Debian Codegraph @

mybusinessaccountmanagement/v1/mybusinessaccountmanagement-gen.go

raw
1 // Copyright 2026 Google LLC.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Code generated file. DO NOT EDIT.
6
7 // Package mybusinessaccountmanagement provides access to the My Business Account Management API.
8 //
9 // For product documentation, see: https://developers.google.com/my-business/
10 //
11 // # Library status
12 //
13 // These client libraries are officially supported by Google. However, this
14 // library is considered complete and is in maintenance mode. This means
15 // that we will address critical bugs and security issues but will not add
16 // any new features.
17 //
18 // When possible, we recommend using our newer
19 // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
20 // that are still actively being worked and iterated on.
21 //
22 // # Creating a client
23 //
24 // Usage example:
25 //
26 // import "google.golang.org/api/mybusinessaccountmanagement/v1"
27 // ...
28 // ctx := context.Background()
29 // mybusinessaccountmanagementService, err := mybusinessaccountmanagement.NewService(ctx)
30 //
31 // In this example, Google Application Default Credentials are used for
32 // authentication. For information on how to create and obtain Application
33 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
34 //
35 // # Other authentication options
36 //
37 // To use an API key for authentication (note: some APIs do not support API
38 // keys), use [google.golang.org/api/option.WithAPIKey]:
39 //
40 // mybusinessaccountmanagementService, err := mybusinessaccountmanagement.NewService(ctx, option.WithAPIKey("AIza..."))
41 //
42 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
43 // flow, use [google.golang.org/api/option.WithTokenSource]:
44 //
45 // config := &oauth2.Config{...}
46 // // ...
47 // token, err := config.Exchange(ctx, ...)
48 // mybusinessaccountmanagementService, err := mybusinessaccountmanagement.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
49 //
50 // See [google.golang.org/api/option.ClientOption] for details on options.
51 package mybusinessaccountmanagement // import "google.golang.org/api/mybusinessaccountmanagement/v1"
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "log/slog"
61 "net/http"
62 "net/url"
63 "strconv"
64 "strings"
65
66 "github.com/googleapis/gax-go/v2/internallog"
67 googleapi "google.golang.org/api/googleapi"
68 internal "google.golang.org/api/internal"
69 gensupport "google.golang.org/api/internal/gensupport"
70 option "google.golang.org/api/option"
71 internaloption "google.golang.org/api/option/internaloption"
72 htransport "google.golang.org/api/transport/http"
73 )
74
75 // Always reference these packages, just in case the auto-generated code
76 // below doesn't.
77 var _ = bytes.NewBuffer
78 var _ = strconv.Itoa
79 var _ = fmt.Sprintf
80 var _ = json.NewDecoder
81 var _ = io.Copy
82 var _ = url.Parse
83 var _ = gensupport.MarshalJSON
84 var _ = googleapi.Version
85 var _ = errors.New
86 var _ = strings.Replace
87 var _ = context.Canceled
88 var _ = internaloption.WithDefaultEndpoint
89 var _ = internal.Version
90 var _ = internallog.New
91
92 const apiId = "mybusinessaccountmanagement:v1"
93 const apiName = "mybusinessaccountmanagement"
94 const apiVersion = "v1"
95 const basePath = "https://mybusinessaccountmanagement.googleapis.com/"
96 const basePathTemplate = "https://mybusinessaccountmanagement.UNIVERSE_DOMAIN/"
97 const mtlsBasePath = "https://mybusinessaccountmanagement.mtls.googleapis.com/"
98
99 // NewService creates a new Service.
100 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
101 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
102 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
103 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
104 opts = append(opts, internaloption.EnableNewAuthLibrary())
105 client, endpoint, err := htransport.NewClient(ctx, opts...)
106 if err != nil {
107 return nil, err
108 }
109 s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)}
110 s.Accounts = NewAccountsService(s)
111 s.Locations = NewLocationsService(s)
112 if endpoint != "" {
113 s.BasePath = endpoint
114 }
115 return s, nil
116 }
117
118 // New creates a new Service. It uses the provided http.Client for requests.
119 //
120 // Deprecated: please use NewService instead.
121 // To provide a custom HTTP client, use option.WithHTTPClient.
122 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
123 func New(client *http.Client) (*Service, error) {
124 if client == nil {
125 return nil, errors.New("client is nil")
126 }
127 return NewService(context.TODO(), option.WithHTTPClient(client))
128 }
129
130 type Service struct {
131 client *http.Client
132 logger *slog.Logger
133 BasePath string // API endpoint base URL
134 UserAgent string // optional additional User-Agent fragment
135
136 Accounts *AccountsService
137
138 Locations *LocationsService
139 }
140
141 func (s *Service) userAgent() string {
142 if s.UserAgent == "" {
143 return googleapi.UserAgent
144 }
145 return googleapi.UserAgent + " " + s.UserAgent
146 }
147
148 func NewAccountsService(s *Service) *AccountsService {
149 rs := &AccountsService{s: s}
150 rs.Admins = NewAccountsAdminsService(s)
151 rs.Invitations = NewAccountsInvitationsService(s)
152 return rs
153 }
154
155 type AccountsService struct {
156 s *Service
157
158 Admins *AccountsAdminsService
159
160 Invitations *AccountsInvitationsService
161 }
162
163 func NewAccountsAdminsService(s *Service) *AccountsAdminsService {
164 rs := &AccountsAdminsService{s: s}
165 return rs
166 }
167
168 type AccountsAdminsService struct {
169 s *Service
170 }
171
172 func NewAccountsInvitationsService(s *Service) *AccountsInvitationsService {
173 rs := &AccountsInvitationsService{s: s}
174 return rs
175 }
176
177 type AccountsInvitationsService struct {
178 s *Service
179 }
180
181 func NewLocationsService(s *Service) *LocationsService {
182 rs := &LocationsService{s: s}
183 rs.Admins = NewLocationsAdminsService(s)
184 return rs
185 }
186
187 type LocationsService struct {
188 s *Service
189
190 Admins *LocationsAdminsService
191 }
192
193 func NewLocationsAdminsService(s *Service) *LocationsAdminsService {
194 rs := &LocationsAdminsService{s: s}
195 return rs
196 }
197
198 type LocationsAdminsService struct {
199 s *Service
200 }
201
202 // AcceptInvitationRequest: Request message for AccessControl.AcceptInvitation.
203 type AcceptInvitationRequest struct {
204 }
205
206 // Account: An account is a container for your location. If you are the only
207 // user who manages locations for your business, you can use your personal
208 // Google Account. To share management of locations with multiple users,
209 // [create a business account]
210 // (https://support.google.com/business/answer/6085339?ref_topic=6085325).
211 type Account struct {
212 // AccountName: Required. The name of the account. For an account of type
213 // `PERSONAL`, this is the first and last name of the user account.
214 AccountName string `json:"accountName,omitempty"`
215 // AccountNumber: Output only. Account reference number if provisioned.
216 AccountNumber string `json:"accountNumber,omitempty"`
217 // Name: Immutable. The resource name, in the format `accounts/{account_id}`.
218 Name string `json:"name,omitempty"`
219 // OrganizationInfo: Output only. Additional info for an organization. This is
220 // populated only for an organization account.
221 OrganizationInfo *OrganizationInfo `json:"organizationInfo,omitempty"`
222 // PermissionLevel: Output only. Specifies the permission level the user has
223 // for this account.
224 //
225 // Possible values:
226 // "PERMISSION_LEVEL_UNSPECIFIED" - Not specified.
227 // "OWNER_LEVEL" - The user has owner level permission.
228 // "MEMBER_LEVEL" - The user has member level permission.
229 PermissionLevel string `json:"permissionLevel,omitempty"`
230 // PrimaryOwner: Required. Input only. The resource name of the account which
231 // will be the primary owner of the account being created. It should be of the
232 // form `accounts/{account_id}`.
233 PrimaryOwner string `json:"primaryOwner,omitempty"`
234 // Role: Output only. Specifies the AccountRole of this account.
235 //
236 // Possible values:
237 // "ACCOUNT_ROLE_UNSPECIFIED" - Not specified.
238 // "PRIMARY_OWNER" - The user is the primary owner this account.
239 // "OWNER" - The user owner of the account.
240 // "MANAGER" - The user can manage this account.
241 // "SITE_MANAGER" - The user can manage a limited set of features for the
242 // account.
243 Role string `json:"role,omitempty"`
244 // Type: Required. Contains the type of account. Accounts of type PERSONAL and
245 // ORGANIZATION cannot be created using this API.
246 //
247 // Possible values:
248 // "ACCOUNT_TYPE_UNSPECIFIED" - Not specified.
249 // "PERSONAL" - An end-user account.
250 // "LOCATION_GROUP" - A group of Locations. For more information, see the
251 // [help center article] (https://support.google.com/business/answer/6085326)
252 // "USER_GROUP" - A User Group for segregating organization staff in groups.
253 // For more information, see the [help center
254 // article](https://support.google.com/business/answer/7655731)
255 // "ORGANIZATION" - An organization representing a company. For more
256 // information, see the [help center
257 // article](https://support.google.com/business/answer/7663063)
258 Type string `json:"type,omitempty"`
259 // VerificationState: Output only. If verified, future locations that are
260 // created are automatically connected to Google Maps, and have Google+ pages
261 // created, without requiring moderation.
262 //
263 // Possible values:
264 // "VERIFICATION_STATE_UNSPECIFIED" - Not specified.
265 // "VERIFIED" - Verified account.
266 // "UNVERIFIED" - Account that is not verified, and verification has not been
267 // requested.
268 // "VERIFICATION_REQUESTED" - Account that is not verified, but verification
269 // has been requested.
270 VerificationState string `json:"verificationState,omitempty"`
271 // VettedState: Output only. Indicates whether the account is vetted by Google.
272 // A vetted account is able to verify locations via the VETTED_PARTNER method.
273 //
274 // Possible values:
275 // "VETTED_STATE_UNSPECIFIED" - Not Specified
276 // "NOT_VETTED" - The account is not vetted by Google.
277 // "VETTED" - The account is vetted by Google and in a valid state. An
278 // account is automatically vetted if it has direct access to a vetted group
279 // account.
280 // "INVALID" - The account is vetted but in an invalid state. The account
281 // will behave like an unvetted account.
282 VettedState string `json:"vettedState,omitempty"`
283
284 // ServerResponse contains the HTTP response code and headers from the server.
285 googleapi.ServerResponse `json:"-"`
286 // ForceSendFields is a list of field names (e.g. "AccountName") to
287 // unconditionally include in API requests. By default, fields with empty or
288 // default values are omitted from API requests. See
289 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
290 // details.
291 ForceSendFields []string `json:"-"`
292 // NullFields is a list of field names (e.g. "AccountName") to include in API
293 // requests with the JSON null value. By default, fields with empty values are
294 // omitted from API requests. See
295 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
296 NullFields []string `json:"-"`
297 }
298
299 func (s Account) MarshalJSON() ([]byte, error) {
300 type NoMethod Account
301 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
302 }
303
304 // Admin: An administrator of an Account or a location.
305 type Admin struct {
306 // Account: Immutable. The name of the Account resource that this Admin refers
307 // to. Used when calling locations.admins.create to invite a LocationGroup as
308 // an admin. If both this field and `admin` are set on `CREATE` requests, this
309 // field takes precedence and the email address in `admin` will be ignored.
310 // Format: `accounts/{account}`.
311 Account string `json:"account,omitempty"`
312 // Admin: Optional. The name of the admin. When making the initial invitation,
313 // this is the invitee's email address. On `GET` calls, the user's email
314 // address is returned if the invitation is still pending. Otherwise, it
315 // contains the user's first and last names. This field is only needed to be
316 // set during admin creation.
317 Admin string `json:"admin,omitempty"`
318 // Name: Immutable. The resource name. For account admins, this is in the form:
319 // `accounts/{account_id}/admins/{admin_id}` For location admins, this is in
320 // the form: `locations/{location_id}/admins/{admin_id}` This field will be
321 // ignored if set during admin creation.
322 Name string `json:"name,omitempty"`
323 // PendingInvitation: Output only. Indicates whether this admin has a pending
324 // invitation for the specified resource.
325 PendingInvitation bool `json:"pendingInvitation,omitempty"`
326 // Role: Required. Specifies the role that this admin uses with the specified
327 // Account or Location.
328 //
329 // Possible values:
330 // "ADMIN_ROLE_UNSPECIFIED" - Not specified.
331 // "PRIMARY_OWNER" - The admin has owner-level access and is the primary
332 // owner. (Displays as 'Primary Owner' in UI).
333 // "OWNER" - The admin has owner-level access. (Displays as 'Owner' in UI).
334 // "MANAGER" - The admin has managerial access.
335 // "SITE_MANAGER" - The admin can manage social (Google+) pages. (Displays as
336 // 'Site Manager' in UI). This API doesn't allow creating an account admin with
337 // a SITE_MANAGER role.
338 Role string `json:"role,omitempty"`
339
340 // ServerResponse contains the HTTP response code and headers from the server.
341 googleapi.ServerResponse `json:"-"`
342 // ForceSendFields is a list of field names (e.g. "Account") to unconditionally
343 // include in API requests. By default, fields with empty or default values are
344 // omitted from API requests. See
345 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
346 // details.
347 ForceSendFields []string `json:"-"`
348 // NullFields is a list of field names (e.g. "Account") to include in API
349 // requests with the JSON null value. By default, fields with empty values are
350 // omitted from API requests. See
351 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
352 NullFields []string `json:"-"`
353 }
354
355 func (s Admin) MarshalJSON() ([]byte, error) {
356 type NoMethod Admin
357 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
358 }
359
360 // DeclineInvitationRequest: Request message for
361 // AccessControl.DeclineInvitation.
362 type DeclineInvitationRequest struct {
363 }
364
365 // Empty: A generic empty message that you can re-use to avoid defining
366 // duplicated empty messages in your APIs. A typical example is to use it as
367 // the request or the response type of an API method. For instance: service Foo
368 // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
369 type Empty struct {
370 // ServerResponse contains the HTTP response code and headers from the server.
371 googleapi.ServerResponse `json:"-"`
372 }
373
374 // Invitation: Represents a pending invitation.
375 type Invitation struct {
376 // Name: Required. The resource name for the invitation.
377 // `accounts/{account_id}/invitations/{invitation_id}`.
378 Name string `json:"name,omitempty"`
379 // Role: Output only. The invited role on the account.
380 //
381 // Possible values:
382 // "ADMIN_ROLE_UNSPECIFIED" - Not specified.
383 // "PRIMARY_OWNER" - The admin has owner-level access and is the primary
384 // owner. (Displays as 'Primary Owner' in UI).
385 // "OWNER" - The admin has owner-level access. (Displays as 'Owner' in UI).
386 // "MANAGER" - The admin has managerial access.
387 // "SITE_MANAGER" - The admin can manage social (Google+) pages. (Displays as
388 // 'Site Manager' in UI). This API doesn't allow creating an account admin with
389 // a SITE_MANAGER role.
390 Role string `json:"role,omitempty"`
391 // TargetAccount: The sparsely populated account this invitation is for.
392 TargetAccount *Account `json:"targetAccount,omitempty"`
393 // TargetLocation: The target location this invitation is for.
394 TargetLocation *TargetLocation `json:"targetLocation,omitempty"`
395 // TargetType: Output only. Specifies which target types should appear in the
396 // response.
397 //
398 // Possible values:
399 // "TARGET_TYPE_UNSPECIFIED" - Set when target type is unspecified.
400 // "ACCOUNTS_ONLY" - List invitations only for targets of type Account.
401 // "LOCATIONS_ONLY" - List invitations only for targets of type Location.
402 TargetType string `json:"targetType,omitempty"`
403 // ForceSendFields is a list of field names (e.g. "Name") to unconditionally
404 // include in API requests. By default, fields with empty or default values are
405 // omitted from API requests. See
406 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
407 // details.
408 ForceSendFields []string `json:"-"`
409 // NullFields is a list of field names (e.g. "Name") to include in API requests
410 // with the JSON null value. By default, fields with empty values are omitted
411 // from API requests. See
412 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
413 NullFields []string `json:"-"`
414 }
415
416 func (s Invitation) MarshalJSON() ([]byte, error) {
417 type NoMethod Invitation
418 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
419 }
420
421 // ListAccountAdminsResponse: Response message for
422 // AccessControl.ListAccountAdmins.
423 type ListAccountAdminsResponse struct {
424 // AccountAdmins: A collection of Admin instances.
425 AccountAdmins []*Admin `json:"accountAdmins,omitempty"`
426
427 // ServerResponse contains the HTTP response code and headers from the server.
428 googleapi.ServerResponse `json:"-"`
429 // ForceSendFields is a list of field names (e.g. "AccountAdmins") to
430 // unconditionally include in API requests. By default, fields with empty or
431 // default values are omitted from API requests. See
432 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
433 // details.
434 ForceSendFields []string `json:"-"`
435 // NullFields is a list of field names (e.g. "AccountAdmins") to include in API
436 // requests with the JSON null value. By default, fields with empty values are
437 // omitted from API requests. See
438 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
439 NullFields []string `json:"-"`
440 }
441
442 func (s ListAccountAdminsResponse) MarshalJSON() ([]byte, error) {
443 type NoMethod ListAccountAdminsResponse
444 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
445 }
446
447 // ListAccountsResponse: Response message for Accounts.ListAccounts.
448 type ListAccountsResponse struct {
449 // Accounts: A collection of accounts to which the user has access. The
450 // personal account of the user doing the query will always be the first item
451 // of the result, unless it is filtered out.
452 Accounts []*Account `json:"accounts,omitempty"`
453 // NextPageToken: If the number of accounts exceeds the requested page size,
454 // this field is populated with a token to fetch the next page of accounts on a
455 // subsequent call to `accounts.list`. If there are no more accounts, this
456 // field is not present in the response.
457 NextPageToken string `json:"nextPageToken,omitempty"`
458
459 // ServerResponse contains the HTTP response code and headers from the server.
460 googleapi.ServerResponse `json:"-"`
461 // ForceSendFields is a list of field names (e.g. "Accounts") to
462 // unconditionally include in API requests. By default, fields with empty or
463 // default values are omitted from API requests. See
464 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
465 // details.
466 ForceSendFields []string `json:"-"`
467 // NullFields is a list of field names (e.g. "Accounts") to include in API
468 // requests with the JSON null value. By default, fields with empty values are
469 // omitted from API requests. See
470 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
471 NullFields []string `json:"-"`
472 }
473
474 func (s ListAccountsResponse) MarshalJSON() ([]byte, error) {
475 type NoMethod ListAccountsResponse
476 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
477 }
478
479 // ListInvitationsResponse: Response message for AccessControl.ListInvitations.
480 type ListInvitationsResponse struct {
481 // Invitations: A collection of invitations that are pending for the account.
482 // The number of invitations listed here cannot exceed 1000.
483 Invitations []*Invitation `json:"invitations,omitempty"`
484
485 // ServerResponse contains the HTTP response code and headers from the server.
486 googleapi.ServerResponse `json:"-"`
487 // ForceSendFields is a list of field names (e.g. "Invitations") to
488 // unconditionally include in API requests. By default, fields with empty or
489 // default values are omitted from API requests. See
490 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
491 // details.
492 ForceSendFields []string `json:"-"`
493 // NullFields is a list of field names (e.g. "Invitations") to include in API
494 // requests with the JSON null value. By default, fields with empty values are
495 // omitted from API requests. See
496 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
497 NullFields []string `json:"-"`
498 }
499
500 func (s ListInvitationsResponse) MarshalJSON() ([]byte, error) {
501 type NoMethod ListInvitationsResponse
502 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
503 }
504
505 // ListLocationAdminsResponse: Response message for
506 // AccessControl.ListLocationAdmins.
507 type ListLocationAdminsResponse struct {
508 // Admins: A collection of Admins.
509 Admins []*Admin `json:"admins,omitempty"`
510
511 // ServerResponse contains the HTTP response code and headers from the server.
512 googleapi.ServerResponse `json:"-"`
513 // ForceSendFields is a list of field names (e.g. "Admins") to unconditionally
514 // include in API requests. By default, fields with empty or default values are
515 // omitted from API requests. See
516 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
517 // details.
518 ForceSendFields []string `json:"-"`
519 // NullFields is a list of field names (e.g. "Admins") to include in API
520 // requests with the JSON null value. By default, fields with empty values are
521 // omitted from API requests. See
522 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
523 NullFields []string `json:"-"`
524 }
525
526 func (s ListLocationAdminsResponse) MarshalJSON() ([]byte, error) {
527 type NoMethod ListLocationAdminsResponse
528 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
529 }
530
531 // OrganizationInfo: Additional information stored for an organization.
532 type OrganizationInfo struct {
533 // Address: Output only. The postal address for the account.
534 Address *PostalAddress `json:"address,omitempty"`
535 // PhoneNumber: Output only. The contact number for the organization.
536 PhoneNumber string `json:"phoneNumber,omitempty"`
537 // RegisteredDomain: Output only. The registered domain for the account.
538 RegisteredDomain string `json:"registeredDomain,omitempty"`
539 // ForceSendFields is a list of field names (e.g. "Address") to unconditionally
540 // include in API requests. By default, fields with empty or default values are
541 // omitted from API requests. See
542 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
543 // details.
544 ForceSendFields []string `json:"-"`
545 // NullFields is a list of field names (e.g. "Address") to include in API
546 // requests with the JSON null value. By default, fields with empty values are
547 // omitted from API requests. See
548 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
549 NullFields []string `json:"-"`
550 }
551
552 func (s OrganizationInfo) MarshalJSON() ([]byte, error) {
553 type NoMethod OrganizationInfo
554 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
555 }
556
557 // PostalAddress: Represents a postal address, such as for postal delivery or
558 // payments addresses. With a postal address, a postal service can deliver
559 // items to a premise, P.O. box, or similar. A postal address is not intended
560 // to model geographical locations like roads, towns, or mountains. In typical
561 // usage, an address would be created by user input or from importing existing
562 // data, depending on the type of process. Advice on address input or editing:
563 // - Use an internationalization-ready address widget such as
564 // https://github.com/google/libaddressinput. - Users should not be presented
565 // with UI elements for input or editing of fields outside countries where that
566 // field is used. For more guidance on how to use this schema, see:
567 // https://support.google.com/business/answer/6397478.
568 type PostalAddress struct {
569 // AddressLines: Unstructured address lines describing the lower levels of an
570 // address. Because values in `address_lines` do not have type information and
571 // may sometimes contain multiple values in a single field (for example,
572 // "Austin, TX"), it is important that the line order is clear. The order of
573 // address lines should be "envelope order" for the country or region of the
574 // address. In places where this can vary (for example, Japan),
575 // `address_language` is used to make it explicit (for example, "ja" for
576 // large-to-small ordering and "ja-Latn" or "en" for small-to-large). In this
577 // way, the most specific line of an address can be selected based on the
578 // language. The minimum permitted structural representation of an address
579 // consists of a `region_code` with all remaining information placed in the
580 // `address_lines`. It would be possible to format such an address very
581 // approximately without geocoding, but no semantic reasoning could be made
582 // about any of the address components until it was at least partially
583 // resolved. Creating an address only containing a `region_code` and
584 // `address_lines` and then geocoding is the recommended way to handle
585 // completely unstructured addresses (as opposed to guessing which parts of the
586 // address should be localities or administrative areas).
587 AddressLines []string `json:"addressLines,omitempty"`
588 // AdministrativeArea: Optional. Highest administrative subdivision which is
589 // used for postal addresses of a country or region. For example, this can be a
590 // state, a province, an oblast, or a prefecture. For Spain, this is the
591 // province and not the autonomous community (for example, "Barcelona" and not
592 // "Catalonia"). Many countries don't use an administrative area in postal
593 // addresses. For example, in Switzerland, this should be left unpopulated.
594 AdministrativeArea string `json:"administrativeArea,omitempty"`
595 // LanguageCode: Optional. BCP-47 language code of the contents of this address
596 // (if known). This is often the UI language of the input form or is expected
597 // to match one of the languages used in the address' country/region, or their
598 // transliterated equivalents. This can affect formatting in certain countries,
599 // but is not critical to the correctness of the data and will never affect any
600 // validation or other non-formatting related operations. If this value is not
601 // known, it should be omitted (rather than specifying a possibly incorrect
602 // default). Examples: "zh-Hant", "ja", "ja-Latn", "en".
603 LanguageCode string `json:"languageCode,omitempty"`
604 // Locality: Optional. Generally refers to the city or town portion of the
605 // address. Examples: US city, IT comune, UK post town. In regions of the world
606 // where localities are not well defined or do not fit into this structure
607 // well, leave `locality` empty and use `address_lines`.
608 Locality string `json:"locality,omitempty"`
609 // Organization: Optional. The name of the organization at the address.
610 Organization string `json:"organization,omitempty"`
611 // PostalCode: Optional. Postal code of the address. Not all countries use or
612 // require postal codes to be present, but where they are used, they may
613 // trigger additional validation with other parts of the address (for example,
614 // state or zip code validation in the United States).
615 PostalCode string `json:"postalCode,omitempty"`
616 // Recipients: Optional. The recipient at the address. This field may, under
617 // certain circumstances, contain multiline information. For example, it might
618 // contain "care of" information.
619 Recipients []string `json:"recipients,omitempty"`
620 // RegionCode: Required. CLDR region code of the country/region of the address.
621 // This is never inferred and it is up to the user to ensure the value is
622 // correct. See https://cldr.unicode.org/ and
623 // https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html
624 // for details. Example: "CH" for Switzerland.
625 RegionCode string `json:"regionCode,omitempty"`
626 // Revision: The schema revision of the `PostalAddress`. This must be set to 0,
627 // which is the latest revision. All new revisions **must** be backward
628 // compatible with old revisions.
629 Revision int64 `json:"revision,omitempty"`
630 // SortingCode: Optional. Additional, country-specific, sorting code. This is
631 // not used in most regions. Where it is used, the value is either a string
632 // like "CEDEX", optionally followed by a number (for example, "CEDEX 7"), or
633 // just a number alone, representing the "sector code" (Jamaica), "delivery
634 // area indicator" (Malawi) or "post office indicator" (Côte d'Ivoire).
635 SortingCode string `json:"sortingCode,omitempty"`
636 // Sublocality: Optional. Sublocality of the address. For example, this can be
637 // a neighborhood, borough, or district.
638 Sublocality string `json:"sublocality,omitempty"`
639 // ForceSendFields is a list of field names (e.g. "AddressLines") to
640 // unconditionally include in API requests. By default, fields with empty or
641 // default values are omitted from API requests. See
642 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
643 // details.
644 ForceSendFields []string `json:"-"`
645 // NullFields is a list of field names (e.g. "AddressLines") to include in API
646 // requests with the JSON null value. By default, fields with empty values are
647 // omitted from API requests. See
648 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
649 NullFields []string `json:"-"`
650 }
651
652 func (s PostalAddress) MarshalJSON() ([]byte, error) {
653 type NoMethod PostalAddress
654 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
655 }
656
657 // TargetLocation: Represents a target location for a pending invitation.
658 type TargetLocation struct {
659 // Address: The address of the location to which the user is invited.
660 Address string `json:"address,omitempty"`
661 // LocationName: The name of the location to which the user is invited.
662 LocationName string `json:"locationName,omitempty"`
663 // ForceSendFields is a list of field names (e.g. "Address") to unconditionally
664 // include in API requests. By default, fields with empty or default values are
665 // omitted from API requests. See
666 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
667 // details.
668 ForceSendFields []string `json:"-"`
669 // NullFields is a list of field names (e.g. "Address") to include in API
670 // requests with the JSON null value. By default, fields with empty values are
671 // omitted from API requests. See
672 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
673 NullFields []string `json:"-"`
674 }
675
676 func (s TargetLocation) MarshalJSON() ([]byte, error) {
677 type NoMethod TargetLocation
678 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
679 }
680
681 // TransferLocationRequest: Request message for AccessControl.TransferLocation.
682 type TransferLocationRequest struct {
683 // DestinationAccount: Required. Name of the account resource to transfer the
684 // location to (for example, "accounts/{account}").
685 DestinationAccount string `json:"destinationAccount,omitempty"`
686 // ForceSendFields is a list of field names (e.g. "DestinationAccount") to
687 // unconditionally include in API requests. By default, fields with empty or
688 // default values are omitted from API requests. See
689 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
690 // details.
691 ForceSendFields []string `json:"-"`
692 // NullFields is a list of field names (e.g. "DestinationAccount") to include
693 // in API requests with the JSON null value. By default, fields with empty
694 // values are omitted from API requests. See
695 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
696 NullFields []string `json:"-"`
697 }
698
699 func (s TransferLocationRequest) MarshalJSON() ([]byte, error) {
700 type NoMethod TransferLocationRequest
701 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
702 }
703
704 type AccountsCreateCall struct {
705 s *Service
706 account *Account
707 urlParams_ gensupport.URLParams
708 ctx_ context.Context
709 header_ http.Header
710 }
711
712 // Create: Creates an account with the specified name and type under the given
713 // parent. - Personal accounts and Organizations cannot be created. - User
714 // Groups cannot be created with a Personal account as primary owner. -
715 // Location Groups cannot be created with a primary owner of a Personal account
716 // if the Personal account is in an Organization. - Location Groups cannot own
717 // Location Groups.
718 func (r *AccountsService) Create(account *Account) *AccountsCreateCall {
719 c := &AccountsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
720 c.account = account
721 return c
722 }
723
724 // Fields allows partial responses to be retrieved. See
725 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
726 // details.
727 func (c *AccountsCreateCall) Fields(s ...googleapi.Field) *AccountsCreateCall {
728 c.urlParams_.Set("fields", googleapi.CombineFields(s))
729 return c
730 }
731
732 // Context sets the context to be used in this call's Do method.
733 func (c *AccountsCreateCall) Context(ctx context.Context) *AccountsCreateCall {
734 c.ctx_ = ctx
735 return c
736 }
737
738 // Header returns a http.Header that can be modified by the caller to add
739 // headers to the request.
740 func (c *AccountsCreateCall) Header() http.Header {
741 if c.header_ == nil {
742 c.header_ = make(http.Header)
743 }
744 return c.header_
745 }
746
747 func (c *AccountsCreateCall) doRequest(alt string) (*http.Response, error) {
748 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
749 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.account)
750 if err != nil {
751 return nil, err
752 }
753 c.urlParams_.Set("alt", alt)
754 c.urlParams_.Set("prettyPrint", "false")
755 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/accounts")
756 urls += "?" + c.urlParams_.Encode()
757 req, err := http.NewRequest("POST", urls, body)
758 if err != nil {
759 return nil, err
760 }
761 req.Header = reqHeaders
762 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.create", "request", internallog.HTTPRequest(req, body.Bytes()))
763 return gensupport.SendRequest(c.ctx_, c.s.client, req)
764 }
765
766 // Do executes the "mybusinessaccountmanagement.accounts.create" call.
767 // Any non-2xx status code is an error. Response headers are in either
768 // *Account.ServerResponse.Header or (if a response was returned at all) in
769 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
770 // whether the returned error was because http.StatusNotModified was returned.
771 func (c *AccountsCreateCall) Do(opts ...googleapi.CallOption) (*Account, error) {
772 gensupport.SetOptions(c.urlParams_, opts...)
773 res, err := c.doRequest("json")
774 if res != nil && res.StatusCode == http.StatusNotModified {
775 if res.Body != nil {
776 res.Body.Close()
777 }
778 return nil, gensupport.WrapError(&googleapi.Error{
779 Code: res.StatusCode,
780 Header: res.Header,
781 })
782 }
783 if err != nil {
784 return nil, err
785 }
786 defer googleapi.CloseBody(res)
787 if err := googleapi.CheckResponse(res); err != nil {
788 return nil, gensupport.WrapError(err)
789 }
790 ret := &Account{
791 ServerResponse: googleapi.ServerResponse{
792 Header: res.Header,
793 HTTPStatusCode: res.StatusCode,
794 },
795 }
796 target := &ret
797 b, err := gensupport.DecodeResponseBytes(target, res)
798 if err != nil {
799 return nil, err
800 }
801 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.create", "response", internallog.HTTPResponse(res, b))
802 return ret, nil
803 }
804
805 type AccountsGetCall struct {
806 s *Service
807 name string
808 urlParams_ gensupport.URLParams
809 ifNoneMatch_ string
810 ctx_ context.Context
811 header_ http.Header
812 }
813
814 // Get: Gets the specified account. Returns `NOT_FOUND` if the account does not
815 // exist or if the caller does not have access rights to it.
816 //
817 // - name: The name of the account to fetch.
818 func (r *AccountsService) Get(name string) *AccountsGetCall {
819 c := &AccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
820 c.name = name
821 return c
822 }
823
824 // Fields allows partial responses to be retrieved. See
825 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
826 // details.
827 func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall {
828 c.urlParams_.Set("fields", googleapi.CombineFields(s))
829 return c
830 }
831
832 // IfNoneMatch sets an optional parameter which makes the operation fail if the
833 // object's ETag matches the given value. This is useful for getting updates
834 // only after the object has changed since the last request.
835 func (c *AccountsGetCall) IfNoneMatch(entityTag string) *AccountsGetCall {
836 c.ifNoneMatch_ = entityTag
837 return c
838 }
839
840 // Context sets the context to be used in this call's Do method.
841 func (c *AccountsGetCall) Context(ctx context.Context) *AccountsGetCall {
842 c.ctx_ = ctx
843 return c
844 }
845
846 // Header returns a http.Header that can be modified by the caller to add
847 // headers to the request.
848 func (c *AccountsGetCall) Header() http.Header {
849 if c.header_ == nil {
850 c.header_ = make(http.Header)
851 }
852 return c.header_
853 }
854
855 func (c *AccountsGetCall) doRequest(alt string) (*http.Response, error) {
856 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
857 if c.ifNoneMatch_ != "" {
858 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
859 }
860 c.urlParams_.Set("alt", alt)
861 c.urlParams_.Set("prettyPrint", "false")
862 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
863 urls += "?" + c.urlParams_.Encode()
864 req, err := http.NewRequest("GET", urls, nil)
865 if err != nil {
866 return nil, err
867 }
868 req.Header = reqHeaders
869 googleapi.Expand(req.URL, map[string]string{
870 "name": c.name,
871 })
872 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.get", "request", internallog.HTTPRequest(req, nil))
873 return gensupport.SendRequest(c.ctx_, c.s.client, req)
874 }
875
876 // Do executes the "mybusinessaccountmanagement.accounts.get" call.
877 // Any non-2xx status code is an error. Response headers are in either
878 // *Account.ServerResponse.Header or (if a response was returned at all) in
879 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
880 // whether the returned error was because http.StatusNotModified was returned.
881 func (c *AccountsGetCall) Do(opts ...googleapi.CallOption) (*Account, error) {
882 gensupport.SetOptions(c.urlParams_, opts...)
883 res, err := c.doRequest("json")
884 if res != nil && res.StatusCode == http.StatusNotModified {
885 if res.Body != nil {
886 res.Body.Close()
887 }
888 return nil, gensupport.WrapError(&googleapi.Error{
889 Code: res.StatusCode,
890 Header: res.Header,
891 })
892 }
893 if err != nil {
894 return nil, err
895 }
896 defer googleapi.CloseBody(res)
897 if err := googleapi.CheckResponse(res); err != nil {
898 return nil, gensupport.WrapError(err)
899 }
900 ret := &Account{
901 ServerResponse: googleapi.ServerResponse{
902 Header: res.Header,
903 HTTPStatusCode: res.StatusCode,
904 },
905 }
906 target := &ret
907 b, err := gensupport.DecodeResponseBytes(target, res)
908 if err != nil {
909 return nil, err
910 }
911 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.get", "response", internallog.HTTPResponse(res, b))
912 return ret, nil
913 }
914
915 type AccountsListCall struct {
916 s *Service
917 urlParams_ gensupport.URLParams
918 ifNoneMatch_ string
919 ctx_ context.Context
920 header_ http.Header
921 }
922
923 // List: Lists all of the accounts for the authenticated user. This includes
924 // all accounts that the user owns, as well as any accounts for which the user
925 // has management rights.
926 func (r *AccountsService) List() *AccountsListCall {
927 c := &AccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
928 return c
929 }
930
931 // Filter sets the optional parameter "filter": A filter constraining the
932 // accounts to return. The response includes only entries that match the
933 // filter. If `filter` is empty, then no constraints are applied and all
934 // accounts (paginated) are retrieved for the requested account. For example, a
935 // request with the filter `type=USER_GROUP` will only return user groups. The
936 // `type` field is the only supported filter.
937 func (c *AccountsListCall) Filter(filter string) *AccountsListCall {
938 c.urlParams_.Set("filter", filter)
939 return c
940 }
941
942 // PageSize sets the optional parameter "pageSize": How many accounts to fetch
943 // per page. The default and maximum is 20.
944 func (c *AccountsListCall) PageSize(pageSize int64) *AccountsListCall {
945 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
946 return c
947 }
948
949 // PageToken sets the optional parameter "pageToken": If specified, the next
950 // page of accounts is retrieved. The `pageToken` is returned when a call to
951 // `accounts.list` returns more results than can fit into the requested page
952 // size.
953 func (c *AccountsListCall) PageToken(pageToken string) *AccountsListCall {
954 c.urlParams_.Set("pageToken", pageToken)
955 return c
956 }
957
958 // ParentAccount sets the optional parameter "parentAccount": The resource name
959 // of the account for which the list of directly accessible accounts is to be
960 // retrieved. This only makes sense for Organizations and User Groups. If
961 // empty, will return `ListAccounts` for the authenticated user.
962 // `accounts/{account_id}`.
963 func (c *AccountsListCall) ParentAccount(parentAccount string) *AccountsListCall {
964 c.urlParams_.Set("parentAccount", parentAccount)
965 return c
966 }
967
968 // Fields allows partial responses to be retrieved. See
969 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
970 // details.
971 func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall {
972 c.urlParams_.Set("fields", googleapi.CombineFields(s))
973 return c
974 }
975
976 // IfNoneMatch sets an optional parameter which makes the operation fail if the
977 // object's ETag matches the given value. This is useful for getting updates
978 // only after the object has changed since the last request.
979 func (c *AccountsListCall) IfNoneMatch(entityTag string) *AccountsListCall {
980 c.ifNoneMatch_ = entityTag
981 return c
982 }
983
984 // Context sets the context to be used in this call's Do method.
985 func (c *AccountsListCall) Context(ctx context.Context) *AccountsListCall {
986 c.ctx_ = ctx
987 return c
988 }
989
990 // Header returns a http.Header that can be modified by the caller to add
991 // headers to the request.
992 func (c *AccountsListCall) Header() http.Header {
993 if c.header_ == nil {
994 c.header_ = make(http.Header)
995 }
996 return c.header_
997 }
998
999 func (c *AccountsListCall) doRequest(alt string) (*http.Response, error) {
1000 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1001 if c.ifNoneMatch_ != "" {
1002 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1003 }
1004 c.urlParams_.Set("alt", alt)
1005 c.urlParams_.Set("prettyPrint", "false")
1006 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/accounts")
1007 urls += "?" + c.urlParams_.Encode()
1008 req, err := http.NewRequest("GET", urls, nil)
1009 if err != nil {
1010 return nil, err
1011 }
1012 req.Header = reqHeaders
1013 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.list", "request", internallog.HTTPRequest(req, nil))
1014 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1015 }
1016
1017 // Do executes the "mybusinessaccountmanagement.accounts.list" call.
1018 // Any non-2xx status code is an error. Response headers are in either
1019 // *ListAccountsResponse.ServerResponse.Header or (if a response was returned
1020 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
1021 // check whether the returned error was because http.StatusNotModified was
1022 // returned.
1023 func (c *AccountsListCall) Do(opts ...googleapi.CallOption) (*ListAccountsResponse, error) {
1024 gensupport.SetOptions(c.urlParams_, opts...)
1025 res, err := c.doRequest("json")
1026 if res != nil && res.StatusCode == http.StatusNotModified {
1027 if res.Body != nil {
1028 res.Body.Close()
1029 }
1030 return nil, gensupport.WrapError(&googleapi.Error{
1031 Code: res.StatusCode,
1032 Header: res.Header,
1033 })
1034 }
1035 if err != nil {
1036 return nil, err
1037 }
1038 defer googleapi.CloseBody(res)
1039 if err := googleapi.CheckResponse(res); err != nil {
1040 return nil, gensupport.WrapError(err)
1041 }
1042 ret := &ListAccountsResponse{
1043 ServerResponse: googleapi.ServerResponse{
1044 Header: res.Header,
1045 HTTPStatusCode: res.StatusCode,
1046 },
1047 }
1048 target := &ret
1049 b, err := gensupport.DecodeResponseBytes(target, res)
1050 if err != nil {
1051 return nil, err
1052 }
1053 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.list", "response", internallog.HTTPResponse(res, b))
1054 return ret, nil
1055 }
1056
1057 // Pages invokes f for each page of results.
1058 // A non-nil error returned from f will halt the iteration.
1059 // The provided context supersedes any context provided to the Context method.
1060 func (c *AccountsListCall) Pages(ctx context.Context, f func(*ListAccountsResponse) error) error {
1061 c.ctx_ = ctx
1062 defer c.PageToken(c.urlParams_.Get("pageToken"))
1063 for {
1064 x, err := c.Do()
1065 if err != nil {
1066 return err
1067 }
1068 if err := f(x); err != nil {
1069 return err
1070 }
1071 if x.NextPageToken == "" {
1072 return nil
1073 }
1074 c.PageToken(x.NextPageToken)
1075 }
1076 }
1077
1078 type AccountsPatchCall struct {
1079 s *Service
1080 name string
1081 account *Account
1082 urlParams_ gensupport.URLParams
1083 ctx_ context.Context
1084 header_ http.Header
1085 }
1086
1087 // Patch: Updates the specified business account. Personal accounts cannot be
1088 // updated using this method.
1089 //
1090 // - name: Immutable. The resource name, in the format `accounts/{account_id}`.
1091 func (r *AccountsService) Patch(name string, account *Account) *AccountsPatchCall {
1092 c := &AccountsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1093 c.name = name
1094 c.account = account
1095 return c
1096 }
1097
1098 // UpdateMask sets the optional parameter "updateMask": Required. The specific
1099 // fields that should be updated. The only editable field is `accountName`.
1100 func (c *AccountsPatchCall) UpdateMask(updateMask string) *AccountsPatchCall {
1101 c.urlParams_.Set("updateMask", updateMask)
1102 return c
1103 }
1104
1105 // ValidateOnly sets the optional parameter "validateOnly": If true, the
1106 // request is validated without actually updating the account.
1107 func (c *AccountsPatchCall) ValidateOnly(validateOnly bool) *AccountsPatchCall {
1108 c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
1109 return c
1110 }
1111
1112 // Fields allows partial responses to be retrieved. See
1113 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1114 // details.
1115 func (c *AccountsPatchCall) Fields(s ...googleapi.Field) *AccountsPatchCall {
1116 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1117 return c
1118 }
1119
1120 // Context sets the context to be used in this call's Do method.
1121 func (c *AccountsPatchCall) Context(ctx context.Context) *AccountsPatchCall {
1122 c.ctx_ = ctx
1123 return c
1124 }
1125
1126 // Header returns a http.Header that can be modified by the caller to add
1127 // headers to the request.
1128 func (c *AccountsPatchCall) Header() http.Header {
1129 if c.header_ == nil {
1130 c.header_ = make(http.Header)
1131 }
1132 return c.header_
1133 }
1134
1135 func (c *AccountsPatchCall) doRequest(alt string) (*http.Response, error) {
1136 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1137 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.account)
1138 if err != nil {
1139 return nil, err
1140 }
1141 c.urlParams_.Set("alt", alt)
1142 c.urlParams_.Set("prettyPrint", "false")
1143 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1144 urls += "?" + c.urlParams_.Encode()
1145 req, err := http.NewRequest("PATCH", urls, body)
1146 if err != nil {
1147 return nil, err
1148 }
1149 req.Header = reqHeaders
1150 googleapi.Expand(req.URL, map[string]string{
1151 "name": c.name,
1152 })
1153 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.patch", "request", internallog.HTTPRequest(req, body.Bytes()))
1154 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1155 }
1156
1157 // Do executes the "mybusinessaccountmanagement.accounts.patch" call.
1158 // Any non-2xx status code is an error. Response headers are in either
1159 // *Account.ServerResponse.Header or (if a response was returned at all) in
1160 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1161 // whether the returned error was because http.StatusNotModified was returned.
1162 func (c *AccountsPatchCall) Do(opts ...googleapi.CallOption) (*Account, error) {
1163 gensupport.SetOptions(c.urlParams_, opts...)
1164 res, err := c.doRequest("json")
1165 if res != nil && res.StatusCode == http.StatusNotModified {
1166 if res.Body != nil {
1167 res.Body.Close()
1168 }
1169 return nil, gensupport.WrapError(&googleapi.Error{
1170 Code: res.StatusCode,
1171 Header: res.Header,
1172 })
1173 }
1174 if err != nil {
1175 return nil, err
1176 }
1177 defer googleapi.CloseBody(res)
1178 if err := googleapi.CheckResponse(res); err != nil {
1179 return nil, gensupport.WrapError(err)
1180 }
1181 ret := &Account{
1182 ServerResponse: googleapi.ServerResponse{
1183 Header: res.Header,
1184 HTTPStatusCode: res.StatusCode,
1185 },
1186 }
1187 target := &ret
1188 b, err := gensupport.DecodeResponseBytes(target, res)
1189 if err != nil {
1190 return nil, err
1191 }
1192 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.patch", "response", internallog.HTTPResponse(res, b))
1193 return ret, nil
1194 }
1195
1196 type AccountsAdminsCreateCall struct {
1197 s *Service
1198 parent string
1199 admin *Admin
1200 urlParams_ gensupport.URLParams
1201 ctx_ context.Context
1202 header_ http.Header
1203 }
1204
1205 // Create: Invites the specified user to become an administrator for the
1206 // specified account. The invitee must accept the invitation in order to be
1207 // granted access to the account. See AcceptInvitation to programmatically
1208 // accept an invitation.
1209 //
1210 // - parent: The resource name of the account this admin is created for.
1211 // `accounts/{account_id}`.
1212 func (r *AccountsAdminsService) Create(parent string, admin *Admin) *AccountsAdminsCreateCall {
1213 c := &AccountsAdminsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1214 c.parent = parent
1215 c.admin = admin
1216 return c
1217 }
1218
1219 // Fields allows partial responses to be retrieved. See
1220 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1221 // details.
1222 func (c *AccountsAdminsCreateCall) Fields(s ...googleapi.Field) *AccountsAdminsCreateCall {
1223 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1224 return c
1225 }
1226
1227 // Context sets the context to be used in this call's Do method.
1228 func (c *AccountsAdminsCreateCall) Context(ctx context.Context) *AccountsAdminsCreateCall {
1229 c.ctx_ = ctx
1230 return c
1231 }
1232
1233 // Header returns a http.Header that can be modified by the caller to add
1234 // headers to the request.
1235 func (c *AccountsAdminsCreateCall) Header() http.Header {
1236 if c.header_ == nil {
1237 c.header_ = make(http.Header)
1238 }
1239 return c.header_
1240 }
1241
1242 func (c *AccountsAdminsCreateCall) doRequest(alt string) (*http.Response, error) {
1243 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1244 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.admin)
1245 if err != nil {
1246 return nil, err
1247 }
1248 c.urlParams_.Set("alt", alt)
1249 c.urlParams_.Set("prettyPrint", "false")
1250 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/admins")
1251 urls += "?" + c.urlParams_.Encode()
1252 req, err := http.NewRequest("POST", urls, body)
1253 if err != nil {
1254 return nil, err
1255 }
1256 req.Header = reqHeaders
1257 googleapi.Expand(req.URL, map[string]string{
1258 "parent": c.parent,
1259 })
1260 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.admins.create", "request", internallog.HTTPRequest(req, body.Bytes()))
1261 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1262 }
1263
1264 // Do executes the "mybusinessaccountmanagement.accounts.admins.create" call.
1265 // Any non-2xx status code is an error. Response headers are in either
1266 // *Admin.ServerResponse.Header or (if a response was returned at all) in
1267 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1268 // whether the returned error was because http.StatusNotModified was returned.
1269 func (c *AccountsAdminsCreateCall) Do(opts ...googleapi.CallOption) (*Admin, error) {
1270 gensupport.SetOptions(c.urlParams_, opts...)
1271 res, err := c.doRequest("json")
1272 if res != nil && res.StatusCode == http.StatusNotModified {
1273 if res.Body != nil {
1274 res.Body.Close()
1275 }
1276 return nil, gensupport.WrapError(&googleapi.Error{
1277 Code: res.StatusCode,
1278 Header: res.Header,
1279 })
1280 }
1281 if err != nil {
1282 return nil, err
1283 }
1284 defer googleapi.CloseBody(res)
1285 if err := googleapi.CheckResponse(res); err != nil {
1286 return nil, gensupport.WrapError(err)
1287 }
1288 ret := &Admin{
1289 ServerResponse: googleapi.ServerResponse{
1290 Header: res.Header,
1291 HTTPStatusCode: res.StatusCode,
1292 },
1293 }
1294 target := &ret
1295 b, err := gensupport.DecodeResponseBytes(target, res)
1296 if err != nil {
1297 return nil, err
1298 }
1299 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.admins.create", "response", internallog.HTTPResponse(res, b))
1300 return ret, nil
1301 }
1302
1303 type AccountsAdminsDeleteCall struct {
1304 s *Service
1305 name string
1306 urlParams_ gensupport.URLParams
1307 ctx_ context.Context
1308 header_ http.Header
1309 }
1310
1311 // Delete: Removes the specified admin from the specified account.
1312 //
1313 // - name: The resource name of the admin to remove from the account.
1314 // `accounts/{account_id}/admins/{admin_id}`.
1315 func (r *AccountsAdminsService) Delete(name string) *AccountsAdminsDeleteCall {
1316 c := &AccountsAdminsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1317 c.name = name
1318 return c
1319 }
1320
1321 // Fields allows partial responses to be retrieved. See
1322 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1323 // details.
1324 func (c *AccountsAdminsDeleteCall) Fields(s ...googleapi.Field) *AccountsAdminsDeleteCall {
1325 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1326 return c
1327 }
1328
1329 // Context sets the context to be used in this call's Do method.
1330 func (c *AccountsAdminsDeleteCall) Context(ctx context.Context) *AccountsAdminsDeleteCall {
1331 c.ctx_ = ctx
1332 return c
1333 }
1334
1335 // Header returns a http.Header that can be modified by the caller to add
1336 // headers to the request.
1337 func (c *AccountsAdminsDeleteCall) Header() http.Header {
1338 if c.header_ == nil {
1339 c.header_ = make(http.Header)
1340 }
1341 return c.header_
1342 }
1343
1344 func (c *AccountsAdminsDeleteCall) doRequest(alt string) (*http.Response, error) {
1345 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1346 c.urlParams_.Set("alt", alt)
1347 c.urlParams_.Set("prettyPrint", "false")
1348 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1349 urls += "?" + c.urlParams_.Encode()
1350 req, err := http.NewRequest("DELETE", urls, nil)
1351 if err != nil {
1352 return nil, err
1353 }
1354 req.Header = reqHeaders
1355 googleapi.Expand(req.URL, map[string]string{
1356 "name": c.name,
1357 })
1358 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.admins.delete", "request", internallog.HTTPRequest(req, nil))
1359 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1360 }
1361
1362 // Do executes the "mybusinessaccountmanagement.accounts.admins.delete" call.
1363 // Any non-2xx status code is an error. Response headers are in either
1364 // *Empty.ServerResponse.Header or (if a response was returned at all) in
1365 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1366 // whether the returned error was because http.StatusNotModified was returned.
1367 func (c *AccountsAdminsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1368 gensupport.SetOptions(c.urlParams_, opts...)
1369 res, err := c.doRequest("json")
1370 if res != nil && res.StatusCode == http.StatusNotModified {
1371 if res.Body != nil {
1372 res.Body.Close()
1373 }
1374 return nil, gensupport.WrapError(&googleapi.Error{
1375 Code: res.StatusCode,
1376 Header: res.Header,
1377 })
1378 }
1379 if err != nil {
1380 return nil, err
1381 }
1382 defer googleapi.CloseBody(res)
1383 if err := googleapi.CheckResponse(res); err != nil {
1384 return nil, gensupport.WrapError(err)
1385 }
1386 ret := &Empty{
1387 ServerResponse: googleapi.ServerResponse{
1388 Header: res.Header,
1389 HTTPStatusCode: res.StatusCode,
1390 },
1391 }
1392 target := &ret
1393 b, err := gensupport.DecodeResponseBytes(target, res)
1394 if err != nil {
1395 return nil, err
1396 }
1397 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.admins.delete", "response", internallog.HTTPResponse(res, b))
1398 return ret, nil
1399 }
1400
1401 type AccountsAdminsListCall struct {
1402 s *Service
1403 parent string
1404 urlParams_ gensupport.URLParams
1405 ifNoneMatch_ string
1406 ctx_ context.Context
1407 header_ http.Header
1408 }
1409
1410 // List: Lists the admins for the specified account.
1411 //
1412 // - parent: The name of the account from which to retrieve a list of admins.
1413 // `accounts/{account_id}/admins`.
1414 func (r *AccountsAdminsService) List(parent string) *AccountsAdminsListCall {
1415 c := &AccountsAdminsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1416 c.parent = parent
1417 return c
1418 }
1419
1420 // Fields allows partial responses to be retrieved. See
1421 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1422 // details.
1423 func (c *AccountsAdminsListCall) Fields(s ...googleapi.Field) *AccountsAdminsListCall {
1424 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1425 return c
1426 }
1427
1428 // IfNoneMatch sets an optional parameter which makes the operation fail if the
1429 // object's ETag matches the given value. This is useful for getting updates
1430 // only after the object has changed since the last request.
1431 func (c *AccountsAdminsListCall) IfNoneMatch(entityTag string) *AccountsAdminsListCall {
1432 c.ifNoneMatch_ = entityTag
1433 return c
1434 }
1435
1436 // Context sets the context to be used in this call's Do method.
1437 func (c *AccountsAdminsListCall) Context(ctx context.Context) *AccountsAdminsListCall {
1438 c.ctx_ = ctx
1439 return c
1440 }
1441
1442 // Header returns a http.Header that can be modified by the caller to add
1443 // headers to the request.
1444 func (c *AccountsAdminsListCall) Header() http.Header {
1445 if c.header_ == nil {
1446 c.header_ = make(http.Header)
1447 }
1448 return c.header_
1449 }
1450
1451 func (c *AccountsAdminsListCall) doRequest(alt string) (*http.Response, error) {
1452 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1453 if c.ifNoneMatch_ != "" {
1454 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1455 }
1456 c.urlParams_.Set("alt", alt)
1457 c.urlParams_.Set("prettyPrint", "false")
1458 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/admins")
1459 urls += "?" + c.urlParams_.Encode()
1460 req, err := http.NewRequest("GET", urls, nil)
1461 if err != nil {
1462 return nil, err
1463 }
1464 req.Header = reqHeaders
1465 googleapi.Expand(req.URL, map[string]string{
1466 "parent": c.parent,
1467 })
1468 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.admins.list", "request", internallog.HTTPRequest(req, nil))
1469 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1470 }
1471
1472 // Do executes the "mybusinessaccountmanagement.accounts.admins.list" call.
1473 // Any non-2xx status code is an error. Response headers are in either
1474 // *ListAccountAdminsResponse.ServerResponse.Header or (if a response was
1475 // returned at all) in error.(*googleapi.Error).Header. Use
1476 // googleapi.IsNotModified to check whether the returned error was because
1477 // http.StatusNotModified was returned.
1478 func (c *AccountsAdminsListCall) Do(opts ...googleapi.CallOption) (*ListAccountAdminsResponse, error) {
1479 gensupport.SetOptions(c.urlParams_, opts...)
1480 res, err := c.doRequest("json")
1481 if res != nil && res.StatusCode == http.StatusNotModified {
1482 if res.Body != nil {
1483 res.Body.Close()
1484 }
1485 return nil, gensupport.WrapError(&googleapi.Error{
1486 Code: res.StatusCode,
1487 Header: res.Header,
1488 })
1489 }
1490 if err != nil {
1491 return nil, err
1492 }
1493 defer googleapi.CloseBody(res)
1494 if err := googleapi.CheckResponse(res); err != nil {
1495 return nil, gensupport.WrapError(err)
1496 }
1497 ret := &ListAccountAdminsResponse{
1498 ServerResponse: googleapi.ServerResponse{
1499 Header: res.Header,
1500 HTTPStatusCode: res.StatusCode,
1501 },
1502 }
1503 target := &ret
1504 b, err := gensupport.DecodeResponseBytes(target, res)
1505 if err != nil {
1506 return nil, err
1507 }
1508 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.admins.list", "response", internallog.HTTPResponse(res, b))
1509 return ret, nil
1510 }
1511
1512 type AccountsAdminsPatchCall struct {
1513 s *Service
1514 name string
1515 admin *Admin
1516 urlParams_ gensupport.URLParams
1517 ctx_ context.Context
1518 header_ http.Header
1519 }
1520
1521 // Patch: Updates the Admin for the specified Account Admin.
1522 //
1523 // - name: Immutable. The resource name. For account admins, this is in the
1524 // form: `accounts/{account_id}/admins/{admin_id}` For location admins, this
1525 // is in the form: `locations/{location_id}/admins/{admin_id}` This field
1526 // will be ignored if set during admin creation.
1527 func (r *AccountsAdminsService) Patch(name string, admin *Admin) *AccountsAdminsPatchCall {
1528 c := &AccountsAdminsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1529 c.name = name
1530 c.admin = admin
1531 return c
1532 }
1533
1534 // UpdateMask sets the optional parameter "updateMask": Required. The specific
1535 // fields that should be updated. The only editable field is role.
1536 func (c *AccountsAdminsPatchCall) UpdateMask(updateMask string) *AccountsAdminsPatchCall {
1537 c.urlParams_.Set("updateMask", updateMask)
1538 return c
1539 }
1540
1541 // Fields allows partial responses to be retrieved. See
1542 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1543 // details.
1544 func (c *AccountsAdminsPatchCall) Fields(s ...googleapi.Field) *AccountsAdminsPatchCall {
1545 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1546 return c
1547 }
1548
1549 // Context sets the context to be used in this call's Do method.
1550 func (c *AccountsAdminsPatchCall) Context(ctx context.Context) *AccountsAdminsPatchCall {
1551 c.ctx_ = ctx
1552 return c
1553 }
1554
1555 // Header returns a http.Header that can be modified by the caller to add
1556 // headers to the request.
1557 func (c *AccountsAdminsPatchCall) Header() http.Header {
1558 if c.header_ == nil {
1559 c.header_ = make(http.Header)
1560 }
1561 return c.header_
1562 }
1563
1564 func (c *AccountsAdminsPatchCall) doRequest(alt string) (*http.Response, error) {
1565 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1566 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.admin)
1567 if err != nil {
1568 return nil, err
1569 }
1570 c.urlParams_.Set("alt", alt)
1571 c.urlParams_.Set("prettyPrint", "false")
1572 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1573 urls += "?" + c.urlParams_.Encode()
1574 req, err := http.NewRequest("PATCH", urls, body)
1575 if err != nil {
1576 return nil, err
1577 }
1578 req.Header = reqHeaders
1579 googleapi.Expand(req.URL, map[string]string{
1580 "name": c.name,
1581 })
1582 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.admins.patch", "request", internallog.HTTPRequest(req, body.Bytes()))
1583 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1584 }
1585
1586 // Do executes the "mybusinessaccountmanagement.accounts.admins.patch" call.
1587 // Any non-2xx status code is an error. Response headers are in either
1588 // *Admin.ServerResponse.Header or (if a response was returned at all) in
1589 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1590 // whether the returned error was because http.StatusNotModified was returned.
1591 func (c *AccountsAdminsPatchCall) Do(opts ...googleapi.CallOption) (*Admin, error) {
1592 gensupport.SetOptions(c.urlParams_, opts...)
1593 res, err := c.doRequest("json")
1594 if res != nil && res.StatusCode == http.StatusNotModified {
1595 if res.Body != nil {
1596 res.Body.Close()
1597 }
1598 return nil, gensupport.WrapError(&googleapi.Error{
1599 Code: res.StatusCode,
1600 Header: res.Header,
1601 })
1602 }
1603 if err != nil {
1604 return nil, err
1605 }
1606 defer googleapi.CloseBody(res)
1607 if err := googleapi.CheckResponse(res); err != nil {
1608 return nil, gensupport.WrapError(err)
1609 }
1610 ret := &Admin{
1611 ServerResponse: googleapi.ServerResponse{
1612 Header: res.Header,
1613 HTTPStatusCode: res.StatusCode,
1614 },
1615 }
1616 target := &ret
1617 b, err := gensupport.DecodeResponseBytes(target, res)
1618 if err != nil {
1619 return nil, err
1620 }
1621 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.admins.patch", "response", internallog.HTTPResponse(res, b))
1622 return ret, nil
1623 }
1624
1625 type AccountsInvitationsAcceptCall struct {
1626 s *Service
1627 name string
1628 acceptinvitationrequest *AcceptInvitationRequest
1629 urlParams_ gensupport.URLParams
1630 ctx_ context.Context
1631 header_ http.Header
1632 }
1633
1634 // Accept: Accepts the specified invitation.
1635 //
1636 // - name: The name of the invitation that is being accepted.
1637 // `accounts/{account_id}/invitations/{invitation_id}`.
1638 func (r *AccountsInvitationsService) Accept(name string, acceptinvitationrequest *AcceptInvitationRequest) *AccountsInvitationsAcceptCall {
1639 c := &AccountsInvitationsAcceptCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1640 c.name = name
1641 c.acceptinvitationrequest = acceptinvitationrequest
1642 return c
1643 }
1644
1645 // Fields allows partial responses to be retrieved. See
1646 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1647 // details.
1648 func (c *AccountsInvitationsAcceptCall) Fields(s ...googleapi.Field) *AccountsInvitationsAcceptCall {
1649 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1650 return c
1651 }
1652
1653 // Context sets the context to be used in this call's Do method.
1654 func (c *AccountsInvitationsAcceptCall) Context(ctx context.Context) *AccountsInvitationsAcceptCall {
1655 c.ctx_ = ctx
1656 return c
1657 }
1658
1659 // Header returns a http.Header that can be modified by the caller to add
1660 // headers to the request.
1661 func (c *AccountsInvitationsAcceptCall) Header() http.Header {
1662 if c.header_ == nil {
1663 c.header_ = make(http.Header)
1664 }
1665 return c.header_
1666 }
1667
1668 func (c *AccountsInvitationsAcceptCall) doRequest(alt string) (*http.Response, error) {
1669 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1670 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.acceptinvitationrequest)
1671 if err != nil {
1672 return nil, err
1673 }
1674 c.urlParams_.Set("alt", alt)
1675 c.urlParams_.Set("prettyPrint", "false")
1676 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:accept")
1677 urls += "?" + c.urlParams_.Encode()
1678 req, err := http.NewRequest("POST", urls, body)
1679 if err != nil {
1680 return nil, err
1681 }
1682 req.Header = reqHeaders
1683 googleapi.Expand(req.URL, map[string]string{
1684 "name": c.name,
1685 })
1686 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.invitations.accept", "request", internallog.HTTPRequest(req, body.Bytes()))
1687 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1688 }
1689
1690 // Do executes the "mybusinessaccountmanagement.accounts.invitations.accept" call.
1691 // Any non-2xx status code is an error. Response headers are in either
1692 // *Empty.ServerResponse.Header or (if a response was returned at all) in
1693 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1694 // whether the returned error was because http.StatusNotModified was returned.
1695 func (c *AccountsInvitationsAcceptCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1696 gensupport.SetOptions(c.urlParams_, opts...)
1697 res, err := c.doRequest("json")
1698 if res != nil && res.StatusCode == http.StatusNotModified {
1699 if res.Body != nil {
1700 res.Body.Close()
1701 }
1702 return nil, gensupport.WrapError(&googleapi.Error{
1703 Code: res.StatusCode,
1704 Header: res.Header,
1705 })
1706 }
1707 if err != nil {
1708 return nil, err
1709 }
1710 defer googleapi.CloseBody(res)
1711 if err := googleapi.CheckResponse(res); err != nil {
1712 return nil, gensupport.WrapError(err)
1713 }
1714 ret := &Empty{
1715 ServerResponse: googleapi.ServerResponse{
1716 Header: res.Header,
1717 HTTPStatusCode: res.StatusCode,
1718 },
1719 }
1720 target := &ret
1721 b, err := gensupport.DecodeResponseBytes(target, res)
1722 if err != nil {
1723 return nil, err
1724 }
1725 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.invitations.accept", "response", internallog.HTTPResponse(res, b))
1726 return ret, nil
1727 }
1728
1729 type AccountsInvitationsDeclineCall struct {
1730 s *Service
1731 name string
1732 declineinvitationrequest *DeclineInvitationRequest
1733 urlParams_ gensupport.URLParams
1734 ctx_ context.Context
1735 header_ http.Header
1736 }
1737
1738 // Decline: Declines the specified invitation.
1739 //
1740 // - name: The name of the account invitation that is being declined.
1741 // `accounts/{account_id}/invitations/{invitation_id}`.
1742 func (r *AccountsInvitationsService) Decline(name string, declineinvitationrequest *DeclineInvitationRequest) *AccountsInvitationsDeclineCall {
1743 c := &AccountsInvitationsDeclineCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1744 c.name = name
1745 c.declineinvitationrequest = declineinvitationrequest
1746 return c
1747 }
1748
1749 // Fields allows partial responses to be retrieved. See
1750 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1751 // details.
1752 func (c *AccountsInvitationsDeclineCall) Fields(s ...googleapi.Field) *AccountsInvitationsDeclineCall {
1753 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1754 return c
1755 }
1756
1757 // Context sets the context to be used in this call's Do method.
1758 func (c *AccountsInvitationsDeclineCall) Context(ctx context.Context) *AccountsInvitationsDeclineCall {
1759 c.ctx_ = ctx
1760 return c
1761 }
1762
1763 // Header returns a http.Header that can be modified by the caller to add
1764 // headers to the request.
1765 func (c *AccountsInvitationsDeclineCall) Header() http.Header {
1766 if c.header_ == nil {
1767 c.header_ = make(http.Header)
1768 }
1769 return c.header_
1770 }
1771
1772 func (c *AccountsInvitationsDeclineCall) doRequest(alt string) (*http.Response, error) {
1773 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1774 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.declineinvitationrequest)
1775 if err != nil {
1776 return nil, err
1777 }
1778 c.urlParams_.Set("alt", alt)
1779 c.urlParams_.Set("prettyPrint", "false")
1780 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:decline")
1781 urls += "?" + c.urlParams_.Encode()
1782 req, err := http.NewRequest("POST", urls, body)
1783 if err != nil {
1784 return nil, err
1785 }
1786 req.Header = reqHeaders
1787 googleapi.Expand(req.URL, map[string]string{
1788 "name": c.name,
1789 })
1790 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.invitations.decline", "request", internallog.HTTPRequest(req, body.Bytes()))
1791 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1792 }
1793
1794 // Do executes the "mybusinessaccountmanagement.accounts.invitations.decline" call.
1795 // Any non-2xx status code is an error. Response headers are in either
1796 // *Empty.ServerResponse.Header or (if a response was returned at all) in
1797 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1798 // whether the returned error was because http.StatusNotModified was returned.
1799 func (c *AccountsInvitationsDeclineCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1800 gensupport.SetOptions(c.urlParams_, opts...)
1801 res, err := c.doRequest("json")
1802 if res != nil && res.StatusCode == http.StatusNotModified {
1803 if res.Body != nil {
1804 res.Body.Close()
1805 }
1806 return nil, gensupport.WrapError(&googleapi.Error{
1807 Code: res.StatusCode,
1808 Header: res.Header,
1809 })
1810 }
1811 if err != nil {
1812 return nil, err
1813 }
1814 defer googleapi.CloseBody(res)
1815 if err := googleapi.CheckResponse(res); err != nil {
1816 return nil, gensupport.WrapError(err)
1817 }
1818 ret := &Empty{
1819 ServerResponse: googleapi.ServerResponse{
1820 Header: res.Header,
1821 HTTPStatusCode: res.StatusCode,
1822 },
1823 }
1824 target := &ret
1825 b, err := gensupport.DecodeResponseBytes(target, res)
1826 if err != nil {
1827 return nil, err
1828 }
1829 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.invitations.decline", "response", internallog.HTTPResponse(res, b))
1830 return ret, nil
1831 }
1832
1833 type AccountsInvitationsListCall struct {
1834 s *Service
1835 parent string
1836 urlParams_ gensupport.URLParams
1837 ifNoneMatch_ string
1838 ctx_ context.Context
1839 header_ http.Header
1840 }
1841
1842 // List: Lists pending invitations for the specified account.
1843 //
1844 // - parent: The name of the account from which the list of invitations is
1845 // being retrieved. `accounts/{account_id}/invitations`.
1846 func (r *AccountsInvitationsService) List(parent string) *AccountsInvitationsListCall {
1847 c := &AccountsInvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1848 c.parent = parent
1849 return c
1850 }
1851
1852 // Filter sets the optional parameter "filter": Filtering the response is
1853 // supported via the Invitation.target_type field.
1854 func (c *AccountsInvitationsListCall) Filter(filter string) *AccountsInvitationsListCall {
1855 c.urlParams_.Set("filter", filter)
1856 return c
1857 }
1858
1859 // Fields allows partial responses to be retrieved. See
1860 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1861 // details.
1862 func (c *AccountsInvitationsListCall) Fields(s ...googleapi.Field) *AccountsInvitationsListCall {
1863 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1864 return c
1865 }
1866
1867 // IfNoneMatch sets an optional parameter which makes the operation fail if the
1868 // object's ETag matches the given value. This is useful for getting updates
1869 // only after the object has changed since the last request.
1870 func (c *AccountsInvitationsListCall) IfNoneMatch(entityTag string) *AccountsInvitationsListCall {
1871 c.ifNoneMatch_ = entityTag
1872 return c
1873 }
1874
1875 // Context sets the context to be used in this call's Do method.
1876 func (c *AccountsInvitationsListCall) Context(ctx context.Context) *AccountsInvitationsListCall {
1877 c.ctx_ = ctx
1878 return c
1879 }
1880
1881 // Header returns a http.Header that can be modified by the caller to add
1882 // headers to the request.
1883 func (c *AccountsInvitationsListCall) Header() http.Header {
1884 if c.header_ == nil {
1885 c.header_ = make(http.Header)
1886 }
1887 return c.header_
1888 }
1889
1890 func (c *AccountsInvitationsListCall) doRequest(alt string) (*http.Response, error) {
1891 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1892 if c.ifNoneMatch_ != "" {
1893 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1894 }
1895 c.urlParams_.Set("alt", alt)
1896 c.urlParams_.Set("prettyPrint", "false")
1897 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/invitations")
1898 urls += "?" + c.urlParams_.Encode()
1899 req, err := http.NewRequest("GET", urls, nil)
1900 if err != nil {
1901 return nil, err
1902 }
1903 req.Header = reqHeaders
1904 googleapi.Expand(req.URL, map[string]string{
1905 "parent": c.parent,
1906 })
1907 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.invitations.list", "request", internallog.HTTPRequest(req, nil))
1908 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1909 }
1910
1911 // Do executes the "mybusinessaccountmanagement.accounts.invitations.list" call.
1912 // Any non-2xx status code is an error. Response headers are in either
1913 // *ListInvitationsResponse.ServerResponse.Header or (if a response was
1914 // returned at all) in error.(*googleapi.Error).Header. Use
1915 // googleapi.IsNotModified to check whether the returned error was because
1916 // http.StatusNotModified was returned.
1917 func (c *AccountsInvitationsListCall) Do(opts ...googleapi.CallOption) (*ListInvitationsResponse, error) {
1918 gensupport.SetOptions(c.urlParams_, opts...)
1919 res, err := c.doRequest("json")
1920 if res != nil && res.StatusCode == http.StatusNotModified {
1921 if res.Body != nil {
1922 res.Body.Close()
1923 }
1924 return nil, gensupport.WrapError(&googleapi.Error{
1925 Code: res.StatusCode,
1926 Header: res.Header,
1927 })
1928 }
1929 if err != nil {
1930 return nil, err
1931 }
1932 defer googleapi.CloseBody(res)
1933 if err := googleapi.CheckResponse(res); err != nil {
1934 return nil, gensupport.WrapError(err)
1935 }
1936 ret := &ListInvitationsResponse{
1937 ServerResponse: googleapi.ServerResponse{
1938 Header: res.Header,
1939 HTTPStatusCode: res.StatusCode,
1940 },
1941 }
1942 target := &ret
1943 b, err := gensupport.DecodeResponseBytes(target, res)
1944 if err != nil {
1945 return nil, err
1946 }
1947 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.accounts.invitations.list", "response", internallog.HTTPResponse(res, b))
1948 return ret, nil
1949 }
1950
1951 type LocationsTransferCall struct {
1952 s *Service
1953 name string
1954 transferlocationrequest *TransferLocationRequest
1955 urlParams_ gensupport.URLParams
1956 ctx_ context.Context
1957 header_ http.Header
1958 }
1959
1960 // Transfer: Moves a location from an account that the user owns to another
1961 // account that the same user administers. The user must be an owner of the
1962 // account the location is currently associated with and must also be at least
1963 // a manager of the destination account.
1964 //
1965 // - name: The name of the location to transfer. `locations/{location_id}`.
1966 func (r *LocationsService) Transfer(name string, transferlocationrequest *TransferLocationRequest) *LocationsTransferCall {
1967 c := &LocationsTransferCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1968 c.name = name
1969 c.transferlocationrequest = transferlocationrequest
1970 return c
1971 }
1972
1973 // Fields allows partial responses to be retrieved. See
1974 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1975 // details.
1976 func (c *LocationsTransferCall) Fields(s ...googleapi.Field) *LocationsTransferCall {
1977 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1978 return c
1979 }
1980
1981 // Context sets the context to be used in this call's Do method.
1982 func (c *LocationsTransferCall) Context(ctx context.Context) *LocationsTransferCall {
1983 c.ctx_ = ctx
1984 return c
1985 }
1986
1987 // Header returns a http.Header that can be modified by the caller to add
1988 // headers to the request.
1989 func (c *LocationsTransferCall) Header() http.Header {
1990 if c.header_ == nil {
1991 c.header_ = make(http.Header)
1992 }
1993 return c.header_
1994 }
1995
1996 func (c *LocationsTransferCall) doRequest(alt string) (*http.Response, error) {
1997 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1998 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.transferlocationrequest)
1999 if err != nil {
2000 return nil, err
2001 }
2002 c.urlParams_.Set("alt", alt)
2003 c.urlParams_.Set("prettyPrint", "false")
2004 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:transfer")
2005 urls += "?" + c.urlParams_.Encode()
2006 req, err := http.NewRequest("POST", urls, body)
2007 if err != nil {
2008 return nil, err
2009 }
2010 req.Header = reqHeaders
2011 googleapi.Expand(req.URL, map[string]string{
2012 "name": c.name,
2013 })
2014 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.locations.transfer", "request", internallog.HTTPRequest(req, body.Bytes()))
2015 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2016 }
2017
2018 // Do executes the "mybusinessaccountmanagement.locations.transfer" call.
2019 // Any non-2xx status code is an error. Response headers are in either
2020 // *Empty.ServerResponse.Header or (if a response was returned at all) in
2021 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2022 // whether the returned error was because http.StatusNotModified was returned.
2023 func (c *LocationsTransferCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2024 gensupport.SetOptions(c.urlParams_, opts...)
2025 res, err := c.doRequest("json")
2026 if res != nil && res.StatusCode == http.StatusNotModified {
2027 if res.Body != nil {
2028 res.Body.Close()
2029 }
2030 return nil, gensupport.WrapError(&googleapi.Error{
2031 Code: res.StatusCode,
2032 Header: res.Header,
2033 })
2034 }
2035 if err != nil {
2036 return nil, err
2037 }
2038 defer googleapi.CloseBody(res)
2039 if err := googleapi.CheckResponse(res); err != nil {
2040 return nil, gensupport.WrapError(err)
2041 }
2042 ret := &Empty{
2043 ServerResponse: googleapi.ServerResponse{
2044 Header: res.Header,
2045 HTTPStatusCode: res.StatusCode,
2046 },
2047 }
2048 target := &ret
2049 b, err := gensupport.DecodeResponseBytes(target, res)
2050 if err != nil {
2051 return nil, err
2052 }
2053 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.locations.transfer", "response", internallog.HTTPResponse(res, b))
2054 return ret, nil
2055 }
2056
2057 type LocationsAdminsCreateCall struct {
2058 s *Service
2059 parent string
2060 admin *Admin
2061 urlParams_ gensupport.URLParams
2062 ctx_ context.Context
2063 header_ http.Header
2064 }
2065
2066 // Create: Invites the specified user to become an administrator for the
2067 // specified location. The invitee must accept the invitation in order to be
2068 // granted access to the location. See AcceptInvitation to programmatically
2069 // accept an invitation.
2070 //
2071 // - parent: The resource name of the location this admin is created for.
2072 // `locations/{location_id}/admins`.
2073 func (r *LocationsAdminsService) Create(parent string, admin *Admin) *LocationsAdminsCreateCall {
2074 c := &LocationsAdminsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2075 c.parent = parent
2076 c.admin = admin
2077 return c
2078 }
2079
2080 // Fields allows partial responses to be retrieved. See
2081 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2082 // details.
2083 func (c *LocationsAdminsCreateCall) Fields(s ...googleapi.Field) *LocationsAdminsCreateCall {
2084 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2085 return c
2086 }
2087
2088 // Context sets the context to be used in this call's Do method.
2089 func (c *LocationsAdminsCreateCall) Context(ctx context.Context) *LocationsAdminsCreateCall {
2090 c.ctx_ = ctx
2091 return c
2092 }
2093
2094 // Header returns a http.Header that can be modified by the caller to add
2095 // headers to the request.
2096 func (c *LocationsAdminsCreateCall) Header() http.Header {
2097 if c.header_ == nil {
2098 c.header_ = make(http.Header)
2099 }
2100 return c.header_
2101 }
2102
2103 func (c *LocationsAdminsCreateCall) doRequest(alt string) (*http.Response, error) {
2104 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2105 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.admin)
2106 if err != nil {
2107 return nil, err
2108 }
2109 c.urlParams_.Set("alt", alt)
2110 c.urlParams_.Set("prettyPrint", "false")
2111 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/admins")
2112 urls += "?" + c.urlParams_.Encode()
2113 req, err := http.NewRequest("POST", urls, body)
2114 if err != nil {
2115 return nil, err
2116 }
2117 req.Header = reqHeaders
2118 googleapi.Expand(req.URL, map[string]string{
2119 "parent": c.parent,
2120 })
2121 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.locations.admins.create", "request", internallog.HTTPRequest(req, body.Bytes()))
2122 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2123 }
2124
2125 // Do executes the "mybusinessaccountmanagement.locations.admins.create" call.
2126 // Any non-2xx status code is an error. Response headers are in either
2127 // *Admin.ServerResponse.Header or (if a response was returned at all) in
2128 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2129 // whether the returned error was because http.StatusNotModified was returned.
2130 func (c *LocationsAdminsCreateCall) Do(opts ...googleapi.CallOption) (*Admin, error) {
2131 gensupport.SetOptions(c.urlParams_, opts...)
2132 res, err := c.doRequest("json")
2133 if res != nil && res.StatusCode == http.StatusNotModified {
2134 if res.Body != nil {
2135 res.Body.Close()
2136 }
2137 return nil, gensupport.WrapError(&googleapi.Error{
2138 Code: res.StatusCode,
2139 Header: res.Header,
2140 })
2141 }
2142 if err != nil {
2143 return nil, err
2144 }
2145 defer googleapi.CloseBody(res)
2146 if err := googleapi.CheckResponse(res); err != nil {
2147 return nil, gensupport.WrapError(err)
2148 }
2149 ret := &Admin{
2150 ServerResponse: googleapi.ServerResponse{
2151 Header: res.Header,
2152 HTTPStatusCode: res.StatusCode,
2153 },
2154 }
2155 target := &ret
2156 b, err := gensupport.DecodeResponseBytes(target, res)
2157 if err != nil {
2158 return nil, err
2159 }
2160 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.locations.admins.create", "response", internallog.HTTPResponse(res, b))
2161 return ret, nil
2162 }
2163
2164 type LocationsAdminsDeleteCall struct {
2165 s *Service
2166 name string
2167 urlParams_ gensupport.URLParams
2168 ctx_ context.Context
2169 header_ http.Header
2170 }
2171
2172 // Delete: Removes the specified admin as a manager of the specified location.
2173 //
2174 // - name: The resource name of the admin to remove from the location.
2175 func (r *LocationsAdminsService) Delete(name string) *LocationsAdminsDeleteCall {
2176 c := &LocationsAdminsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2177 c.name = name
2178 return c
2179 }
2180
2181 // Fields allows partial responses to be retrieved. See
2182 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2183 // details.
2184 func (c *LocationsAdminsDeleteCall) Fields(s ...googleapi.Field) *LocationsAdminsDeleteCall {
2185 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2186 return c
2187 }
2188
2189 // Context sets the context to be used in this call's Do method.
2190 func (c *LocationsAdminsDeleteCall) Context(ctx context.Context) *LocationsAdminsDeleteCall {
2191 c.ctx_ = ctx
2192 return c
2193 }
2194
2195 // Header returns a http.Header that can be modified by the caller to add
2196 // headers to the request.
2197 func (c *LocationsAdminsDeleteCall) Header() http.Header {
2198 if c.header_ == nil {
2199 c.header_ = make(http.Header)
2200 }
2201 return c.header_
2202 }
2203
2204 func (c *LocationsAdminsDeleteCall) doRequest(alt string) (*http.Response, error) {
2205 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2206 c.urlParams_.Set("alt", alt)
2207 c.urlParams_.Set("prettyPrint", "false")
2208 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
2209 urls += "?" + c.urlParams_.Encode()
2210 req, err := http.NewRequest("DELETE", urls, nil)
2211 if err != nil {
2212 return nil, err
2213 }
2214 req.Header = reqHeaders
2215 googleapi.Expand(req.URL, map[string]string{
2216 "name": c.name,
2217 })
2218 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.locations.admins.delete", "request", internallog.HTTPRequest(req, nil))
2219 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2220 }
2221
2222 // Do executes the "mybusinessaccountmanagement.locations.admins.delete" call.
2223 // Any non-2xx status code is an error. Response headers are in either
2224 // *Empty.ServerResponse.Header or (if a response was returned at all) in
2225 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2226 // whether the returned error was because http.StatusNotModified was returned.
2227 func (c *LocationsAdminsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2228 gensupport.SetOptions(c.urlParams_, opts...)
2229 res, err := c.doRequest("json")
2230 if res != nil && res.StatusCode == http.StatusNotModified {
2231 if res.Body != nil {
2232 res.Body.Close()
2233 }
2234 return nil, gensupport.WrapError(&googleapi.Error{
2235 Code: res.StatusCode,
2236 Header: res.Header,
2237 })
2238 }
2239 if err != nil {
2240 return nil, err
2241 }
2242 defer googleapi.CloseBody(res)
2243 if err := googleapi.CheckResponse(res); err != nil {
2244 return nil, gensupport.WrapError(err)
2245 }
2246 ret := &Empty{
2247 ServerResponse: googleapi.ServerResponse{
2248 Header: res.Header,
2249 HTTPStatusCode: res.StatusCode,
2250 },
2251 }
2252 target := &ret
2253 b, err := gensupport.DecodeResponseBytes(target, res)
2254 if err != nil {
2255 return nil, err
2256 }
2257 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.locations.admins.delete", "response", internallog.HTTPResponse(res, b))
2258 return ret, nil
2259 }
2260
2261 type LocationsAdminsListCall struct {
2262 s *Service
2263 parent string
2264 urlParams_ gensupport.URLParams
2265 ifNoneMatch_ string
2266 ctx_ context.Context
2267 header_ http.Header
2268 }
2269
2270 // List: Lists all of the admins for the specified location.
2271 //
2272 // - parent: The name of the location to list admins of.
2273 // `locations/{location_id}/admins`.
2274 func (r *LocationsAdminsService) List(parent string) *LocationsAdminsListCall {
2275 c := &LocationsAdminsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2276 c.parent = parent
2277 return c
2278 }
2279
2280 // Fields allows partial responses to be retrieved. See
2281 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2282 // details.
2283 func (c *LocationsAdminsListCall) Fields(s ...googleapi.Field) *LocationsAdminsListCall {
2284 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2285 return c
2286 }
2287
2288 // IfNoneMatch sets an optional parameter which makes the operation fail if the
2289 // object's ETag matches the given value. This is useful for getting updates
2290 // only after the object has changed since the last request.
2291 func (c *LocationsAdminsListCall) IfNoneMatch(entityTag string) *LocationsAdminsListCall {
2292 c.ifNoneMatch_ = entityTag
2293 return c
2294 }
2295
2296 // Context sets the context to be used in this call's Do method.
2297 func (c *LocationsAdminsListCall) Context(ctx context.Context) *LocationsAdminsListCall {
2298 c.ctx_ = ctx
2299 return c
2300 }
2301
2302 // Header returns a http.Header that can be modified by the caller to add
2303 // headers to the request.
2304 func (c *LocationsAdminsListCall) Header() http.Header {
2305 if c.header_ == nil {
2306 c.header_ = make(http.Header)
2307 }
2308 return c.header_
2309 }
2310
2311 func (c *LocationsAdminsListCall) doRequest(alt string) (*http.Response, error) {
2312 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2313 if c.ifNoneMatch_ != "" {
2314 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2315 }
2316 c.urlParams_.Set("alt", alt)
2317 c.urlParams_.Set("prettyPrint", "false")
2318 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/admins")
2319 urls += "?" + c.urlParams_.Encode()
2320 req, err := http.NewRequest("GET", urls, nil)
2321 if err != nil {
2322 return nil, err
2323 }
2324 req.Header = reqHeaders
2325 googleapi.Expand(req.URL, map[string]string{
2326 "parent": c.parent,
2327 })
2328 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.locations.admins.list", "request", internallog.HTTPRequest(req, nil))
2329 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2330 }
2331
2332 // Do executes the "mybusinessaccountmanagement.locations.admins.list" call.
2333 // Any non-2xx status code is an error. Response headers are in either
2334 // *ListLocationAdminsResponse.ServerResponse.Header or (if a response was
2335 // returned at all) in error.(*googleapi.Error).Header. Use
2336 // googleapi.IsNotModified to check whether the returned error was because
2337 // http.StatusNotModified was returned.
2338 func (c *LocationsAdminsListCall) Do(opts ...googleapi.CallOption) (*ListLocationAdminsResponse, error) {
2339 gensupport.SetOptions(c.urlParams_, opts...)
2340 res, err := c.doRequest("json")
2341 if res != nil && res.StatusCode == http.StatusNotModified {
2342 if res.Body != nil {
2343 res.Body.Close()
2344 }
2345 return nil, gensupport.WrapError(&googleapi.Error{
2346 Code: res.StatusCode,
2347 Header: res.Header,
2348 })
2349 }
2350 if err != nil {
2351 return nil, err
2352 }
2353 defer googleapi.CloseBody(res)
2354 if err := googleapi.CheckResponse(res); err != nil {
2355 return nil, gensupport.WrapError(err)
2356 }
2357 ret := &ListLocationAdminsResponse{
2358 ServerResponse: googleapi.ServerResponse{
2359 Header: res.Header,
2360 HTTPStatusCode: res.StatusCode,
2361 },
2362 }
2363 target := &ret
2364 b, err := gensupport.DecodeResponseBytes(target, res)
2365 if err != nil {
2366 return nil, err
2367 }
2368 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.locations.admins.list", "response", internallog.HTTPResponse(res, b))
2369 return ret, nil
2370 }
2371
2372 type LocationsAdminsPatchCall struct {
2373 s *Service
2374 name string
2375 admin *Admin
2376 urlParams_ gensupport.URLParams
2377 ctx_ context.Context
2378 header_ http.Header
2379 }
2380
2381 // Patch: Updates the Admin for the specified location. Only the AdminRole of
2382 // the Admin can be updated.
2383 //
2384 // - name: Immutable. The resource name. For account admins, this is in the
2385 // form: `accounts/{account_id}/admins/{admin_id}` For location admins, this
2386 // is in the form: `locations/{location_id}/admins/{admin_id}` This field
2387 // will be ignored if set during admin creation.
2388 func (r *LocationsAdminsService) Patch(name string, admin *Admin) *LocationsAdminsPatchCall {
2389 c := &LocationsAdminsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2390 c.name = name
2391 c.admin = admin
2392 return c
2393 }
2394
2395 // UpdateMask sets the optional parameter "updateMask": Required. The specific
2396 // fields that should be updated. The only editable field is role.
2397 func (c *LocationsAdminsPatchCall) UpdateMask(updateMask string) *LocationsAdminsPatchCall {
2398 c.urlParams_.Set("updateMask", updateMask)
2399 return c
2400 }
2401
2402 // Fields allows partial responses to be retrieved. See
2403 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2404 // details.
2405 func (c *LocationsAdminsPatchCall) Fields(s ...googleapi.Field) *LocationsAdminsPatchCall {
2406 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2407 return c
2408 }
2409
2410 // Context sets the context to be used in this call's Do method.
2411 func (c *LocationsAdminsPatchCall) Context(ctx context.Context) *LocationsAdminsPatchCall {
2412 c.ctx_ = ctx
2413 return c
2414 }
2415
2416 // Header returns a http.Header that can be modified by the caller to add
2417 // headers to the request.
2418 func (c *LocationsAdminsPatchCall) Header() http.Header {
2419 if c.header_ == nil {
2420 c.header_ = make(http.Header)
2421 }
2422 return c.header_
2423 }
2424
2425 func (c *LocationsAdminsPatchCall) doRequest(alt string) (*http.Response, error) {
2426 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2427 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.admin)
2428 if err != nil {
2429 return nil, err
2430 }
2431 c.urlParams_.Set("alt", alt)
2432 c.urlParams_.Set("prettyPrint", "false")
2433 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
2434 urls += "?" + c.urlParams_.Encode()
2435 req, err := http.NewRequest("PATCH", urls, body)
2436 if err != nil {
2437 return nil, err
2438 }
2439 req.Header = reqHeaders
2440 googleapi.Expand(req.URL, map[string]string{
2441 "name": c.name,
2442 })
2443 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.locations.admins.patch", "request", internallog.HTTPRequest(req, body.Bytes()))
2444 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2445 }
2446
2447 // Do executes the "mybusinessaccountmanagement.locations.admins.patch" call.
2448 // Any non-2xx status code is an error. Response headers are in either
2449 // *Admin.ServerResponse.Header or (if a response was returned at all) in
2450 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2451 // whether the returned error was because http.StatusNotModified was returned.
2452 func (c *LocationsAdminsPatchCall) Do(opts ...googleapi.CallOption) (*Admin, error) {
2453 gensupport.SetOptions(c.urlParams_, opts...)
2454 res, err := c.doRequest("json")
2455 if res != nil && res.StatusCode == http.StatusNotModified {
2456 if res.Body != nil {
2457 res.Body.Close()
2458 }
2459 return nil, gensupport.WrapError(&googleapi.Error{
2460 Code: res.StatusCode,
2461 Header: res.Header,
2462 })
2463 }
2464 if err != nil {
2465 return nil, err
2466 }
2467 defer googleapi.CloseBody(res)
2468 if err := googleapi.CheckResponse(res); err != nil {
2469 return nil, gensupport.WrapError(err)
2470 }
2471 ret := &Admin{
2472 ServerResponse: googleapi.ServerResponse{
2473 Header: res.Header,
2474 HTTPStatusCode: res.StatusCode,
2475 },
2476 }
2477 target := &ret
2478 b, err := gensupport.DecodeResponseBytes(target, res)
2479 if err != nil {
2480 return nil, err
2481 }
2482 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "mybusinessaccountmanagement.locations.admins.patch", "response", internallog.HTTPResponse(res, b))
2483 return ret, nil
2484 }