1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\Webmasters\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Webmasters\SitesListResponse;
|
---|
21 | use Google\Service\Webmasters\WmxSite;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "sites" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $webmastersService = new Google\Service\Webmasters(...);
|
---|
28 | * $sites = $webmastersService->sites;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class Sites extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Adds a site to the set of the user's sites in Search Console. (sites.add)
|
---|
35 | *
|
---|
36 | * @param string $siteUrl The URL of the site to add.
|
---|
37 | * @param array $optParams Optional parameters.
|
---|
38 | */
|
---|
39 | public function add($siteUrl, $optParams = [])
|
---|
40 | {
|
---|
41 | $params = ['siteUrl' => $siteUrl];
|
---|
42 | $params = array_merge($params, $optParams);
|
---|
43 | return $this->call('add', [$params]);
|
---|
44 | }
|
---|
45 | /**
|
---|
46 | * Removes a site from the set of the user's Search Console sites.
|
---|
47 | * (sites.delete)
|
---|
48 | *
|
---|
49 | * @param string $siteUrl The URI of the property as defined in Search Console.
|
---|
50 | * Examples: http://www.example.com/ or android-app://com.example/ Note: for
|
---|
51 | * property-sets, use the URI that starts with sc-set: which is used in Search
|
---|
52 | * Console URLs.
|
---|
53 | * @param array $optParams Optional parameters.
|
---|
54 | */
|
---|
55 | public function delete($siteUrl, $optParams = [])
|
---|
56 | {
|
---|
57 | $params = ['siteUrl' => $siteUrl];
|
---|
58 | $params = array_merge($params, $optParams);
|
---|
59 | return $this->call('delete', [$params]);
|
---|
60 | }
|
---|
61 | /**
|
---|
62 | * Retrieves information about specific site. (sites.get)
|
---|
63 | *
|
---|
64 | * @param string $siteUrl The URI of the property as defined in Search Console.
|
---|
65 | * Examples: http://www.example.com/ or android-app://com.example/ Note: for
|
---|
66 | * property-sets, use the URI that starts with sc-set: which is used in Search
|
---|
67 | * Console URLs.
|
---|
68 | * @param array $optParams Optional parameters.
|
---|
69 | * @return WmxSite
|
---|
70 | */
|
---|
71 | public function get($siteUrl, $optParams = [])
|
---|
72 | {
|
---|
73 | $params = ['siteUrl' => $siteUrl];
|
---|
74 | $params = array_merge($params, $optParams);
|
---|
75 | return $this->call('get', [$params], WmxSite::class);
|
---|
76 | }
|
---|
77 | /**
|
---|
78 | * Lists the user's Search Console sites. (sites.listSites)
|
---|
79 | *
|
---|
80 | * @param array $optParams Optional parameters.
|
---|
81 | * @return SitesListResponse
|
---|
82 | */
|
---|
83 | public function listSites($optParams = [])
|
---|
84 | {
|
---|
85 | $params = [];
|
---|
86 | $params = array_merge($params, $optParams);
|
---|
87 | return $this->call('list', [$params], SitesListResponse::class);
|
---|
88 | }
|
---|
89 | }
|
---|
90 |
|
---|
91 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
92 | class_alias(Sites::class, 'Google_Service_Webmasters_Resource_Sites');
|
---|