google-apis-mybusinessaccountmanagement_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module MybusinessaccountmanagementV1
18
+ # Version of the google-apis-mybusinessaccountmanagement_v1 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.2"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20210217"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,230 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module MybusinessaccountmanagementV1
24
+
25
+ class AcceptInvitationRequest
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class Account
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class Admin
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class DeclineInvitationRequest
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class Empty
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class Invitation
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class ListAccountAdminsResponse
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class ListAccountsResponse
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class ListInvitationsResponse
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class ListLocationAdminsResponse
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class OrganizationInfo
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class PostalAddress
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class TargetLocation
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ include Google::Apis::Core::JsonObjectSupport
101
+ end
102
+
103
+ class AcceptInvitationRequest
104
+ # @private
105
+ class Representation < Google::Apis::Core::JsonRepresentation
106
+ end
107
+ end
108
+
109
+ class Account
110
+ # @private
111
+ class Representation < Google::Apis::Core::JsonRepresentation
112
+ property :account_name, as: 'accountName'
113
+ property :account_number, as: 'accountNumber'
114
+ property :name, as: 'name'
115
+ property :organization_info, as: 'organizationInfo', class: Google::Apis::MybusinessaccountmanagementV1::OrganizationInfo, decorator: Google::Apis::MybusinessaccountmanagementV1::OrganizationInfo::Representation
116
+
117
+ property :permission_level, as: 'permissionLevel'
118
+ property :primary_owner, as: 'primaryOwner'
119
+ property :role, as: 'role'
120
+ property :type, as: 'type'
121
+ property :verification_state, as: 'verificationState'
122
+ property :vetted_state, as: 'vettedState'
123
+ end
124
+ end
125
+
126
+ class Admin
127
+ # @private
128
+ class Representation < Google::Apis::Core::JsonRepresentation
129
+ property :admin, as: 'admin'
130
+ property :name, as: 'name'
131
+ property :pending_invitation, as: 'pendingInvitation'
132
+ property :role, as: 'role'
133
+ end
134
+ end
135
+
136
+ class DeclineInvitationRequest
137
+ # @private
138
+ class Representation < Google::Apis::Core::JsonRepresentation
139
+ end
140
+ end
141
+
142
+ class Empty
143
+ # @private
144
+ class Representation < Google::Apis::Core::JsonRepresentation
145
+ end
146
+ end
147
+
148
+ class Invitation
149
+ # @private
150
+ class Representation < Google::Apis::Core::JsonRepresentation
151
+ property :name, as: 'name'
152
+ property :role, as: 'role'
153
+ property :target_account, as: 'targetAccount', class: Google::Apis::MybusinessaccountmanagementV1::Account, decorator: Google::Apis::MybusinessaccountmanagementV1::Account::Representation
154
+
155
+ property :target_location, as: 'targetLocation', class: Google::Apis::MybusinessaccountmanagementV1::TargetLocation, decorator: Google::Apis::MybusinessaccountmanagementV1::TargetLocation::Representation
156
+
157
+ property :target_type, as: 'targetType'
158
+ end
159
+ end
160
+
161
+ class ListAccountAdminsResponse
162
+ # @private
163
+ class Representation < Google::Apis::Core::JsonRepresentation
164
+ collection :account_admins, as: 'accountAdmins', class: Google::Apis::MybusinessaccountmanagementV1::Admin, decorator: Google::Apis::MybusinessaccountmanagementV1::Admin::Representation
165
+
166
+ end
167
+ end
168
+
169
+ class ListAccountsResponse
170
+ # @private
171
+ class Representation < Google::Apis::Core::JsonRepresentation
172
+ collection :accounts, as: 'accounts', class: Google::Apis::MybusinessaccountmanagementV1::Account, decorator: Google::Apis::MybusinessaccountmanagementV1::Account::Representation
173
+
174
+ property :next_page_token, as: 'nextPageToken'
175
+ end
176
+ end
177
+
178
+ class ListInvitationsResponse
179
+ # @private
180
+ class Representation < Google::Apis::Core::JsonRepresentation
181
+ collection :invitations, as: 'invitations', class: Google::Apis::MybusinessaccountmanagementV1::Invitation, decorator: Google::Apis::MybusinessaccountmanagementV1::Invitation::Representation
182
+
183
+ end
184
+ end
185
+
186
+ class ListLocationAdminsResponse
187
+ # @private
188
+ class Representation < Google::Apis::Core::JsonRepresentation
189
+ collection :admins, as: 'admins', class: Google::Apis::MybusinessaccountmanagementV1::Admin, decorator: Google::Apis::MybusinessaccountmanagementV1::Admin::Representation
190
+
191
+ end
192
+ end
193
+
194
+ class OrganizationInfo
195
+ # @private
196
+ class Representation < Google::Apis::Core::JsonRepresentation
197
+ property :address, as: 'address', class: Google::Apis::MybusinessaccountmanagementV1::PostalAddress, decorator: Google::Apis::MybusinessaccountmanagementV1::PostalAddress::Representation
198
+
199
+ property :phone_number, as: 'phoneNumber'
200
+ property :registered_domain, as: 'registeredDomain'
201
+ end
202
+ end
203
+
204
+ class PostalAddress
205
+ # @private
206
+ class Representation < Google::Apis::Core::JsonRepresentation
207
+ collection :address_lines, as: 'addressLines'
208
+ property :administrative_area, as: 'administrativeArea'
209
+ property :language_code, as: 'languageCode'
210
+ property :locality, as: 'locality'
211
+ property :organization, as: 'organization'
212
+ property :postal_code, as: 'postalCode'
213
+ collection :recipients, as: 'recipients'
214
+ property :region_code, as: 'regionCode'
215
+ property :revision, as: 'revision'
216
+ property :sorting_code, as: 'sortingCode'
217
+ property :sublocality, as: 'sublocality'
218
+ end
219
+ end
220
+
221
+ class TargetLocation
222
+ # @private
223
+ class Representation < Google::Apis::Core::JsonRepresentation
224
+ property :address, as: 'address'
225
+ property :location_name, as: 'locationName'
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,599 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module MybusinessaccountmanagementV1
23
+ # My Business Account Management API
24
+ #
25
+ # The My Business Account Management API provides an interface for managing
26
+ # access to a location on Google.
27
+ #
28
+ # @example
29
+ # require 'google/apis/mybusinessaccountmanagement_v1'
30
+ #
31
+ # Mybusinessaccountmanagement = Google::Apis::MybusinessaccountmanagementV1 # Alias the module
32
+ # service = Mybusinessaccountmanagement::MyBusinessAccountManagementService.new
33
+ #
34
+ # @see https://developers.google.com/my-business/
35
+ class MyBusinessAccountManagementService < Google::Apis::Core::BaseService
36
+ # @return [String]
37
+ # API key. Your API key identifies your project and provides you with API access,
38
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
39
+ attr_accessor :key
40
+
41
+ # @return [String]
42
+ # Available to use for quota purposes for server-side applications. Can be any
43
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
44
+ attr_accessor :quota_user
45
+
46
+ def initialize
47
+ super('https://mybusinessaccountmanagement.googleapis.com/', '',
48
+ client_name: 'google-apis-mybusinessaccountmanagement_v1',
49
+ client_version: Google::Apis::MybusinessaccountmanagementV1::GEM_VERSION)
50
+ @batch_path = 'batch'
51
+ end
52
+
53
+ # Creates an account with the specified name and type under the given parent. -
54
+ # Personal accounts and Organizations cannot be created. - User Groups cannot be
55
+ # created with a Personal account as primary owner. - Location Groups cannot be
56
+ # created with a primary owner of a Personal account if the Personal account is
57
+ # in an Organization. - Location Groups cannot own Location Groups.
58
+ # @param [Google::Apis::MybusinessaccountmanagementV1::Account] account_object
59
+ # @param [String] fields
60
+ # Selector specifying which fields to include in a partial response.
61
+ # @param [String] quota_user
62
+ # Available to use for quota purposes for server-side applications. Can be any
63
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
64
+ # @param [Google::Apis::RequestOptions] options
65
+ # Request-specific options
66
+ #
67
+ # @yield [result, err] Result & error if block supplied
68
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Account] parsed result object
69
+ # @yieldparam err [StandardError] error object if request failed
70
+ #
71
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Account]
72
+ #
73
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
74
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
75
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
76
+ def create_account(account_object = nil, fields: nil, quota_user: nil, options: nil, &block)
77
+ command = make_simple_command(:post, 'v1/accounts', options)
78
+ command.request_representation = Google::Apis::MybusinessaccountmanagementV1::Account::Representation
79
+ command.request_object = account_object
80
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Account::Representation
81
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Account
82
+ command.query['fields'] = fields unless fields.nil?
83
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
84
+ execute_or_queue_command(command, &block)
85
+ end
86
+
87
+ # Gets the specified account. Returns `NOT_FOUND` if the account does not exist
88
+ # or if the caller does not have access rights to it.
89
+ # @param [String] name
90
+ # Required. The name of the account to fetch.
91
+ # @param [String] fields
92
+ # Selector specifying which fields to include in a partial response.
93
+ # @param [String] quota_user
94
+ # Available to use for quota purposes for server-side applications. Can be any
95
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
96
+ # @param [Google::Apis::RequestOptions] options
97
+ # Request-specific options
98
+ #
99
+ # @yield [result, err] Result & error if block supplied
100
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Account] parsed result object
101
+ # @yieldparam err [StandardError] error object if request failed
102
+ #
103
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Account]
104
+ #
105
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
106
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
107
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
108
+ def get_account(name, fields: nil, quota_user: nil, options: nil, &block)
109
+ command = make_simple_command(:get, 'v1/{+name}', options)
110
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Account::Representation
111
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Account
112
+ command.params['name'] = name unless name.nil?
113
+ command.query['fields'] = fields unless fields.nil?
114
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
115
+ execute_or_queue_command(command, &block)
116
+ end
117
+
118
+ # Lists all of the accounts for the authenticated user. This includes all
119
+ # accounts that the user owns, as well as any accounts for which the user has
120
+ # management rights.
121
+ # @param [String] filter
122
+ # Optional. A filter constraining the accounts to return. The response includes
123
+ # only entries that match the filter. If `filter` is empty, then no constraints
124
+ # are applied and all accounts (paginated) are retrieved for the requested
125
+ # account. For example, a request with the filter `type=USER_GROUP` will only
126
+ # return user groups. The `type` field is the only supported filter.
127
+ # @param [Fixnum] page_size
128
+ # Optional. How many accounts to fetch per page. The minimum supported page_size
129
+ # is 2. The default and maximum is 20.
130
+ # @param [String] page_token
131
+ # Optional. If specified, the next page of accounts is retrieved. The `pageToken`
132
+ # is returned when a call to `accounts.list` returns more results than can fit
133
+ # into the requested page size.
134
+ # @param [String] parent_account
135
+ # Optional. The resource name of the account for which the list of directly
136
+ # accessible accounts is to be retrieved. This only makes sense for
137
+ # Organizations and User Groups. If empty, will return `ListAccounts` for the
138
+ # authenticated user. `accounts/`account_id``.
139
+ # @param [String] fields
140
+ # Selector specifying which fields to include in a partial response.
141
+ # @param [String] quota_user
142
+ # Available to use for quota purposes for server-side applications. Can be any
143
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
144
+ # @param [Google::Apis::RequestOptions] options
145
+ # Request-specific options
146
+ #
147
+ # @yield [result, err] Result & error if block supplied
148
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::ListAccountsResponse] parsed result object
149
+ # @yieldparam err [StandardError] error object if request failed
150
+ #
151
+ # @return [Google::Apis::MybusinessaccountmanagementV1::ListAccountsResponse]
152
+ #
153
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
154
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
155
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
156
+ def list_accounts(filter: nil, page_size: nil, page_token: nil, parent_account: nil, fields: nil, quota_user: nil, options: nil, &block)
157
+ command = make_simple_command(:get, 'v1/accounts', options)
158
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::ListAccountsResponse::Representation
159
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::ListAccountsResponse
160
+ command.query['filter'] = filter unless filter.nil?
161
+ command.query['pageSize'] = page_size unless page_size.nil?
162
+ command.query['pageToken'] = page_token unless page_token.nil?
163
+ command.query['parentAccount'] = parent_account unless parent_account.nil?
164
+ command.query['fields'] = fields unless fields.nil?
165
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
166
+ execute_or_queue_command(command, &block)
167
+ end
168
+
169
+ # Updates the specified business account. Personal accounts cannot be updated
170
+ # using this method.
171
+ # @param [String] name
172
+ # Immutable. The resource name, in the format `accounts/`account_id``.
173
+ # @param [Google::Apis::MybusinessaccountmanagementV1::Account] account_object
174
+ # @param [String] update_mask
175
+ # Required. The specific fields that should be updated. The only editable field
176
+ # is `accountName`.
177
+ # @param [Boolean] validate_only
178
+ # Optional. If true, the request is validated without actually updating the
179
+ # account.
180
+ # @param [String] fields
181
+ # Selector specifying which fields to include in a partial response.
182
+ # @param [String] quota_user
183
+ # Available to use for quota purposes for server-side applications. Can be any
184
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
185
+ # @param [Google::Apis::RequestOptions] options
186
+ # Request-specific options
187
+ #
188
+ # @yield [result, err] Result & error if block supplied
189
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Account] parsed result object
190
+ # @yieldparam err [StandardError] error object if request failed
191
+ #
192
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Account]
193
+ #
194
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
195
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
196
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
197
+ def patch_account(name, account_object = nil, update_mask: nil, validate_only: nil, fields: nil, quota_user: nil, options: nil, &block)
198
+ command = make_simple_command(:patch, 'v1/{+name}', options)
199
+ command.request_representation = Google::Apis::MybusinessaccountmanagementV1::Account::Representation
200
+ command.request_object = account_object
201
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Account::Representation
202
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Account
203
+ command.params['name'] = name unless name.nil?
204
+ command.query['updateMask'] = update_mask unless update_mask.nil?
205
+ command.query['validateOnly'] = validate_only unless validate_only.nil?
206
+ command.query['fields'] = fields unless fields.nil?
207
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
208
+ execute_or_queue_command(command, &block)
209
+ end
210
+
211
+ # Invites the specified user to become an administrator for the specified
212
+ # account. The invitee must accept the invitation in order to be granted access
213
+ # to the account. See AcceptInvitation to programmatically accept an invitation.
214
+ # @param [String] parent
215
+ # Required. The resource name of the account this admin is created for. `
216
+ # accounts/`account_id``.
217
+ # @param [Google::Apis::MybusinessaccountmanagementV1::Admin] admin_object
218
+ # @param [String] fields
219
+ # Selector specifying which fields to include in a partial response.
220
+ # @param [String] quota_user
221
+ # Available to use for quota purposes for server-side applications. Can be any
222
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
223
+ # @param [Google::Apis::RequestOptions] options
224
+ # Request-specific options
225
+ #
226
+ # @yield [result, err] Result & error if block supplied
227
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Admin] parsed result object
228
+ # @yieldparam err [StandardError] error object if request failed
229
+ #
230
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Admin]
231
+ #
232
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
233
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
234
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
235
+ def create_account_admin(parent, admin_object = nil, fields: nil, quota_user: nil, options: nil, &block)
236
+ command = make_simple_command(:post, 'v1/{+parent}/admins', options)
237
+ command.request_representation = Google::Apis::MybusinessaccountmanagementV1::Admin::Representation
238
+ command.request_object = admin_object
239
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Admin::Representation
240
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Admin
241
+ command.params['parent'] = parent unless parent.nil?
242
+ command.query['fields'] = fields unless fields.nil?
243
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
244
+ execute_or_queue_command(command, &block)
245
+ end
246
+
247
+ # Removes the specified admin from the specified account.
248
+ # @param [String] name
249
+ # Required. The resource name of the admin to remove from the account. `accounts/
250
+ # `account_id`/admins/`admin_id``.
251
+ # @param [String] fields
252
+ # Selector specifying which fields to include in a partial response.
253
+ # @param [String] quota_user
254
+ # Available to use for quota purposes for server-side applications. Can be any
255
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
256
+ # @param [Google::Apis::RequestOptions] options
257
+ # Request-specific options
258
+ #
259
+ # @yield [result, err] Result & error if block supplied
260
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Empty] parsed result object
261
+ # @yieldparam err [StandardError] error object if request failed
262
+ #
263
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Empty]
264
+ #
265
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
266
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
267
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
268
+ def delete_account_admin(name, fields: nil, quota_user: nil, options: nil, &block)
269
+ command = make_simple_command(:delete, 'v1/{+name}', options)
270
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Empty::Representation
271
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Empty
272
+ command.params['name'] = name unless name.nil?
273
+ command.query['fields'] = fields unless fields.nil?
274
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
275
+ execute_or_queue_command(command, &block)
276
+ end
277
+
278
+ # Lists the admins for the specified account.
279
+ # @param [String] parent
280
+ # Required. The name of the account from which to retrieve a list of admins. `
281
+ # accounts/`account_id`/admins`.
282
+ # @param [String] fields
283
+ # Selector specifying which fields to include in a partial response.
284
+ # @param [String] quota_user
285
+ # Available to use for quota purposes for server-side applications. Can be any
286
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
287
+ # @param [Google::Apis::RequestOptions] options
288
+ # Request-specific options
289
+ #
290
+ # @yield [result, err] Result & error if block supplied
291
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::ListAccountAdminsResponse] parsed result object
292
+ # @yieldparam err [StandardError] error object if request failed
293
+ #
294
+ # @return [Google::Apis::MybusinessaccountmanagementV1::ListAccountAdminsResponse]
295
+ #
296
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
297
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
298
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
299
+ def list_account_admins(parent, fields: nil, quota_user: nil, options: nil, &block)
300
+ command = make_simple_command(:get, 'v1/{+parent}/admins', options)
301
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::ListAccountAdminsResponse::Representation
302
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::ListAccountAdminsResponse
303
+ command.params['parent'] = parent unless parent.nil?
304
+ command.query['fields'] = fields unless fields.nil?
305
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
306
+ execute_or_queue_command(command, &block)
307
+ end
308
+
309
+ # Updates the Admin for the specified Account Admin.
310
+ # @param [String] name
311
+ # Immutable. The resource name. For account admins, this is in the form: `
312
+ # accounts/`account_id`/admins/`admin_id`` For location admins, this is in the
313
+ # form: `locations/`location_id`/admins/`admin_id`` This field will be ignored
314
+ # if set during admin creation.
315
+ # @param [Google::Apis::MybusinessaccountmanagementV1::Admin] admin_object
316
+ # @param [String] update_mask
317
+ # Required. The specific fields that should be updated. The only editable field
318
+ # is role.
319
+ # @param [String] fields
320
+ # Selector specifying which fields to include in a partial response.
321
+ # @param [String] quota_user
322
+ # Available to use for quota purposes for server-side applications. Can be any
323
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
324
+ # @param [Google::Apis::RequestOptions] options
325
+ # Request-specific options
326
+ #
327
+ # @yield [result, err] Result & error if block supplied
328
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Admin] parsed result object
329
+ # @yieldparam err [StandardError] error object if request failed
330
+ #
331
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Admin]
332
+ #
333
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
334
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
335
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
336
+ def patch_account_admin(name, admin_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
337
+ command = make_simple_command(:patch, 'v1/{+name}', options)
338
+ command.request_representation = Google::Apis::MybusinessaccountmanagementV1::Admin::Representation
339
+ command.request_object = admin_object
340
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Admin::Representation
341
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Admin
342
+ command.params['name'] = name unless name.nil?
343
+ command.query['updateMask'] = update_mask unless update_mask.nil?
344
+ command.query['fields'] = fields unless fields.nil?
345
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
346
+ execute_or_queue_command(command, &block)
347
+ end
348
+
349
+ # Accepts the specified invitation.
350
+ # @param [String] name
351
+ # Required. The name of the invitation that is being accepted. `accounts/`
352
+ # account_id`/invitations/`invitation_id``
353
+ # @param [Google::Apis::MybusinessaccountmanagementV1::AcceptInvitationRequest] accept_invitation_request_object
354
+ # @param [String] fields
355
+ # Selector specifying which fields to include in a partial response.
356
+ # @param [String] quota_user
357
+ # Available to use for quota purposes for server-side applications. Can be any
358
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
359
+ # @param [Google::Apis::RequestOptions] options
360
+ # Request-specific options
361
+ #
362
+ # @yield [result, err] Result & error if block supplied
363
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Empty] parsed result object
364
+ # @yieldparam err [StandardError] error object if request failed
365
+ #
366
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Empty]
367
+ #
368
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
369
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
370
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
371
+ def accept_invitation(name, accept_invitation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
372
+ command = make_simple_command(:post, 'v1/{+name}:accept', options)
373
+ command.request_representation = Google::Apis::MybusinessaccountmanagementV1::AcceptInvitationRequest::Representation
374
+ command.request_object = accept_invitation_request_object
375
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Empty::Representation
376
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Empty
377
+ command.params['name'] = name unless name.nil?
378
+ command.query['fields'] = fields unless fields.nil?
379
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
380
+ execute_or_queue_command(command, &block)
381
+ end
382
+
383
+ # Declines the specified invitation.
384
+ # @param [String] name
385
+ # Required. The name of the account invitation that is being declined. `accounts/
386
+ # `account_id`/invitations/`invitation_id``
387
+ # @param [Google::Apis::MybusinessaccountmanagementV1::DeclineInvitationRequest] decline_invitation_request_object
388
+ # @param [String] fields
389
+ # Selector specifying which fields to include in a partial response.
390
+ # @param [String] quota_user
391
+ # Available to use for quota purposes for server-side applications. Can be any
392
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
393
+ # @param [Google::Apis::RequestOptions] options
394
+ # Request-specific options
395
+ #
396
+ # @yield [result, err] Result & error if block supplied
397
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Empty] parsed result object
398
+ # @yieldparam err [StandardError] error object if request failed
399
+ #
400
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Empty]
401
+ #
402
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
403
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
404
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
405
+ def decline_invitation(name, decline_invitation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
406
+ command = make_simple_command(:post, 'v1/{+name}:decline', options)
407
+ command.request_representation = Google::Apis::MybusinessaccountmanagementV1::DeclineInvitationRequest::Representation
408
+ command.request_object = decline_invitation_request_object
409
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Empty::Representation
410
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Empty
411
+ command.params['name'] = name unless name.nil?
412
+ command.query['fields'] = fields unless fields.nil?
413
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
414
+ execute_or_queue_command(command, &block)
415
+ end
416
+
417
+ # Lists pending invitations for the specified account.
418
+ # @param [String] parent
419
+ # Required. The name of the account from which the list of invitations is being
420
+ # retrieved. `accounts/`account_id`/invitations`
421
+ # @param [String] filter
422
+ # Optional. Filtering the response is supported via the Invitation.target_type
423
+ # field.
424
+ # @param [String] fields
425
+ # Selector specifying which fields to include in a partial response.
426
+ # @param [String] quota_user
427
+ # Available to use for quota purposes for server-side applications. Can be any
428
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
429
+ # @param [Google::Apis::RequestOptions] options
430
+ # Request-specific options
431
+ #
432
+ # @yield [result, err] Result & error if block supplied
433
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::ListInvitationsResponse] parsed result object
434
+ # @yieldparam err [StandardError] error object if request failed
435
+ #
436
+ # @return [Google::Apis::MybusinessaccountmanagementV1::ListInvitationsResponse]
437
+ #
438
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
439
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
440
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
441
+ def list_account_invitations(parent, filter: nil, fields: nil, quota_user: nil, options: nil, &block)
442
+ command = make_simple_command(:get, 'v1/{+parent}/invitations', options)
443
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::ListInvitationsResponse::Representation
444
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::ListInvitationsResponse
445
+ command.params['parent'] = parent unless parent.nil?
446
+ command.query['filter'] = filter unless filter.nil?
447
+ command.query['fields'] = fields unless fields.nil?
448
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
449
+ execute_or_queue_command(command, &block)
450
+ end
451
+
452
+ # Invites the specified user to become an administrator for the specified
453
+ # location. The invitee must accept the invitation in order to be granted access
454
+ # to the location. See AcceptInvitation to programmatically accept an invitation.
455
+ # @param [String] parent
456
+ # Required. The resource name of the location this admin is created for. `
457
+ # locations/`location_id`/admins`.
458
+ # @param [Google::Apis::MybusinessaccountmanagementV1::Admin] admin_object
459
+ # @param [String] fields
460
+ # Selector specifying which fields to include in a partial response.
461
+ # @param [String] quota_user
462
+ # Available to use for quota purposes for server-side applications. Can be any
463
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
464
+ # @param [Google::Apis::RequestOptions] options
465
+ # Request-specific options
466
+ #
467
+ # @yield [result, err] Result & error if block supplied
468
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Admin] parsed result object
469
+ # @yieldparam err [StandardError] error object if request failed
470
+ #
471
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Admin]
472
+ #
473
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
474
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
475
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
476
+ def create_location_admin(parent, admin_object = nil, fields: nil, quota_user: nil, options: nil, &block)
477
+ command = make_simple_command(:post, 'v1/{+parent}/admins', options)
478
+ command.request_representation = Google::Apis::MybusinessaccountmanagementV1::Admin::Representation
479
+ command.request_object = admin_object
480
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Admin::Representation
481
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Admin
482
+ command.params['parent'] = parent unless parent.nil?
483
+ command.query['fields'] = fields unless fields.nil?
484
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
485
+ execute_or_queue_command(command, &block)
486
+ end
487
+
488
+ # Removes the specified admin as a manager of the specified location.
489
+ # @param [String] name
490
+ # Required. The resource name of the admin to remove from the location.
491
+ # @param [String] fields
492
+ # Selector specifying which fields to include in a partial response.
493
+ # @param [String] quota_user
494
+ # Available to use for quota purposes for server-side applications. Can be any
495
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
496
+ # @param [Google::Apis::RequestOptions] options
497
+ # Request-specific options
498
+ #
499
+ # @yield [result, err] Result & error if block supplied
500
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Empty] parsed result object
501
+ # @yieldparam err [StandardError] error object if request failed
502
+ #
503
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Empty]
504
+ #
505
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
506
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
507
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
508
+ def delete_location_admin(name, fields: nil, quota_user: nil, options: nil, &block)
509
+ command = make_simple_command(:delete, 'v1/{+name}', options)
510
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Empty::Representation
511
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Empty
512
+ command.params['name'] = name unless name.nil?
513
+ command.query['fields'] = fields unless fields.nil?
514
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
515
+ execute_or_queue_command(command, &block)
516
+ end
517
+
518
+ # Lists all of the admins for the specified location.
519
+ # @param [String] parent
520
+ # Required. The name of the location to list admins of. `locations/`location_id`/
521
+ # admins`.
522
+ # @param [String] fields
523
+ # Selector specifying which fields to include in a partial response.
524
+ # @param [String] quota_user
525
+ # Available to use for quota purposes for server-side applications. Can be any
526
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
527
+ # @param [Google::Apis::RequestOptions] options
528
+ # Request-specific options
529
+ #
530
+ # @yield [result, err] Result & error if block supplied
531
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::ListLocationAdminsResponse] parsed result object
532
+ # @yieldparam err [StandardError] error object if request failed
533
+ #
534
+ # @return [Google::Apis::MybusinessaccountmanagementV1::ListLocationAdminsResponse]
535
+ #
536
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
537
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
538
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
539
+ def list_location_admins(parent, fields: nil, quota_user: nil, options: nil, &block)
540
+ command = make_simple_command(:get, 'v1/{+parent}/admins', options)
541
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::ListLocationAdminsResponse::Representation
542
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::ListLocationAdminsResponse
543
+ command.params['parent'] = parent unless parent.nil?
544
+ command.query['fields'] = fields unless fields.nil?
545
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
546
+ execute_or_queue_command(command, &block)
547
+ end
548
+
549
+ # Updates the Admin for the specified location. Only the AdminRole of the Admin
550
+ # can be updated.
551
+ # @param [String] name
552
+ # Immutable. The resource name. For account admins, this is in the form: `
553
+ # accounts/`account_id`/admins/`admin_id`` For location admins, this is in the
554
+ # form: `locations/`location_id`/admins/`admin_id`` This field will be ignored
555
+ # if set during admin creation.
556
+ # @param [Google::Apis::MybusinessaccountmanagementV1::Admin] admin_object
557
+ # @param [String] update_mask
558
+ # Required. The specific fields that should be updated. The only editable field
559
+ # is role.
560
+ # @param [String] fields
561
+ # Selector specifying which fields to include in a partial response.
562
+ # @param [String] quota_user
563
+ # Available to use for quota purposes for server-side applications. Can be any
564
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
565
+ # @param [Google::Apis::RequestOptions] options
566
+ # Request-specific options
567
+ #
568
+ # @yield [result, err] Result & error if block supplied
569
+ # @yieldparam result [Google::Apis::MybusinessaccountmanagementV1::Admin] parsed result object
570
+ # @yieldparam err [StandardError] error object if request failed
571
+ #
572
+ # @return [Google::Apis::MybusinessaccountmanagementV1::Admin]
573
+ #
574
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
575
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
576
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
577
+ def patch_location_admin(name, admin_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
578
+ command = make_simple_command(:patch, 'v1/{+name}', options)
579
+ command.request_representation = Google::Apis::MybusinessaccountmanagementV1::Admin::Representation
580
+ command.request_object = admin_object
581
+ command.response_representation = Google::Apis::MybusinessaccountmanagementV1::Admin::Representation
582
+ command.response_class = Google::Apis::MybusinessaccountmanagementV1::Admin
583
+ command.params['name'] = name unless name.nil?
584
+ command.query['updateMask'] = update_mask unless update_mask.nil?
585
+ command.query['fields'] = fields unless fields.nil?
586
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
587
+ execute_or_queue_command(command, &block)
588
+ end
589
+
590
+ protected
591
+
592
+ def apply_command_defaults(command)
593
+ command.query['key'] = key unless key.nil?
594
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
595
+ end
596
+ end
597
+ end
598
+ end
599
+ end