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
18namespace Google\Service\AdSenseHost\Resource;
19
20use 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 */
30class 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   */
47  public function start($productCode, $websiteUrl, $optParams = [])
48  {
49    $params = ['productCode' => $productCode, 'websiteUrl' => $websiteUrl];
50    $params = array_merge($params, $optParams);
51    return $this->call('start', [$params], AssociationSession::class);
52  }
53  /**
54   * Verify an association session after the association callback returns from
55   * AdSense signup. (associationsessions.verify)
56   *
57   * @param string $token The token returned to the association callback URL.
58   * @param array $optParams Optional parameters.
59   * @return AssociationSession
60   */
61  public function verify($token, $optParams = [])
62  {
63    $params = ['token' => $token];
64    $params = array_merge($params, $optParams);
65    return $this->call('verify', [$params], AssociationSession::class);
66  }
67}
68
69// Adding a class alias for backwards compatibility with the previous class name.
70class_alias(Associationsessions::class, 'Google_Service_AdSenseHost_Resource_Associationsessions');
71