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\Apigee\Resource;
19
20use Google\Service\Apigee\GoogleCloudApigeeV1Attributes;
21use Google\Service\Apigee\GoogleCloudApigeeV1Developer;
22use Google\Service\Apigee\GoogleCloudApigeeV1DeveloperBalance;
23use Google\Service\Apigee\GoogleCloudApigeeV1DeveloperMonetizationConfig;
24use Google\Service\Apigee\GoogleCloudApigeeV1ListOfDevelopersResponse;
25use Google\Service\Apigee\GoogleProtobufEmpty;
26
27/**
28 * The "developers" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $apigeeService = new Google\Service\Apigee(...);
32 *   $developers = $apigeeService->developers;
33 *  </code>
34 */
35class OrganizationsDevelopers extends \Google\Service\Resource
36{
37  /**
38   * Updates developer attributes. This API replaces the existing attributes with
39   * those specified in the request. Add new attributes, and include or exclude
40   * any existing attributes that you want to retain or remove, respectively. The
41   * custom attribute limit is 18. **Note**: OAuth access tokens and Key
42   * Management Service (KMS) entities (apps, developers, and API products) are
43   * cached for 180 seconds (default). Any custom attributes associated with these
44   * entities are cached for at least 180 seconds after the entity is accessed at
45   * runtime. Therefore, an `ExpiresIn` element on the OAuthV2 policy won't be
46   * able to expire an access token in less than 180 seconds.
47   * (developers.attributes)
48   *
49   * @param string $parent Required. Email address of the developer for which
50   * attributes are being updated. Use the following structure in your request:
51   * `organizations/{org}/developers/{developer_email}`
52   * @param GoogleCloudApigeeV1Attributes $postBody
53   * @param array $optParams Optional parameters.
54   * @return GoogleCloudApigeeV1Attributes
55   */
56  public function attributes($parent, GoogleCloudApigeeV1Attributes $postBody, $optParams = [])
57  {
58    $params = ['parent' => $parent, 'postBody' => $postBody];
59    $params = array_merge($params, $optParams);
60    return $this->call('attributes', [$params], GoogleCloudApigeeV1Attributes::class);
61  }
62  /**
63   * Creates a developer. Once created, the developer can register an app and
64   * obtain an API key. At creation time, a developer is set as `active`. To
65   * change the developer status, use the SetDeveloperStatus API.
66   * (developers.create)
67   *
68   * @param string $parent Required. Name of the Apigee organization in which the
69   * developer is created. Use the following structure in your request:
70   * `organizations/{org}`.
71   * @param GoogleCloudApigeeV1Developer $postBody
72   * @param array $optParams Optional parameters.
73   * @return GoogleCloudApigeeV1Developer
74   */
75  public function create($parent, GoogleCloudApigeeV1Developer $postBody, $optParams = [])
76  {
77    $params = ['parent' => $parent, 'postBody' => $postBody];
78    $params = array_merge($params, $optParams);
79    return $this->call('create', [$params], GoogleCloudApigeeV1Developer::class);
80  }
81  /**
82   * Deletes a developer. All apps and API keys associated with the developer are
83   * also removed. **Warning**: This API will permanently delete the developer and
84   * related artifacts. To avoid permanently deleting developers and their
85   * artifacts, set the developer status to `inactive` using the
86   * SetDeveloperStatus API. **Note**: The delete operation is asynchronous. The
87   * developer app is deleted immediately, but its associated resources, such as
88   * apps and API keys, may take anywhere from a few seconds to a few minutes to
89   * be deleted. (developers.delete)
90   *
91   * @param string $name Required. Email address of the developer. Use the
92   * following structure in your request:
93   * `organizations/{org}/developers/{developer_email}`
94   * @param array $optParams Optional parameters.
95   * @return GoogleCloudApigeeV1Developer
96   */
97  public function delete($name, $optParams = [])
98  {
99    $params = ['name' => $name];
100    $params = array_merge($params, $optParams);
101    return $this->call('delete', [$params], GoogleCloudApigeeV1Developer::class);
102  }
103  /**
104   * Returns the developer details, including the developer's name, email address,
105   * apps, and other information. **Note**: The response includes only the first
106   * 100 developer apps. (developers.get)
107   *
108   * @param string $name Required. Email address of the developer. Use the
109   * following structure in your request:
110   * `organizations/{org}/developers/{developer_email}`
111   * @param array $optParams Optional parameters.
112   *
113   * @opt_param string action Status of the developer. Valid values are `active`
114   * or `inactive`.
115   * @return GoogleCloudApigeeV1Developer
116   */
117  public function get($name, $optParams = [])
118  {
119    $params = ['name' => $name];
120    $params = array_merge($params, $optParams);
121    return $this->call('get', [$params], GoogleCloudApigeeV1Developer::class);
122  }
123  /**
124   * Gets the account balance for the developer. (developers.getBalance)
125   *
126   * @param string $name Required. Account balance for the developer. Use the
127   * following structure in your request:
128   * `organizations/{org}/developers/{developer}/balance`
129   * @param array $optParams Optional parameters.
130   * @return GoogleCloudApigeeV1DeveloperBalance
131   */
132  public function getBalance($name, $optParams = [])
133  {
134    $params = ['name' => $name];
135    $params = array_merge($params, $optParams);
136    return $this->call('getBalance', [$params], GoogleCloudApigeeV1DeveloperBalance::class);
137  }
138  /**
139   * Gets the monetization configuration for the developer.
140   * (developers.getMonetizationConfig)
141   *
142   * @param string $name Required. Monetization configuration for the developer.
143   * Use the following structure in your request:
144   * `organizations/{org}/developers/{developer}/monetizationConfig`
145   * @param array $optParams Optional parameters.
146   * @return GoogleCloudApigeeV1DeveloperMonetizationConfig
147   */
148  public function getMonetizationConfig($name, $optParams = [])
149  {
150    $params = ['name' => $name];
151    $params = array_merge($params, $optParams);
152    return $this->call('getMonetizationConfig', [$params], GoogleCloudApigeeV1DeveloperMonetizationConfig::class);
153  }
154  /**
155   * Lists all developers in an organization by email address. By default, the
156   * response does not include company developers. Set the `includeCompany` query
157   * parameter to `true` to include company developers. **Note**: A maximum of
158   * 1000 developers are returned in the response. You paginate the list of
159   * developers returned using the `startKey` and `count` query parameters.
160   * (developers.listOrganizationsDevelopers)
161   *
162   * @param string $parent Required. Name of the Apigee organization. Use the
163   * following structure in your request: `organizations/{org}`.
164   * @param array $optParams Optional parameters.
165   *
166   * @opt_param string app Optional. List only Developers that are associated with
167   * the app. Note that start_key, count are not applicable for this filter
168   * criteria.
169   * @opt_param string count Optional. Number of developers to return in the API
170   * call. Use with the `startKey` parameter to provide more targeted filtering.
171   * The limit is 1000.
172   * @opt_param bool expand Specifies whether to expand the results. Set to `true`
173   * to expand the results. This query parameter is not valid if you use the
174   * `count` or `startKey` query parameters.
175   * @opt_param string ids Optional. List of IDs to include, separated by commas.
176   * @opt_param bool includeCompany Flag that specifies whether to include company
177   * details in the response.
178   * @opt_param string startKey **Note**: Must be used in conjunction with the
179   * `count` parameter. Email address of the developer from which to start
180   * displaying the list of developers. For example, if the an unfiltered list
181   * returns: ``` westley@example.com fezzik@example.com buttercup@example.com ```
182   * and your `startKey` is `fezzik@example.com`, the list returned will be ```
183   * fezzik@example.com buttercup@example.com ```
184   * @return GoogleCloudApigeeV1ListOfDevelopersResponse
185   */
186  public function listOrganizationsDevelopers($parent, $optParams = [])
187  {
188    $params = ['parent' => $parent];
189    $params = array_merge($params, $optParams);
190    return $this->call('list', [$params], GoogleCloudApigeeV1ListOfDevelopersResponse::class);
191  }
192  /**
193   * Sets the status of a developer. A developer is `active` by default. If you
194   * set a developer's status to `inactive`, the API keys assigned to the
195   * developer apps are no longer valid even though the API keys are set to
196   * `approved`. Inactive developers can still sign in to the developer portal and
197   * create apps; however, any new API keys generated during app creation won't
198   * work. To set the status of a developer, set the `action` query parameter to
199   * `active` or `inactive`, and the `Content-Type` header to `application/octet-
200   * stream`. If successful, the API call returns the following HTTP status code:
201   * `204 No Content` (developers.setDeveloperStatus)
202   *
203   * @param string $name Required. Name of the developer. Use the following
204   * structure in your request: `organizations/{org}/developers/{developer_id}`
205   * @param array $optParams Optional parameters.
206   *
207   * @opt_param string action Status of the developer. Valid values are `active`
208   * and `inactive`.
209   * @return GoogleProtobufEmpty
210   */
211  public function setDeveloperStatus($name, $optParams = [])
212  {
213    $params = ['name' => $name];
214    $params = array_merge($params, $optParams);
215    return $this->call('setDeveloperStatus', [$params], GoogleProtobufEmpty::class);
216  }
217  /**
218   * Updates a developer. This API replaces the existing developer details with
219   * those specified in the request. Include or exclude any existing details that
220   * you want to retain or delete, respectively. The custom attribute limit is 18.
221   * **Note**: OAuth access tokens and Key Management Service (KMS) entities
222   * (apps, developers, and API products) are cached for 180 seconds (current
223   * default). Any custom attributes associated with these entities are cached for
224   * at least 180 seconds after the entity is accessed at runtime. Therefore, an
225   * `ExpiresIn` element on the OAuthV2 policy won't be able to expire an access
226   * token in less than 180 seconds. (developers.update)
227   *
228   * @param string $name Required. Email address of the developer. Use the
229   * following structure in your request:
230   * `organizations/{org}/developers/{developer_email}`
231   * @param GoogleCloudApigeeV1Developer $postBody
232   * @param array $optParams Optional parameters.
233   * @return GoogleCloudApigeeV1Developer
234   */
235  public function update($name, GoogleCloudApigeeV1Developer $postBody, $optParams = [])
236  {
237    $params = ['name' => $name, 'postBody' => $postBody];
238    $params = array_merge($params, $optParams);
239    return $this->call('update', [$params], GoogleCloudApigeeV1Developer::class);
240  }
241  /**
242   * Updates the monetization configuration for the developer.
243   * (developers.updateMonetizationConfig)
244   *
245   * @param string $name Required. Monetization configuration for the developer.
246   * Use the following structure in your request:
247   * `organizations/{org}/developers/{developer}/monetizationConfig`
248   * @param GoogleCloudApigeeV1DeveloperMonetizationConfig $postBody
249   * @param array $optParams Optional parameters.
250   * @return GoogleCloudApigeeV1DeveloperMonetizationConfig
251   */
252  public function updateMonetizationConfig($name, GoogleCloudApigeeV1DeveloperMonetizationConfig $postBody, $optParams = [])
253  {
254    $params = ['name' => $name, 'postBody' => $postBody];
255    $params = array_merge($params, $optParams);
256    return $this->call('updateMonetizationConfig', [$params], GoogleCloudApigeeV1DeveloperMonetizationConfig::class);
257  }
258}
259
260// Adding a class alias for backwards compatibility with the previous class name.
261class_alias(OrganizationsDevelopers::class, 'Google_Service_Apigee_Resource_OrganizationsDevelopers');
262