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\Reseller\Resource;
19
20use Google\Service\Reseller\Customer;
21
22/**
23 * The "customers" collection of methods.
24 * Typical usage is:
25 *  <code>
26 *   $resellerService = new Google\Service\Reseller(...);
27 *   $customers = $resellerService->customers;
28 *  </code>
29 */
30class Customers extends \Google\Service\Resource
31{
32  /**
33   * Gets a customer account. Use this operation to see a customer account already
34   * in your reseller management, or to see the minimal account information for an
35   * existing customer that you do not manage. For more information about the API
36   * response for existing customers, see [retrieving a customer account](/admin-
37   * sdk/reseller/v1/how-tos/manage_customers#get_customer). (customers.get)
38   *
39   * @param string $customerId This can be either the customer's primary domain
40   * name or the customer's unique identifier. If the domain name for a customer
41   * changes, the old domain name cannot be used to access the customer, but the
42   * customer's unique identifier (as returned by the API) can always be used. We
43   * recommend storing the unique identifier in your systems where applicable.
44   * @param array $optParams Optional parameters.
45   * @return Customer
46   */
47  public function get($customerId, $optParams = [])
48  {
49    $params = ['customerId' => $customerId];
50    $params = array_merge($params, $optParams);
51    return $this->call('get', [$params], Customer::class);
52  }
53  /**
54   * Orders a new customer's account. Before ordering a new customer account,
55   * establish whether the customer account already exists using the
56   * [`customers.get`](/admin-sdk/reseller/v1/reference/customers/get) If the
57   * customer account exists as a direct Google account or as a resold customer
58   * account from another reseller, use the `customerAuthToken\` as described in
59   * [order a resold account for an existing customer](/admin-sdk/reseller/v1/how-
60   * tos/manage_customers#create_existing_customer). For more information about
61   * ordering a new customer account, see [order a new customer account](/admin-
62   * sdk/reseller/v1/how-tos/manage_customers#create_customer). After creating a
63   * new customer account, you must provision a user as an administrator. The
64   * customer's administrator is required to sign in to the Admin console and sign
65   * the G Suite via Reseller agreement to activate the account. Resellers are
66   * prohibited from signing the G Suite via Reseller agreement on the customer's
67   * behalf. For more information, see [order a new customer account](/admin-
68   * sdk/reseller/v1/how-tos/manage_customers#tos). (customers.insert)
69   *
70   * @param Customer $postBody
71   * @param array $optParams Optional parameters.
72   *
73   * @opt_param string customerAuthToken The `customerAuthToken` query string is
74   * required when creating a resold account that transfers a direct customer's
75   * subscription or transfers another reseller customer's subscription to your
76   * reseller management. This is a hexadecimal authentication token needed to
77   * complete the subscription transfer. For more information, see the
78   * administrator help center.
79   * @return Customer
80   */
81  public function insert(Customer $postBody, $optParams = [])
82  {
83    $params = ['postBody' => $postBody];
84    $params = array_merge($params, $optParams);
85    return $this->call('insert', [$params], Customer::class);
86  }
87  /**
88   * Updates a customer account's settings. This method supports patch semantics.
89   * You cannot update `customerType` via the Reseller API, but a `"team"`
90   * customer can verify their domain and become `customerType = "domain"`. For
91   * more information, see [Verify your domain to unlock Essentials
92   * features](https://support.google.com/a/answer/9122284). (customers.patch)
93   *
94   * @param string $customerId This can be either the customer's primary domain
95   * name or the customer's unique identifier. If the domain name for a customer
96   * changes, the old domain name cannot be used to access the customer, but the
97   * customer's unique identifier (as returned by the API) can always be used. We
98   * recommend storing the unique identifier in your systems where applicable.
99   * @param Customer $postBody
100   * @param array $optParams Optional parameters.
101   * @return Customer
102   */
103  public function patch($customerId, Customer $postBody, $optParams = [])
104  {
105    $params = ['customerId' => $customerId, 'postBody' => $postBody];
106    $params = array_merge($params, $optParams);
107    return $this->call('patch', [$params], Customer::class);
108  }
109  /**
110   * Updates a customer account's settings. You cannot update `customerType` via
111   * the Reseller API, but a `"team"` customer can verify their domain and become
112   * `customerType = "domain"`. For more information, see [update a customer's
113   * settings](/admin-sdk/reseller/v1/how-tos/manage_customers#update_customer).
114   * (customers.update)
115   *
116   * @param string $customerId This can be either the customer's primary domain
117   * name or the customer's unique identifier. If the domain name for a customer
118   * changes, the old domain name cannot be used to access the customer, but the
119   * customer's unique identifier (as returned by the API) can always be used. We
120   * recommend storing the unique identifier in your systems where applicable.
121   * @param Customer $postBody
122   * @param array $optParams Optional parameters.
123   * @return Customer
124   */
125  public function update($customerId, Customer $postBody, $optParams = [])
126  {
127    $params = ['customerId' => $customerId, 'postBody' => $postBody];
128    $params = array_merge($params, $optParams);
129    return $this->call('update', [$params], Customer::class);
130  }
131}
132
133// Adding a class alias for backwards compatibility with the previous class name.
134class_alias(Customers::class, 'Google_Service_Reseller_Resource_Customers');
135