1 | <?php |
||
30 | class Temporary extends AbstractAPI |
||
31 | { |
||
32 | /** |
||
33 | * Allow media type. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $allowTypes = ['image', 'voice', 'video', 'thumb']; |
||
38 | |||
39 | const API_GET = 'https://api.weixin.qq.com/cgi-bin/media/get'; |
||
40 | const API_UPLOAD = 'https://api.weixin.qq.com/cgi-bin/media/upload'; |
||
41 | |||
42 | /** |
||
43 | * Download temporary material. |
||
44 | * |
||
45 | * @param string $mediaId |
||
46 | * @param string $directory |
||
47 | * @param string $filename |
||
48 | * |
||
49 | * @return string |
||
50 | * |
||
51 | * @throws InvalidArgumentException |
||
52 | */ |
||
53 | 1 | public function download($mediaId, $directory, $filename = '') |
|
69 | |||
70 | /** |
||
71 | * Fetch item from WeChat server. |
||
72 | * |
||
73 | * @param string $mediaId |
||
74 | * |
||
75 | * @return mixed |
||
76 | * |
||
77 | * @throws \EasyWeChat\Core\Exceptions\RuntimeException |
||
78 | */ |
||
79 | public function getStream($mediaId) |
||
85 | |||
86 | /** |
||
87 | * Upload temporary material. |
||
88 | * |
||
89 | * @param string $type |
||
90 | * @param string $path |
||
91 | * |
||
92 | * @return string |
||
93 | * |
||
94 | * @throws \EasyWeChat\Core\Exceptions\InvalidArgumentException |
||
95 | */ |
||
96 | 2 | public function upload($type, $path) |
|
108 | |||
109 | /** |
||
110 | * Upload image. |
||
111 | * |
||
112 | * @param $path |
||
113 | * |
||
114 | * @return string |
||
115 | * |
||
116 | * @throws \EasyWeChat\Core\Exceptions\InvalidArgumentException |
||
117 | */ |
||
118 | 1 | public function uploadImage($path) |
|
122 | |||
123 | /** |
||
124 | * Upload video. |
||
125 | * |
||
126 | * @param $path |
||
127 | * |
||
128 | * @return string |
||
129 | * |
||
130 | * @throws \EasyWeChat\Core\Exceptions\InvalidArgumentException |
||
131 | */ |
||
132 | 1 | public function uploadVideo($path) |
|
136 | |||
137 | /** |
||
138 | * Upload voice. |
||
139 | * |
||
140 | * @param $path |
||
141 | * |
||
142 | * @return string |
||
143 | * |
||
144 | * @throws \EasyWeChat\Core\Exceptions\InvalidArgumentException |
||
145 | */ |
||
146 | 1 | public function uploadVoice($path) |
|
150 | |||
151 | /** |
||
152 | * Upload thumb. |
||
153 | * |
||
154 | * @param $path |
||
155 | * |
||
156 | * @return string |
||
157 | * |
||
158 | * @throws \EasyWeChat\Core\Exceptions\InvalidArgumentException |
||
159 | */ |
||
160 | 1 | public function uploadThumb($path) |
|
164 | } |
||
165 |