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\AndroidProvisioningPartner\Resource;
19
20use Google\Service\AndroidProvisioningPartner\AndroiddeviceprovisioningEmpty;
21use Google\Service\AndroidProvisioningPartner\ClaimDeviceRequest;
22use Google\Service\AndroidProvisioningPartner\ClaimDeviceResponse;
23use Google\Service\AndroidProvisioningPartner\ClaimDevicesRequest;
24use Google\Service\AndroidProvisioningPartner\Device;
25use Google\Service\AndroidProvisioningPartner\DeviceMetadata;
26use Google\Service\AndroidProvisioningPartner\FindDevicesByDeviceIdentifierRequest;
27use Google\Service\AndroidProvisioningPartner\FindDevicesByDeviceIdentifierResponse;
28use Google\Service\AndroidProvisioningPartner\FindDevicesByOwnerRequest;
29use Google\Service\AndroidProvisioningPartner\FindDevicesByOwnerResponse;
30use Google\Service\AndroidProvisioningPartner\Operation;
31use Google\Service\AndroidProvisioningPartner\UnclaimDeviceRequest;
32use Google\Service\AndroidProvisioningPartner\UnclaimDevicesRequest;
33use Google\Service\AndroidProvisioningPartner\UpdateDeviceMetadataInBatchRequest;
34use Google\Service\AndroidProvisioningPartner\UpdateDeviceMetadataRequest;
35
36/**
37 * The "devices" collection of methods.
38 * Typical usage is:
39 *  <code>
40 *   $androiddeviceprovisioningService = new Google\Service\AndroidProvisioningPartner(...);
41 *   $devices = $androiddeviceprovisioningService->devices;
42 *  </code>
43 */
44class PartnersDevices extends \Google\Service\Resource
45{
46  /**
47   * Claims a device for a customer and adds it to zero-touch enrollment. If the
48   * device is already claimed by another customer, the call returns an error.
49   * (devices.claim)
50   *
51   * @param string $partnerId Required. The ID of the reseller partner.
52   * @param ClaimDeviceRequest $postBody
53   * @param array $optParams Optional parameters.
54   * @return ClaimDeviceResponse
55   */
56  public function claim($partnerId, ClaimDeviceRequest $postBody, $optParams = [])
57  {
58    $params = ['partnerId' => $partnerId, 'postBody' => $postBody];
59    $params = array_merge($params, $optParams);
60    return $this->call('claim', [$params], ClaimDeviceResponse::class);
61  }
62  /**
63   * Claims a batch of devices for a customer asynchronously. Adds the devices to
64   * zero-touch enrollment. To learn more, read [Long‑running batch operations
65   * ](/zero-touch/guides/how-it-works#operations). (devices.claimAsync)
66   *
67   * @param string $partnerId Required. The ID of the reseller partner.
68   * @param ClaimDevicesRequest $postBody
69   * @param array $optParams Optional parameters.
70   * @return Operation
71   */
72  public function claimAsync($partnerId, ClaimDevicesRequest $postBody, $optParams = [])
73  {
74    $params = ['partnerId' => $partnerId, 'postBody' => $postBody];
75    $params = array_merge($params, $optParams);
76    return $this->call('claimAsync', [$params], Operation::class);
77  }
78  /**
79   * Finds devices by hardware identifiers, such as IMEI.
80   * (devices.findByIdentifier)
81   *
82   * @param string $partnerId Required. The ID of the reseller partner.
83   * @param FindDevicesByDeviceIdentifierRequest $postBody
84   * @param array $optParams Optional parameters.
85   * @return FindDevicesByDeviceIdentifierResponse
86   */
87  public function findByIdentifier($partnerId, FindDevicesByDeviceIdentifierRequest $postBody, $optParams = [])
88  {
89    $params = ['partnerId' => $partnerId, 'postBody' => $postBody];
90    $params = array_merge($params, $optParams);
91    return $this->call('findByIdentifier', [$params], FindDevicesByDeviceIdentifierResponse::class);
92  }
93  /**
94   * Finds devices claimed for customers. The results only contain devices
95   * registered to the reseller that's identified by the `partnerId` argument. The
96   * customer's devices purchased from other resellers don't appear in the
97   * results. (devices.findByOwner)
98   *
99   * @param string $partnerId Required. The ID of the reseller partner.
100   * @param FindDevicesByOwnerRequest $postBody
101   * @param array $optParams Optional parameters.
102   * @return FindDevicesByOwnerResponse
103   */
104  public function findByOwner($partnerId, FindDevicesByOwnerRequest $postBody, $optParams = [])
105  {
106    $params = ['partnerId' => $partnerId, 'postBody' => $postBody];
107    $params = array_merge($params, $optParams);
108    return $this->call('findByOwner', [$params], FindDevicesByOwnerResponse::class);
109  }
110  /**
111   * Gets a device. (devices.get)
112   *
113   * @param string $name Required. The device API resource name in the format
114   * `partners/[PARTNER_ID]/devices/[DEVICE_ID]`.
115   * @param array $optParams Optional parameters.
116   * @return Device
117   */
118  public function get($name, $optParams = [])
119  {
120    $params = ['name' => $name];
121    $params = array_merge($params, $optParams);
122    return $this->call('get', [$params], Device::class);
123  }
124  /**
125   * Updates reseller metadata associated with the device. (devices.metadata)
126   *
127   * @param string $metadataOwnerId Required. The owner of the newly set metadata.
128   * Set this to the partner ID.
129   * @param string $deviceId Required. The ID of the device.
130   * @param UpdateDeviceMetadataRequest $postBody
131   * @param array $optParams Optional parameters.
132   * @return DeviceMetadata
133   */
134  public function metadata($metadataOwnerId, $deviceId, UpdateDeviceMetadataRequest $postBody, $optParams = [])
135  {
136    $params = ['metadataOwnerId' => $metadataOwnerId, 'deviceId' => $deviceId, 'postBody' => $postBody];
137    $params = array_merge($params, $optParams);
138    return $this->call('metadata', [$params], DeviceMetadata::class);
139  }
140  /**
141   * Unclaims a device from a customer and removes it from zero-touch enrollment.
142   * (devices.unclaim)
143   *
144   * @param string $partnerId Required. The ID of the reseller partner.
145   * @param UnclaimDeviceRequest $postBody
146   * @param array $optParams Optional parameters.
147   * @return AndroiddeviceprovisioningEmpty
148   */
149  public function unclaim($partnerId, UnclaimDeviceRequest $postBody, $optParams = [])
150  {
151    $params = ['partnerId' => $partnerId, 'postBody' => $postBody];
152    $params = array_merge($params, $optParams);
153    return $this->call('unclaim', [$params], AndroiddeviceprovisioningEmpty::class);
154  }
155  /**
156   * Unclaims a batch of devices for a customer asynchronously. Removes the
157   * devices from zero-touch enrollment. To learn more, read [Long‑running batch
158   * operations](/zero-touch/guides/how-it-works#operations).
159   * (devices.unclaimAsync)
160   *
161   * @param string $partnerId Required. The reseller partner ID.
162   * @param UnclaimDevicesRequest $postBody
163   * @param array $optParams Optional parameters.
164   * @return Operation
165   */
166  public function unclaimAsync($partnerId, UnclaimDevicesRequest $postBody, $optParams = [])
167  {
168    $params = ['partnerId' => $partnerId, 'postBody' => $postBody];
169    $params = array_merge($params, $optParams);
170    return $this->call('unclaimAsync', [$params], Operation::class);
171  }
172  /**
173   * Updates the reseller metadata attached to a batch of devices. This method
174   * updates devices asynchronously and returns an `Operation` that can be used to
175   * track progress. Read [Long‑running batch operations](/zero-touch/guides/how-
176   * it-works#operations). (devices.updateMetadataAsync)
177   *
178   * @param string $partnerId Required. The reseller partner ID.
179   * @param UpdateDeviceMetadataInBatchRequest $postBody
180   * @param array $optParams Optional parameters.
181   * @return Operation
182   */
183  public function updateMetadataAsync($partnerId, UpdateDeviceMetadataInBatchRequest $postBody, $optParams = [])
184  {
185    $params = ['partnerId' => $partnerId, 'postBody' => $postBody];
186    $params = array_merge($params, $optParams);
187    return $this->call('updateMetadataAsync', [$params], Operation::class);
188  }
189}
190
191// Adding a class alias for backwards compatibility with the previous class name.
192class_alias(PartnersDevices::class, 'Google_Service_AndroidProvisioningPartner_Resource_PartnersDevices');
193