@@ -34,7 +34,21 @@ public function __construct(Auth $auth, Config $config = null)
34
34
*/
35
35
public function buckets ($ shared = true )
36
36
{
37
- return $ this ->rsGet ('/buckets?shared= ' . $ shared );
37
+ $ includeShared = "false " ;
38
+ if ($ shared === true ) {
39
+ $ includeShared = "true " ;
40
+ }
41
+ return $ this ->rsGet ('/buckets?shared= ' . $ includeShared );
42
+ }
43
+
44
+ /**
45
+ * 获取指定空间绑定的所有的域名
46
+ *
47
+ * @return string[] 包含所有空间域名
48
+ */
49
+ public function domains ($ bucket )
50
+ {
51
+ return $ this ->apiGet ('/v6/domain/list?tbl= ' . $ bucket );
38
52
}
39
53
40
54
/**
@@ -148,7 +162,7 @@ public function copy($from_bucket, $from_key, $to_bucket, $to_key, $force = fals
148
162
$ from = \Qiniu \entry ($ from_bucket , $ from_key );
149
163
$ to = \Qiniu \entry ($ to_bucket , $ to_key );
150
164
$ path = '/copy/ ' . $ from . '/ ' . $ to ;
151
- if ($ force ) {
165
+ if ($ force === true ) {
152
166
$ path .= '/force/true ' ;
153
167
}
154
168
list (, $ error ) = $ this ->rsPost ($ path );
@@ -310,8 +324,8 @@ public function batch($operations)
310
324
public function deleteAfterDays ($ bucket , $ key , $ days )
311
325
{
312
326
$ entry = \Qiniu \entry ($ bucket , $ key );
313
- $ url = "/deleteAfterDays/ $ entry/ $ days " ;
314
- list (, $ error ) = $ this ->rsPost ($ url );
327
+ $ path = "/deleteAfterDays/ $ entry/ $ days " ;
328
+ list (, $ error ) = $ this ->rsPost ($ path );
315
329
return $ error ;
316
330
}
317
331
@@ -333,18 +347,33 @@ private function getRsHost()
333
347
return $ scheme . Config::RS_HOST ;
334
348
}
335
349
350
+ private function getApiHost ()
351
+ {
352
+ $ scheme = "http:// " ;
353
+ if ($ this ->config ->useHTTPS == true ) {
354
+ $ scheme = "https:// " ;
355
+ }
356
+ return $ scheme . Config::API_HOST ;
357
+ }
358
+
336
359
private function rsPost ($ path , $ body = null )
337
360
{
338
361
$ url = $ this ->getRsHost () . $ path ;
339
362
return $ this ->post ($ url , $ body );
340
363
}
341
364
365
+ private function apiGet ($ path )
366
+ {
367
+ $ url = $ this ->getApiHost () . $ path ;
368
+ return $ this ->get ($ url );
369
+ }
370
+
342
371
private function rsGet ($ path )
343
372
{
344
373
$ url = $ this ->getRsHost () . $ path ;
345
374
return $ this ->get ($ url );
346
375
}
347
-
376
+
348
377
private function get ($ url )
349
378
{
350
379
$ headers = $ this ->auth ->authorization ($ url );
0 commit comments