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\AdSenseHost\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\AdSenseHost\AssociationSession;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * The "associationsessions" collection of methods.
|
---|
24 | * Typical usage is:
|
---|
25 | * <code>
|
---|
26 | * $adsensehostService = new Google\Service\AdSenseHost(...);
|
---|
27 | * $associationsessions = $adsensehostService->associationsessions;
|
---|
28 | * </code>
|
---|
29 | */
|
---|
30 | class Associationsessions extends \Google\Service\Resource
|
---|
31 | {
|
---|
32 | /**
|
---|
33 | * Create an association session for initiating an association with an AdSense
|
---|
34 | * user. (associationsessions.start)
|
---|
35 | *
|
---|
36 | * @param string|array $productCode Products to associate with the user.
|
---|
37 | * @param string $websiteUrl The URL of the user's hosted website.
|
---|
38 | * @param array $optParams Optional parameters.
|
---|
39 | *
|
---|
40 | * @opt_param string callbackUrl The URL to redirect the user to once
|
---|
41 | * association is completed. It receives a token parameter that can then be used
|
---|
42 | * to retrieve the associated account.
|
---|
43 | * @opt_param string userLocale The preferred locale of the user.
|
---|
44 | * @opt_param string websiteLocale The locale of the user's hosted website.
|
---|
45 | * @return AssociationSession
|
---|
46 | * @throws \Google\Service\Exception
|
---|
47 | */
|
---|
48 | public function start($productCode, $websiteUrl, $optParams = [])
|
---|
49 | {
|
---|
50 | $params = ['productCode' => $productCode, 'websiteUrl' => $websiteUrl];
|
---|
51 | $params = array_merge($params, $optParams);
|
---|
52 | return $this->call('start', [$params], AssociationSession::class);
|
---|
53 | }
|
---|
54 | /**
|
---|
55 | * Verify an association session after the association callback returns from
|
---|
56 | * AdSense signup. (associationsessions.verify)
|
---|
57 | *
|
---|
58 | * @param string $token The token returned to the association callback URL.
|
---|
59 | * @param array $optParams Optional parameters.
|
---|
60 | * @return AssociationSession
|
---|
61 | * @throws \Google\Service\Exception
|
---|
62 | */
|
---|
63 | public function verify($token, $optParams = [])
|
---|
64 | {
|
---|
65 | $params = ['token' => $token];
|
---|
66 | $params = array_merge($params, $optParams);
|
---|
67 | return $this->call('verify', [$params], AssociationSession::class);
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|
71 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
72 | class_alias(Associationsessions::class, 'Google_Service_AdSenseHost_Resource_Associationsessions');
|
---|