You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21542 regels
685 KiB

  1. // Copyright 2019 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. // Code generated file. DO NOT EDIT.
  5. // Package admin provides access to the Admin Directory API.
  6. //
  7. // For product documentation, see: https://developers.google.com/admin-sdk/directory/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/admin/directory/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // adminService, err := admin.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // adminService, err := admin.NewService(ctx, option.WithScopes(admin.AdminDirectoryUserschemaReadonlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // adminService, err := admin.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // adminService, err := admin.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package admin // import "google.golang.org/api/admin/directory/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "admin:directory_v1"
  71. const apiName = "admin"
  72. const apiVersion = "directory_v1"
  73. const basePath = "https://www.googleapis.com/admin/directory/v1/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage customer related information
  77. AdminDirectoryCustomerScope = "https://www.googleapis.com/auth/admin.directory.customer"
  78. // View customer related information
  79. AdminDirectoryCustomerReadonlyScope = "https://www.googleapis.com/auth/admin.directory.customer.readonly"
  80. // View and manage your Chrome OS devices' metadata
  81. AdminDirectoryDeviceChromeosScope = "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  82. // View your Chrome OS devices' metadata
  83. AdminDirectoryDeviceChromeosReadonlyScope = "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly"
  84. // View and manage your mobile devices' metadata
  85. AdminDirectoryDeviceMobileScope = "https://www.googleapis.com/auth/admin.directory.device.mobile"
  86. // Manage your mobile devices by performing administrative tasks
  87. AdminDirectoryDeviceMobileActionScope = "https://www.googleapis.com/auth/admin.directory.device.mobile.action"
  88. // View your mobile devices' metadata
  89. AdminDirectoryDeviceMobileReadonlyScope = "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly"
  90. // View and manage the provisioning of domains for your customers
  91. AdminDirectoryDomainScope = "https://www.googleapis.com/auth/admin.directory.domain"
  92. // View domains related to your customers
  93. AdminDirectoryDomainReadonlyScope = "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  94. // View and manage the provisioning of groups on your domain
  95. AdminDirectoryGroupScope = "https://www.googleapis.com/auth/admin.directory.group"
  96. // View and manage group subscriptions on your domain
  97. AdminDirectoryGroupMemberScope = "https://www.googleapis.com/auth/admin.directory.group.member"
  98. // View group subscriptions on your domain
  99. AdminDirectoryGroupMemberReadonlyScope = "https://www.googleapis.com/auth/admin.directory.group.member.readonly"
  100. // View groups on your domain
  101. AdminDirectoryGroupReadonlyScope = "https://www.googleapis.com/auth/admin.directory.group.readonly"
  102. // View and manage notifications received on your domain
  103. AdminDirectoryNotificationsScope = "https://www.googleapis.com/auth/admin.directory.notifications"
  104. // View and manage organization units on your domain
  105. AdminDirectoryOrgunitScope = "https://www.googleapis.com/auth/admin.directory.orgunit"
  106. // View organization units on your domain
  107. AdminDirectoryOrgunitReadonlyScope = "https://www.googleapis.com/auth/admin.directory.orgunit.readonly"
  108. // View and manage the provisioning of calendar resources on your domain
  109. AdminDirectoryResourceCalendarScope = "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  110. // View calendar resources on your domain
  111. AdminDirectoryResourceCalendarReadonlyScope = "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  112. // Manage delegated admin roles for your domain
  113. AdminDirectoryRolemanagementScope = "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  114. // View delegated admin roles for your domain
  115. AdminDirectoryRolemanagementReadonlyScope = "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  116. // View and manage the provisioning of users on your domain
  117. AdminDirectoryUserScope = "https://www.googleapis.com/auth/admin.directory.user"
  118. // View and manage user aliases on your domain
  119. AdminDirectoryUserAliasScope = "https://www.googleapis.com/auth/admin.directory.user.alias"
  120. // View user aliases on your domain
  121. AdminDirectoryUserAliasReadonlyScope = "https://www.googleapis.com/auth/admin.directory.user.alias.readonly"
  122. // View users on your domain
  123. AdminDirectoryUserReadonlyScope = "https://www.googleapis.com/auth/admin.directory.user.readonly"
  124. // Manage data access permissions for users on your domain
  125. AdminDirectoryUserSecurityScope = "https://www.googleapis.com/auth/admin.directory.user.security"
  126. // View and manage the provisioning of user schemas on your domain
  127. AdminDirectoryUserschemaScope = "https://www.googleapis.com/auth/admin.directory.userschema"
  128. // View user schemas on your domain
  129. AdminDirectoryUserschemaReadonlyScope = "https://www.googleapis.com/auth/admin.directory.userschema.readonly"
  130. )
  131. // NewService creates a new Service.
  132. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  133. scopesOption := option.WithScopes(
  134. "https://www.googleapis.com/auth/admin.directory.customer",
  135. "https://www.googleapis.com/auth/admin.directory.customer.readonly",
  136. "https://www.googleapis.com/auth/admin.directory.device.chromeos",
  137. "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly",
  138. "https://www.googleapis.com/auth/admin.directory.device.mobile",
  139. "https://www.googleapis.com/auth/admin.directory.device.mobile.action",
  140. "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly",
  141. "https://www.googleapis.com/auth/admin.directory.domain",
  142. "https://www.googleapis.com/auth/admin.directory.domain.readonly",
  143. "https://www.googleapis.com/auth/admin.directory.group",
  144. "https://www.googleapis.com/auth/admin.directory.group.member",
  145. "https://www.googleapis.com/auth/admin.directory.group.member.readonly",
  146. "https://www.googleapis.com/auth/admin.directory.group.readonly",
  147. "https://www.googleapis.com/auth/admin.directory.notifications",
  148. "https://www.googleapis.com/auth/admin.directory.orgunit",
  149. "https://www.googleapis.com/auth/admin.directory.orgunit.readonly",
  150. "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  151. "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly",
  152. "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  153. "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly",
  154. "https://www.googleapis.com/auth/admin.directory.user",
  155. "https://www.googleapis.com/auth/admin.directory.user.alias",
  156. "https://www.googleapis.com/auth/admin.directory.user.alias.readonly",
  157. "https://www.googleapis.com/auth/admin.directory.user.readonly",
  158. "https://www.googleapis.com/auth/admin.directory.user.security",
  159. "https://www.googleapis.com/auth/admin.directory.userschema",
  160. "https://www.googleapis.com/auth/admin.directory.userschema.readonly",
  161. )
  162. // NOTE: prepend, so we don't override user-specified scopes.
  163. opts = append([]option.ClientOption{scopesOption}, opts...)
  164. client, endpoint, err := htransport.NewClient(ctx, opts...)
  165. if err != nil {
  166. return nil, err
  167. }
  168. s, err := New(client)
  169. if err != nil {
  170. return nil, err
  171. }
  172. if endpoint != "" {
  173. s.BasePath = endpoint
  174. }
  175. return s, nil
  176. }
  177. // New creates a new Service. It uses the provided http.Client for requests.
  178. //
  179. // Deprecated: please use NewService instead.
  180. // To provide a custom HTTP client, use option.WithHTTPClient.
  181. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  182. func New(client *http.Client) (*Service, error) {
  183. if client == nil {
  184. return nil, errors.New("client is nil")
  185. }
  186. s := &Service{client: client, BasePath: basePath}
  187. s.Asps = NewAspsService(s)
  188. s.Channels = NewChannelsService(s)
  189. s.Chromeosdevices = NewChromeosdevicesService(s)
  190. s.Customers = NewCustomersService(s)
  191. s.DomainAliases = NewDomainAliasesService(s)
  192. s.Domains = NewDomainsService(s)
  193. s.Groups = NewGroupsService(s)
  194. s.Members = NewMembersService(s)
  195. s.Mobiledevices = NewMobiledevicesService(s)
  196. s.Notifications = NewNotificationsService(s)
  197. s.Orgunits = NewOrgunitsService(s)
  198. s.Privileges = NewPrivilegesService(s)
  199. s.ResolvedAppAccessSettings = NewResolvedAppAccessSettingsService(s)
  200. s.Resources = NewResourcesService(s)
  201. s.RoleAssignments = NewRoleAssignmentsService(s)
  202. s.Roles = NewRolesService(s)
  203. s.Schemas = NewSchemasService(s)
  204. s.Tokens = NewTokensService(s)
  205. s.Users = NewUsersService(s)
  206. s.VerificationCodes = NewVerificationCodesService(s)
  207. return s, nil
  208. }
  209. type Service struct {
  210. client *http.Client
  211. BasePath string // API endpoint base URL
  212. UserAgent string // optional additional User-Agent fragment
  213. Asps *AspsService
  214. Channels *ChannelsService
  215. Chromeosdevices *ChromeosdevicesService
  216. Customers *CustomersService
  217. DomainAliases *DomainAliasesService
  218. Domains *DomainsService
  219. Groups *GroupsService
  220. Members *MembersService
  221. Mobiledevices *MobiledevicesService
  222. Notifications *NotificationsService
  223. Orgunits *OrgunitsService
  224. Privileges *PrivilegesService
  225. ResolvedAppAccessSettings *ResolvedAppAccessSettingsService
  226. Resources *ResourcesService
  227. RoleAssignments *RoleAssignmentsService
  228. Roles *RolesService
  229. Schemas *SchemasService
  230. Tokens *TokensService
  231. Users *UsersService
  232. VerificationCodes *VerificationCodesService
  233. }
  234. func (s *Service) userAgent() string {
  235. if s.UserAgent == "" {
  236. return googleapi.UserAgent
  237. }
  238. return googleapi.UserAgent + " " + s.UserAgent
  239. }
  240. func NewAspsService(s *Service) *AspsService {
  241. rs := &AspsService{s: s}
  242. return rs
  243. }
  244. type AspsService struct {
  245. s *Service
  246. }
  247. func NewChannelsService(s *Service) *ChannelsService {
  248. rs := &ChannelsService{s: s}
  249. return rs
  250. }
  251. type ChannelsService struct {
  252. s *Service
  253. }
  254. func NewChromeosdevicesService(s *Service) *ChromeosdevicesService {
  255. rs := &ChromeosdevicesService{s: s}
  256. return rs
  257. }
  258. type ChromeosdevicesService struct {
  259. s *Service
  260. }
  261. func NewCustomersService(s *Service) *CustomersService {
  262. rs := &CustomersService{s: s}
  263. return rs
  264. }
  265. type CustomersService struct {
  266. s *Service
  267. }
  268. func NewDomainAliasesService(s *Service) *DomainAliasesService {
  269. rs := &DomainAliasesService{s: s}
  270. return rs
  271. }
  272. type DomainAliasesService struct {
  273. s *Service
  274. }
  275. func NewDomainsService(s *Service) *DomainsService {
  276. rs := &DomainsService{s: s}
  277. return rs
  278. }
  279. type DomainsService struct {
  280. s *Service
  281. }
  282. func NewGroupsService(s *Service) *GroupsService {
  283. rs := &GroupsService{s: s}
  284. rs.Aliases = NewGroupsAliasesService(s)
  285. return rs
  286. }
  287. type GroupsService struct {
  288. s *Service
  289. Aliases *GroupsAliasesService
  290. }
  291. func NewGroupsAliasesService(s *Service) *GroupsAliasesService {
  292. rs := &GroupsAliasesService{s: s}
  293. return rs
  294. }
  295. type GroupsAliasesService struct {
  296. s *Service
  297. }
  298. func NewMembersService(s *Service) *MembersService {
  299. rs := &MembersService{s: s}
  300. return rs
  301. }
  302. type MembersService struct {
  303. s *Service
  304. }
  305. func NewMobiledevicesService(s *Service) *MobiledevicesService {
  306. rs := &MobiledevicesService{s: s}
  307. return rs
  308. }
  309. type MobiledevicesService struct {
  310. s *Service
  311. }
  312. func NewNotificationsService(s *Service) *NotificationsService {
  313. rs := &NotificationsService{s: s}
  314. return rs
  315. }
  316. type NotificationsService struct {
  317. s *Service
  318. }
  319. func NewOrgunitsService(s *Service) *OrgunitsService {
  320. rs := &OrgunitsService{s: s}
  321. return rs
  322. }
  323. type OrgunitsService struct {
  324. s *Service
  325. }
  326. func NewPrivilegesService(s *Service) *PrivilegesService {
  327. rs := &PrivilegesService{s: s}
  328. return rs
  329. }
  330. type PrivilegesService struct {
  331. s *Service
  332. }
  333. func NewResolvedAppAccessSettingsService(s *Service) *ResolvedAppAccessSettingsService {
  334. rs := &ResolvedAppAccessSettingsService{s: s}
  335. return rs
  336. }
  337. type ResolvedAppAccessSettingsService struct {
  338. s *Service
  339. }
  340. func NewResourcesService(s *Service) *ResourcesService {
  341. rs := &ResourcesService{s: s}
  342. rs.Buildings = NewResourcesBuildingsService(s)
  343. rs.Calendars = NewResourcesCalendarsService(s)
  344. rs.Features = NewResourcesFeaturesService(s)
  345. return rs
  346. }
  347. type ResourcesService struct {
  348. s *Service
  349. Buildings *ResourcesBuildingsService
  350. Calendars *ResourcesCalendarsService
  351. Features *ResourcesFeaturesService
  352. }
  353. func NewResourcesBuildingsService(s *Service) *ResourcesBuildingsService {
  354. rs := &ResourcesBuildingsService{s: s}
  355. return rs
  356. }
  357. type ResourcesBuildingsService struct {
  358. s *Service
  359. }
  360. func NewResourcesCalendarsService(s *Service) *ResourcesCalendarsService {
  361. rs := &ResourcesCalendarsService{s: s}
  362. return rs
  363. }
  364. type ResourcesCalendarsService struct {
  365. s *Service
  366. }
  367. func NewResourcesFeaturesService(s *Service) *ResourcesFeaturesService {
  368. rs := &ResourcesFeaturesService{s: s}
  369. return rs
  370. }
  371. type ResourcesFeaturesService struct {
  372. s *Service
  373. }
  374. func NewRoleAssignmentsService(s *Service) *RoleAssignmentsService {
  375. rs := &RoleAssignmentsService{s: s}
  376. return rs
  377. }
  378. type RoleAssignmentsService struct {
  379. s *Service
  380. }
  381. func NewRolesService(s *Service) *RolesService {
  382. rs := &RolesService{s: s}
  383. return rs
  384. }
  385. type RolesService struct {
  386. s *Service
  387. }
  388. func NewSchemasService(s *Service) *SchemasService {
  389. rs := &SchemasService{s: s}
  390. return rs
  391. }
  392. type SchemasService struct {
  393. s *Service
  394. }
  395. func NewTokensService(s *Service) *TokensService {
  396. rs := &TokensService{s: s}
  397. return rs
  398. }
  399. type TokensService struct {
  400. s *Service
  401. }
  402. func NewUsersService(s *Service) *UsersService {
  403. rs := &UsersService{s: s}
  404. rs.Aliases = NewUsersAliasesService(s)
  405. rs.Photos = NewUsersPhotosService(s)
  406. return rs
  407. }
  408. type UsersService struct {
  409. s *Service
  410. Aliases *UsersAliasesService
  411. Photos *UsersPhotosService
  412. }
  413. func NewUsersAliasesService(s *Service) *UsersAliasesService {
  414. rs := &UsersAliasesService{s: s}
  415. return rs
  416. }
  417. type UsersAliasesService struct {
  418. s *Service
  419. }
  420. func NewUsersPhotosService(s *Service) *UsersPhotosService {
  421. rs := &UsersPhotosService{s: s}
  422. return rs
  423. }
  424. type UsersPhotosService struct {
  425. s *Service
  426. }
  427. func NewVerificationCodesService(s *Service) *VerificationCodesService {
  428. rs := &VerificationCodesService{s: s}
  429. return rs
  430. }
  431. type VerificationCodesService struct {
  432. s *Service
  433. }
  434. // Alias: JSON template for Alias object in Directory API.
  435. type Alias struct {
  436. // Alias: A alias email
  437. Alias string `json:"alias,omitempty"`
  438. // Etag: ETag of the resource.
  439. Etag string `json:"etag,omitempty"`
  440. // Id: Unique id of the group (Read-only) Unique id of the user
  441. // (Read-only)
  442. Id string `json:"id,omitempty"`
  443. // Kind: Kind of resource this is.
  444. Kind string `json:"kind,omitempty"`
  445. // PrimaryEmail: Group's primary email (Read-only) User's primary email
  446. // (Read-only)
  447. PrimaryEmail string `json:"primaryEmail,omitempty"`
  448. // ServerResponse contains the HTTP response code and headers from the
  449. // server.
  450. googleapi.ServerResponse `json:"-"`
  451. // ForceSendFields is a list of field names (e.g. "Alias") to
  452. // unconditionally include in API requests. By default, fields with
  453. // empty values are omitted from API requests. However, any non-pointer,
  454. // non-interface field appearing in ForceSendFields will be sent to the
  455. // server regardless of whether the field is empty or not. This may be
  456. // used to include empty fields in Patch requests.
  457. ForceSendFields []string `json:"-"`
  458. // NullFields is a list of field names (e.g. "Alias") to include in API
  459. // requests with the JSON null value. By default, fields with empty
  460. // values are omitted from API requests. However, any field with an
  461. // empty value appearing in NullFields will be sent to the server as
  462. // null. It is an error if a field in this list has a non-empty value.
  463. // This may be used to include null fields in Patch requests.
  464. NullFields []string `json:"-"`
  465. }
  466. func (s *Alias) MarshalJSON() ([]byte, error) {
  467. type NoMethod Alias
  468. raw := NoMethod(*s)
  469. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  470. }
  471. // Aliases: JSON response template to list aliases in Directory API.
  472. type Aliases struct {
  473. // Aliases: List of alias objects.
  474. Aliases []interface{} `json:"aliases,omitempty"`
  475. // Etag: ETag of the resource.
  476. Etag string `json:"etag,omitempty"`
  477. // Kind: Kind of resource this is.
  478. Kind string `json:"kind,omitempty"`
  479. // ServerResponse contains the HTTP response code and headers from the
  480. // server.
  481. googleapi.ServerResponse `json:"-"`
  482. // ForceSendFields is a list of field names (e.g. "Aliases") to
  483. // unconditionally include in API requests. By default, fields with
  484. // empty values are omitted from API requests. However, any non-pointer,
  485. // non-interface field appearing in ForceSendFields will be sent to the
  486. // server regardless of whether the field is empty or not. This may be
  487. // used to include empty fields in Patch requests.
  488. ForceSendFields []string `json:"-"`
  489. // NullFields is a list of field names (e.g. "Aliases") to include in
  490. // API requests with the JSON null value. By default, fields with empty
  491. // values are omitted from API requests. However, any field with an
  492. // empty value appearing in NullFields will be sent to the server as
  493. // null. It is an error if a field in this list has a non-empty value.
  494. // This may be used to include null fields in Patch requests.
  495. NullFields []string `json:"-"`
  496. }
  497. func (s *Aliases) MarshalJSON() ([]byte, error) {
  498. type NoMethod Aliases
  499. raw := NoMethod(*s)
  500. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  501. }
  502. // AppAccessCollections: JSON template for App Access Collections
  503. // Resource object in Directory API.
  504. type AppAccessCollections struct {
  505. // BlockedApiAccessBuckets: List of blocked api access buckets.
  506. BlockedApiAccessBuckets []string `json:"blockedApiAccessBuckets,omitempty"`
  507. // EnforceSettingsForAndroidDrive: Boolean to indicate whether to
  508. // enforce app access settings on Android Drive or not.
  509. EnforceSettingsForAndroidDrive bool `json:"enforceSettingsForAndroidDrive,omitempty"`
  510. // ErrorMessage: Error message provided by the Admin that will be shown
  511. // to the user when an app is blocked.
  512. ErrorMessage string `json:"errorMessage,omitempty"`
  513. // Etag: ETag of the resource.
  514. Etag string `json:"etag,omitempty"`
  515. // Kind: Identifies the resource as an app access collection. Value:
  516. // admin#directory#appaccesscollection
  517. Kind string `json:"kind,omitempty"`
  518. // ResourceId: Unique ID of app access collection. (Readonly)
  519. ResourceId int64 `json:"resourceId,omitempty,string"`
  520. // ResourceName: Resource name given by the customer while
  521. // creating/updating. Should be unique under given customer.
  522. ResourceName string `json:"resourceName,omitempty"`
  523. // TrustDomainOwnedApps: Boolean that indicates whether to trust domain
  524. // owned apps.
  525. TrustDomainOwnedApps bool `json:"trustDomainOwnedApps,omitempty"`
  526. // ServerResponse contains the HTTP response code and headers from the
  527. // server.
  528. googleapi.ServerResponse `json:"-"`
  529. // ForceSendFields is a list of field names (e.g.
  530. // "BlockedApiAccessBuckets") to unconditionally include in API
  531. // requests. By default, fields with empty values are omitted from API
  532. // requests. However, any non-pointer, non-interface field appearing in
  533. // ForceSendFields will be sent to the server regardless of whether the
  534. // field is empty or not. This may be used to include empty fields in
  535. // Patch requests.
  536. ForceSendFields []string `json:"-"`
  537. // NullFields is a list of field names (e.g. "BlockedApiAccessBuckets")
  538. // to include in API requests with the JSON null value. By default,
  539. // fields with empty values are omitted from API requests. However, any
  540. // field with an empty value appearing in NullFields will be sent to the
  541. // server as null. It is an error if a field in this list has a
  542. // non-empty value. This may be used to include null fields in Patch
  543. // requests.
  544. NullFields []string `json:"-"`
  545. }
  546. func (s *AppAccessCollections) MarshalJSON() ([]byte, error) {
  547. type NoMethod AppAccessCollections
  548. raw := NoMethod(*s)
  549. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  550. }
  551. // Asp: The template that returns individual ASP (Access Code) data.
  552. type Asp struct {
  553. // CodeId: The unique ID of the ASP.
  554. CodeId int64 `json:"codeId,omitempty"`
  555. // CreationTime: The time when the ASP was created. Expressed in Unix
  556. // time format.
  557. CreationTime int64 `json:"creationTime,omitempty,string"`
  558. // Etag: ETag of the ASP.
  559. Etag string `json:"etag,omitempty"`
  560. // Kind: The type of the API resource. This is always
  561. // admin#directory#asp.
  562. Kind string `json:"kind,omitempty"`
  563. // LastTimeUsed: The time when the ASP was last used. Expressed in Unix
  564. // time format.
  565. LastTimeUsed int64 `json:"lastTimeUsed,omitempty,string"`
  566. // Name: The name of the application that the user, represented by their
  567. // userId, entered when the ASP was created.
  568. Name string `json:"name,omitempty"`
  569. // UserKey: The unique ID of the user who issued the ASP.
  570. UserKey string `json:"userKey,omitempty"`
  571. // ServerResponse contains the HTTP response code and headers from the
  572. // server.
  573. googleapi.ServerResponse `json:"-"`
  574. // ForceSendFields is a list of field names (e.g. "CodeId") to
  575. // unconditionally include in API requests. By default, fields with
  576. // empty values are omitted from API requests. However, any non-pointer,
  577. // non-interface field appearing in ForceSendFields will be sent to the
  578. // server regardless of whether the field is empty or not. This may be
  579. // used to include empty fields in Patch requests.
  580. ForceSendFields []string `json:"-"`
  581. // NullFields is a list of field names (e.g. "CodeId") to include in API
  582. // requests with the JSON null value. By default, fields with empty
  583. // values are omitted from API requests. However, any field with an
  584. // empty value appearing in NullFields will be sent to the server as
  585. // null. It is an error if a field in this list has a non-empty value.
  586. // This may be used to include null fields in Patch requests.
  587. NullFields []string `json:"-"`
  588. }
  589. func (s *Asp) MarshalJSON() ([]byte, error) {
  590. type NoMethod Asp
  591. raw := NoMethod(*s)
  592. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  593. }
  594. type Asps struct {
  595. // Etag: ETag of the resource.
  596. Etag string `json:"etag,omitempty"`
  597. // Items: A list of ASP resources.
  598. Items []*Asp `json:"items,omitempty"`
  599. // Kind: The type of the API resource. This is always
  600. // admin#directory#aspList.
  601. Kind string `json:"kind,omitempty"`
  602. // ServerResponse contains the HTTP response code and headers from the
  603. // server.
  604. googleapi.ServerResponse `json:"-"`
  605. // ForceSendFields is a list of field names (e.g. "Etag") to
  606. // unconditionally include in API requests. By default, fields with
  607. // empty values are omitted from API requests. However, any non-pointer,
  608. // non-interface field appearing in ForceSendFields will be sent to the
  609. // server regardless of whether the field is empty or not. This may be
  610. // used to include empty fields in Patch requests.
  611. ForceSendFields []string `json:"-"`
  612. // NullFields is a list of field names (e.g. "Etag") to include in API
  613. // requests with the JSON null value. By default, fields with empty
  614. // values are omitted from API requests. However, any field with an
  615. // empty value appearing in NullFields will be sent to the server as
  616. // null. It is an error if a field in this list has a non-empty value.
  617. // This may be used to include null fields in Patch requests.
  618. NullFields []string `json:"-"`
  619. }
  620. func (s *Asps) MarshalJSON() ([]byte, error) {
  621. type NoMethod Asps
  622. raw := NoMethod(*s)
  623. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  624. }
  625. // Building: JSON template for Building object in Directory API.
  626. type Building struct {
  627. // Address: The postal address of the building. See PostalAddress for
  628. // details. Note that only a single address line and region code are
  629. // required.
  630. Address *BuildingAddress `json:"address,omitempty"`
  631. // BuildingId: Unique identifier for the building. The maximum length is
  632. // 100 characters.
  633. BuildingId string `json:"buildingId,omitempty"`
  634. // BuildingName: The building name as seen by users in Calendar. Must be
  635. // unique for the customer. For example, "NYC-CHEL". The maximum length
  636. // is 100 characters.
  637. BuildingName string `json:"buildingName,omitempty"`
  638. // Coordinates: The geographic coordinates of the center of the
  639. // building, expressed as latitude and longitude in decimal degrees.
  640. Coordinates *BuildingCoordinates `json:"coordinates,omitempty"`
  641. // Description: A brief description of the building. For example,
  642. // "Chelsea Market".
  643. Description string `json:"description,omitempty"`
  644. // Etags: ETag of the resource.
  645. Etags string `json:"etags,omitempty"`
  646. // FloorNames: The display names for all floors in this building. The
  647. // floors are expected to be sorted in ascending order, from lowest
  648. // floor to highest floor. For example, ["B2", "B1", "L", "1", "2",
  649. // "2M", "3", "PH"] Must contain at least one entry.
  650. FloorNames []string `json:"floorNames,omitempty"`
  651. // Kind: Kind of resource this is.
  652. Kind string `json:"kind,omitempty"`
  653. // ServerResponse contains the HTTP response code and headers from the
  654. // server.
  655. googleapi.ServerResponse `json:"-"`
  656. // ForceSendFields is a list of field names (e.g. "Address") to
  657. // unconditionally include in API requests. By default, fields with
  658. // empty values are omitted from API requests. However, any non-pointer,
  659. // non-interface field appearing in ForceSendFields will be sent to the
  660. // server regardless of whether the field is empty or not. This may be
  661. // used to include empty fields in Patch requests.
  662. ForceSendFields []string `json:"-"`
  663. // NullFields is a list of field names (e.g. "Address") to include in
  664. // API requests with the JSON null value. By default, fields with empty
  665. // values are omitted from API requests. However, any field with an
  666. // empty value appearing in NullFields will be sent to the server as
  667. // null. It is an error if a field in this list has a non-empty value.
  668. // This may be used to include null fields in Patch requests.
  669. NullFields []string `json:"-"`
  670. }
  671. func (s *Building) MarshalJSON() ([]byte, error) {
  672. type NoMethod Building
  673. raw := NoMethod(*s)
  674. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  675. }
  676. // BuildingAddress: JSON template for the postal address of a building
  677. // in Directory API.
  678. type BuildingAddress struct {
  679. // AddressLines: Unstructured address lines describing the lower levels
  680. // of an address.
  681. AddressLines []string `json:"addressLines,omitempty"`
  682. // AdministrativeArea: Optional. Highest administrative subdivision
  683. // which is used for postal addresses of a country or region.
  684. AdministrativeArea string `json:"administrativeArea,omitempty"`
  685. // LanguageCode: Optional. BCP-47 language code of the contents of this
  686. // address (if known).
  687. LanguageCode string `json:"languageCode,omitempty"`
  688. // Locality: Optional. Generally refers to the city/town portion of the
  689. // address. Examples: US city, IT comune, UK post town. In regions of
  690. // the world where localities are not well defined or do not fit into
  691. // this structure well, leave locality empty and use addressLines.
  692. Locality string `json:"locality,omitempty"`
  693. // PostalCode: Optional. Postal code of the address.
  694. PostalCode string `json:"postalCode,omitempty"`
  695. // RegionCode: Required. CLDR region code of the country/region of the
  696. // address.
  697. RegionCode string `json:"regionCode,omitempty"`
  698. // Sublocality: Optional. Sublocality of the address.
  699. Sublocality string `json:"sublocality,omitempty"`
  700. // ForceSendFields is a list of field names (e.g. "AddressLines") to
  701. // unconditionally include in API requests. By default, fields with
  702. // empty values are omitted from API requests. However, any non-pointer,
  703. // non-interface field appearing in ForceSendFields will be sent to the
  704. // server regardless of whether the field is empty or not. This may be
  705. // used to include empty fields in Patch requests.
  706. ForceSendFields []string `json:"-"`
  707. // NullFields is a list of field names (e.g. "AddressLines") to include
  708. // in API requests with the JSON null value. By default, fields with
  709. // empty values are omitted from API requests. However, any field with
  710. // an empty value appearing in NullFields will be sent to the server as
  711. // null. It is an error if a field in this list has a non-empty value.
  712. // This may be used to include null fields in Patch requests.
  713. NullFields []string `json:"-"`
  714. }
  715. func (s *BuildingAddress) MarshalJSON() ([]byte, error) {
  716. type NoMethod BuildingAddress
  717. raw := NoMethod(*s)
  718. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  719. }
  720. // BuildingCoordinates: JSON template for coordinates of a building in
  721. // Directory API.
  722. type BuildingCoordinates struct {
  723. // Latitude: Latitude in decimal degrees.
  724. Latitude float64 `json:"latitude,omitempty"`
  725. // Longitude: Longitude in decimal degrees.
  726. Longitude float64 `json:"longitude,omitempty"`
  727. // ForceSendFields is a list of field names (e.g. "Latitude") to
  728. // unconditionally include in API requests. By default, fields with
  729. // empty values are omitted from API requests. However, any non-pointer,
  730. // non-interface field appearing in ForceSendFields will be sent to the
  731. // server regardless of whether the field is empty or not. This may be
  732. // used to include empty fields in Patch requests.
  733. ForceSendFields []string `json:"-"`
  734. // NullFields is a list of field names (e.g. "Latitude") to include in
  735. // API requests with the JSON null value. By default, fields with empty
  736. // values are omitted from API requests. However, any field with an
  737. // empty value appearing in NullFields will be sent to the server as
  738. // null. It is an error if a field in this list has a non-empty value.
  739. // This may be used to include null fields in Patch requests.
  740. NullFields []string `json:"-"`
  741. }
  742. func (s *BuildingCoordinates) MarshalJSON() ([]byte, error) {
  743. type NoMethod BuildingCoordinates
  744. raw := NoMethod(*s)
  745. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  746. }
  747. func (s *BuildingCoordinates) UnmarshalJSON(data []byte) error {
  748. type NoMethod BuildingCoordinates
  749. var s1 struct {
  750. Latitude gensupport.JSONFloat64 `json:"latitude"`
  751. Longitude gensupport.JSONFloat64 `json:"longitude"`
  752. *NoMethod
  753. }
  754. s1.NoMethod = (*NoMethod)(s)
  755. if err := json.Unmarshal(data, &s1); err != nil {
  756. return err
  757. }
  758. s.Latitude = float64(s1.Latitude)
  759. s.Longitude = float64(s1.Longitude)
  760. return nil
  761. }
  762. // Buildings: JSON template for Building List Response object in
  763. // Directory API.
  764. type Buildings struct {
  765. // Buildings: The Buildings in this page of results.
  766. Buildings []*Building `json:"buildings,omitempty"`
  767. // Etag: ETag of the resource.
  768. Etag string `json:"etag,omitempty"`
  769. // Kind: Kind of resource this is.
  770. Kind string `json:"kind,omitempty"`
  771. // NextPageToken: The continuation token, used to page through large
  772. // result sets. Provide this value in a subsequent request to return the
  773. // next page of results.
  774. NextPageToken string `json:"nextPageToken,omitempty"`
  775. // ServerResponse contains the HTTP response code and headers from the
  776. // server.
  777. googleapi.ServerResponse `json:"-"`
  778. // ForceSendFields is a list of field names (e.g. "Buildings") to
  779. // unconditionally include in API requests. By default, fields with
  780. // empty values are omitted from API requests. However, any non-pointer,
  781. // non-interface field appearing in ForceSendFields will be sent to the
  782. // server regardless of whether the field is empty or not. This may be
  783. // used to include empty fields in Patch requests.
  784. ForceSendFields []string `json:"-"`
  785. // NullFields is a list of field names (e.g. "Buildings") to include in
  786. // API requests with the JSON null value. By default, fields with empty
  787. // values are omitted from API requests. However, any field with an
  788. // empty value appearing in NullFields will be sent to the server as
  789. // null. It is an error if a field in this list has a non-empty value.
  790. // This may be used to include null fields in Patch requests.
  791. NullFields []string `json:"-"`
  792. }
  793. func (s *Buildings) MarshalJSON() ([]byte, error) {
  794. type NoMethod Buildings
  795. raw := NoMethod(*s)
  796. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  797. }
  798. // CalendarResource: JSON template for Calendar Resource object in
  799. // Directory API.
  800. type CalendarResource struct {
  801. // BuildingId: Unique ID for the building a resource is located in.
  802. BuildingId string `json:"buildingId,omitempty"`
  803. // Capacity: Capacity of a resource, number of seats in a room.
  804. Capacity int64 `json:"capacity,omitempty"`
  805. // Etags: ETag of the resource.
  806. Etags string `json:"etags,omitempty"`
  807. FeatureInstances interface{} `json:"featureInstances,omitempty"`
  808. // FloorName: Name of the floor a resource is located on.
  809. FloorName string `json:"floorName,omitempty"`
  810. // FloorSection: Name of the section within a floor a resource is
  811. // located in.
  812. FloorSection string `json:"floorSection,omitempty"`
  813. // GeneratedResourceName: The read-only auto-generated name of the
  814. // calendar resource which includes metadata about the resource such as
  815. // building name, floor, capacity, etc. For example, "NYC-2-Training
  816. // Room 1A (16)".
  817. GeneratedResourceName string `json:"generatedResourceName,omitempty"`
  818. // Kind: The type of the resource. For calendar resources, the value is
  819. // admin#directory#resources#calendars#CalendarResource.
  820. Kind string `json:"kind,omitempty"`
  821. // ResourceCategory: The category of the calendar resource. Either
  822. // CONFERENCE_ROOM or OTHER. Legacy data is set to CATEGORY_UNKNOWN.
  823. ResourceCategory string `json:"resourceCategory,omitempty"`
  824. // ResourceDescription: Description of the resource, visible only to
  825. // admins.
  826. ResourceDescription string `json:"resourceDescription,omitempty"`
  827. // ResourceEmail: The read-only email for the calendar resource.
  828. // Generated as part of creating a new calendar resource.
  829. ResourceEmail string `json:"resourceEmail,omitempty"`
  830. // ResourceId: The unique ID for the calendar resource.
  831. ResourceId string `json:"resourceId,omitempty"`
  832. // ResourceName: The name of the calendar resource. For example,
  833. // "Training Room 1A".
  834. ResourceName string `json:"resourceName,omitempty"`
  835. // ResourceType: The type of the calendar resource, intended for
  836. // non-room resources.
  837. ResourceType string `json:"resourceType,omitempty"`
  838. // UserVisibleDescription: Description of the resource, visible to users
  839. // and admins.
  840. UserVisibleDescription string `json:"userVisibleDescription,omitempty"`
  841. // ServerResponse contains the HTTP response code and headers from the
  842. // server.
  843. googleapi.ServerResponse `json:"-"`
  844. // ForceSendFields is a list of field names (e.g. "BuildingId") to
  845. // unconditionally include in API requests. By default, fields with
  846. // empty values are omitted from API requests. However, any non-pointer,
  847. // non-interface field appearing in ForceSendFields will be sent to the
  848. // server regardless of whether the field is empty or not. This may be
  849. // used to include empty fields in Patch requests.
  850. ForceSendFields []string `json:"-"`
  851. // NullFields is a list of field names (e.g. "BuildingId") to include in
  852. // API requests with the JSON null value. By default, fields with empty
  853. // values are omitted from API requests. However, any field with an
  854. // empty value appearing in NullFields will be sent to the server as
  855. // null. It is an error if a field in this list has a non-empty value.
  856. // This may be used to include null fields in Patch requests.
  857. NullFields []string `json:"-"`
  858. }
  859. func (s *CalendarResource) MarshalJSON() ([]byte, error) {
  860. type NoMethod CalendarResource
  861. raw := NoMethod(*s)
  862. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  863. }
  864. // CalendarResources: JSON template for Calendar Resource List Response
  865. // object in Directory API.
  866. type CalendarResources struct {
  867. // Etag: ETag of the resource.
  868. Etag string `json:"etag,omitempty"`
  869. // Items: The CalendarResources in this page of results.
  870. Items []*CalendarResource `json:"items,omitempty"`
  871. // Kind: Identifies this as a collection of CalendarResources. This is
  872. // always admin#directory#resources#calendars#calendarResourcesList.
  873. Kind string `json:"kind,omitempty"`
  874. // NextPageToken: The continuation token, used to page through large
  875. // result sets. Provide this value in a subsequent request to return the
  876. // next page of results.
  877. NextPageToken string `json:"nextPageToken,omitempty"`
  878. // ServerResponse contains the HTTP response code and headers from the
  879. // server.
  880. googleapi.ServerResponse `json:"-"`
  881. // ForceSendFields is a list of field names (e.g. "Etag") to
  882. // unconditionally include in API requests. By default, fields with
  883. // empty values are omitted from API requests. However, any non-pointer,
  884. // non-interface field appearing in ForceSendFields will be sent to the
  885. // server regardless of whether the field is empty or not. This may be
  886. // used to include empty fields in Patch requests.
  887. ForceSendFields []string `json:"-"`
  888. // NullFields is a list of field names (e.g. "Etag") to include in API
  889. // requests with the JSON null value. By default, fields with empty
  890. // values are omitted from API requests. However, any field with an
  891. // empty value appearing in NullFields will be sent to the server as
  892. // null. It is an error if a field in this list has a non-empty value.
  893. // This may be used to include null fields in Patch requests.
  894. NullFields []string `json:"-"`
  895. }
  896. func (s *CalendarResources) MarshalJSON() ([]byte, error) {
  897. type NoMethod CalendarResources
  898. raw := NoMethod(*s)
  899. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  900. }
  901. // Channel: An notification channel used to watch for resource changes.
  902. type Channel struct {
  903. // Address: The address where notifications are delivered for this
  904. // channel.
  905. Address string `json:"address,omitempty"`
  906. // Expiration: Date and time of notification channel expiration,
  907. // expressed as a Unix timestamp, in milliseconds. Optional.
  908. Expiration int64 `json:"expiration,omitempty,string"`
  909. // Id: A UUID or similar unique string that identifies this channel.
  910. Id string `json:"id,omitempty"`
  911. // Kind: Identifies this as a notification channel used to watch for
  912. // changes to a resource. Value: the fixed string "api#channel".
  913. Kind string `json:"kind,omitempty"`
  914. // Params: Additional parameters controlling delivery channel behavior.
  915. // Optional.
  916. Params map[string]string `json:"params,omitempty"`
  917. // Payload: A Boolean value to indicate whether payload is wanted.
  918. // Optional.
  919. Payload bool `json:"payload,omitempty"`
  920. // ResourceId: An opaque ID that identifies the resource being watched
  921. // on this channel. Stable across different API versions.
  922. ResourceId string `json:"resourceId,omitempty"`
  923. // ResourceUri: A version-specific identifier for the watched resource.
  924. ResourceUri string `json:"resourceUri,omitempty"`
  925. // Token: An arbitrary string delivered to the target address with each
  926. // notification delivered over this channel. Optional.
  927. Token string `json:"token,omitempty"`
  928. // Type: The type of delivery mechanism used for this channel.
  929. Type string `json:"type,omitempty"`
  930. // ServerResponse contains the HTTP response code and headers from the
  931. // server.
  932. googleapi.ServerResponse `json:"-"`
  933. // ForceSendFields is a list of field names (e.g. "Address") to
  934. // unconditionally include in API requests. By default, fields with
  935. // empty values are omitted from API requests. However, any non-pointer,
  936. // non-interface field appearing in ForceSendFields will be sent to the
  937. // server regardless of whether the field is empty or not. This may be
  938. // used to include empty fields in Patch requests.
  939. ForceSendFields []string `json:"-"`
  940. // NullFields is a list of field names (e.g. "Address") to include in
  941. // API requests with the JSON null value. By default, fields with empty
  942. // values are omitted from API requests. However, any field with an
  943. // empty value appearing in NullFields will be sent to the server as
  944. // null. It is an error if a field in this list has a non-empty value.
  945. // This may be used to include null fields in Patch requests.
  946. NullFields []string `json:"-"`
  947. }
  948. func (s *Channel) MarshalJSON() ([]byte, error) {
  949. type NoMethod Channel
  950. raw := NoMethod(*s)
  951. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  952. }
  953. // ChromeOsDevice: JSON template for Chrome Os Device resource in
  954. // Directory API.
  955. type ChromeOsDevice struct {
  956. // ActiveTimeRanges: List of active time ranges (Read-only)
  957. ActiveTimeRanges []*ChromeOsDeviceActiveTimeRanges `json:"activeTimeRanges,omitempty"`
  958. // AnnotatedAssetId: AssetId specified during enrollment or through
  959. // later annotation
  960. AnnotatedAssetId string `json:"annotatedAssetId,omitempty"`
  961. // AnnotatedLocation: Address or location of the device as noted by the
  962. // administrator
  963. AnnotatedLocation string `json:"annotatedLocation,omitempty"`
  964. // AnnotatedUser: User of the device
  965. AnnotatedUser string `json:"annotatedUser,omitempty"`
  966. // BootMode: Chromebook boot mode (Read-only)
  967. BootMode string `json:"bootMode,omitempty"`
  968. // CpuStatusReports: Reports of CPU utilization and temperature
  969. // (Read-only)
  970. CpuStatusReports []*ChromeOsDeviceCpuStatusReports `json:"cpuStatusReports,omitempty"`
  971. // DeviceFiles: List of device files to download (Read-only)
  972. DeviceFiles []*ChromeOsDeviceDeviceFiles `json:"deviceFiles,omitempty"`
  973. // DeviceId: Unique identifier of Chrome OS Device (Read-only)
  974. DeviceId string `json:"deviceId,omitempty"`
  975. // DiskVolumeReports: Reports of disk space and other info about
  976. // mounted/connected volumes.
  977. DiskVolumeReports []*ChromeOsDeviceDiskVolumeReports `json:"diskVolumeReports,omitempty"`
  978. // Etag: ETag of the resource.
  979. Etag string `json:"etag,omitempty"`
  980. // EthernetMacAddress: Chromebook Mac Address on ethernet network
  981. // interface (Read-only)
  982. EthernetMacAddress string `json:"ethernetMacAddress,omitempty"`
  983. // FirmwareVersion: Chromebook firmware version (Read-only)
  984. FirmwareVersion string `json:"firmwareVersion,omitempty"`
  985. // Kind: Kind of resource this is.
  986. Kind string `json:"kind,omitempty"`
  987. // LastEnrollmentTime: Date and time the device was last enrolled
  988. // (Read-only)
  989. LastEnrollmentTime string `json:"lastEnrollmentTime,omitempty"`
  990. // LastSync: Date and time the device was last synchronized with the
  991. // policy settings in the G Suite administrator control panel
  992. // (Read-only)
  993. LastSync string `json:"lastSync,omitempty"`
  994. // MacAddress: Chromebook Mac Address on wifi network interface
  995. // (Read-only)
  996. MacAddress string `json:"macAddress,omitempty"`
  997. // Meid: Mobile Equipment identifier for the 3G mobile card in the
  998. // Chromebook (Read-only)
  999. Meid string `json:"meid,omitempty"`
  1000. // Model: Chromebook Model (Read-only)
  1001. Model string `json:"model,omitempty"`
  1002. // Notes: Notes added by the administrator
  1003. Notes string `json:"notes,omitempty"`
  1004. // OrderNumber: Chromebook order number (Read-only)
  1005. OrderNumber string `json:"orderNumber,omitempty"`
  1006. // OrgUnitPath: OrgUnit of the device
  1007. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  1008. // OsVersion: Chromebook Os Version (Read-only)
  1009. OsVersion string `json:"osVersion,omitempty"`
  1010. // PlatformVersion: Chromebook platform version (Read-only)
  1011. PlatformVersion string `json:"platformVersion,omitempty"`
  1012. // RecentUsers: List of recent device users, in descending order by last
  1013. // login time (Read-only)
  1014. RecentUsers []*ChromeOsDeviceRecentUsers `json:"recentUsers,omitempty"`
  1015. // SerialNumber: Chromebook serial number (Read-only)
  1016. SerialNumber string `json:"serialNumber,omitempty"`
  1017. // Status: status of the device (Read-only)
  1018. Status string `json:"status,omitempty"`
  1019. // SupportEndDate: Final date the device will be supported (Read-only)
  1020. SupportEndDate string `json:"supportEndDate,omitempty"`
  1021. // SystemRamFreeReports: Reports of amounts of available RAM memory
  1022. // (Read-only)
  1023. SystemRamFreeReports []*ChromeOsDeviceSystemRamFreeReports `json:"systemRamFreeReports,omitempty"`
  1024. // SystemRamTotal: Total RAM on the device [in bytes] (Read-only)
  1025. SystemRamTotal int64 `json:"systemRamTotal,omitempty,string"`
  1026. // TpmVersionInfo: Trusted Platform Module (TPM) (Read-only)
  1027. TpmVersionInfo *ChromeOsDeviceTpmVersionInfo `json:"tpmVersionInfo,omitempty"`
  1028. // WillAutoRenew: Will Chromebook auto renew after support end date
  1029. // (Read-only)
  1030. WillAutoRenew bool `json:"willAutoRenew,omitempty"`
  1031. // ServerResponse contains the HTTP response code and headers from the
  1032. // server.
  1033. googleapi.ServerResponse `json:"-"`
  1034. // ForceSendFields is a list of field names (e.g. "ActiveTimeRanges") to
  1035. // unconditionally include in API requests. By default, fields with
  1036. // empty values are omitted from API requests. However, any non-pointer,
  1037. // non-interface field appearing in ForceSendFields will be sent to the
  1038. // server regardless of whether the field is empty or not. This may be
  1039. // used to include empty fields in Patch requests.
  1040. ForceSendFields []string `json:"-"`
  1041. // NullFields is a list of field names (e.g. "ActiveTimeRanges") to
  1042. // include in API requests with the JSON null value. By default, fields
  1043. // with empty values are omitted from API requests. However, any field
  1044. // with an empty value appearing in NullFields will be sent to the
  1045. // server as null. It is an error if a field in this list has a
  1046. // non-empty value. This may be used to include null fields in Patch
  1047. // requests.
  1048. NullFields []string `json:"-"`
  1049. }
  1050. func (s *ChromeOsDevice) MarshalJSON() ([]byte, error) {
  1051. type NoMethod ChromeOsDevice
  1052. raw := NoMethod(*s)
  1053. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1054. }
  1055. type ChromeOsDeviceActiveTimeRanges struct {
  1056. // ActiveTime: Duration in milliseconds
  1057. ActiveTime int64 `json:"activeTime,omitempty"`
  1058. // Date: Date of usage
  1059. Date string `json:"date,omitempty"`
  1060. // ForceSendFields is a list of field names (e.g. "ActiveTime") to
  1061. // unconditionally include in API requests. By default, fields with
  1062. // empty values are omitted from API requests. However, any non-pointer,
  1063. // non-interface field appearing in ForceSendFields will be sent to the
  1064. // server regardless of whether the field is empty or not. This may be
  1065. // used to include empty fields in Patch requests.
  1066. ForceSendFields []string `json:"-"`
  1067. // NullFields is a list of field names (e.g. "ActiveTime") to include in
  1068. // API requests with the JSON null value. By default, fields with empty
  1069. // values are omitted from API requests. However, any field with an
  1070. // empty value appearing in NullFields will be sent to the server as
  1071. // null. It is an error if a field in this list has a non-empty value.
  1072. // This may be used to include null fields in Patch requests.
  1073. NullFields []string `json:"-"`
  1074. }
  1075. func (s *ChromeOsDeviceActiveTimeRanges) MarshalJSON() ([]byte, error) {
  1076. type NoMethod ChromeOsDeviceActiveTimeRanges
  1077. raw := NoMethod(*s)
  1078. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1079. }
  1080. type ChromeOsDeviceCpuStatusReports struct {
  1081. // CpuTemperatureInfo: List of CPU temperature samples.
  1082. CpuTemperatureInfo []*ChromeOsDeviceCpuStatusReportsCpuTemperatureInfo `json:"cpuTemperatureInfo,omitempty"`
  1083. CpuUtilizationPercentageInfo []int64 `json:"cpuUtilizationPercentageInfo,omitempty"`
  1084. // ReportTime: Date and time the report was received.
  1085. ReportTime string `json:"reportTime,omitempty"`
  1086. // ForceSendFields is a list of field names (e.g. "CpuTemperatureInfo")
  1087. // to unconditionally include in API requests. By default, fields with
  1088. // empty values are omitted from API requests. However, any non-pointer,
  1089. // non-interface field appearing in ForceSendFields will be sent to the
  1090. // server regardless of whether the field is empty or not. This may be
  1091. // used to include empty fields in Patch requests.
  1092. ForceSendFields []string `json:"-"`
  1093. // NullFields is a list of field names (e.g. "CpuTemperatureInfo") to
  1094. // include in API requests with the JSON null value. By default, fields
  1095. // with empty values are omitted from API requests. However, any field
  1096. // with an empty value appearing in NullFields will be sent to the
  1097. // server as null. It is an error if a field in this list has a
  1098. // non-empty value. This may be used to include null fields in Patch
  1099. // requests.
  1100. NullFields []string `json:"-"`
  1101. }
  1102. func (s *ChromeOsDeviceCpuStatusReports) MarshalJSON() ([]byte, error) {
  1103. type NoMethod ChromeOsDeviceCpuStatusReports
  1104. raw := NoMethod(*s)
  1105. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1106. }
  1107. type ChromeOsDeviceCpuStatusReportsCpuTemperatureInfo struct {
  1108. // Label: CPU label
  1109. Label string `json:"label,omitempty"`
  1110. // Temperature: Temperature in Celsius degrees.
  1111. Temperature int64 `json:"temperature,omitempty"`
  1112. // ForceSendFields is a list of field names (e.g. "Label") to
  1113. // unconditionally include in API requests. By default, fields with
  1114. // empty values are omitted from API requests. However, any non-pointer,
  1115. // non-interface field appearing in ForceSendFields will be sent to the
  1116. // server regardless of whether the field is empty or not. This may be
  1117. // used to include empty fields in Patch requests.
  1118. ForceSendFields []string `json:"-"`
  1119. // NullFields is a list of field names (e.g. "Label") to include in API
  1120. // requests with the JSON null value. By default, fields with empty
  1121. // values are omitted from API requests. However, any field with an
  1122. // empty value appearing in NullFields will be sent to the server as
  1123. // null. It is an error if a field in this list has a non-empty value.
  1124. // This may be used to include null fields in Patch requests.
  1125. NullFields []string `json:"-"`
  1126. }
  1127. func (s *ChromeOsDeviceCpuStatusReportsCpuTemperatureInfo) MarshalJSON() ([]byte, error) {
  1128. type NoMethod ChromeOsDeviceCpuStatusReportsCpuTemperatureInfo
  1129. raw := NoMethod(*s)
  1130. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1131. }
  1132. type ChromeOsDeviceDeviceFiles struct {
  1133. // CreateTime: Date and time the file was created
  1134. CreateTime string `json:"createTime,omitempty"`
  1135. // DownloadUrl: File download URL
  1136. DownloadUrl string `json:"downloadUrl,omitempty"`
  1137. // Name: File name
  1138. Name string `json:"name,omitempty"`
  1139. // Type: File type
  1140. Type string `json:"type,omitempty"`
  1141. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1142. // unconditionally include in API requests. By default, fields with
  1143. // empty values are omitted from API requests. However, any non-pointer,
  1144. // non-interface field appearing in ForceSendFields will be sent to the
  1145. // server regardless of whether the field is empty or not. This may be
  1146. // used to include empty fields in Patch requests.
  1147. ForceSendFields []string `json:"-"`
  1148. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1149. // API requests with the JSON null value. By default, fields with empty
  1150. // values are omitted from API requests. However, any field with an
  1151. // empty value appearing in NullFields will be sent to the server as
  1152. // null. It is an error if a field in this list has a non-empty value.
  1153. // This may be used to include null fields in Patch requests.
  1154. NullFields []string `json:"-"`
  1155. }
  1156. func (s *ChromeOsDeviceDeviceFiles) MarshalJSON() ([]byte, error) {
  1157. type NoMethod ChromeOsDeviceDeviceFiles
  1158. raw := NoMethod(*s)
  1159. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1160. }
  1161. type ChromeOsDeviceDiskVolumeReports struct {
  1162. // VolumeInfo: Disk volumes
  1163. VolumeInfo []*ChromeOsDeviceDiskVolumeReportsVolumeInfo `json:"volumeInfo,omitempty"`
  1164. // ForceSendFields is a list of field names (e.g. "VolumeInfo") to
  1165. // unconditionally include in API requests. By default, fields with
  1166. // empty values are omitted from API requests. However, any non-pointer,
  1167. // non-interface field appearing in ForceSendFields will be sent to the
  1168. // server regardless of whether the field is empty or not. This may be
  1169. // used to include empty fields in Patch requests.
  1170. ForceSendFields []string `json:"-"`
  1171. // NullFields is a list of field names (e.g. "VolumeInfo") to include in
  1172. // API requests with the JSON null value. By default, fields with empty
  1173. // values are omitted from API requests. However, any field with an
  1174. // empty value appearing in NullFields will be sent to the server as
  1175. // null. It is an error if a field in this list has a non-empty value.
  1176. // This may be used to include null fields in Patch requests.
  1177. NullFields []string `json:"-"`
  1178. }
  1179. func (s *ChromeOsDeviceDiskVolumeReports) MarshalJSON() ([]byte, error) {
  1180. type NoMethod ChromeOsDeviceDiskVolumeReports
  1181. raw := NoMethod(*s)
  1182. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1183. }
  1184. type ChromeOsDeviceDiskVolumeReportsVolumeInfo struct {
  1185. // StorageFree: Free disk space [in bytes]
  1186. StorageFree int64 `json:"storageFree,omitempty,string"`
  1187. // StorageTotal: Total disk space [in bytes]
  1188. StorageTotal int64 `json:"storageTotal,omitempty,string"`
  1189. // VolumeId: Volume id
  1190. VolumeId string `json:"volumeId,omitempty"`
  1191. // ForceSendFields is a list of field names (e.g. "StorageFree") to
  1192. // unconditionally include in API requests. By default, fields with
  1193. // empty values are omitted from API requests. However, any non-pointer,
  1194. // non-interface field appearing in ForceSendFields will be sent to the
  1195. // server regardless of whether the field is empty or not. This may be
  1196. // used to include empty fields in Patch requests.
  1197. ForceSendFields []string `json:"-"`
  1198. // NullFields is a list of field names (e.g. "StorageFree") to include
  1199. // in API requests with the JSON null value. By default, fields with
  1200. // empty values are omitted from API requests. However, any field with
  1201. // an empty value appearing in NullFields will be sent to the server as
  1202. // null. It is an error if a field in this list has a non-empty value.
  1203. // This may be used to include null fields in Patch requests.
  1204. NullFields []string `json:"-"`
  1205. }
  1206. func (s *ChromeOsDeviceDiskVolumeReportsVolumeInfo) MarshalJSON() ([]byte, error) {
  1207. type NoMethod ChromeOsDeviceDiskVolumeReportsVolumeInfo
  1208. raw := NoMethod(*s)
  1209. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1210. }
  1211. type ChromeOsDeviceRecentUsers struct {
  1212. // Email: Email address of the user. Present only if the user type is
  1213. // managed
  1214. Email string `json:"email,omitempty"`
  1215. // Type: The type of the user
  1216. Type string `json:"type,omitempty"`
  1217. // ForceSendFields is a list of field names (e.g. "Email") to
  1218. // unconditionally include in API requests. By default, fields with
  1219. // empty values are omitted from API requests. However, any non-pointer,
  1220. // non-interface field appearing in ForceSendFields will be sent to the
  1221. // server regardless of whether the field is empty or not. This may be
  1222. // used to include empty fields in Patch requests.
  1223. ForceSendFields []string `json:"-"`
  1224. // NullFields is a list of field names (e.g. "Email") to include in API
  1225. // requests with the JSON null value. By default, fields with empty
  1226. // values are omitted from API requests. However, any field with an
  1227. // empty value appearing in NullFields will be sent to the server as
  1228. // null. It is an error if a field in this list has a non-empty value.
  1229. // This may be used to include null fields in Patch requests.
  1230. NullFields []string `json:"-"`
  1231. }
  1232. func (s *ChromeOsDeviceRecentUsers) MarshalJSON() ([]byte, error) {
  1233. type NoMethod ChromeOsDeviceRecentUsers
  1234. raw := NoMethod(*s)
  1235. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1236. }
  1237. type ChromeOsDeviceSystemRamFreeReports struct {
  1238. // ReportTime: Date and time the report was received.
  1239. ReportTime string `json:"reportTime,omitempty"`
  1240. SystemRamFreeInfo googleapi.Int64s `json:"systemRamFreeInfo,omitempty"`
  1241. // ForceSendFields is a list of field names (e.g. "ReportTime") to
  1242. // unconditionally include in API requests. By default, fields with
  1243. // empty values are omitted from API requests. However, any non-pointer,
  1244. // non-interface field appearing in ForceSendFields will be sent to the
  1245. // server regardless of whether the field is empty or not. This may be
  1246. // used to include empty fields in Patch requests.
  1247. ForceSendFields []string `json:"-"`
  1248. // NullFields is a list of field names (e.g. "ReportTime") to include in
  1249. // API requests with the JSON null value. By default, fields with empty
  1250. // values are omitted from API requests. However, any field with an
  1251. // empty value appearing in NullFields will be sent to the server as
  1252. // null. It is an error if a field in this list has a non-empty value.
  1253. // This may be used to include null fields in Patch requests.
  1254. NullFields []string `json:"-"`
  1255. }
  1256. func (s *ChromeOsDeviceSystemRamFreeReports) MarshalJSON() ([]byte, error) {
  1257. type NoMethod ChromeOsDeviceSystemRamFreeReports
  1258. raw := NoMethod(*s)
  1259. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1260. }
  1261. // ChromeOsDeviceTpmVersionInfo: Trusted Platform Module (TPM)
  1262. // (Read-only)
  1263. type ChromeOsDeviceTpmVersionInfo struct {
  1264. // Family: TPM family.
  1265. Family string `json:"family,omitempty"`
  1266. // FirmwareVersion: TPM firmware version.
  1267. FirmwareVersion string `json:"firmwareVersion,omitempty"`
  1268. // Manufacturer: TPM manufacturer code.
  1269. Manufacturer string `json:"manufacturer,omitempty"`
  1270. // SpecLevel: TPM specification level.
  1271. SpecLevel string `json:"specLevel,omitempty"`
  1272. // TpmModel: TPM model number.
  1273. TpmModel string `json:"tpmModel,omitempty"`
  1274. // VendorSpecific: Vendor-specific information such as Vendor ID.
  1275. VendorSpecific string `json:"vendorSpecific,omitempty"`
  1276. // ForceSendFields is a list of field names (e.g. "Family") to
  1277. // unconditionally include in API requests. By default, fields with
  1278. // empty values are omitted from API requests. However, any non-pointer,
  1279. // non-interface field appearing in ForceSendFields will be sent to the
  1280. // server regardless of whether the field is empty or not. This may be
  1281. // used to include empty fields in Patch requests.
  1282. ForceSendFields []string `json:"-"`
  1283. // NullFields is a list of field names (e.g. "Family") to include in API
  1284. // requests with the JSON null value. By default, fields with empty
  1285. // values are omitted from API requests. However, any field with an
  1286. // empty value appearing in NullFields will be sent to the server as
  1287. // null. It is an error if a field in this list has a non-empty value.
  1288. // This may be used to include null fields in Patch requests.
  1289. NullFields []string `json:"-"`
  1290. }
  1291. func (s *ChromeOsDeviceTpmVersionInfo) MarshalJSON() ([]byte, error) {
  1292. type NoMethod ChromeOsDeviceTpmVersionInfo
  1293. raw := NoMethod(*s)
  1294. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1295. }
  1296. // ChromeOsDeviceAction: JSON request template for firing actions on
  1297. // ChromeOs Device in Directory Devices API.
  1298. type ChromeOsDeviceAction struct {
  1299. // Action: Action to be taken on the ChromeOs Device
  1300. Action string `json:"action,omitempty"`
  1301. DeprovisionReason string `json:"deprovisionReason,omitempty"`
  1302. // ForceSendFields is a list of field names (e.g. "Action") to
  1303. // unconditionally include in API requests. By default, fields with
  1304. // empty values are omitted from API requests. However, any non-pointer,
  1305. // non-interface field appearing in ForceSendFields will be sent to the
  1306. // server regardless of whether the field is empty or not. This may be
  1307. // used to include empty fields in Patch requests.
  1308. ForceSendFields []string `json:"-"`
  1309. // NullFields is a list of field names (e.g. "Action") to include in API
  1310. // requests with the JSON null value. By default, fields with empty
  1311. // values are omitted from API requests. However, any field with an
  1312. // empty value appearing in NullFields will be sent to the server as
  1313. // null. It is an error if a field in this list has a non-empty value.
  1314. // This may be used to include null fields in Patch requests.
  1315. NullFields []string `json:"-"`
  1316. }
  1317. func (s *ChromeOsDeviceAction) MarshalJSON() ([]byte, error) {
  1318. type NoMethod ChromeOsDeviceAction
  1319. raw := NoMethod(*s)
  1320. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1321. }
  1322. // ChromeOsDevices: JSON response template for List Chrome OS Devices
  1323. // operation in Directory API.
  1324. type ChromeOsDevices struct {
  1325. // Chromeosdevices: List of Chrome OS Device objects.
  1326. Chromeosdevices []*ChromeOsDevice `json:"chromeosdevices,omitempty"`
  1327. // Etag: ETag of the resource.
  1328. Etag string `json:"etag,omitempty"`
  1329. // Kind: Kind of resource this is.
  1330. Kind string `json:"kind,omitempty"`
  1331. // NextPageToken: Token used to access next page of this result.
  1332. NextPageToken string `json:"nextPageToken,omitempty"`
  1333. // ServerResponse contains the HTTP response code and headers from the
  1334. // server.
  1335. googleapi.ServerResponse `json:"-"`
  1336. // ForceSendFields is a list of field names (e.g. "Chromeosdevices") to
  1337. // unconditionally include in API requests. By default, fields with
  1338. // empty values are omitted from API requests. However, any non-pointer,
  1339. // non-interface field appearing in ForceSendFields will be sent to the
  1340. // server regardless of whether the field is empty or not. This may be
  1341. // used to include empty fields in Patch requests.
  1342. ForceSendFields []string `json:"-"`
  1343. // NullFields is a list of field names (e.g. "Chromeosdevices") to
  1344. // include in API requests with the JSON null value. By default, fields
  1345. // with empty values are omitted from API requests. However, any field
  1346. // with an empty value appearing in NullFields will be sent to the
  1347. // server as null. It is an error if a field in this list has a
  1348. // non-empty value. This may be used to include null fields in Patch
  1349. // requests.
  1350. NullFields []string `json:"-"`
  1351. }
  1352. func (s *ChromeOsDevices) MarshalJSON() ([]byte, error) {
  1353. type NoMethod ChromeOsDevices
  1354. raw := NoMethod(*s)
  1355. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1356. }
  1357. // ChromeOsMoveDevicesToOu: JSON request template for moving ChromeOs
  1358. // Device to given OU in Directory Devices API.
  1359. type ChromeOsMoveDevicesToOu struct {
  1360. // DeviceIds: ChromeOs Devices to be moved to OU
  1361. DeviceIds []string `json:"deviceIds,omitempty"`
  1362. // ForceSendFields is a list of field names (e.g. "DeviceIds") to
  1363. // unconditionally include in API requests. By default, fields with
  1364. // empty values are omitted from API requests. However, any non-pointer,
  1365. // non-interface field appearing in ForceSendFields will be sent to the
  1366. // server regardless of whether the field is empty or not. This may be
  1367. // used to include empty fields in Patch requests.
  1368. ForceSendFields []string `json:"-"`
  1369. // NullFields is a list of field names (e.g. "DeviceIds") to include in
  1370. // API requests with the JSON null value. By default, fields with empty
  1371. // values are omitted from API requests. However, any field with an
  1372. // empty value appearing in NullFields will be sent to the server as
  1373. // null. It is an error if a field in this list has a non-empty value.
  1374. // This may be used to include null fields in Patch requests.
  1375. NullFields []string `json:"-"`
  1376. }
  1377. func (s *ChromeOsMoveDevicesToOu) MarshalJSON() ([]byte, error) {
  1378. type NoMethod ChromeOsMoveDevicesToOu
  1379. raw := NoMethod(*s)
  1380. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1381. }
  1382. // Customer: JSON template for Customer Resource object in Directory
  1383. // API.
  1384. type Customer struct {
  1385. // AlternateEmail: The customer's secondary contact email address. This
  1386. // email address cannot be on the same domain as the customerDomain
  1387. AlternateEmail string `json:"alternateEmail,omitempty"`
  1388. // CustomerCreationTime: The customer's creation time (Readonly)
  1389. CustomerCreationTime string `json:"customerCreationTime,omitempty"`
  1390. // CustomerDomain: The customer's primary domain name string. Do not
  1391. // include the www prefix when creating a new customer.
  1392. CustomerDomain string `json:"customerDomain,omitempty"`
  1393. // Etag: ETag of the resource.
  1394. Etag string `json:"etag,omitempty"`
  1395. // Id: The unique ID for the customer's G Suite account. (Readonly)
  1396. Id string `json:"id,omitempty"`
  1397. // Kind: Identifies the resource as a customer. Value:
  1398. // admin#directory#customer
  1399. Kind string `json:"kind,omitempty"`
  1400. // Language: The customer's ISO 639-2 language code. The default value
  1401. // is en-US
  1402. Language string `json:"language,omitempty"`
  1403. // PhoneNumber: The customer's contact phone number in E.164 format.
  1404. PhoneNumber string `json:"phoneNumber,omitempty"`
  1405. // PostalAddress: The customer's postal address information.
  1406. PostalAddress *CustomerPostalAddress `json:"postalAddress,omitempty"`
  1407. // ServerResponse contains the HTTP response code and headers from the
  1408. // server.
  1409. googleapi.ServerResponse `json:"-"`
  1410. // ForceSendFields is a list of field names (e.g. "AlternateEmail") to
  1411. // unconditionally include in API requests. By default, fields with
  1412. // empty values are omitted from API requests. However, any non-pointer,
  1413. // non-interface field appearing in ForceSendFields will be sent to the
  1414. // server regardless of whether the field is empty or not. This may be
  1415. // used to include empty fields in Patch requests.
  1416. ForceSendFields []string `json:"-"`
  1417. // NullFields is a list of field names (e.g. "AlternateEmail") to
  1418. // include in API requests with the JSON null value. By default, fields
  1419. // with empty values are omitted from API requests. However, any field
  1420. // with an empty value appearing in NullFields will be sent to the
  1421. // server as null. It is an error if a field in this list has a
  1422. // non-empty value. This may be used to include null fields in Patch
  1423. // requests.
  1424. NullFields []string `json:"-"`
  1425. }
  1426. func (s *Customer) MarshalJSON() ([]byte, error) {
  1427. type NoMethod Customer
  1428. raw := NoMethod(*s)
  1429. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1430. }
  1431. // CustomerPostalAddress: JSON template for postal address of a
  1432. // customer.
  1433. type CustomerPostalAddress struct {
  1434. // AddressLine1: A customer's physical address. The address can be
  1435. // composed of one to three lines.
  1436. AddressLine1 string `json:"addressLine1,omitempty"`
  1437. // AddressLine2: Address line 2 of the address.
  1438. AddressLine2 string `json:"addressLine2,omitempty"`
  1439. // AddressLine3: Address line 3 of the address.
  1440. AddressLine3 string `json:"addressLine3,omitempty"`
  1441. // ContactName: The customer contact's name.
  1442. ContactName string `json:"contactName,omitempty"`
  1443. // CountryCode: This is a required property. For countryCode information
  1444. // see the ISO 3166 country code elements.
  1445. CountryCode string `json:"countryCode,omitempty"`
  1446. // Locality: Name of the locality. An example of a locality value is the
  1447. // city of San Francisco.
  1448. Locality string `json:"locality,omitempty"`
  1449. // OrganizationName: The company or company division name.
  1450. OrganizationName string `json:"organizationName,omitempty"`
  1451. // PostalCode: The postal code. A postalCode example is a postal zip
  1452. // code such as 10009. This is in accordance with -
  1453. // http://portablecontacts.net/draft-spec.html#address_element.
  1454. PostalCode string `json:"postalCode,omitempty"`
  1455. // Region: Name of the region. An example of a region value is NY for
  1456. // the state of New York.
  1457. Region string `json:"region,omitempty"`
  1458. // ForceSendFields is a list of field names (e.g. "AddressLine1") to
  1459. // unconditionally include in API requests. By default, fields with
  1460. // empty values are omitted from API requests. However, any non-pointer,
  1461. // non-interface field appearing in ForceSendFields will be sent to the
  1462. // server regardless of whether the field is empty or not. This may be
  1463. // used to include empty fields in Patch requests.
  1464. ForceSendFields []string `json:"-"`
  1465. // NullFields is a list of field names (e.g. "AddressLine1") to include
  1466. // in API requests with the JSON null value. By default, fields with
  1467. // empty values are omitted from API requests. However, any field with
  1468. // an empty value appearing in NullFields will be sent to the server as
  1469. // null. It is an error if a field in this list has a non-empty value.
  1470. // This may be used to include null fields in Patch requests.
  1471. NullFields []string `json:"-"`
  1472. }
  1473. func (s *CustomerPostalAddress) MarshalJSON() ([]byte, error) {
  1474. type NoMethod CustomerPostalAddress
  1475. raw := NoMethod(*s)
  1476. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1477. }
  1478. // DomainAlias: JSON template for Domain Alias object in Directory API.
  1479. type DomainAlias struct {
  1480. // CreationTime: The creation time of the domain alias. (Read-only).
  1481. CreationTime int64 `json:"creationTime,omitempty,string"`
  1482. // DomainAliasName: The domain alias name.
  1483. DomainAliasName string `json:"domainAliasName,omitempty"`
  1484. // Etag: ETag of the resource.
  1485. Etag string `json:"etag,omitempty"`
  1486. // Kind: Kind of resource this is.
  1487. Kind string `json:"kind,omitempty"`
  1488. // ParentDomainName: The parent domain name that the domain alias is
  1489. // associated with. This can either be a primary or secondary domain
  1490. // name within a customer.
  1491. ParentDomainName string `json:"parentDomainName,omitempty"`
  1492. // Verified: Indicates the verification state of a domain alias.
  1493. // (Read-only)
  1494. Verified bool `json:"verified,omitempty"`
  1495. // ServerResponse contains the HTTP response code and headers from the
  1496. // server.
  1497. googleapi.ServerResponse `json:"-"`
  1498. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1499. // unconditionally include in API requests. By default, fields with
  1500. // empty values are omitted from API requests. However, any non-pointer,
  1501. // non-interface field appearing in ForceSendFields will be sent to the
  1502. // server regardless of whether the field is empty or not. This may be
  1503. // used to include empty fields in Patch requests.
  1504. ForceSendFields []string `json:"-"`
  1505. // NullFields is a list of field names (e.g. "CreationTime") to include
  1506. // in API requests with the JSON null value. By default, fields with
  1507. // empty values are omitted from API requests. However, any field with
  1508. // an empty value appearing in NullFields will be sent to the server as
  1509. // null. It is an error if a field in this list has a non-empty value.
  1510. // This may be used to include null fields in Patch requests.
  1511. NullFields []string `json:"-"`
  1512. }
  1513. func (s *DomainAlias) MarshalJSON() ([]byte, error) {
  1514. type NoMethod DomainAlias
  1515. raw := NoMethod(*s)
  1516. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1517. }
  1518. // DomainAliases: JSON response template to list domain aliases in
  1519. // Directory API.
  1520. type DomainAliases struct {
  1521. // DomainAliases: List of domain alias objects.
  1522. DomainAliases []*DomainAlias `json:"domainAliases,omitempty"`
  1523. // Etag: ETag of the resource.
  1524. Etag string `json:"etag,omitempty"`
  1525. // Kind: Kind of resource this is.
  1526. Kind string `json:"kind,omitempty"`
  1527. // ServerResponse contains the HTTP response code and headers from the
  1528. // server.
  1529. googleapi.ServerResponse `json:"-"`
  1530. // ForceSendFields is a list of field names (e.g. "DomainAliases") to
  1531. // unconditionally include in API requests. By default, fields with
  1532. // empty values are omitted from API requests. However, any non-pointer,
  1533. // non-interface field appearing in ForceSendFields will be sent to the
  1534. // server regardless of whether the field is empty or not. This may be
  1535. // used to include empty fields in Patch requests.
  1536. ForceSendFields []string `json:"-"`
  1537. // NullFields is a list of field names (e.g. "DomainAliases") to include
  1538. // in API requests with the JSON null value. By default, fields with
  1539. // empty values are omitted from API requests. However, any field with
  1540. // an empty value appearing in NullFields will be sent to the server as
  1541. // null. It is an error if a field in this list has a non-empty value.
  1542. // This may be used to include null fields in Patch requests.
  1543. NullFields []string `json:"-"`
  1544. }
  1545. func (s *DomainAliases) MarshalJSON() ([]byte, error) {
  1546. type NoMethod DomainAliases
  1547. raw := NoMethod(*s)
  1548. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1549. }
  1550. // Domains: JSON template for Domain object in Directory API.
  1551. type Domains struct {
  1552. // CreationTime: Creation time of the domain. (Read-only).
  1553. CreationTime int64 `json:"creationTime,omitempty,string"`
  1554. // DomainAliases: List of domain alias objects. (Read-only)
  1555. DomainAliases []*DomainAlias `json:"domainAliases,omitempty"`
  1556. // DomainName: The domain name of the customer.
  1557. DomainName string `json:"domainName,omitempty"`
  1558. // Etag: ETag of the resource.
  1559. Etag string `json:"etag,omitempty"`
  1560. // IsPrimary: Indicates if the domain is a primary domain (Read-only).
  1561. IsPrimary bool `json:"isPrimary,omitempty"`
  1562. // Kind: Kind of resource this is.
  1563. Kind string `json:"kind,omitempty"`
  1564. // Verified: Indicates the verification state of a domain. (Read-only).
  1565. Verified bool `json:"verified,omitempty"`
  1566. // ServerResponse contains the HTTP response code and headers from the
  1567. // server.
  1568. googleapi.ServerResponse `json:"-"`
  1569. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1570. // unconditionally include in API requests. By default, fields with
  1571. // empty values are omitted from API requests. However, any non-pointer,
  1572. // non-interface field appearing in ForceSendFields will be sent to the
  1573. // server regardless of whether the field is empty or not. This may be
  1574. // used to include empty fields in Patch requests.
  1575. ForceSendFields []string `json:"-"`
  1576. // NullFields is a list of field names (e.g. "CreationTime") to include
  1577. // in API requests with the JSON null value. By default, fields with
  1578. // empty values are omitted from API requests. However, any field with
  1579. // an empty value appearing in NullFields will be sent to the server as
  1580. // null. It is an error if a field in this list has a non-empty value.
  1581. // This may be used to include null fields in Patch requests.
  1582. NullFields []string `json:"-"`
  1583. }
  1584. func (s *Domains) MarshalJSON() ([]byte, error) {
  1585. type NoMethod Domains
  1586. raw := NoMethod(*s)
  1587. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1588. }
  1589. // Domains2: JSON response template to list Domains in Directory API.
  1590. type Domains2 struct {
  1591. // Domains: List of domain objects.
  1592. Domains []*Domains `json:"domains,omitempty"`
  1593. // Etag: ETag of the resource.
  1594. Etag string `json:"etag,omitempty"`
  1595. // Kind: Kind of resource this is.
  1596. Kind string `json:"kind,omitempty"`
  1597. // ServerResponse contains the HTTP response code and headers from the
  1598. // server.
  1599. googleapi.ServerResponse `json:"-"`
  1600. // ForceSendFields is a list of field names (e.g. "Domains") to
  1601. // unconditionally include in API requests. By default, fields with
  1602. // empty values are omitted from API requests. However, any non-pointer,
  1603. // non-interface field appearing in ForceSendFields will be sent to the
  1604. // server regardless of whether the field is empty or not. This may be
  1605. // used to include empty fields in Patch requests.
  1606. ForceSendFields []string `json:"-"`
  1607. // NullFields is a list of field names (e.g. "Domains") to include in
  1608. // API requests with the JSON null value. By default, fields with empty
  1609. // values are omitted from API requests. However, any field with an
  1610. // empty value appearing in NullFields will be sent to the server as
  1611. // null. It is an error if a field in this list has a non-empty value.
  1612. // This may be used to include null fields in Patch requests.
  1613. NullFields []string `json:"-"`
  1614. }
  1615. func (s *Domains2) MarshalJSON() ([]byte, error) {
  1616. type NoMethod Domains2
  1617. raw := NoMethod(*s)
  1618. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1619. }
  1620. // Feature: JSON template for Feature object in Directory API.
  1621. type Feature struct {
  1622. // Etags: ETag of the resource.
  1623. Etags string `json:"etags,omitempty"`
  1624. // Kind: Kind of resource this is.
  1625. Kind string `json:"kind,omitempty"`
  1626. // Name: The name of the feature.
  1627. Name string `json:"name,omitempty"`
  1628. // ServerResponse contains the HTTP response code and headers from the
  1629. // server.
  1630. googleapi.ServerResponse `json:"-"`
  1631. // ForceSendFields is a list of field names (e.g. "Etags") to
  1632. // unconditionally include in API requests. By default, fields with
  1633. // empty values are omitted from API requests. However, any non-pointer,
  1634. // non-interface field appearing in ForceSendFields will be sent to the
  1635. // server regardless of whether the field is empty or not. This may be
  1636. // used to include empty fields in Patch requests.
  1637. ForceSendFields []string `json:"-"`
  1638. // NullFields is a list of field names (e.g. "Etags") to include in API
  1639. // requests with the JSON null value. By default, fields with empty
  1640. // values are omitted from API requests. However, any field with an
  1641. // empty value appearing in NullFields will be sent to the server as
  1642. // null. It is an error if a field in this list has a non-empty value.
  1643. // This may be used to include null fields in Patch requests.
  1644. NullFields []string `json:"-"`
  1645. }
  1646. func (s *Feature) MarshalJSON() ([]byte, error) {
  1647. type NoMethod Feature
  1648. raw := NoMethod(*s)
  1649. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1650. }
  1651. // FeatureInstance: JSON template for a "feature instance".
  1652. type FeatureInstance struct {
  1653. // Feature: The feature that this is an instance of. A calendar resource
  1654. // may have multiple instances of a feature.
  1655. Feature *Feature `json:"feature,omitempty"`
  1656. // ForceSendFields is a list of field names (e.g. "Feature") to
  1657. // unconditionally include in API requests. By default, fields with
  1658. // empty values are omitted from API requests. However, any non-pointer,
  1659. // non-interface field appearing in ForceSendFields will be sent to the
  1660. // server regardless of whether the field is empty or not. This may be
  1661. // used to include empty fields in Patch requests.
  1662. ForceSendFields []string `json:"-"`
  1663. // NullFields is a list of field names (e.g. "Feature") to include in
  1664. // API requests with the JSON null value. By default, fields with empty
  1665. // values are omitted from API requests. However, any field with an
  1666. // empty value appearing in NullFields will be sent to the server as
  1667. // null. It is an error if a field in this list has a non-empty value.
  1668. // This may be used to include null fields in Patch requests.
  1669. NullFields []string `json:"-"`
  1670. }
  1671. func (s *FeatureInstance) MarshalJSON() ([]byte, error) {
  1672. type NoMethod FeatureInstance
  1673. raw := NoMethod(*s)
  1674. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1675. }
  1676. // FeatureRename: JSON request template for renaming a feature.
  1677. type FeatureRename struct {
  1678. // NewName: New name of the feature.
  1679. NewName string `json:"newName,omitempty"`
  1680. // ForceSendFields is a list of field names (e.g. "NewName") to
  1681. // unconditionally include in API requests. By default, fields with
  1682. // empty values are omitted from API requests. However, any non-pointer,
  1683. // non-interface field appearing in ForceSendFields will be sent to the
  1684. // server regardless of whether the field is empty or not. This may be
  1685. // used to include empty fields in Patch requests.
  1686. ForceSendFields []string `json:"-"`
  1687. // NullFields is a list of field names (e.g. "NewName") to include in
  1688. // API requests with the JSON null value. By default, fields with empty
  1689. // values are omitted from API requests. However, any field with an
  1690. // empty value appearing in NullFields will be sent to the server as
  1691. // null. It is an error if a field in this list has a non-empty value.
  1692. // This may be used to include null fields in Patch requests.
  1693. NullFields []string `json:"-"`
  1694. }
  1695. func (s *FeatureRename) MarshalJSON() ([]byte, error) {
  1696. type NoMethod FeatureRename
  1697. raw := NoMethod(*s)
  1698. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1699. }
  1700. // Features: JSON template for Feature List Response object in Directory
  1701. // API.
  1702. type Features struct {
  1703. // Etag: ETag of the resource.
  1704. Etag string `json:"etag,omitempty"`
  1705. // Features: The Features in this page of results.
  1706. Features []*Feature `json:"features,omitempty"`
  1707. // Kind: Kind of resource this is.
  1708. Kind string `json:"kind,omitempty"`
  1709. // NextPageToken: The continuation token, used to page through large
  1710. // result sets. Provide this value in a subsequent request to return the
  1711. // next page of results.
  1712. NextPageToken string `json:"nextPageToken,omitempty"`
  1713. // ServerResponse contains the HTTP response code and headers from the
  1714. // server.
  1715. googleapi.ServerResponse `json:"-"`
  1716. // ForceSendFields is a list of field names (e.g. "Etag") to
  1717. // unconditionally include in API requests. By default, fields with
  1718. // empty values are omitted from API requests. However, any non-pointer,
  1719. // non-interface field appearing in ForceSendFields will be sent to the
  1720. // server regardless of whether the field is empty or not. This may be
  1721. // used to include empty fields in Patch requests.
  1722. ForceSendFields []string `json:"-"`
  1723. // NullFields is a list of field names (e.g. "Etag") to include in API
  1724. // requests with the JSON null value. By default, fields with empty
  1725. // values are omitted from API requests. However, any field with an
  1726. // empty value appearing in NullFields will be sent to the server as
  1727. // null. It is an error if a field in this list has a non-empty value.
  1728. // This may be used to include null fields in Patch requests.
  1729. NullFields []string `json:"-"`
  1730. }
  1731. func (s *Features) MarshalJSON() ([]byte, error) {
  1732. type NoMethod Features
  1733. raw := NoMethod(*s)
  1734. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1735. }
  1736. // Group: JSON template for Group resource in Directory API.
  1737. type Group struct {
  1738. // AdminCreated: Is the group created by admin (Read-only) *
  1739. AdminCreated bool `json:"adminCreated,omitempty"`
  1740. // Aliases: List of aliases (Read-only)
  1741. Aliases []string `json:"aliases,omitempty"`
  1742. // Description: Description of the group
  1743. Description string `json:"description,omitempty"`
  1744. // DirectMembersCount: Group direct members count
  1745. DirectMembersCount int64 `json:"directMembersCount,omitempty,string"`
  1746. // Email: Email of Group
  1747. Email string `json:"email,omitempty"`
  1748. // Etag: ETag of the resource.
  1749. Etag string `json:"etag,omitempty"`
  1750. // Id: Unique identifier of Group (Read-only)
  1751. Id string `json:"id,omitempty"`
  1752. // Kind: Kind of resource this is.
  1753. Kind string `json:"kind,omitempty"`
  1754. // Name: Group name
  1755. Name string `json:"name,omitempty"`
  1756. // NonEditableAliases: List of non editable aliases (Read-only)
  1757. NonEditableAliases []string `json:"nonEditableAliases,omitempty"`
  1758. // ServerResponse contains the HTTP response code and headers from the
  1759. // server.
  1760. googleapi.ServerResponse `json:"-"`
  1761. // ForceSendFields is a list of field names (e.g. "AdminCreated") to
  1762. // unconditionally include in API requests. By default, fields with
  1763. // empty values are omitted from API requests. However, any non-pointer,
  1764. // non-interface field appearing in ForceSendFields will be sent to the
  1765. // server regardless of whether the field is empty or not. This may be
  1766. // used to include empty fields in Patch requests.
  1767. ForceSendFields []string `json:"-"`
  1768. // NullFields is a list of field names (e.g. "AdminCreated") to include
  1769. // in API requests with the JSON null value. By default, fields with
  1770. // empty values are omitted from API requests. However, any field with
  1771. // an empty value appearing in NullFields will be sent to the server as
  1772. // null. It is an error if a field in this list has a non-empty value.
  1773. // This may be used to include null fields in Patch requests.
  1774. NullFields []string `json:"-"`
  1775. }
  1776. func (s *Group) MarshalJSON() ([]byte, error) {
  1777. type NoMethod Group
  1778. raw := NoMethod(*s)
  1779. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1780. }
  1781. // Groups: JSON response template for List Groups operation in Directory
  1782. // API.
  1783. type Groups struct {
  1784. // Etag: ETag of the resource.
  1785. Etag string `json:"etag,omitempty"`
  1786. // Groups: List of group objects.
  1787. Groups []*Group `json:"groups,omitempty"`
  1788. // Kind: Kind of resource this is.
  1789. Kind string `json:"kind,omitempty"`
  1790. // NextPageToken: Token used to access next page of this result.
  1791. NextPageToken string `json:"nextPageToken,omitempty"`
  1792. // ServerResponse contains the HTTP response code and headers from the
  1793. // server.
  1794. googleapi.ServerResponse `json:"-"`
  1795. // ForceSendFields is a list of field names (e.g. "Etag") to
  1796. // unconditionally include in API requests. By default, fields with
  1797. // empty values are omitted from API requests. However, any non-pointer,
  1798. // non-interface field appearing in ForceSendFields will be sent to the
  1799. // server regardless of whether the field is empty or not. This may be
  1800. // used to include empty fields in Patch requests.
  1801. ForceSendFields []string `json:"-"`
  1802. // NullFields is a list of field names (e.g. "Etag") to include in API
  1803. // requests with the JSON null value. By default, fields with empty
  1804. // values are omitted from API requests. However, any field with an
  1805. // empty value appearing in NullFields will be sent to the server as
  1806. // null. It is an error if a field in this list has a non-empty value.
  1807. // This may be used to include null fields in Patch requests.
  1808. NullFields []string `json:"-"`
  1809. }
  1810. func (s *Groups) MarshalJSON() ([]byte, error) {
  1811. type NoMethod Groups
  1812. raw := NoMethod(*s)
  1813. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1814. }
  1815. // Member: JSON template for Member resource in Directory API.
  1816. type Member struct {
  1817. // DeliverySettings: Delivery settings of member
  1818. DeliverySettings string `json:"delivery_settings,omitempty"`
  1819. // Email: Email of member (Read-only)
  1820. Email string `json:"email,omitempty"`
  1821. // Etag: ETag of the resource.
  1822. Etag string `json:"etag,omitempty"`
  1823. // Id: Unique identifier of customer member (Read-only) Unique
  1824. // identifier of group (Read-only) Unique identifier of member
  1825. // (Read-only)
  1826. Id string `json:"id,omitempty"`
  1827. // Kind: Kind of resource this is.
  1828. Kind string `json:"kind,omitempty"`
  1829. // Role: Role of member
  1830. Role string `json:"role,omitempty"`
  1831. // Status: Status of member (Immutable)
  1832. Status string `json:"status,omitempty"`
  1833. // Type: Type of member (Immutable)
  1834. Type string `json:"type,omitempty"`
  1835. // ServerResponse contains the HTTP response code and headers from the
  1836. // server.
  1837. googleapi.ServerResponse `json:"-"`
  1838. // ForceSendFields is a list of field names (e.g. "DeliverySettings") to
  1839. // unconditionally include in API requests. By default, fields with
  1840. // empty values are omitted from API requests. However, any non-pointer,
  1841. // non-interface field appearing in ForceSendFields will be sent to the
  1842. // server regardless of whether the field is empty or not. This may be
  1843. // used to include empty fields in Patch requests.
  1844. ForceSendFields []string `json:"-"`
  1845. // NullFields is a list of field names (e.g. "DeliverySettings") to
  1846. // include in API requests with the JSON null value. By default, fields
  1847. // with empty values are omitted from API requests. However, any field
  1848. // with an empty value appearing in NullFields will be sent to the
  1849. // server as null. It is an error if a field in this list has a
  1850. // non-empty value. This may be used to include null fields in Patch
  1851. // requests.
  1852. NullFields []string `json:"-"`
  1853. }
  1854. func (s *Member) MarshalJSON() ([]byte, error) {
  1855. type NoMethod Member
  1856. raw := NoMethod(*s)
  1857. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1858. }
  1859. // Members: JSON response template for List Members operation in
  1860. // Directory API.
  1861. type Members struct {
  1862. // Etag: ETag of the resource.
  1863. Etag string `json:"etag,omitempty"`
  1864. // Kind: Kind of resource this is.
  1865. Kind string `json:"kind,omitempty"`
  1866. // Members: List of member objects.
  1867. Members []*Member `json:"members,omitempty"`
  1868. // NextPageToken: Token used to access next page of this result.
  1869. NextPageToken string `json:"nextPageToken,omitempty"`
  1870. // ServerResponse contains the HTTP response code and headers from the
  1871. // server.
  1872. googleapi.ServerResponse `json:"-"`
  1873. // ForceSendFields is a list of field names (e.g. "Etag") to
  1874. // unconditionally include in API requests. By default, fields with
  1875. // empty values are omitted from API requests. However, any non-pointer,
  1876. // non-interface field appearing in ForceSendFields will be sent to the
  1877. // server regardless of whether the field is empty or not. This may be
  1878. // used to include empty fields in Patch requests.
  1879. ForceSendFields []string `json:"-"`
  1880. // NullFields is a list of field names (e.g. "Etag") to include in API
  1881. // requests with the JSON null value. By default, fields with empty
  1882. // values are omitted from API requests. However, any field with an
  1883. // empty value appearing in NullFields will be sent to the server as
  1884. // null. It is an error if a field in this list has a non-empty value.
  1885. // This may be used to include null fields in Patch requests.
  1886. NullFields []string `json:"-"`
  1887. }
  1888. func (s *Members) MarshalJSON() ([]byte, error) {
  1889. type NoMethod Members
  1890. raw := NoMethod(*s)
  1891. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1892. }
  1893. // MembersHasMember: JSON template for Has Member response in Directory
  1894. // API.
  1895. type MembersHasMember struct {
  1896. // IsMember: Identifies whether the given user is a member of the group.
  1897. // Membership can be direct or nested.
  1898. IsMember bool `json:"isMember,omitempty"`
  1899. // ServerResponse contains the HTTP response code and headers from the
  1900. // server.
  1901. googleapi.ServerResponse `json:"-"`
  1902. // ForceSendFields is a list of field names (e.g. "IsMember") to
  1903. // unconditionally include in API requests. By default, fields with
  1904. // empty values are omitted from API requests. However, any non-pointer,
  1905. // non-interface field appearing in ForceSendFields will be sent to the
  1906. // server regardless of whether the field is empty or not. This may be
  1907. // used to include empty fields in Patch requests.
  1908. ForceSendFields []string `json:"-"`
  1909. // NullFields is a list of field names (e.g. "IsMember") to include in
  1910. // API requests with the JSON null value. By default, fields with empty
  1911. // values are omitted from API requests. However, any field with an
  1912. // empty value appearing in NullFields will be sent to the server as
  1913. // null. It is an error if a field in this list has a non-empty value.
  1914. // This may be used to include null fields in Patch requests.
  1915. NullFields []string `json:"-"`
  1916. }
  1917. func (s *MembersHasMember) MarshalJSON() ([]byte, error) {
  1918. type NoMethod MembersHasMember
  1919. raw := NoMethod(*s)
  1920. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1921. }
  1922. // MobileDevice: JSON template for Mobile Device resource in Directory
  1923. // API.
  1924. type MobileDevice struct {
  1925. // AdbStatus: Adb (USB debugging) enabled or disabled on device
  1926. // (Read-only)
  1927. AdbStatus bool `json:"adbStatus,omitempty"`
  1928. // Applications: List of applications installed on Mobile Device
  1929. Applications []*MobileDeviceApplications `json:"applications,omitempty"`
  1930. // BasebandVersion: Mobile Device Baseband version (Read-only)
  1931. BasebandVersion string `json:"basebandVersion,omitempty"`
  1932. // BootloaderVersion: Mobile Device Bootloader version (Read-only)
  1933. BootloaderVersion string `json:"bootloaderVersion,omitempty"`
  1934. // Brand: Mobile Device Brand (Read-only)
  1935. Brand string `json:"brand,omitempty"`
  1936. // BuildNumber: Mobile Device Build number (Read-only)
  1937. BuildNumber string `json:"buildNumber,omitempty"`
  1938. // DefaultLanguage: The default locale used on the Mobile Device
  1939. // (Read-only)
  1940. DefaultLanguage string `json:"defaultLanguage,omitempty"`
  1941. // DeveloperOptionsStatus: Developer options enabled or disabled on
  1942. // device (Read-only)
  1943. DeveloperOptionsStatus bool `json:"developerOptionsStatus,omitempty"`
  1944. // DeviceCompromisedStatus: Mobile Device compromised status (Read-only)
  1945. DeviceCompromisedStatus string `json:"deviceCompromisedStatus,omitempty"`
  1946. // DeviceId: Mobile Device serial number (Read-only)
  1947. DeviceId string `json:"deviceId,omitempty"`
  1948. // DevicePasswordStatus: DevicePasswordStatus (Read-only)
  1949. DevicePasswordStatus string `json:"devicePasswordStatus,omitempty"`
  1950. // Email: List of owner user's email addresses (Read-only)
  1951. Email []string `json:"email,omitempty"`
  1952. // EncryptionStatus: Mobile Device Encryption Status (Read-only)
  1953. EncryptionStatus string `json:"encryptionStatus,omitempty"`
  1954. // Etag: ETag of the resource.
  1955. Etag string `json:"etag,omitempty"`
  1956. // FirstSync: Date and time the device was first synchronized with the
  1957. // policy settings in the G Suite administrator control panel
  1958. // (Read-only)
  1959. FirstSync string `json:"firstSync,omitempty"`
  1960. // Hardware: Mobile Device Hardware (Read-only)
  1961. Hardware string `json:"hardware,omitempty"`
  1962. // HardwareId: Mobile Device Hardware Id (Read-only)
  1963. HardwareId string `json:"hardwareId,omitempty"`
  1964. // Imei: Mobile Device IMEI number (Read-only)
  1965. Imei string `json:"imei,omitempty"`
  1966. // KernelVersion: Mobile Device Kernel version (Read-only)
  1967. KernelVersion string `json:"kernelVersion,omitempty"`
  1968. // Kind: Kind of resource this is.
  1969. Kind string `json:"kind,omitempty"`
  1970. // LastSync: Date and time the device was last synchronized with the
  1971. // policy settings in the G Suite administrator control panel
  1972. // (Read-only)
  1973. LastSync string `json:"lastSync,omitempty"`
  1974. // ManagedAccountIsOnOwnerProfile: Boolean indicating if this account is
  1975. // on owner/primary profile or not (Read-only)
  1976. ManagedAccountIsOnOwnerProfile bool `json:"managedAccountIsOnOwnerProfile,omitempty"`
  1977. // Manufacturer: Mobile Device manufacturer (Read-only)
  1978. Manufacturer string `json:"manufacturer,omitempty"`
  1979. // Meid: Mobile Device MEID number (Read-only)
  1980. Meid string `json:"meid,omitempty"`
  1981. // Model: Name of the model of the device
  1982. Model string `json:"model,omitempty"`
  1983. // Name: List of owner user's names (Read-only)
  1984. Name []string `json:"name,omitempty"`
  1985. // NetworkOperator: Mobile Device mobile or network operator (if
  1986. // available) (Read-only)
  1987. NetworkOperator string `json:"networkOperator,omitempty"`
  1988. // Os: Name of the mobile operating system
  1989. Os string `json:"os,omitempty"`
  1990. // OtherAccountsInfo: List of accounts added on device (Read-only)
  1991. OtherAccountsInfo []string `json:"otherAccountsInfo,omitempty"`
  1992. // Privilege: DMAgentPermission (Read-only)
  1993. Privilege string `json:"privilege,omitempty"`
  1994. // ReleaseVersion: Mobile Device release version version (Read-only)
  1995. ReleaseVersion string `json:"releaseVersion,omitempty"`
  1996. // ResourceId: Unique identifier of Mobile Device (Read-only)
  1997. ResourceId string `json:"resourceId,omitempty"`
  1998. // SecurityPatchLevel: Mobile Device Security patch level (Read-only)
  1999. SecurityPatchLevel int64 `json:"securityPatchLevel,omitempty,string"`
  2000. // SerialNumber: Mobile Device SSN or Serial Number (Read-only)
  2001. SerialNumber string `json:"serialNumber,omitempty"`
  2002. // Status: Status of the device (Read-only)
  2003. Status string `json:"status,omitempty"`
  2004. // SupportsWorkProfile: Work profile supported on device (Read-only)
  2005. SupportsWorkProfile bool `json:"supportsWorkProfile,omitempty"`
  2006. // Type: The type of device (Read-only)
  2007. Type string `json:"type,omitempty"`
  2008. // UnknownSourcesStatus: Unknown sources enabled or disabled on device
  2009. // (Read-only)
  2010. UnknownSourcesStatus bool `json:"unknownSourcesStatus,omitempty"`
  2011. // UserAgent: Mobile Device user agent
  2012. UserAgent string `json:"userAgent,omitempty"`
  2013. // WifiMacAddress: Mobile Device WiFi MAC address (Read-only)
  2014. WifiMacAddress string `json:"wifiMacAddress,omitempty"`
  2015. // ServerResponse contains the HTTP response code and headers from the
  2016. // server.
  2017. googleapi.ServerResponse `json:"-"`
  2018. // ForceSendFields is a list of field names (e.g. "AdbStatus") to
  2019. // unconditionally include in API requests. By default, fields with
  2020. // empty values are omitted from API requests. However, any non-pointer,
  2021. // non-interface field appearing in ForceSendFields will be sent to the
  2022. // server regardless of whether the field is empty or not. This may be
  2023. // used to include empty fields in Patch requests.
  2024. ForceSendFields []string `json:"-"`
  2025. // NullFields is a list of field names (e.g. "AdbStatus") to include in
  2026. // API requests with the JSON null value. By default, fields with empty
  2027. // values are omitted from API requests. However, any field with an
  2028. // empty value appearing in NullFields will be sent to the server as
  2029. // null. It is an error if a field in this list has a non-empty value.
  2030. // This may be used to include null fields in Patch requests.
  2031. NullFields []string `json:"-"`
  2032. }
  2033. func (s *MobileDevice) MarshalJSON() ([]byte, error) {
  2034. type NoMethod MobileDevice
  2035. raw := NoMethod(*s)
  2036. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2037. }
  2038. type MobileDeviceApplications struct {
  2039. // DisplayName: Display name of application
  2040. DisplayName string `json:"displayName,omitempty"`
  2041. // PackageName: Package name of application
  2042. PackageName string `json:"packageName,omitempty"`
  2043. // Permission: List of Permissions for application
  2044. Permission []string `json:"permission,omitempty"`
  2045. // VersionCode: Version code of application
  2046. VersionCode int64 `json:"versionCode,omitempty"`
  2047. // VersionName: Version name of application
  2048. VersionName string `json:"versionName,omitempty"`
  2049. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  2050. // unconditionally include in API requests. By default, fields with
  2051. // empty values are omitted from API requests. However, any non-pointer,
  2052. // non-interface field appearing in ForceSendFields will be sent to the
  2053. // server regardless of whether the field is empty or not. This may be
  2054. // used to include empty fields in Patch requests.
  2055. ForceSendFields []string `json:"-"`
  2056. // NullFields is a list of field names (e.g. "DisplayName") to include
  2057. // in API requests with the JSON null value. By default, fields with
  2058. // empty values are omitted from API requests. However, any field with
  2059. // an empty value appearing in NullFields will be sent to the server as
  2060. // null. It is an error if a field in this list has a non-empty value.
  2061. // This may be used to include null fields in Patch requests.
  2062. NullFields []string `json:"-"`
  2063. }
  2064. func (s *MobileDeviceApplications) MarshalJSON() ([]byte, error) {
  2065. type NoMethod MobileDeviceApplications
  2066. raw := NoMethod(*s)
  2067. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2068. }
  2069. // MobileDeviceAction: JSON request template for firing commands on
  2070. // Mobile Device in Directory Devices API.
  2071. type MobileDeviceAction struct {
  2072. // Action: Action to be taken on the Mobile Device
  2073. Action string `json:"action,omitempty"`
  2074. // ForceSendFields is a list of field names (e.g. "Action") to
  2075. // unconditionally include in API requests. By default, fields with
  2076. // empty values are omitted from API requests. However, any non-pointer,
  2077. // non-interface field appearing in ForceSendFields will be sent to the
  2078. // server regardless of whether the field is empty or not. This may be
  2079. // used to include empty fields in Patch requests.
  2080. ForceSendFields []string `json:"-"`
  2081. // NullFields is a list of field names (e.g. "Action") to include in API
  2082. // requests with the JSON null value. By default, fields with empty
  2083. // values are omitted from API requests. However, any field with an
  2084. // empty value appearing in NullFields will be sent to the server as
  2085. // null. It is an error if a field in this list has a non-empty value.
  2086. // This may be used to include null fields in Patch requests.
  2087. NullFields []string `json:"-"`
  2088. }
  2089. func (s *MobileDeviceAction) MarshalJSON() ([]byte, error) {
  2090. type NoMethod MobileDeviceAction
  2091. raw := NoMethod(*s)
  2092. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2093. }
  2094. // MobileDevices: JSON response template for List Mobile Devices
  2095. // operation in Directory API.
  2096. type MobileDevices struct {
  2097. // Etag: ETag of the resource.
  2098. Etag string `json:"etag,omitempty"`
  2099. // Kind: Kind of resource this is.
  2100. Kind string `json:"kind,omitempty"`
  2101. // Mobiledevices: List of Mobile Device objects.
  2102. Mobiledevices []*MobileDevice `json:"mobiledevices,omitempty"`
  2103. // NextPageToken: Token used to access next page of this result.
  2104. NextPageToken string `json:"nextPageToken,omitempty"`
  2105. // ServerResponse contains the HTTP response code and headers from the
  2106. // server.
  2107. googleapi.ServerResponse `json:"-"`
  2108. // ForceSendFields is a list of field names (e.g. "Etag") to
  2109. // unconditionally include in API requests. By default, fields with
  2110. // empty values are omitted from API requests. However, any non-pointer,
  2111. // non-interface field appearing in ForceSendFields will be sent to the
  2112. // server regardless of whether the field is empty or not. This may be
  2113. // used to include empty fields in Patch requests.
  2114. ForceSendFields []string `json:"-"`
  2115. // NullFields is a list of field names (e.g. "Etag") to include in API
  2116. // requests with the JSON null value. By default, fields with empty
  2117. // values are omitted from API requests. However, any field with an
  2118. // empty value appearing in NullFields will be sent to the server as
  2119. // null. It is an error if a field in this list has a non-empty value.
  2120. // This may be used to include null fields in Patch requests.
  2121. NullFields []string `json:"-"`
  2122. }
  2123. func (s *MobileDevices) MarshalJSON() ([]byte, error) {
  2124. type NoMethod MobileDevices
  2125. raw := NoMethod(*s)
  2126. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2127. }
  2128. // Notification: Template for a notification resource.
  2129. type Notification struct {
  2130. // Body: Body of the notification (Read-only)
  2131. Body string `json:"body,omitempty"`
  2132. // Etag: ETag of the resource.
  2133. Etag string `json:"etag,omitempty"`
  2134. // FromAddress: Address from which the notification is received
  2135. // (Read-only)
  2136. FromAddress string `json:"fromAddress,omitempty"`
  2137. // IsUnread: Boolean indicating whether the notification is unread or
  2138. // not.
  2139. IsUnread bool `json:"isUnread,omitempty"`
  2140. // Kind: The type of the resource.
  2141. Kind string `json:"kind,omitempty"`
  2142. NotificationId string `json:"notificationId,omitempty"`
  2143. // SendTime: Time at which notification was sent (Read-only)
  2144. SendTime string `json:"sendTime,omitempty"`
  2145. // Subject: Subject of the notification (Read-only)
  2146. Subject string `json:"subject,omitempty"`
  2147. // ServerResponse contains the HTTP response code and headers from the
  2148. // server.
  2149. googleapi.ServerResponse `json:"-"`
  2150. // ForceSendFields is a list of field names (e.g. "Body") to
  2151. // unconditionally include in API requests. By default, fields with
  2152. // empty values are omitted from API requests. However, any non-pointer,
  2153. // non-interface field appearing in ForceSendFields will be sent to the
  2154. // server regardless of whether the field is empty or not. This may be
  2155. // used to include empty fields in Patch requests.
  2156. ForceSendFields []string `json:"-"`
  2157. // NullFields is a list of field names (e.g. "Body") to include in API
  2158. // requests with the JSON null value. By default, fields with empty
  2159. // values are omitted from API requests. However, any field with an
  2160. // empty value appearing in NullFields will be sent to the server as
  2161. // null. It is an error if a field in this list has a non-empty value.
  2162. // This may be used to include null fields in Patch requests.
  2163. NullFields []string `json:"-"`
  2164. }
  2165. func (s *Notification) MarshalJSON() ([]byte, error) {
  2166. type NoMethod Notification
  2167. raw := NoMethod(*s)
  2168. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2169. }
  2170. // Notifications: Template for notifications list response.
  2171. type Notifications struct {
  2172. // Etag: ETag of the resource.
  2173. Etag string `json:"etag,omitempty"`
  2174. // Items: List of notifications in this page.
  2175. Items []*Notification `json:"items,omitempty"`
  2176. // Kind: The type of the resource.
  2177. Kind string `json:"kind,omitempty"`
  2178. // NextPageToken: Token for fetching the next page of notifications.
  2179. NextPageToken string `json:"nextPageToken,omitempty"`
  2180. // UnreadNotificationsCount: Number of unread notification for the
  2181. // domain.
  2182. UnreadNotificationsCount int64 `json:"unreadNotificationsCount,omitempty"`
  2183. // ServerResponse contains the HTTP response code and headers from the
  2184. // server.
  2185. googleapi.ServerResponse `json:"-"`
  2186. // ForceSendFields is a list of field names (e.g. "Etag") to
  2187. // unconditionally include in API requests. By default, fields with
  2188. // empty values are omitted from API requests. However, any non-pointer,
  2189. // non-interface field appearing in ForceSendFields will be sent to the
  2190. // server regardless of whether the field is empty or not. This may be
  2191. // used to include empty fields in Patch requests.
  2192. ForceSendFields []string `json:"-"`
  2193. // NullFields is a list of field names (e.g. "Etag") to include in API
  2194. // requests with the JSON null value. By default, fields with empty
  2195. // values are omitted from API requests. However, any field with an
  2196. // empty value appearing in NullFields will be sent to the server as
  2197. // null. It is an error if a field in this list has a non-empty value.
  2198. // This may be used to include null fields in Patch requests.
  2199. NullFields []string `json:"-"`
  2200. }
  2201. func (s *Notifications) MarshalJSON() ([]byte, error) {
  2202. type NoMethod Notifications
  2203. raw := NoMethod(*s)
  2204. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2205. }
  2206. // OrgUnit: JSON template for Org Unit resource in Directory API.
  2207. type OrgUnit struct {
  2208. // BlockInheritance: Should block inheritance
  2209. BlockInheritance bool `json:"blockInheritance,omitempty"`
  2210. // Description: Description of OrgUnit
  2211. Description string `json:"description,omitempty"`
  2212. // Etag: ETag of the resource.
  2213. Etag string `json:"etag,omitempty"`
  2214. // Kind: Kind of resource this is.
  2215. Kind string `json:"kind,omitempty"`
  2216. // Name: Name of OrgUnit
  2217. Name string `json:"name,omitempty"`
  2218. // OrgUnitId: Id of OrgUnit
  2219. OrgUnitId string `json:"orgUnitId,omitempty"`
  2220. // OrgUnitPath: Path of OrgUnit
  2221. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  2222. // ParentOrgUnitId: Id of parent OrgUnit
  2223. ParentOrgUnitId string `json:"parentOrgUnitId,omitempty"`
  2224. // ParentOrgUnitPath: Path of parent OrgUnit
  2225. ParentOrgUnitPath string `json:"parentOrgUnitPath,omitempty"`
  2226. // ServerResponse contains the HTTP response code and headers from the
  2227. // server.
  2228. googleapi.ServerResponse `json:"-"`
  2229. // ForceSendFields is a list of field names (e.g. "BlockInheritance") to
  2230. // unconditionally include in API requests. By default, fields with
  2231. // empty values are omitted from API requests. However, any non-pointer,
  2232. // non-interface field appearing in ForceSendFields will be sent to the
  2233. // server regardless of whether the field is empty or not. This may be
  2234. // used to include empty fields in Patch requests.
  2235. ForceSendFields []string `json:"-"`
  2236. // NullFields is a list of field names (e.g. "BlockInheritance") to
  2237. // include in API requests with the JSON null value. By default, fields
  2238. // with empty values are omitted from API requests. However, any field
  2239. // with an empty value appearing in NullFields will be sent to the
  2240. // server as null. It is an error if a field in this list has a
  2241. // non-empty value. This may be used to include null fields in Patch
  2242. // requests.
  2243. NullFields []string `json:"-"`
  2244. }
  2245. func (s *OrgUnit) MarshalJSON() ([]byte, error) {
  2246. type NoMethod OrgUnit
  2247. raw := NoMethod(*s)
  2248. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2249. }
  2250. // OrgUnits: JSON response template for List Organization Units
  2251. // operation in Directory API.
  2252. type OrgUnits struct {
  2253. // Etag: ETag of the resource.
  2254. Etag string `json:"etag,omitempty"`
  2255. // Kind: Kind of resource this is.
  2256. Kind string `json:"kind,omitempty"`
  2257. // OrganizationUnits: List of user objects.
  2258. OrganizationUnits []*OrgUnit `json:"organizationUnits,omitempty"`
  2259. // ServerResponse contains the HTTP response code and headers from the
  2260. // server.
  2261. googleapi.ServerResponse `json:"-"`
  2262. // ForceSendFields is a list of field names (e.g. "Etag") to
  2263. // unconditionally include in API requests. By default, fields with
  2264. // empty values are omitted from API requests. However, any non-pointer,
  2265. // non-interface field appearing in ForceSendFields will be sent to the
  2266. // server regardless of whether the field is empty or not. This may be
  2267. // used to include empty fields in Patch requests.
  2268. ForceSendFields []string `json:"-"`
  2269. // NullFields is a list of field names (e.g. "Etag") to include in API
  2270. // requests with the JSON null value. By default, fields with empty
  2271. // values are omitted from API requests. However, any field with an
  2272. // empty value appearing in NullFields will be sent to the server as
  2273. // null. It is an error if a field in this list has a non-empty value.
  2274. // This may be used to include null fields in Patch requests.
  2275. NullFields []string `json:"-"`
  2276. }
  2277. func (s *OrgUnits) MarshalJSON() ([]byte, error) {
  2278. type NoMethod OrgUnits
  2279. raw := NoMethod(*s)
  2280. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2281. }
  2282. // Privilege: JSON template for privilege resource in Directory API.
  2283. type Privilege struct {
  2284. // ChildPrivileges: A list of child privileges. Privileges for a service
  2285. // form a tree. Each privilege can have a list of child privileges; this
  2286. // list is empty for a leaf privilege.
  2287. ChildPrivileges []*Privilege `json:"childPrivileges,omitempty"`
  2288. // Etag: ETag of the resource.
  2289. Etag string `json:"etag,omitempty"`
  2290. // IsOuScopable: If the privilege can be restricted to an organization
  2291. // unit.
  2292. IsOuScopable bool `json:"isOuScopable,omitempty"`
  2293. // Kind: The type of the API resource. This is always
  2294. // admin#directory#privilege.
  2295. Kind string `json:"kind,omitempty"`
  2296. // PrivilegeName: The name of the privilege.
  2297. PrivilegeName string `json:"privilegeName,omitempty"`
  2298. // ServiceId: The obfuscated ID of the service this privilege is for.
  2299. ServiceId string `json:"serviceId,omitempty"`
  2300. // ServiceName: The name of the service this privilege is for.
  2301. ServiceName string `json:"serviceName,omitempty"`
  2302. // ForceSendFields is a list of field names (e.g. "ChildPrivileges") to
  2303. // unconditionally include in API requests. By default, fields with
  2304. // empty values are omitted from API requests. However, any non-pointer,
  2305. // non-interface field appearing in ForceSendFields will be sent to the
  2306. // server regardless of whether the field is empty or not. This may be
  2307. // used to include empty fields in Patch requests.
  2308. ForceSendFields []string `json:"-"`
  2309. // NullFields is a list of field names (e.g. "ChildPrivileges") to
  2310. // include in API requests with the JSON null value. By default, fields
  2311. // with empty values are omitted from API requests. However, any field
  2312. // with an empty value appearing in NullFields will be sent to the
  2313. // server as null. It is an error if a field in this list has a
  2314. // non-empty value. This may be used to include null fields in Patch
  2315. // requests.
  2316. NullFields []string `json:"-"`
  2317. }
  2318. func (s *Privilege) MarshalJSON() ([]byte, error) {
  2319. type NoMethod Privilege
  2320. raw := NoMethod(*s)
  2321. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2322. }
  2323. // Privileges: JSON response template for List privileges operation in
  2324. // Directory API.
  2325. type Privileges struct {
  2326. // Etag: ETag of the resource.
  2327. Etag string `json:"etag,omitempty"`
  2328. // Items: A list of Privilege resources.
  2329. Items []*Privilege `json:"items,omitempty"`
  2330. // Kind: The type of the API resource. This is always
  2331. // admin#directory#privileges.
  2332. Kind string `json:"kind,omitempty"`
  2333. // ServerResponse contains the HTTP response code and headers from the
  2334. // server.
  2335. googleapi.ServerResponse `json:"-"`
  2336. // ForceSendFields is a list of field names (e.g. "Etag") to
  2337. // unconditionally include in API requests. By default, fields with
  2338. // empty values are omitted from API requests. However, any non-pointer,
  2339. // non-interface field appearing in ForceSendFields will be sent to the
  2340. // server regardless of whether the field is empty or not. This may be
  2341. // used to include empty fields in Patch requests.
  2342. ForceSendFields []string `json:"-"`
  2343. // NullFields is a list of field names (e.g. "Etag") to include in API
  2344. // requests with the JSON null value. By default, fields with empty
  2345. // values are omitted from API requests. However, any field with an
  2346. // empty value appearing in NullFields will be sent to the server as
  2347. // null. It is an error if a field in this list has a non-empty value.
  2348. // This may be used to include null fields in Patch requests.
  2349. NullFields []string `json:"-"`
  2350. }
  2351. func (s *Privileges) MarshalJSON() ([]byte, error) {
  2352. type NoMethod Privileges
  2353. raw := NoMethod(*s)
  2354. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2355. }
  2356. // Role: JSON template for role resource in Directory API.
  2357. type Role struct {
  2358. // Etag: ETag of the resource.
  2359. Etag string `json:"etag,omitempty"`
  2360. // IsSuperAdminRole: Returns true if the role is a super admin role.
  2361. IsSuperAdminRole bool `json:"isSuperAdminRole,omitempty"`
  2362. // IsSystemRole: Returns true if this is a pre-defined system role.
  2363. IsSystemRole bool `json:"isSystemRole,omitempty"`
  2364. // Kind: The type of the API resource. This is always
  2365. // admin#directory#role.
  2366. Kind string `json:"kind,omitempty"`
  2367. // RoleDescription: A short description of the role.
  2368. RoleDescription string `json:"roleDescription,omitempty"`
  2369. // RoleId: ID of the role.
  2370. RoleId int64 `json:"roleId,omitempty,string"`
  2371. // RoleName: Name of the role.
  2372. RoleName string `json:"roleName,omitempty"`
  2373. // RolePrivileges: The set of privileges that are granted to this role.
  2374. RolePrivileges []*RoleRolePrivileges `json:"rolePrivileges,omitempty"`
  2375. // ServerResponse contains the HTTP response code and headers from the
  2376. // server.
  2377. googleapi.ServerResponse `json:"-"`
  2378. // ForceSendFields is a list of field names (e.g. "Etag") to
  2379. // unconditionally include in API requests. By default, fields with
  2380. // empty values are omitted from API requests. However, any non-pointer,
  2381. // non-interface field appearing in ForceSendFields will be sent to the
  2382. // server regardless of whether the field is empty or not. This may be
  2383. // used to include empty fields in Patch requests.
  2384. ForceSendFields []string `json:"-"`
  2385. // NullFields is a list of field names (e.g. "Etag") to include in API
  2386. // requests with the JSON null value. By default, fields with empty
  2387. // values are omitted from API requests. However, any field with an
  2388. // empty value appearing in NullFields will be sent to the server as
  2389. // null. It is an error if a field in this list has a non-empty value.
  2390. // This may be used to include null fields in Patch requests.
  2391. NullFields []string `json:"-"`
  2392. }
  2393. func (s *Role) MarshalJSON() ([]byte, error) {
  2394. type NoMethod Role
  2395. raw := NoMethod(*s)
  2396. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2397. }
  2398. type RoleRolePrivileges struct {
  2399. // PrivilegeName: The name of the privilege.
  2400. PrivilegeName string `json:"privilegeName,omitempty"`
  2401. // ServiceId: The obfuscated ID of the service this privilege is for.
  2402. ServiceId string `json:"serviceId,omitempty"`
  2403. // ForceSendFields is a list of field names (e.g. "PrivilegeName") to
  2404. // unconditionally include in API requests. By default, fields with
  2405. // empty values are omitted from API requests. However, any non-pointer,
  2406. // non-interface field appearing in ForceSendFields will be sent to the
  2407. // server regardless of whether the field is empty or not. This may be
  2408. // used to include empty fields in Patch requests.
  2409. ForceSendFields []string `json:"-"`
  2410. // NullFields is a list of field names (e.g. "PrivilegeName") to include
  2411. // in API requests with the JSON null value. By default, fields with
  2412. // empty values are omitted from API requests. However, any field with
  2413. // an empty value appearing in NullFields will be sent to the server as
  2414. // null. It is an error if a field in this list has a non-empty value.
  2415. // This may be used to include null fields in Patch requests.
  2416. NullFields []string `json:"-"`
  2417. }
  2418. func (s *RoleRolePrivileges) MarshalJSON() ([]byte, error) {
  2419. type NoMethod RoleRolePrivileges
  2420. raw := NoMethod(*s)
  2421. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2422. }
  2423. // RoleAssignment: JSON template for roleAssignment resource in
  2424. // Directory API.
  2425. type RoleAssignment struct {
  2426. // AssignedTo: The unique ID of the user this role is assigned to.
  2427. AssignedTo string `json:"assignedTo,omitempty"`
  2428. // Etag: ETag of the resource.
  2429. Etag string `json:"etag,omitempty"`
  2430. // Kind: The type of the API resource. This is always
  2431. // admin#directory#roleAssignment.
  2432. Kind string `json:"kind,omitempty"`
  2433. // OrgUnitId: If the role is restricted to an organization unit, this
  2434. // contains the ID for the organization unit the exercise of this role
  2435. // is restricted to.
  2436. OrgUnitId string `json:"orgUnitId,omitempty"`
  2437. // RoleAssignmentId: ID of this roleAssignment.
  2438. RoleAssignmentId int64 `json:"roleAssignmentId,omitempty,string"`
  2439. // RoleId: The ID of the role that is assigned.
  2440. RoleId int64 `json:"roleId,omitempty,string"`
  2441. // ScopeType: The scope in which this role is assigned. Possible values
  2442. // are:
  2443. // - CUSTOMER
  2444. // - ORG_UNIT
  2445. ScopeType string `json:"scopeType,omitempty"`
  2446. // ServerResponse contains the HTTP response code and headers from the
  2447. // server.
  2448. googleapi.ServerResponse `json:"-"`
  2449. // ForceSendFields is a list of field names (e.g. "AssignedTo") to
  2450. // unconditionally include in API requests. By default, fields with
  2451. // empty values are omitted from API requests. However, any non-pointer,
  2452. // non-interface field appearing in ForceSendFields will be sent to the
  2453. // server regardless of whether the field is empty or not. This may be
  2454. // used to include empty fields in Patch requests.
  2455. ForceSendFields []string `json:"-"`
  2456. // NullFields is a list of field names (e.g. "AssignedTo") to include in
  2457. // API requests with the JSON null value. By default, fields with empty
  2458. // values are omitted from API requests. However, any field with an
  2459. // empty value appearing in NullFields will be sent to the server as
  2460. // null. It is an error if a field in this list has a non-empty value.
  2461. // This may be used to include null fields in Patch requests.
  2462. NullFields []string `json:"-"`
  2463. }
  2464. func (s *RoleAssignment) MarshalJSON() ([]byte, error) {
  2465. type NoMethod RoleAssignment
  2466. raw := NoMethod(*s)
  2467. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2468. }
  2469. // RoleAssignments: JSON response template for List roleAssignments
  2470. // operation in Directory API.
  2471. type RoleAssignments struct {
  2472. // Etag: ETag of the resource.
  2473. Etag string `json:"etag,omitempty"`
  2474. // Items: A list of RoleAssignment resources.
  2475. Items []*RoleAssignment `json:"items,omitempty"`
  2476. // Kind: The type of the API resource. This is always
  2477. // admin#directory#roleAssignments.
  2478. Kind string `json:"kind,omitempty"`
  2479. NextPageToken string `json:"nextPageToken,omitempty"`
  2480. // ServerResponse contains the HTTP response code and headers from the
  2481. // server.
  2482. googleapi.ServerResponse `json:"-"`
  2483. // ForceSendFields is a list of field names (e.g. "Etag") to
  2484. // unconditionally include in API requests. By default, fields with
  2485. // empty values are omitted from API requests. However, any non-pointer,
  2486. // non-interface field appearing in ForceSendFields will be sent to the
  2487. // server regardless of whether the field is empty or not. This may be
  2488. // used to include empty fields in Patch requests.
  2489. ForceSendFields []string `json:"-"`
  2490. // NullFields is a list of field names (e.g. "Etag") to include in API
  2491. // requests with the JSON null value. By default, fields with empty
  2492. // values are omitted from API requests. However, any field with an
  2493. // empty value appearing in NullFields will be sent to the server as
  2494. // null. It is an error if a field in this list has a non-empty value.
  2495. // This may be used to include null fields in Patch requests.
  2496. NullFields []string `json:"-"`
  2497. }
  2498. func (s *RoleAssignments) MarshalJSON() ([]byte, error) {
  2499. type NoMethod RoleAssignments
  2500. raw := NoMethod(*s)
  2501. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2502. }
  2503. // Roles: JSON response template for List roles operation in Directory
  2504. // API.
  2505. type Roles struct {
  2506. // Etag: ETag of the resource.
  2507. Etag string `json:"etag,omitempty"`
  2508. // Items: A list of Role resources.
  2509. Items []*Role `json:"items,omitempty"`
  2510. // Kind: The type of the API resource. This is always
  2511. // admin#directory#roles.
  2512. Kind string `json:"kind,omitempty"`
  2513. NextPageToken string `json:"nextPageToken,omitempty"`
  2514. // ServerResponse contains the HTTP response code and headers from the
  2515. // server.
  2516. googleapi.ServerResponse `json:"-"`
  2517. // ForceSendFields is a list of field names (e.g. "Etag") to
  2518. // unconditionally include in API requests. By default, fields with
  2519. // empty values are omitted from API requests. However, any non-pointer,
  2520. // non-interface field appearing in ForceSendFields will be sent to the
  2521. // server regardless of whether the field is empty or not. This may be
  2522. // used to include empty fields in Patch requests.
  2523. ForceSendFields []string `json:"-"`
  2524. // NullFields is a list of field names (e.g. "Etag") to include in API
  2525. // requests with the JSON null value. By default, fields with empty
  2526. // values are omitted from API requests. However, any field with an
  2527. // empty value appearing in NullFields will be sent to the server as
  2528. // null. It is an error if a field in this list has a non-empty value.
  2529. // This may be used to include null fields in Patch requests.
  2530. NullFields []string `json:"-"`
  2531. }
  2532. func (s *Roles) MarshalJSON() ([]byte, error) {
  2533. type NoMethod Roles
  2534. raw := NoMethod(*s)
  2535. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2536. }
  2537. // Schema: JSON template for Schema resource in Directory API.
  2538. type Schema struct {
  2539. // DisplayName: Display name for the schema.
  2540. DisplayName string `json:"displayName,omitempty"`
  2541. // Etag: ETag of the resource.
  2542. Etag string `json:"etag,omitempty"`
  2543. // Fields: Fields of Schema
  2544. Fields []*SchemaFieldSpec `json:"fields,omitempty"`
  2545. // Kind: Kind of resource this is.
  2546. Kind string `json:"kind,omitempty"`
  2547. // SchemaId: Unique identifier of Schema (Read-only)
  2548. SchemaId string `json:"schemaId,omitempty"`
  2549. // SchemaName: Schema name
  2550. SchemaName string `json:"schemaName,omitempty"`
  2551. // ServerResponse contains the HTTP response code and headers from the
  2552. // server.
  2553. googleapi.ServerResponse `json:"-"`
  2554. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  2555. // unconditionally include in API requests. By default, fields with
  2556. // empty values are omitted from API requests. However, any non-pointer,
  2557. // non-interface field appearing in ForceSendFields will be sent to the
  2558. // server regardless of whether the field is empty or not. This may be
  2559. // used to include empty fields in Patch requests.
  2560. ForceSendFields []string `json:"-"`
  2561. // NullFields is a list of field names (e.g. "DisplayName") to include
  2562. // in API requests with the JSON null value. By default, fields with
  2563. // empty values are omitted from API requests. However, any field with
  2564. // an empty value appearing in NullFields will be sent to the server as
  2565. // null. It is an error if a field in this list has a non-empty value.
  2566. // This may be used to include null fields in Patch requests.
  2567. NullFields []string `json:"-"`
  2568. }
  2569. func (s *Schema) MarshalJSON() ([]byte, error) {
  2570. type NoMethod Schema
  2571. raw := NoMethod(*s)
  2572. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2573. }
  2574. // SchemaFieldSpec: JSON template for FieldSpec resource for Schemas in
  2575. // Directory API.
  2576. type SchemaFieldSpec struct {
  2577. // DisplayName: Display Name of the field.
  2578. DisplayName string `json:"displayName,omitempty"`
  2579. // Etag: ETag of the resource.
  2580. Etag string `json:"etag,omitempty"`
  2581. // FieldId: Unique identifier of Field (Read-only)
  2582. FieldId string `json:"fieldId,omitempty"`
  2583. // FieldName: Name of the field.
  2584. FieldName string `json:"fieldName,omitempty"`
  2585. // FieldType: Type of the field.
  2586. FieldType string `json:"fieldType,omitempty"`
  2587. // Indexed: Boolean specifying whether the field is indexed or not.
  2588. //
  2589. // Default: true
  2590. Indexed *bool `json:"indexed,omitempty"`
  2591. // Kind: Kind of resource this is.
  2592. Kind string `json:"kind,omitempty"`
  2593. // MultiValued: Boolean specifying whether this is a multi-valued field
  2594. // or not.
  2595. MultiValued bool `json:"multiValued,omitempty"`
  2596. // NumericIndexingSpec: Indexing spec for a numeric field. By default,
  2597. // only exact match queries will be supported for numeric fields.
  2598. // Setting the numericIndexingSpec allows range queries to be supported.
  2599. NumericIndexingSpec *SchemaFieldSpecNumericIndexingSpec `json:"numericIndexingSpec,omitempty"`
  2600. // ReadAccessType: Read ACLs on the field specifying who can view values
  2601. // of this field. Valid values are "ALL_DOMAIN_USERS" and
  2602. // "ADMINS_AND_SELF".
  2603. ReadAccessType string `json:"readAccessType,omitempty"`
  2604. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  2605. // unconditionally include in API requests. By default, fields with
  2606. // empty values are omitted from API requests. However, any non-pointer,
  2607. // non-interface field appearing in ForceSendFields will be sent to the
  2608. // server regardless of whether the field is empty or not. This may be
  2609. // used to include empty fields in Patch requests.
  2610. ForceSendFields []string `json:"-"`
  2611. // NullFields is a list of field names (e.g. "DisplayName") to include
  2612. // in API requests with the JSON null value. By default, fields with
  2613. // empty values are omitted from API requests. However, any field with
  2614. // an empty value appearing in NullFields will be sent to the server as
  2615. // null. It is an error if a field in this list has a non-empty value.
  2616. // This may be used to include null fields in Patch requests.
  2617. NullFields []string `json:"-"`
  2618. }
  2619. func (s *SchemaFieldSpec) MarshalJSON() ([]byte, error) {
  2620. type NoMethod SchemaFieldSpec
  2621. raw := NoMethod(*s)
  2622. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2623. }
  2624. // SchemaFieldSpecNumericIndexingSpec: Indexing spec for a numeric
  2625. // field. By default, only exact match queries will be supported for
  2626. // numeric fields. Setting the numericIndexingSpec allows range queries
  2627. // to be supported.
  2628. type SchemaFieldSpecNumericIndexingSpec struct {
  2629. // MaxValue: Maximum value of this field. This is meant to be indicative
  2630. // rather than enforced. Values outside this range will still be
  2631. // indexed, but search may not be as performant.
  2632. MaxValue float64 `json:"maxValue,omitempty"`
  2633. // MinValue: Minimum value of this field. This is meant to be indicative
  2634. // rather than enforced. Values outside this range will still be
  2635. // indexed, but search may not be as performant.
  2636. MinValue float64 `json:"minValue,omitempty"`
  2637. // ForceSendFields is a list of field names (e.g. "MaxValue") to
  2638. // unconditionally include in API requests. By default, fields with
  2639. // empty values are omitted from API requests. However, any non-pointer,
  2640. // non-interface field appearing in ForceSendFields will be sent to the
  2641. // server regardless of whether the field is empty or not. This may be
  2642. // used to include empty fields in Patch requests.
  2643. ForceSendFields []string `json:"-"`
  2644. // NullFields is a list of field names (e.g. "MaxValue") to include in
  2645. // API requests with the JSON null value. By default, fields with empty
  2646. // values are omitted from API requests. However, any field with an
  2647. // empty value appearing in NullFields will be sent to the server as
  2648. // null. It is an error if a field in this list has a non-empty value.
  2649. // This may be used to include null fields in Patch requests.
  2650. NullFields []string `json:"-"`
  2651. }
  2652. func (s *SchemaFieldSpecNumericIndexingSpec) MarshalJSON() ([]byte, error) {
  2653. type NoMethod SchemaFieldSpecNumericIndexingSpec
  2654. raw := NoMethod(*s)
  2655. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2656. }
  2657. func (s *SchemaFieldSpecNumericIndexingSpec) UnmarshalJSON(data []byte) error {
  2658. type NoMethod SchemaFieldSpecNumericIndexingSpec
  2659. var s1 struct {
  2660. MaxValue gensupport.JSONFloat64 `json:"maxValue"`
  2661. MinValue gensupport.JSONFloat64 `json:"minValue"`
  2662. *NoMethod
  2663. }
  2664. s1.NoMethod = (*NoMethod)(s)
  2665. if err := json.Unmarshal(data, &s1); err != nil {
  2666. return err
  2667. }
  2668. s.MaxValue = float64(s1.MaxValue)
  2669. s.MinValue = float64(s1.MinValue)
  2670. return nil
  2671. }
  2672. // Schemas: JSON response template for List Schema operation in
  2673. // Directory API.
  2674. type Schemas struct {
  2675. // Etag: ETag of the resource.
  2676. Etag string `json:"etag,omitempty"`
  2677. // Kind: Kind of resource this is.
  2678. Kind string `json:"kind,omitempty"`
  2679. // Schemas: List of UserSchema objects.
  2680. Schemas []*Schema `json:"schemas,omitempty"`
  2681. // ServerResponse contains the HTTP response code and headers from the
  2682. // server.
  2683. googleapi.ServerResponse `json:"-"`
  2684. // ForceSendFields is a list of field names (e.g. "Etag") to
  2685. // unconditionally include in API requests. By default, fields with
  2686. // empty values are omitted from API requests. However, any non-pointer,
  2687. // non-interface field appearing in ForceSendFields will be sent to the
  2688. // server regardless of whether the field is empty or not. This may be
  2689. // used to include empty fields in Patch requests.
  2690. ForceSendFields []string `json:"-"`
  2691. // NullFields is a list of field names (e.g. "Etag") to include in API
  2692. // requests with the JSON null value. By default, fields with empty
  2693. // values are omitted from API requests. However, any field with an
  2694. // empty value appearing in NullFields will be sent to the server as
  2695. // null. It is an error if a field in this list has a non-empty value.
  2696. // This may be used to include null fields in Patch requests.
  2697. NullFields []string `json:"-"`
  2698. }
  2699. func (s *Schemas) MarshalJSON() ([]byte, error) {
  2700. type NoMethod Schemas
  2701. raw := NoMethod(*s)
  2702. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2703. }
  2704. // Token: JSON template for token resource in Directory API.
  2705. type Token struct {
  2706. // Anonymous: Whether the application is registered with Google. The
  2707. // value is true if the application has an anonymous Client ID.
  2708. Anonymous bool `json:"anonymous,omitempty"`
  2709. // ClientId: The Client ID of the application the token is issued to.
  2710. ClientId string `json:"clientId,omitempty"`
  2711. // DisplayText: The displayable name of the application the token is
  2712. // issued to.
  2713. DisplayText string `json:"displayText,omitempty"`
  2714. // Etag: ETag of the resource.
  2715. Etag string `json:"etag,omitempty"`
  2716. // Kind: The type of the API resource. This is always
  2717. // admin#directory#token.
  2718. Kind string `json:"kind,omitempty"`
  2719. // NativeApp: Whether the token is issued to an installed application.
  2720. // The value is true if the application is installed to a desktop or
  2721. // mobile device.
  2722. NativeApp bool `json:"nativeApp,omitempty"`
  2723. // Scopes: A list of authorization scopes the application is granted.
  2724. Scopes []string `json:"scopes,omitempty"`
  2725. // UserKey: The unique ID of the user that issued the token.
  2726. UserKey string `json:"userKey,omitempty"`
  2727. // ServerResponse contains the HTTP response code and headers from the
  2728. // server.
  2729. googleapi.ServerResponse `json:"-"`
  2730. // ForceSendFields is a list of field names (e.g. "Anonymous") to
  2731. // unconditionally include in API requests. By default, fields with
  2732. // empty values are omitted from API requests. However, any non-pointer,
  2733. // non-interface field appearing in ForceSendFields will be sent to the
  2734. // server regardless of whether the field is empty or not. This may be
  2735. // used to include empty fields in Patch requests.
  2736. ForceSendFields []string `json:"-"`
  2737. // NullFields is a list of field names (e.g. "Anonymous") to include in
  2738. // API requests with the JSON null value. By default, fields with empty
  2739. // values are omitted from API requests. However, any field with an
  2740. // empty value appearing in NullFields will be sent to the server as
  2741. // null. It is an error if a field in this list has a non-empty value.
  2742. // This may be used to include null fields in Patch requests.
  2743. NullFields []string `json:"-"`
  2744. }
  2745. func (s *Token) MarshalJSON() ([]byte, error) {
  2746. type NoMethod Token
  2747. raw := NoMethod(*s)
  2748. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2749. }
  2750. // Tokens: JSON response template for List tokens operation in Directory
  2751. // API.
  2752. type Tokens struct {
  2753. // Etag: ETag of the resource.
  2754. Etag string `json:"etag,omitempty"`
  2755. // Items: A list of Token resources.
  2756. Items []*Token `json:"items,omitempty"`
  2757. // Kind: The type of the API resource. This is always
  2758. // admin#directory#tokenList.
  2759. Kind string `json:"kind,omitempty"`
  2760. // ServerResponse contains the HTTP response code and headers from the
  2761. // server.
  2762. googleapi.ServerResponse `json:"-"`
  2763. // ForceSendFields is a list of field names (e.g. "Etag") to
  2764. // unconditionally include in API requests. By default, fields with
  2765. // empty values are omitted from API requests. However, any non-pointer,
  2766. // non-interface field appearing in ForceSendFields will be sent to the
  2767. // server regardless of whether the field is empty or not. This may be
  2768. // used to include empty fields in Patch requests.
  2769. ForceSendFields []string `json:"-"`
  2770. // NullFields is a list of field names (e.g. "Etag") to include in API
  2771. // requests with the JSON null value. By default, fields with empty
  2772. // values are omitted from API requests. However, any field with an
  2773. // empty value appearing in NullFields will be sent to the server as
  2774. // null. It is an error if a field in this list has a non-empty value.
  2775. // This may be used to include null fields in Patch requests.
  2776. NullFields []string `json:"-"`
  2777. }
  2778. func (s *Tokens) MarshalJSON() ([]byte, error) {
  2779. type NoMethod Tokens
  2780. raw := NoMethod(*s)
  2781. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2782. }
  2783. // TrustedAppId: JSON template for Trusted App Ids Resource object in
  2784. // Directory API.
  2785. type TrustedAppId struct {
  2786. // AndroidPackageName: Android package name.
  2787. AndroidPackageName string `json:"androidPackageName,omitempty"`
  2788. // CertificateHashSHA1: SHA1 signature of the app certificate.
  2789. CertificateHashSHA1 string `json:"certificateHashSHA1,omitempty"`
  2790. // CertificateHashSHA256: SHA256 signature of the app certificate.
  2791. CertificateHashSHA256 string `json:"certificateHashSHA256,omitempty"`
  2792. Etag string `json:"etag,omitempty"`
  2793. // Kind: Identifies the resource as a trusted AppId.
  2794. Kind string `json:"kind,omitempty"`
  2795. // ForceSendFields is a list of field names (e.g. "AndroidPackageName")
  2796. // to unconditionally include in API requests. By default, fields with
  2797. // empty values are omitted from API requests. However, any non-pointer,
  2798. // non-interface field appearing in ForceSendFields will be sent to the
  2799. // server regardless of whether the field is empty or not. This may be
  2800. // used to include empty fields in Patch requests.
  2801. ForceSendFields []string `json:"-"`
  2802. // NullFields is a list of field names (e.g. "AndroidPackageName") to
  2803. // include in API requests with the JSON null value. By default, fields
  2804. // with empty values are omitted from API requests. However, any field
  2805. // with an empty value appearing in NullFields will be sent to the
  2806. // server as null. It is an error if a field in this list has a
  2807. // non-empty value. This may be used to include null fields in Patch
  2808. // requests.
  2809. NullFields []string `json:"-"`
  2810. }
  2811. func (s *TrustedAppId) MarshalJSON() ([]byte, error) {
  2812. type NoMethod TrustedAppId
  2813. raw := NoMethod(*s)
  2814. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2815. }
  2816. // TrustedApps: JSON template for Trusted Apps response object of a user
  2817. // in Directory API.
  2818. type TrustedApps struct {
  2819. // Etag: ETag of the resource.
  2820. Etag string `json:"etag,omitempty"`
  2821. // Kind: Identifies the resource as trusted apps response.
  2822. Kind string `json:"kind,omitempty"`
  2823. NextPageToken string `json:"nextPageToken,omitempty"`
  2824. // TrustedApps: Trusted Apps list.
  2825. TrustedApps []*TrustedAppId `json:"trustedApps,omitempty"`
  2826. // ServerResponse contains the HTTP response code and headers from the
  2827. // server.
  2828. googleapi.ServerResponse `json:"-"`
  2829. // ForceSendFields is a list of field names (e.g. "Etag") to
  2830. // unconditionally include in API requests. By default, fields with
  2831. // empty values are omitted from API requests. However, any non-pointer,
  2832. // non-interface field appearing in ForceSendFields will be sent to the
  2833. // server regardless of whether the field is empty or not. This may be
  2834. // used to include empty fields in Patch requests.
  2835. ForceSendFields []string `json:"-"`
  2836. // NullFields is a list of field names (e.g. "Etag") to include in API
  2837. // requests with the JSON null value. By default, fields with empty
  2838. // values are omitted from API requests. However, any field with an
  2839. // empty value appearing in NullFields will be sent to the server as
  2840. // null. It is an error if a field in this list has a non-empty value.
  2841. // This may be used to include null fields in Patch requests.
  2842. NullFields []string `json:"-"`
  2843. }
  2844. func (s *TrustedApps) MarshalJSON() ([]byte, error) {
  2845. type NoMethod TrustedApps
  2846. raw := NoMethod(*s)
  2847. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2848. }
  2849. // User: JSON template for User object in Directory API.
  2850. type User struct {
  2851. Addresses interface{} `json:"addresses,omitempty"`
  2852. // AgreedToTerms: Indicates if user has agreed to terms (Read-only)
  2853. AgreedToTerms bool `json:"agreedToTerms,omitempty"`
  2854. // Aliases: List of aliases (Read-only)
  2855. Aliases []string `json:"aliases,omitempty"`
  2856. // Archived: Indicates if user is archived.
  2857. Archived bool `json:"archived,omitempty"`
  2858. // ChangePasswordAtNextLogin: Boolean indicating if the user should
  2859. // change password in next login
  2860. ChangePasswordAtNextLogin bool `json:"changePasswordAtNextLogin,omitempty"`
  2861. // CreationTime: User's G Suite account creation time. (Read-only)
  2862. CreationTime string `json:"creationTime,omitempty"`
  2863. // CustomSchemas: Custom fields of the user.
  2864. CustomSchemas map[string]googleapi.RawMessage `json:"customSchemas,omitempty"`
  2865. // CustomerId: CustomerId of User (Read-only)
  2866. CustomerId string `json:"customerId,omitempty"`
  2867. DeletionTime string `json:"deletionTime,omitempty"`
  2868. Emails interface{} `json:"emails,omitempty"`
  2869. // Etag: ETag of the resource.
  2870. Etag string `json:"etag,omitempty"`
  2871. ExternalIds interface{} `json:"externalIds,omitempty"`
  2872. Gender interface{} `json:"gender,omitempty"`
  2873. // HashFunction: Hash function name for password. Supported are MD5,
  2874. // SHA-1 and crypt
  2875. HashFunction string `json:"hashFunction,omitempty"`
  2876. // Id: Unique identifier of User (Read-only)
  2877. Id string `json:"id,omitempty"`
  2878. Ims interface{} `json:"ims,omitempty"`
  2879. // IncludeInGlobalAddressList: Boolean indicating if user is included in
  2880. // Global Address List
  2881. IncludeInGlobalAddressList bool `json:"includeInGlobalAddressList,omitempty"`
  2882. // IpWhitelisted: Boolean indicating if ip is whitelisted
  2883. IpWhitelisted bool `json:"ipWhitelisted,omitempty"`
  2884. // IsAdmin: Boolean indicating if the user is admin (Read-only)
  2885. IsAdmin bool `json:"isAdmin,omitempty"`
  2886. // IsDelegatedAdmin: Boolean indicating if the user is delegated admin
  2887. // (Read-only)
  2888. IsDelegatedAdmin bool `json:"isDelegatedAdmin,omitempty"`
  2889. // IsEnforcedIn2Sv: Is 2-step verification enforced (Read-only)
  2890. IsEnforcedIn2Sv bool `json:"isEnforcedIn2Sv,omitempty"`
  2891. // IsEnrolledIn2Sv: Is enrolled in 2-step verification (Read-only)
  2892. IsEnrolledIn2Sv bool `json:"isEnrolledIn2Sv,omitempty"`
  2893. // IsMailboxSetup: Is mailbox setup (Read-only)
  2894. IsMailboxSetup bool `json:"isMailboxSetup,omitempty"`
  2895. Keywords interface{} `json:"keywords,omitempty"`
  2896. // Kind: Kind of resource this is.
  2897. Kind string `json:"kind,omitempty"`
  2898. Languages interface{} `json:"languages,omitempty"`
  2899. // LastLoginTime: User's last login time. (Read-only)
  2900. LastLoginTime string `json:"lastLoginTime,omitempty"`
  2901. Locations interface{} `json:"locations,omitempty"`
  2902. // Name: User's name
  2903. Name *UserName `json:"name,omitempty"`
  2904. // NonEditableAliases: List of non editable aliases (Read-only)
  2905. NonEditableAliases []string `json:"nonEditableAliases,omitempty"`
  2906. Notes interface{} `json:"notes,omitempty"`
  2907. // OrgUnitPath: OrgUnit of User
  2908. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  2909. Organizations interface{} `json:"organizations,omitempty"`
  2910. // Password: User's password
  2911. Password string `json:"password,omitempty"`
  2912. Phones interface{} `json:"phones,omitempty"`
  2913. PosixAccounts interface{} `json:"posixAccounts,omitempty"`
  2914. // PrimaryEmail: username of User
  2915. PrimaryEmail string `json:"primaryEmail,omitempty"`
  2916. Relations interface{} `json:"relations,omitempty"`
  2917. SshPublicKeys interface{} `json:"sshPublicKeys,omitempty"`
  2918. // Suspended: Indicates if user is suspended.
  2919. Suspended bool `json:"suspended,omitempty"`
  2920. // SuspensionReason: Suspension reason if user is suspended (Read-only)
  2921. SuspensionReason string `json:"suspensionReason,omitempty"`
  2922. // ThumbnailPhotoEtag: ETag of the user's photo (Read-only)
  2923. ThumbnailPhotoEtag string `json:"thumbnailPhotoEtag,omitempty"`
  2924. // ThumbnailPhotoUrl: Photo Url of the user (Read-only)
  2925. ThumbnailPhotoUrl string `json:"thumbnailPhotoUrl,omitempty"`
  2926. Websites interface{} `json:"websites,omitempty"`
  2927. // ServerResponse contains the HTTP response code and headers from the
  2928. // server.
  2929. googleapi.ServerResponse `json:"-"`
  2930. // ForceSendFields is a list of field names (e.g. "Addresses") to
  2931. // unconditionally include in API requests. By default, fields with
  2932. // empty values are omitted from API requests. However, any non-pointer,
  2933. // non-interface field appearing in ForceSendFields will be sent to the
  2934. // server regardless of whether the field is empty or not. This may be
  2935. // used to include empty fields in Patch requests.
  2936. ForceSendFields []string `json:"-"`
  2937. // NullFields is a list of field names (e.g. "Addresses") to include in
  2938. // API requests with the JSON null value. By default, fields with empty
  2939. // values are omitted from API requests. However, any field with an
  2940. // empty value appearing in NullFields will be sent to the server as
  2941. // null. It is an error if a field in this list has a non-empty value.
  2942. // This may be used to include null fields in Patch requests.
  2943. NullFields []string `json:"-"`
  2944. }
  2945. func (s *User) MarshalJSON() ([]byte, error) {
  2946. type NoMethod User
  2947. raw := NoMethod(*s)
  2948. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2949. }
  2950. // UserAbout: JSON template for About (notes) of a user in Directory
  2951. // API.
  2952. type UserAbout struct {
  2953. // ContentType: About entry can have a type which indicates the content
  2954. // type. It can either be plain or html. By default, notes contents are
  2955. // assumed to contain plain text.
  2956. ContentType string `json:"contentType,omitempty"`
  2957. // Value: Actual value of notes.
  2958. Value string `json:"value,omitempty"`
  2959. // ForceSendFields is a list of field names (e.g. "ContentType") to
  2960. // unconditionally include in API requests. By default, fields with
  2961. // empty values are omitted from API requests. However, any non-pointer,
  2962. // non-interface field appearing in ForceSendFields will be sent to the
  2963. // server regardless of whether the field is empty or not. This may be
  2964. // used to include empty fields in Patch requests.
  2965. ForceSendFields []string `json:"-"`
  2966. // NullFields is a list of field names (e.g. "ContentType") to include
  2967. // in API requests with the JSON null value. By default, fields with
  2968. // empty values are omitted from API requests. However, any field with
  2969. // an empty value appearing in NullFields will be sent to the server as
  2970. // null. It is an error if a field in this list has a non-empty value.
  2971. // This may be used to include null fields in Patch requests.
  2972. NullFields []string `json:"-"`
  2973. }
  2974. func (s *UserAbout) MarshalJSON() ([]byte, error) {
  2975. type NoMethod UserAbout
  2976. raw := NoMethod(*s)
  2977. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2978. }
  2979. // UserAddress: JSON template for address.
  2980. type UserAddress struct {
  2981. // Country: Country.
  2982. Country string `json:"country,omitempty"`
  2983. // CountryCode: Country code.
  2984. CountryCode string `json:"countryCode,omitempty"`
  2985. // CustomType: Custom type.
  2986. CustomType string `json:"customType,omitempty"`
  2987. // ExtendedAddress: Extended Address.
  2988. ExtendedAddress string `json:"extendedAddress,omitempty"`
  2989. // Formatted: Formatted address.
  2990. Formatted string `json:"formatted,omitempty"`
  2991. // Locality: Locality.
  2992. Locality string `json:"locality,omitempty"`
  2993. // PoBox: Other parts of address.
  2994. PoBox string `json:"poBox,omitempty"`
  2995. // PostalCode: Postal code.
  2996. PostalCode string `json:"postalCode,omitempty"`
  2997. // Primary: If this is user's primary address. Only one entry could be
  2998. // marked as primary.
  2999. Primary bool `json:"primary,omitempty"`
  3000. // Region: Region.
  3001. Region string `json:"region,omitempty"`
  3002. // SourceIsStructured: User supplied address was structured. Structured
  3003. // addresses are NOT supported at this time. You might be able to write
  3004. // structured addresses, but any values will eventually be clobbered.
  3005. SourceIsStructured bool `json:"sourceIsStructured,omitempty"`
  3006. // StreetAddress: Street.
  3007. StreetAddress string `json:"streetAddress,omitempty"`
  3008. // Type: Each entry can have a type which indicates standard values of
  3009. // that entry. For example address could be of home, work etc. In
  3010. // addition to the standard type, an entry can have a custom type and
  3011. // can take any value. Such type should have the CUSTOM value as type
  3012. // and also have a customType value.
  3013. Type string `json:"type,omitempty"`
  3014. // ForceSendFields is a list of field names (e.g. "Country") to
  3015. // unconditionally include in API requests. By default, fields with
  3016. // empty values are omitted from API requests. However, any non-pointer,
  3017. // non-interface field appearing in ForceSendFields will be sent to the
  3018. // server regardless of whether the field is empty or not. This may be
  3019. // used to include empty fields in Patch requests.
  3020. ForceSendFields []string `json:"-"`
  3021. // NullFields is a list of field names (e.g. "Country") to include in
  3022. // API requests with the JSON null value. By default, fields with empty
  3023. // values are omitted from API requests. However, any field with an
  3024. // empty value appearing in NullFields will be sent to the server as
  3025. // null. It is an error if a field in this list has a non-empty value.
  3026. // This may be used to include null fields in Patch requests.
  3027. NullFields []string `json:"-"`
  3028. }
  3029. func (s *UserAddress) MarshalJSON() ([]byte, error) {
  3030. type NoMethod UserAddress
  3031. raw := NoMethod(*s)
  3032. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3033. }
  3034. // UserEmail: JSON template for an email.
  3035. type UserEmail struct {
  3036. // Address: Email id of the user.
  3037. Address string `json:"address,omitempty"`
  3038. // CustomType: Custom Type.
  3039. CustomType string `json:"customType,omitempty"`
  3040. // Primary: If this is user's primary email. Only one entry could be
  3041. // marked as primary.
  3042. Primary bool `json:"primary,omitempty"`
  3043. // Type: Each entry can have a type which indicates standard types of
  3044. // that entry. For example email could be of home, work etc. In addition
  3045. // to the standard type, an entry can have a custom type and can take
  3046. // any value Such types should have the CUSTOM value as type and also
  3047. // have a customType value.
  3048. Type string `json:"type,omitempty"`
  3049. // ForceSendFields is a list of field names (e.g. "Address") to
  3050. // unconditionally include in API requests. By default, fields with
  3051. // empty values are omitted from API requests. However, any non-pointer,
  3052. // non-interface field appearing in ForceSendFields will be sent to the
  3053. // server regardless of whether the field is empty or not. This may be
  3054. // used to include empty fields in Patch requests.
  3055. ForceSendFields []string `json:"-"`
  3056. // NullFields is a list of field names (e.g. "Address") to include in
  3057. // API requests with the JSON null value. By default, fields with empty
  3058. // values are omitted from API requests. However, any field with an
  3059. // empty value appearing in NullFields will be sent to the server as
  3060. // null. It is an error if a field in this list has a non-empty value.
  3061. // This may be used to include null fields in Patch requests.
  3062. NullFields []string `json:"-"`
  3063. }
  3064. func (s *UserEmail) MarshalJSON() ([]byte, error) {
  3065. type NoMethod UserEmail
  3066. raw := NoMethod(*s)
  3067. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3068. }
  3069. // UserExternalId: JSON template for an externalId entry.
  3070. type UserExternalId struct {
  3071. // CustomType: Custom type.
  3072. CustomType string `json:"customType,omitempty"`
  3073. // Type: The type of the Id.
  3074. Type string `json:"type,omitempty"`
  3075. // Value: The value of the id.
  3076. Value string `json:"value,omitempty"`
  3077. // ForceSendFields is a list of field names (e.g. "CustomType") to
  3078. // unconditionally include in API requests. By default, fields with
  3079. // empty values are omitted from API requests. However, any non-pointer,
  3080. // non-interface field appearing in ForceSendFields will be sent to the
  3081. // server regardless of whether the field is empty or not. This may be
  3082. // used to include empty fields in Patch requests.
  3083. ForceSendFields []string `json:"-"`
  3084. // NullFields is a list of field names (e.g. "CustomType") to include in
  3085. // API requests with the JSON null value. By default, fields with empty
  3086. // values are omitted from API requests. However, any field with an
  3087. // empty value appearing in NullFields will be sent to the server as
  3088. // null. It is an error if a field in this list has a non-empty value.
  3089. // This may be used to include null fields in Patch requests.
  3090. NullFields []string `json:"-"`
  3091. }
  3092. func (s *UserExternalId) MarshalJSON() ([]byte, error) {
  3093. type NoMethod UserExternalId
  3094. raw := NoMethod(*s)
  3095. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3096. }
  3097. type UserGender struct {
  3098. // AddressMeAs: AddressMeAs. A human-readable string containing the
  3099. // proper way to refer to the profile owner by humans, for example
  3100. // "he/him/his" or "they/them/their".
  3101. AddressMeAs string `json:"addressMeAs,omitempty"`
  3102. // CustomGender: Custom gender.
  3103. CustomGender string `json:"customGender,omitempty"`
  3104. // Type: Gender.
  3105. Type string `json:"type,omitempty"`
  3106. // ForceSendFields is a list of field names (e.g. "AddressMeAs") to
  3107. // unconditionally include in API requests. By default, fields with
  3108. // empty values are omitted from API requests. However, any non-pointer,
  3109. // non-interface field appearing in ForceSendFields will be sent to the
  3110. // server regardless of whether the field is empty or not. This may be
  3111. // used to include empty fields in Patch requests.
  3112. ForceSendFields []string `json:"-"`
  3113. // NullFields is a list of field names (e.g. "AddressMeAs") to include
  3114. // in API requests with the JSON null value. By default, fields with
  3115. // empty values are omitted from API requests. However, any field with
  3116. // an empty value appearing in NullFields will be sent to the server as
  3117. // null. It is an error if a field in this list has a non-empty value.
  3118. // This may be used to include null fields in Patch requests.
  3119. NullFields []string `json:"-"`
  3120. }
  3121. func (s *UserGender) MarshalJSON() ([]byte, error) {
  3122. type NoMethod UserGender
  3123. raw := NoMethod(*s)
  3124. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3125. }
  3126. // UserIm: JSON template for instant messenger of an user.
  3127. type UserIm struct {
  3128. // CustomProtocol: Custom protocol.
  3129. CustomProtocol string `json:"customProtocol,omitempty"`
  3130. // CustomType: Custom type.
  3131. CustomType string `json:"customType,omitempty"`
  3132. // Im: Instant messenger id.
  3133. Im string `json:"im,omitempty"`
  3134. // Primary: If this is user's primary im. Only one entry could be marked
  3135. // as primary.
  3136. Primary bool `json:"primary,omitempty"`
  3137. // Protocol: Protocol used in the instant messenger. It should be one of
  3138. // the values from ImProtocolTypes map. Similar to type, it can take a
  3139. // CUSTOM value and specify the custom name in customProtocol field.
  3140. Protocol string `json:"protocol,omitempty"`
  3141. // Type: Each entry can have a type which indicates standard types of
  3142. // that entry. For example instant messengers could be of home, work
  3143. // etc. In addition to the standard type, an entry can have a custom
  3144. // type and can take any value. Such types should have the CUSTOM value
  3145. // as type and also have a customType value.
  3146. Type string `json:"type,omitempty"`
  3147. // ForceSendFields is a list of field names (e.g. "CustomProtocol") to
  3148. // unconditionally include in API requests. By default, fields with
  3149. // empty values are omitted from API requests. However, any non-pointer,
  3150. // non-interface field appearing in ForceSendFields will be sent to the
  3151. // server regardless of whether the field is empty or not. This may be
  3152. // used to include empty fields in Patch requests.
  3153. ForceSendFields []string `json:"-"`
  3154. // NullFields is a list of field names (e.g. "CustomProtocol") to
  3155. // include in API requests with the JSON null value. By default, fields
  3156. // with empty values are omitted from API requests. However, any field
  3157. // with an empty value appearing in NullFields will be sent to the
  3158. // server as null. It is an error if a field in this list has a
  3159. // non-empty value. This may be used to include null fields in Patch
  3160. // requests.
  3161. NullFields []string `json:"-"`
  3162. }
  3163. func (s *UserIm) MarshalJSON() ([]byte, error) {
  3164. type NoMethod UserIm
  3165. raw := NoMethod(*s)
  3166. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3167. }
  3168. // UserKeyword: JSON template for a keyword entry.
  3169. type UserKeyword struct {
  3170. // CustomType: Custom Type.
  3171. CustomType string `json:"customType,omitempty"`
  3172. // Type: Each entry can have a type which indicates standard type of
  3173. // that entry. For example, keyword could be of type occupation or
  3174. // outlook. In addition to the standard type, an entry can have a custom
  3175. // type and can give it any name. Such types should have the CUSTOM
  3176. // value as type and also have a customType value.
  3177. Type string `json:"type,omitempty"`
  3178. // Value: Keyword.
  3179. Value string `json:"value,omitempty"`
  3180. // ForceSendFields is a list of field names (e.g. "CustomType") to
  3181. // unconditionally include in API requests. By default, fields with
  3182. // empty values are omitted from API requests. However, any non-pointer,
  3183. // non-interface field appearing in ForceSendFields will be sent to the
  3184. // server regardless of whether the field is empty or not. This may be
  3185. // used to include empty fields in Patch requests.
  3186. ForceSendFields []string `json:"-"`
  3187. // NullFields is a list of field names (e.g. "CustomType") to include in
  3188. // API requests with the JSON null value. By default, fields with empty
  3189. // values are omitted from API requests. However, any field with an
  3190. // empty value appearing in NullFields will be sent to the server as
  3191. // null. It is an error if a field in this list has a non-empty value.
  3192. // This may be used to include null fields in Patch requests.
  3193. NullFields []string `json:"-"`
  3194. }
  3195. func (s *UserKeyword) MarshalJSON() ([]byte, error) {
  3196. type NoMethod UserKeyword
  3197. raw := NoMethod(*s)
  3198. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3199. }
  3200. // UserLanguage: JSON template for a language entry.
  3201. type UserLanguage struct {
  3202. // CustomLanguage: Other language. User can provide own language name if
  3203. // there is no corresponding Google III language code. If this is set
  3204. // LanguageCode can't be set
  3205. CustomLanguage string `json:"customLanguage,omitempty"`
  3206. // LanguageCode: Language Code. Should be used for storing Google III
  3207. // LanguageCode string representation for language. Illegal values cause
  3208. // SchemaException.
  3209. LanguageCode string `json:"languageCode,omitempty"`
  3210. // ForceSendFields is a list of field names (e.g. "CustomLanguage") to
  3211. // unconditionally include in API requests. By default, fields with
  3212. // empty values are omitted from API requests. However, any non-pointer,
  3213. // non-interface field appearing in ForceSendFields will be sent to the
  3214. // server regardless of whether the field is empty or not. This may be
  3215. // used to include empty fields in Patch requests.
  3216. ForceSendFields []string `json:"-"`
  3217. // NullFields is a list of field names (e.g. "CustomLanguage") to
  3218. // include in API requests with the JSON null value. By default, fields
  3219. // with empty values are omitted from API requests. However, any field
  3220. // with an empty value appearing in NullFields will be sent to the
  3221. // server as null. It is an error if a field in this list has a
  3222. // non-empty value. This may be used to include null fields in Patch
  3223. // requests.
  3224. NullFields []string `json:"-"`
  3225. }
  3226. func (s *UserLanguage) MarshalJSON() ([]byte, error) {
  3227. type NoMethod UserLanguage
  3228. raw := NoMethod(*s)
  3229. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3230. }
  3231. // UserLocation: JSON template for a location entry.
  3232. type UserLocation struct {
  3233. // Area: Textual location. This is most useful for display purposes to
  3234. // concisely describe the location. For example, "Mountain View, CA",
  3235. // "Near Seattle", "US-NYC-9TH 9A209A".
  3236. Area string `json:"area,omitempty"`
  3237. // BuildingId: Building Identifier.
  3238. BuildingId string `json:"buildingId,omitempty"`
  3239. // CustomType: Custom Type.
  3240. CustomType string `json:"customType,omitempty"`
  3241. // DeskCode: Most specific textual code of individual desk location.
  3242. DeskCode string `json:"deskCode,omitempty"`
  3243. // FloorName: Floor name/number.
  3244. FloorName string `json:"floorName,omitempty"`
  3245. // FloorSection: Floor section. More specific location within the floor.
  3246. // For example, if a floor is divided into sections "A", "B", and "C",
  3247. // this field would identify one of those values.
  3248. FloorSection string `json:"floorSection,omitempty"`
  3249. // Type: Each entry can have a type which indicates standard types of
  3250. // that entry. For example location could be of types default and desk.
  3251. // In addition to standard type, an entry can have a custom type and can
  3252. // give it any name. Such types should have "custom" as type and also
  3253. // have a customType value.
  3254. Type string `json:"type,omitempty"`
  3255. // ForceSendFields is a list of field names (e.g. "Area") to
  3256. // unconditionally include in API requests. By default, fields with
  3257. // empty values are omitted from API requests. However, any non-pointer,
  3258. // non-interface field appearing in ForceSendFields will be sent to the
  3259. // server regardless of whether the field is empty or not. This may be
  3260. // used to include empty fields in Patch requests.
  3261. ForceSendFields []string `json:"-"`
  3262. // NullFields is a list of field names (e.g. "Area") to include in API
  3263. // requests with the JSON null value. By default, fields with empty
  3264. // values are omitted from API requests. However, any field with an
  3265. // empty value appearing in NullFields will be sent to the server as
  3266. // null. It is an error if a field in this list has a non-empty value.
  3267. // This may be used to include null fields in Patch requests.
  3268. NullFields []string `json:"-"`
  3269. }
  3270. func (s *UserLocation) MarshalJSON() ([]byte, error) {
  3271. type NoMethod UserLocation
  3272. raw := NoMethod(*s)
  3273. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3274. }
  3275. // UserMakeAdmin: JSON request template for setting/revoking admin
  3276. // status of a user in Directory API.
  3277. type UserMakeAdmin struct {
  3278. // Status: Boolean indicating new admin status of the user
  3279. Status bool `json:"status,omitempty"`
  3280. // ForceSendFields is a list of field names (e.g. "Status") to
  3281. // unconditionally include in API requests. By default, fields with
  3282. // empty values are omitted from API requests. However, any non-pointer,
  3283. // non-interface field appearing in ForceSendFields will be sent to the
  3284. // server regardless of whether the field is empty or not. This may be
  3285. // used to include empty fields in Patch requests.
  3286. ForceSendFields []string `json:"-"`
  3287. // NullFields is a list of field names (e.g. "Status") to include in API
  3288. // requests with the JSON null value. By default, fields with empty
  3289. // values are omitted from API requests. However, any field with an
  3290. // empty value appearing in NullFields will be sent to the server as
  3291. // null. It is an error if a field in this list has a non-empty value.
  3292. // This may be used to include null fields in Patch requests.
  3293. NullFields []string `json:"-"`
  3294. }
  3295. func (s *UserMakeAdmin) MarshalJSON() ([]byte, error) {
  3296. type NoMethod UserMakeAdmin
  3297. raw := NoMethod(*s)
  3298. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3299. }
  3300. // UserName: JSON template for name of a user in Directory API.
  3301. type UserName struct {
  3302. // FamilyName: Last Name
  3303. FamilyName string `json:"familyName,omitempty"`
  3304. // FullName: Full Name
  3305. FullName string `json:"fullName,omitempty"`
  3306. // GivenName: First Name
  3307. GivenName string `json:"givenName,omitempty"`
  3308. // ForceSendFields is a list of field names (e.g. "FamilyName") to
  3309. // unconditionally include in API requests. By default, fields with
  3310. // empty values are omitted from API requests. However, any non-pointer,
  3311. // non-interface field appearing in ForceSendFields will be sent to the
  3312. // server regardless of whether the field is empty or not. This may be
  3313. // used to include empty fields in Patch requests.
  3314. ForceSendFields []string `json:"-"`
  3315. // NullFields is a list of field names (e.g. "FamilyName") to include in
  3316. // API requests with the JSON null value. By default, fields with empty
  3317. // values are omitted from API requests. However, any field with an
  3318. // empty value appearing in NullFields will be sent to the server as
  3319. // null. It is an error if a field in this list has a non-empty value.
  3320. // This may be used to include null fields in Patch requests.
  3321. NullFields []string `json:"-"`
  3322. }
  3323. func (s *UserName) MarshalJSON() ([]byte, error) {
  3324. type NoMethod UserName
  3325. raw := NoMethod(*s)
  3326. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3327. }
  3328. // UserOrganization: JSON template for an organization entry.
  3329. type UserOrganization struct {
  3330. // CostCenter: The cost center of the users department.
  3331. CostCenter string `json:"costCenter,omitempty"`
  3332. // CustomType: Custom type.
  3333. CustomType string `json:"customType,omitempty"`
  3334. // Department: Department within the organization.
  3335. Department string `json:"department,omitempty"`
  3336. // Description: Description of the organization.
  3337. Description string `json:"description,omitempty"`
  3338. // Domain: The domain to which the organization belongs to.
  3339. Domain string `json:"domain,omitempty"`
  3340. // FullTimeEquivalent: The full-time equivalent percent within the
  3341. // organization (100000 = 100%).
  3342. FullTimeEquivalent int64 `json:"fullTimeEquivalent,omitempty"`
  3343. // Location: Location of the organization. This need not be fully
  3344. // qualified address.
  3345. Location string `json:"location,omitempty"`
  3346. // Name: Name of the organization
  3347. Name string `json:"name,omitempty"`
  3348. // Primary: If it user's primary organization.
  3349. Primary bool `json:"primary,omitempty"`
  3350. // Symbol: Symbol of the organization.
  3351. Symbol string `json:"symbol,omitempty"`
  3352. // Title: Title (designation) of the user in the organization.
  3353. Title string `json:"title,omitempty"`
  3354. // Type: Each entry can have a type which indicates standard types of
  3355. // that entry. For example organization could be of school, work etc. In
  3356. // addition to the standard type, an entry can have a custom type and
  3357. // can give it any name. Such types should have the CUSTOM value as type
  3358. // and also have a CustomType value.
  3359. Type string `json:"type,omitempty"`
  3360. // ForceSendFields is a list of field names (e.g. "CostCenter") to
  3361. // unconditionally include in API requests. By default, fields with
  3362. // empty values are omitted from API requests. However, any non-pointer,
  3363. // non-interface field appearing in ForceSendFields will be sent to the
  3364. // server regardless of whether the field is empty or not. This may be
  3365. // used to include empty fields in Patch requests.
  3366. ForceSendFields []string `json:"-"`
  3367. // NullFields is a list of field names (e.g. "CostCenter") to include in
  3368. // API requests with the JSON null value. By default, fields with empty
  3369. // values are omitted from API requests. However, any field with an
  3370. // empty value appearing in NullFields will be sent to the server as
  3371. // null. It is an error if a field in this list has a non-empty value.
  3372. // This may be used to include null fields in Patch requests.
  3373. NullFields []string `json:"-"`
  3374. }
  3375. func (s *UserOrganization) MarshalJSON() ([]byte, error) {
  3376. type NoMethod UserOrganization
  3377. raw := NoMethod(*s)
  3378. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3379. }
  3380. // UserPhone: JSON template for a phone entry.
  3381. type UserPhone struct {
  3382. // CustomType: Custom Type.
  3383. CustomType string `json:"customType,omitempty"`
  3384. // Primary: If this is user's primary phone or not.
  3385. Primary bool `json:"primary,omitempty"`
  3386. // Type: Each entry can have a type which indicates standard types of
  3387. // that entry. For example phone could be of home_fax, work, mobile etc.
  3388. // In addition to the standard type, an entry can have a custom type and
  3389. // can give it any name. Such types should have the CUSTOM value as type
  3390. // and also have a customType value.
  3391. Type string `json:"type,omitempty"`
  3392. // Value: Phone number.
  3393. Value string `json:"value,omitempty"`
  3394. // ForceSendFields is a list of field names (e.g. "CustomType") to
  3395. // unconditionally include in API requests. By default, fields with
  3396. // empty values are omitted from API requests. However, any non-pointer,
  3397. // non-interface field appearing in ForceSendFields will be sent to the
  3398. // server regardless of whether the field is empty or not. This may be
  3399. // used to include empty fields in Patch requests.
  3400. ForceSendFields []string `json:"-"`
  3401. // NullFields is a list of field names (e.g. "CustomType") to include in
  3402. // API requests with the JSON null value. By default, fields with empty
  3403. // values are omitted from API requests. However, any field with an
  3404. // empty value appearing in NullFields will be sent to the server as
  3405. // null. It is an error if a field in this list has a non-empty value.
  3406. // This may be used to include null fields in Patch requests.
  3407. NullFields []string `json:"-"`
  3408. }
  3409. func (s *UserPhone) MarshalJSON() ([]byte, error) {
  3410. type NoMethod UserPhone
  3411. raw := NoMethod(*s)
  3412. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3413. }
  3414. // UserPhoto: JSON template for Photo object in Directory API.
  3415. type UserPhoto struct {
  3416. // Etag: ETag of the resource.
  3417. Etag string `json:"etag,omitempty"`
  3418. // Height: Height in pixels of the photo
  3419. Height int64 `json:"height,omitempty"`
  3420. // Id: Unique identifier of User (Read-only)
  3421. Id string `json:"id,omitempty"`
  3422. // Kind: Kind of resource this is.
  3423. Kind string `json:"kind,omitempty"`
  3424. // MimeType: Mime Type of the photo
  3425. MimeType string `json:"mimeType,omitempty"`
  3426. // PhotoData: Base64 encoded photo data
  3427. PhotoData string `json:"photoData,omitempty"`
  3428. // PrimaryEmail: Primary email of User (Read-only)
  3429. PrimaryEmail string `json:"primaryEmail,omitempty"`
  3430. // Width: Width in pixels of the photo
  3431. Width int64 `json:"width,omitempty"`
  3432. // ServerResponse contains the HTTP response code and headers from the
  3433. // server.
  3434. googleapi.ServerResponse `json:"-"`
  3435. // ForceSendFields is a list of field names (e.g. "Etag") to
  3436. // unconditionally include in API requests. By default, fields with
  3437. // empty values are omitted from API requests. However, any non-pointer,
  3438. // non-interface field appearing in ForceSendFields will be sent to the
  3439. // server regardless of whether the field is empty or not. This may be
  3440. // used to include empty fields in Patch requests.
  3441. ForceSendFields []string `json:"-"`
  3442. // NullFields is a list of field names (e.g. "Etag") to include in API
  3443. // requests with the JSON null value. By default, fields with empty
  3444. // values are omitted from API requests. However, any field with an
  3445. // empty value appearing in NullFields will be sent to the server as
  3446. // null. It is an error if a field in this list has a non-empty value.
  3447. // This may be used to include null fields in Patch requests.
  3448. NullFields []string `json:"-"`
  3449. }
  3450. func (s *UserPhoto) MarshalJSON() ([]byte, error) {
  3451. type NoMethod UserPhoto
  3452. raw := NoMethod(*s)
  3453. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3454. }
  3455. // UserPosixAccount: JSON template for a POSIX account entry.
  3456. // Description of the field family: go/fbs-posix.
  3457. type UserPosixAccount struct {
  3458. // AccountId: A POSIX account field identifier.
  3459. AccountId string `json:"accountId,omitempty"`
  3460. // Gecos: The GECOS (user information) for this account.
  3461. Gecos string `json:"gecos,omitempty"`
  3462. // Gid: The default group ID.
  3463. Gid uint64 `json:"gid,omitempty,string"`
  3464. // HomeDirectory: The path to the home directory for this account.
  3465. HomeDirectory string `json:"homeDirectory,omitempty"`
  3466. // OperatingSystemType: The operating system type for this account.
  3467. OperatingSystemType string `json:"operatingSystemType,omitempty"`
  3468. // Primary: If this is user's primary account within the SystemId.
  3469. Primary bool `json:"primary,omitempty"`
  3470. // Shell: The path to the login shell for this account.
  3471. Shell string `json:"shell,omitempty"`
  3472. // SystemId: System identifier for which account Username or Uid apply
  3473. // to.
  3474. SystemId string `json:"systemId,omitempty"`
  3475. // Uid: The POSIX compliant user ID.
  3476. Uid uint64 `json:"uid,omitempty,string"`
  3477. // Username: The username of the account.
  3478. Username string `json:"username,omitempty"`
  3479. // ForceSendFields is a list of field names (e.g. "AccountId") to
  3480. // unconditionally include in API requests. By default, fields with
  3481. // empty values are omitted from API requests. However, any non-pointer,
  3482. // non-interface field appearing in ForceSendFields will be sent to the
  3483. // server regardless of whether the field is empty or not. This may be
  3484. // used to include empty fields in Patch requests.
  3485. ForceSendFields []string `json:"-"`
  3486. // NullFields is a list of field names (e.g. "AccountId") to include in
  3487. // API requests with the JSON null value. By default, fields with empty
  3488. // values are omitted from API requests. However, any field with an
  3489. // empty value appearing in NullFields will be sent to the server as
  3490. // null. It is an error if a field in this list has a non-empty value.
  3491. // This may be used to include null fields in Patch requests.
  3492. NullFields []string `json:"-"`
  3493. }
  3494. func (s *UserPosixAccount) MarshalJSON() ([]byte, error) {
  3495. type NoMethod UserPosixAccount
  3496. raw := NoMethod(*s)
  3497. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3498. }
  3499. // UserRelation: JSON template for a relation entry.
  3500. type UserRelation struct {
  3501. // CustomType: Custom Type.
  3502. CustomType string `json:"customType,omitempty"`
  3503. // Type: The relation of the user. Some of the possible values are
  3504. // mother, father, sister, brother, manager, assistant, partner.
  3505. Type string `json:"type,omitempty"`
  3506. // Value: The name of the relation.
  3507. Value string `json:"value,omitempty"`
  3508. // ForceSendFields is a list of field names (e.g. "CustomType") to
  3509. // unconditionally include in API requests. By default, fields with
  3510. // empty values are omitted from API requests. However, any non-pointer,
  3511. // non-interface field appearing in ForceSendFields will be sent to the
  3512. // server regardless of whether the field is empty or not. This may be
  3513. // used to include empty fields in Patch requests.
  3514. ForceSendFields []string `json:"-"`
  3515. // NullFields is a list of field names (e.g. "CustomType") to include in
  3516. // API requests with the JSON null value. By default, fields with empty
  3517. // values are omitted from API requests. However, any field with an
  3518. // empty value appearing in NullFields will be sent to the server as
  3519. // null. It is an error if a field in this list has a non-empty value.
  3520. // This may be used to include null fields in Patch requests.
  3521. NullFields []string `json:"-"`
  3522. }
  3523. func (s *UserRelation) MarshalJSON() ([]byte, error) {
  3524. type NoMethod UserRelation
  3525. raw := NoMethod(*s)
  3526. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3527. }
  3528. // UserSshPublicKey: JSON template for a POSIX account entry.
  3529. type UserSshPublicKey struct {
  3530. // ExpirationTimeUsec: An expiration time in microseconds since epoch.
  3531. ExpirationTimeUsec int64 `json:"expirationTimeUsec,omitempty,string"`
  3532. // Fingerprint: A SHA-256 fingerprint of the SSH public key. (Read-only)
  3533. Fingerprint string `json:"fingerprint,omitempty"`
  3534. // Key: An SSH public key.
  3535. Key string `json:"key,omitempty"`
  3536. // ForceSendFields is a list of field names (e.g. "ExpirationTimeUsec")
  3537. // to unconditionally include in API requests. By default, fields with
  3538. // empty values are omitted from API requests. However, any non-pointer,
  3539. // non-interface field appearing in ForceSendFields will be sent to the
  3540. // server regardless of whether the field is empty or not. This may be
  3541. // used to include empty fields in Patch requests.
  3542. ForceSendFields []string `json:"-"`
  3543. // NullFields is a list of field names (e.g. "ExpirationTimeUsec") to
  3544. // include in API requests with the JSON null value. By default, fields
  3545. // with empty values are omitted from API requests. However, any field
  3546. // with an empty value appearing in NullFields will be sent to the
  3547. // server as null. It is an error if a field in this list has a
  3548. // non-empty value. This may be used to include null fields in Patch
  3549. // requests.
  3550. NullFields []string `json:"-"`
  3551. }
  3552. func (s *UserSshPublicKey) MarshalJSON() ([]byte, error) {
  3553. type NoMethod UserSshPublicKey
  3554. raw := NoMethod(*s)
  3555. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3556. }
  3557. // UserUndelete: JSON request template to undelete a user in Directory
  3558. // API.
  3559. type UserUndelete struct {
  3560. // OrgUnitPath: OrgUnit of User
  3561. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  3562. // ForceSendFields is a list of field names (e.g. "OrgUnitPath") to
  3563. // unconditionally include in API requests. By default, fields with
  3564. // empty values are omitted from API requests. However, any non-pointer,
  3565. // non-interface field appearing in ForceSendFields will be sent to the
  3566. // server regardless of whether the field is empty or not. This may be
  3567. // used to include empty fields in Patch requests.
  3568. ForceSendFields []string `json:"-"`
  3569. // NullFields is a list of field names (e.g. "OrgUnitPath") to include
  3570. // in API requests with the JSON null value. By default, fields with
  3571. // empty values are omitted from API requests. However, any field with
  3572. // an empty value appearing in NullFields will be sent to the server as
  3573. // null. It is an error if a field in this list has a non-empty value.
  3574. // This may be used to include null fields in Patch requests.
  3575. NullFields []string `json:"-"`
  3576. }
  3577. func (s *UserUndelete) MarshalJSON() ([]byte, error) {
  3578. type NoMethod UserUndelete
  3579. raw := NoMethod(*s)
  3580. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3581. }
  3582. // UserWebsite: JSON template for a website entry.
  3583. type UserWebsite struct {
  3584. // CustomType: Custom Type.
  3585. CustomType string `json:"customType,omitempty"`
  3586. // Primary: If this is user's primary website or not.
  3587. Primary bool `json:"primary,omitempty"`
  3588. // Type: Each entry can have a type which indicates standard types of
  3589. // that entry. For example website could be of home, work, blog etc. In
  3590. // addition to the standard type, an entry can have a custom type and
  3591. // can give it any name. Such types should have the CUSTOM value as type
  3592. // and also have a customType value.
  3593. Type string `json:"type,omitempty"`
  3594. // Value: Website.
  3595. Value string `json:"value,omitempty"`
  3596. // ForceSendFields is a list of field names (e.g. "CustomType") to
  3597. // unconditionally include in API requests. By default, fields with
  3598. // empty values are omitted from API requests. However, any non-pointer,
  3599. // non-interface field appearing in ForceSendFields will be sent to the
  3600. // server regardless of whether the field is empty or not. This may be
  3601. // used to include empty fields in Patch requests.
  3602. ForceSendFields []string `json:"-"`
  3603. // NullFields is a list of field names (e.g. "CustomType") to include in
  3604. // API requests with the JSON null value. By default, fields with empty
  3605. // values are omitted from API requests. However, any field with an
  3606. // empty value appearing in NullFields will be sent to the server as
  3607. // null. It is an error if a field in this list has a non-empty value.
  3608. // This may be used to include null fields in Patch requests.
  3609. NullFields []string `json:"-"`
  3610. }
  3611. func (s *UserWebsite) MarshalJSON() ([]byte, error) {
  3612. type NoMethod UserWebsite
  3613. raw := NoMethod(*s)
  3614. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3615. }
  3616. // Users: JSON response template for List Users operation in Apps
  3617. // Directory API.
  3618. type Users struct {
  3619. // Etag: ETag of the resource.
  3620. Etag string `json:"etag,omitempty"`
  3621. // Kind: Kind of resource this is.
  3622. Kind string `json:"kind,omitempty"`
  3623. // NextPageToken: Token used to access next page of this result.
  3624. NextPageToken string `json:"nextPageToken,omitempty"`
  3625. // TriggerEvent: Event that triggered this response (only used in case
  3626. // of Push Response)
  3627. TriggerEvent string `json:"trigger_event,omitempty"`
  3628. // Users: List of user objects.
  3629. Users []*User `json:"users,omitempty"`
  3630. // ServerResponse contains the HTTP response code and headers from the
  3631. // server.
  3632. googleapi.ServerResponse `json:"-"`
  3633. // ForceSendFields is a list of field names (e.g. "Etag") to
  3634. // unconditionally include in API requests. By default, fields with
  3635. // empty values are omitted from API requests. However, any non-pointer,
  3636. // non-interface field appearing in ForceSendFields will be sent to the
  3637. // server regardless of whether the field is empty or not. This may be
  3638. // used to include empty fields in Patch requests.
  3639. ForceSendFields []string `json:"-"`
  3640. // NullFields is a list of field names (e.g. "Etag") to include in API
  3641. // requests with the JSON null value. By default, fields with empty
  3642. // values are omitted from API requests. However, any field with an
  3643. // empty value appearing in NullFields will be sent to the server as
  3644. // null. It is an error if a field in this list has a non-empty value.
  3645. // This may be used to include null fields in Patch requests.
  3646. NullFields []string `json:"-"`
  3647. }
  3648. func (s *Users) MarshalJSON() ([]byte, error) {
  3649. type NoMethod Users
  3650. raw := NoMethod(*s)
  3651. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3652. }
  3653. // VerificationCode: JSON template for verification codes in Directory
  3654. // API.
  3655. type VerificationCode struct {
  3656. // Etag: ETag of the resource.
  3657. Etag string `json:"etag,omitempty"`
  3658. // Kind: The type of the resource. This is always
  3659. // admin#directory#verificationCode.
  3660. Kind string `json:"kind,omitempty"`
  3661. // UserId: The obfuscated unique ID of the user.
  3662. UserId string `json:"userId,omitempty"`
  3663. // VerificationCode: A current verification code for the user.
  3664. // Invalidated or used verification codes are not returned as part of
  3665. // the result.
  3666. VerificationCode string `json:"verificationCode,omitempty"`
  3667. // ForceSendFields is a list of field names (e.g. "Etag") to
  3668. // unconditionally include in API requests. By default, fields with
  3669. // empty values are omitted from API requests. However, any non-pointer,
  3670. // non-interface field appearing in ForceSendFields will be sent to the
  3671. // server regardless of whether the field is empty or not. This may be
  3672. // used to include empty fields in Patch requests.
  3673. ForceSendFields []string `json:"-"`
  3674. // NullFields is a list of field names (e.g. "Etag") to include in API
  3675. // requests with the JSON null value. By default, fields with empty
  3676. // values are omitted from API requests. However, any field with an
  3677. // empty value appearing in NullFields will be sent to the server as
  3678. // null. It is an error if a field in this list has a non-empty value.
  3679. // This may be used to include null fields in Patch requests.
  3680. NullFields []string `json:"-"`
  3681. }
  3682. func (s *VerificationCode) MarshalJSON() ([]byte, error) {
  3683. type NoMethod VerificationCode
  3684. raw := NoMethod(*s)
  3685. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3686. }
  3687. // VerificationCodes: JSON response template for List verification codes
  3688. // operation in Directory API.
  3689. type VerificationCodes struct {
  3690. // Etag: ETag of the resource.
  3691. Etag string `json:"etag,omitempty"`
  3692. // Items: A list of verification code resources.
  3693. Items []*VerificationCode `json:"items,omitempty"`
  3694. // Kind: The type of the resource. This is always
  3695. // admin#directory#verificationCodesList.
  3696. Kind string `json:"kind,omitempty"`
  3697. // ServerResponse contains the HTTP response code and headers from the
  3698. // server.
  3699. googleapi.ServerResponse `json:"-"`
  3700. // ForceSendFields is a list of field names (e.g. "Etag") to
  3701. // unconditionally include in API requests. By default, fields with
  3702. // empty values are omitted from API requests. However, any non-pointer,
  3703. // non-interface field appearing in ForceSendFields will be sent to the
  3704. // server regardless of whether the field is empty or not. This may be
  3705. // used to include empty fields in Patch requests.
  3706. ForceSendFields []string `json:"-"`
  3707. // NullFields is a list of field names (e.g. "Etag") to include in API
  3708. // requests with the JSON null value. By default, fields with empty
  3709. // values are omitted from API requests. However, any field with an
  3710. // empty value appearing in NullFields will be sent to the server as
  3711. // null. It is an error if a field in this list has a non-empty value.
  3712. // This may be used to include null fields in Patch requests.
  3713. NullFields []string `json:"-"`
  3714. }
  3715. func (s *VerificationCodes) MarshalJSON() ([]byte, error) {
  3716. type NoMethod VerificationCodes
  3717. raw := NoMethod(*s)
  3718. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3719. }
  3720. // method id "directory.asps.delete":
  3721. type AspsDeleteCall struct {
  3722. s *Service
  3723. userKey string
  3724. codeId int64
  3725. urlParams_ gensupport.URLParams
  3726. ctx_ context.Context
  3727. header_ http.Header
  3728. }
  3729. // Delete: Delete an ASP issued by a user.
  3730. func (r *AspsService) Delete(userKey string, codeId int64) *AspsDeleteCall {
  3731. c := &AspsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3732. c.userKey = userKey
  3733. c.codeId = codeId
  3734. return c
  3735. }
  3736. // Fields allows partial responses to be retrieved. See
  3737. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3738. // for more information.
  3739. func (c *AspsDeleteCall) Fields(s ...googleapi.Field) *AspsDeleteCall {
  3740. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3741. return c
  3742. }
  3743. // Context sets the context to be used in this call's Do method. Any
  3744. // pending HTTP request will be aborted if the provided context is
  3745. // canceled.
  3746. func (c *AspsDeleteCall) Context(ctx context.Context) *AspsDeleteCall {
  3747. c.ctx_ = ctx
  3748. return c
  3749. }
  3750. // Header returns an http.Header that can be modified by the caller to
  3751. // add HTTP headers to the request.
  3752. func (c *AspsDeleteCall) Header() http.Header {
  3753. if c.header_ == nil {
  3754. c.header_ = make(http.Header)
  3755. }
  3756. return c.header_
  3757. }
  3758. func (c *AspsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3759. reqHeaders := make(http.Header)
  3760. for k, v := range c.header_ {
  3761. reqHeaders[k] = v
  3762. }
  3763. reqHeaders.Set("User-Agent", c.s.userAgent())
  3764. var body io.Reader = nil
  3765. c.urlParams_.Set("alt", alt)
  3766. c.urlParams_.Set("prettyPrint", "false")
  3767. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/asps/{codeId}")
  3768. urls += "?" + c.urlParams_.Encode()
  3769. req, err := http.NewRequest("DELETE", urls, body)
  3770. if err != nil {
  3771. return nil, err
  3772. }
  3773. req.Header = reqHeaders
  3774. googleapi.Expand(req.URL, map[string]string{
  3775. "userKey": c.userKey,
  3776. "codeId": strconv.FormatInt(c.codeId, 10),
  3777. })
  3778. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3779. }
  3780. // Do executes the "directory.asps.delete" call.
  3781. func (c *AspsDeleteCall) Do(opts ...googleapi.CallOption) error {
  3782. gensupport.SetOptions(c.urlParams_, opts...)
  3783. res, err := c.doRequest("json")
  3784. if err != nil {
  3785. return err
  3786. }
  3787. defer googleapi.CloseBody(res)
  3788. if err := googleapi.CheckResponse(res); err != nil {
  3789. return err
  3790. }
  3791. return nil
  3792. // {
  3793. // "description": "Delete an ASP issued by a user.",
  3794. // "httpMethod": "DELETE",
  3795. // "id": "directory.asps.delete",
  3796. // "parameterOrder": [
  3797. // "userKey",
  3798. // "codeId"
  3799. // ],
  3800. // "parameters": {
  3801. // "codeId": {
  3802. // "description": "The unique ID of the ASP to be deleted.",
  3803. // "format": "int32",
  3804. // "location": "path",
  3805. // "required": true,
  3806. // "type": "integer"
  3807. // },
  3808. // "userKey": {
  3809. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  3810. // "location": "path",
  3811. // "required": true,
  3812. // "type": "string"
  3813. // }
  3814. // },
  3815. // "path": "users/{userKey}/asps/{codeId}",
  3816. // "scopes": [
  3817. // "https://www.googleapis.com/auth/admin.directory.user.security"
  3818. // ]
  3819. // }
  3820. }
  3821. // method id "directory.asps.get":
  3822. type AspsGetCall struct {
  3823. s *Service
  3824. userKey string
  3825. codeId int64
  3826. urlParams_ gensupport.URLParams
  3827. ifNoneMatch_ string
  3828. ctx_ context.Context
  3829. header_ http.Header
  3830. }
  3831. // Get: Get information about an ASP issued by a user.
  3832. func (r *AspsService) Get(userKey string, codeId int64) *AspsGetCall {
  3833. c := &AspsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3834. c.userKey = userKey
  3835. c.codeId = codeId
  3836. return c
  3837. }
  3838. // Fields allows partial responses to be retrieved. See
  3839. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3840. // for more information.
  3841. func (c *AspsGetCall) Fields(s ...googleapi.Field) *AspsGetCall {
  3842. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3843. return c
  3844. }
  3845. // IfNoneMatch sets the optional parameter which makes the operation
  3846. // fail if the object's ETag matches the given value. This is useful for
  3847. // getting updates only after the object has changed since the last
  3848. // request. Use googleapi.IsNotModified to check whether the response
  3849. // error from Do is the result of In-None-Match.
  3850. func (c *AspsGetCall) IfNoneMatch(entityTag string) *AspsGetCall {
  3851. c.ifNoneMatch_ = entityTag
  3852. return c
  3853. }
  3854. // Context sets the context to be used in this call's Do method. Any
  3855. // pending HTTP request will be aborted if the provided context is
  3856. // canceled.
  3857. func (c *AspsGetCall) Context(ctx context.Context) *AspsGetCall {
  3858. c.ctx_ = ctx
  3859. return c
  3860. }
  3861. // Header returns an http.Header that can be modified by the caller to
  3862. // add HTTP headers to the request.
  3863. func (c *AspsGetCall) Header() http.Header {
  3864. if c.header_ == nil {
  3865. c.header_ = make(http.Header)
  3866. }
  3867. return c.header_
  3868. }
  3869. func (c *AspsGetCall) doRequest(alt string) (*http.Response, error) {
  3870. reqHeaders := make(http.Header)
  3871. for k, v := range c.header_ {
  3872. reqHeaders[k] = v
  3873. }
  3874. reqHeaders.Set("User-Agent", c.s.userAgent())
  3875. if c.ifNoneMatch_ != "" {
  3876. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3877. }
  3878. var body io.Reader = nil
  3879. c.urlParams_.Set("alt", alt)
  3880. c.urlParams_.Set("prettyPrint", "false")
  3881. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/asps/{codeId}")
  3882. urls += "?" + c.urlParams_.Encode()
  3883. req, err := http.NewRequest("GET", urls, body)
  3884. if err != nil {
  3885. return nil, err
  3886. }
  3887. req.Header = reqHeaders
  3888. googleapi.Expand(req.URL, map[string]string{
  3889. "userKey": c.userKey,
  3890. "codeId": strconv.FormatInt(c.codeId, 10),
  3891. })
  3892. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3893. }
  3894. // Do executes the "directory.asps.get" call.
  3895. // Exactly one of *Asp or error will be non-nil. Any non-2xx status code
  3896. // is an error. Response headers are in either
  3897. // *Asp.ServerResponse.Header or (if a response was returned at all) in
  3898. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3899. // whether the returned error was because http.StatusNotModified was
  3900. // returned.
  3901. func (c *AspsGetCall) Do(opts ...googleapi.CallOption) (*Asp, error) {
  3902. gensupport.SetOptions(c.urlParams_, opts...)
  3903. res, err := c.doRequest("json")
  3904. if res != nil && res.StatusCode == http.StatusNotModified {
  3905. if res.Body != nil {
  3906. res.Body.Close()
  3907. }
  3908. return nil, &googleapi.Error{
  3909. Code: res.StatusCode,
  3910. Header: res.Header,
  3911. }
  3912. }
  3913. if err != nil {
  3914. return nil, err
  3915. }
  3916. defer googleapi.CloseBody(res)
  3917. if err := googleapi.CheckResponse(res); err != nil {
  3918. return nil, err
  3919. }
  3920. ret := &Asp{
  3921. ServerResponse: googleapi.ServerResponse{
  3922. Header: res.Header,
  3923. HTTPStatusCode: res.StatusCode,
  3924. },
  3925. }
  3926. target := &ret
  3927. if err := gensupport.DecodeResponse(target, res); err != nil {
  3928. return nil, err
  3929. }
  3930. return ret, nil
  3931. // {
  3932. // "description": "Get information about an ASP issued by a user.",
  3933. // "httpMethod": "GET",
  3934. // "id": "directory.asps.get",
  3935. // "parameterOrder": [
  3936. // "userKey",
  3937. // "codeId"
  3938. // ],
  3939. // "parameters": {
  3940. // "codeId": {
  3941. // "description": "The unique ID of the ASP.",
  3942. // "format": "int32",
  3943. // "location": "path",
  3944. // "required": true,
  3945. // "type": "integer"
  3946. // },
  3947. // "userKey": {
  3948. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  3949. // "location": "path",
  3950. // "required": true,
  3951. // "type": "string"
  3952. // }
  3953. // },
  3954. // "path": "users/{userKey}/asps/{codeId}",
  3955. // "response": {
  3956. // "$ref": "Asp"
  3957. // },
  3958. // "scopes": [
  3959. // "https://www.googleapis.com/auth/admin.directory.user.security"
  3960. // ]
  3961. // }
  3962. }
  3963. // method id "directory.asps.list":
  3964. type AspsListCall struct {
  3965. s *Service
  3966. userKey string
  3967. urlParams_ gensupport.URLParams
  3968. ifNoneMatch_ string
  3969. ctx_ context.Context
  3970. header_ http.Header
  3971. }
  3972. // List: List the ASPs issued by a user.
  3973. func (r *AspsService) List(userKey string) *AspsListCall {
  3974. c := &AspsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3975. c.userKey = userKey
  3976. return c
  3977. }
  3978. // Fields allows partial responses to be retrieved. See
  3979. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3980. // for more information.
  3981. func (c *AspsListCall) Fields(s ...googleapi.Field) *AspsListCall {
  3982. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3983. return c
  3984. }
  3985. // IfNoneMatch sets the optional parameter which makes the operation
  3986. // fail if the object's ETag matches the given value. This is useful for
  3987. // getting updates only after the object has changed since the last
  3988. // request. Use googleapi.IsNotModified to check whether the response
  3989. // error from Do is the result of In-None-Match.
  3990. func (c *AspsListCall) IfNoneMatch(entityTag string) *AspsListCall {
  3991. c.ifNoneMatch_ = entityTag
  3992. return c
  3993. }
  3994. // Context sets the context to be used in this call's Do method. Any
  3995. // pending HTTP request will be aborted if the provided context is
  3996. // canceled.
  3997. func (c *AspsListCall) Context(ctx context.Context) *AspsListCall {
  3998. c.ctx_ = ctx
  3999. return c
  4000. }
  4001. // Header returns an http.Header that can be modified by the caller to
  4002. // add HTTP headers to the request.
  4003. func (c *AspsListCall) Header() http.Header {
  4004. if c.header_ == nil {
  4005. c.header_ = make(http.Header)
  4006. }
  4007. return c.header_
  4008. }
  4009. func (c *AspsListCall) doRequest(alt string) (*http.Response, error) {
  4010. reqHeaders := make(http.Header)
  4011. for k, v := range c.header_ {
  4012. reqHeaders[k] = v
  4013. }
  4014. reqHeaders.Set("User-Agent", c.s.userAgent())
  4015. if c.ifNoneMatch_ != "" {
  4016. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4017. }
  4018. var body io.Reader = nil
  4019. c.urlParams_.Set("alt", alt)
  4020. c.urlParams_.Set("prettyPrint", "false")
  4021. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/asps")
  4022. urls += "?" + c.urlParams_.Encode()
  4023. req, err := http.NewRequest("GET", urls, body)
  4024. if err != nil {
  4025. return nil, err
  4026. }
  4027. req.Header = reqHeaders
  4028. googleapi.Expand(req.URL, map[string]string{
  4029. "userKey": c.userKey,
  4030. })
  4031. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4032. }
  4033. // Do executes the "directory.asps.list" call.
  4034. // Exactly one of *Asps or error will be non-nil. Any non-2xx status
  4035. // code is an error. Response headers are in either
  4036. // *Asps.ServerResponse.Header or (if a response was returned at all) in
  4037. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4038. // whether the returned error was because http.StatusNotModified was
  4039. // returned.
  4040. func (c *AspsListCall) Do(opts ...googleapi.CallOption) (*Asps, error) {
  4041. gensupport.SetOptions(c.urlParams_, opts...)
  4042. res, err := c.doRequest("json")
  4043. if res != nil && res.StatusCode == http.StatusNotModified {
  4044. if res.Body != nil {
  4045. res.Body.Close()
  4046. }
  4047. return nil, &googleapi.Error{
  4048. Code: res.StatusCode,
  4049. Header: res.Header,
  4050. }
  4051. }
  4052. if err != nil {
  4053. return nil, err
  4054. }
  4055. defer googleapi.CloseBody(res)
  4056. if err := googleapi.CheckResponse(res); err != nil {
  4057. return nil, err
  4058. }
  4059. ret := &Asps{
  4060. ServerResponse: googleapi.ServerResponse{
  4061. Header: res.Header,
  4062. HTTPStatusCode: res.StatusCode,
  4063. },
  4064. }
  4065. target := &ret
  4066. if err := gensupport.DecodeResponse(target, res); err != nil {
  4067. return nil, err
  4068. }
  4069. return ret, nil
  4070. // {
  4071. // "description": "List the ASPs issued by a user.",
  4072. // "httpMethod": "GET",
  4073. // "id": "directory.asps.list",
  4074. // "parameterOrder": [
  4075. // "userKey"
  4076. // ],
  4077. // "parameters": {
  4078. // "userKey": {
  4079. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  4080. // "location": "path",
  4081. // "required": true,
  4082. // "type": "string"
  4083. // }
  4084. // },
  4085. // "path": "users/{userKey}/asps",
  4086. // "response": {
  4087. // "$ref": "Asps"
  4088. // },
  4089. // "scopes": [
  4090. // "https://www.googleapis.com/auth/admin.directory.user.security"
  4091. // ]
  4092. // }
  4093. }
  4094. // method id "admin.channels.stop":
  4095. type ChannelsStopCall struct {
  4096. s *Service
  4097. channel *Channel
  4098. urlParams_ gensupport.URLParams
  4099. ctx_ context.Context
  4100. header_ http.Header
  4101. }
  4102. // Stop: Stop watching resources through this channel
  4103. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  4104. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4105. c.channel = channel
  4106. return c
  4107. }
  4108. // Fields allows partial responses to be retrieved. See
  4109. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4110. // for more information.
  4111. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  4112. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4113. return c
  4114. }
  4115. // Context sets the context to be used in this call's Do method. Any
  4116. // pending HTTP request will be aborted if the provided context is
  4117. // canceled.
  4118. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  4119. c.ctx_ = ctx
  4120. return c
  4121. }
  4122. // Header returns an http.Header that can be modified by the caller to
  4123. // add HTTP headers to the request.
  4124. func (c *ChannelsStopCall) Header() http.Header {
  4125. if c.header_ == nil {
  4126. c.header_ = make(http.Header)
  4127. }
  4128. return c.header_
  4129. }
  4130. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  4131. reqHeaders := make(http.Header)
  4132. for k, v := range c.header_ {
  4133. reqHeaders[k] = v
  4134. }
  4135. reqHeaders.Set("User-Agent", c.s.userAgent())
  4136. var body io.Reader = nil
  4137. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  4138. if err != nil {
  4139. return nil, err
  4140. }
  4141. reqHeaders.Set("Content-Type", "application/json")
  4142. c.urlParams_.Set("alt", alt)
  4143. c.urlParams_.Set("prettyPrint", "false")
  4144. urls := googleapi.ResolveRelative(c.s.BasePath, "/admin/directory_v1/channels/stop")
  4145. urls += "?" + c.urlParams_.Encode()
  4146. req, err := http.NewRequest("POST", urls, body)
  4147. if err != nil {
  4148. return nil, err
  4149. }
  4150. req.Header = reqHeaders
  4151. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4152. }
  4153. // Do executes the "admin.channels.stop" call.
  4154. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  4155. gensupport.SetOptions(c.urlParams_, opts...)
  4156. res, err := c.doRequest("json")
  4157. if err != nil {
  4158. return err
  4159. }
  4160. defer googleapi.CloseBody(res)
  4161. if err := googleapi.CheckResponse(res); err != nil {
  4162. return err
  4163. }
  4164. return nil
  4165. // {
  4166. // "description": "Stop watching resources through this channel",
  4167. // "httpMethod": "POST",
  4168. // "id": "admin.channels.stop",
  4169. // "path": "/admin/directory_v1/channels/stop",
  4170. // "request": {
  4171. // "$ref": "Channel",
  4172. // "parameterName": "resource"
  4173. // },
  4174. // "scopes": [
  4175. // "https://www.googleapis.com/auth/admin.directory.user",
  4176. // "https://www.googleapis.com/auth/admin.directory.user.alias",
  4177. // "https://www.googleapis.com/auth/admin.directory.user.alias.readonly",
  4178. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  4179. // ]
  4180. // }
  4181. }
  4182. // method id "directory.chromeosdevices.action":
  4183. type ChromeosdevicesActionCall struct {
  4184. s *Service
  4185. customerId string
  4186. resourceId string
  4187. chromeosdeviceaction *ChromeOsDeviceAction
  4188. urlParams_ gensupport.URLParams
  4189. ctx_ context.Context
  4190. header_ http.Header
  4191. }
  4192. // Action: Take action on Chrome OS Device
  4193. func (r *ChromeosdevicesService) Action(customerId string, resourceId string, chromeosdeviceaction *ChromeOsDeviceAction) *ChromeosdevicesActionCall {
  4194. c := &ChromeosdevicesActionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4195. c.customerId = customerId
  4196. c.resourceId = resourceId
  4197. c.chromeosdeviceaction = chromeosdeviceaction
  4198. return c
  4199. }
  4200. // Fields allows partial responses to be retrieved. See
  4201. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4202. // for more information.
  4203. func (c *ChromeosdevicesActionCall) Fields(s ...googleapi.Field) *ChromeosdevicesActionCall {
  4204. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4205. return c
  4206. }
  4207. // Context sets the context to be used in this call's Do method. Any
  4208. // pending HTTP request will be aborted if the provided context is
  4209. // canceled.
  4210. func (c *ChromeosdevicesActionCall) Context(ctx context.Context) *ChromeosdevicesActionCall {
  4211. c.ctx_ = ctx
  4212. return c
  4213. }
  4214. // Header returns an http.Header that can be modified by the caller to
  4215. // add HTTP headers to the request.
  4216. func (c *ChromeosdevicesActionCall) Header() http.Header {
  4217. if c.header_ == nil {
  4218. c.header_ = make(http.Header)
  4219. }
  4220. return c.header_
  4221. }
  4222. func (c *ChromeosdevicesActionCall) doRequest(alt string) (*http.Response, error) {
  4223. reqHeaders := make(http.Header)
  4224. for k, v := range c.header_ {
  4225. reqHeaders[k] = v
  4226. }
  4227. reqHeaders.Set("User-Agent", c.s.userAgent())
  4228. var body io.Reader = nil
  4229. body, err := googleapi.WithoutDataWrapper.JSONReader(c.chromeosdeviceaction)
  4230. if err != nil {
  4231. return nil, err
  4232. }
  4233. reqHeaders.Set("Content-Type", "application/json")
  4234. c.urlParams_.Set("alt", alt)
  4235. c.urlParams_.Set("prettyPrint", "false")
  4236. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{resourceId}/action")
  4237. urls += "?" + c.urlParams_.Encode()
  4238. req, err := http.NewRequest("POST", urls, body)
  4239. if err != nil {
  4240. return nil, err
  4241. }
  4242. req.Header = reqHeaders
  4243. googleapi.Expand(req.URL, map[string]string{
  4244. "customerId": c.customerId,
  4245. "resourceId": c.resourceId,
  4246. })
  4247. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4248. }
  4249. // Do executes the "directory.chromeosdevices.action" call.
  4250. func (c *ChromeosdevicesActionCall) Do(opts ...googleapi.CallOption) error {
  4251. gensupport.SetOptions(c.urlParams_, opts...)
  4252. res, err := c.doRequest("json")
  4253. if err != nil {
  4254. return err
  4255. }
  4256. defer googleapi.CloseBody(res)
  4257. if err := googleapi.CheckResponse(res); err != nil {
  4258. return err
  4259. }
  4260. return nil
  4261. // {
  4262. // "description": "Take action on Chrome OS Device",
  4263. // "httpMethod": "POST",
  4264. // "id": "directory.chromeosdevices.action",
  4265. // "parameterOrder": [
  4266. // "customerId",
  4267. // "resourceId"
  4268. // ],
  4269. // "parameters": {
  4270. // "customerId": {
  4271. // "description": "Immutable ID of the G Suite account",
  4272. // "location": "path",
  4273. // "required": true,
  4274. // "type": "string"
  4275. // },
  4276. // "resourceId": {
  4277. // "description": "Immutable ID of Chrome OS Device",
  4278. // "location": "path",
  4279. // "required": true,
  4280. // "type": "string"
  4281. // }
  4282. // },
  4283. // "path": "customer/{customerId}/devices/chromeos/{resourceId}/action",
  4284. // "request": {
  4285. // "$ref": "ChromeOsDeviceAction"
  4286. // },
  4287. // "scopes": [
  4288. // "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  4289. // ]
  4290. // }
  4291. }
  4292. // method id "directory.chromeosdevices.get":
  4293. type ChromeosdevicesGetCall struct {
  4294. s *Service
  4295. customerId string
  4296. deviceId string
  4297. urlParams_ gensupport.URLParams
  4298. ifNoneMatch_ string
  4299. ctx_ context.Context
  4300. header_ http.Header
  4301. }
  4302. // Get: Retrieve Chrome OS Device
  4303. func (r *ChromeosdevicesService) Get(customerId string, deviceId string) *ChromeosdevicesGetCall {
  4304. c := &ChromeosdevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4305. c.customerId = customerId
  4306. c.deviceId = deviceId
  4307. return c
  4308. }
  4309. // Projection sets the optional parameter "projection": Restrict
  4310. // information returned to a set of selected fields.
  4311. //
  4312. // Possible values:
  4313. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  4314. // serialNumber, status, and user)
  4315. // "FULL" - Includes all metadata fields
  4316. func (c *ChromeosdevicesGetCall) Projection(projection string) *ChromeosdevicesGetCall {
  4317. c.urlParams_.Set("projection", projection)
  4318. return c
  4319. }
  4320. // Fields allows partial responses to be retrieved. See
  4321. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4322. // for more information.
  4323. func (c *ChromeosdevicesGetCall) Fields(s ...googleapi.Field) *ChromeosdevicesGetCall {
  4324. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4325. return c
  4326. }
  4327. // IfNoneMatch sets the optional parameter which makes the operation
  4328. // fail if the object's ETag matches the given value. This is useful for
  4329. // getting updates only after the object has changed since the last
  4330. // request. Use googleapi.IsNotModified to check whether the response
  4331. // error from Do is the result of In-None-Match.
  4332. func (c *ChromeosdevicesGetCall) IfNoneMatch(entityTag string) *ChromeosdevicesGetCall {
  4333. c.ifNoneMatch_ = entityTag
  4334. return c
  4335. }
  4336. // Context sets the context to be used in this call's Do method. Any
  4337. // pending HTTP request will be aborted if the provided context is
  4338. // canceled.
  4339. func (c *ChromeosdevicesGetCall) Context(ctx context.Context) *ChromeosdevicesGetCall {
  4340. c.ctx_ = ctx
  4341. return c
  4342. }
  4343. // Header returns an http.Header that can be modified by the caller to
  4344. // add HTTP headers to the request.
  4345. func (c *ChromeosdevicesGetCall) Header() http.Header {
  4346. if c.header_ == nil {
  4347. c.header_ = make(http.Header)
  4348. }
  4349. return c.header_
  4350. }
  4351. func (c *ChromeosdevicesGetCall) doRequest(alt string) (*http.Response, error) {
  4352. reqHeaders := make(http.Header)
  4353. for k, v := range c.header_ {
  4354. reqHeaders[k] = v
  4355. }
  4356. reqHeaders.Set("User-Agent", c.s.userAgent())
  4357. if c.ifNoneMatch_ != "" {
  4358. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4359. }
  4360. var body io.Reader = nil
  4361. c.urlParams_.Set("alt", alt)
  4362. c.urlParams_.Set("prettyPrint", "false")
  4363. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{deviceId}")
  4364. urls += "?" + c.urlParams_.Encode()
  4365. req, err := http.NewRequest("GET", urls, body)
  4366. if err != nil {
  4367. return nil, err
  4368. }
  4369. req.Header = reqHeaders
  4370. googleapi.Expand(req.URL, map[string]string{
  4371. "customerId": c.customerId,
  4372. "deviceId": c.deviceId,
  4373. })
  4374. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4375. }
  4376. // Do executes the "directory.chromeosdevices.get" call.
  4377. // Exactly one of *ChromeOsDevice or error will be non-nil. Any non-2xx
  4378. // status code is an error. Response headers are in either
  4379. // *ChromeOsDevice.ServerResponse.Header or (if a response was returned
  4380. // at all) in error.(*googleapi.Error).Header. Use
  4381. // googleapi.IsNotModified to check whether the returned error was
  4382. // because http.StatusNotModified was returned.
  4383. func (c *ChromeosdevicesGetCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevice, error) {
  4384. gensupport.SetOptions(c.urlParams_, opts...)
  4385. res, err := c.doRequest("json")
  4386. if res != nil && res.StatusCode == http.StatusNotModified {
  4387. if res.Body != nil {
  4388. res.Body.Close()
  4389. }
  4390. return nil, &googleapi.Error{
  4391. Code: res.StatusCode,
  4392. Header: res.Header,
  4393. }
  4394. }
  4395. if err != nil {
  4396. return nil, err
  4397. }
  4398. defer googleapi.CloseBody(res)
  4399. if err := googleapi.CheckResponse(res); err != nil {
  4400. return nil, err
  4401. }
  4402. ret := &ChromeOsDevice{
  4403. ServerResponse: googleapi.ServerResponse{
  4404. Header: res.Header,
  4405. HTTPStatusCode: res.StatusCode,
  4406. },
  4407. }
  4408. target := &ret
  4409. if err := gensupport.DecodeResponse(target, res); err != nil {
  4410. return nil, err
  4411. }
  4412. return ret, nil
  4413. // {
  4414. // "description": "Retrieve Chrome OS Device",
  4415. // "httpMethod": "GET",
  4416. // "id": "directory.chromeosdevices.get",
  4417. // "parameterOrder": [
  4418. // "customerId",
  4419. // "deviceId"
  4420. // ],
  4421. // "parameters": {
  4422. // "customerId": {
  4423. // "description": "Immutable ID of the G Suite account",
  4424. // "location": "path",
  4425. // "required": true,
  4426. // "type": "string"
  4427. // },
  4428. // "deviceId": {
  4429. // "description": "Immutable ID of Chrome OS Device",
  4430. // "location": "path",
  4431. // "required": true,
  4432. // "type": "string"
  4433. // },
  4434. // "projection": {
  4435. // "description": "Restrict information returned to a set of selected fields.",
  4436. // "enum": [
  4437. // "BASIC",
  4438. // "FULL"
  4439. // ],
  4440. // "enumDescriptions": [
  4441. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  4442. // "Includes all metadata fields"
  4443. // ],
  4444. // "location": "query",
  4445. // "type": "string"
  4446. // }
  4447. // },
  4448. // "path": "customer/{customerId}/devices/chromeos/{deviceId}",
  4449. // "response": {
  4450. // "$ref": "ChromeOsDevice"
  4451. // },
  4452. // "scopes": [
  4453. // "https://www.googleapis.com/auth/admin.directory.device.chromeos",
  4454. // "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly"
  4455. // ]
  4456. // }
  4457. }
  4458. // method id "directory.chromeosdevices.list":
  4459. type ChromeosdevicesListCall struct {
  4460. s *Service
  4461. customerId string
  4462. urlParams_ gensupport.URLParams
  4463. ifNoneMatch_ string
  4464. ctx_ context.Context
  4465. header_ http.Header
  4466. }
  4467. // List: Retrieve all Chrome OS Devices of a customer (paginated)
  4468. func (r *ChromeosdevicesService) List(customerId string) *ChromeosdevicesListCall {
  4469. c := &ChromeosdevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4470. c.customerId = customerId
  4471. return c
  4472. }
  4473. // MaxResults sets the optional parameter "maxResults": Maximum number
  4474. // of results to return. Default is 100
  4475. func (c *ChromeosdevicesListCall) MaxResults(maxResults int64) *ChromeosdevicesListCall {
  4476. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4477. return c
  4478. }
  4479. // OrderBy sets the optional parameter "orderBy": Column to use for
  4480. // sorting results
  4481. //
  4482. // Possible values:
  4483. // "annotatedLocation" - Chromebook location as annotated by the
  4484. // administrator.
  4485. // "annotatedUser" - Chromebook user as annotated by administrator.
  4486. // "lastSync" - Chromebook last sync.
  4487. // "notes" - Chromebook notes as annotated by the administrator.
  4488. // "serialNumber" - Chromebook Serial Number.
  4489. // "status" - Chromebook status.
  4490. // "supportEndDate" - Chromebook support end date.
  4491. func (c *ChromeosdevicesListCall) OrderBy(orderBy string) *ChromeosdevicesListCall {
  4492. c.urlParams_.Set("orderBy", orderBy)
  4493. return c
  4494. }
  4495. // OrgUnitPath sets the optional parameter "orgUnitPath": Full path of
  4496. // the organizational unit or its ID
  4497. func (c *ChromeosdevicesListCall) OrgUnitPath(orgUnitPath string) *ChromeosdevicesListCall {
  4498. c.urlParams_.Set("orgUnitPath", orgUnitPath)
  4499. return c
  4500. }
  4501. // PageToken sets the optional parameter "pageToken": Token to specify
  4502. // next page in the list
  4503. func (c *ChromeosdevicesListCall) PageToken(pageToken string) *ChromeosdevicesListCall {
  4504. c.urlParams_.Set("pageToken", pageToken)
  4505. return c
  4506. }
  4507. // Projection sets the optional parameter "projection": Restrict
  4508. // information returned to a set of selected fields.
  4509. //
  4510. // Possible values:
  4511. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  4512. // serialNumber, status, and user)
  4513. // "FULL" - Includes all metadata fields
  4514. func (c *ChromeosdevicesListCall) Projection(projection string) *ChromeosdevicesListCall {
  4515. c.urlParams_.Set("projection", projection)
  4516. return c
  4517. }
  4518. // Query sets the optional parameter "query": Search string in the
  4519. // format given at
  4520. // http://support.google.com/chromeos/a/bin/answer.py?answer=1698333
  4521. func (c *ChromeosdevicesListCall) Query(query string) *ChromeosdevicesListCall {
  4522. c.urlParams_.Set("query", query)
  4523. return c
  4524. }
  4525. // SortOrder sets the optional parameter "sortOrder": Whether to return
  4526. // results in ascending or descending order. Only of use when orderBy is
  4527. // also used
  4528. //
  4529. // Possible values:
  4530. // "ASCENDING" - Ascending order.
  4531. // "DESCENDING" - Descending order.
  4532. func (c *ChromeosdevicesListCall) SortOrder(sortOrder string) *ChromeosdevicesListCall {
  4533. c.urlParams_.Set("sortOrder", sortOrder)
  4534. return c
  4535. }
  4536. // Fields allows partial responses to be retrieved. See
  4537. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4538. // for more information.
  4539. func (c *ChromeosdevicesListCall) Fields(s ...googleapi.Field) *ChromeosdevicesListCall {
  4540. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4541. return c
  4542. }
  4543. // IfNoneMatch sets the optional parameter which makes the operation
  4544. // fail if the object's ETag matches the given value. This is useful for
  4545. // getting updates only after the object has changed since the last
  4546. // request. Use googleapi.IsNotModified to check whether the response
  4547. // error from Do is the result of In-None-Match.
  4548. func (c *ChromeosdevicesListCall) IfNoneMatch(entityTag string) *ChromeosdevicesListCall {
  4549. c.ifNoneMatch_ = entityTag
  4550. return c
  4551. }
  4552. // Context sets the context to be used in this call's Do method. Any
  4553. // pending HTTP request will be aborted if the provided context is
  4554. // canceled.
  4555. func (c *ChromeosdevicesListCall) Context(ctx context.Context) *ChromeosdevicesListCall {
  4556. c.ctx_ = ctx
  4557. return c
  4558. }
  4559. // Header returns an http.Header that can be modified by the caller to
  4560. // add HTTP headers to the request.
  4561. func (c *ChromeosdevicesListCall) Header() http.Header {
  4562. if c.header_ == nil {
  4563. c.header_ = make(http.Header)
  4564. }
  4565. return c.header_
  4566. }
  4567. func (c *ChromeosdevicesListCall) doRequest(alt string) (*http.Response, error) {
  4568. reqHeaders := make(http.Header)
  4569. for k, v := range c.header_ {
  4570. reqHeaders[k] = v
  4571. }
  4572. reqHeaders.Set("User-Agent", c.s.userAgent())
  4573. if c.ifNoneMatch_ != "" {
  4574. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4575. }
  4576. var body io.Reader = nil
  4577. c.urlParams_.Set("alt", alt)
  4578. c.urlParams_.Set("prettyPrint", "false")
  4579. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos")
  4580. urls += "?" + c.urlParams_.Encode()
  4581. req, err := http.NewRequest("GET", urls, body)
  4582. if err != nil {
  4583. return nil, err
  4584. }
  4585. req.Header = reqHeaders
  4586. googleapi.Expand(req.URL, map[string]string{
  4587. "customerId": c.customerId,
  4588. })
  4589. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4590. }
  4591. // Do executes the "directory.chromeosdevices.list" call.
  4592. // Exactly one of *ChromeOsDevices or error will be non-nil. Any non-2xx
  4593. // status code is an error. Response headers are in either
  4594. // *ChromeOsDevices.ServerResponse.Header or (if a response was returned
  4595. // at all) in error.(*googleapi.Error).Header. Use
  4596. // googleapi.IsNotModified to check whether the returned error was
  4597. // because http.StatusNotModified was returned.
  4598. func (c *ChromeosdevicesListCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevices, error) {
  4599. gensupport.SetOptions(c.urlParams_, opts...)
  4600. res, err := c.doRequest("json")
  4601. if res != nil && res.StatusCode == http.StatusNotModified {
  4602. if res.Body != nil {
  4603. res.Body.Close()
  4604. }
  4605. return nil, &googleapi.Error{
  4606. Code: res.StatusCode,
  4607. Header: res.Header,
  4608. }
  4609. }
  4610. if err != nil {
  4611. return nil, err
  4612. }
  4613. defer googleapi.CloseBody(res)
  4614. if err := googleapi.CheckResponse(res); err != nil {
  4615. return nil, err
  4616. }
  4617. ret := &ChromeOsDevices{
  4618. ServerResponse: googleapi.ServerResponse{
  4619. Header: res.Header,
  4620. HTTPStatusCode: res.StatusCode,
  4621. },
  4622. }
  4623. target := &ret
  4624. if err := gensupport.DecodeResponse(target, res); err != nil {
  4625. return nil, err
  4626. }
  4627. return ret, nil
  4628. // {
  4629. // "description": "Retrieve all Chrome OS Devices of a customer (paginated)",
  4630. // "httpMethod": "GET",
  4631. // "id": "directory.chromeosdevices.list",
  4632. // "parameterOrder": [
  4633. // "customerId"
  4634. // ],
  4635. // "parameters": {
  4636. // "customerId": {
  4637. // "description": "Immutable ID of the G Suite account",
  4638. // "location": "path",
  4639. // "required": true,
  4640. // "type": "string"
  4641. // },
  4642. // "maxResults": {
  4643. // "description": "Maximum number of results to return. Default is 100",
  4644. // "format": "int32",
  4645. // "location": "query",
  4646. // "minimum": "1",
  4647. // "type": "integer"
  4648. // },
  4649. // "orderBy": {
  4650. // "description": "Column to use for sorting results",
  4651. // "enum": [
  4652. // "annotatedLocation",
  4653. // "annotatedUser",
  4654. // "lastSync",
  4655. // "notes",
  4656. // "serialNumber",
  4657. // "status",
  4658. // "supportEndDate"
  4659. // ],
  4660. // "enumDescriptions": [
  4661. // "Chromebook location as annotated by the administrator.",
  4662. // "Chromebook user as annotated by administrator.",
  4663. // "Chromebook last sync.",
  4664. // "Chromebook notes as annotated by the administrator.",
  4665. // "Chromebook Serial Number.",
  4666. // "Chromebook status.",
  4667. // "Chromebook support end date."
  4668. // ],
  4669. // "location": "query",
  4670. // "type": "string"
  4671. // },
  4672. // "orgUnitPath": {
  4673. // "description": "Full path of the organizational unit or its ID",
  4674. // "location": "query",
  4675. // "type": "string"
  4676. // },
  4677. // "pageToken": {
  4678. // "description": "Token to specify next page in the list",
  4679. // "location": "query",
  4680. // "type": "string"
  4681. // },
  4682. // "projection": {
  4683. // "description": "Restrict information returned to a set of selected fields.",
  4684. // "enum": [
  4685. // "BASIC",
  4686. // "FULL"
  4687. // ],
  4688. // "enumDescriptions": [
  4689. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  4690. // "Includes all metadata fields"
  4691. // ],
  4692. // "location": "query",
  4693. // "type": "string"
  4694. // },
  4695. // "query": {
  4696. // "description": "Search string in the format given at http://support.google.com/chromeos/a/bin/answer.py?answer=1698333",
  4697. // "location": "query",
  4698. // "type": "string"
  4699. // },
  4700. // "sortOrder": {
  4701. // "description": "Whether to return results in ascending or descending order. Only of use when orderBy is also used",
  4702. // "enum": [
  4703. // "ASCENDING",
  4704. // "DESCENDING"
  4705. // ],
  4706. // "enumDescriptions": [
  4707. // "Ascending order.",
  4708. // "Descending order."
  4709. // ],
  4710. // "location": "query",
  4711. // "type": "string"
  4712. // }
  4713. // },
  4714. // "path": "customer/{customerId}/devices/chromeos",
  4715. // "response": {
  4716. // "$ref": "ChromeOsDevices"
  4717. // },
  4718. // "scopes": [
  4719. // "https://www.googleapis.com/auth/admin.directory.device.chromeos",
  4720. // "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly"
  4721. // ]
  4722. // }
  4723. }
  4724. // Pages invokes f for each page of results.
  4725. // A non-nil error returned from f will halt the iteration.
  4726. // The provided context supersedes any context provided to the Context method.
  4727. func (c *ChromeosdevicesListCall) Pages(ctx context.Context, f func(*ChromeOsDevices) error) error {
  4728. c.ctx_ = ctx
  4729. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4730. for {
  4731. x, err := c.Do()
  4732. if err != nil {
  4733. return err
  4734. }
  4735. if err := f(x); err != nil {
  4736. return err
  4737. }
  4738. if x.NextPageToken == "" {
  4739. return nil
  4740. }
  4741. c.PageToken(x.NextPageToken)
  4742. }
  4743. }
  4744. // method id "directory.chromeosdevices.moveDevicesToOu":
  4745. type ChromeosdevicesMoveDevicesToOuCall struct {
  4746. s *Service
  4747. customerId string
  4748. chromeosmovedevicestoou *ChromeOsMoveDevicesToOu
  4749. urlParams_ gensupport.URLParams
  4750. ctx_ context.Context
  4751. header_ http.Header
  4752. }
  4753. // MoveDevicesToOu: Move or insert multiple Chrome OS Devices to
  4754. // organizational unit
  4755. func (r *ChromeosdevicesService) MoveDevicesToOu(customerId string, orgUnitPath string, chromeosmovedevicestoou *ChromeOsMoveDevicesToOu) *ChromeosdevicesMoveDevicesToOuCall {
  4756. c := &ChromeosdevicesMoveDevicesToOuCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4757. c.customerId = customerId
  4758. c.urlParams_.Set("orgUnitPath", orgUnitPath)
  4759. c.chromeosmovedevicestoou = chromeosmovedevicestoou
  4760. return c
  4761. }
  4762. // Fields allows partial responses to be retrieved. See
  4763. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4764. // for more information.
  4765. func (c *ChromeosdevicesMoveDevicesToOuCall) Fields(s ...googleapi.Field) *ChromeosdevicesMoveDevicesToOuCall {
  4766. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4767. return c
  4768. }
  4769. // Context sets the context to be used in this call's Do method. Any
  4770. // pending HTTP request will be aborted if the provided context is
  4771. // canceled.
  4772. func (c *ChromeosdevicesMoveDevicesToOuCall) Context(ctx context.Context) *ChromeosdevicesMoveDevicesToOuCall {
  4773. c.ctx_ = ctx
  4774. return c
  4775. }
  4776. // Header returns an http.Header that can be modified by the caller to
  4777. // add HTTP headers to the request.
  4778. func (c *ChromeosdevicesMoveDevicesToOuCall) Header() http.Header {
  4779. if c.header_ == nil {
  4780. c.header_ = make(http.Header)
  4781. }
  4782. return c.header_
  4783. }
  4784. func (c *ChromeosdevicesMoveDevicesToOuCall) doRequest(alt string) (*http.Response, error) {
  4785. reqHeaders := make(http.Header)
  4786. for k, v := range c.header_ {
  4787. reqHeaders[k] = v
  4788. }
  4789. reqHeaders.Set("User-Agent", c.s.userAgent())
  4790. var body io.Reader = nil
  4791. body, err := googleapi.WithoutDataWrapper.JSONReader(c.chromeosmovedevicestoou)
  4792. if err != nil {
  4793. return nil, err
  4794. }
  4795. reqHeaders.Set("Content-Type", "application/json")
  4796. c.urlParams_.Set("alt", alt)
  4797. c.urlParams_.Set("prettyPrint", "false")
  4798. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/moveDevicesToOu")
  4799. urls += "?" + c.urlParams_.Encode()
  4800. req, err := http.NewRequest("POST", urls, body)
  4801. if err != nil {
  4802. return nil, err
  4803. }
  4804. req.Header = reqHeaders
  4805. googleapi.Expand(req.URL, map[string]string{
  4806. "customerId": c.customerId,
  4807. })
  4808. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4809. }
  4810. // Do executes the "directory.chromeosdevices.moveDevicesToOu" call.
  4811. func (c *ChromeosdevicesMoveDevicesToOuCall) Do(opts ...googleapi.CallOption) error {
  4812. gensupport.SetOptions(c.urlParams_, opts...)
  4813. res, err := c.doRequest("json")
  4814. if err != nil {
  4815. return err
  4816. }
  4817. defer googleapi.CloseBody(res)
  4818. if err := googleapi.CheckResponse(res); err != nil {
  4819. return err
  4820. }
  4821. return nil
  4822. // {
  4823. // "description": "Move or insert multiple Chrome OS Devices to organizational unit",
  4824. // "httpMethod": "POST",
  4825. // "id": "directory.chromeosdevices.moveDevicesToOu",
  4826. // "parameterOrder": [
  4827. // "customerId",
  4828. // "orgUnitPath"
  4829. // ],
  4830. // "parameters": {
  4831. // "customerId": {
  4832. // "description": "Immutable ID of the G Suite account",
  4833. // "location": "path",
  4834. // "required": true,
  4835. // "type": "string"
  4836. // },
  4837. // "orgUnitPath": {
  4838. // "description": "Full path of the target organizational unit or its ID",
  4839. // "location": "query",
  4840. // "required": true,
  4841. // "type": "string"
  4842. // }
  4843. // },
  4844. // "path": "customer/{customerId}/devices/chromeos/moveDevicesToOu",
  4845. // "request": {
  4846. // "$ref": "ChromeOsMoveDevicesToOu"
  4847. // },
  4848. // "scopes": [
  4849. // "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  4850. // ]
  4851. // }
  4852. }
  4853. // method id "directory.chromeosdevices.patch":
  4854. type ChromeosdevicesPatchCall struct {
  4855. s *Service
  4856. customerId string
  4857. deviceId string
  4858. chromeosdevice *ChromeOsDevice
  4859. urlParams_ gensupport.URLParams
  4860. ctx_ context.Context
  4861. header_ http.Header
  4862. }
  4863. // Patch: Update Chrome OS Device. This method supports patch semantics.
  4864. func (r *ChromeosdevicesService) Patch(customerId string, deviceId string, chromeosdevice *ChromeOsDevice) *ChromeosdevicesPatchCall {
  4865. c := &ChromeosdevicesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4866. c.customerId = customerId
  4867. c.deviceId = deviceId
  4868. c.chromeosdevice = chromeosdevice
  4869. return c
  4870. }
  4871. // Projection sets the optional parameter "projection": Restrict
  4872. // information returned to a set of selected fields.
  4873. //
  4874. // Possible values:
  4875. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  4876. // serialNumber, status, and user)
  4877. // "FULL" - Includes all metadata fields
  4878. func (c *ChromeosdevicesPatchCall) Projection(projection string) *ChromeosdevicesPatchCall {
  4879. c.urlParams_.Set("projection", projection)
  4880. return c
  4881. }
  4882. // Fields allows partial responses to be retrieved. See
  4883. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4884. // for more information.
  4885. func (c *ChromeosdevicesPatchCall) Fields(s ...googleapi.Field) *ChromeosdevicesPatchCall {
  4886. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4887. return c
  4888. }
  4889. // Context sets the context to be used in this call's Do method. Any
  4890. // pending HTTP request will be aborted if the provided context is
  4891. // canceled.
  4892. func (c *ChromeosdevicesPatchCall) Context(ctx context.Context) *ChromeosdevicesPatchCall {
  4893. c.ctx_ = ctx
  4894. return c
  4895. }
  4896. // Header returns an http.Header that can be modified by the caller to
  4897. // add HTTP headers to the request.
  4898. func (c *ChromeosdevicesPatchCall) Header() http.Header {
  4899. if c.header_ == nil {
  4900. c.header_ = make(http.Header)
  4901. }
  4902. return c.header_
  4903. }
  4904. func (c *ChromeosdevicesPatchCall) doRequest(alt string) (*http.Response, error) {
  4905. reqHeaders := make(http.Header)
  4906. for k, v := range c.header_ {
  4907. reqHeaders[k] = v
  4908. }
  4909. reqHeaders.Set("User-Agent", c.s.userAgent())
  4910. var body io.Reader = nil
  4911. body, err := googleapi.WithoutDataWrapper.JSONReader(c.chromeosdevice)
  4912. if err != nil {
  4913. return nil, err
  4914. }
  4915. reqHeaders.Set("Content-Type", "application/json")
  4916. c.urlParams_.Set("alt", alt)
  4917. c.urlParams_.Set("prettyPrint", "false")
  4918. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{deviceId}")
  4919. urls += "?" + c.urlParams_.Encode()
  4920. req, err := http.NewRequest("PATCH", urls, body)
  4921. if err != nil {
  4922. return nil, err
  4923. }
  4924. req.Header = reqHeaders
  4925. googleapi.Expand(req.URL, map[string]string{
  4926. "customerId": c.customerId,
  4927. "deviceId": c.deviceId,
  4928. })
  4929. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4930. }
  4931. // Do executes the "directory.chromeosdevices.patch" call.
  4932. // Exactly one of *ChromeOsDevice or error will be non-nil. Any non-2xx
  4933. // status code is an error. Response headers are in either
  4934. // *ChromeOsDevice.ServerResponse.Header or (if a response was returned
  4935. // at all) in error.(*googleapi.Error).Header. Use
  4936. // googleapi.IsNotModified to check whether the returned error was
  4937. // because http.StatusNotModified was returned.
  4938. func (c *ChromeosdevicesPatchCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevice, error) {
  4939. gensupport.SetOptions(c.urlParams_, opts...)
  4940. res, err := c.doRequest("json")
  4941. if res != nil && res.StatusCode == http.StatusNotModified {
  4942. if res.Body != nil {
  4943. res.Body.Close()
  4944. }
  4945. return nil, &googleapi.Error{
  4946. Code: res.StatusCode,
  4947. Header: res.Header,
  4948. }
  4949. }
  4950. if err != nil {
  4951. return nil, err
  4952. }
  4953. defer googleapi.CloseBody(res)
  4954. if err := googleapi.CheckResponse(res); err != nil {
  4955. return nil, err
  4956. }
  4957. ret := &ChromeOsDevice{
  4958. ServerResponse: googleapi.ServerResponse{
  4959. Header: res.Header,
  4960. HTTPStatusCode: res.StatusCode,
  4961. },
  4962. }
  4963. target := &ret
  4964. if err := gensupport.DecodeResponse(target, res); err != nil {
  4965. return nil, err
  4966. }
  4967. return ret, nil
  4968. // {
  4969. // "description": "Update Chrome OS Device. This method supports patch semantics.",
  4970. // "httpMethod": "PATCH",
  4971. // "id": "directory.chromeosdevices.patch",
  4972. // "parameterOrder": [
  4973. // "customerId",
  4974. // "deviceId"
  4975. // ],
  4976. // "parameters": {
  4977. // "customerId": {
  4978. // "description": "Immutable ID of the G Suite account",
  4979. // "location": "path",
  4980. // "required": true,
  4981. // "type": "string"
  4982. // },
  4983. // "deviceId": {
  4984. // "description": "Immutable ID of Chrome OS Device",
  4985. // "location": "path",
  4986. // "required": true,
  4987. // "type": "string"
  4988. // },
  4989. // "projection": {
  4990. // "description": "Restrict information returned to a set of selected fields.",
  4991. // "enum": [
  4992. // "BASIC",
  4993. // "FULL"
  4994. // ],
  4995. // "enumDescriptions": [
  4996. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  4997. // "Includes all metadata fields"
  4998. // ],
  4999. // "location": "query",
  5000. // "type": "string"
  5001. // }
  5002. // },
  5003. // "path": "customer/{customerId}/devices/chromeos/{deviceId}",
  5004. // "request": {
  5005. // "$ref": "ChromeOsDevice"
  5006. // },
  5007. // "response": {
  5008. // "$ref": "ChromeOsDevice"
  5009. // },
  5010. // "scopes": [
  5011. // "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  5012. // ]
  5013. // }
  5014. }
  5015. // method id "directory.chromeosdevices.update":
  5016. type ChromeosdevicesUpdateCall struct {
  5017. s *Service
  5018. customerId string
  5019. deviceId string
  5020. chromeosdevice *ChromeOsDevice
  5021. urlParams_ gensupport.URLParams
  5022. ctx_ context.Context
  5023. header_ http.Header
  5024. }
  5025. // Update: Update Chrome OS Device
  5026. func (r *ChromeosdevicesService) Update(customerId string, deviceId string, chromeosdevice *ChromeOsDevice) *ChromeosdevicesUpdateCall {
  5027. c := &ChromeosdevicesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5028. c.customerId = customerId
  5029. c.deviceId = deviceId
  5030. c.chromeosdevice = chromeosdevice
  5031. return c
  5032. }
  5033. // Projection sets the optional parameter "projection": Restrict
  5034. // information returned to a set of selected fields.
  5035. //
  5036. // Possible values:
  5037. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  5038. // serialNumber, status, and user)
  5039. // "FULL" - Includes all metadata fields
  5040. func (c *ChromeosdevicesUpdateCall) Projection(projection string) *ChromeosdevicesUpdateCall {
  5041. c.urlParams_.Set("projection", projection)
  5042. return c
  5043. }
  5044. // Fields allows partial responses to be retrieved. See
  5045. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5046. // for more information.
  5047. func (c *ChromeosdevicesUpdateCall) Fields(s ...googleapi.Field) *ChromeosdevicesUpdateCall {
  5048. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5049. return c
  5050. }
  5051. // Context sets the context to be used in this call's Do method. Any
  5052. // pending HTTP request will be aborted if the provided context is
  5053. // canceled.
  5054. func (c *ChromeosdevicesUpdateCall) Context(ctx context.Context) *ChromeosdevicesUpdateCall {
  5055. c.ctx_ = ctx
  5056. return c
  5057. }
  5058. // Header returns an http.Header that can be modified by the caller to
  5059. // add HTTP headers to the request.
  5060. func (c *ChromeosdevicesUpdateCall) Header() http.Header {
  5061. if c.header_ == nil {
  5062. c.header_ = make(http.Header)
  5063. }
  5064. return c.header_
  5065. }
  5066. func (c *ChromeosdevicesUpdateCall) doRequest(alt string) (*http.Response, error) {
  5067. reqHeaders := make(http.Header)
  5068. for k, v := range c.header_ {
  5069. reqHeaders[k] = v
  5070. }
  5071. reqHeaders.Set("User-Agent", c.s.userAgent())
  5072. var body io.Reader = nil
  5073. body, err := googleapi.WithoutDataWrapper.JSONReader(c.chromeosdevice)
  5074. if err != nil {
  5075. return nil, err
  5076. }
  5077. reqHeaders.Set("Content-Type", "application/json")
  5078. c.urlParams_.Set("alt", alt)
  5079. c.urlParams_.Set("prettyPrint", "false")
  5080. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{deviceId}")
  5081. urls += "?" + c.urlParams_.Encode()
  5082. req, err := http.NewRequest("PUT", urls, body)
  5083. if err != nil {
  5084. return nil, err
  5085. }
  5086. req.Header = reqHeaders
  5087. googleapi.Expand(req.URL, map[string]string{
  5088. "customerId": c.customerId,
  5089. "deviceId": c.deviceId,
  5090. })
  5091. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5092. }
  5093. // Do executes the "directory.chromeosdevices.update" call.
  5094. // Exactly one of *ChromeOsDevice or error will be non-nil. Any non-2xx
  5095. // status code is an error. Response headers are in either
  5096. // *ChromeOsDevice.ServerResponse.Header or (if a response was returned
  5097. // at all) in error.(*googleapi.Error).Header. Use
  5098. // googleapi.IsNotModified to check whether the returned error was
  5099. // because http.StatusNotModified was returned.
  5100. func (c *ChromeosdevicesUpdateCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevice, error) {
  5101. gensupport.SetOptions(c.urlParams_, opts...)
  5102. res, err := c.doRequest("json")
  5103. if res != nil && res.StatusCode == http.StatusNotModified {
  5104. if res.Body != nil {
  5105. res.Body.Close()
  5106. }
  5107. return nil, &googleapi.Error{
  5108. Code: res.StatusCode,
  5109. Header: res.Header,
  5110. }
  5111. }
  5112. if err != nil {
  5113. return nil, err
  5114. }
  5115. defer googleapi.CloseBody(res)
  5116. if err := googleapi.CheckResponse(res); err != nil {
  5117. return nil, err
  5118. }
  5119. ret := &ChromeOsDevice{
  5120. ServerResponse: googleapi.ServerResponse{
  5121. Header: res.Header,
  5122. HTTPStatusCode: res.StatusCode,
  5123. },
  5124. }
  5125. target := &ret
  5126. if err := gensupport.DecodeResponse(target, res); err != nil {
  5127. return nil, err
  5128. }
  5129. return ret, nil
  5130. // {
  5131. // "description": "Update Chrome OS Device",
  5132. // "httpMethod": "PUT",
  5133. // "id": "directory.chromeosdevices.update",
  5134. // "parameterOrder": [
  5135. // "customerId",
  5136. // "deviceId"
  5137. // ],
  5138. // "parameters": {
  5139. // "customerId": {
  5140. // "description": "Immutable ID of the G Suite account",
  5141. // "location": "path",
  5142. // "required": true,
  5143. // "type": "string"
  5144. // },
  5145. // "deviceId": {
  5146. // "description": "Immutable ID of Chrome OS Device",
  5147. // "location": "path",
  5148. // "required": true,
  5149. // "type": "string"
  5150. // },
  5151. // "projection": {
  5152. // "description": "Restrict information returned to a set of selected fields.",
  5153. // "enum": [
  5154. // "BASIC",
  5155. // "FULL"
  5156. // ],
  5157. // "enumDescriptions": [
  5158. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  5159. // "Includes all metadata fields"
  5160. // ],
  5161. // "location": "query",
  5162. // "type": "string"
  5163. // }
  5164. // },
  5165. // "path": "customer/{customerId}/devices/chromeos/{deviceId}",
  5166. // "request": {
  5167. // "$ref": "ChromeOsDevice"
  5168. // },
  5169. // "response": {
  5170. // "$ref": "ChromeOsDevice"
  5171. // },
  5172. // "scopes": [
  5173. // "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  5174. // ]
  5175. // }
  5176. }
  5177. // method id "directory.customers.get":
  5178. type CustomersGetCall struct {
  5179. s *Service
  5180. customerKey string
  5181. urlParams_ gensupport.URLParams
  5182. ifNoneMatch_ string
  5183. ctx_ context.Context
  5184. header_ http.Header
  5185. }
  5186. // Get: Retrieves a customer.
  5187. func (r *CustomersService) Get(customerKey string) *CustomersGetCall {
  5188. c := &CustomersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5189. c.customerKey = customerKey
  5190. return c
  5191. }
  5192. // Fields allows partial responses to be retrieved. See
  5193. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5194. // for more information.
  5195. func (c *CustomersGetCall) Fields(s ...googleapi.Field) *CustomersGetCall {
  5196. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5197. return c
  5198. }
  5199. // IfNoneMatch sets the optional parameter which makes the operation
  5200. // fail if the object's ETag matches the given value. This is useful for
  5201. // getting updates only after the object has changed since the last
  5202. // request. Use googleapi.IsNotModified to check whether the response
  5203. // error from Do is the result of In-None-Match.
  5204. func (c *CustomersGetCall) IfNoneMatch(entityTag string) *CustomersGetCall {
  5205. c.ifNoneMatch_ = entityTag
  5206. return c
  5207. }
  5208. // Context sets the context to be used in this call's Do method. Any
  5209. // pending HTTP request will be aborted if the provided context is
  5210. // canceled.
  5211. func (c *CustomersGetCall) Context(ctx context.Context) *CustomersGetCall {
  5212. c.ctx_ = ctx
  5213. return c
  5214. }
  5215. // Header returns an http.Header that can be modified by the caller to
  5216. // add HTTP headers to the request.
  5217. func (c *CustomersGetCall) Header() http.Header {
  5218. if c.header_ == nil {
  5219. c.header_ = make(http.Header)
  5220. }
  5221. return c.header_
  5222. }
  5223. func (c *CustomersGetCall) doRequest(alt string) (*http.Response, error) {
  5224. reqHeaders := make(http.Header)
  5225. for k, v := range c.header_ {
  5226. reqHeaders[k] = v
  5227. }
  5228. reqHeaders.Set("User-Agent", c.s.userAgent())
  5229. if c.ifNoneMatch_ != "" {
  5230. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5231. }
  5232. var body io.Reader = nil
  5233. c.urlParams_.Set("alt", alt)
  5234. c.urlParams_.Set("prettyPrint", "false")
  5235. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerKey}")
  5236. urls += "?" + c.urlParams_.Encode()
  5237. req, err := http.NewRequest("GET", urls, body)
  5238. if err != nil {
  5239. return nil, err
  5240. }
  5241. req.Header = reqHeaders
  5242. googleapi.Expand(req.URL, map[string]string{
  5243. "customerKey": c.customerKey,
  5244. })
  5245. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5246. }
  5247. // Do executes the "directory.customers.get" call.
  5248. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  5249. // code is an error. Response headers are in either
  5250. // *Customer.ServerResponse.Header or (if a response was returned at
  5251. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5252. // to check whether the returned error was because
  5253. // http.StatusNotModified was returned.
  5254. func (c *CustomersGetCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  5255. gensupport.SetOptions(c.urlParams_, opts...)
  5256. res, err := c.doRequest("json")
  5257. if res != nil && res.StatusCode == http.StatusNotModified {
  5258. if res.Body != nil {
  5259. res.Body.Close()
  5260. }
  5261. return nil, &googleapi.Error{
  5262. Code: res.StatusCode,
  5263. Header: res.Header,
  5264. }
  5265. }
  5266. if err != nil {
  5267. return nil, err
  5268. }
  5269. defer googleapi.CloseBody(res)
  5270. if err := googleapi.CheckResponse(res); err != nil {
  5271. return nil, err
  5272. }
  5273. ret := &Customer{
  5274. ServerResponse: googleapi.ServerResponse{
  5275. Header: res.Header,
  5276. HTTPStatusCode: res.StatusCode,
  5277. },
  5278. }
  5279. target := &ret
  5280. if err := gensupport.DecodeResponse(target, res); err != nil {
  5281. return nil, err
  5282. }
  5283. return ret, nil
  5284. // {
  5285. // "description": "Retrieves a customer.",
  5286. // "httpMethod": "GET",
  5287. // "id": "directory.customers.get",
  5288. // "parameterOrder": [
  5289. // "customerKey"
  5290. // ],
  5291. // "parameters": {
  5292. // "customerKey": {
  5293. // "description": "Id of the customer to be retrieved",
  5294. // "location": "path",
  5295. // "required": true,
  5296. // "type": "string"
  5297. // }
  5298. // },
  5299. // "path": "customers/{customerKey}",
  5300. // "response": {
  5301. // "$ref": "Customer"
  5302. // },
  5303. // "scopes": [
  5304. // "https://www.googleapis.com/auth/admin.directory.customer",
  5305. // "https://www.googleapis.com/auth/admin.directory.customer.readonly"
  5306. // ]
  5307. // }
  5308. }
  5309. // method id "directory.customers.patch":
  5310. type CustomersPatchCall struct {
  5311. s *Service
  5312. customerKey string
  5313. customer *Customer
  5314. urlParams_ gensupport.URLParams
  5315. ctx_ context.Context
  5316. header_ http.Header
  5317. }
  5318. // Patch: Updates a customer. This method supports patch semantics.
  5319. func (r *CustomersService) Patch(customerKey string, customer *Customer) *CustomersPatchCall {
  5320. c := &CustomersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5321. c.customerKey = customerKey
  5322. c.customer = customer
  5323. return c
  5324. }
  5325. // Fields allows partial responses to be retrieved. See
  5326. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5327. // for more information.
  5328. func (c *CustomersPatchCall) Fields(s ...googleapi.Field) *CustomersPatchCall {
  5329. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5330. return c
  5331. }
  5332. // Context sets the context to be used in this call's Do method. Any
  5333. // pending HTTP request will be aborted if the provided context is
  5334. // canceled.
  5335. func (c *CustomersPatchCall) Context(ctx context.Context) *CustomersPatchCall {
  5336. c.ctx_ = ctx
  5337. return c
  5338. }
  5339. // Header returns an http.Header that can be modified by the caller to
  5340. // add HTTP headers to the request.
  5341. func (c *CustomersPatchCall) Header() http.Header {
  5342. if c.header_ == nil {
  5343. c.header_ = make(http.Header)
  5344. }
  5345. return c.header_
  5346. }
  5347. func (c *CustomersPatchCall) doRequest(alt string) (*http.Response, error) {
  5348. reqHeaders := make(http.Header)
  5349. for k, v := range c.header_ {
  5350. reqHeaders[k] = v
  5351. }
  5352. reqHeaders.Set("User-Agent", c.s.userAgent())
  5353. var body io.Reader = nil
  5354. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  5355. if err != nil {
  5356. return nil, err
  5357. }
  5358. reqHeaders.Set("Content-Type", "application/json")
  5359. c.urlParams_.Set("alt", alt)
  5360. c.urlParams_.Set("prettyPrint", "false")
  5361. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerKey}")
  5362. urls += "?" + c.urlParams_.Encode()
  5363. req, err := http.NewRequest("PATCH", urls, body)
  5364. if err != nil {
  5365. return nil, err
  5366. }
  5367. req.Header = reqHeaders
  5368. googleapi.Expand(req.URL, map[string]string{
  5369. "customerKey": c.customerKey,
  5370. })
  5371. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5372. }
  5373. // Do executes the "directory.customers.patch" call.
  5374. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  5375. // code is an error. Response headers are in either
  5376. // *Customer.ServerResponse.Header or (if a response was returned at
  5377. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5378. // to check whether the returned error was because
  5379. // http.StatusNotModified was returned.
  5380. func (c *CustomersPatchCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  5381. gensupport.SetOptions(c.urlParams_, opts...)
  5382. res, err := c.doRequest("json")
  5383. if res != nil && res.StatusCode == http.StatusNotModified {
  5384. if res.Body != nil {
  5385. res.Body.Close()
  5386. }
  5387. return nil, &googleapi.Error{
  5388. Code: res.StatusCode,
  5389. Header: res.Header,
  5390. }
  5391. }
  5392. if err != nil {
  5393. return nil, err
  5394. }
  5395. defer googleapi.CloseBody(res)
  5396. if err := googleapi.CheckResponse(res); err != nil {
  5397. return nil, err
  5398. }
  5399. ret := &Customer{
  5400. ServerResponse: googleapi.ServerResponse{
  5401. Header: res.Header,
  5402. HTTPStatusCode: res.StatusCode,
  5403. },
  5404. }
  5405. target := &ret
  5406. if err := gensupport.DecodeResponse(target, res); err != nil {
  5407. return nil, err
  5408. }
  5409. return ret, nil
  5410. // {
  5411. // "description": "Updates a customer. This method supports patch semantics.",
  5412. // "httpMethod": "PATCH",
  5413. // "id": "directory.customers.patch",
  5414. // "parameterOrder": [
  5415. // "customerKey"
  5416. // ],
  5417. // "parameters": {
  5418. // "customerKey": {
  5419. // "description": "Id of the customer to be updated",
  5420. // "location": "path",
  5421. // "required": true,
  5422. // "type": "string"
  5423. // }
  5424. // },
  5425. // "path": "customers/{customerKey}",
  5426. // "request": {
  5427. // "$ref": "Customer"
  5428. // },
  5429. // "response": {
  5430. // "$ref": "Customer"
  5431. // },
  5432. // "scopes": [
  5433. // "https://www.googleapis.com/auth/admin.directory.customer"
  5434. // ]
  5435. // }
  5436. }
  5437. // method id "directory.customers.update":
  5438. type CustomersUpdateCall struct {
  5439. s *Service
  5440. customerKey string
  5441. customer *Customer
  5442. urlParams_ gensupport.URLParams
  5443. ctx_ context.Context
  5444. header_ http.Header
  5445. }
  5446. // Update: Updates a customer.
  5447. func (r *CustomersService) Update(customerKey string, customer *Customer) *CustomersUpdateCall {
  5448. c := &CustomersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5449. c.customerKey = customerKey
  5450. c.customer = customer
  5451. return c
  5452. }
  5453. // Fields allows partial responses to be retrieved. See
  5454. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5455. // for more information.
  5456. func (c *CustomersUpdateCall) Fields(s ...googleapi.Field) *CustomersUpdateCall {
  5457. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5458. return c
  5459. }
  5460. // Context sets the context to be used in this call's Do method. Any
  5461. // pending HTTP request will be aborted if the provided context is
  5462. // canceled.
  5463. func (c *CustomersUpdateCall) Context(ctx context.Context) *CustomersUpdateCall {
  5464. c.ctx_ = ctx
  5465. return c
  5466. }
  5467. // Header returns an http.Header that can be modified by the caller to
  5468. // add HTTP headers to the request.
  5469. func (c *CustomersUpdateCall) Header() http.Header {
  5470. if c.header_ == nil {
  5471. c.header_ = make(http.Header)
  5472. }
  5473. return c.header_
  5474. }
  5475. func (c *CustomersUpdateCall) doRequest(alt string) (*http.Response, error) {
  5476. reqHeaders := make(http.Header)
  5477. for k, v := range c.header_ {
  5478. reqHeaders[k] = v
  5479. }
  5480. reqHeaders.Set("User-Agent", c.s.userAgent())
  5481. var body io.Reader = nil
  5482. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  5483. if err != nil {
  5484. return nil, err
  5485. }
  5486. reqHeaders.Set("Content-Type", "application/json")
  5487. c.urlParams_.Set("alt", alt)
  5488. c.urlParams_.Set("prettyPrint", "false")
  5489. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerKey}")
  5490. urls += "?" + c.urlParams_.Encode()
  5491. req, err := http.NewRequest("PUT", urls, body)
  5492. if err != nil {
  5493. return nil, err
  5494. }
  5495. req.Header = reqHeaders
  5496. googleapi.Expand(req.URL, map[string]string{
  5497. "customerKey": c.customerKey,
  5498. })
  5499. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5500. }
  5501. // Do executes the "directory.customers.update" call.
  5502. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  5503. // code is an error. Response headers are in either
  5504. // *Customer.ServerResponse.Header or (if a response was returned at
  5505. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5506. // to check whether the returned error was because
  5507. // http.StatusNotModified was returned.
  5508. func (c *CustomersUpdateCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  5509. gensupport.SetOptions(c.urlParams_, opts...)
  5510. res, err := c.doRequest("json")
  5511. if res != nil && res.StatusCode == http.StatusNotModified {
  5512. if res.Body != nil {
  5513. res.Body.Close()
  5514. }
  5515. return nil, &googleapi.Error{
  5516. Code: res.StatusCode,
  5517. Header: res.Header,
  5518. }
  5519. }
  5520. if err != nil {
  5521. return nil, err
  5522. }
  5523. defer googleapi.CloseBody(res)
  5524. if err := googleapi.CheckResponse(res); err != nil {
  5525. return nil, err
  5526. }
  5527. ret := &Customer{
  5528. ServerResponse: googleapi.ServerResponse{
  5529. Header: res.Header,
  5530. HTTPStatusCode: res.StatusCode,
  5531. },
  5532. }
  5533. target := &ret
  5534. if err := gensupport.DecodeResponse(target, res); err != nil {
  5535. return nil, err
  5536. }
  5537. return ret, nil
  5538. // {
  5539. // "description": "Updates a customer.",
  5540. // "httpMethod": "PUT",
  5541. // "id": "directory.customers.update",
  5542. // "parameterOrder": [
  5543. // "customerKey"
  5544. // ],
  5545. // "parameters": {
  5546. // "customerKey": {
  5547. // "description": "Id of the customer to be updated",
  5548. // "location": "path",
  5549. // "required": true,
  5550. // "type": "string"
  5551. // }
  5552. // },
  5553. // "path": "customers/{customerKey}",
  5554. // "request": {
  5555. // "$ref": "Customer"
  5556. // },
  5557. // "response": {
  5558. // "$ref": "Customer"
  5559. // },
  5560. // "scopes": [
  5561. // "https://www.googleapis.com/auth/admin.directory.customer"
  5562. // ]
  5563. // }
  5564. }
  5565. // method id "directory.domainAliases.delete":
  5566. type DomainAliasesDeleteCall struct {
  5567. s *Service
  5568. customer string
  5569. domainAliasName string
  5570. urlParams_ gensupport.URLParams
  5571. ctx_ context.Context
  5572. header_ http.Header
  5573. }
  5574. // Delete: Deletes a Domain Alias of the customer.
  5575. func (r *DomainAliasesService) Delete(customer string, domainAliasName string) *DomainAliasesDeleteCall {
  5576. c := &DomainAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5577. c.customer = customer
  5578. c.domainAliasName = domainAliasName
  5579. return c
  5580. }
  5581. // Fields allows partial responses to be retrieved. See
  5582. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5583. // for more information.
  5584. func (c *DomainAliasesDeleteCall) Fields(s ...googleapi.Field) *DomainAliasesDeleteCall {
  5585. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5586. return c
  5587. }
  5588. // Context sets the context to be used in this call's Do method. Any
  5589. // pending HTTP request will be aborted if the provided context is
  5590. // canceled.
  5591. func (c *DomainAliasesDeleteCall) Context(ctx context.Context) *DomainAliasesDeleteCall {
  5592. c.ctx_ = ctx
  5593. return c
  5594. }
  5595. // Header returns an http.Header that can be modified by the caller to
  5596. // add HTTP headers to the request.
  5597. func (c *DomainAliasesDeleteCall) Header() http.Header {
  5598. if c.header_ == nil {
  5599. c.header_ = make(http.Header)
  5600. }
  5601. return c.header_
  5602. }
  5603. func (c *DomainAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  5604. reqHeaders := make(http.Header)
  5605. for k, v := range c.header_ {
  5606. reqHeaders[k] = v
  5607. }
  5608. reqHeaders.Set("User-Agent", c.s.userAgent())
  5609. var body io.Reader = nil
  5610. c.urlParams_.Set("alt", alt)
  5611. c.urlParams_.Set("prettyPrint", "false")
  5612. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases/{domainAliasName}")
  5613. urls += "?" + c.urlParams_.Encode()
  5614. req, err := http.NewRequest("DELETE", urls, body)
  5615. if err != nil {
  5616. return nil, err
  5617. }
  5618. req.Header = reqHeaders
  5619. googleapi.Expand(req.URL, map[string]string{
  5620. "customer": c.customer,
  5621. "domainAliasName": c.domainAliasName,
  5622. })
  5623. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5624. }
  5625. // Do executes the "directory.domainAliases.delete" call.
  5626. func (c *DomainAliasesDeleteCall) Do(opts ...googleapi.CallOption) error {
  5627. gensupport.SetOptions(c.urlParams_, opts...)
  5628. res, err := c.doRequest("json")
  5629. if err != nil {
  5630. return err
  5631. }
  5632. defer googleapi.CloseBody(res)
  5633. if err := googleapi.CheckResponse(res); err != nil {
  5634. return err
  5635. }
  5636. return nil
  5637. // {
  5638. // "description": "Deletes a Domain Alias of the customer.",
  5639. // "httpMethod": "DELETE",
  5640. // "id": "directory.domainAliases.delete",
  5641. // "parameterOrder": [
  5642. // "customer",
  5643. // "domainAliasName"
  5644. // ],
  5645. // "parameters": {
  5646. // "customer": {
  5647. // "description": "Immutable ID of the G Suite account.",
  5648. // "location": "path",
  5649. // "required": true,
  5650. // "type": "string"
  5651. // },
  5652. // "domainAliasName": {
  5653. // "description": "Name of domain alias to be retrieved.",
  5654. // "location": "path",
  5655. // "required": true,
  5656. // "type": "string"
  5657. // }
  5658. // },
  5659. // "path": "customer/{customer}/domainaliases/{domainAliasName}",
  5660. // "scopes": [
  5661. // "https://www.googleapis.com/auth/admin.directory.domain"
  5662. // ]
  5663. // }
  5664. }
  5665. // method id "directory.domainAliases.get":
  5666. type DomainAliasesGetCall struct {
  5667. s *Service
  5668. customer string
  5669. domainAliasName string
  5670. urlParams_ gensupport.URLParams
  5671. ifNoneMatch_ string
  5672. ctx_ context.Context
  5673. header_ http.Header
  5674. }
  5675. // Get: Retrieves a domain alias of the customer.
  5676. func (r *DomainAliasesService) Get(customer string, domainAliasName string) *DomainAliasesGetCall {
  5677. c := &DomainAliasesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5678. c.customer = customer
  5679. c.domainAliasName = domainAliasName
  5680. return c
  5681. }
  5682. // Fields allows partial responses to be retrieved. See
  5683. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5684. // for more information.
  5685. func (c *DomainAliasesGetCall) Fields(s ...googleapi.Field) *DomainAliasesGetCall {
  5686. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5687. return c
  5688. }
  5689. // IfNoneMatch sets the optional parameter which makes the operation
  5690. // fail if the object's ETag matches the given value. This is useful for
  5691. // getting updates only after the object has changed since the last
  5692. // request. Use googleapi.IsNotModified to check whether the response
  5693. // error from Do is the result of In-None-Match.
  5694. func (c *DomainAliasesGetCall) IfNoneMatch(entityTag string) *DomainAliasesGetCall {
  5695. c.ifNoneMatch_ = entityTag
  5696. return c
  5697. }
  5698. // Context sets the context to be used in this call's Do method. Any
  5699. // pending HTTP request will be aborted if the provided context is
  5700. // canceled.
  5701. func (c *DomainAliasesGetCall) Context(ctx context.Context) *DomainAliasesGetCall {
  5702. c.ctx_ = ctx
  5703. return c
  5704. }
  5705. // Header returns an http.Header that can be modified by the caller to
  5706. // add HTTP headers to the request.
  5707. func (c *DomainAliasesGetCall) Header() http.Header {
  5708. if c.header_ == nil {
  5709. c.header_ = make(http.Header)
  5710. }
  5711. return c.header_
  5712. }
  5713. func (c *DomainAliasesGetCall) doRequest(alt string) (*http.Response, error) {
  5714. reqHeaders := make(http.Header)
  5715. for k, v := range c.header_ {
  5716. reqHeaders[k] = v
  5717. }
  5718. reqHeaders.Set("User-Agent", c.s.userAgent())
  5719. if c.ifNoneMatch_ != "" {
  5720. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5721. }
  5722. var body io.Reader = nil
  5723. c.urlParams_.Set("alt", alt)
  5724. c.urlParams_.Set("prettyPrint", "false")
  5725. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases/{domainAliasName}")
  5726. urls += "?" + c.urlParams_.Encode()
  5727. req, err := http.NewRequest("GET", urls, body)
  5728. if err != nil {
  5729. return nil, err
  5730. }
  5731. req.Header = reqHeaders
  5732. googleapi.Expand(req.URL, map[string]string{
  5733. "customer": c.customer,
  5734. "domainAliasName": c.domainAliasName,
  5735. })
  5736. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5737. }
  5738. // Do executes the "directory.domainAliases.get" call.
  5739. // Exactly one of *DomainAlias or error will be non-nil. Any non-2xx
  5740. // status code is an error. Response headers are in either
  5741. // *DomainAlias.ServerResponse.Header or (if a response was returned at
  5742. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5743. // to check whether the returned error was because
  5744. // http.StatusNotModified was returned.
  5745. func (c *DomainAliasesGetCall) Do(opts ...googleapi.CallOption) (*DomainAlias, error) {
  5746. gensupport.SetOptions(c.urlParams_, opts...)
  5747. res, err := c.doRequest("json")
  5748. if res != nil && res.StatusCode == http.StatusNotModified {
  5749. if res.Body != nil {
  5750. res.Body.Close()
  5751. }
  5752. return nil, &googleapi.Error{
  5753. Code: res.StatusCode,
  5754. Header: res.Header,
  5755. }
  5756. }
  5757. if err != nil {
  5758. return nil, err
  5759. }
  5760. defer googleapi.CloseBody(res)
  5761. if err := googleapi.CheckResponse(res); err != nil {
  5762. return nil, err
  5763. }
  5764. ret := &DomainAlias{
  5765. ServerResponse: googleapi.ServerResponse{
  5766. Header: res.Header,
  5767. HTTPStatusCode: res.StatusCode,
  5768. },
  5769. }
  5770. target := &ret
  5771. if err := gensupport.DecodeResponse(target, res); err != nil {
  5772. return nil, err
  5773. }
  5774. return ret, nil
  5775. // {
  5776. // "description": "Retrieves a domain alias of the customer.",
  5777. // "httpMethod": "GET",
  5778. // "id": "directory.domainAliases.get",
  5779. // "parameterOrder": [
  5780. // "customer",
  5781. // "domainAliasName"
  5782. // ],
  5783. // "parameters": {
  5784. // "customer": {
  5785. // "description": "Immutable ID of the G Suite account.",
  5786. // "location": "path",
  5787. // "required": true,
  5788. // "type": "string"
  5789. // },
  5790. // "domainAliasName": {
  5791. // "description": "Name of domain alias to be retrieved.",
  5792. // "location": "path",
  5793. // "required": true,
  5794. // "type": "string"
  5795. // }
  5796. // },
  5797. // "path": "customer/{customer}/domainaliases/{domainAliasName}",
  5798. // "response": {
  5799. // "$ref": "DomainAlias"
  5800. // },
  5801. // "scopes": [
  5802. // "https://www.googleapis.com/auth/admin.directory.domain",
  5803. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  5804. // ]
  5805. // }
  5806. }
  5807. // method id "directory.domainAliases.insert":
  5808. type DomainAliasesInsertCall struct {
  5809. s *Service
  5810. customer string
  5811. domainalias *DomainAlias
  5812. urlParams_ gensupport.URLParams
  5813. ctx_ context.Context
  5814. header_ http.Header
  5815. }
  5816. // Insert: Inserts a Domain alias of the customer.
  5817. func (r *DomainAliasesService) Insert(customer string, domainalias *DomainAlias) *DomainAliasesInsertCall {
  5818. c := &DomainAliasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5819. c.customer = customer
  5820. c.domainalias = domainalias
  5821. return c
  5822. }
  5823. // Fields allows partial responses to be retrieved. See
  5824. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5825. // for more information.
  5826. func (c *DomainAliasesInsertCall) Fields(s ...googleapi.Field) *DomainAliasesInsertCall {
  5827. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5828. return c
  5829. }
  5830. // Context sets the context to be used in this call's Do method. Any
  5831. // pending HTTP request will be aborted if the provided context is
  5832. // canceled.
  5833. func (c *DomainAliasesInsertCall) Context(ctx context.Context) *DomainAliasesInsertCall {
  5834. c.ctx_ = ctx
  5835. return c
  5836. }
  5837. // Header returns an http.Header that can be modified by the caller to
  5838. // add HTTP headers to the request.
  5839. func (c *DomainAliasesInsertCall) Header() http.Header {
  5840. if c.header_ == nil {
  5841. c.header_ = make(http.Header)
  5842. }
  5843. return c.header_
  5844. }
  5845. func (c *DomainAliasesInsertCall) doRequest(alt string) (*http.Response, error) {
  5846. reqHeaders := make(http.Header)
  5847. for k, v := range c.header_ {
  5848. reqHeaders[k] = v
  5849. }
  5850. reqHeaders.Set("User-Agent", c.s.userAgent())
  5851. var body io.Reader = nil
  5852. body, err := googleapi.WithoutDataWrapper.JSONReader(c.domainalias)
  5853. if err != nil {
  5854. return nil, err
  5855. }
  5856. reqHeaders.Set("Content-Type", "application/json")
  5857. c.urlParams_.Set("alt", alt)
  5858. c.urlParams_.Set("prettyPrint", "false")
  5859. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases")
  5860. urls += "?" + c.urlParams_.Encode()
  5861. req, err := http.NewRequest("POST", urls, body)
  5862. if err != nil {
  5863. return nil, err
  5864. }
  5865. req.Header = reqHeaders
  5866. googleapi.Expand(req.URL, map[string]string{
  5867. "customer": c.customer,
  5868. })
  5869. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5870. }
  5871. // Do executes the "directory.domainAliases.insert" call.
  5872. // Exactly one of *DomainAlias or error will be non-nil. Any non-2xx
  5873. // status code is an error. Response headers are in either
  5874. // *DomainAlias.ServerResponse.Header or (if a response was returned at
  5875. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5876. // to check whether the returned error was because
  5877. // http.StatusNotModified was returned.
  5878. func (c *DomainAliasesInsertCall) Do(opts ...googleapi.CallOption) (*DomainAlias, error) {
  5879. gensupport.SetOptions(c.urlParams_, opts...)
  5880. res, err := c.doRequest("json")
  5881. if res != nil && res.StatusCode == http.StatusNotModified {
  5882. if res.Body != nil {
  5883. res.Body.Close()
  5884. }
  5885. return nil, &googleapi.Error{
  5886. Code: res.StatusCode,
  5887. Header: res.Header,
  5888. }
  5889. }
  5890. if err != nil {
  5891. return nil, err
  5892. }
  5893. defer googleapi.CloseBody(res)
  5894. if err := googleapi.CheckResponse(res); err != nil {
  5895. return nil, err
  5896. }
  5897. ret := &DomainAlias{
  5898. ServerResponse: googleapi.ServerResponse{
  5899. Header: res.Header,
  5900. HTTPStatusCode: res.StatusCode,
  5901. },
  5902. }
  5903. target := &ret
  5904. if err := gensupport.DecodeResponse(target, res); err != nil {
  5905. return nil, err
  5906. }
  5907. return ret, nil
  5908. // {
  5909. // "description": "Inserts a Domain alias of the customer.",
  5910. // "httpMethod": "POST",
  5911. // "id": "directory.domainAliases.insert",
  5912. // "parameterOrder": [
  5913. // "customer"
  5914. // ],
  5915. // "parameters": {
  5916. // "customer": {
  5917. // "description": "Immutable ID of the G Suite account.",
  5918. // "location": "path",
  5919. // "required": true,
  5920. // "type": "string"
  5921. // }
  5922. // },
  5923. // "path": "customer/{customer}/domainaliases",
  5924. // "request": {
  5925. // "$ref": "DomainAlias"
  5926. // },
  5927. // "response": {
  5928. // "$ref": "DomainAlias"
  5929. // },
  5930. // "scopes": [
  5931. // "https://www.googleapis.com/auth/admin.directory.domain"
  5932. // ]
  5933. // }
  5934. }
  5935. // method id "directory.domainAliases.list":
  5936. type DomainAliasesListCall struct {
  5937. s *Service
  5938. customer string
  5939. urlParams_ gensupport.URLParams
  5940. ifNoneMatch_ string
  5941. ctx_ context.Context
  5942. header_ http.Header
  5943. }
  5944. // List: Lists the domain aliases of the customer.
  5945. func (r *DomainAliasesService) List(customer string) *DomainAliasesListCall {
  5946. c := &DomainAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5947. c.customer = customer
  5948. return c
  5949. }
  5950. // ParentDomainName sets the optional parameter "parentDomainName": Name
  5951. // of the parent domain for which domain aliases are to be fetched.
  5952. func (c *DomainAliasesListCall) ParentDomainName(parentDomainName string) *DomainAliasesListCall {
  5953. c.urlParams_.Set("parentDomainName", parentDomainName)
  5954. return c
  5955. }
  5956. // Fields allows partial responses to be retrieved. See
  5957. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5958. // for more information.
  5959. func (c *DomainAliasesListCall) Fields(s ...googleapi.Field) *DomainAliasesListCall {
  5960. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5961. return c
  5962. }
  5963. // IfNoneMatch sets the optional parameter which makes the operation
  5964. // fail if the object's ETag matches the given value. This is useful for
  5965. // getting updates only after the object has changed since the last
  5966. // request. Use googleapi.IsNotModified to check whether the response
  5967. // error from Do is the result of In-None-Match.
  5968. func (c *DomainAliasesListCall) IfNoneMatch(entityTag string) *DomainAliasesListCall {
  5969. c.ifNoneMatch_ = entityTag
  5970. return c
  5971. }
  5972. // Context sets the context to be used in this call's Do method. Any
  5973. // pending HTTP request will be aborted if the provided context is
  5974. // canceled.
  5975. func (c *DomainAliasesListCall) Context(ctx context.Context) *DomainAliasesListCall {
  5976. c.ctx_ = ctx
  5977. return c
  5978. }
  5979. // Header returns an http.Header that can be modified by the caller to
  5980. // add HTTP headers to the request.
  5981. func (c *DomainAliasesListCall) Header() http.Header {
  5982. if c.header_ == nil {
  5983. c.header_ = make(http.Header)
  5984. }
  5985. return c.header_
  5986. }
  5987. func (c *DomainAliasesListCall) doRequest(alt string) (*http.Response, error) {
  5988. reqHeaders := make(http.Header)
  5989. for k, v := range c.header_ {
  5990. reqHeaders[k] = v
  5991. }
  5992. reqHeaders.Set("User-Agent", c.s.userAgent())
  5993. if c.ifNoneMatch_ != "" {
  5994. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5995. }
  5996. var body io.Reader = nil
  5997. c.urlParams_.Set("alt", alt)
  5998. c.urlParams_.Set("prettyPrint", "false")
  5999. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases")
  6000. urls += "?" + c.urlParams_.Encode()
  6001. req, err := http.NewRequest("GET", urls, body)
  6002. if err != nil {
  6003. return nil, err
  6004. }
  6005. req.Header = reqHeaders
  6006. googleapi.Expand(req.URL, map[string]string{
  6007. "customer": c.customer,
  6008. })
  6009. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6010. }
  6011. // Do executes the "directory.domainAliases.list" call.
  6012. // Exactly one of *DomainAliases or error will be non-nil. Any non-2xx
  6013. // status code is an error. Response headers are in either
  6014. // *DomainAliases.ServerResponse.Header or (if a response was returned
  6015. // at all) in error.(*googleapi.Error).Header. Use
  6016. // googleapi.IsNotModified to check whether the returned error was
  6017. // because http.StatusNotModified was returned.
  6018. func (c *DomainAliasesListCall) Do(opts ...googleapi.CallOption) (*DomainAliases, error) {
  6019. gensupport.SetOptions(c.urlParams_, opts...)
  6020. res, err := c.doRequest("json")
  6021. if res != nil && res.StatusCode == http.StatusNotModified {
  6022. if res.Body != nil {
  6023. res.Body.Close()
  6024. }
  6025. return nil, &googleapi.Error{
  6026. Code: res.StatusCode,
  6027. Header: res.Header,
  6028. }
  6029. }
  6030. if err != nil {
  6031. return nil, err
  6032. }
  6033. defer googleapi.CloseBody(res)
  6034. if err := googleapi.CheckResponse(res); err != nil {
  6035. return nil, err
  6036. }
  6037. ret := &DomainAliases{
  6038. ServerResponse: googleapi.ServerResponse{
  6039. Header: res.Header,
  6040. HTTPStatusCode: res.StatusCode,
  6041. },
  6042. }
  6043. target := &ret
  6044. if err := gensupport.DecodeResponse(target, res); err != nil {
  6045. return nil, err
  6046. }
  6047. return ret, nil
  6048. // {
  6049. // "description": "Lists the domain aliases of the customer.",
  6050. // "httpMethod": "GET",
  6051. // "id": "directory.domainAliases.list",
  6052. // "parameterOrder": [
  6053. // "customer"
  6054. // ],
  6055. // "parameters": {
  6056. // "customer": {
  6057. // "description": "Immutable ID of the G Suite account.",
  6058. // "location": "path",
  6059. // "required": true,
  6060. // "type": "string"
  6061. // },
  6062. // "parentDomainName": {
  6063. // "description": "Name of the parent domain for which domain aliases are to be fetched.",
  6064. // "location": "query",
  6065. // "type": "string"
  6066. // }
  6067. // },
  6068. // "path": "customer/{customer}/domainaliases",
  6069. // "response": {
  6070. // "$ref": "DomainAliases"
  6071. // },
  6072. // "scopes": [
  6073. // "https://www.googleapis.com/auth/admin.directory.domain",
  6074. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  6075. // ]
  6076. // }
  6077. }
  6078. // method id "directory.domains.delete":
  6079. type DomainsDeleteCall struct {
  6080. s *Service
  6081. customer string
  6082. domainName string
  6083. urlParams_ gensupport.URLParams
  6084. ctx_ context.Context
  6085. header_ http.Header
  6086. }
  6087. // Delete: Deletes a domain of the customer.
  6088. func (r *DomainsService) Delete(customer string, domainName string) *DomainsDeleteCall {
  6089. c := &DomainsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6090. c.customer = customer
  6091. c.domainName = domainName
  6092. return c
  6093. }
  6094. // Fields allows partial responses to be retrieved. See
  6095. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6096. // for more information.
  6097. func (c *DomainsDeleteCall) Fields(s ...googleapi.Field) *DomainsDeleteCall {
  6098. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6099. return c
  6100. }
  6101. // Context sets the context to be used in this call's Do method. Any
  6102. // pending HTTP request will be aborted if the provided context is
  6103. // canceled.
  6104. func (c *DomainsDeleteCall) Context(ctx context.Context) *DomainsDeleteCall {
  6105. c.ctx_ = ctx
  6106. return c
  6107. }
  6108. // Header returns an http.Header that can be modified by the caller to
  6109. // add HTTP headers to the request.
  6110. func (c *DomainsDeleteCall) Header() http.Header {
  6111. if c.header_ == nil {
  6112. c.header_ = make(http.Header)
  6113. }
  6114. return c.header_
  6115. }
  6116. func (c *DomainsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6117. reqHeaders := make(http.Header)
  6118. for k, v := range c.header_ {
  6119. reqHeaders[k] = v
  6120. }
  6121. reqHeaders.Set("User-Agent", c.s.userAgent())
  6122. var body io.Reader = nil
  6123. c.urlParams_.Set("alt", alt)
  6124. c.urlParams_.Set("prettyPrint", "false")
  6125. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains/{domainName}")
  6126. urls += "?" + c.urlParams_.Encode()
  6127. req, err := http.NewRequest("DELETE", urls, body)
  6128. if err != nil {
  6129. return nil, err
  6130. }
  6131. req.Header = reqHeaders
  6132. googleapi.Expand(req.URL, map[string]string{
  6133. "customer": c.customer,
  6134. "domainName": c.domainName,
  6135. })
  6136. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6137. }
  6138. // Do executes the "directory.domains.delete" call.
  6139. func (c *DomainsDeleteCall) Do(opts ...googleapi.CallOption) error {
  6140. gensupport.SetOptions(c.urlParams_, opts...)
  6141. res, err := c.doRequest("json")
  6142. if err != nil {
  6143. return err
  6144. }
  6145. defer googleapi.CloseBody(res)
  6146. if err := googleapi.CheckResponse(res); err != nil {
  6147. return err
  6148. }
  6149. return nil
  6150. // {
  6151. // "description": "Deletes a domain of the customer.",
  6152. // "httpMethod": "DELETE",
  6153. // "id": "directory.domains.delete",
  6154. // "parameterOrder": [
  6155. // "customer",
  6156. // "domainName"
  6157. // ],
  6158. // "parameters": {
  6159. // "customer": {
  6160. // "description": "Immutable ID of the G Suite account.",
  6161. // "location": "path",
  6162. // "required": true,
  6163. // "type": "string"
  6164. // },
  6165. // "domainName": {
  6166. // "description": "Name of domain to be deleted",
  6167. // "location": "path",
  6168. // "required": true,
  6169. // "type": "string"
  6170. // }
  6171. // },
  6172. // "path": "customer/{customer}/domains/{domainName}",
  6173. // "scopes": [
  6174. // "https://www.googleapis.com/auth/admin.directory.domain"
  6175. // ]
  6176. // }
  6177. }
  6178. // method id "directory.domains.get":
  6179. type DomainsGetCall struct {
  6180. s *Service
  6181. customer string
  6182. domainName string
  6183. urlParams_ gensupport.URLParams
  6184. ifNoneMatch_ string
  6185. ctx_ context.Context
  6186. header_ http.Header
  6187. }
  6188. // Get: Retrieves a domain of the customer.
  6189. func (r *DomainsService) Get(customer string, domainName string) *DomainsGetCall {
  6190. c := &DomainsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6191. c.customer = customer
  6192. c.domainName = domainName
  6193. return c
  6194. }
  6195. // Fields allows partial responses to be retrieved. See
  6196. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6197. // for more information.
  6198. func (c *DomainsGetCall) Fields(s ...googleapi.Field) *DomainsGetCall {
  6199. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6200. return c
  6201. }
  6202. // IfNoneMatch sets the optional parameter which makes the operation
  6203. // fail if the object's ETag matches the given value. This is useful for
  6204. // getting updates only after the object has changed since the last
  6205. // request. Use googleapi.IsNotModified to check whether the response
  6206. // error from Do is the result of In-None-Match.
  6207. func (c *DomainsGetCall) IfNoneMatch(entityTag string) *DomainsGetCall {
  6208. c.ifNoneMatch_ = entityTag
  6209. return c
  6210. }
  6211. // Context sets the context to be used in this call's Do method. Any
  6212. // pending HTTP request will be aborted if the provided context is
  6213. // canceled.
  6214. func (c *DomainsGetCall) Context(ctx context.Context) *DomainsGetCall {
  6215. c.ctx_ = ctx
  6216. return c
  6217. }
  6218. // Header returns an http.Header that can be modified by the caller to
  6219. // add HTTP headers to the request.
  6220. func (c *DomainsGetCall) Header() http.Header {
  6221. if c.header_ == nil {
  6222. c.header_ = make(http.Header)
  6223. }
  6224. return c.header_
  6225. }
  6226. func (c *DomainsGetCall) doRequest(alt string) (*http.Response, error) {
  6227. reqHeaders := make(http.Header)
  6228. for k, v := range c.header_ {
  6229. reqHeaders[k] = v
  6230. }
  6231. reqHeaders.Set("User-Agent", c.s.userAgent())
  6232. if c.ifNoneMatch_ != "" {
  6233. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6234. }
  6235. var body io.Reader = nil
  6236. c.urlParams_.Set("alt", alt)
  6237. c.urlParams_.Set("prettyPrint", "false")
  6238. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains/{domainName}")
  6239. urls += "?" + c.urlParams_.Encode()
  6240. req, err := http.NewRequest("GET", urls, body)
  6241. if err != nil {
  6242. return nil, err
  6243. }
  6244. req.Header = reqHeaders
  6245. googleapi.Expand(req.URL, map[string]string{
  6246. "customer": c.customer,
  6247. "domainName": c.domainName,
  6248. })
  6249. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6250. }
  6251. // Do executes the "directory.domains.get" call.
  6252. // Exactly one of *Domains or error will be non-nil. Any non-2xx status
  6253. // code is an error. Response headers are in either
  6254. // *Domains.ServerResponse.Header or (if a response was returned at all)
  6255. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6256. // check whether the returned error was because http.StatusNotModified
  6257. // was returned.
  6258. func (c *DomainsGetCall) Do(opts ...googleapi.CallOption) (*Domains, error) {
  6259. gensupport.SetOptions(c.urlParams_, opts...)
  6260. res, err := c.doRequest("json")
  6261. if res != nil && res.StatusCode == http.StatusNotModified {
  6262. if res.Body != nil {
  6263. res.Body.Close()
  6264. }
  6265. return nil, &googleapi.Error{
  6266. Code: res.StatusCode,
  6267. Header: res.Header,
  6268. }
  6269. }
  6270. if err != nil {
  6271. return nil, err
  6272. }
  6273. defer googleapi.CloseBody(res)
  6274. if err := googleapi.CheckResponse(res); err != nil {
  6275. return nil, err
  6276. }
  6277. ret := &Domains{
  6278. ServerResponse: googleapi.ServerResponse{
  6279. Header: res.Header,
  6280. HTTPStatusCode: res.StatusCode,
  6281. },
  6282. }
  6283. target := &ret
  6284. if err := gensupport.DecodeResponse(target, res); err != nil {
  6285. return nil, err
  6286. }
  6287. return ret, nil
  6288. // {
  6289. // "description": "Retrieves a domain of the customer.",
  6290. // "httpMethod": "GET",
  6291. // "id": "directory.domains.get",
  6292. // "parameterOrder": [
  6293. // "customer",
  6294. // "domainName"
  6295. // ],
  6296. // "parameters": {
  6297. // "customer": {
  6298. // "description": "Immutable ID of the G Suite account.",
  6299. // "location": "path",
  6300. // "required": true,
  6301. // "type": "string"
  6302. // },
  6303. // "domainName": {
  6304. // "description": "Name of domain to be retrieved",
  6305. // "location": "path",
  6306. // "required": true,
  6307. // "type": "string"
  6308. // }
  6309. // },
  6310. // "path": "customer/{customer}/domains/{domainName}",
  6311. // "response": {
  6312. // "$ref": "Domains"
  6313. // },
  6314. // "scopes": [
  6315. // "https://www.googleapis.com/auth/admin.directory.domain",
  6316. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  6317. // ]
  6318. // }
  6319. }
  6320. // method id "directory.domains.insert":
  6321. type DomainsInsertCall struct {
  6322. s *Service
  6323. customer string
  6324. domains *Domains
  6325. urlParams_ gensupport.URLParams
  6326. ctx_ context.Context
  6327. header_ http.Header
  6328. }
  6329. // Insert: Inserts a domain of the customer.
  6330. func (r *DomainsService) Insert(customer string, domains *Domains) *DomainsInsertCall {
  6331. c := &DomainsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6332. c.customer = customer
  6333. c.domains = domains
  6334. return c
  6335. }
  6336. // Fields allows partial responses to be retrieved. See
  6337. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6338. // for more information.
  6339. func (c *DomainsInsertCall) Fields(s ...googleapi.Field) *DomainsInsertCall {
  6340. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6341. return c
  6342. }
  6343. // Context sets the context to be used in this call's Do method. Any
  6344. // pending HTTP request will be aborted if the provided context is
  6345. // canceled.
  6346. func (c *DomainsInsertCall) Context(ctx context.Context) *DomainsInsertCall {
  6347. c.ctx_ = ctx
  6348. return c
  6349. }
  6350. // Header returns an http.Header that can be modified by the caller to
  6351. // add HTTP headers to the request.
  6352. func (c *DomainsInsertCall) Header() http.Header {
  6353. if c.header_ == nil {
  6354. c.header_ = make(http.Header)
  6355. }
  6356. return c.header_
  6357. }
  6358. func (c *DomainsInsertCall) doRequest(alt string) (*http.Response, error) {
  6359. reqHeaders := make(http.Header)
  6360. for k, v := range c.header_ {
  6361. reqHeaders[k] = v
  6362. }
  6363. reqHeaders.Set("User-Agent", c.s.userAgent())
  6364. var body io.Reader = nil
  6365. body, err := googleapi.WithoutDataWrapper.JSONReader(c.domains)
  6366. if err != nil {
  6367. return nil, err
  6368. }
  6369. reqHeaders.Set("Content-Type", "application/json")
  6370. c.urlParams_.Set("alt", alt)
  6371. c.urlParams_.Set("prettyPrint", "false")
  6372. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains")
  6373. urls += "?" + c.urlParams_.Encode()
  6374. req, err := http.NewRequest("POST", urls, body)
  6375. if err != nil {
  6376. return nil, err
  6377. }
  6378. req.Header = reqHeaders
  6379. googleapi.Expand(req.URL, map[string]string{
  6380. "customer": c.customer,
  6381. })
  6382. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6383. }
  6384. // Do executes the "directory.domains.insert" call.
  6385. // Exactly one of *Domains or error will be non-nil. Any non-2xx status
  6386. // code is an error. Response headers are in either
  6387. // *Domains.ServerResponse.Header or (if a response was returned at all)
  6388. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6389. // check whether the returned error was because http.StatusNotModified
  6390. // was returned.
  6391. func (c *DomainsInsertCall) Do(opts ...googleapi.CallOption) (*Domains, error) {
  6392. gensupport.SetOptions(c.urlParams_, opts...)
  6393. res, err := c.doRequest("json")
  6394. if res != nil && res.StatusCode == http.StatusNotModified {
  6395. if res.Body != nil {
  6396. res.Body.Close()
  6397. }
  6398. return nil, &googleapi.Error{
  6399. Code: res.StatusCode,
  6400. Header: res.Header,
  6401. }
  6402. }
  6403. if err != nil {
  6404. return nil, err
  6405. }
  6406. defer googleapi.CloseBody(res)
  6407. if err := googleapi.CheckResponse(res); err != nil {
  6408. return nil, err
  6409. }
  6410. ret := &Domains{
  6411. ServerResponse: googleapi.ServerResponse{
  6412. Header: res.Header,
  6413. HTTPStatusCode: res.StatusCode,
  6414. },
  6415. }
  6416. target := &ret
  6417. if err := gensupport.DecodeResponse(target, res); err != nil {
  6418. return nil, err
  6419. }
  6420. return ret, nil
  6421. // {
  6422. // "description": "Inserts a domain of the customer.",
  6423. // "httpMethod": "POST",
  6424. // "id": "directory.domains.insert",
  6425. // "parameterOrder": [
  6426. // "customer"
  6427. // ],
  6428. // "parameters": {
  6429. // "customer": {
  6430. // "description": "Immutable ID of the G Suite account.",
  6431. // "location": "path",
  6432. // "required": true,
  6433. // "type": "string"
  6434. // }
  6435. // },
  6436. // "path": "customer/{customer}/domains",
  6437. // "request": {
  6438. // "$ref": "Domains"
  6439. // },
  6440. // "response": {
  6441. // "$ref": "Domains"
  6442. // },
  6443. // "scopes": [
  6444. // "https://www.googleapis.com/auth/admin.directory.domain"
  6445. // ]
  6446. // }
  6447. }
  6448. // method id "directory.domains.list":
  6449. type DomainsListCall struct {
  6450. s *Service
  6451. customer string
  6452. urlParams_ gensupport.URLParams
  6453. ifNoneMatch_ string
  6454. ctx_ context.Context
  6455. header_ http.Header
  6456. }
  6457. // List: Lists the domains of the customer.
  6458. func (r *DomainsService) List(customer string) *DomainsListCall {
  6459. c := &DomainsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6460. c.customer = customer
  6461. return c
  6462. }
  6463. // Fields allows partial responses to be retrieved. See
  6464. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6465. // for more information.
  6466. func (c *DomainsListCall) Fields(s ...googleapi.Field) *DomainsListCall {
  6467. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6468. return c
  6469. }
  6470. // IfNoneMatch sets the optional parameter which makes the operation
  6471. // fail if the object's ETag matches the given value. This is useful for
  6472. // getting updates only after the object has changed since the last
  6473. // request. Use googleapi.IsNotModified to check whether the response
  6474. // error from Do is the result of In-None-Match.
  6475. func (c *DomainsListCall) IfNoneMatch(entityTag string) *DomainsListCall {
  6476. c.ifNoneMatch_ = entityTag
  6477. return c
  6478. }
  6479. // Context sets the context to be used in this call's Do method. Any
  6480. // pending HTTP request will be aborted if the provided context is
  6481. // canceled.
  6482. func (c *DomainsListCall) Context(ctx context.Context) *DomainsListCall {
  6483. c.ctx_ = ctx
  6484. return c
  6485. }
  6486. // Header returns an http.Header that can be modified by the caller to
  6487. // add HTTP headers to the request.
  6488. func (c *DomainsListCall) Header() http.Header {
  6489. if c.header_ == nil {
  6490. c.header_ = make(http.Header)
  6491. }
  6492. return c.header_
  6493. }
  6494. func (c *DomainsListCall) doRequest(alt string) (*http.Response, error) {
  6495. reqHeaders := make(http.Header)
  6496. for k, v := range c.header_ {
  6497. reqHeaders[k] = v
  6498. }
  6499. reqHeaders.Set("User-Agent", c.s.userAgent())
  6500. if c.ifNoneMatch_ != "" {
  6501. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6502. }
  6503. var body io.Reader = nil
  6504. c.urlParams_.Set("alt", alt)
  6505. c.urlParams_.Set("prettyPrint", "false")
  6506. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains")
  6507. urls += "?" + c.urlParams_.Encode()
  6508. req, err := http.NewRequest("GET", urls, body)
  6509. if err != nil {
  6510. return nil, err
  6511. }
  6512. req.Header = reqHeaders
  6513. googleapi.Expand(req.URL, map[string]string{
  6514. "customer": c.customer,
  6515. })
  6516. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6517. }
  6518. // Do executes the "directory.domains.list" call.
  6519. // Exactly one of *Domains2 or error will be non-nil. Any non-2xx status
  6520. // code is an error. Response headers are in either
  6521. // *Domains2.ServerResponse.Header or (if a response was returned at
  6522. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6523. // to check whether the returned error was because
  6524. // http.StatusNotModified was returned.
  6525. func (c *DomainsListCall) Do(opts ...googleapi.CallOption) (*Domains2, error) {
  6526. gensupport.SetOptions(c.urlParams_, opts...)
  6527. res, err := c.doRequest("json")
  6528. if res != nil && res.StatusCode == http.StatusNotModified {
  6529. if res.Body != nil {
  6530. res.Body.Close()
  6531. }
  6532. return nil, &googleapi.Error{
  6533. Code: res.StatusCode,
  6534. Header: res.Header,
  6535. }
  6536. }
  6537. if err != nil {
  6538. return nil, err
  6539. }
  6540. defer googleapi.CloseBody(res)
  6541. if err := googleapi.CheckResponse(res); err != nil {
  6542. return nil, err
  6543. }
  6544. ret := &Domains2{
  6545. ServerResponse: googleapi.ServerResponse{
  6546. Header: res.Header,
  6547. HTTPStatusCode: res.StatusCode,
  6548. },
  6549. }
  6550. target := &ret
  6551. if err := gensupport.DecodeResponse(target, res); err != nil {
  6552. return nil, err
  6553. }
  6554. return ret, nil
  6555. // {
  6556. // "description": "Lists the domains of the customer.",
  6557. // "httpMethod": "GET",
  6558. // "id": "directory.domains.list",
  6559. // "parameterOrder": [
  6560. // "customer"
  6561. // ],
  6562. // "parameters": {
  6563. // "customer": {
  6564. // "description": "Immutable ID of the G Suite account.",
  6565. // "location": "path",
  6566. // "required": true,
  6567. // "type": "string"
  6568. // }
  6569. // },
  6570. // "path": "customer/{customer}/domains",
  6571. // "response": {
  6572. // "$ref": "Domains2"
  6573. // },
  6574. // "scopes": [
  6575. // "https://www.googleapis.com/auth/admin.directory.domain",
  6576. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  6577. // ]
  6578. // }
  6579. }
  6580. // method id "directory.groups.delete":
  6581. type GroupsDeleteCall struct {
  6582. s *Service
  6583. groupKey string
  6584. urlParams_ gensupport.URLParams
  6585. ctx_ context.Context
  6586. header_ http.Header
  6587. }
  6588. // Delete: Delete Group
  6589. func (r *GroupsService) Delete(groupKey string) *GroupsDeleteCall {
  6590. c := &GroupsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6591. c.groupKey = groupKey
  6592. return c
  6593. }
  6594. // Fields allows partial responses to be retrieved. See
  6595. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6596. // for more information.
  6597. func (c *GroupsDeleteCall) Fields(s ...googleapi.Field) *GroupsDeleteCall {
  6598. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6599. return c
  6600. }
  6601. // Context sets the context to be used in this call's Do method. Any
  6602. // pending HTTP request will be aborted if the provided context is
  6603. // canceled.
  6604. func (c *GroupsDeleteCall) Context(ctx context.Context) *GroupsDeleteCall {
  6605. c.ctx_ = ctx
  6606. return c
  6607. }
  6608. // Header returns an http.Header that can be modified by the caller to
  6609. // add HTTP headers to the request.
  6610. func (c *GroupsDeleteCall) Header() http.Header {
  6611. if c.header_ == nil {
  6612. c.header_ = make(http.Header)
  6613. }
  6614. return c.header_
  6615. }
  6616. func (c *GroupsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6617. reqHeaders := make(http.Header)
  6618. for k, v := range c.header_ {
  6619. reqHeaders[k] = v
  6620. }
  6621. reqHeaders.Set("User-Agent", c.s.userAgent())
  6622. var body io.Reader = nil
  6623. c.urlParams_.Set("alt", alt)
  6624. c.urlParams_.Set("prettyPrint", "false")
  6625. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  6626. urls += "?" + c.urlParams_.Encode()
  6627. req, err := http.NewRequest("DELETE", urls, body)
  6628. if err != nil {
  6629. return nil, err
  6630. }
  6631. req.Header = reqHeaders
  6632. googleapi.Expand(req.URL, map[string]string{
  6633. "groupKey": c.groupKey,
  6634. })
  6635. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6636. }
  6637. // Do executes the "directory.groups.delete" call.
  6638. func (c *GroupsDeleteCall) Do(opts ...googleapi.CallOption) error {
  6639. gensupport.SetOptions(c.urlParams_, opts...)
  6640. res, err := c.doRequest("json")
  6641. if err != nil {
  6642. return err
  6643. }
  6644. defer googleapi.CloseBody(res)
  6645. if err := googleapi.CheckResponse(res); err != nil {
  6646. return err
  6647. }
  6648. return nil
  6649. // {
  6650. // "description": "Delete Group",
  6651. // "httpMethod": "DELETE",
  6652. // "id": "directory.groups.delete",
  6653. // "parameterOrder": [
  6654. // "groupKey"
  6655. // ],
  6656. // "parameters": {
  6657. // "groupKey": {
  6658. // "description": "Email or immutable ID of the group",
  6659. // "location": "path",
  6660. // "required": true,
  6661. // "type": "string"
  6662. // }
  6663. // },
  6664. // "path": "groups/{groupKey}",
  6665. // "scopes": [
  6666. // "https://www.googleapis.com/auth/admin.directory.group"
  6667. // ]
  6668. // }
  6669. }
  6670. // method id "directory.groups.get":
  6671. type GroupsGetCall struct {
  6672. s *Service
  6673. groupKey string
  6674. urlParams_ gensupport.URLParams
  6675. ifNoneMatch_ string
  6676. ctx_ context.Context
  6677. header_ http.Header
  6678. }
  6679. // Get: Retrieve Group
  6680. func (r *GroupsService) Get(groupKey string) *GroupsGetCall {
  6681. c := &GroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6682. c.groupKey = groupKey
  6683. return c
  6684. }
  6685. // Fields allows partial responses to be retrieved. See
  6686. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6687. // for more information.
  6688. func (c *GroupsGetCall) Fields(s ...googleapi.Field) *GroupsGetCall {
  6689. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6690. return c
  6691. }
  6692. // IfNoneMatch sets the optional parameter which makes the operation
  6693. // fail if the object's ETag matches the given value. This is useful for
  6694. // getting updates only after the object has changed since the last
  6695. // request. Use googleapi.IsNotModified to check whether the response
  6696. // error from Do is the result of In-None-Match.
  6697. func (c *GroupsGetCall) IfNoneMatch(entityTag string) *GroupsGetCall {
  6698. c.ifNoneMatch_ = entityTag
  6699. return c
  6700. }
  6701. // Context sets the context to be used in this call's Do method. Any
  6702. // pending HTTP request will be aborted if the provided context is
  6703. // canceled.
  6704. func (c *GroupsGetCall) Context(ctx context.Context) *GroupsGetCall {
  6705. c.ctx_ = ctx
  6706. return c
  6707. }
  6708. // Header returns an http.Header that can be modified by the caller to
  6709. // add HTTP headers to the request.
  6710. func (c *GroupsGetCall) Header() http.Header {
  6711. if c.header_ == nil {
  6712. c.header_ = make(http.Header)
  6713. }
  6714. return c.header_
  6715. }
  6716. func (c *GroupsGetCall) doRequest(alt string) (*http.Response, error) {
  6717. reqHeaders := make(http.Header)
  6718. for k, v := range c.header_ {
  6719. reqHeaders[k] = v
  6720. }
  6721. reqHeaders.Set("User-Agent", c.s.userAgent())
  6722. if c.ifNoneMatch_ != "" {
  6723. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6724. }
  6725. var body io.Reader = nil
  6726. c.urlParams_.Set("alt", alt)
  6727. c.urlParams_.Set("prettyPrint", "false")
  6728. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  6729. urls += "?" + c.urlParams_.Encode()
  6730. req, err := http.NewRequest("GET", urls, body)
  6731. if err != nil {
  6732. return nil, err
  6733. }
  6734. req.Header = reqHeaders
  6735. googleapi.Expand(req.URL, map[string]string{
  6736. "groupKey": c.groupKey,
  6737. })
  6738. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6739. }
  6740. // Do executes the "directory.groups.get" call.
  6741. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  6742. // code is an error. Response headers are in either
  6743. // *Group.ServerResponse.Header or (if a response was returned at all)
  6744. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6745. // check whether the returned error was because http.StatusNotModified
  6746. // was returned.
  6747. func (c *GroupsGetCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  6748. gensupport.SetOptions(c.urlParams_, opts...)
  6749. res, err := c.doRequest("json")
  6750. if res != nil && res.StatusCode == http.StatusNotModified {
  6751. if res.Body != nil {
  6752. res.Body.Close()
  6753. }
  6754. return nil, &googleapi.Error{
  6755. Code: res.StatusCode,
  6756. Header: res.Header,
  6757. }
  6758. }
  6759. if err != nil {
  6760. return nil, err
  6761. }
  6762. defer googleapi.CloseBody(res)
  6763. if err := googleapi.CheckResponse(res); err != nil {
  6764. return nil, err
  6765. }
  6766. ret := &Group{
  6767. ServerResponse: googleapi.ServerResponse{
  6768. Header: res.Header,
  6769. HTTPStatusCode: res.StatusCode,
  6770. },
  6771. }
  6772. target := &ret
  6773. if err := gensupport.DecodeResponse(target, res); err != nil {
  6774. return nil, err
  6775. }
  6776. return ret, nil
  6777. // {
  6778. // "description": "Retrieve Group",
  6779. // "httpMethod": "GET",
  6780. // "id": "directory.groups.get",
  6781. // "parameterOrder": [
  6782. // "groupKey"
  6783. // ],
  6784. // "parameters": {
  6785. // "groupKey": {
  6786. // "description": "Email or immutable ID of the group",
  6787. // "location": "path",
  6788. // "required": true,
  6789. // "type": "string"
  6790. // }
  6791. // },
  6792. // "path": "groups/{groupKey}",
  6793. // "response": {
  6794. // "$ref": "Group"
  6795. // },
  6796. // "scopes": [
  6797. // "https://www.googleapis.com/auth/admin.directory.group",
  6798. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  6799. // ]
  6800. // }
  6801. }
  6802. // method id "directory.groups.insert":
  6803. type GroupsInsertCall struct {
  6804. s *Service
  6805. group *Group
  6806. urlParams_ gensupport.URLParams
  6807. ctx_ context.Context
  6808. header_ http.Header
  6809. }
  6810. // Insert: Create Group
  6811. func (r *GroupsService) Insert(group *Group) *GroupsInsertCall {
  6812. c := &GroupsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6813. c.group = group
  6814. return c
  6815. }
  6816. // Fields allows partial responses to be retrieved. See
  6817. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6818. // for more information.
  6819. func (c *GroupsInsertCall) Fields(s ...googleapi.Field) *GroupsInsertCall {
  6820. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6821. return c
  6822. }
  6823. // Context sets the context to be used in this call's Do method. Any
  6824. // pending HTTP request will be aborted if the provided context is
  6825. // canceled.
  6826. func (c *GroupsInsertCall) Context(ctx context.Context) *GroupsInsertCall {
  6827. c.ctx_ = ctx
  6828. return c
  6829. }
  6830. // Header returns an http.Header that can be modified by the caller to
  6831. // add HTTP headers to the request.
  6832. func (c *GroupsInsertCall) Header() http.Header {
  6833. if c.header_ == nil {
  6834. c.header_ = make(http.Header)
  6835. }
  6836. return c.header_
  6837. }
  6838. func (c *GroupsInsertCall) doRequest(alt string) (*http.Response, error) {
  6839. reqHeaders := make(http.Header)
  6840. for k, v := range c.header_ {
  6841. reqHeaders[k] = v
  6842. }
  6843. reqHeaders.Set("User-Agent", c.s.userAgent())
  6844. var body io.Reader = nil
  6845. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  6846. if err != nil {
  6847. return nil, err
  6848. }
  6849. reqHeaders.Set("Content-Type", "application/json")
  6850. c.urlParams_.Set("alt", alt)
  6851. c.urlParams_.Set("prettyPrint", "false")
  6852. urls := googleapi.ResolveRelative(c.s.BasePath, "groups")
  6853. urls += "?" + c.urlParams_.Encode()
  6854. req, err := http.NewRequest("POST", urls, body)
  6855. if err != nil {
  6856. return nil, err
  6857. }
  6858. req.Header = reqHeaders
  6859. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6860. }
  6861. // Do executes the "directory.groups.insert" call.
  6862. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  6863. // code is an error. Response headers are in either
  6864. // *Group.ServerResponse.Header or (if a response was returned at all)
  6865. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6866. // check whether the returned error was because http.StatusNotModified
  6867. // was returned.
  6868. func (c *GroupsInsertCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  6869. gensupport.SetOptions(c.urlParams_, opts...)
  6870. res, err := c.doRequest("json")
  6871. if res != nil && res.StatusCode == http.StatusNotModified {
  6872. if res.Body != nil {
  6873. res.Body.Close()
  6874. }
  6875. return nil, &googleapi.Error{
  6876. Code: res.StatusCode,
  6877. Header: res.Header,
  6878. }
  6879. }
  6880. if err != nil {
  6881. return nil, err
  6882. }
  6883. defer googleapi.CloseBody(res)
  6884. if err := googleapi.CheckResponse(res); err != nil {
  6885. return nil, err
  6886. }
  6887. ret := &Group{
  6888. ServerResponse: googleapi.ServerResponse{
  6889. Header: res.Header,
  6890. HTTPStatusCode: res.StatusCode,
  6891. },
  6892. }
  6893. target := &ret
  6894. if err := gensupport.DecodeResponse(target, res); err != nil {
  6895. return nil, err
  6896. }
  6897. return ret, nil
  6898. // {
  6899. // "description": "Create Group",
  6900. // "httpMethod": "POST",
  6901. // "id": "directory.groups.insert",
  6902. // "path": "groups",
  6903. // "request": {
  6904. // "$ref": "Group"
  6905. // },
  6906. // "response": {
  6907. // "$ref": "Group"
  6908. // },
  6909. // "scopes": [
  6910. // "https://www.googleapis.com/auth/admin.directory.group"
  6911. // ]
  6912. // }
  6913. }
  6914. // method id "directory.groups.list":
  6915. type GroupsListCall struct {
  6916. s *Service
  6917. urlParams_ gensupport.URLParams
  6918. ifNoneMatch_ string
  6919. ctx_ context.Context
  6920. header_ http.Header
  6921. }
  6922. // List: Retrieve all groups of a domain or of a user given a userKey
  6923. // (paginated)
  6924. func (r *GroupsService) List() *GroupsListCall {
  6925. c := &GroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6926. return c
  6927. }
  6928. // Customer sets the optional parameter "customer": Immutable ID of the
  6929. // G Suite account. In case of multi-domain, to fetch all groups for a
  6930. // customer, fill this field instead of domain.
  6931. func (c *GroupsListCall) Customer(customer string) *GroupsListCall {
  6932. c.urlParams_.Set("customer", customer)
  6933. return c
  6934. }
  6935. // Domain sets the optional parameter "domain": Name of the domain. Fill
  6936. // this field to get groups from only this domain. To return all groups
  6937. // in a multi-domain fill customer field instead.
  6938. func (c *GroupsListCall) Domain(domain string) *GroupsListCall {
  6939. c.urlParams_.Set("domain", domain)
  6940. return c
  6941. }
  6942. // MaxResults sets the optional parameter "maxResults": Maximum number
  6943. // of results to return. Default is 200
  6944. func (c *GroupsListCall) MaxResults(maxResults int64) *GroupsListCall {
  6945. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6946. return c
  6947. }
  6948. // OrderBy sets the optional parameter "orderBy": Column to use for
  6949. // sorting results
  6950. //
  6951. // Possible values:
  6952. // "email" - Email of the group.
  6953. func (c *GroupsListCall) OrderBy(orderBy string) *GroupsListCall {
  6954. c.urlParams_.Set("orderBy", orderBy)
  6955. return c
  6956. }
  6957. // PageToken sets the optional parameter "pageToken": Token to specify
  6958. // next page in the list
  6959. func (c *GroupsListCall) PageToken(pageToken string) *GroupsListCall {
  6960. c.urlParams_.Set("pageToken", pageToken)
  6961. return c
  6962. }
  6963. // Query sets the optional parameter "query": Query string search.
  6964. // Should be of the form "". Complete documentation is at
  6965. // https://developers.google.com/admin-sdk/directory/v1/guides/search-groups
  6966. func (c *GroupsListCall) Query(query string) *GroupsListCall {
  6967. c.urlParams_.Set("query", query)
  6968. return c
  6969. }
  6970. // SortOrder sets the optional parameter "sortOrder": Whether to return
  6971. // results in ascending or descending order. Only of use when orderBy is
  6972. // also used
  6973. //
  6974. // Possible values:
  6975. // "ASCENDING" - Ascending order.
  6976. // "DESCENDING" - Descending order.
  6977. func (c *GroupsListCall) SortOrder(sortOrder string) *GroupsListCall {
  6978. c.urlParams_.Set("sortOrder", sortOrder)
  6979. return c
  6980. }
  6981. // UserKey sets the optional parameter "userKey": Email or immutable Id
  6982. // of the user if only those groups are to be listed, the given user is
  6983. // a member of. If Id, it should match with id of user object
  6984. func (c *GroupsListCall) UserKey(userKey string) *GroupsListCall {
  6985. c.urlParams_.Set("userKey", userKey)
  6986. return c
  6987. }
  6988. // Fields allows partial responses to be retrieved. See
  6989. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6990. // for more information.
  6991. func (c *GroupsListCall) Fields(s ...googleapi.Field) *GroupsListCall {
  6992. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6993. return c
  6994. }
  6995. // IfNoneMatch sets the optional parameter which makes the operation
  6996. // fail if the object's ETag matches the given value. This is useful for
  6997. // getting updates only after the object has changed since the last
  6998. // request. Use googleapi.IsNotModified to check whether the response
  6999. // error from Do is the result of In-None-Match.
  7000. func (c *GroupsListCall) IfNoneMatch(entityTag string) *GroupsListCall {
  7001. c.ifNoneMatch_ = entityTag
  7002. return c
  7003. }
  7004. // Context sets the context to be used in this call's Do method. Any
  7005. // pending HTTP request will be aborted if the provided context is
  7006. // canceled.
  7007. func (c *GroupsListCall) Context(ctx context.Context) *GroupsListCall {
  7008. c.ctx_ = ctx
  7009. return c
  7010. }
  7011. // Header returns an http.Header that can be modified by the caller to
  7012. // add HTTP headers to the request.
  7013. func (c *GroupsListCall) Header() http.Header {
  7014. if c.header_ == nil {
  7015. c.header_ = make(http.Header)
  7016. }
  7017. return c.header_
  7018. }
  7019. func (c *GroupsListCall) doRequest(alt string) (*http.Response, error) {
  7020. reqHeaders := make(http.Header)
  7021. for k, v := range c.header_ {
  7022. reqHeaders[k] = v
  7023. }
  7024. reqHeaders.Set("User-Agent", c.s.userAgent())
  7025. if c.ifNoneMatch_ != "" {
  7026. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7027. }
  7028. var body io.Reader = nil
  7029. c.urlParams_.Set("alt", alt)
  7030. c.urlParams_.Set("prettyPrint", "false")
  7031. urls := googleapi.ResolveRelative(c.s.BasePath, "groups")
  7032. urls += "?" + c.urlParams_.Encode()
  7033. req, err := http.NewRequest("GET", urls, body)
  7034. if err != nil {
  7035. return nil, err
  7036. }
  7037. req.Header = reqHeaders
  7038. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7039. }
  7040. // Do executes the "directory.groups.list" call.
  7041. // Exactly one of *Groups or error will be non-nil. Any non-2xx status
  7042. // code is an error. Response headers are in either
  7043. // *Groups.ServerResponse.Header or (if a response was returned at all)
  7044. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7045. // check whether the returned error was because http.StatusNotModified
  7046. // was returned.
  7047. func (c *GroupsListCall) Do(opts ...googleapi.CallOption) (*Groups, error) {
  7048. gensupport.SetOptions(c.urlParams_, opts...)
  7049. res, err := c.doRequest("json")
  7050. if res != nil && res.StatusCode == http.StatusNotModified {
  7051. if res.Body != nil {
  7052. res.Body.Close()
  7053. }
  7054. return nil, &googleapi.Error{
  7055. Code: res.StatusCode,
  7056. Header: res.Header,
  7057. }
  7058. }
  7059. if err != nil {
  7060. return nil, err
  7061. }
  7062. defer googleapi.CloseBody(res)
  7063. if err := googleapi.CheckResponse(res); err != nil {
  7064. return nil, err
  7065. }
  7066. ret := &Groups{
  7067. ServerResponse: googleapi.ServerResponse{
  7068. Header: res.Header,
  7069. HTTPStatusCode: res.StatusCode,
  7070. },
  7071. }
  7072. target := &ret
  7073. if err := gensupport.DecodeResponse(target, res); err != nil {
  7074. return nil, err
  7075. }
  7076. return ret, nil
  7077. // {
  7078. // "description": "Retrieve all groups of a domain or of a user given a userKey (paginated)",
  7079. // "httpMethod": "GET",
  7080. // "id": "directory.groups.list",
  7081. // "parameters": {
  7082. // "customer": {
  7083. // "description": "Immutable ID of the G Suite account. In case of multi-domain, to fetch all groups for a customer, fill this field instead of domain.",
  7084. // "location": "query",
  7085. // "type": "string"
  7086. // },
  7087. // "domain": {
  7088. // "description": "Name of the domain. Fill this field to get groups from only this domain. To return all groups in a multi-domain fill customer field instead.",
  7089. // "location": "query",
  7090. // "type": "string"
  7091. // },
  7092. // "maxResults": {
  7093. // "description": "Maximum number of results to return. Default is 200",
  7094. // "format": "int32",
  7095. // "location": "query",
  7096. // "minimum": "1",
  7097. // "type": "integer"
  7098. // },
  7099. // "orderBy": {
  7100. // "description": "Column to use for sorting results",
  7101. // "enum": [
  7102. // "email"
  7103. // ],
  7104. // "enumDescriptions": [
  7105. // "Email of the group."
  7106. // ],
  7107. // "location": "query",
  7108. // "type": "string"
  7109. // },
  7110. // "pageToken": {
  7111. // "description": "Token to specify next page in the list",
  7112. // "location": "query",
  7113. // "type": "string"
  7114. // },
  7115. // "query": {
  7116. // "description": "Query string search. Should be of the form \"\". Complete documentation is at https://developers.google.com/admin-sdk/directory/v1/guides/search-groups",
  7117. // "location": "query",
  7118. // "type": "string"
  7119. // },
  7120. // "sortOrder": {
  7121. // "description": "Whether to return results in ascending or descending order. Only of use when orderBy is also used",
  7122. // "enum": [
  7123. // "ASCENDING",
  7124. // "DESCENDING"
  7125. // ],
  7126. // "enumDescriptions": [
  7127. // "Ascending order.",
  7128. // "Descending order."
  7129. // ],
  7130. // "location": "query",
  7131. // "type": "string"
  7132. // },
  7133. // "userKey": {
  7134. // "description": "Email or immutable Id of the user if only those groups are to be listed, the given user is a member of. If Id, it should match with id of user object",
  7135. // "location": "query",
  7136. // "type": "string"
  7137. // }
  7138. // },
  7139. // "path": "groups",
  7140. // "response": {
  7141. // "$ref": "Groups"
  7142. // },
  7143. // "scopes": [
  7144. // "https://www.googleapis.com/auth/admin.directory.group",
  7145. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  7146. // ]
  7147. // }
  7148. }
  7149. // Pages invokes f for each page of results.
  7150. // A non-nil error returned from f will halt the iteration.
  7151. // The provided context supersedes any context provided to the Context method.
  7152. func (c *GroupsListCall) Pages(ctx context.Context, f func(*Groups) error) error {
  7153. c.ctx_ = ctx
  7154. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7155. for {
  7156. x, err := c.Do()
  7157. if err != nil {
  7158. return err
  7159. }
  7160. if err := f(x); err != nil {
  7161. return err
  7162. }
  7163. if x.NextPageToken == "" {
  7164. return nil
  7165. }
  7166. c.PageToken(x.NextPageToken)
  7167. }
  7168. }
  7169. // method id "directory.groups.patch":
  7170. type GroupsPatchCall struct {
  7171. s *Service
  7172. groupKey string
  7173. group *Group
  7174. urlParams_ gensupport.URLParams
  7175. ctx_ context.Context
  7176. header_ http.Header
  7177. }
  7178. // Patch: Update Group. This method supports patch semantics.
  7179. func (r *GroupsService) Patch(groupKey string, group *Group) *GroupsPatchCall {
  7180. c := &GroupsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7181. c.groupKey = groupKey
  7182. c.group = group
  7183. return c
  7184. }
  7185. // Fields allows partial responses to be retrieved. See
  7186. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7187. // for more information.
  7188. func (c *GroupsPatchCall) Fields(s ...googleapi.Field) *GroupsPatchCall {
  7189. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7190. return c
  7191. }
  7192. // Context sets the context to be used in this call's Do method. Any
  7193. // pending HTTP request will be aborted if the provided context is
  7194. // canceled.
  7195. func (c *GroupsPatchCall) Context(ctx context.Context) *GroupsPatchCall {
  7196. c.ctx_ = ctx
  7197. return c
  7198. }
  7199. // Header returns an http.Header that can be modified by the caller to
  7200. // add HTTP headers to the request.
  7201. func (c *GroupsPatchCall) Header() http.Header {
  7202. if c.header_ == nil {
  7203. c.header_ = make(http.Header)
  7204. }
  7205. return c.header_
  7206. }
  7207. func (c *GroupsPatchCall) doRequest(alt string) (*http.Response, error) {
  7208. reqHeaders := make(http.Header)
  7209. for k, v := range c.header_ {
  7210. reqHeaders[k] = v
  7211. }
  7212. reqHeaders.Set("User-Agent", c.s.userAgent())
  7213. var body io.Reader = nil
  7214. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  7215. if err != nil {
  7216. return nil, err
  7217. }
  7218. reqHeaders.Set("Content-Type", "application/json")
  7219. c.urlParams_.Set("alt", alt)
  7220. c.urlParams_.Set("prettyPrint", "false")
  7221. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  7222. urls += "?" + c.urlParams_.Encode()
  7223. req, err := http.NewRequest("PATCH", urls, body)
  7224. if err != nil {
  7225. return nil, err
  7226. }
  7227. req.Header = reqHeaders
  7228. googleapi.Expand(req.URL, map[string]string{
  7229. "groupKey": c.groupKey,
  7230. })
  7231. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7232. }
  7233. // Do executes the "directory.groups.patch" call.
  7234. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  7235. // code is an error. Response headers are in either
  7236. // *Group.ServerResponse.Header or (if a response was returned at all)
  7237. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7238. // check whether the returned error was because http.StatusNotModified
  7239. // was returned.
  7240. func (c *GroupsPatchCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  7241. gensupport.SetOptions(c.urlParams_, opts...)
  7242. res, err := c.doRequest("json")
  7243. if res != nil && res.StatusCode == http.StatusNotModified {
  7244. if res.Body != nil {
  7245. res.Body.Close()
  7246. }
  7247. return nil, &googleapi.Error{
  7248. Code: res.StatusCode,
  7249. Header: res.Header,
  7250. }
  7251. }
  7252. if err != nil {
  7253. return nil, err
  7254. }
  7255. defer googleapi.CloseBody(res)
  7256. if err := googleapi.CheckResponse(res); err != nil {
  7257. return nil, err
  7258. }
  7259. ret := &Group{
  7260. ServerResponse: googleapi.ServerResponse{
  7261. Header: res.Header,
  7262. HTTPStatusCode: res.StatusCode,
  7263. },
  7264. }
  7265. target := &ret
  7266. if err := gensupport.DecodeResponse(target, res); err != nil {
  7267. return nil, err
  7268. }
  7269. return ret, nil
  7270. // {
  7271. // "description": "Update Group. This method supports patch semantics.",
  7272. // "httpMethod": "PATCH",
  7273. // "id": "directory.groups.patch",
  7274. // "parameterOrder": [
  7275. // "groupKey"
  7276. // ],
  7277. // "parameters": {
  7278. // "groupKey": {
  7279. // "description": "Email or immutable ID of the group. If ID, it should match with id of group object",
  7280. // "location": "path",
  7281. // "required": true,
  7282. // "type": "string"
  7283. // }
  7284. // },
  7285. // "path": "groups/{groupKey}",
  7286. // "request": {
  7287. // "$ref": "Group"
  7288. // },
  7289. // "response": {
  7290. // "$ref": "Group"
  7291. // },
  7292. // "scopes": [
  7293. // "https://www.googleapis.com/auth/admin.directory.group"
  7294. // ]
  7295. // }
  7296. }
  7297. // method id "directory.groups.update":
  7298. type GroupsUpdateCall struct {
  7299. s *Service
  7300. groupKey string
  7301. group *Group
  7302. urlParams_ gensupport.URLParams
  7303. ctx_ context.Context
  7304. header_ http.Header
  7305. }
  7306. // Update: Update Group
  7307. func (r *GroupsService) Update(groupKey string, group *Group) *GroupsUpdateCall {
  7308. c := &GroupsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7309. c.groupKey = groupKey
  7310. c.group = group
  7311. return c
  7312. }
  7313. // Fields allows partial responses to be retrieved. See
  7314. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7315. // for more information.
  7316. func (c *GroupsUpdateCall) Fields(s ...googleapi.Field) *GroupsUpdateCall {
  7317. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7318. return c
  7319. }
  7320. // Context sets the context to be used in this call's Do method. Any
  7321. // pending HTTP request will be aborted if the provided context is
  7322. // canceled.
  7323. func (c *GroupsUpdateCall) Context(ctx context.Context) *GroupsUpdateCall {
  7324. c.ctx_ = ctx
  7325. return c
  7326. }
  7327. // Header returns an http.Header that can be modified by the caller to
  7328. // add HTTP headers to the request.
  7329. func (c *GroupsUpdateCall) Header() http.Header {
  7330. if c.header_ == nil {
  7331. c.header_ = make(http.Header)
  7332. }
  7333. return c.header_
  7334. }
  7335. func (c *GroupsUpdateCall) doRequest(alt string) (*http.Response, error) {
  7336. reqHeaders := make(http.Header)
  7337. for k, v := range c.header_ {
  7338. reqHeaders[k] = v
  7339. }
  7340. reqHeaders.Set("User-Agent", c.s.userAgent())
  7341. var body io.Reader = nil
  7342. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  7343. if err != nil {
  7344. return nil, err
  7345. }
  7346. reqHeaders.Set("Content-Type", "application/json")
  7347. c.urlParams_.Set("alt", alt)
  7348. c.urlParams_.Set("prettyPrint", "false")
  7349. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  7350. urls += "?" + c.urlParams_.Encode()
  7351. req, err := http.NewRequest("PUT", urls, body)
  7352. if err != nil {
  7353. return nil, err
  7354. }
  7355. req.Header = reqHeaders
  7356. googleapi.Expand(req.URL, map[string]string{
  7357. "groupKey": c.groupKey,
  7358. })
  7359. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7360. }
  7361. // Do executes the "directory.groups.update" call.
  7362. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  7363. // code is an error. Response headers are in either
  7364. // *Group.ServerResponse.Header or (if a response was returned at all)
  7365. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7366. // check whether the returned error was because http.StatusNotModified
  7367. // was returned.
  7368. func (c *GroupsUpdateCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  7369. gensupport.SetOptions(c.urlParams_, opts...)
  7370. res, err := c.doRequest("json")
  7371. if res != nil && res.StatusCode == http.StatusNotModified {
  7372. if res.Body != nil {
  7373. res.Body.Close()
  7374. }
  7375. return nil, &googleapi.Error{
  7376. Code: res.StatusCode,
  7377. Header: res.Header,
  7378. }
  7379. }
  7380. if err != nil {
  7381. return nil, err
  7382. }
  7383. defer googleapi.CloseBody(res)
  7384. if err := googleapi.CheckResponse(res); err != nil {
  7385. return nil, err
  7386. }
  7387. ret := &Group{
  7388. ServerResponse: googleapi.ServerResponse{
  7389. Header: res.Header,
  7390. HTTPStatusCode: res.StatusCode,
  7391. },
  7392. }
  7393. target := &ret
  7394. if err := gensupport.DecodeResponse(target, res); err != nil {
  7395. return nil, err
  7396. }
  7397. return ret, nil
  7398. // {
  7399. // "description": "Update Group",
  7400. // "httpMethod": "PUT",
  7401. // "id": "directory.groups.update",
  7402. // "parameterOrder": [
  7403. // "groupKey"
  7404. // ],
  7405. // "parameters": {
  7406. // "groupKey": {
  7407. // "description": "Email or immutable ID of the group. If ID, it should match with id of group object",
  7408. // "location": "path",
  7409. // "required": true,
  7410. // "type": "string"
  7411. // }
  7412. // },
  7413. // "path": "groups/{groupKey}",
  7414. // "request": {
  7415. // "$ref": "Group"
  7416. // },
  7417. // "response": {
  7418. // "$ref": "Group"
  7419. // },
  7420. // "scopes": [
  7421. // "https://www.googleapis.com/auth/admin.directory.group"
  7422. // ]
  7423. // }
  7424. }
  7425. // method id "directory.groups.aliases.delete":
  7426. type GroupsAliasesDeleteCall struct {
  7427. s *Service
  7428. groupKey string
  7429. alias string
  7430. urlParams_ gensupport.URLParams
  7431. ctx_ context.Context
  7432. header_ http.Header
  7433. }
  7434. // Delete: Remove a alias for the group
  7435. func (r *GroupsAliasesService) Delete(groupKey string, alias string) *GroupsAliasesDeleteCall {
  7436. c := &GroupsAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7437. c.groupKey = groupKey
  7438. c.alias = alias
  7439. return c
  7440. }
  7441. // Fields allows partial responses to be retrieved. See
  7442. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7443. // for more information.
  7444. func (c *GroupsAliasesDeleteCall) Fields(s ...googleapi.Field) *GroupsAliasesDeleteCall {
  7445. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7446. return c
  7447. }
  7448. // Context sets the context to be used in this call's Do method. Any
  7449. // pending HTTP request will be aborted if the provided context is
  7450. // canceled.
  7451. func (c *GroupsAliasesDeleteCall) Context(ctx context.Context) *GroupsAliasesDeleteCall {
  7452. c.ctx_ = ctx
  7453. return c
  7454. }
  7455. // Header returns an http.Header that can be modified by the caller to
  7456. // add HTTP headers to the request.
  7457. func (c *GroupsAliasesDeleteCall) Header() http.Header {
  7458. if c.header_ == nil {
  7459. c.header_ = make(http.Header)
  7460. }
  7461. return c.header_
  7462. }
  7463. func (c *GroupsAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  7464. reqHeaders := make(http.Header)
  7465. for k, v := range c.header_ {
  7466. reqHeaders[k] = v
  7467. }
  7468. reqHeaders.Set("User-Agent", c.s.userAgent())
  7469. var body io.Reader = nil
  7470. c.urlParams_.Set("alt", alt)
  7471. c.urlParams_.Set("prettyPrint", "false")
  7472. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/aliases/{alias}")
  7473. urls += "?" + c.urlParams_.Encode()
  7474. req, err := http.NewRequest("DELETE", urls, body)
  7475. if err != nil {
  7476. return nil, err
  7477. }
  7478. req.Header = reqHeaders
  7479. googleapi.Expand(req.URL, map[string]string{
  7480. "groupKey": c.groupKey,
  7481. "alias": c.alias,
  7482. })
  7483. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7484. }
  7485. // Do executes the "directory.groups.aliases.delete" call.
  7486. func (c *GroupsAliasesDeleteCall) Do(opts ...googleapi.CallOption) error {
  7487. gensupport.SetOptions(c.urlParams_, opts...)
  7488. res, err := c.doRequest("json")
  7489. if err != nil {
  7490. return err
  7491. }
  7492. defer googleapi.CloseBody(res)
  7493. if err := googleapi.CheckResponse(res); err != nil {
  7494. return err
  7495. }
  7496. return nil
  7497. // {
  7498. // "description": "Remove a alias for the group",
  7499. // "httpMethod": "DELETE",
  7500. // "id": "directory.groups.aliases.delete",
  7501. // "parameterOrder": [
  7502. // "groupKey",
  7503. // "alias"
  7504. // ],
  7505. // "parameters": {
  7506. // "alias": {
  7507. // "description": "The alias to be removed",
  7508. // "location": "path",
  7509. // "required": true,
  7510. // "type": "string"
  7511. // },
  7512. // "groupKey": {
  7513. // "description": "Email or immutable ID of the group",
  7514. // "location": "path",
  7515. // "required": true,
  7516. // "type": "string"
  7517. // }
  7518. // },
  7519. // "path": "groups/{groupKey}/aliases/{alias}",
  7520. // "scopes": [
  7521. // "https://www.googleapis.com/auth/admin.directory.group"
  7522. // ]
  7523. // }
  7524. }
  7525. // method id "directory.groups.aliases.insert":
  7526. type GroupsAliasesInsertCall struct {
  7527. s *Service
  7528. groupKey string
  7529. alias *Alias
  7530. urlParams_ gensupport.URLParams
  7531. ctx_ context.Context
  7532. header_ http.Header
  7533. }
  7534. // Insert: Add a alias for the group
  7535. func (r *GroupsAliasesService) Insert(groupKey string, alias *Alias) *GroupsAliasesInsertCall {
  7536. c := &GroupsAliasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7537. c.groupKey = groupKey
  7538. c.alias = alias
  7539. return c
  7540. }
  7541. // Fields allows partial responses to be retrieved. See
  7542. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7543. // for more information.
  7544. func (c *GroupsAliasesInsertCall) Fields(s ...googleapi.Field) *GroupsAliasesInsertCall {
  7545. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7546. return c
  7547. }
  7548. // Context sets the context to be used in this call's Do method. Any
  7549. // pending HTTP request will be aborted if the provided context is
  7550. // canceled.
  7551. func (c *GroupsAliasesInsertCall) Context(ctx context.Context) *GroupsAliasesInsertCall {
  7552. c.ctx_ = ctx
  7553. return c
  7554. }
  7555. // Header returns an http.Header that can be modified by the caller to
  7556. // add HTTP headers to the request.
  7557. func (c *GroupsAliasesInsertCall) Header() http.Header {
  7558. if c.header_ == nil {
  7559. c.header_ = make(http.Header)
  7560. }
  7561. return c.header_
  7562. }
  7563. func (c *GroupsAliasesInsertCall) doRequest(alt string) (*http.Response, error) {
  7564. reqHeaders := make(http.Header)
  7565. for k, v := range c.header_ {
  7566. reqHeaders[k] = v
  7567. }
  7568. reqHeaders.Set("User-Agent", c.s.userAgent())
  7569. var body io.Reader = nil
  7570. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alias)
  7571. if err != nil {
  7572. return nil, err
  7573. }
  7574. reqHeaders.Set("Content-Type", "application/json")
  7575. c.urlParams_.Set("alt", alt)
  7576. c.urlParams_.Set("prettyPrint", "false")
  7577. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/aliases")
  7578. urls += "?" + c.urlParams_.Encode()
  7579. req, err := http.NewRequest("POST", urls, body)
  7580. if err != nil {
  7581. return nil, err
  7582. }
  7583. req.Header = reqHeaders
  7584. googleapi.Expand(req.URL, map[string]string{
  7585. "groupKey": c.groupKey,
  7586. })
  7587. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7588. }
  7589. // Do executes the "directory.groups.aliases.insert" call.
  7590. // Exactly one of *Alias or error will be non-nil. Any non-2xx status
  7591. // code is an error. Response headers are in either
  7592. // *Alias.ServerResponse.Header or (if a response was returned at all)
  7593. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7594. // check whether the returned error was because http.StatusNotModified
  7595. // was returned.
  7596. func (c *GroupsAliasesInsertCall) Do(opts ...googleapi.CallOption) (*Alias, error) {
  7597. gensupport.SetOptions(c.urlParams_, opts...)
  7598. res, err := c.doRequest("json")
  7599. if res != nil && res.StatusCode == http.StatusNotModified {
  7600. if res.Body != nil {
  7601. res.Body.Close()
  7602. }
  7603. return nil, &googleapi.Error{
  7604. Code: res.StatusCode,
  7605. Header: res.Header,
  7606. }
  7607. }
  7608. if err != nil {
  7609. return nil, err
  7610. }
  7611. defer googleapi.CloseBody(res)
  7612. if err := googleapi.CheckResponse(res); err != nil {
  7613. return nil, err
  7614. }
  7615. ret := &Alias{
  7616. ServerResponse: googleapi.ServerResponse{
  7617. Header: res.Header,
  7618. HTTPStatusCode: res.StatusCode,
  7619. },
  7620. }
  7621. target := &ret
  7622. if err := gensupport.DecodeResponse(target, res); err != nil {
  7623. return nil, err
  7624. }
  7625. return ret, nil
  7626. // {
  7627. // "description": "Add a alias for the group",
  7628. // "httpMethod": "POST",
  7629. // "id": "directory.groups.aliases.insert",
  7630. // "parameterOrder": [
  7631. // "groupKey"
  7632. // ],
  7633. // "parameters": {
  7634. // "groupKey": {
  7635. // "description": "Email or immutable ID of the group",
  7636. // "location": "path",
  7637. // "required": true,
  7638. // "type": "string"
  7639. // }
  7640. // },
  7641. // "path": "groups/{groupKey}/aliases",
  7642. // "request": {
  7643. // "$ref": "Alias"
  7644. // },
  7645. // "response": {
  7646. // "$ref": "Alias"
  7647. // },
  7648. // "scopes": [
  7649. // "https://www.googleapis.com/auth/admin.directory.group"
  7650. // ]
  7651. // }
  7652. }
  7653. // method id "directory.groups.aliases.list":
  7654. type GroupsAliasesListCall struct {
  7655. s *Service
  7656. groupKey string
  7657. urlParams_ gensupport.URLParams
  7658. ifNoneMatch_ string
  7659. ctx_ context.Context
  7660. header_ http.Header
  7661. }
  7662. // List: List all aliases for a group
  7663. func (r *GroupsAliasesService) List(groupKey string) *GroupsAliasesListCall {
  7664. c := &GroupsAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7665. c.groupKey = groupKey
  7666. return c
  7667. }
  7668. // Fields allows partial responses to be retrieved. See
  7669. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7670. // for more information.
  7671. func (c *GroupsAliasesListCall) Fields(s ...googleapi.Field) *GroupsAliasesListCall {
  7672. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7673. return c
  7674. }
  7675. // IfNoneMatch sets the optional parameter which makes the operation
  7676. // fail if the object's ETag matches the given value. This is useful for
  7677. // getting updates only after the object has changed since the last
  7678. // request. Use googleapi.IsNotModified to check whether the response
  7679. // error from Do is the result of In-None-Match.
  7680. func (c *GroupsAliasesListCall) IfNoneMatch(entityTag string) *GroupsAliasesListCall {
  7681. c.ifNoneMatch_ = entityTag
  7682. return c
  7683. }
  7684. // Context sets the context to be used in this call's Do method. Any
  7685. // pending HTTP request will be aborted if the provided context is
  7686. // canceled.
  7687. func (c *GroupsAliasesListCall) Context(ctx context.Context) *GroupsAliasesListCall {
  7688. c.ctx_ = ctx
  7689. return c
  7690. }
  7691. // Header returns an http.Header that can be modified by the caller to
  7692. // add HTTP headers to the request.
  7693. func (c *GroupsAliasesListCall) Header() http.Header {
  7694. if c.header_ == nil {
  7695. c.header_ = make(http.Header)
  7696. }
  7697. return c.header_
  7698. }
  7699. func (c *GroupsAliasesListCall) doRequest(alt string) (*http.Response, error) {
  7700. reqHeaders := make(http.Header)
  7701. for k, v := range c.header_ {
  7702. reqHeaders[k] = v
  7703. }
  7704. reqHeaders.Set("User-Agent", c.s.userAgent())
  7705. if c.ifNoneMatch_ != "" {
  7706. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7707. }
  7708. var body io.Reader = nil
  7709. c.urlParams_.Set("alt", alt)
  7710. c.urlParams_.Set("prettyPrint", "false")
  7711. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/aliases")
  7712. urls += "?" + c.urlParams_.Encode()
  7713. req, err := http.NewRequest("GET", urls, body)
  7714. if err != nil {
  7715. return nil, err
  7716. }
  7717. req.Header = reqHeaders
  7718. googleapi.Expand(req.URL, map[string]string{
  7719. "groupKey": c.groupKey,
  7720. })
  7721. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7722. }
  7723. // Do executes the "directory.groups.aliases.list" call.
  7724. // Exactly one of *Aliases or error will be non-nil. Any non-2xx status
  7725. // code is an error. Response headers are in either
  7726. // *Aliases.ServerResponse.Header or (if a response was returned at all)
  7727. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7728. // check whether the returned error was because http.StatusNotModified
  7729. // was returned.
  7730. func (c *GroupsAliasesListCall) Do(opts ...googleapi.CallOption) (*Aliases, error) {
  7731. gensupport.SetOptions(c.urlParams_, opts...)
  7732. res, err := c.doRequest("json")
  7733. if res != nil && res.StatusCode == http.StatusNotModified {
  7734. if res.Body != nil {
  7735. res.Body.Close()
  7736. }
  7737. return nil, &googleapi.Error{
  7738. Code: res.StatusCode,
  7739. Header: res.Header,
  7740. }
  7741. }
  7742. if err != nil {
  7743. return nil, err
  7744. }
  7745. defer googleapi.CloseBody(res)
  7746. if err := googleapi.CheckResponse(res); err != nil {
  7747. return nil, err
  7748. }
  7749. ret := &Aliases{
  7750. ServerResponse: googleapi.ServerResponse{
  7751. Header: res.Header,
  7752. HTTPStatusCode: res.StatusCode,
  7753. },
  7754. }
  7755. target := &ret
  7756. if err := gensupport.DecodeResponse(target, res); err != nil {
  7757. return nil, err
  7758. }
  7759. return ret, nil
  7760. // {
  7761. // "description": "List all aliases for a group",
  7762. // "httpMethod": "GET",
  7763. // "id": "directory.groups.aliases.list",
  7764. // "parameterOrder": [
  7765. // "groupKey"
  7766. // ],
  7767. // "parameters": {
  7768. // "groupKey": {
  7769. // "description": "Email or immutable ID of the group",
  7770. // "location": "path",
  7771. // "required": true,
  7772. // "type": "string"
  7773. // }
  7774. // },
  7775. // "path": "groups/{groupKey}/aliases",
  7776. // "response": {
  7777. // "$ref": "Aliases"
  7778. // },
  7779. // "scopes": [
  7780. // "https://www.googleapis.com/auth/admin.directory.group",
  7781. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  7782. // ],
  7783. // "supportsSubscription": true
  7784. // }
  7785. }
  7786. // method id "directory.members.delete":
  7787. type MembersDeleteCall struct {
  7788. s *Service
  7789. groupKey string
  7790. memberKey string
  7791. urlParams_ gensupport.URLParams
  7792. ctx_ context.Context
  7793. header_ http.Header
  7794. }
  7795. // Delete: Remove membership.
  7796. func (r *MembersService) Delete(groupKey string, memberKey string) *MembersDeleteCall {
  7797. c := &MembersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7798. c.groupKey = groupKey
  7799. c.memberKey = memberKey
  7800. return c
  7801. }
  7802. // Fields allows partial responses to be retrieved. See
  7803. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7804. // for more information.
  7805. func (c *MembersDeleteCall) Fields(s ...googleapi.Field) *MembersDeleteCall {
  7806. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7807. return c
  7808. }
  7809. // Context sets the context to be used in this call's Do method. Any
  7810. // pending HTTP request will be aborted if the provided context is
  7811. // canceled.
  7812. func (c *MembersDeleteCall) Context(ctx context.Context) *MembersDeleteCall {
  7813. c.ctx_ = ctx
  7814. return c
  7815. }
  7816. // Header returns an http.Header that can be modified by the caller to
  7817. // add HTTP headers to the request.
  7818. func (c *MembersDeleteCall) Header() http.Header {
  7819. if c.header_ == nil {
  7820. c.header_ = make(http.Header)
  7821. }
  7822. return c.header_
  7823. }
  7824. func (c *MembersDeleteCall) doRequest(alt string) (*http.Response, error) {
  7825. reqHeaders := make(http.Header)
  7826. for k, v := range c.header_ {
  7827. reqHeaders[k] = v
  7828. }
  7829. reqHeaders.Set("User-Agent", c.s.userAgent())
  7830. var body io.Reader = nil
  7831. c.urlParams_.Set("alt", alt)
  7832. c.urlParams_.Set("prettyPrint", "false")
  7833. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  7834. urls += "?" + c.urlParams_.Encode()
  7835. req, err := http.NewRequest("DELETE", urls, body)
  7836. if err != nil {
  7837. return nil, err
  7838. }
  7839. req.Header = reqHeaders
  7840. googleapi.Expand(req.URL, map[string]string{
  7841. "groupKey": c.groupKey,
  7842. "memberKey": c.memberKey,
  7843. })
  7844. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7845. }
  7846. // Do executes the "directory.members.delete" call.
  7847. func (c *MembersDeleteCall) Do(opts ...googleapi.CallOption) error {
  7848. gensupport.SetOptions(c.urlParams_, opts...)
  7849. res, err := c.doRequest("json")
  7850. if err != nil {
  7851. return err
  7852. }
  7853. defer googleapi.CloseBody(res)
  7854. if err := googleapi.CheckResponse(res); err != nil {
  7855. return err
  7856. }
  7857. return nil
  7858. // {
  7859. // "description": "Remove membership.",
  7860. // "httpMethod": "DELETE",
  7861. // "id": "directory.members.delete",
  7862. // "parameterOrder": [
  7863. // "groupKey",
  7864. // "memberKey"
  7865. // ],
  7866. // "parameters": {
  7867. // "groupKey": {
  7868. // "description": "Email or immutable ID of the group",
  7869. // "location": "path",
  7870. // "required": true,
  7871. // "type": "string"
  7872. // },
  7873. // "memberKey": {
  7874. // "description": "Email or immutable ID of the member",
  7875. // "location": "path",
  7876. // "required": true,
  7877. // "type": "string"
  7878. // }
  7879. // },
  7880. // "path": "groups/{groupKey}/members/{memberKey}",
  7881. // "scopes": [
  7882. // "https://www.googleapis.com/auth/admin.directory.group",
  7883. // "https://www.googleapis.com/auth/admin.directory.group.member"
  7884. // ]
  7885. // }
  7886. }
  7887. // method id "directory.members.get":
  7888. type MembersGetCall struct {
  7889. s *Service
  7890. groupKey string
  7891. memberKey string
  7892. urlParams_ gensupport.URLParams
  7893. ifNoneMatch_ string
  7894. ctx_ context.Context
  7895. header_ http.Header
  7896. }
  7897. // Get: Retrieve Group Member
  7898. func (r *MembersService) Get(groupKey string, memberKey string) *MembersGetCall {
  7899. c := &MembersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7900. c.groupKey = groupKey
  7901. c.memberKey = memberKey
  7902. return c
  7903. }
  7904. // Fields allows partial responses to be retrieved. See
  7905. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7906. // for more information.
  7907. func (c *MembersGetCall) Fields(s ...googleapi.Field) *MembersGetCall {
  7908. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7909. return c
  7910. }
  7911. // IfNoneMatch sets the optional parameter which makes the operation
  7912. // fail if the object's ETag matches the given value. This is useful for
  7913. // getting updates only after the object has changed since the last
  7914. // request. Use googleapi.IsNotModified to check whether the response
  7915. // error from Do is the result of In-None-Match.
  7916. func (c *MembersGetCall) IfNoneMatch(entityTag string) *MembersGetCall {
  7917. c.ifNoneMatch_ = entityTag
  7918. return c
  7919. }
  7920. // Context sets the context to be used in this call's Do method. Any
  7921. // pending HTTP request will be aborted if the provided context is
  7922. // canceled.
  7923. func (c *MembersGetCall) Context(ctx context.Context) *MembersGetCall {
  7924. c.ctx_ = ctx
  7925. return c
  7926. }
  7927. // Header returns an http.Header that can be modified by the caller to
  7928. // add HTTP headers to the request.
  7929. func (c *MembersGetCall) Header() http.Header {
  7930. if c.header_ == nil {
  7931. c.header_ = make(http.Header)
  7932. }
  7933. return c.header_
  7934. }
  7935. func (c *MembersGetCall) doRequest(alt string) (*http.Response, error) {
  7936. reqHeaders := make(http.Header)
  7937. for k, v := range c.header_ {
  7938. reqHeaders[k] = v
  7939. }
  7940. reqHeaders.Set("User-Agent", c.s.userAgent())
  7941. if c.ifNoneMatch_ != "" {
  7942. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7943. }
  7944. var body io.Reader = nil
  7945. c.urlParams_.Set("alt", alt)
  7946. c.urlParams_.Set("prettyPrint", "false")
  7947. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  7948. urls += "?" + c.urlParams_.Encode()
  7949. req, err := http.NewRequest("GET", urls, body)
  7950. if err != nil {
  7951. return nil, err
  7952. }
  7953. req.Header = reqHeaders
  7954. googleapi.Expand(req.URL, map[string]string{
  7955. "groupKey": c.groupKey,
  7956. "memberKey": c.memberKey,
  7957. })
  7958. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7959. }
  7960. // Do executes the "directory.members.get" call.
  7961. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  7962. // code is an error. Response headers are in either
  7963. // *Member.ServerResponse.Header or (if a response was returned at all)
  7964. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7965. // check whether the returned error was because http.StatusNotModified
  7966. // was returned.
  7967. func (c *MembersGetCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  7968. gensupport.SetOptions(c.urlParams_, opts...)
  7969. res, err := c.doRequest("json")
  7970. if res != nil && res.StatusCode == http.StatusNotModified {
  7971. if res.Body != nil {
  7972. res.Body.Close()
  7973. }
  7974. return nil, &googleapi.Error{
  7975. Code: res.StatusCode,
  7976. Header: res.Header,
  7977. }
  7978. }
  7979. if err != nil {
  7980. return nil, err
  7981. }
  7982. defer googleapi.CloseBody(res)
  7983. if err := googleapi.CheckResponse(res); err != nil {
  7984. return nil, err
  7985. }
  7986. ret := &Member{
  7987. ServerResponse: googleapi.ServerResponse{
  7988. Header: res.Header,
  7989. HTTPStatusCode: res.StatusCode,
  7990. },
  7991. }
  7992. target := &ret
  7993. if err := gensupport.DecodeResponse(target, res); err != nil {
  7994. return nil, err
  7995. }
  7996. return ret, nil
  7997. // {
  7998. // "description": "Retrieve Group Member",
  7999. // "httpMethod": "GET",
  8000. // "id": "directory.members.get",
  8001. // "parameterOrder": [
  8002. // "groupKey",
  8003. // "memberKey"
  8004. // ],
  8005. // "parameters": {
  8006. // "groupKey": {
  8007. // "description": "Email or immutable ID of the group",
  8008. // "location": "path",
  8009. // "required": true,
  8010. // "type": "string"
  8011. // },
  8012. // "memberKey": {
  8013. // "description": "Email or immutable ID of the member",
  8014. // "location": "path",
  8015. // "required": true,
  8016. // "type": "string"
  8017. // }
  8018. // },
  8019. // "path": "groups/{groupKey}/members/{memberKey}",
  8020. // "response": {
  8021. // "$ref": "Member"
  8022. // },
  8023. // "scopes": [
  8024. // "https://www.googleapis.com/auth/admin.directory.group",
  8025. // "https://www.googleapis.com/auth/admin.directory.group.member",
  8026. // "https://www.googleapis.com/auth/admin.directory.group.member.readonly",
  8027. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  8028. // ]
  8029. // }
  8030. }
  8031. // method id "directory.members.hasMember":
  8032. type MembersHasMemberCall struct {
  8033. s *Service
  8034. groupKey string
  8035. memberKey string
  8036. urlParams_ gensupport.URLParams
  8037. ifNoneMatch_ string
  8038. ctx_ context.Context
  8039. header_ http.Header
  8040. }
  8041. // HasMember: Checks whether the given user is a member of the group.
  8042. // Membership can be direct or nested.
  8043. func (r *MembersService) HasMember(groupKey string, memberKey string) *MembersHasMemberCall {
  8044. c := &MembersHasMemberCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8045. c.groupKey = groupKey
  8046. c.memberKey = memberKey
  8047. return c
  8048. }
  8049. // Fields allows partial responses to be retrieved. See
  8050. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8051. // for more information.
  8052. func (c *MembersHasMemberCall) Fields(s ...googleapi.Field) *MembersHasMemberCall {
  8053. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8054. return c
  8055. }
  8056. // IfNoneMatch sets the optional parameter which makes the operation
  8057. // fail if the object's ETag matches the given value. This is useful for
  8058. // getting updates only after the object has changed since the last
  8059. // request. Use googleapi.IsNotModified to check whether the response
  8060. // error from Do is the result of In-None-Match.
  8061. func (c *MembersHasMemberCall) IfNoneMatch(entityTag string) *MembersHasMemberCall {
  8062. c.ifNoneMatch_ = entityTag
  8063. return c
  8064. }
  8065. // Context sets the context to be used in this call's Do method. Any
  8066. // pending HTTP request will be aborted if the provided context is
  8067. // canceled.
  8068. func (c *MembersHasMemberCall) Context(ctx context.Context) *MembersHasMemberCall {
  8069. c.ctx_ = ctx
  8070. return c
  8071. }
  8072. // Header returns an http.Header that can be modified by the caller to
  8073. // add HTTP headers to the request.
  8074. func (c *MembersHasMemberCall) Header() http.Header {
  8075. if c.header_ == nil {
  8076. c.header_ = make(http.Header)
  8077. }
  8078. return c.header_
  8079. }
  8080. func (c *MembersHasMemberCall) doRequest(alt string) (*http.Response, error) {
  8081. reqHeaders := make(http.Header)
  8082. for k, v := range c.header_ {
  8083. reqHeaders[k] = v
  8084. }
  8085. reqHeaders.Set("User-Agent", c.s.userAgent())
  8086. if c.ifNoneMatch_ != "" {
  8087. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8088. }
  8089. var body io.Reader = nil
  8090. c.urlParams_.Set("alt", alt)
  8091. c.urlParams_.Set("prettyPrint", "false")
  8092. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/hasMember/{memberKey}")
  8093. urls += "?" + c.urlParams_.Encode()
  8094. req, err := http.NewRequest("GET", urls, body)
  8095. if err != nil {
  8096. return nil, err
  8097. }
  8098. req.Header = reqHeaders
  8099. googleapi.Expand(req.URL, map[string]string{
  8100. "groupKey": c.groupKey,
  8101. "memberKey": c.memberKey,
  8102. })
  8103. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8104. }
  8105. // Do executes the "directory.members.hasMember" call.
  8106. // Exactly one of *MembersHasMember or error will be non-nil. Any
  8107. // non-2xx status code is an error. Response headers are in either
  8108. // *MembersHasMember.ServerResponse.Header or (if a response was
  8109. // returned at all) in error.(*googleapi.Error).Header. Use
  8110. // googleapi.IsNotModified to check whether the returned error was
  8111. // because http.StatusNotModified was returned.
  8112. func (c *MembersHasMemberCall) Do(opts ...googleapi.CallOption) (*MembersHasMember, error) {
  8113. gensupport.SetOptions(c.urlParams_, opts...)
  8114. res, err := c.doRequest("json")
  8115. if res != nil && res.StatusCode == http.StatusNotModified {
  8116. if res.Body != nil {
  8117. res.Body.Close()
  8118. }
  8119. return nil, &googleapi.Error{
  8120. Code: res.StatusCode,
  8121. Header: res.Header,
  8122. }
  8123. }
  8124. if err != nil {
  8125. return nil, err
  8126. }
  8127. defer googleapi.CloseBody(res)
  8128. if err := googleapi.CheckResponse(res); err != nil {
  8129. return nil, err
  8130. }
  8131. ret := &MembersHasMember{
  8132. ServerResponse: googleapi.ServerResponse{
  8133. Header: res.Header,
  8134. HTTPStatusCode: res.StatusCode,
  8135. },
  8136. }
  8137. target := &ret
  8138. if err := gensupport.DecodeResponse(target, res); err != nil {
  8139. return nil, err
  8140. }
  8141. return ret, nil
  8142. // {
  8143. // "description": "Checks whether the given user is a member of the group. Membership can be direct or nested.",
  8144. // "httpMethod": "GET",
  8145. // "id": "directory.members.hasMember",
  8146. // "parameterOrder": [
  8147. // "groupKey",
  8148. // "memberKey"
  8149. // ],
  8150. // "parameters": {
  8151. // "groupKey": {
  8152. // "description": "Identifies the group in the API request. The value can be the group's email address, group alias, or the unique group ID.",
  8153. // "location": "path",
  8154. // "required": true,
  8155. // "type": "string"
  8156. // },
  8157. // "memberKey": {
  8158. // "description": "Identifies the user member in the API request. The value can be the user's primary email address, alias, or unique ID.",
  8159. // "location": "path",
  8160. // "required": true,
  8161. // "type": "string"
  8162. // }
  8163. // },
  8164. // "path": "groups/{groupKey}/hasMember/{memberKey}",
  8165. // "response": {
  8166. // "$ref": "MembersHasMember"
  8167. // },
  8168. // "scopes": [
  8169. // "https://www.googleapis.com/auth/admin.directory.group",
  8170. // "https://www.googleapis.com/auth/admin.directory.group.member",
  8171. // "https://www.googleapis.com/auth/admin.directory.group.member.readonly",
  8172. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  8173. // ]
  8174. // }
  8175. }
  8176. // method id "directory.members.insert":
  8177. type MembersInsertCall struct {
  8178. s *Service
  8179. groupKey string
  8180. member *Member
  8181. urlParams_ gensupport.URLParams
  8182. ctx_ context.Context
  8183. header_ http.Header
  8184. }
  8185. // Insert: Add user to the specified group.
  8186. func (r *MembersService) Insert(groupKey string, member *Member) *MembersInsertCall {
  8187. c := &MembersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8188. c.groupKey = groupKey
  8189. c.member = member
  8190. return c
  8191. }
  8192. // Fields allows partial responses to be retrieved. See
  8193. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8194. // for more information.
  8195. func (c *MembersInsertCall) Fields(s ...googleapi.Field) *MembersInsertCall {
  8196. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8197. return c
  8198. }
  8199. // Context sets the context to be used in this call's Do method. Any
  8200. // pending HTTP request will be aborted if the provided context is
  8201. // canceled.
  8202. func (c *MembersInsertCall) Context(ctx context.Context) *MembersInsertCall {
  8203. c.ctx_ = ctx
  8204. return c
  8205. }
  8206. // Header returns an http.Header that can be modified by the caller to
  8207. // add HTTP headers to the request.
  8208. func (c *MembersInsertCall) Header() http.Header {
  8209. if c.header_ == nil {
  8210. c.header_ = make(http.Header)
  8211. }
  8212. return c.header_
  8213. }
  8214. func (c *MembersInsertCall) doRequest(alt string) (*http.Response, error) {
  8215. reqHeaders := make(http.Header)
  8216. for k, v := range c.header_ {
  8217. reqHeaders[k] = v
  8218. }
  8219. reqHeaders.Set("User-Agent", c.s.userAgent())
  8220. var body io.Reader = nil
  8221. body, err := googleapi.WithoutDataWrapper.JSONReader(c.member)
  8222. if err != nil {
  8223. return nil, err
  8224. }
  8225. reqHeaders.Set("Content-Type", "application/json")
  8226. c.urlParams_.Set("alt", alt)
  8227. c.urlParams_.Set("prettyPrint", "false")
  8228. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members")
  8229. urls += "?" + c.urlParams_.Encode()
  8230. req, err := http.NewRequest("POST", urls, body)
  8231. if err != nil {
  8232. return nil, err
  8233. }
  8234. req.Header = reqHeaders
  8235. googleapi.Expand(req.URL, map[string]string{
  8236. "groupKey": c.groupKey,
  8237. })
  8238. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8239. }
  8240. // Do executes the "directory.members.insert" call.
  8241. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  8242. // code is an error. Response headers are in either
  8243. // *Member.ServerResponse.Header or (if a response was returned at all)
  8244. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8245. // check whether the returned error was because http.StatusNotModified
  8246. // was returned.
  8247. func (c *MembersInsertCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  8248. gensupport.SetOptions(c.urlParams_, opts...)
  8249. res, err := c.doRequest("json")
  8250. if res != nil && res.StatusCode == http.StatusNotModified {
  8251. if res.Body != nil {
  8252. res.Body.Close()
  8253. }
  8254. return nil, &googleapi.Error{
  8255. Code: res.StatusCode,
  8256. Header: res.Header,
  8257. }
  8258. }
  8259. if err != nil {
  8260. return nil, err
  8261. }
  8262. defer googleapi.CloseBody(res)
  8263. if err := googleapi.CheckResponse(res); err != nil {
  8264. return nil, err
  8265. }
  8266. ret := &Member{
  8267. ServerResponse: googleapi.ServerResponse{
  8268. Header: res.Header,
  8269. HTTPStatusCode: res.StatusCode,
  8270. },
  8271. }
  8272. target := &ret
  8273. if err := gensupport.DecodeResponse(target, res); err != nil {
  8274. return nil, err
  8275. }
  8276. return ret, nil
  8277. // {
  8278. // "description": "Add user to the specified group.",
  8279. // "httpMethod": "POST",
  8280. // "id": "directory.members.insert",
  8281. // "parameterOrder": [
  8282. // "groupKey"
  8283. // ],
  8284. // "parameters": {
  8285. // "groupKey": {
  8286. // "description": "Email or immutable ID of the group",
  8287. // "location": "path",
  8288. // "required": true,
  8289. // "type": "string"
  8290. // }
  8291. // },
  8292. // "path": "groups/{groupKey}/members",
  8293. // "request": {
  8294. // "$ref": "Member"
  8295. // },
  8296. // "response": {
  8297. // "$ref": "Member"
  8298. // },
  8299. // "scopes": [
  8300. // "https://www.googleapis.com/auth/admin.directory.group",
  8301. // "https://www.googleapis.com/auth/admin.directory.group.member"
  8302. // ]
  8303. // }
  8304. }
  8305. // method id "directory.members.list":
  8306. type MembersListCall struct {
  8307. s *Service
  8308. groupKey string
  8309. urlParams_ gensupport.URLParams
  8310. ifNoneMatch_ string
  8311. ctx_ context.Context
  8312. header_ http.Header
  8313. }
  8314. // List: Retrieve all members in a group (paginated)
  8315. func (r *MembersService) List(groupKey string) *MembersListCall {
  8316. c := &MembersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8317. c.groupKey = groupKey
  8318. return c
  8319. }
  8320. // IncludeDerivedMembership sets the optional parameter
  8321. // "includeDerivedMembership": Whether to list indirect memberships.
  8322. // Default: false.
  8323. func (c *MembersListCall) IncludeDerivedMembership(includeDerivedMembership bool) *MembersListCall {
  8324. c.urlParams_.Set("includeDerivedMembership", fmt.Sprint(includeDerivedMembership))
  8325. return c
  8326. }
  8327. // MaxResults sets the optional parameter "maxResults": Maximum number
  8328. // of results to return. Default is 200
  8329. func (c *MembersListCall) MaxResults(maxResults int64) *MembersListCall {
  8330. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  8331. return c
  8332. }
  8333. // PageToken sets the optional parameter "pageToken": Token to specify
  8334. // next page in the list
  8335. func (c *MembersListCall) PageToken(pageToken string) *MembersListCall {
  8336. c.urlParams_.Set("pageToken", pageToken)
  8337. return c
  8338. }
  8339. // Roles sets the optional parameter "roles": Comma separated role
  8340. // values to filter list results on.
  8341. func (c *MembersListCall) Roles(roles string) *MembersListCall {
  8342. c.urlParams_.Set("roles", roles)
  8343. return c
  8344. }
  8345. // Fields allows partial responses to be retrieved. See
  8346. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8347. // for more information.
  8348. func (c *MembersListCall) Fields(s ...googleapi.Field) *MembersListCall {
  8349. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8350. return c
  8351. }
  8352. // IfNoneMatch sets the optional parameter which makes the operation
  8353. // fail if the object's ETag matches the given value. This is useful for
  8354. // getting updates only after the object has changed since the last
  8355. // request. Use googleapi.IsNotModified to check whether the response
  8356. // error from Do is the result of In-None-Match.
  8357. func (c *MembersListCall) IfNoneMatch(entityTag string) *MembersListCall {
  8358. c.ifNoneMatch_ = entityTag
  8359. return c
  8360. }
  8361. // Context sets the context to be used in this call's Do method. Any
  8362. // pending HTTP request will be aborted if the provided context is
  8363. // canceled.
  8364. func (c *MembersListCall) Context(ctx context.Context) *MembersListCall {
  8365. c.ctx_ = ctx
  8366. return c
  8367. }
  8368. // Header returns an http.Header that can be modified by the caller to
  8369. // add HTTP headers to the request.
  8370. func (c *MembersListCall) Header() http.Header {
  8371. if c.header_ == nil {
  8372. c.header_ = make(http.Header)
  8373. }
  8374. return c.header_
  8375. }
  8376. func (c *MembersListCall) doRequest(alt string) (*http.Response, error) {
  8377. reqHeaders := make(http.Header)
  8378. for k, v := range c.header_ {
  8379. reqHeaders[k] = v
  8380. }
  8381. reqHeaders.Set("User-Agent", c.s.userAgent())
  8382. if c.ifNoneMatch_ != "" {
  8383. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8384. }
  8385. var body io.Reader = nil
  8386. c.urlParams_.Set("alt", alt)
  8387. c.urlParams_.Set("prettyPrint", "false")
  8388. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members")
  8389. urls += "?" + c.urlParams_.Encode()
  8390. req, err := http.NewRequest("GET", urls, body)
  8391. if err != nil {
  8392. return nil, err
  8393. }
  8394. req.Header = reqHeaders
  8395. googleapi.Expand(req.URL, map[string]string{
  8396. "groupKey": c.groupKey,
  8397. })
  8398. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8399. }
  8400. // Do executes the "directory.members.list" call.
  8401. // Exactly one of *Members or error will be non-nil. Any non-2xx status
  8402. // code is an error. Response headers are in either
  8403. // *Members.ServerResponse.Header or (if a response was returned at all)
  8404. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8405. // check whether the returned error was because http.StatusNotModified
  8406. // was returned.
  8407. func (c *MembersListCall) Do(opts ...googleapi.CallOption) (*Members, error) {
  8408. gensupport.SetOptions(c.urlParams_, opts...)
  8409. res, err := c.doRequest("json")
  8410. if res != nil && res.StatusCode == http.StatusNotModified {
  8411. if res.Body != nil {
  8412. res.Body.Close()
  8413. }
  8414. return nil, &googleapi.Error{
  8415. Code: res.StatusCode,
  8416. Header: res.Header,
  8417. }
  8418. }
  8419. if err != nil {
  8420. return nil, err
  8421. }
  8422. defer googleapi.CloseBody(res)
  8423. if err := googleapi.CheckResponse(res); err != nil {
  8424. return nil, err
  8425. }
  8426. ret := &Members{
  8427. ServerResponse: googleapi.ServerResponse{
  8428. Header: res.Header,
  8429. HTTPStatusCode: res.StatusCode,
  8430. },
  8431. }
  8432. target := &ret
  8433. if err := gensupport.DecodeResponse(target, res); err != nil {
  8434. return nil, err
  8435. }
  8436. return ret, nil
  8437. // {
  8438. // "description": "Retrieve all members in a group (paginated)",
  8439. // "httpMethod": "GET",
  8440. // "id": "directory.members.list",
  8441. // "parameterOrder": [
  8442. // "groupKey"
  8443. // ],
  8444. // "parameters": {
  8445. // "groupKey": {
  8446. // "description": "Email or immutable ID of the group",
  8447. // "location": "path",
  8448. // "required": true,
  8449. // "type": "string"
  8450. // },
  8451. // "includeDerivedMembership": {
  8452. // "description": "Whether to list indirect memberships. Default: false.",
  8453. // "location": "query",
  8454. // "type": "boolean"
  8455. // },
  8456. // "maxResults": {
  8457. // "description": "Maximum number of results to return. Default is 200",
  8458. // "format": "int32",
  8459. // "location": "query",
  8460. // "minimum": "1",
  8461. // "type": "integer"
  8462. // },
  8463. // "pageToken": {
  8464. // "description": "Token to specify next page in the list",
  8465. // "location": "query",
  8466. // "type": "string"
  8467. // },
  8468. // "roles": {
  8469. // "description": "Comma separated role values to filter list results on.",
  8470. // "location": "query",
  8471. // "type": "string"
  8472. // }
  8473. // },
  8474. // "path": "groups/{groupKey}/members",
  8475. // "response": {
  8476. // "$ref": "Members"
  8477. // },
  8478. // "scopes": [
  8479. // "https://www.googleapis.com/auth/admin.directory.group",
  8480. // "https://www.googleapis.com/auth/admin.directory.group.member",
  8481. // "https://www.googleapis.com/auth/admin.directory.group.member.readonly",
  8482. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  8483. // ]
  8484. // }
  8485. }
  8486. // Pages invokes f for each page of results.
  8487. // A non-nil error returned from f will halt the iteration.
  8488. // The provided context supersedes any context provided to the Context method.
  8489. func (c *MembersListCall) Pages(ctx context.Context, f func(*Members) error) error {
  8490. c.ctx_ = ctx
  8491. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8492. for {
  8493. x, err := c.Do()
  8494. if err != nil {
  8495. return err
  8496. }
  8497. if err := f(x); err != nil {
  8498. return err
  8499. }
  8500. if x.NextPageToken == "" {
  8501. return nil
  8502. }
  8503. c.PageToken(x.NextPageToken)
  8504. }
  8505. }
  8506. // method id "directory.members.patch":
  8507. type MembersPatchCall struct {
  8508. s *Service
  8509. groupKey string
  8510. memberKey string
  8511. member *Member
  8512. urlParams_ gensupport.URLParams
  8513. ctx_ context.Context
  8514. header_ http.Header
  8515. }
  8516. // Patch: Update membership of a user in the specified group. This
  8517. // method supports patch semantics.
  8518. func (r *MembersService) Patch(groupKey string, memberKey string, member *Member) *MembersPatchCall {
  8519. c := &MembersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8520. c.groupKey = groupKey
  8521. c.memberKey = memberKey
  8522. c.member = member
  8523. return c
  8524. }
  8525. // Fields allows partial responses to be retrieved. See
  8526. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8527. // for more information.
  8528. func (c *MembersPatchCall) Fields(s ...googleapi.Field) *MembersPatchCall {
  8529. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8530. return c
  8531. }
  8532. // Context sets the context to be used in this call's Do method. Any
  8533. // pending HTTP request will be aborted if the provided context is
  8534. // canceled.
  8535. func (c *MembersPatchCall) Context(ctx context.Context) *MembersPatchCall {
  8536. c.ctx_ = ctx
  8537. return c
  8538. }
  8539. // Header returns an http.Header that can be modified by the caller to
  8540. // add HTTP headers to the request.
  8541. func (c *MembersPatchCall) Header() http.Header {
  8542. if c.header_ == nil {
  8543. c.header_ = make(http.Header)
  8544. }
  8545. return c.header_
  8546. }
  8547. func (c *MembersPatchCall) doRequest(alt string) (*http.Response, error) {
  8548. reqHeaders := make(http.Header)
  8549. for k, v := range c.header_ {
  8550. reqHeaders[k] = v
  8551. }
  8552. reqHeaders.Set("User-Agent", c.s.userAgent())
  8553. var body io.Reader = nil
  8554. body, err := googleapi.WithoutDataWrapper.JSONReader(c.member)
  8555. if err != nil {
  8556. return nil, err
  8557. }
  8558. reqHeaders.Set("Content-Type", "application/json")
  8559. c.urlParams_.Set("alt", alt)
  8560. c.urlParams_.Set("prettyPrint", "false")
  8561. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  8562. urls += "?" + c.urlParams_.Encode()
  8563. req, err := http.NewRequest("PATCH", urls, body)
  8564. if err != nil {
  8565. return nil, err
  8566. }
  8567. req.Header = reqHeaders
  8568. googleapi.Expand(req.URL, map[string]string{
  8569. "groupKey": c.groupKey,
  8570. "memberKey": c.memberKey,
  8571. })
  8572. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8573. }
  8574. // Do executes the "directory.members.patch" call.
  8575. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  8576. // code is an error. Response headers are in either
  8577. // *Member.ServerResponse.Header or (if a response was returned at all)
  8578. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8579. // check whether the returned error was because http.StatusNotModified
  8580. // was returned.
  8581. func (c *MembersPatchCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  8582. gensupport.SetOptions(c.urlParams_, opts...)
  8583. res, err := c.doRequest("json")
  8584. if res != nil && res.StatusCode == http.StatusNotModified {
  8585. if res.Body != nil {
  8586. res.Body.Close()
  8587. }
  8588. return nil, &googleapi.Error{
  8589. Code: res.StatusCode,
  8590. Header: res.Header,
  8591. }
  8592. }
  8593. if err != nil {
  8594. return nil, err
  8595. }
  8596. defer googleapi.CloseBody(res)
  8597. if err := googleapi.CheckResponse(res); err != nil {
  8598. return nil, err
  8599. }
  8600. ret := &Member{
  8601. ServerResponse: googleapi.ServerResponse{
  8602. Header: res.Header,
  8603. HTTPStatusCode: res.StatusCode,
  8604. },
  8605. }
  8606. target := &ret
  8607. if err := gensupport.DecodeResponse(target, res); err != nil {
  8608. return nil, err
  8609. }
  8610. return ret, nil
  8611. // {
  8612. // "description": "Update membership of a user in the specified group. This method supports patch semantics.",
  8613. // "httpMethod": "PATCH",
  8614. // "id": "directory.members.patch",
  8615. // "parameterOrder": [
  8616. // "groupKey",
  8617. // "memberKey"
  8618. // ],
  8619. // "parameters": {
  8620. // "groupKey": {
  8621. // "description": "Email or immutable ID of the group. If ID, it should match with id of group object",
  8622. // "location": "path",
  8623. // "required": true,
  8624. // "type": "string"
  8625. // },
  8626. // "memberKey": {
  8627. // "description": "Email or immutable ID of the user. If ID, it should match with id of member object",
  8628. // "location": "path",
  8629. // "required": true,
  8630. // "type": "string"
  8631. // }
  8632. // },
  8633. // "path": "groups/{groupKey}/members/{memberKey}",
  8634. // "request": {
  8635. // "$ref": "Member"
  8636. // },
  8637. // "response": {
  8638. // "$ref": "Member"
  8639. // },
  8640. // "scopes": [
  8641. // "https://www.googleapis.com/auth/admin.directory.group",
  8642. // "https://www.googleapis.com/auth/admin.directory.group.member"
  8643. // ]
  8644. // }
  8645. }
  8646. // method id "directory.members.update":
  8647. type MembersUpdateCall struct {
  8648. s *Service
  8649. groupKey string
  8650. memberKey string
  8651. member *Member
  8652. urlParams_ gensupport.URLParams
  8653. ctx_ context.Context
  8654. header_ http.Header
  8655. }
  8656. // Update: Update membership of a user in the specified group.
  8657. func (r *MembersService) Update(groupKey string, memberKey string, member *Member) *MembersUpdateCall {
  8658. c := &MembersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8659. c.groupKey = groupKey
  8660. c.memberKey = memberKey
  8661. c.member = member
  8662. return c
  8663. }
  8664. // Fields allows partial responses to be retrieved. See
  8665. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8666. // for more information.
  8667. func (c *MembersUpdateCall) Fields(s ...googleapi.Field) *MembersUpdateCall {
  8668. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8669. return c
  8670. }
  8671. // Context sets the context to be used in this call's Do method. Any
  8672. // pending HTTP request will be aborted if the provided context is
  8673. // canceled.
  8674. func (c *MembersUpdateCall) Context(ctx context.Context) *MembersUpdateCall {
  8675. c.ctx_ = ctx
  8676. return c
  8677. }
  8678. // Header returns an http.Header that can be modified by the caller to
  8679. // add HTTP headers to the request.
  8680. func (c *MembersUpdateCall) Header() http.Header {
  8681. if c.header_ == nil {
  8682. c.header_ = make(http.Header)
  8683. }
  8684. return c.header_
  8685. }
  8686. func (c *MembersUpdateCall) doRequest(alt string) (*http.Response, error) {
  8687. reqHeaders := make(http.Header)
  8688. for k, v := range c.header_ {
  8689. reqHeaders[k] = v
  8690. }
  8691. reqHeaders.Set("User-Agent", c.s.userAgent())
  8692. var body io.Reader = nil
  8693. body, err := googleapi.WithoutDataWrapper.JSONReader(c.member)
  8694. if err != nil {
  8695. return nil, err
  8696. }
  8697. reqHeaders.Set("Content-Type", "application/json")
  8698. c.urlParams_.Set("alt", alt)
  8699. c.urlParams_.Set("prettyPrint", "false")
  8700. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  8701. urls += "?" + c.urlParams_.Encode()
  8702. req, err := http.NewRequest("PUT", urls, body)
  8703. if err != nil {
  8704. return nil, err
  8705. }
  8706. req.Header = reqHeaders
  8707. googleapi.Expand(req.URL, map[string]string{
  8708. "groupKey": c.groupKey,
  8709. "memberKey": c.memberKey,
  8710. })
  8711. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8712. }
  8713. // Do executes the "directory.members.update" call.
  8714. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  8715. // code is an error. Response headers are in either
  8716. // *Member.ServerResponse.Header or (if a response was returned at all)
  8717. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8718. // check whether the returned error was because http.StatusNotModified
  8719. // was returned.
  8720. func (c *MembersUpdateCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  8721. gensupport.SetOptions(c.urlParams_, opts...)
  8722. res, err := c.doRequest("json")
  8723. if res != nil && res.StatusCode == http.StatusNotModified {
  8724. if res.Body != nil {
  8725. res.Body.Close()
  8726. }
  8727. return nil, &googleapi.Error{
  8728. Code: res.StatusCode,
  8729. Header: res.Header,
  8730. }
  8731. }
  8732. if err != nil {
  8733. return nil, err
  8734. }
  8735. defer googleapi.CloseBody(res)
  8736. if err := googleapi.CheckResponse(res); err != nil {
  8737. return nil, err
  8738. }
  8739. ret := &Member{
  8740. ServerResponse: googleapi.ServerResponse{
  8741. Header: res.Header,
  8742. HTTPStatusCode: res.StatusCode,
  8743. },
  8744. }
  8745. target := &ret
  8746. if err := gensupport.DecodeResponse(target, res); err != nil {
  8747. return nil, err
  8748. }
  8749. return ret, nil
  8750. // {
  8751. // "description": "Update membership of a user in the specified group.",
  8752. // "httpMethod": "PUT",
  8753. // "id": "directory.members.update",
  8754. // "parameterOrder": [
  8755. // "groupKey",
  8756. // "memberKey"
  8757. // ],
  8758. // "parameters": {
  8759. // "groupKey": {
  8760. // "description": "Email or immutable ID of the group. If ID, it should match with id of group object",
  8761. // "location": "path",
  8762. // "required": true,
  8763. // "type": "string"
  8764. // },
  8765. // "memberKey": {
  8766. // "description": "Email or immutable ID of the user. If ID, it should match with id of member object",
  8767. // "location": "path",
  8768. // "required": true,
  8769. // "type": "string"
  8770. // }
  8771. // },
  8772. // "path": "groups/{groupKey}/members/{memberKey}",
  8773. // "request": {
  8774. // "$ref": "Member"
  8775. // },
  8776. // "response": {
  8777. // "$ref": "Member"
  8778. // },
  8779. // "scopes": [
  8780. // "https://www.googleapis.com/auth/admin.directory.group",
  8781. // "https://www.googleapis.com/auth/admin.directory.group.member"
  8782. // ]
  8783. // }
  8784. }
  8785. // method id "directory.mobiledevices.action":
  8786. type MobiledevicesActionCall struct {
  8787. s *Service
  8788. customerId string
  8789. resourceId string
  8790. mobiledeviceaction *MobileDeviceAction
  8791. urlParams_ gensupport.URLParams
  8792. ctx_ context.Context
  8793. header_ http.Header
  8794. }
  8795. // Action: Take action on Mobile Device
  8796. func (r *MobiledevicesService) Action(customerId string, resourceId string, mobiledeviceaction *MobileDeviceAction) *MobiledevicesActionCall {
  8797. c := &MobiledevicesActionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8798. c.customerId = customerId
  8799. c.resourceId = resourceId
  8800. c.mobiledeviceaction = mobiledeviceaction
  8801. return c
  8802. }
  8803. // Fields allows partial responses to be retrieved. See
  8804. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8805. // for more information.
  8806. func (c *MobiledevicesActionCall) Fields(s ...googleapi.Field) *MobiledevicesActionCall {
  8807. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8808. return c
  8809. }
  8810. // Context sets the context to be used in this call's Do method. Any
  8811. // pending HTTP request will be aborted if the provided context is
  8812. // canceled.
  8813. func (c *MobiledevicesActionCall) Context(ctx context.Context) *MobiledevicesActionCall {
  8814. c.ctx_ = ctx
  8815. return c
  8816. }
  8817. // Header returns an http.Header that can be modified by the caller to
  8818. // add HTTP headers to the request.
  8819. func (c *MobiledevicesActionCall) Header() http.Header {
  8820. if c.header_ == nil {
  8821. c.header_ = make(http.Header)
  8822. }
  8823. return c.header_
  8824. }
  8825. func (c *MobiledevicesActionCall) doRequest(alt string) (*http.Response, error) {
  8826. reqHeaders := make(http.Header)
  8827. for k, v := range c.header_ {
  8828. reqHeaders[k] = v
  8829. }
  8830. reqHeaders.Set("User-Agent", c.s.userAgent())
  8831. var body io.Reader = nil
  8832. body, err := googleapi.WithoutDataWrapper.JSONReader(c.mobiledeviceaction)
  8833. if err != nil {
  8834. return nil, err
  8835. }
  8836. reqHeaders.Set("Content-Type", "application/json")
  8837. c.urlParams_.Set("alt", alt)
  8838. c.urlParams_.Set("prettyPrint", "false")
  8839. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile/{resourceId}/action")
  8840. urls += "?" + c.urlParams_.Encode()
  8841. req, err := http.NewRequest("POST", urls, body)
  8842. if err != nil {
  8843. return nil, err
  8844. }
  8845. req.Header = reqHeaders
  8846. googleapi.Expand(req.URL, map[string]string{
  8847. "customerId": c.customerId,
  8848. "resourceId": c.resourceId,
  8849. })
  8850. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8851. }
  8852. // Do executes the "directory.mobiledevices.action" call.
  8853. func (c *MobiledevicesActionCall) Do(opts ...googleapi.CallOption) error {
  8854. gensupport.SetOptions(c.urlParams_, opts...)
  8855. res, err := c.doRequest("json")
  8856. if err != nil {
  8857. return err
  8858. }
  8859. defer googleapi.CloseBody(res)
  8860. if err := googleapi.CheckResponse(res); err != nil {
  8861. return err
  8862. }
  8863. return nil
  8864. // {
  8865. // "description": "Take action on Mobile Device",
  8866. // "httpMethod": "POST",
  8867. // "id": "directory.mobiledevices.action",
  8868. // "parameterOrder": [
  8869. // "customerId",
  8870. // "resourceId"
  8871. // ],
  8872. // "parameters": {
  8873. // "customerId": {
  8874. // "description": "Immutable ID of the G Suite account",
  8875. // "location": "path",
  8876. // "required": true,
  8877. // "type": "string"
  8878. // },
  8879. // "resourceId": {
  8880. // "description": "Immutable ID of Mobile Device",
  8881. // "location": "path",
  8882. // "required": true,
  8883. // "type": "string"
  8884. // }
  8885. // },
  8886. // "path": "customer/{customerId}/devices/mobile/{resourceId}/action",
  8887. // "request": {
  8888. // "$ref": "MobileDeviceAction"
  8889. // },
  8890. // "scopes": [
  8891. // "https://www.googleapis.com/auth/admin.directory.device.mobile",
  8892. // "https://www.googleapis.com/auth/admin.directory.device.mobile.action"
  8893. // ]
  8894. // }
  8895. }
  8896. // method id "directory.mobiledevices.delete":
  8897. type MobiledevicesDeleteCall struct {
  8898. s *Service
  8899. customerId string
  8900. resourceId string
  8901. urlParams_ gensupport.URLParams
  8902. ctx_ context.Context
  8903. header_ http.Header
  8904. }
  8905. // Delete: Delete Mobile Device
  8906. func (r *MobiledevicesService) Delete(customerId string, resourceId string) *MobiledevicesDeleteCall {
  8907. c := &MobiledevicesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8908. c.customerId = customerId
  8909. c.resourceId = resourceId
  8910. return c
  8911. }
  8912. // Fields allows partial responses to be retrieved. See
  8913. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8914. // for more information.
  8915. func (c *MobiledevicesDeleteCall) Fields(s ...googleapi.Field) *MobiledevicesDeleteCall {
  8916. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8917. return c
  8918. }
  8919. // Context sets the context to be used in this call's Do method. Any
  8920. // pending HTTP request will be aborted if the provided context is
  8921. // canceled.
  8922. func (c *MobiledevicesDeleteCall) Context(ctx context.Context) *MobiledevicesDeleteCall {
  8923. c.ctx_ = ctx
  8924. return c
  8925. }
  8926. // Header returns an http.Header that can be modified by the caller to
  8927. // add HTTP headers to the request.
  8928. func (c *MobiledevicesDeleteCall) Header() http.Header {
  8929. if c.header_ == nil {
  8930. c.header_ = make(http.Header)
  8931. }
  8932. return c.header_
  8933. }
  8934. func (c *MobiledevicesDeleteCall) doRequest(alt string) (*http.Response, error) {
  8935. reqHeaders := make(http.Header)
  8936. for k, v := range c.header_ {
  8937. reqHeaders[k] = v
  8938. }
  8939. reqHeaders.Set("User-Agent", c.s.userAgent())
  8940. var body io.Reader = nil
  8941. c.urlParams_.Set("alt", alt)
  8942. c.urlParams_.Set("prettyPrint", "false")
  8943. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile/{resourceId}")
  8944. urls += "?" + c.urlParams_.Encode()
  8945. req, err := http.NewRequest("DELETE", urls, body)
  8946. if err != nil {
  8947. return nil, err
  8948. }
  8949. req.Header = reqHeaders
  8950. googleapi.Expand(req.URL, map[string]string{
  8951. "customerId": c.customerId,
  8952. "resourceId": c.resourceId,
  8953. })
  8954. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8955. }
  8956. // Do executes the "directory.mobiledevices.delete" call.
  8957. func (c *MobiledevicesDeleteCall) Do(opts ...googleapi.CallOption) error {
  8958. gensupport.SetOptions(c.urlParams_, opts...)
  8959. res, err := c.doRequest("json")
  8960. if err != nil {
  8961. return err
  8962. }
  8963. defer googleapi.CloseBody(res)
  8964. if err := googleapi.CheckResponse(res); err != nil {
  8965. return err
  8966. }
  8967. return nil
  8968. // {
  8969. // "description": "Delete Mobile Device",
  8970. // "httpMethod": "DELETE",
  8971. // "id": "directory.mobiledevices.delete",
  8972. // "parameterOrder": [
  8973. // "customerId",
  8974. // "resourceId"
  8975. // ],
  8976. // "parameters": {
  8977. // "customerId": {
  8978. // "description": "Immutable ID of the G Suite account",
  8979. // "location": "path",
  8980. // "required": true,
  8981. // "type": "string"
  8982. // },
  8983. // "resourceId": {
  8984. // "description": "Immutable ID of Mobile Device",
  8985. // "location": "path",
  8986. // "required": true,
  8987. // "type": "string"
  8988. // }
  8989. // },
  8990. // "path": "customer/{customerId}/devices/mobile/{resourceId}",
  8991. // "scopes": [
  8992. // "https://www.googleapis.com/auth/admin.directory.device.mobile"
  8993. // ]
  8994. // }
  8995. }
  8996. // method id "directory.mobiledevices.get":
  8997. type MobiledevicesGetCall struct {
  8998. s *Service
  8999. customerId string
  9000. resourceId string
  9001. urlParams_ gensupport.URLParams
  9002. ifNoneMatch_ string
  9003. ctx_ context.Context
  9004. header_ http.Header
  9005. }
  9006. // Get: Retrieve Mobile Device
  9007. func (r *MobiledevicesService) Get(customerId string, resourceId string) *MobiledevicesGetCall {
  9008. c := &MobiledevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9009. c.customerId = customerId
  9010. c.resourceId = resourceId
  9011. return c
  9012. }
  9013. // Projection sets the optional parameter "projection": Restrict
  9014. // information returned to a set of selected fields.
  9015. //
  9016. // Possible values:
  9017. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  9018. // model, status, type, and status)
  9019. // "FULL" - Includes all metadata fields
  9020. func (c *MobiledevicesGetCall) Projection(projection string) *MobiledevicesGetCall {
  9021. c.urlParams_.Set("projection", projection)
  9022. return c
  9023. }
  9024. // Fields allows partial responses to be retrieved. See
  9025. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9026. // for more information.
  9027. func (c *MobiledevicesGetCall) Fields(s ...googleapi.Field) *MobiledevicesGetCall {
  9028. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9029. return c
  9030. }
  9031. // IfNoneMatch sets the optional parameter which makes the operation
  9032. // fail if the object's ETag matches the given value. This is useful for
  9033. // getting updates only after the object has changed since the last
  9034. // request. Use googleapi.IsNotModified to check whether the response
  9035. // error from Do is the result of In-None-Match.
  9036. func (c *MobiledevicesGetCall) IfNoneMatch(entityTag string) *MobiledevicesGetCall {
  9037. c.ifNoneMatch_ = entityTag
  9038. return c
  9039. }
  9040. // Context sets the context to be used in this call's Do method. Any
  9041. // pending HTTP request will be aborted if the provided context is
  9042. // canceled.
  9043. func (c *MobiledevicesGetCall) Context(ctx context.Context) *MobiledevicesGetCall {
  9044. c.ctx_ = ctx
  9045. return c
  9046. }
  9047. // Header returns an http.Header that can be modified by the caller to
  9048. // add HTTP headers to the request.
  9049. func (c *MobiledevicesGetCall) Header() http.Header {
  9050. if c.header_ == nil {
  9051. c.header_ = make(http.Header)
  9052. }
  9053. return c.header_
  9054. }
  9055. func (c *MobiledevicesGetCall) doRequest(alt string) (*http.Response, error) {
  9056. reqHeaders := make(http.Header)
  9057. for k, v := range c.header_ {
  9058. reqHeaders[k] = v
  9059. }
  9060. reqHeaders.Set("User-Agent", c.s.userAgent())
  9061. if c.ifNoneMatch_ != "" {
  9062. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9063. }
  9064. var body io.Reader = nil
  9065. c.urlParams_.Set("alt", alt)
  9066. c.urlParams_.Set("prettyPrint", "false")
  9067. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile/{resourceId}")
  9068. urls += "?" + c.urlParams_.Encode()
  9069. req, err := http.NewRequest("GET", urls, body)
  9070. if err != nil {
  9071. return nil, err
  9072. }
  9073. req.Header = reqHeaders
  9074. googleapi.Expand(req.URL, map[string]string{
  9075. "customerId": c.customerId,
  9076. "resourceId": c.resourceId,
  9077. })
  9078. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9079. }
  9080. // Do executes the "directory.mobiledevices.get" call.
  9081. // Exactly one of *MobileDevice or error will be non-nil. Any non-2xx
  9082. // status code is an error. Response headers are in either
  9083. // *MobileDevice.ServerResponse.Header or (if a response was returned at
  9084. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9085. // to check whether the returned error was because
  9086. // http.StatusNotModified was returned.
  9087. func (c *MobiledevicesGetCall) Do(opts ...googleapi.CallOption) (*MobileDevice, error) {
  9088. gensupport.SetOptions(c.urlParams_, opts...)
  9089. res, err := c.doRequest("json")
  9090. if res != nil && res.StatusCode == http.StatusNotModified {
  9091. if res.Body != nil {
  9092. res.Body.Close()
  9093. }
  9094. return nil, &googleapi.Error{
  9095. Code: res.StatusCode,
  9096. Header: res.Header,
  9097. }
  9098. }
  9099. if err != nil {
  9100. return nil, err
  9101. }
  9102. defer googleapi.CloseBody(res)
  9103. if err := googleapi.CheckResponse(res); err != nil {
  9104. return nil, err
  9105. }
  9106. ret := &MobileDevice{
  9107. ServerResponse: googleapi.ServerResponse{
  9108. Header: res.Header,
  9109. HTTPStatusCode: res.StatusCode,
  9110. },
  9111. }
  9112. target := &ret
  9113. if err := gensupport.DecodeResponse(target, res); err != nil {
  9114. return nil, err
  9115. }
  9116. return ret, nil
  9117. // {
  9118. // "description": "Retrieve Mobile Device",
  9119. // "httpMethod": "GET",
  9120. // "id": "directory.mobiledevices.get",
  9121. // "parameterOrder": [
  9122. // "customerId",
  9123. // "resourceId"
  9124. // ],
  9125. // "parameters": {
  9126. // "customerId": {
  9127. // "description": "Immutable ID of the G Suite account",
  9128. // "location": "path",
  9129. // "required": true,
  9130. // "type": "string"
  9131. // },
  9132. // "projection": {
  9133. // "description": "Restrict information returned to a set of selected fields.",
  9134. // "enum": [
  9135. // "BASIC",
  9136. // "FULL"
  9137. // ],
  9138. // "enumDescriptions": [
  9139. // "Includes only the basic metadata fields (e.g., deviceId, model, status, type, and status)",
  9140. // "Includes all metadata fields"
  9141. // ],
  9142. // "location": "query",
  9143. // "type": "string"
  9144. // },
  9145. // "resourceId": {
  9146. // "description": "Immutable ID of Mobile Device",
  9147. // "location": "path",
  9148. // "required": true,
  9149. // "type": "string"
  9150. // }
  9151. // },
  9152. // "path": "customer/{customerId}/devices/mobile/{resourceId}",
  9153. // "response": {
  9154. // "$ref": "MobileDevice"
  9155. // },
  9156. // "scopes": [
  9157. // "https://www.googleapis.com/auth/admin.directory.device.mobile",
  9158. // "https://www.googleapis.com/auth/admin.directory.device.mobile.action",
  9159. // "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly"
  9160. // ]
  9161. // }
  9162. }
  9163. // method id "directory.mobiledevices.list":
  9164. type MobiledevicesListCall struct {
  9165. s *Service
  9166. customerId string
  9167. urlParams_ gensupport.URLParams
  9168. ifNoneMatch_ string
  9169. ctx_ context.Context
  9170. header_ http.Header
  9171. }
  9172. // List: Retrieve all Mobile Devices of a customer (paginated)
  9173. func (r *MobiledevicesService) List(customerId string) *MobiledevicesListCall {
  9174. c := &MobiledevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9175. c.customerId = customerId
  9176. return c
  9177. }
  9178. // MaxResults sets the optional parameter "maxResults": Maximum number
  9179. // of results to return. Default is 100
  9180. func (c *MobiledevicesListCall) MaxResults(maxResults int64) *MobiledevicesListCall {
  9181. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  9182. return c
  9183. }
  9184. // OrderBy sets the optional parameter "orderBy": Column to use for
  9185. // sorting results
  9186. //
  9187. // Possible values:
  9188. // "deviceId" - Mobile Device serial number.
  9189. // "email" - Owner user email.
  9190. // "lastSync" - Last policy settings sync date time of the device.
  9191. // "model" - Mobile Device model.
  9192. // "name" - Owner user name.
  9193. // "os" - Mobile operating system.
  9194. // "status" - Status of the device.
  9195. // "type" - Type of the device.
  9196. func (c *MobiledevicesListCall) OrderBy(orderBy string) *MobiledevicesListCall {
  9197. c.urlParams_.Set("orderBy", orderBy)
  9198. return c
  9199. }
  9200. // PageToken sets the optional parameter "pageToken": Token to specify
  9201. // next page in the list
  9202. func (c *MobiledevicesListCall) PageToken(pageToken string) *MobiledevicesListCall {
  9203. c.urlParams_.Set("pageToken", pageToken)
  9204. return c
  9205. }
  9206. // Projection sets the optional parameter "projection": Restrict
  9207. // information returned to a set of selected fields.
  9208. //
  9209. // Possible values:
  9210. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  9211. // model, status, type, and status)
  9212. // "FULL" - Includes all metadata fields
  9213. func (c *MobiledevicesListCall) Projection(projection string) *MobiledevicesListCall {
  9214. c.urlParams_.Set("projection", projection)
  9215. return c
  9216. }
  9217. // Query sets the optional parameter "query": Search string in the
  9218. // format given at
  9219. // http://support.google.com/a/bin/answer.py?answer=1408863#search
  9220. func (c *MobiledevicesListCall) Query(query string) *MobiledevicesListCall {
  9221. c.urlParams_.Set("query", query)
  9222. return c
  9223. }
  9224. // SortOrder sets the optional parameter "sortOrder": Whether to return
  9225. // results in ascending or descending order. Only of use when orderBy is
  9226. // also used
  9227. //
  9228. // Possible values:
  9229. // "ASCENDING" - Ascending order.
  9230. // "DESCENDING" - Descending order.
  9231. func (c *MobiledevicesListCall) SortOrder(sortOrder string) *MobiledevicesListCall {
  9232. c.urlParams_.Set("sortOrder", sortOrder)
  9233. return c
  9234. }
  9235. // Fields allows partial responses to be retrieved. See
  9236. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9237. // for more information.
  9238. func (c *MobiledevicesListCall) Fields(s ...googleapi.Field) *MobiledevicesListCall {
  9239. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9240. return c
  9241. }
  9242. // IfNoneMatch sets the optional parameter which makes the operation
  9243. // fail if the object's ETag matches the given value. This is useful for
  9244. // getting updates only after the object has changed since the last
  9245. // request. Use googleapi.IsNotModified to check whether the response
  9246. // error from Do is the result of In-None-Match.
  9247. func (c *MobiledevicesListCall) IfNoneMatch(entityTag string) *MobiledevicesListCall {
  9248. c.ifNoneMatch_ = entityTag
  9249. return c
  9250. }
  9251. // Context sets the context to be used in this call's Do method. Any
  9252. // pending HTTP request will be aborted if the provided context is
  9253. // canceled.
  9254. func (c *MobiledevicesListCall) Context(ctx context.Context) *MobiledevicesListCall {
  9255. c.ctx_ = ctx
  9256. return c
  9257. }
  9258. // Header returns an http.Header that can be modified by the caller to
  9259. // add HTTP headers to the request.
  9260. func (c *MobiledevicesListCall) Header() http.Header {
  9261. if c.header_ == nil {
  9262. c.header_ = make(http.Header)
  9263. }
  9264. return c.header_
  9265. }
  9266. func (c *MobiledevicesListCall) doRequest(alt string) (*http.Response, error) {
  9267. reqHeaders := make(http.Header)
  9268. for k, v := range c.header_ {
  9269. reqHeaders[k] = v
  9270. }
  9271. reqHeaders.Set("User-Agent", c.s.userAgent())
  9272. if c.ifNoneMatch_ != "" {
  9273. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9274. }
  9275. var body io.Reader = nil
  9276. c.urlParams_.Set("alt", alt)
  9277. c.urlParams_.Set("prettyPrint", "false")
  9278. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile")
  9279. urls += "?" + c.urlParams_.Encode()
  9280. req, err := http.NewRequest("GET", urls, body)
  9281. if err != nil {
  9282. return nil, err
  9283. }
  9284. req.Header = reqHeaders
  9285. googleapi.Expand(req.URL, map[string]string{
  9286. "customerId": c.customerId,
  9287. })
  9288. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9289. }
  9290. // Do executes the "directory.mobiledevices.list" call.
  9291. // Exactly one of *MobileDevices or error will be non-nil. Any non-2xx
  9292. // status code is an error. Response headers are in either
  9293. // *MobileDevices.ServerResponse.Header or (if a response was returned
  9294. // at all) in error.(*googleapi.Error).Header. Use
  9295. // googleapi.IsNotModified to check whether the returned error was
  9296. // because http.StatusNotModified was returned.
  9297. func (c *MobiledevicesListCall) Do(opts ...googleapi.CallOption) (*MobileDevices, error) {
  9298. gensupport.SetOptions(c.urlParams_, opts...)
  9299. res, err := c.doRequest("json")
  9300. if res != nil && res.StatusCode == http.StatusNotModified {
  9301. if res.Body != nil {
  9302. res.Body.Close()
  9303. }
  9304. return nil, &googleapi.Error{
  9305. Code: res.StatusCode,
  9306. Header: res.Header,
  9307. }
  9308. }
  9309. if err != nil {
  9310. return nil, err
  9311. }
  9312. defer googleapi.CloseBody(res)
  9313. if err := googleapi.CheckResponse(res); err != nil {
  9314. return nil, err
  9315. }
  9316. ret := &MobileDevices{
  9317. ServerResponse: googleapi.ServerResponse{
  9318. Header: res.Header,
  9319. HTTPStatusCode: res.StatusCode,
  9320. },
  9321. }
  9322. target := &ret
  9323. if err := gensupport.DecodeResponse(target, res); err != nil {
  9324. return nil, err
  9325. }
  9326. return ret, nil
  9327. // {
  9328. // "description": "Retrieve all Mobile Devices of a customer (paginated)",
  9329. // "httpMethod": "GET",
  9330. // "id": "directory.mobiledevices.list",
  9331. // "parameterOrder": [
  9332. // "customerId"
  9333. // ],
  9334. // "parameters": {
  9335. // "customerId": {
  9336. // "description": "Immutable ID of the G Suite account",
  9337. // "location": "path",
  9338. // "required": true,
  9339. // "type": "string"
  9340. // },
  9341. // "maxResults": {
  9342. // "description": "Maximum number of results to return. Default is 100",
  9343. // "format": "int32",
  9344. // "location": "query",
  9345. // "minimum": "1",
  9346. // "type": "integer"
  9347. // },
  9348. // "orderBy": {
  9349. // "description": "Column to use for sorting results",
  9350. // "enum": [
  9351. // "deviceId",
  9352. // "email",
  9353. // "lastSync",
  9354. // "model",
  9355. // "name",
  9356. // "os",
  9357. // "status",
  9358. // "type"
  9359. // ],
  9360. // "enumDescriptions": [
  9361. // "Mobile Device serial number.",
  9362. // "Owner user email.",
  9363. // "Last policy settings sync date time of the device.",
  9364. // "Mobile Device model.",
  9365. // "Owner user name.",
  9366. // "Mobile operating system.",
  9367. // "Status of the device.",
  9368. // "Type of the device."
  9369. // ],
  9370. // "location": "query",
  9371. // "type": "string"
  9372. // },
  9373. // "pageToken": {
  9374. // "description": "Token to specify next page in the list",
  9375. // "location": "query",
  9376. // "type": "string"
  9377. // },
  9378. // "projection": {
  9379. // "description": "Restrict information returned to a set of selected fields.",
  9380. // "enum": [
  9381. // "BASIC",
  9382. // "FULL"
  9383. // ],
  9384. // "enumDescriptions": [
  9385. // "Includes only the basic metadata fields (e.g., deviceId, model, status, type, and status)",
  9386. // "Includes all metadata fields"
  9387. // ],
  9388. // "location": "query",
  9389. // "type": "string"
  9390. // },
  9391. // "query": {
  9392. // "description": "Search string in the format given at http://support.google.com/a/bin/answer.py?answer=1408863#search",
  9393. // "location": "query",
  9394. // "type": "string"
  9395. // },
  9396. // "sortOrder": {
  9397. // "description": "Whether to return results in ascending or descending order. Only of use when orderBy is also used",
  9398. // "enum": [
  9399. // "ASCENDING",
  9400. // "DESCENDING"
  9401. // ],
  9402. // "enumDescriptions": [
  9403. // "Ascending order.",
  9404. // "Descending order."
  9405. // ],
  9406. // "location": "query",
  9407. // "type": "string"
  9408. // }
  9409. // },
  9410. // "path": "customer/{customerId}/devices/mobile",
  9411. // "response": {
  9412. // "$ref": "MobileDevices"
  9413. // },
  9414. // "scopes": [
  9415. // "https://www.googleapis.com/auth/admin.directory.device.mobile",
  9416. // "https://www.googleapis.com/auth/admin.directory.device.mobile.action",
  9417. // "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly"
  9418. // ]
  9419. // }
  9420. }
  9421. // Pages invokes f for each page of results.
  9422. // A non-nil error returned from f will halt the iteration.
  9423. // The provided context supersedes any context provided to the Context method.
  9424. func (c *MobiledevicesListCall) Pages(ctx context.Context, f func(*MobileDevices) error) error {
  9425. c.ctx_ = ctx
  9426. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9427. for {
  9428. x, err := c.Do()
  9429. if err != nil {
  9430. return err
  9431. }
  9432. if err := f(x); err != nil {
  9433. return err
  9434. }
  9435. if x.NextPageToken == "" {
  9436. return nil
  9437. }
  9438. c.PageToken(x.NextPageToken)
  9439. }
  9440. }
  9441. // method id "directory.notifications.delete":
  9442. type NotificationsDeleteCall struct {
  9443. s *Service
  9444. customer string
  9445. notificationId string
  9446. urlParams_ gensupport.URLParams
  9447. ctx_ context.Context
  9448. header_ http.Header
  9449. }
  9450. // Delete: Deletes a notification
  9451. func (r *NotificationsService) Delete(customer string, notificationId string) *NotificationsDeleteCall {
  9452. c := &NotificationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9453. c.customer = customer
  9454. c.notificationId = notificationId
  9455. return c
  9456. }
  9457. // Fields allows partial responses to be retrieved. See
  9458. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9459. // for more information.
  9460. func (c *NotificationsDeleteCall) Fields(s ...googleapi.Field) *NotificationsDeleteCall {
  9461. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9462. return c
  9463. }
  9464. // Context sets the context to be used in this call's Do method. Any
  9465. // pending HTTP request will be aborted if the provided context is
  9466. // canceled.
  9467. func (c *NotificationsDeleteCall) Context(ctx context.Context) *NotificationsDeleteCall {
  9468. c.ctx_ = ctx
  9469. return c
  9470. }
  9471. // Header returns an http.Header that can be modified by the caller to
  9472. // add HTTP headers to the request.
  9473. func (c *NotificationsDeleteCall) Header() http.Header {
  9474. if c.header_ == nil {
  9475. c.header_ = make(http.Header)
  9476. }
  9477. return c.header_
  9478. }
  9479. func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9480. reqHeaders := make(http.Header)
  9481. for k, v := range c.header_ {
  9482. reqHeaders[k] = v
  9483. }
  9484. reqHeaders.Set("User-Agent", c.s.userAgent())
  9485. var body io.Reader = nil
  9486. c.urlParams_.Set("alt", alt)
  9487. c.urlParams_.Set("prettyPrint", "false")
  9488. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  9489. urls += "?" + c.urlParams_.Encode()
  9490. req, err := http.NewRequest("DELETE", urls, body)
  9491. if err != nil {
  9492. return nil, err
  9493. }
  9494. req.Header = reqHeaders
  9495. googleapi.Expand(req.URL, map[string]string{
  9496. "customer": c.customer,
  9497. "notificationId": c.notificationId,
  9498. })
  9499. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9500. }
  9501. // Do executes the "directory.notifications.delete" call.
  9502. func (c *NotificationsDeleteCall) Do(opts ...googleapi.CallOption) error {
  9503. gensupport.SetOptions(c.urlParams_, opts...)
  9504. res, err := c.doRequest("json")
  9505. if err != nil {
  9506. return err
  9507. }
  9508. defer googleapi.CloseBody(res)
  9509. if err := googleapi.CheckResponse(res); err != nil {
  9510. return err
  9511. }
  9512. return nil
  9513. // {
  9514. // "description": "Deletes a notification",
  9515. // "httpMethod": "DELETE",
  9516. // "id": "directory.notifications.delete",
  9517. // "parameterOrder": [
  9518. // "customer",
  9519. // "notificationId"
  9520. // ],
  9521. // "parameters": {
  9522. // "customer": {
  9523. // "description": "The unique ID for the customer's G Suite account. The customerId is also returned as part of the Users resource.",
  9524. // "location": "path",
  9525. // "required": true,
  9526. // "type": "string"
  9527. // },
  9528. // "notificationId": {
  9529. // "description": "The unique ID of the notification.",
  9530. // "location": "path",
  9531. // "required": true,
  9532. // "type": "string"
  9533. // }
  9534. // },
  9535. // "path": "customer/{customer}/notifications/{notificationId}",
  9536. // "scopes": [
  9537. // "https://www.googleapis.com/auth/admin.directory.notifications"
  9538. // ]
  9539. // }
  9540. }
  9541. // method id "directory.notifications.get":
  9542. type NotificationsGetCall struct {
  9543. s *Service
  9544. customer string
  9545. notificationId string
  9546. urlParams_ gensupport.URLParams
  9547. ifNoneMatch_ string
  9548. ctx_ context.Context
  9549. header_ http.Header
  9550. }
  9551. // Get: Retrieves a notification.
  9552. func (r *NotificationsService) Get(customer string, notificationId string) *NotificationsGetCall {
  9553. c := &NotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9554. c.customer = customer
  9555. c.notificationId = notificationId
  9556. return c
  9557. }
  9558. // Fields allows partial responses to be retrieved. See
  9559. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9560. // for more information.
  9561. func (c *NotificationsGetCall) Fields(s ...googleapi.Field) *NotificationsGetCall {
  9562. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9563. return c
  9564. }
  9565. // IfNoneMatch sets the optional parameter which makes the operation
  9566. // fail if the object's ETag matches the given value. This is useful for
  9567. // getting updates only after the object has changed since the last
  9568. // request. Use googleapi.IsNotModified to check whether the response
  9569. // error from Do is the result of In-None-Match.
  9570. func (c *NotificationsGetCall) IfNoneMatch(entityTag string) *NotificationsGetCall {
  9571. c.ifNoneMatch_ = entityTag
  9572. return c
  9573. }
  9574. // Context sets the context to be used in this call's Do method. Any
  9575. // pending HTTP request will be aborted if the provided context is
  9576. // canceled.
  9577. func (c *NotificationsGetCall) Context(ctx context.Context) *NotificationsGetCall {
  9578. c.ctx_ = ctx
  9579. return c
  9580. }
  9581. // Header returns an http.Header that can be modified by the caller to
  9582. // add HTTP headers to the request.
  9583. func (c *NotificationsGetCall) Header() http.Header {
  9584. if c.header_ == nil {
  9585. c.header_ = make(http.Header)
  9586. }
  9587. return c.header_
  9588. }
  9589. func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) {
  9590. reqHeaders := make(http.Header)
  9591. for k, v := range c.header_ {
  9592. reqHeaders[k] = v
  9593. }
  9594. reqHeaders.Set("User-Agent", c.s.userAgent())
  9595. if c.ifNoneMatch_ != "" {
  9596. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9597. }
  9598. var body io.Reader = nil
  9599. c.urlParams_.Set("alt", alt)
  9600. c.urlParams_.Set("prettyPrint", "false")
  9601. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  9602. urls += "?" + c.urlParams_.Encode()
  9603. req, err := http.NewRequest("GET", urls, body)
  9604. if err != nil {
  9605. return nil, err
  9606. }
  9607. req.Header = reqHeaders
  9608. googleapi.Expand(req.URL, map[string]string{
  9609. "customer": c.customer,
  9610. "notificationId": c.notificationId,
  9611. })
  9612. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9613. }
  9614. // Do executes the "directory.notifications.get" call.
  9615. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  9616. // status code is an error. Response headers are in either
  9617. // *Notification.ServerResponse.Header or (if a response was returned at
  9618. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9619. // to check whether the returned error was because
  9620. // http.StatusNotModified was returned.
  9621. func (c *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  9622. gensupport.SetOptions(c.urlParams_, opts...)
  9623. res, err := c.doRequest("json")
  9624. if res != nil && res.StatusCode == http.StatusNotModified {
  9625. if res.Body != nil {
  9626. res.Body.Close()
  9627. }
  9628. return nil, &googleapi.Error{
  9629. Code: res.StatusCode,
  9630. Header: res.Header,
  9631. }
  9632. }
  9633. if err != nil {
  9634. return nil, err
  9635. }
  9636. defer googleapi.CloseBody(res)
  9637. if err := googleapi.CheckResponse(res); err != nil {
  9638. return nil, err
  9639. }
  9640. ret := &Notification{
  9641. ServerResponse: googleapi.ServerResponse{
  9642. Header: res.Header,
  9643. HTTPStatusCode: res.StatusCode,
  9644. },
  9645. }
  9646. target := &ret
  9647. if err := gensupport.DecodeResponse(target, res); err != nil {
  9648. return nil, err
  9649. }
  9650. return ret, nil
  9651. // {
  9652. // "description": "Retrieves a notification.",
  9653. // "httpMethod": "GET",
  9654. // "id": "directory.notifications.get",
  9655. // "parameterOrder": [
  9656. // "customer",
  9657. // "notificationId"
  9658. // ],
  9659. // "parameters": {
  9660. // "customer": {
  9661. // "description": "The unique ID for the customer's G Suite account. The customerId is also returned as part of the Users resource.",
  9662. // "location": "path",
  9663. // "required": true,
  9664. // "type": "string"
  9665. // },
  9666. // "notificationId": {
  9667. // "description": "The unique ID of the notification.",
  9668. // "location": "path",
  9669. // "required": true,
  9670. // "type": "string"
  9671. // }
  9672. // },
  9673. // "path": "customer/{customer}/notifications/{notificationId}",
  9674. // "response": {
  9675. // "$ref": "Notification"
  9676. // },
  9677. // "scopes": [
  9678. // "https://www.googleapis.com/auth/admin.directory.notifications"
  9679. // ]
  9680. // }
  9681. }
  9682. // method id "directory.notifications.list":
  9683. type NotificationsListCall struct {
  9684. s *Service
  9685. customer string
  9686. urlParams_ gensupport.URLParams
  9687. ifNoneMatch_ string
  9688. ctx_ context.Context
  9689. header_ http.Header
  9690. }
  9691. // List: Retrieves a list of notifications.
  9692. func (r *NotificationsService) List(customer string) *NotificationsListCall {
  9693. c := &NotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9694. c.customer = customer
  9695. return c
  9696. }
  9697. // Language sets the optional parameter "language": The ISO 639-1 code
  9698. // of the language notifications are returned in. The default is English
  9699. // (en).
  9700. func (c *NotificationsListCall) Language(language string) *NotificationsListCall {
  9701. c.urlParams_.Set("language", language)
  9702. return c
  9703. }
  9704. // MaxResults sets the optional parameter "maxResults": Maximum number
  9705. // of notifications to return per page. The default is 100.
  9706. func (c *NotificationsListCall) MaxResults(maxResults int64) *NotificationsListCall {
  9707. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  9708. return c
  9709. }
  9710. // PageToken sets the optional parameter "pageToken": The token to
  9711. // specify the page of results to retrieve.
  9712. func (c *NotificationsListCall) PageToken(pageToken string) *NotificationsListCall {
  9713. c.urlParams_.Set("pageToken", pageToken)
  9714. return c
  9715. }
  9716. // Fields allows partial responses to be retrieved. See
  9717. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9718. // for more information.
  9719. func (c *NotificationsListCall) Fields(s ...googleapi.Field) *NotificationsListCall {
  9720. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9721. return c
  9722. }
  9723. // IfNoneMatch sets the optional parameter which makes the operation
  9724. // fail if the object's ETag matches the given value. This is useful for
  9725. // getting updates only after the object has changed since the last
  9726. // request. Use googleapi.IsNotModified to check whether the response
  9727. // error from Do is the result of In-None-Match.
  9728. func (c *NotificationsListCall) IfNoneMatch(entityTag string) *NotificationsListCall {
  9729. c.ifNoneMatch_ = entityTag
  9730. return c
  9731. }
  9732. // Context sets the context to be used in this call's Do method. Any
  9733. // pending HTTP request will be aborted if the provided context is
  9734. // canceled.
  9735. func (c *NotificationsListCall) Context(ctx context.Context) *NotificationsListCall {
  9736. c.ctx_ = ctx
  9737. return c
  9738. }
  9739. // Header returns an http.Header that can be modified by the caller to
  9740. // add HTTP headers to the request.
  9741. func (c *NotificationsListCall) Header() http.Header {
  9742. if c.header_ == nil {
  9743. c.header_ = make(http.Header)
  9744. }
  9745. return c.header_
  9746. }
  9747. func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) {
  9748. reqHeaders := make(http.Header)
  9749. for k, v := range c.header_ {
  9750. reqHeaders[k] = v
  9751. }
  9752. reqHeaders.Set("User-Agent", c.s.userAgent())
  9753. if c.ifNoneMatch_ != "" {
  9754. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9755. }
  9756. var body io.Reader = nil
  9757. c.urlParams_.Set("alt", alt)
  9758. c.urlParams_.Set("prettyPrint", "false")
  9759. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications")
  9760. urls += "?" + c.urlParams_.Encode()
  9761. req, err := http.NewRequest("GET", urls, body)
  9762. if err != nil {
  9763. return nil, err
  9764. }
  9765. req.Header = reqHeaders
  9766. googleapi.Expand(req.URL, map[string]string{
  9767. "customer": c.customer,
  9768. })
  9769. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9770. }
  9771. // Do executes the "directory.notifications.list" call.
  9772. // Exactly one of *Notifications or error will be non-nil. Any non-2xx
  9773. // status code is an error. Response headers are in either
  9774. // *Notifications.ServerResponse.Header or (if a response was returned
  9775. // at all) in error.(*googleapi.Error).Header. Use
  9776. // googleapi.IsNotModified to check whether the returned error was
  9777. // because http.StatusNotModified was returned.
  9778. func (c *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications, error) {
  9779. gensupport.SetOptions(c.urlParams_, opts...)
  9780. res, err := c.doRequest("json")
  9781. if res != nil && res.StatusCode == http.StatusNotModified {
  9782. if res.Body != nil {
  9783. res.Body.Close()
  9784. }
  9785. return nil, &googleapi.Error{
  9786. Code: res.StatusCode,
  9787. Header: res.Header,
  9788. }
  9789. }
  9790. if err != nil {
  9791. return nil, err
  9792. }
  9793. defer googleapi.CloseBody(res)
  9794. if err := googleapi.CheckResponse(res); err != nil {
  9795. return nil, err
  9796. }
  9797. ret := &Notifications{
  9798. ServerResponse: googleapi.ServerResponse{
  9799. Header: res.Header,
  9800. HTTPStatusCode: res.StatusCode,
  9801. },
  9802. }
  9803. target := &ret
  9804. if err := gensupport.DecodeResponse(target, res); err != nil {
  9805. return nil, err
  9806. }
  9807. return ret, nil
  9808. // {
  9809. // "description": "Retrieves a list of notifications.",
  9810. // "httpMethod": "GET",
  9811. // "id": "directory.notifications.list",
  9812. // "parameterOrder": [
  9813. // "customer"
  9814. // ],
  9815. // "parameters": {
  9816. // "customer": {
  9817. // "description": "The unique ID for the customer's G Suite account.",
  9818. // "location": "path",
  9819. // "required": true,
  9820. // "type": "string"
  9821. // },
  9822. // "language": {
  9823. // "description": "The ISO 639-1 code of the language notifications are returned in. The default is English (en).",
  9824. // "location": "query",
  9825. // "type": "string"
  9826. // },
  9827. // "maxResults": {
  9828. // "description": "Maximum number of notifications to return per page. The default is 100.",
  9829. // "format": "uint32",
  9830. // "location": "query",
  9831. // "type": "integer"
  9832. // },
  9833. // "pageToken": {
  9834. // "description": "The token to specify the page of results to retrieve.",
  9835. // "location": "query",
  9836. // "type": "string"
  9837. // }
  9838. // },
  9839. // "path": "customer/{customer}/notifications",
  9840. // "response": {
  9841. // "$ref": "Notifications"
  9842. // },
  9843. // "scopes": [
  9844. // "https://www.googleapis.com/auth/admin.directory.notifications"
  9845. // ]
  9846. // }
  9847. }
  9848. // Pages invokes f for each page of results.
  9849. // A non-nil error returned from f will halt the iteration.
  9850. // The provided context supersedes any context provided to the Context method.
  9851. func (c *NotificationsListCall) Pages(ctx context.Context, f func(*Notifications) error) error {
  9852. c.ctx_ = ctx
  9853. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9854. for {
  9855. x, err := c.Do()
  9856. if err != nil {
  9857. return err
  9858. }
  9859. if err := f(x); err != nil {
  9860. return err
  9861. }
  9862. if x.NextPageToken == "" {
  9863. return nil
  9864. }
  9865. c.PageToken(x.NextPageToken)
  9866. }
  9867. }
  9868. // method id "directory.notifications.patch":
  9869. type NotificationsPatchCall struct {
  9870. s *Service
  9871. customer string
  9872. notificationId string
  9873. notification *Notification
  9874. urlParams_ gensupport.URLParams
  9875. ctx_ context.Context
  9876. header_ http.Header
  9877. }
  9878. // Patch: Updates a notification. This method supports patch semantics.
  9879. func (r *NotificationsService) Patch(customer string, notificationId string, notification *Notification) *NotificationsPatchCall {
  9880. c := &NotificationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9881. c.customer = customer
  9882. c.notificationId = notificationId
  9883. c.notification = notification
  9884. return c
  9885. }
  9886. // Fields allows partial responses to be retrieved. See
  9887. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9888. // for more information.
  9889. func (c *NotificationsPatchCall) Fields(s ...googleapi.Field) *NotificationsPatchCall {
  9890. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9891. return c
  9892. }
  9893. // Context sets the context to be used in this call's Do method. Any
  9894. // pending HTTP request will be aborted if the provided context is
  9895. // canceled.
  9896. func (c *NotificationsPatchCall) Context(ctx context.Context) *NotificationsPatchCall {
  9897. c.ctx_ = ctx
  9898. return c
  9899. }
  9900. // Header returns an http.Header that can be modified by the caller to
  9901. // add HTTP headers to the request.
  9902. func (c *NotificationsPatchCall) Header() http.Header {
  9903. if c.header_ == nil {
  9904. c.header_ = make(http.Header)
  9905. }
  9906. return c.header_
  9907. }
  9908. func (c *NotificationsPatchCall) doRequest(alt string) (*http.Response, error) {
  9909. reqHeaders := make(http.Header)
  9910. for k, v := range c.header_ {
  9911. reqHeaders[k] = v
  9912. }
  9913. reqHeaders.Set("User-Agent", c.s.userAgent())
  9914. var body io.Reader = nil
  9915. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  9916. if err != nil {
  9917. return nil, err
  9918. }
  9919. reqHeaders.Set("Content-Type", "application/json")
  9920. c.urlParams_.Set("alt", alt)
  9921. c.urlParams_.Set("prettyPrint", "false")
  9922. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  9923. urls += "?" + c.urlParams_.Encode()
  9924. req, err := http.NewRequest("PATCH", urls, body)
  9925. if err != nil {
  9926. return nil, err
  9927. }
  9928. req.Header = reqHeaders
  9929. googleapi.Expand(req.URL, map[string]string{
  9930. "customer": c.customer,
  9931. "notificationId": c.notificationId,
  9932. })
  9933. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9934. }
  9935. // Do executes the "directory.notifications.patch" call.
  9936. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  9937. // status code is an error. Response headers are in either
  9938. // *Notification.ServerResponse.Header or (if a response was returned at
  9939. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9940. // to check whether the returned error was because
  9941. // http.StatusNotModified was returned.
  9942. func (c *NotificationsPatchCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  9943. gensupport.SetOptions(c.urlParams_, opts...)
  9944. res, err := c.doRequest("json")
  9945. if res != nil && res.StatusCode == http.StatusNotModified {
  9946. if res.Body != nil {
  9947. res.Body.Close()
  9948. }
  9949. return nil, &googleapi.Error{
  9950. Code: res.StatusCode,
  9951. Header: res.Header,
  9952. }
  9953. }
  9954. if err != nil {
  9955. return nil, err
  9956. }
  9957. defer googleapi.CloseBody(res)
  9958. if err := googleapi.CheckResponse(res); err != nil {
  9959. return nil, err
  9960. }
  9961. ret := &Notification{
  9962. ServerResponse: googleapi.ServerResponse{
  9963. Header: res.Header,
  9964. HTTPStatusCode: res.StatusCode,
  9965. },
  9966. }
  9967. target := &ret
  9968. if err := gensupport.DecodeResponse(target, res); err != nil {
  9969. return nil, err
  9970. }
  9971. return ret, nil
  9972. // {
  9973. // "description": "Updates a notification. This method supports patch semantics.",
  9974. // "httpMethod": "PATCH",
  9975. // "id": "directory.notifications.patch",
  9976. // "parameterOrder": [
  9977. // "customer",
  9978. // "notificationId"
  9979. // ],
  9980. // "parameters": {
  9981. // "customer": {
  9982. // "description": "The unique ID for the customer's G Suite account.",
  9983. // "location": "path",
  9984. // "required": true,
  9985. // "type": "string"
  9986. // },
  9987. // "notificationId": {
  9988. // "description": "The unique ID of the notification.",
  9989. // "location": "path",
  9990. // "required": true,
  9991. // "type": "string"
  9992. // }
  9993. // },
  9994. // "path": "customer/{customer}/notifications/{notificationId}",
  9995. // "request": {
  9996. // "$ref": "Notification"
  9997. // },
  9998. // "response": {
  9999. // "$ref": "Notification"
  10000. // },
  10001. // "scopes": [
  10002. // "https://www.googleapis.com/auth/admin.directory.notifications"
  10003. // ]
  10004. // }
  10005. }
  10006. // method id "directory.notifications.update":
  10007. type NotificationsUpdateCall struct {
  10008. s *Service
  10009. customer string
  10010. notificationId string
  10011. notification *Notification
  10012. urlParams_ gensupport.URLParams
  10013. ctx_ context.Context
  10014. header_ http.Header
  10015. }
  10016. // Update: Updates a notification.
  10017. func (r *NotificationsService) Update(customer string, notificationId string, notification *Notification) *NotificationsUpdateCall {
  10018. c := &NotificationsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10019. c.customer = customer
  10020. c.notificationId = notificationId
  10021. c.notification = notification
  10022. return c
  10023. }
  10024. // Fields allows partial responses to be retrieved. See
  10025. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10026. // for more information.
  10027. func (c *NotificationsUpdateCall) Fields(s ...googleapi.Field) *NotificationsUpdateCall {
  10028. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10029. return c
  10030. }
  10031. // Context sets the context to be used in this call's Do method. Any
  10032. // pending HTTP request will be aborted if the provided context is
  10033. // canceled.
  10034. func (c *NotificationsUpdateCall) Context(ctx context.Context) *NotificationsUpdateCall {
  10035. c.ctx_ = ctx
  10036. return c
  10037. }
  10038. // Header returns an http.Header that can be modified by the caller to
  10039. // add HTTP headers to the request.
  10040. func (c *NotificationsUpdateCall) Header() http.Header {
  10041. if c.header_ == nil {
  10042. c.header_ = make(http.Header)
  10043. }
  10044. return c.header_
  10045. }
  10046. func (c *NotificationsUpdateCall) doRequest(alt string) (*http.Response, error) {
  10047. reqHeaders := make(http.Header)
  10048. for k, v := range c.header_ {
  10049. reqHeaders[k] = v
  10050. }
  10051. reqHeaders.Set("User-Agent", c.s.userAgent())
  10052. var body io.Reader = nil
  10053. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  10054. if err != nil {
  10055. return nil, err
  10056. }
  10057. reqHeaders.Set("Content-Type", "application/json")
  10058. c.urlParams_.Set("alt", alt)
  10059. c.urlParams_.Set("prettyPrint", "false")
  10060. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  10061. urls += "?" + c.urlParams_.Encode()
  10062. req, err := http.NewRequest("PUT", urls, body)
  10063. if err != nil {
  10064. return nil, err
  10065. }
  10066. req.Header = reqHeaders
  10067. googleapi.Expand(req.URL, map[string]string{
  10068. "customer": c.customer,
  10069. "notificationId": c.notificationId,
  10070. })
  10071. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10072. }
  10073. // Do executes the "directory.notifications.update" call.
  10074. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  10075. // status code is an error. Response headers are in either
  10076. // *Notification.ServerResponse.Header or (if a response was returned at
  10077. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10078. // to check whether the returned error was because
  10079. // http.StatusNotModified was returned.
  10080. func (c *NotificationsUpdateCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  10081. gensupport.SetOptions(c.urlParams_, opts...)
  10082. res, err := c.doRequest("json")
  10083. if res != nil && res.StatusCode == http.StatusNotModified {
  10084. if res.Body != nil {
  10085. res.Body.Close()
  10086. }
  10087. return nil, &googleapi.Error{
  10088. Code: res.StatusCode,
  10089. Header: res.Header,
  10090. }
  10091. }
  10092. if err != nil {
  10093. return nil, err
  10094. }
  10095. defer googleapi.CloseBody(res)
  10096. if err := googleapi.CheckResponse(res); err != nil {
  10097. return nil, err
  10098. }
  10099. ret := &Notification{
  10100. ServerResponse: googleapi.ServerResponse{
  10101. Header: res.Header,
  10102. HTTPStatusCode: res.StatusCode,
  10103. },
  10104. }
  10105. target := &ret
  10106. if err := gensupport.DecodeResponse(target, res); err != nil {
  10107. return nil, err
  10108. }
  10109. return ret, nil
  10110. // {
  10111. // "description": "Updates a notification.",
  10112. // "httpMethod": "PUT",
  10113. // "id": "directory.notifications.update",
  10114. // "parameterOrder": [
  10115. // "customer",
  10116. // "notificationId"
  10117. // ],
  10118. // "parameters": {
  10119. // "customer": {
  10120. // "description": "The unique ID for the customer's G Suite account.",
  10121. // "location": "path",
  10122. // "required": true,
  10123. // "type": "string"
  10124. // },
  10125. // "notificationId": {
  10126. // "description": "The unique ID of the notification.",
  10127. // "location": "path",
  10128. // "required": true,
  10129. // "type": "string"
  10130. // }
  10131. // },
  10132. // "path": "customer/{customer}/notifications/{notificationId}",
  10133. // "request": {
  10134. // "$ref": "Notification"
  10135. // },
  10136. // "response": {
  10137. // "$ref": "Notification"
  10138. // },
  10139. // "scopes": [
  10140. // "https://www.googleapis.com/auth/admin.directory.notifications"
  10141. // ]
  10142. // }
  10143. }
  10144. // method id "directory.orgunits.delete":
  10145. type OrgunitsDeleteCall struct {
  10146. s *Service
  10147. customerId string
  10148. orgUnitPath []string
  10149. urlParams_ gensupport.URLParams
  10150. ctx_ context.Context
  10151. header_ http.Header
  10152. }
  10153. // Delete: Remove organizational unit
  10154. func (r *OrgunitsService) Delete(customerId string, orgUnitPath []string) *OrgunitsDeleteCall {
  10155. c := &OrgunitsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10156. c.customerId = customerId
  10157. c.orgUnitPath = append([]string{}, orgUnitPath...)
  10158. return c
  10159. }
  10160. // Fields allows partial responses to be retrieved. See
  10161. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10162. // for more information.
  10163. func (c *OrgunitsDeleteCall) Fields(s ...googleapi.Field) *OrgunitsDeleteCall {
  10164. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10165. return c
  10166. }
  10167. // Context sets the context to be used in this call's Do method. Any
  10168. // pending HTTP request will be aborted if the provided context is
  10169. // canceled.
  10170. func (c *OrgunitsDeleteCall) Context(ctx context.Context) *OrgunitsDeleteCall {
  10171. c.ctx_ = ctx
  10172. return c
  10173. }
  10174. // Header returns an http.Header that can be modified by the caller to
  10175. // add HTTP headers to the request.
  10176. func (c *OrgunitsDeleteCall) Header() http.Header {
  10177. if c.header_ == nil {
  10178. c.header_ = make(http.Header)
  10179. }
  10180. return c.header_
  10181. }
  10182. func (c *OrgunitsDeleteCall) doRequest(alt string) (*http.Response, error) {
  10183. reqHeaders := make(http.Header)
  10184. for k, v := range c.header_ {
  10185. reqHeaders[k] = v
  10186. }
  10187. reqHeaders.Set("User-Agent", c.s.userAgent())
  10188. var body io.Reader = nil
  10189. c.urlParams_.Set("alt", alt)
  10190. c.urlParams_.Set("prettyPrint", "false")
  10191. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  10192. urls += "?" + c.urlParams_.Encode()
  10193. req, err := http.NewRequest("DELETE", urls, body)
  10194. if err != nil {
  10195. return nil, err
  10196. }
  10197. req.Header = reqHeaders
  10198. googleapi.Expand(req.URL, map[string]string{
  10199. "customerId": c.customerId,
  10200. "orgUnitPath": c.orgUnitPath[0],
  10201. })
  10202. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10203. }
  10204. // Do executes the "directory.orgunits.delete" call.
  10205. func (c *OrgunitsDeleteCall) Do(opts ...googleapi.CallOption) error {
  10206. gensupport.SetOptions(c.urlParams_, opts...)
  10207. res, err := c.doRequest("json")
  10208. if err != nil {
  10209. return err
  10210. }
  10211. defer googleapi.CloseBody(res)
  10212. if err := googleapi.CheckResponse(res); err != nil {
  10213. return err
  10214. }
  10215. return nil
  10216. // {
  10217. // "description": "Remove organizational unit",
  10218. // "httpMethod": "DELETE",
  10219. // "id": "directory.orgunits.delete",
  10220. // "parameterOrder": [
  10221. // "customerId",
  10222. // "orgUnitPath"
  10223. // ],
  10224. // "parameters": {
  10225. // "customerId": {
  10226. // "description": "Immutable ID of the G Suite account",
  10227. // "location": "path",
  10228. // "required": true,
  10229. // "type": "string"
  10230. // },
  10231. // "orgUnitPath": {
  10232. // "description": "Full path of the organizational unit or its ID",
  10233. // "location": "path",
  10234. // "repeated": true,
  10235. // "required": true,
  10236. // "type": "string"
  10237. // }
  10238. // },
  10239. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  10240. // "scopes": [
  10241. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  10242. // ]
  10243. // }
  10244. }
  10245. // method id "directory.orgunits.get":
  10246. type OrgunitsGetCall struct {
  10247. s *Service
  10248. customerId string
  10249. orgUnitPath []string
  10250. urlParams_ gensupport.URLParams
  10251. ifNoneMatch_ string
  10252. ctx_ context.Context
  10253. header_ http.Header
  10254. }
  10255. // Get: Retrieve organizational unit
  10256. func (r *OrgunitsService) Get(customerId string, orgUnitPath []string) *OrgunitsGetCall {
  10257. c := &OrgunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10258. c.customerId = customerId
  10259. c.orgUnitPath = append([]string{}, orgUnitPath...)
  10260. return c
  10261. }
  10262. // Fields allows partial responses to be retrieved. See
  10263. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10264. // for more information.
  10265. func (c *OrgunitsGetCall) Fields(s ...googleapi.Field) *OrgunitsGetCall {
  10266. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10267. return c
  10268. }
  10269. // IfNoneMatch sets the optional parameter which makes the operation
  10270. // fail if the object's ETag matches the given value. This is useful for
  10271. // getting updates only after the object has changed since the last
  10272. // request. Use googleapi.IsNotModified to check whether the response
  10273. // error from Do is the result of In-None-Match.
  10274. func (c *OrgunitsGetCall) IfNoneMatch(entityTag string) *OrgunitsGetCall {
  10275. c.ifNoneMatch_ = entityTag
  10276. return c
  10277. }
  10278. // Context sets the context to be used in this call's Do method. Any
  10279. // pending HTTP request will be aborted if the provided context is
  10280. // canceled.
  10281. func (c *OrgunitsGetCall) Context(ctx context.Context) *OrgunitsGetCall {
  10282. c.ctx_ = ctx
  10283. return c
  10284. }
  10285. // Header returns an http.Header that can be modified by the caller to
  10286. // add HTTP headers to the request.
  10287. func (c *OrgunitsGetCall) Header() http.Header {
  10288. if c.header_ == nil {
  10289. c.header_ = make(http.Header)
  10290. }
  10291. return c.header_
  10292. }
  10293. func (c *OrgunitsGetCall) doRequest(alt string) (*http.Response, error) {
  10294. reqHeaders := make(http.Header)
  10295. for k, v := range c.header_ {
  10296. reqHeaders[k] = v
  10297. }
  10298. reqHeaders.Set("User-Agent", c.s.userAgent())
  10299. if c.ifNoneMatch_ != "" {
  10300. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10301. }
  10302. var body io.Reader = nil
  10303. c.urlParams_.Set("alt", alt)
  10304. c.urlParams_.Set("prettyPrint", "false")
  10305. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  10306. urls += "?" + c.urlParams_.Encode()
  10307. req, err := http.NewRequest("GET", urls, body)
  10308. if err != nil {
  10309. return nil, err
  10310. }
  10311. req.Header = reqHeaders
  10312. googleapi.Expand(req.URL, map[string]string{
  10313. "customerId": c.customerId,
  10314. "orgUnitPath": c.orgUnitPath[0],
  10315. })
  10316. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10317. }
  10318. // Do executes the "directory.orgunits.get" call.
  10319. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  10320. // code is an error. Response headers are in either
  10321. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  10322. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10323. // check whether the returned error was because http.StatusNotModified
  10324. // was returned.
  10325. func (c *OrgunitsGetCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  10326. gensupport.SetOptions(c.urlParams_, opts...)
  10327. res, err := c.doRequest("json")
  10328. if res != nil && res.StatusCode == http.StatusNotModified {
  10329. if res.Body != nil {
  10330. res.Body.Close()
  10331. }
  10332. return nil, &googleapi.Error{
  10333. Code: res.StatusCode,
  10334. Header: res.Header,
  10335. }
  10336. }
  10337. if err != nil {
  10338. return nil, err
  10339. }
  10340. defer googleapi.CloseBody(res)
  10341. if err := googleapi.CheckResponse(res); err != nil {
  10342. return nil, err
  10343. }
  10344. ret := &OrgUnit{
  10345. ServerResponse: googleapi.ServerResponse{
  10346. Header: res.Header,
  10347. HTTPStatusCode: res.StatusCode,
  10348. },
  10349. }
  10350. target := &ret
  10351. if err := gensupport.DecodeResponse(target, res); err != nil {
  10352. return nil, err
  10353. }
  10354. return ret, nil
  10355. // {
  10356. // "description": "Retrieve organizational unit",
  10357. // "httpMethod": "GET",
  10358. // "id": "directory.orgunits.get",
  10359. // "parameterOrder": [
  10360. // "customerId",
  10361. // "orgUnitPath"
  10362. // ],
  10363. // "parameters": {
  10364. // "customerId": {
  10365. // "description": "Immutable ID of the G Suite account",
  10366. // "location": "path",
  10367. // "required": true,
  10368. // "type": "string"
  10369. // },
  10370. // "orgUnitPath": {
  10371. // "description": "Full path of the organizational unit or its ID",
  10372. // "location": "path",
  10373. // "repeated": true,
  10374. // "required": true,
  10375. // "type": "string"
  10376. // }
  10377. // },
  10378. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  10379. // "response": {
  10380. // "$ref": "OrgUnit"
  10381. // },
  10382. // "scopes": [
  10383. // "https://www.googleapis.com/auth/admin.directory.orgunit",
  10384. // "https://www.googleapis.com/auth/admin.directory.orgunit.readonly"
  10385. // ]
  10386. // }
  10387. }
  10388. // method id "directory.orgunits.insert":
  10389. type OrgunitsInsertCall struct {
  10390. s *Service
  10391. customerId string
  10392. orgunit *OrgUnit
  10393. urlParams_ gensupport.URLParams
  10394. ctx_ context.Context
  10395. header_ http.Header
  10396. }
  10397. // Insert: Add organizational unit
  10398. func (r *OrgunitsService) Insert(customerId string, orgunit *OrgUnit) *OrgunitsInsertCall {
  10399. c := &OrgunitsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10400. c.customerId = customerId
  10401. c.orgunit = orgunit
  10402. return c
  10403. }
  10404. // Fields allows partial responses to be retrieved. See
  10405. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10406. // for more information.
  10407. func (c *OrgunitsInsertCall) Fields(s ...googleapi.Field) *OrgunitsInsertCall {
  10408. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10409. return c
  10410. }
  10411. // Context sets the context to be used in this call's Do method. Any
  10412. // pending HTTP request will be aborted if the provided context is
  10413. // canceled.
  10414. func (c *OrgunitsInsertCall) Context(ctx context.Context) *OrgunitsInsertCall {
  10415. c.ctx_ = ctx
  10416. return c
  10417. }
  10418. // Header returns an http.Header that can be modified by the caller to
  10419. // add HTTP headers to the request.
  10420. func (c *OrgunitsInsertCall) Header() http.Header {
  10421. if c.header_ == nil {
  10422. c.header_ = make(http.Header)
  10423. }
  10424. return c.header_
  10425. }
  10426. func (c *OrgunitsInsertCall) doRequest(alt string) (*http.Response, error) {
  10427. reqHeaders := make(http.Header)
  10428. for k, v := range c.header_ {
  10429. reqHeaders[k] = v
  10430. }
  10431. reqHeaders.Set("User-Agent", c.s.userAgent())
  10432. var body io.Reader = nil
  10433. body, err := googleapi.WithoutDataWrapper.JSONReader(c.orgunit)
  10434. if err != nil {
  10435. return nil, err
  10436. }
  10437. reqHeaders.Set("Content-Type", "application/json")
  10438. c.urlParams_.Set("alt", alt)
  10439. c.urlParams_.Set("prettyPrint", "false")
  10440. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits")
  10441. urls += "?" + c.urlParams_.Encode()
  10442. req, err := http.NewRequest("POST", urls, body)
  10443. if err != nil {
  10444. return nil, err
  10445. }
  10446. req.Header = reqHeaders
  10447. googleapi.Expand(req.URL, map[string]string{
  10448. "customerId": c.customerId,
  10449. })
  10450. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10451. }
  10452. // Do executes the "directory.orgunits.insert" call.
  10453. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  10454. // code is an error. Response headers are in either
  10455. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  10456. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10457. // check whether the returned error was because http.StatusNotModified
  10458. // was returned.
  10459. func (c *OrgunitsInsertCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  10460. gensupport.SetOptions(c.urlParams_, opts...)
  10461. res, err := c.doRequest("json")
  10462. if res != nil && res.StatusCode == http.StatusNotModified {
  10463. if res.Body != nil {
  10464. res.Body.Close()
  10465. }
  10466. return nil, &googleapi.Error{
  10467. Code: res.StatusCode,
  10468. Header: res.Header,
  10469. }
  10470. }
  10471. if err != nil {
  10472. return nil, err
  10473. }
  10474. defer googleapi.CloseBody(res)
  10475. if err := googleapi.CheckResponse(res); err != nil {
  10476. return nil, err
  10477. }
  10478. ret := &OrgUnit{
  10479. ServerResponse: googleapi.ServerResponse{
  10480. Header: res.Header,
  10481. HTTPStatusCode: res.StatusCode,
  10482. },
  10483. }
  10484. target := &ret
  10485. if err := gensupport.DecodeResponse(target, res); err != nil {
  10486. return nil, err
  10487. }
  10488. return ret, nil
  10489. // {
  10490. // "description": "Add organizational unit",
  10491. // "httpMethod": "POST",
  10492. // "id": "directory.orgunits.insert",
  10493. // "parameterOrder": [
  10494. // "customerId"
  10495. // ],
  10496. // "parameters": {
  10497. // "customerId": {
  10498. // "description": "Immutable ID of the G Suite account",
  10499. // "location": "path",
  10500. // "required": true,
  10501. // "type": "string"
  10502. // }
  10503. // },
  10504. // "path": "customer/{customerId}/orgunits",
  10505. // "request": {
  10506. // "$ref": "OrgUnit"
  10507. // },
  10508. // "response": {
  10509. // "$ref": "OrgUnit"
  10510. // },
  10511. // "scopes": [
  10512. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  10513. // ]
  10514. // }
  10515. }
  10516. // method id "directory.orgunits.list":
  10517. type OrgunitsListCall struct {
  10518. s *Service
  10519. customerId string
  10520. urlParams_ gensupport.URLParams
  10521. ifNoneMatch_ string
  10522. ctx_ context.Context
  10523. header_ http.Header
  10524. }
  10525. // List: Retrieve all organizational units
  10526. func (r *OrgunitsService) List(customerId string) *OrgunitsListCall {
  10527. c := &OrgunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10528. c.customerId = customerId
  10529. return c
  10530. }
  10531. // OrgUnitPath sets the optional parameter "orgUnitPath": the
  10532. // URL-encoded organizational unit's path or its ID
  10533. func (c *OrgunitsListCall) OrgUnitPath(orgUnitPath string) *OrgunitsListCall {
  10534. c.urlParams_.Set("orgUnitPath", orgUnitPath)
  10535. return c
  10536. }
  10537. // Type sets the optional parameter "type": Whether to return all
  10538. // sub-organizations or just immediate children
  10539. //
  10540. // Possible values:
  10541. // "all" - All sub-organizational units.
  10542. // "children" - Immediate children only (default).
  10543. func (c *OrgunitsListCall) Type(type_ string) *OrgunitsListCall {
  10544. c.urlParams_.Set("type", type_)
  10545. return c
  10546. }
  10547. // Fields allows partial responses to be retrieved. See
  10548. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10549. // for more information.
  10550. func (c *OrgunitsListCall) Fields(s ...googleapi.Field) *OrgunitsListCall {
  10551. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10552. return c
  10553. }
  10554. // IfNoneMatch sets the optional parameter which makes the operation
  10555. // fail if the object's ETag matches the given value. This is useful for
  10556. // getting updates only after the object has changed since the last
  10557. // request. Use googleapi.IsNotModified to check whether the response
  10558. // error from Do is the result of In-None-Match.
  10559. func (c *OrgunitsListCall) IfNoneMatch(entityTag string) *OrgunitsListCall {
  10560. c.ifNoneMatch_ = entityTag
  10561. return c
  10562. }
  10563. // Context sets the context to be used in this call's Do method. Any
  10564. // pending HTTP request will be aborted if the provided context is
  10565. // canceled.
  10566. func (c *OrgunitsListCall) Context(ctx context.Context) *OrgunitsListCall {
  10567. c.ctx_ = ctx
  10568. return c
  10569. }
  10570. // Header returns an http.Header that can be modified by the caller to
  10571. // add HTTP headers to the request.
  10572. func (c *OrgunitsListCall) Header() http.Header {
  10573. if c.header_ == nil {
  10574. c.header_ = make(http.Header)
  10575. }
  10576. return c.header_
  10577. }
  10578. func (c *OrgunitsListCall) doRequest(alt string) (*http.Response, error) {
  10579. reqHeaders := make(http.Header)
  10580. for k, v := range c.header_ {
  10581. reqHeaders[k] = v
  10582. }
  10583. reqHeaders.Set("User-Agent", c.s.userAgent())
  10584. if c.ifNoneMatch_ != "" {
  10585. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10586. }
  10587. var body io.Reader = nil
  10588. c.urlParams_.Set("alt", alt)
  10589. c.urlParams_.Set("prettyPrint", "false")
  10590. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits")
  10591. urls += "?" + c.urlParams_.Encode()
  10592. req, err := http.NewRequest("GET", urls, body)
  10593. if err != nil {
  10594. return nil, err
  10595. }
  10596. req.Header = reqHeaders
  10597. googleapi.Expand(req.URL, map[string]string{
  10598. "customerId": c.customerId,
  10599. })
  10600. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10601. }
  10602. // Do executes the "directory.orgunits.list" call.
  10603. // Exactly one of *OrgUnits or error will be non-nil. Any non-2xx status
  10604. // code is an error. Response headers are in either
  10605. // *OrgUnits.ServerResponse.Header or (if a response was returned at
  10606. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10607. // to check whether the returned error was because
  10608. // http.StatusNotModified was returned.
  10609. func (c *OrgunitsListCall) Do(opts ...googleapi.CallOption) (*OrgUnits, error) {
  10610. gensupport.SetOptions(c.urlParams_, opts...)
  10611. res, err := c.doRequest("json")
  10612. if res != nil && res.StatusCode == http.StatusNotModified {
  10613. if res.Body != nil {
  10614. res.Body.Close()
  10615. }
  10616. return nil, &googleapi.Error{
  10617. Code: res.StatusCode,
  10618. Header: res.Header,
  10619. }
  10620. }
  10621. if err != nil {
  10622. return nil, err
  10623. }
  10624. defer googleapi.CloseBody(res)
  10625. if err := googleapi.CheckResponse(res); err != nil {
  10626. return nil, err
  10627. }
  10628. ret := &OrgUnits{
  10629. ServerResponse: googleapi.ServerResponse{
  10630. Header: res.Header,
  10631. HTTPStatusCode: res.StatusCode,
  10632. },
  10633. }
  10634. target := &ret
  10635. if err := gensupport.DecodeResponse(target, res); err != nil {
  10636. return nil, err
  10637. }
  10638. return ret, nil
  10639. // {
  10640. // "description": "Retrieve all organizational units",
  10641. // "httpMethod": "GET",
  10642. // "id": "directory.orgunits.list",
  10643. // "parameterOrder": [
  10644. // "customerId"
  10645. // ],
  10646. // "parameters": {
  10647. // "customerId": {
  10648. // "description": "Immutable ID of the G Suite account",
  10649. // "location": "path",
  10650. // "required": true,
  10651. // "type": "string"
  10652. // },
  10653. // "orgUnitPath": {
  10654. // "default": "",
  10655. // "description": "the URL-encoded organizational unit's path or its ID",
  10656. // "location": "query",
  10657. // "type": "string"
  10658. // },
  10659. // "type": {
  10660. // "description": "Whether to return all sub-organizations or just immediate children",
  10661. // "enum": [
  10662. // "all",
  10663. // "children"
  10664. // ],
  10665. // "enumDescriptions": [
  10666. // "All sub-organizational units.",
  10667. // "Immediate children only (default)."
  10668. // ],
  10669. // "location": "query",
  10670. // "type": "string"
  10671. // }
  10672. // },
  10673. // "path": "customer/{customerId}/orgunits",
  10674. // "response": {
  10675. // "$ref": "OrgUnits"
  10676. // },
  10677. // "scopes": [
  10678. // "https://www.googleapis.com/auth/admin.directory.orgunit",
  10679. // "https://www.googleapis.com/auth/admin.directory.orgunit.readonly"
  10680. // ]
  10681. // }
  10682. }
  10683. // method id "directory.orgunits.patch":
  10684. type OrgunitsPatchCall struct {
  10685. s *Service
  10686. customerId string
  10687. orgUnitPath []string
  10688. orgunit *OrgUnit
  10689. urlParams_ gensupport.URLParams
  10690. ctx_ context.Context
  10691. header_ http.Header
  10692. }
  10693. // Patch: Update organizational unit. This method supports patch
  10694. // semantics.
  10695. func (r *OrgunitsService) Patch(customerId string, orgUnitPath []string, orgunit *OrgUnit) *OrgunitsPatchCall {
  10696. c := &OrgunitsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10697. c.customerId = customerId
  10698. c.orgUnitPath = append([]string{}, orgUnitPath...)
  10699. c.orgunit = orgunit
  10700. return c
  10701. }
  10702. // Fields allows partial responses to be retrieved. See
  10703. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10704. // for more information.
  10705. func (c *OrgunitsPatchCall) Fields(s ...googleapi.Field) *OrgunitsPatchCall {
  10706. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10707. return c
  10708. }
  10709. // Context sets the context to be used in this call's Do method. Any
  10710. // pending HTTP request will be aborted if the provided context is
  10711. // canceled.
  10712. func (c *OrgunitsPatchCall) Context(ctx context.Context) *OrgunitsPatchCall {
  10713. c.ctx_ = ctx
  10714. return c
  10715. }
  10716. // Header returns an http.Header that can be modified by the caller to
  10717. // add HTTP headers to the request.
  10718. func (c *OrgunitsPatchCall) Header() http.Header {
  10719. if c.header_ == nil {
  10720. c.header_ = make(http.Header)
  10721. }
  10722. return c.header_
  10723. }
  10724. func (c *OrgunitsPatchCall) doRequest(alt string) (*http.Response, error) {
  10725. reqHeaders := make(http.Header)
  10726. for k, v := range c.header_ {
  10727. reqHeaders[k] = v
  10728. }
  10729. reqHeaders.Set("User-Agent", c.s.userAgent())
  10730. var body io.Reader = nil
  10731. body, err := googleapi.WithoutDataWrapper.JSONReader(c.orgunit)
  10732. if err != nil {
  10733. return nil, err
  10734. }
  10735. reqHeaders.Set("Content-Type", "application/json")
  10736. c.urlParams_.Set("alt", alt)
  10737. c.urlParams_.Set("prettyPrint", "false")
  10738. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  10739. urls += "?" + c.urlParams_.Encode()
  10740. req, err := http.NewRequest("PATCH", urls, body)
  10741. if err != nil {
  10742. return nil, err
  10743. }
  10744. req.Header = reqHeaders
  10745. googleapi.Expand(req.URL, map[string]string{
  10746. "customerId": c.customerId,
  10747. "orgUnitPath": c.orgUnitPath[0],
  10748. })
  10749. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10750. }
  10751. // Do executes the "directory.orgunits.patch" call.
  10752. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  10753. // code is an error. Response headers are in either
  10754. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  10755. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10756. // check whether the returned error was because http.StatusNotModified
  10757. // was returned.
  10758. func (c *OrgunitsPatchCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  10759. gensupport.SetOptions(c.urlParams_, opts...)
  10760. res, err := c.doRequest("json")
  10761. if res != nil && res.StatusCode == http.StatusNotModified {
  10762. if res.Body != nil {
  10763. res.Body.Close()
  10764. }
  10765. return nil, &googleapi.Error{
  10766. Code: res.StatusCode,
  10767. Header: res.Header,
  10768. }
  10769. }
  10770. if err != nil {
  10771. return nil, err
  10772. }
  10773. defer googleapi.CloseBody(res)
  10774. if err := googleapi.CheckResponse(res); err != nil {
  10775. return nil, err
  10776. }
  10777. ret := &OrgUnit{
  10778. ServerResponse: googleapi.ServerResponse{
  10779. Header: res.Header,
  10780. HTTPStatusCode: res.StatusCode,
  10781. },
  10782. }
  10783. target := &ret
  10784. if err := gensupport.DecodeResponse(target, res); err != nil {
  10785. return nil, err
  10786. }
  10787. return ret, nil
  10788. // {
  10789. // "description": "Update organizational unit. This method supports patch semantics.",
  10790. // "httpMethod": "PATCH",
  10791. // "id": "directory.orgunits.patch",
  10792. // "parameterOrder": [
  10793. // "customerId",
  10794. // "orgUnitPath"
  10795. // ],
  10796. // "parameters": {
  10797. // "customerId": {
  10798. // "description": "Immutable ID of the G Suite account",
  10799. // "location": "path",
  10800. // "required": true,
  10801. // "type": "string"
  10802. // },
  10803. // "orgUnitPath": {
  10804. // "description": "Full path of the organizational unit or its ID",
  10805. // "location": "path",
  10806. // "repeated": true,
  10807. // "required": true,
  10808. // "type": "string"
  10809. // }
  10810. // },
  10811. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  10812. // "request": {
  10813. // "$ref": "OrgUnit"
  10814. // },
  10815. // "response": {
  10816. // "$ref": "OrgUnit"
  10817. // },
  10818. // "scopes": [
  10819. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  10820. // ]
  10821. // }
  10822. }
  10823. // method id "directory.orgunits.update":
  10824. type OrgunitsUpdateCall struct {
  10825. s *Service
  10826. customerId string
  10827. orgUnitPath []string
  10828. orgunit *OrgUnit
  10829. urlParams_ gensupport.URLParams
  10830. ctx_ context.Context
  10831. header_ http.Header
  10832. }
  10833. // Update: Update organizational unit
  10834. func (r *OrgunitsService) Update(customerId string, orgUnitPath []string, orgunit *OrgUnit) *OrgunitsUpdateCall {
  10835. c := &OrgunitsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10836. c.customerId = customerId
  10837. c.orgUnitPath = append([]string{}, orgUnitPath...)
  10838. c.orgunit = orgunit
  10839. return c
  10840. }
  10841. // Fields allows partial responses to be retrieved. See
  10842. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10843. // for more information.
  10844. func (c *OrgunitsUpdateCall) Fields(s ...googleapi.Field) *OrgunitsUpdateCall {
  10845. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10846. return c
  10847. }
  10848. // Context sets the context to be used in this call's Do method. Any
  10849. // pending HTTP request will be aborted if the provided context is
  10850. // canceled.
  10851. func (c *OrgunitsUpdateCall) Context(ctx context.Context) *OrgunitsUpdateCall {
  10852. c.ctx_ = ctx
  10853. return c
  10854. }
  10855. // Header returns an http.Header that can be modified by the caller to
  10856. // add HTTP headers to the request.
  10857. func (c *OrgunitsUpdateCall) Header() http.Header {
  10858. if c.header_ == nil {
  10859. c.header_ = make(http.Header)
  10860. }
  10861. return c.header_
  10862. }
  10863. func (c *OrgunitsUpdateCall) doRequest(alt string) (*http.Response, error) {
  10864. reqHeaders := make(http.Header)
  10865. for k, v := range c.header_ {
  10866. reqHeaders[k] = v
  10867. }
  10868. reqHeaders.Set("User-Agent", c.s.userAgent())
  10869. var body io.Reader = nil
  10870. body, err := googleapi.WithoutDataWrapper.JSONReader(c.orgunit)
  10871. if err != nil {
  10872. return nil, err
  10873. }
  10874. reqHeaders.Set("Content-Type", "application/json")
  10875. c.urlParams_.Set("alt", alt)
  10876. c.urlParams_.Set("prettyPrint", "false")
  10877. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  10878. urls += "?" + c.urlParams_.Encode()
  10879. req, err := http.NewRequest("PUT", urls, body)
  10880. if err != nil {
  10881. return nil, err
  10882. }
  10883. req.Header = reqHeaders
  10884. googleapi.Expand(req.URL, map[string]string{
  10885. "customerId": c.customerId,
  10886. "orgUnitPath": c.orgUnitPath[0],
  10887. })
  10888. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10889. }
  10890. // Do executes the "directory.orgunits.update" call.
  10891. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  10892. // code is an error. Response headers are in either
  10893. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  10894. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10895. // check whether the returned error was because http.StatusNotModified
  10896. // was returned.
  10897. func (c *OrgunitsUpdateCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  10898. gensupport.SetOptions(c.urlParams_, opts...)
  10899. res, err := c.doRequest("json")
  10900. if res != nil && res.StatusCode == http.StatusNotModified {
  10901. if res.Body != nil {
  10902. res.Body.Close()
  10903. }
  10904. return nil, &googleapi.Error{
  10905. Code: res.StatusCode,
  10906. Header: res.Header,
  10907. }
  10908. }
  10909. if err != nil {
  10910. return nil, err
  10911. }
  10912. defer googleapi.CloseBody(res)
  10913. if err := googleapi.CheckResponse(res); err != nil {
  10914. return nil, err
  10915. }
  10916. ret := &OrgUnit{
  10917. ServerResponse: googleapi.ServerResponse{
  10918. Header: res.Header,
  10919. HTTPStatusCode: res.StatusCode,
  10920. },
  10921. }
  10922. target := &ret
  10923. if err := gensupport.DecodeResponse(target, res); err != nil {
  10924. return nil, err
  10925. }
  10926. return ret, nil
  10927. // {
  10928. // "description": "Update organizational unit",
  10929. // "httpMethod": "PUT",
  10930. // "id": "directory.orgunits.update",
  10931. // "parameterOrder": [
  10932. // "customerId",
  10933. // "orgUnitPath"
  10934. // ],
  10935. // "parameters": {
  10936. // "customerId": {
  10937. // "description": "Immutable ID of the G Suite account",
  10938. // "location": "path",
  10939. // "required": true,
  10940. // "type": "string"
  10941. // },
  10942. // "orgUnitPath": {
  10943. // "description": "Full path of the organizational unit or its ID",
  10944. // "location": "path",
  10945. // "repeated": true,
  10946. // "required": true,
  10947. // "type": "string"
  10948. // }
  10949. // },
  10950. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  10951. // "request": {
  10952. // "$ref": "OrgUnit"
  10953. // },
  10954. // "response": {
  10955. // "$ref": "OrgUnit"
  10956. // },
  10957. // "scopes": [
  10958. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  10959. // ]
  10960. // }
  10961. }
  10962. // method id "directory.privileges.list":
  10963. type PrivilegesListCall struct {
  10964. s *Service
  10965. customer string
  10966. urlParams_ gensupport.URLParams
  10967. ifNoneMatch_ string
  10968. ctx_ context.Context
  10969. header_ http.Header
  10970. }
  10971. // List: Retrieves a paginated list of all privileges for a customer.
  10972. func (r *PrivilegesService) List(customer string) *PrivilegesListCall {
  10973. c := &PrivilegesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10974. c.customer = customer
  10975. return c
  10976. }
  10977. // Fields allows partial responses to be retrieved. See
  10978. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10979. // for more information.
  10980. func (c *PrivilegesListCall) Fields(s ...googleapi.Field) *PrivilegesListCall {
  10981. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10982. return c
  10983. }
  10984. // IfNoneMatch sets the optional parameter which makes the operation
  10985. // fail if the object's ETag matches the given value. This is useful for
  10986. // getting updates only after the object has changed since the last
  10987. // request. Use googleapi.IsNotModified to check whether the response
  10988. // error from Do is the result of In-None-Match.
  10989. func (c *PrivilegesListCall) IfNoneMatch(entityTag string) *PrivilegesListCall {
  10990. c.ifNoneMatch_ = entityTag
  10991. return c
  10992. }
  10993. // Context sets the context to be used in this call's Do method. Any
  10994. // pending HTTP request will be aborted if the provided context is
  10995. // canceled.
  10996. func (c *PrivilegesListCall) Context(ctx context.Context) *PrivilegesListCall {
  10997. c.ctx_ = ctx
  10998. return c
  10999. }
  11000. // Header returns an http.Header that can be modified by the caller to
  11001. // add HTTP headers to the request.
  11002. func (c *PrivilegesListCall) Header() http.Header {
  11003. if c.header_ == nil {
  11004. c.header_ = make(http.Header)
  11005. }
  11006. return c.header_
  11007. }
  11008. func (c *PrivilegesListCall) doRequest(alt string) (*http.Response, error) {
  11009. reqHeaders := make(http.Header)
  11010. for k, v := range c.header_ {
  11011. reqHeaders[k] = v
  11012. }
  11013. reqHeaders.Set("User-Agent", c.s.userAgent())
  11014. if c.ifNoneMatch_ != "" {
  11015. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11016. }
  11017. var body io.Reader = nil
  11018. c.urlParams_.Set("alt", alt)
  11019. c.urlParams_.Set("prettyPrint", "false")
  11020. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/ALL/privileges")
  11021. urls += "?" + c.urlParams_.Encode()
  11022. req, err := http.NewRequest("GET", urls, body)
  11023. if err != nil {
  11024. return nil, err
  11025. }
  11026. req.Header = reqHeaders
  11027. googleapi.Expand(req.URL, map[string]string{
  11028. "customer": c.customer,
  11029. })
  11030. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11031. }
  11032. // Do executes the "directory.privileges.list" call.
  11033. // Exactly one of *Privileges or error will be non-nil. Any non-2xx
  11034. // status code is an error. Response headers are in either
  11035. // *Privileges.ServerResponse.Header or (if a response was returned at
  11036. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11037. // to check whether the returned error was because
  11038. // http.StatusNotModified was returned.
  11039. func (c *PrivilegesListCall) Do(opts ...googleapi.CallOption) (*Privileges, error) {
  11040. gensupport.SetOptions(c.urlParams_, opts...)
  11041. res, err := c.doRequest("json")
  11042. if res != nil && res.StatusCode == http.StatusNotModified {
  11043. if res.Body != nil {
  11044. res.Body.Close()
  11045. }
  11046. return nil, &googleapi.Error{
  11047. Code: res.StatusCode,
  11048. Header: res.Header,
  11049. }
  11050. }
  11051. if err != nil {
  11052. return nil, err
  11053. }
  11054. defer googleapi.CloseBody(res)
  11055. if err := googleapi.CheckResponse(res); err != nil {
  11056. return nil, err
  11057. }
  11058. ret := &Privileges{
  11059. ServerResponse: googleapi.ServerResponse{
  11060. Header: res.Header,
  11061. HTTPStatusCode: res.StatusCode,
  11062. },
  11063. }
  11064. target := &ret
  11065. if err := gensupport.DecodeResponse(target, res); err != nil {
  11066. return nil, err
  11067. }
  11068. return ret, nil
  11069. // {
  11070. // "description": "Retrieves a paginated list of all privileges for a customer.",
  11071. // "httpMethod": "GET",
  11072. // "id": "directory.privileges.list",
  11073. // "parameterOrder": [
  11074. // "customer"
  11075. // ],
  11076. // "parameters": {
  11077. // "customer": {
  11078. // "description": "Immutable ID of the G Suite account.",
  11079. // "location": "path",
  11080. // "required": true,
  11081. // "type": "string"
  11082. // }
  11083. // },
  11084. // "path": "customer/{customer}/roles/ALL/privileges",
  11085. // "response": {
  11086. // "$ref": "Privileges"
  11087. // },
  11088. // "scopes": [
  11089. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  11090. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  11091. // ]
  11092. // }
  11093. }
  11094. // method id "directory.resolvedAppAccessSettings.GetSettings":
  11095. type ResolvedAppAccessSettingsGetSettingsCall struct {
  11096. s *Service
  11097. urlParams_ gensupport.URLParams
  11098. ifNoneMatch_ string
  11099. ctx_ context.Context
  11100. header_ http.Header
  11101. }
  11102. // GetSettings: Retrieves resolved app access settings of the logged in
  11103. // user.
  11104. func (r *ResolvedAppAccessSettingsService) GetSettings() *ResolvedAppAccessSettingsGetSettingsCall {
  11105. c := &ResolvedAppAccessSettingsGetSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11106. return c
  11107. }
  11108. // Fields allows partial responses to be retrieved. See
  11109. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11110. // for more information.
  11111. func (c *ResolvedAppAccessSettingsGetSettingsCall) Fields(s ...googleapi.Field) *ResolvedAppAccessSettingsGetSettingsCall {
  11112. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11113. return c
  11114. }
  11115. // IfNoneMatch sets the optional parameter which makes the operation
  11116. // fail if the object's ETag matches the given value. This is useful for
  11117. // getting updates only after the object has changed since the last
  11118. // request. Use googleapi.IsNotModified to check whether the response
  11119. // error from Do is the result of In-None-Match.
  11120. func (c *ResolvedAppAccessSettingsGetSettingsCall) IfNoneMatch(entityTag string) *ResolvedAppAccessSettingsGetSettingsCall {
  11121. c.ifNoneMatch_ = entityTag
  11122. return c
  11123. }
  11124. // Context sets the context to be used in this call's Do method. Any
  11125. // pending HTTP request will be aborted if the provided context is
  11126. // canceled.
  11127. func (c *ResolvedAppAccessSettingsGetSettingsCall) Context(ctx context.Context) *ResolvedAppAccessSettingsGetSettingsCall {
  11128. c.ctx_ = ctx
  11129. return c
  11130. }
  11131. // Header returns an http.Header that can be modified by the caller to
  11132. // add HTTP headers to the request.
  11133. func (c *ResolvedAppAccessSettingsGetSettingsCall) Header() http.Header {
  11134. if c.header_ == nil {
  11135. c.header_ = make(http.Header)
  11136. }
  11137. return c.header_
  11138. }
  11139. func (c *ResolvedAppAccessSettingsGetSettingsCall) doRequest(alt string) (*http.Response, error) {
  11140. reqHeaders := make(http.Header)
  11141. for k, v := range c.header_ {
  11142. reqHeaders[k] = v
  11143. }
  11144. reqHeaders.Set("User-Agent", c.s.userAgent())
  11145. if c.ifNoneMatch_ != "" {
  11146. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11147. }
  11148. var body io.Reader = nil
  11149. c.urlParams_.Set("alt", alt)
  11150. c.urlParams_.Set("prettyPrint", "false")
  11151. urls := googleapi.ResolveRelative(c.s.BasePath, "resolvedappaccesssettings")
  11152. urls += "?" + c.urlParams_.Encode()
  11153. req, err := http.NewRequest("GET", urls, body)
  11154. if err != nil {
  11155. return nil, err
  11156. }
  11157. req.Header = reqHeaders
  11158. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11159. }
  11160. // Do executes the "directory.resolvedAppAccessSettings.GetSettings" call.
  11161. // Exactly one of *AppAccessCollections or error will be non-nil. Any
  11162. // non-2xx status code is an error. Response headers are in either
  11163. // *AppAccessCollections.ServerResponse.Header or (if a response was
  11164. // returned at all) in error.(*googleapi.Error).Header. Use
  11165. // googleapi.IsNotModified to check whether the returned error was
  11166. // because http.StatusNotModified was returned.
  11167. func (c *ResolvedAppAccessSettingsGetSettingsCall) Do(opts ...googleapi.CallOption) (*AppAccessCollections, error) {
  11168. gensupport.SetOptions(c.urlParams_, opts...)
  11169. res, err := c.doRequest("json")
  11170. if res != nil && res.StatusCode == http.StatusNotModified {
  11171. if res.Body != nil {
  11172. res.Body.Close()
  11173. }
  11174. return nil, &googleapi.Error{
  11175. Code: res.StatusCode,
  11176. Header: res.Header,
  11177. }
  11178. }
  11179. if err != nil {
  11180. return nil, err
  11181. }
  11182. defer googleapi.CloseBody(res)
  11183. if err := googleapi.CheckResponse(res); err != nil {
  11184. return nil, err
  11185. }
  11186. ret := &AppAccessCollections{
  11187. ServerResponse: googleapi.ServerResponse{
  11188. Header: res.Header,
  11189. HTTPStatusCode: res.StatusCode,
  11190. },
  11191. }
  11192. target := &ret
  11193. if err := gensupport.DecodeResponse(target, res); err != nil {
  11194. return nil, err
  11195. }
  11196. return ret, nil
  11197. // {
  11198. // "description": "Retrieves resolved app access settings of the logged in user.",
  11199. // "httpMethod": "GET",
  11200. // "id": "directory.resolvedAppAccessSettings.GetSettings",
  11201. // "path": "resolvedappaccesssettings",
  11202. // "response": {
  11203. // "$ref": "AppAccessCollections"
  11204. // }
  11205. // }
  11206. }
  11207. // method id "directory.resolvedAppAccessSettings.ListTrustedApps":
  11208. type ResolvedAppAccessSettingsListTrustedAppsCall struct {
  11209. s *Service
  11210. urlParams_ gensupport.URLParams
  11211. ifNoneMatch_ string
  11212. ctx_ context.Context
  11213. header_ http.Header
  11214. }
  11215. // ListTrustedApps: Retrieves the list of apps trusted by the admin of
  11216. // the logged in user.
  11217. func (r *ResolvedAppAccessSettingsService) ListTrustedApps() *ResolvedAppAccessSettingsListTrustedAppsCall {
  11218. c := &ResolvedAppAccessSettingsListTrustedAppsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11219. return c
  11220. }
  11221. // Fields allows partial responses to be retrieved. See
  11222. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11223. // for more information.
  11224. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) Fields(s ...googleapi.Field) *ResolvedAppAccessSettingsListTrustedAppsCall {
  11225. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11226. return c
  11227. }
  11228. // IfNoneMatch sets the optional parameter which makes the operation
  11229. // fail if the object's ETag matches the given value. This is useful for
  11230. // getting updates only after the object has changed since the last
  11231. // request. Use googleapi.IsNotModified to check whether the response
  11232. // error from Do is the result of In-None-Match.
  11233. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) IfNoneMatch(entityTag string) *ResolvedAppAccessSettingsListTrustedAppsCall {
  11234. c.ifNoneMatch_ = entityTag
  11235. return c
  11236. }
  11237. // Context sets the context to be used in this call's Do method. Any
  11238. // pending HTTP request will be aborted if the provided context is
  11239. // canceled.
  11240. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) Context(ctx context.Context) *ResolvedAppAccessSettingsListTrustedAppsCall {
  11241. c.ctx_ = ctx
  11242. return c
  11243. }
  11244. // Header returns an http.Header that can be modified by the caller to
  11245. // add HTTP headers to the request.
  11246. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) Header() http.Header {
  11247. if c.header_ == nil {
  11248. c.header_ = make(http.Header)
  11249. }
  11250. return c.header_
  11251. }
  11252. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) doRequest(alt string) (*http.Response, error) {
  11253. reqHeaders := make(http.Header)
  11254. for k, v := range c.header_ {
  11255. reqHeaders[k] = v
  11256. }
  11257. reqHeaders.Set("User-Agent", c.s.userAgent())
  11258. if c.ifNoneMatch_ != "" {
  11259. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11260. }
  11261. var body io.Reader = nil
  11262. c.urlParams_.Set("alt", alt)
  11263. c.urlParams_.Set("prettyPrint", "false")
  11264. urls := googleapi.ResolveRelative(c.s.BasePath, "trustedapps")
  11265. urls += "?" + c.urlParams_.Encode()
  11266. req, err := http.NewRequest("GET", urls, body)
  11267. if err != nil {
  11268. return nil, err
  11269. }
  11270. req.Header = reqHeaders
  11271. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11272. }
  11273. // Do executes the "directory.resolvedAppAccessSettings.ListTrustedApps" call.
  11274. // Exactly one of *TrustedApps or error will be non-nil. Any non-2xx
  11275. // status code is an error. Response headers are in either
  11276. // *TrustedApps.ServerResponse.Header or (if a response was returned at
  11277. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11278. // to check whether the returned error was because
  11279. // http.StatusNotModified was returned.
  11280. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) Do(opts ...googleapi.CallOption) (*TrustedApps, error) {
  11281. gensupport.SetOptions(c.urlParams_, opts...)
  11282. res, err := c.doRequest("json")
  11283. if res != nil && res.StatusCode == http.StatusNotModified {
  11284. if res.Body != nil {
  11285. res.Body.Close()
  11286. }
  11287. return nil, &googleapi.Error{
  11288. Code: res.StatusCode,
  11289. Header: res.Header,
  11290. }
  11291. }
  11292. if err != nil {
  11293. return nil, err
  11294. }
  11295. defer googleapi.CloseBody(res)
  11296. if err := googleapi.CheckResponse(res); err != nil {
  11297. return nil, err
  11298. }
  11299. ret := &TrustedApps{
  11300. ServerResponse: googleapi.ServerResponse{
  11301. Header: res.Header,
  11302. HTTPStatusCode: res.StatusCode,
  11303. },
  11304. }
  11305. target := &ret
  11306. if err := gensupport.DecodeResponse(target, res); err != nil {
  11307. return nil, err
  11308. }
  11309. return ret, nil
  11310. // {
  11311. // "description": "Retrieves the list of apps trusted by the admin of the logged in user.",
  11312. // "httpMethod": "GET",
  11313. // "id": "directory.resolvedAppAccessSettings.ListTrustedApps",
  11314. // "path": "trustedapps",
  11315. // "response": {
  11316. // "$ref": "TrustedApps"
  11317. // }
  11318. // }
  11319. }
  11320. // method id "directory.resources.buildings.delete":
  11321. type ResourcesBuildingsDeleteCall struct {
  11322. s *Service
  11323. customer string
  11324. buildingId string
  11325. urlParams_ gensupport.URLParams
  11326. ctx_ context.Context
  11327. header_ http.Header
  11328. }
  11329. // Delete: Deletes a building.
  11330. func (r *ResourcesBuildingsService) Delete(customer string, buildingId string) *ResourcesBuildingsDeleteCall {
  11331. c := &ResourcesBuildingsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11332. c.customer = customer
  11333. c.buildingId = buildingId
  11334. return c
  11335. }
  11336. // Fields allows partial responses to be retrieved. See
  11337. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11338. // for more information.
  11339. func (c *ResourcesBuildingsDeleteCall) Fields(s ...googleapi.Field) *ResourcesBuildingsDeleteCall {
  11340. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11341. return c
  11342. }
  11343. // Context sets the context to be used in this call's Do method. Any
  11344. // pending HTTP request will be aborted if the provided context is
  11345. // canceled.
  11346. func (c *ResourcesBuildingsDeleteCall) Context(ctx context.Context) *ResourcesBuildingsDeleteCall {
  11347. c.ctx_ = ctx
  11348. return c
  11349. }
  11350. // Header returns an http.Header that can be modified by the caller to
  11351. // add HTTP headers to the request.
  11352. func (c *ResourcesBuildingsDeleteCall) Header() http.Header {
  11353. if c.header_ == nil {
  11354. c.header_ = make(http.Header)
  11355. }
  11356. return c.header_
  11357. }
  11358. func (c *ResourcesBuildingsDeleteCall) doRequest(alt string) (*http.Response, error) {
  11359. reqHeaders := make(http.Header)
  11360. for k, v := range c.header_ {
  11361. reqHeaders[k] = v
  11362. }
  11363. reqHeaders.Set("User-Agent", c.s.userAgent())
  11364. var body io.Reader = nil
  11365. c.urlParams_.Set("alt", alt)
  11366. c.urlParams_.Set("prettyPrint", "false")
  11367. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings/{buildingId}")
  11368. urls += "?" + c.urlParams_.Encode()
  11369. req, err := http.NewRequest("DELETE", urls, body)
  11370. if err != nil {
  11371. return nil, err
  11372. }
  11373. req.Header = reqHeaders
  11374. googleapi.Expand(req.URL, map[string]string{
  11375. "customer": c.customer,
  11376. "buildingId": c.buildingId,
  11377. })
  11378. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11379. }
  11380. // Do executes the "directory.resources.buildings.delete" call.
  11381. func (c *ResourcesBuildingsDeleteCall) Do(opts ...googleapi.CallOption) error {
  11382. gensupport.SetOptions(c.urlParams_, opts...)
  11383. res, err := c.doRequest("json")
  11384. if err != nil {
  11385. return err
  11386. }
  11387. defer googleapi.CloseBody(res)
  11388. if err := googleapi.CheckResponse(res); err != nil {
  11389. return err
  11390. }
  11391. return nil
  11392. // {
  11393. // "description": "Deletes a building.",
  11394. // "httpMethod": "DELETE",
  11395. // "id": "directory.resources.buildings.delete",
  11396. // "parameterOrder": [
  11397. // "customer",
  11398. // "buildingId"
  11399. // ],
  11400. // "parameters": {
  11401. // "buildingId": {
  11402. // "description": "The ID of the building to delete.",
  11403. // "location": "path",
  11404. // "required": true,
  11405. // "type": "string"
  11406. // },
  11407. // "customer": {
  11408. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  11409. // "location": "path",
  11410. // "required": true,
  11411. // "type": "string"
  11412. // }
  11413. // },
  11414. // "path": "customer/{customer}/resources/buildings/{buildingId}",
  11415. // "scopes": [
  11416. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  11417. // ]
  11418. // }
  11419. }
  11420. // method id "directory.resources.buildings.get":
  11421. type ResourcesBuildingsGetCall struct {
  11422. s *Service
  11423. customer string
  11424. buildingId string
  11425. urlParams_ gensupport.URLParams
  11426. ifNoneMatch_ string
  11427. ctx_ context.Context
  11428. header_ http.Header
  11429. }
  11430. // Get: Retrieves a building.
  11431. func (r *ResourcesBuildingsService) Get(customer string, buildingId string) *ResourcesBuildingsGetCall {
  11432. c := &ResourcesBuildingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11433. c.customer = customer
  11434. c.buildingId = buildingId
  11435. return c
  11436. }
  11437. // Fields allows partial responses to be retrieved. See
  11438. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11439. // for more information.
  11440. func (c *ResourcesBuildingsGetCall) Fields(s ...googleapi.Field) *ResourcesBuildingsGetCall {
  11441. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11442. return c
  11443. }
  11444. // IfNoneMatch sets the optional parameter which makes the operation
  11445. // fail if the object's ETag matches the given value. This is useful for
  11446. // getting updates only after the object has changed since the last
  11447. // request. Use googleapi.IsNotModified to check whether the response
  11448. // error from Do is the result of In-None-Match.
  11449. func (c *ResourcesBuildingsGetCall) IfNoneMatch(entityTag string) *ResourcesBuildingsGetCall {
  11450. c.ifNoneMatch_ = entityTag
  11451. return c
  11452. }
  11453. // Context sets the context to be used in this call's Do method. Any
  11454. // pending HTTP request will be aborted if the provided context is
  11455. // canceled.
  11456. func (c *ResourcesBuildingsGetCall) Context(ctx context.Context) *ResourcesBuildingsGetCall {
  11457. c.ctx_ = ctx
  11458. return c
  11459. }
  11460. // Header returns an http.Header that can be modified by the caller to
  11461. // add HTTP headers to the request.
  11462. func (c *ResourcesBuildingsGetCall) Header() http.Header {
  11463. if c.header_ == nil {
  11464. c.header_ = make(http.Header)
  11465. }
  11466. return c.header_
  11467. }
  11468. func (c *ResourcesBuildingsGetCall) doRequest(alt string) (*http.Response, error) {
  11469. reqHeaders := make(http.Header)
  11470. for k, v := range c.header_ {
  11471. reqHeaders[k] = v
  11472. }
  11473. reqHeaders.Set("User-Agent", c.s.userAgent())
  11474. if c.ifNoneMatch_ != "" {
  11475. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11476. }
  11477. var body io.Reader = nil
  11478. c.urlParams_.Set("alt", alt)
  11479. c.urlParams_.Set("prettyPrint", "false")
  11480. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings/{buildingId}")
  11481. urls += "?" + c.urlParams_.Encode()
  11482. req, err := http.NewRequest("GET", urls, body)
  11483. if err != nil {
  11484. return nil, err
  11485. }
  11486. req.Header = reqHeaders
  11487. googleapi.Expand(req.URL, map[string]string{
  11488. "customer": c.customer,
  11489. "buildingId": c.buildingId,
  11490. })
  11491. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11492. }
  11493. // Do executes the "directory.resources.buildings.get" call.
  11494. // Exactly one of *Building or error will be non-nil. Any non-2xx status
  11495. // code is an error. Response headers are in either
  11496. // *Building.ServerResponse.Header or (if a response was returned at
  11497. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11498. // to check whether the returned error was because
  11499. // http.StatusNotModified was returned.
  11500. func (c *ResourcesBuildingsGetCall) Do(opts ...googleapi.CallOption) (*Building, error) {
  11501. gensupport.SetOptions(c.urlParams_, opts...)
  11502. res, err := c.doRequest("json")
  11503. if res != nil && res.StatusCode == http.StatusNotModified {
  11504. if res.Body != nil {
  11505. res.Body.Close()
  11506. }
  11507. return nil, &googleapi.Error{
  11508. Code: res.StatusCode,
  11509. Header: res.Header,
  11510. }
  11511. }
  11512. if err != nil {
  11513. return nil, err
  11514. }
  11515. defer googleapi.CloseBody(res)
  11516. if err := googleapi.CheckResponse(res); err != nil {
  11517. return nil, err
  11518. }
  11519. ret := &Building{
  11520. ServerResponse: googleapi.ServerResponse{
  11521. Header: res.Header,
  11522. HTTPStatusCode: res.StatusCode,
  11523. },
  11524. }
  11525. target := &ret
  11526. if err := gensupport.DecodeResponse(target, res); err != nil {
  11527. return nil, err
  11528. }
  11529. return ret, nil
  11530. // {
  11531. // "description": "Retrieves a building.",
  11532. // "httpMethod": "GET",
  11533. // "id": "directory.resources.buildings.get",
  11534. // "parameterOrder": [
  11535. // "customer",
  11536. // "buildingId"
  11537. // ],
  11538. // "parameters": {
  11539. // "buildingId": {
  11540. // "description": "The unique ID of the building to retrieve.",
  11541. // "location": "path",
  11542. // "required": true,
  11543. // "type": "string"
  11544. // },
  11545. // "customer": {
  11546. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  11547. // "location": "path",
  11548. // "required": true,
  11549. // "type": "string"
  11550. // }
  11551. // },
  11552. // "path": "customer/{customer}/resources/buildings/{buildingId}",
  11553. // "response": {
  11554. // "$ref": "Building"
  11555. // },
  11556. // "scopes": [
  11557. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  11558. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  11559. // ]
  11560. // }
  11561. }
  11562. // method id "directory.resources.buildings.insert":
  11563. type ResourcesBuildingsInsertCall struct {
  11564. s *Service
  11565. customer string
  11566. building *Building
  11567. urlParams_ gensupport.URLParams
  11568. ctx_ context.Context
  11569. header_ http.Header
  11570. }
  11571. // Insert: Inserts a building.
  11572. func (r *ResourcesBuildingsService) Insert(customer string, building *Building) *ResourcesBuildingsInsertCall {
  11573. c := &ResourcesBuildingsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11574. c.customer = customer
  11575. c.building = building
  11576. return c
  11577. }
  11578. // CoordinatesSource sets the optional parameter "coordinatesSource":
  11579. // Source from which Building.coordinates are derived.
  11580. //
  11581. // Possible values:
  11582. // "CLIENT_SPECIFIED" - Building.coordinates are set to the
  11583. // coordinates included in the request.
  11584. // "RESOLVED_FROM_ADDRESS" - Building.coordinates are automatically
  11585. // populated based on the postal address.
  11586. // "SOURCE_UNSPECIFIED" (default) - Defaults to RESOLVED_FROM_ADDRESS
  11587. // if postal address is provided. Otherwise, defaults to
  11588. // CLIENT_SPECIFIED if coordinates are provided.
  11589. func (c *ResourcesBuildingsInsertCall) CoordinatesSource(coordinatesSource string) *ResourcesBuildingsInsertCall {
  11590. c.urlParams_.Set("coordinatesSource", coordinatesSource)
  11591. return c
  11592. }
  11593. // Fields allows partial responses to be retrieved. See
  11594. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11595. // for more information.
  11596. func (c *ResourcesBuildingsInsertCall) Fields(s ...googleapi.Field) *ResourcesBuildingsInsertCall {
  11597. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11598. return c
  11599. }
  11600. // Context sets the context to be used in this call's Do method. Any
  11601. // pending HTTP request will be aborted if the provided context is
  11602. // canceled.
  11603. func (c *ResourcesBuildingsInsertCall) Context(ctx context.Context) *ResourcesBuildingsInsertCall {
  11604. c.ctx_ = ctx
  11605. return c
  11606. }
  11607. // Header returns an http.Header that can be modified by the caller to
  11608. // add HTTP headers to the request.
  11609. func (c *ResourcesBuildingsInsertCall) Header() http.Header {
  11610. if c.header_ == nil {
  11611. c.header_ = make(http.Header)
  11612. }
  11613. return c.header_
  11614. }
  11615. func (c *ResourcesBuildingsInsertCall) doRequest(alt string) (*http.Response, error) {
  11616. reqHeaders := make(http.Header)
  11617. for k, v := range c.header_ {
  11618. reqHeaders[k] = v
  11619. }
  11620. reqHeaders.Set("User-Agent", c.s.userAgent())
  11621. var body io.Reader = nil
  11622. body, err := googleapi.WithoutDataWrapper.JSONReader(c.building)
  11623. if err != nil {
  11624. return nil, err
  11625. }
  11626. reqHeaders.Set("Content-Type", "application/json")
  11627. c.urlParams_.Set("alt", alt)
  11628. c.urlParams_.Set("prettyPrint", "false")
  11629. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings")
  11630. urls += "?" + c.urlParams_.Encode()
  11631. req, err := http.NewRequest("POST", urls, body)
  11632. if err != nil {
  11633. return nil, err
  11634. }
  11635. req.Header = reqHeaders
  11636. googleapi.Expand(req.URL, map[string]string{
  11637. "customer": c.customer,
  11638. })
  11639. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11640. }
  11641. // Do executes the "directory.resources.buildings.insert" call.
  11642. // Exactly one of *Building or error will be non-nil. Any non-2xx status
  11643. // code is an error. Response headers are in either
  11644. // *Building.ServerResponse.Header or (if a response was returned at
  11645. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11646. // to check whether the returned error was because
  11647. // http.StatusNotModified was returned.
  11648. func (c *ResourcesBuildingsInsertCall) Do(opts ...googleapi.CallOption) (*Building, error) {
  11649. gensupport.SetOptions(c.urlParams_, opts...)
  11650. res, err := c.doRequest("json")
  11651. if res != nil && res.StatusCode == http.StatusNotModified {
  11652. if res.Body != nil {
  11653. res.Body.Close()
  11654. }
  11655. return nil, &googleapi.Error{
  11656. Code: res.StatusCode,
  11657. Header: res.Header,
  11658. }
  11659. }
  11660. if err != nil {
  11661. return nil, err
  11662. }
  11663. defer googleapi.CloseBody(res)
  11664. if err := googleapi.CheckResponse(res); err != nil {
  11665. return nil, err
  11666. }
  11667. ret := &Building{
  11668. ServerResponse: googleapi.ServerResponse{
  11669. Header: res.Header,
  11670. HTTPStatusCode: res.StatusCode,
  11671. },
  11672. }
  11673. target := &ret
  11674. if err := gensupport.DecodeResponse(target, res); err != nil {
  11675. return nil, err
  11676. }
  11677. return ret, nil
  11678. // {
  11679. // "description": "Inserts a building.",
  11680. // "httpMethod": "POST",
  11681. // "id": "directory.resources.buildings.insert",
  11682. // "parameterOrder": [
  11683. // "customer"
  11684. // ],
  11685. // "parameters": {
  11686. // "coordinatesSource": {
  11687. // "default": "SOURCE_UNSPECIFIED",
  11688. // "description": "Source from which Building.coordinates are derived.",
  11689. // "enum": [
  11690. // "CLIENT_SPECIFIED",
  11691. // "RESOLVED_FROM_ADDRESS",
  11692. // "SOURCE_UNSPECIFIED"
  11693. // ],
  11694. // "enumDescriptions": [
  11695. // "Building.coordinates are set to the coordinates included in the request.",
  11696. // "Building.coordinates are automatically populated based on the postal address.",
  11697. // "Defaults to RESOLVED_FROM_ADDRESS if postal address is provided. Otherwise, defaults to CLIENT_SPECIFIED if coordinates are provided."
  11698. // ],
  11699. // "location": "query",
  11700. // "type": "string"
  11701. // },
  11702. // "customer": {
  11703. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  11704. // "location": "path",
  11705. // "required": true,
  11706. // "type": "string"
  11707. // }
  11708. // },
  11709. // "path": "customer/{customer}/resources/buildings",
  11710. // "request": {
  11711. // "$ref": "Building"
  11712. // },
  11713. // "response": {
  11714. // "$ref": "Building"
  11715. // },
  11716. // "scopes": [
  11717. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  11718. // ]
  11719. // }
  11720. }
  11721. // method id "directory.resources.buildings.list":
  11722. type ResourcesBuildingsListCall struct {
  11723. s *Service
  11724. customer string
  11725. urlParams_ gensupport.URLParams
  11726. ifNoneMatch_ string
  11727. ctx_ context.Context
  11728. header_ http.Header
  11729. }
  11730. // List: Retrieves a list of buildings for an account.
  11731. func (r *ResourcesBuildingsService) List(customer string) *ResourcesBuildingsListCall {
  11732. c := &ResourcesBuildingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11733. c.customer = customer
  11734. return c
  11735. }
  11736. // MaxResults sets the optional parameter "maxResults": Maximum number
  11737. // of results to return.
  11738. func (c *ResourcesBuildingsListCall) MaxResults(maxResults int64) *ResourcesBuildingsListCall {
  11739. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  11740. return c
  11741. }
  11742. // PageToken sets the optional parameter "pageToken": Token to specify
  11743. // the next page in the list.
  11744. func (c *ResourcesBuildingsListCall) PageToken(pageToken string) *ResourcesBuildingsListCall {
  11745. c.urlParams_.Set("pageToken", pageToken)
  11746. return c
  11747. }
  11748. // Fields allows partial responses to be retrieved. See
  11749. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11750. // for more information.
  11751. func (c *ResourcesBuildingsListCall) Fields(s ...googleapi.Field) *ResourcesBuildingsListCall {
  11752. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11753. return c
  11754. }
  11755. // IfNoneMatch sets the optional parameter which makes the operation
  11756. // fail if the object's ETag matches the given value. This is useful for
  11757. // getting updates only after the object has changed since the last
  11758. // request. Use googleapi.IsNotModified to check whether the response
  11759. // error from Do is the result of In-None-Match.
  11760. func (c *ResourcesBuildingsListCall) IfNoneMatch(entityTag string) *ResourcesBuildingsListCall {
  11761. c.ifNoneMatch_ = entityTag
  11762. return c
  11763. }
  11764. // Context sets the context to be used in this call's Do method. Any
  11765. // pending HTTP request will be aborted if the provided context is
  11766. // canceled.
  11767. func (c *ResourcesBuildingsListCall) Context(ctx context.Context) *ResourcesBuildingsListCall {
  11768. c.ctx_ = ctx
  11769. return c
  11770. }
  11771. // Header returns an http.Header that can be modified by the caller to
  11772. // add HTTP headers to the request.
  11773. func (c *ResourcesBuildingsListCall) Header() http.Header {
  11774. if c.header_ == nil {
  11775. c.header_ = make(http.Header)
  11776. }
  11777. return c.header_
  11778. }
  11779. func (c *ResourcesBuildingsListCall) doRequest(alt string) (*http.Response, error) {
  11780. reqHeaders := make(http.Header)
  11781. for k, v := range c.header_ {
  11782. reqHeaders[k] = v
  11783. }
  11784. reqHeaders.Set("User-Agent", c.s.userAgent())
  11785. if c.ifNoneMatch_ != "" {
  11786. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11787. }
  11788. var body io.Reader = nil
  11789. c.urlParams_.Set("alt", alt)
  11790. c.urlParams_.Set("prettyPrint", "false")
  11791. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings")
  11792. urls += "?" + c.urlParams_.Encode()
  11793. req, err := http.NewRequest("GET", urls, body)
  11794. if err != nil {
  11795. return nil, err
  11796. }
  11797. req.Header = reqHeaders
  11798. googleapi.Expand(req.URL, map[string]string{
  11799. "customer": c.customer,
  11800. })
  11801. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11802. }
  11803. // Do executes the "directory.resources.buildings.list" call.
  11804. // Exactly one of *Buildings or error will be non-nil. Any non-2xx
  11805. // status code is an error. Response headers are in either
  11806. // *Buildings.ServerResponse.Header or (if a response was returned at
  11807. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11808. // to check whether the returned error was because
  11809. // http.StatusNotModified was returned.
  11810. func (c *ResourcesBuildingsListCall) Do(opts ...googleapi.CallOption) (*Buildings, error) {
  11811. gensupport.SetOptions(c.urlParams_, opts...)
  11812. res, err := c.doRequest("json")
  11813. if res != nil && res.StatusCode == http.StatusNotModified {
  11814. if res.Body != nil {
  11815. res.Body.Close()
  11816. }
  11817. return nil, &googleapi.Error{
  11818. Code: res.StatusCode,
  11819. Header: res.Header,
  11820. }
  11821. }
  11822. if err != nil {
  11823. return nil, err
  11824. }
  11825. defer googleapi.CloseBody(res)
  11826. if err := googleapi.CheckResponse(res); err != nil {
  11827. return nil, err
  11828. }
  11829. ret := &Buildings{
  11830. ServerResponse: googleapi.ServerResponse{
  11831. Header: res.Header,
  11832. HTTPStatusCode: res.StatusCode,
  11833. },
  11834. }
  11835. target := &ret
  11836. if err := gensupport.DecodeResponse(target, res); err != nil {
  11837. return nil, err
  11838. }
  11839. return ret, nil
  11840. // {
  11841. // "description": "Retrieves a list of buildings for an account.",
  11842. // "httpMethod": "GET",
  11843. // "id": "directory.resources.buildings.list",
  11844. // "parameterOrder": [
  11845. // "customer"
  11846. // ],
  11847. // "parameters": {
  11848. // "customer": {
  11849. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  11850. // "location": "path",
  11851. // "required": true,
  11852. // "type": "string"
  11853. // },
  11854. // "maxResults": {
  11855. // "description": "Maximum number of results to return.",
  11856. // "format": "int32",
  11857. // "location": "query",
  11858. // "maximum": "500",
  11859. // "minimum": "1",
  11860. // "type": "integer"
  11861. // },
  11862. // "pageToken": {
  11863. // "description": "Token to specify the next page in the list.",
  11864. // "location": "query",
  11865. // "type": "string"
  11866. // }
  11867. // },
  11868. // "path": "customer/{customer}/resources/buildings",
  11869. // "response": {
  11870. // "$ref": "Buildings"
  11871. // },
  11872. // "scopes": [
  11873. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  11874. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  11875. // ]
  11876. // }
  11877. }
  11878. // Pages invokes f for each page of results.
  11879. // A non-nil error returned from f will halt the iteration.
  11880. // The provided context supersedes any context provided to the Context method.
  11881. func (c *ResourcesBuildingsListCall) Pages(ctx context.Context, f func(*Buildings) error) error {
  11882. c.ctx_ = ctx
  11883. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  11884. for {
  11885. x, err := c.Do()
  11886. if err != nil {
  11887. return err
  11888. }
  11889. if err := f(x); err != nil {
  11890. return err
  11891. }
  11892. if x.NextPageToken == "" {
  11893. return nil
  11894. }
  11895. c.PageToken(x.NextPageToken)
  11896. }
  11897. }
  11898. // method id "directory.resources.buildings.patch":
  11899. type ResourcesBuildingsPatchCall struct {
  11900. s *Service
  11901. customer string
  11902. buildingId string
  11903. building *Building
  11904. urlParams_ gensupport.URLParams
  11905. ctx_ context.Context
  11906. header_ http.Header
  11907. }
  11908. // Patch: Updates a building. This method supports patch semantics.
  11909. func (r *ResourcesBuildingsService) Patch(customer string, buildingId string, building *Building) *ResourcesBuildingsPatchCall {
  11910. c := &ResourcesBuildingsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11911. c.customer = customer
  11912. c.buildingId = buildingId
  11913. c.building = building
  11914. return c
  11915. }
  11916. // CoordinatesSource sets the optional parameter "coordinatesSource":
  11917. // Source from which Building.coordinates are derived.
  11918. //
  11919. // Possible values:
  11920. // "CLIENT_SPECIFIED" - Building.coordinates are set to the
  11921. // coordinates included in the request.
  11922. // "RESOLVED_FROM_ADDRESS" - Building.coordinates are automatically
  11923. // populated based on the postal address.
  11924. // "SOURCE_UNSPECIFIED" (default) - Defaults to RESOLVED_FROM_ADDRESS
  11925. // if postal address is provided. Otherwise, defaults to
  11926. // CLIENT_SPECIFIED if coordinates are provided.
  11927. func (c *ResourcesBuildingsPatchCall) CoordinatesSource(coordinatesSource string) *ResourcesBuildingsPatchCall {
  11928. c.urlParams_.Set("coordinatesSource", coordinatesSource)
  11929. return c
  11930. }
  11931. // Fields allows partial responses to be retrieved. See
  11932. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11933. // for more information.
  11934. func (c *ResourcesBuildingsPatchCall) Fields(s ...googleapi.Field) *ResourcesBuildingsPatchCall {
  11935. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11936. return c
  11937. }
  11938. // Context sets the context to be used in this call's Do method. Any
  11939. // pending HTTP request will be aborted if the provided context is
  11940. // canceled.
  11941. func (c *ResourcesBuildingsPatchCall) Context(ctx context.Context) *ResourcesBuildingsPatchCall {
  11942. c.ctx_ = ctx
  11943. return c
  11944. }
  11945. // Header returns an http.Header that can be modified by the caller to
  11946. // add HTTP headers to the request.
  11947. func (c *ResourcesBuildingsPatchCall) Header() http.Header {
  11948. if c.header_ == nil {
  11949. c.header_ = make(http.Header)
  11950. }
  11951. return c.header_
  11952. }
  11953. func (c *ResourcesBuildingsPatchCall) doRequest(alt string) (*http.Response, error) {
  11954. reqHeaders := make(http.Header)
  11955. for k, v := range c.header_ {
  11956. reqHeaders[k] = v
  11957. }
  11958. reqHeaders.Set("User-Agent", c.s.userAgent())
  11959. var body io.Reader = nil
  11960. body, err := googleapi.WithoutDataWrapper.JSONReader(c.building)
  11961. if err != nil {
  11962. return nil, err
  11963. }
  11964. reqHeaders.Set("Content-Type", "application/json")
  11965. c.urlParams_.Set("alt", alt)
  11966. c.urlParams_.Set("prettyPrint", "false")
  11967. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings/{buildingId}")
  11968. urls += "?" + c.urlParams_.Encode()
  11969. req, err := http.NewRequest("PATCH", urls, body)
  11970. if err != nil {
  11971. return nil, err
  11972. }
  11973. req.Header = reqHeaders
  11974. googleapi.Expand(req.URL, map[string]string{
  11975. "customer": c.customer,
  11976. "buildingId": c.buildingId,
  11977. })
  11978. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11979. }
  11980. // Do executes the "directory.resources.buildings.patch" call.
  11981. // Exactly one of *Building or error will be non-nil. Any non-2xx status
  11982. // code is an error. Response headers are in either
  11983. // *Building.ServerResponse.Header or (if a response was returned at
  11984. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11985. // to check whether the returned error was because
  11986. // http.StatusNotModified was returned.
  11987. func (c *ResourcesBuildingsPatchCall) Do(opts ...googleapi.CallOption) (*Building, error) {
  11988. gensupport.SetOptions(c.urlParams_, opts...)
  11989. res, err := c.doRequest("json")
  11990. if res != nil && res.StatusCode == http.StatusNotModified {
  11991. if res.Body != nil {
  11992. res.Body.Close()
  11993. }
  11994. return nil, &googleapi.Error{
  11995. Code: res.StatusCode,
  11996. Header: res.Header,
  11997. }
  11998. }
  11999. if err != nil {
  12000. return nil, err
  12001. }
  12002. defer googleapi.CloseBody(res)
  12003. if err := googleapi.CheckResponse(res); err != nil {
  12004. return nil, err
  12005. }
  12006. ret := &Building{
  12007. ServerResponse: googleapi.ServerResponse{
  12008. Header: res.Header,
  12009. HTTPStatusCode: res.StatusCode,
  12010. },
  12011. }
  12012. target := &ret
  12013. if err := gensupport.DecodeResponse(target, res); err != nil {
  12014. return nil, err
  12015. }
  12016. return ret, nil
  12017. // {
  12018. // "description": "Updates a building. This method supports patch semantics.",
  12019. // "httpMethod": "PATCH",
  12020. // "id": "directory.resources.buildings.patch",
  12021. // "parameterOrder": [
  12022. // "customer",
  12023. // "buildingId"
  12024. // ],
  12025. // "parameters": {
  12026. // "buildingId": {
  12027. // "description": "The ID of the building to update.",
  12028. // "location": "path",
  12029. // "required": true,
  12030. // "type": "string"
  12031. // },
  12032. // "coordinatesSource": {
  12033. // "default": "SOURCE_UNSPECIFIED",
  12034. // "description": "Source from which Building.coordinates are derived.",
  12035. // "enum": [
  12036. // "CLIENT_SPECIFIED",
  12037. // "RESOLVED_FROM_ADDRESS",
  12038. // "SOURCE_UNSPECIFIED"
  12039. // ],
  12040. // "enumDescriptions": [
  12041. // "Building.coordinates are set to the coordinates included in the request.",
  12042. // "Building.coordinates are automatically populated based on the postal address.",
  12043. // "Defaults to RESOLVED_FROM_ADDRESS if postal address is provided. Otherwise, defaults to CLIENT_SPECIFIED if coordinates are provided."
  12044. // ],
  12045. // "location": "query",
  12046. // "type": "string"
  12047. // },
  12048. // "customer": {
  12049. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  12050. // "location": "path",
  12051. // "required": true,
  12052. // "type": "string"
  12053. // }
  12054. // },
  12055. // "path": "customer/{customer}/resources/buildings/{buildingId}",
  12056. // "request": {
  12057. // "$ref": "Building"
  12058. // },
  12059. // "response": {
  12060. // "$ref": "Building"
  12061. // },
  12062. // "scopes": [
  12063. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  12064. // ]
  12065. // }
  12066. }
  12067. // method id "directory.resources.buildings.update":
  12068. type ResourcesBuildingsUpdateCall struct {
  12069. s *Service
  12070. customer string
  12071. buildingId string
  12072. building *Building
  12073. urlParams_ gensupport.URLParams
  12074. ctx_ context.Context
  12075. header_ http.Header
  12076. }
  12077. // Update: Updates a building.
  12078. func (r *ResourcesBuildingsService) Update(customer string, buildingId string, building *Building) *ResourcesBuildingsUpdateCall {
  12079. c := &ResourcesBuildingsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12080. c.customer = customer
  12081. c.buildingId = buildingId
  12082. c.building = building
  12083. return c
  12084. }
  12085. // CoordinatesSource sets the optional parameter "coordinatesSource":
  12086. // Source from which Building.coordinates are derived.
  12087. //
  12088. // Possible values:
  12089. // "CLIENT_SPECIFIED" - Building.coordinates are set to the
  12090. // coordinates included in the request.
  12091. // "RESOLVED_FROM_ADDRESS" - Building.coordinates are automatically
  12092. // populated based on the postal address.
  12093. // "SOURCE_UNSPECIFIED" (default) - Defaults to RESOLVED_FROM_ADDRESS
  12094. // if postal address is provided. Otherwise, defaults to
  12095. // CLIENT_SPECIFIED if coordinates are provided.
  12096. func (c *ResourcesBuildingsUpdateCall) CoordinatesSource(coordinatesSource string) *ResourcesBuildingsUpdateCall {
  12097. c.urlParams_.Set("coordinatesSource", coordinatesSource)
  12098. return c
  12099. }
  12100. // Fields allows partial responses to be retrieved. See
  12101. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12102. // for more information.
  12103. func (c *ResourcesBuildingsUpdateCall) Fields(s ...googleapi.Field) *ResourcesBuildingsUpdateCall {
  12104. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12105. return c
  12106. }
  12107. // Context sets the context to be used in this call's Do method. Any
  12108. // pending HTTP request will be aborted if the provided context is
  12109. // canceled.
  12110. func (c *ResourcesBuildingsUpdateCall) Context(ctx context.Context) *ResourcesBuildingsUpdateCall {
  12111. c.ctx_ = ctx
  12112. return c
  12113. }
  12114. // Header returns an http.Header that can be modified by the caller to
  12115. // add HTTP headers to the request.
  12116. func (c *ResourcesBuildingsUpdateCall) Header() http.Header {
  12117. if c.header_ == nil {
  12118. c.header_ = make(http.Header)
  12119. }
  12120. return c.header_
  12121. }
  12122. func (c *ResourcesBuildingsUpdateCall) doRequest(alt string) (*http.Response, error) {
  12123. reqHeaders := make(http.Header)
  12124. for k, v := range c.header_ {
  12125. reqHeaders[k] = v
  12126. }
  12127. reqHeaders.Set("User-Agent", c.s.userAgent())
  12128. var body io.Reader = nil
  12129. body, err := googleapi.WithoutDataWrapper.JSONReader(c.building)
  12130. if err != nil {
  12131. return nil, err
  12132. }
  12133. reqHeaders.Set("Content-Type", "application/json")
  12134. c.urlParams_.Set("alt", alt)
  12135. c.urlParams_.Set("prettyPrint", "false")
  12136. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings/{buildingId}")
  12137. urls += "?" + c.urlParams_.Encode()
  12138. req, err := http.NewRequest("PUT", urls, body)
  12139. if err != nil {
  12140. return nil, err
  12141. }
  12142. req.Header = reqHeaders
  12143. googleapi.Expand(req.URL, map[string]string{
  12144. "customer": c.customer,
  12145. "buildingId": c.buildingId,
  12146. })
  12147. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12148. }
  12149. // Do executes the "directory.resources.buildings.update" call.
  12150. // Exactly one of *Building or error will be non-nil. Any non-2xx status
  12151. // code is an error. Response headers are in either
  12152. // *Building.ServerResponse.Header or (if a response was returned at
  12153. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12154. // to check whether the returned error was because
  12155. // http.StatusNotModified was returned.
  12156. func (c *ResourcesBuildingsUpdateCall) Do(opts ...googleapi.CallOption) (*Building, error) {
  12157. gensupport.SetOptions(c.urlParams_, opts...)
  12158. res, err := c.doRequest("json")
  12159. if res != nil && res.StatusCode == http.StatusNotModified {
  12160. if res.Body != nil {
  12161. res.Body.Close()
  12162. }
  12163. return nil, &googleapi.Error{
  12164. Code: res.StatusCode,
  12165. Header: res.Header,
  12166. }
  12167. }
  12168. if err != nil {
  12169. return nil, err
  12170. }
  12171. defer googleapi.CloseBody(res)
  12172. if err := googleapi.CheckResponse(res); err != nil {
  12173. return nil, err
  12174. }
  12175. ret := &Building{
  12176. ServerResponse: googleapi.ServerResponse{
  12177. Header: res.Header,
  12178. HTTPStatusCode: res.StatusCode,
  12179. },
  12180. }
  12181. target := &ret
  12182. if err := gensupport.DecodeResponse(target, res); err != nil {
  12183. return nil, err
  12184. }
  12185. return ret, nil
  12186. // {
  12187. // "description": "Updates a building.",
  12188. // "httpMethod": "PUT",
  12189. // "id": "directory.resources.buildings.update",
  12190. // "parameterOrder": [
  12191. // "customer",
  12192. // "buildingId"
  12193. // ],
  12194. // "parameters": {
  12195. // "buildingId": {
  12196. // "description": "The ID of the building to update.",
  12197. // "location": "path",
  12198. // "required": true,
  12199. // "type": "string"
  12200. // },
  12201. // "coordinatesSource": {
  12202. // "default": "SOURCE_UNSPECIFIED",
  12203. // "description": "Source from which Building.coordinates are derived.",
  12204. // "enum": [
  12205. // "CLIENT_SPECIFIED",
  12206. // "RESOLVED_FROM_ADDRESS",
  12207. // "SOURCE_UNSPECIFIED"
  12208. // ],
  12209. // "enumDescriptions": [
  12210. // "Building.coordinates are set to the coordinates included in the request.",
  12211. // "Building.coordinates are automatically populated based on the postal address.",
  12212. // "Defaults to RESOLVED_FROM_ADDRESS if postal address is provided. Otherwise, defaults to CLIENT_SPECIFIED if coordinates are provided."
  12213. // ],
  12214. // "location": "query",
  12215. // "type": "string"
  12216. // },
  12217. // "customer": {
  12218. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  12219. // "location": "path",
  12220. // "required": true,
  12221. // "type": "string"
  12222. // }
  12223. // },
  12224. // "path": "customer/{customer}/resources/buildings/{buildingId}",
  12225. // "request": {
  12226. // "$ref": "Building"
  12227. // },
  12228. // "response": {
  12229. // "$ref": "Building"
  12230. // },
  12231. // "scopes": [
  12232. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  12233. // ]
  12234. // }
  12235. }
  12236. // method id "directory.resources.calendars.delete":
  12237. type ResourcesCalendarsDeleteCall struct {
  12238. s *Service
  12239. customer string
  12240. calendarResourceId string
  12241. urlParams_ gensupport.URLParams
  12242. ctx_ context.Context
  12243. header_ http.Header
  12244. }
  12245. // Delete: Deletes a calendar resource.
  12246. func (r *ResourcesCalendarsService) Delete(customer string, calendarResourceId string) *ResourcesCalendarsDeleteCall {
  12247. c := &ResourcesCalendarsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12248. c.customer = customer
  12249. c.calendarResourceId = calendarResourceId
  12250. return c
  12251. }
  12252. // Fields allows partial responses to be retrieved. See
  12253. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12254. // for more information.
  12255. func (c *ResourcesCalendarsDeleteCall) Fields(s ...googleapi.Field) *ResourcesCalendarsDeleteCall {
  12256. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12257. return c
  12258. }
  12259. // Context sets the context to be used in this call's Do method. Any
  12260. // pending HTTP request will be aborted if the provided context is
  12261. // canceled.
  12262. func (c *ResourcesCalendarsDeleteCall) Context(ctx context.Context) *ResourcesCalendarsDeleteCall {
  12263. c.ctx_ = ctx
  12264. return c
  12265. }
  12266. // Header returns an http.Header that can be modified by the caller to
  12267. // add HTTP headers to the request.
  12268. func (c *ResourcesCalendarsDeleteCall) Header() http.Header {
  12269. if c.header_ == nil {
  12270. c.header_ = make(http.Header)
  12271. }
  12272. return c.header_
  12273. }
  12274. func (c *ResourcesCalendarsDeleteCall) doRequest(alt string) (*http.Response, error) {
  12275. reqHeaders := make(http.Header)
  12276. for k, v := range c.header_ {
  12277. reqHeaders[k] = v
  12278. }
  12279. reqHeaders.Set("User-Agent", c.s.userAgent())
  12280. var body io.Reader = nil
  12281. c.urlParams_.Set("alt", alt)
  12282. c.urlParams_.Set("prettyPrint", "false")
  12283. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  12284. urls += "?" + c.urlParams_.Encode()
  12285. req, err := http.NewRequest("DELETE", urls, body)
  12286. if err != nil {
  12287. return nil, err
  12288. }
  12289. req.Header = reqHeaders
  12290. googleapi.Expand(req.URL, map[string]string{
  12291. "customer": c.customer,
  12292. "calendarResourceId": c.calendarResourceId,
  12293. })
  12294. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12295. }
  12296. // Do executes the "directory.resources.calendars.delete" call.
  12297. func (c *ResourcesCalendarsDeleteCall) Do(opts ...googleapi.CallOption) error {
  12298. gensupport.SetOptions(c.urlParams_, opts...)
  12299. res, err := c.doRequest("json")
  12300. if err != nil {
  12301. return err
  12302. }
  12303. defer googleapi.CloseBody(res)
  12304. if err := googleapi.CheckResponse(res); err != nil {
  12305. return err
  12306. }
  12307. return nil
  12308. // {
  12309. // "description": "Deletes a calendar resource.",
  12310. // "httpMethod": "DELETE",
  12311. // "id": "directory.resources.calendars.delete",
  12312. // "parameterOrder": [
  12313. // "customer",
  12314. // "calendarResourceId"
  12315. // ],
  12316. // "parameters": {
  12317. // "calendarResourceId": {
  12318. // "description": "The unique ID of the calendar resource to delete.",
  12319. // "location": "path",
  12320. // "required": true,
  12321. // "type": "string"
  12322. // },
  12323. // "customer": {
  12324. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  12325. // "location": "path",
  12326. // "required": true,
  12327. // "type": "string"
  12328. // }
  12329. // },
  12330. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  12331. // "scopes": [
  12332. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  12333. // ]
  12334. // }
  12335. }
  12336. // method id "directory.resources.calendars.get":
  12337. type ResourcesCalendarsGetCall struct {
  12338. s *Service
  12339. customer string
  12340. calendarResourceId string
  12341. urlParams_ gensupport.URLParams
  12342. ifNoneMatch_ string
  12343. ctx_ context.Context
  12344. header_ http.Header
  12345. }
  12346. // Get: Retrieves a calendar resource.
  12347. func (r *ResourcesCalendarsService) Get(customer string, calendarResourceId string) *ResourcesCalendarsGetCall {
  12348. c := &ResourcesCalendarsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12349. c.customer = customer
  12350. c.calendarResourceId = calendarResourceId
  12351. return c
  12352. }
  12353. // Fields allows partial responses to be retrieved. See
  12354. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12355. // for more information.
  12356. func (c *ResourcesCalendarsGetCall) Fields(s ...googleapi.Field) *ResourcesCalendarsGetCall {
  12357. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12358. return c
  12359. }
  12360. // IfNoneMatch sets the optional parameter which makes the operation
  12361. // fail if the object's ETag matches the given value. This is useful for
  12362. // getting updates only after the object has changed since the last
  12363. // request. Use googleapi.IsNotModified to check whether the response
  12364. // error from Do is the result of In-None-Match.
  12365. func (c *ResourcesCalendarsGetCall) IfNoneMatch(entityTag string) *ResourcesCalendarsGetCall {
  12366. c.ifNoneMatch_ = entityTag
  12367. return c
  12368. }
  12369. // Context sets the context to be used in this call's Do method. Any
  12370. // pending HTTP request will be aborted if the provided context is
  12371. // canceled.
  12372. func (c *ResourcesCalendarsGetCall) Context(ctx context.Context) *ResourcesCalendarsGetCall {
  12373. c.ctx_ = ctx
  12374. return c
  12375. }
  12376. // Header returns an http.Header that can be modified by the caller to
  12377. // add HTTP headers to the request.
  12378. func (c *ResourcesCalendarsGetCall) Header() http.Header {
  12379. if c.header_ == nil {
  12380. c.header_ = make(http.Header)
  12381. }
  12382. return c.header_
  12383. }
  12384. func (c *ResourcesCalendarsGetCall) doRequest(alt string) (*http.Response, error) {
  12385. reqHeaders := make(http.Header)
  12386. for k, v := range c.header_ {
  12387. reqHeaders[k] = v
  12388. }
  12389. reqHeaders.Set("User-Agent", c.s.userAgent())
  12390. if c.ifNoneMatch_ != "" {
  12391. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12392. }
  12393. var body io.Reader = nil
  12394. c.urlParams_.Set("alt", alt)
  12395. c.urlParams_.Set("prettyPrint", "false")
  12396. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  12397. urls += "?" + c.urlParams_.Encode()
  12398. req, err := http.NewRequest("GET", urls, body)
  12399. if err != nil {
  12400. return nil, err
  12401. }
  12402. req.Header = reqHeaders
  12403. googleapi.Expand(req.URL, map[string]string{
  12404. "customer": c.customer,
  12405. "calendarResourceId": c.calendarResourceId,
  12406. })
  12407. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12408. }
  12409. // Do executes the "directory.resources.calendars.get" call.
  12410. // Exactly one of *CalendarResource or error will be non-nil. Any
  12411. // non-2xx status code is an error. Response headers are in either
  12412. // *CalendarResource.ServerResponse.Header or (if a response was
  12413. // returned at all) in error.(*googleapi.Error).Header. Use
  12414. // googleapi.IsNotModified to check whether the returned error was
  12415. // because http.StatusNotModified was returned.
  12416. func (c *ResourcesCalendarsGetCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  12417. gensupport.SetOptions(c.urlParams_, opts...)
  12418. res, err := c.doRequest("json")
  12419. if res != nil && res.StatusCode == http.StatusNotModified {
  12420. if res.Body != nil {
  12421. res.Body.Close()
  12422. }
  12423. return nil, &googleapi.Error{
  12424. Code: res.StatusCode,
  12425. Header: res.Header,
  12426. }
  12427. }
  12428. if err != nil {
  12429. return nil, err
  12430. }
  12431. defer googleapi.CloseBody(res)
  12432. if err := googleapi.CheckResponse(res); err != nil {
  12433. return nil, err
  12434. }
  12435. ret := &CalendarResource{
  12436. ServerResponse: googleapi.ServerResponse{
  12437. Header: res.Header,
  12438. HTTPStatusCode: res.StatusCode,
  12439. },
  12440. }
  12441. target := &ret
  12442. if err := gensupport.DecodeResponse(target, res); err != nil {
  12443. return nil, err
  12444. }
  12445. return ret, nil
  12446. // {
  12447. // "description": "Retrieves a calendar resource.",
  12448. // "httpMethod": "GET",
  12449. // "id": "directory.resources.calendars.get",
  12450. // "parameterOrder": [
  12451. // "customer",
  12452. // "calendarResourceId"
  12453. // ],
  12454. // "parameters": {
  12455. // "calendarResourceId": {
  12456. // "description": "The unique ID of the calendar resource to retrieve.",
  12457. // "location": "path",
  12458. // "required": true,
  12459. // "type": "string"
  12460. // },
  12461. // "customer": {
  12462. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  12463. // "location": "path",
  12464. // "required": true,
  12465. // "type": "string"
  12466. // }
  12467. // },
  12468. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  12469. // "response": {
  12470. // "$ref": "CalendarResource"
  12471. // },
  12472. // "scopes": [
  12473. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  12474. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  12475. // ]
  12476. // }
  12477. }
  12478. // method id "directory.resources.calendars.insert":
  12479. type ResourcesCalendarsInsertCall struct {
  12480. s *Service
  12481. customer string
  12482. calendarresource *CalendarResource
  12483. urlParams_ gensupport.URLParams
  12484. ctx_ context.Context
  12485. header_ http.Header
  12486. }
  12487. // Insert: Inserts a calendar resource.
  12488. func (r *ResourcesCalendarsService) Insert(customer string, calendarresource *CalendarResource) *ResourcesCalendarsInsertCall {
  12489. c := &ResourcesCalendarsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12490. c.customer = customer
  12491. c.calendarresource = calendarresource
  12492. return c
  12493. }
  12494. // Fields allows partial responses to be retrieved. See
  12495. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12496. // for more information.
  12497. func (c *ResourcesCalendarsInsertCall) Fields(s ...googleapi.Field) *ResourcesCalendarsInsertCall {
  12498. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12499. return c
  12500. }
  12501. // Context sets the context to be used in this call's Do method. Any
  12502. // pending HTTP request will be aborted if the provided context is
  12503. // canceled.
  12504. func (c *ResourcesCalendarsInsertCall) Context(ctx context.Context) *ResourcesCalendarsInsertCall {
  12505. c.ctx_ = ctx
  12506. return c
  12507. }
  12508. // Header returns an http.Header that can be modified by the caller to
  12509. // add HTTP headers to the request.
  12510. func (c *ResourcesCalendarsInsertCall) Header() http.Header {
  12511. if c.header_ == nil {
  12512. c.header_ = make(http.Header)
  12513. }
  12514. return c.header_
  12515. }
  12516. func (c *ResourcesCalendarsInsertCall) doRequest(alt string) (*http.Response, error) {
  12517. reqHeaders := make(http.Header)
  12518. for k, v := range c.header_ {
  12519. reqHeaders[k] = v
  12520. }
  12521. reqHeaders.Set("User-Agent", c.s.userAgent())
  12522. var body io.Reader = nil
  12523. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarresource)
  12524. if err != nil {
  12525. return nil, err
  12526. }
  12527. reqHeaders.Set("Content-Type", "application/json")
  12528. c.urlParams_.Set("alt", alt)
  12529. c.urlParams_.Set("prettyPrint", "false")
  12530. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars")
  12531. urls += "?" + c.urlParams_.Encode()
  12532. req, err := http.NewRequest("POST", urls, body)
  12533. if err != nil {
  12534. return nil, err
  12535. }
  12536. req.Header = reqHeaders
  12537. googleapi.Expand(req.URL, map[string]string{
  12538. "customer": c.customer,
  12539. })
  12540. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12541. }
  12542. // Do executes the "directory.resources.calendars.insert" call.
  12543. // Exactly one of *CalendarResource or error will be non-nil. Any
  12544. // non-2xx status code is an error. Response headers are in either
  12545. // *CalendarResource.ServerResponse.Header or (if a response was
  12546. // returned at all) in error.(*googleapi.Error).Header. Use
  12547. // googleapi.IsNotModified to check whether the returned error was
  12548. // because http.StatusNotModified was returned.
  12549. func (c *ResourcesCalendarsInsertCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  12550. gensupport.SetOptions(c.urlParams_, opts...)
  12551. res, err := c.doRequest("json")
  12552. if res != nil && res.StatusCode == http.StatusNotModified {
  12553. if res.Body != nil {
  12554. res.Body.Close()
  12555. }
  12556. return nil, &googleapi.Error{
  12557. Code: res.StatusCode,
  12558. Header: res.Header,
  12559. }
  12560. }
  12561. if err != nil {
  12562. return nil, err
  12563. }
  12564. defer googleapi.CloseBody(res)
  12565. if err := googleapi.CheckResponse(res); err != nil {
  12566. return nil, err
  12567. }
  12568. ret := &CalendarResource{
  12569. ServerResponse: googleapi.ServerResponse{
  12570. Header: res.Header,
  12571. HTTPStatusCode: res.StatusCode,
  12572. },
  12573. }
  12574. target := &ret
  12575. if err := gensupport.DecodeResponse(target, res); err != nil {
  12576. return nil, err
  12577. }
  12578. return ret, nil
  12579. // {
  12580. // "description": "Inserts a calendar resource.",
  12581. // "httpMethod": "POST",
  12582. // "id": "directory.resources.calendars.insert",
  12583. // "parameterOrder": [
  12584. // "customer"
  12585. // ],
  12586. // "parameters": {
  12587. // "customer": {
  12588. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  12589. // "location": "path",
  12590. // "required": true,
  12591. // "type": "string"
  12592. // }
  12593. // },
  12594. // "path": "customer/{customer}/resources/calendars",
  12595. // "request": {
  12596. // "$ref": "CalendarResource"
  12597. // },
  12598. // "response": {
  12599. // "$ref": "CalendarResource"
  12600. // },
  12601. // "scopes": [
  12602. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  12603. // ]
  12604. // }
  12605. }
  12606. // method id "directory.resources.calendars.list":
  12607. type ResourcesCalendarsListCall struct {
  12608. s *Service
  12609. customer string
  12610. urlParams_ gensupport.URLParams
  12611. ifNoneMatch_ string
  12612. ctx_ context.Context
  12613. header_ http.Header
  12614. }
  12615. // List: Retrieves a list of calendar resources for an account.
  12616. func (r *ResourcesCalendarsService) List(customer string) *ResourcesCalendarsListCall {
  12617. c := &ResourcesCalendarsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12618. c.customer = customer
  12619. return c
  12620. }
  12621. // MaxResults sets the optional parameter "maxResults": Maximum number
  12622. // of results to return.
  12623. func (c *ResourcesCalendarsListCall) MaxResults(maxResults int64) *ResourcesCalendarsListCall {
  12624. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  12625. return c
  12626. }
  12627. // OrderBy sets the optional parameter "orderBy": Field(s) to sort
  12628. // results by in either ascending or descending order. Supported fields
  12629. // include resourceId, resourceName, capacity, buildingId, and
  12630. // floorName. If no order is specified, defaults to ascending. Should be
  12631. // of the form "field [asc|desc], field [asc|desc], ...". For example
  12632. // buildingId, capacity desc would return results sorted first by
  12633. // buildingId in ascending order then by capacity in descending order.
  12634. func (c *ResourcesCalendarsListCall) OrderBy(orderBy string) *ResourcesCalendarsListCall {
  12635. c.urlParams_.Set("orderBy", orderBy)
  12636. return c
  12637. }
  12638. // PageToken sets the optional parameter "pageToken": Token to specify
  12639. // the next page in the list.
  12640. func (c *ResourcesCalendarsListCall) PageToken(pageToken string) *ResourcesCalendarsListCall {
  12641. c.urlParams_.Set("pageToken", pageToken)
  12642. return c
  12643. }
  12644. // Query sets the optional parameter "query": String query used to
  12645. // filter results. Should be of the form "field operator value" where
  12646. // field can be any of supported fields and operators can be any of
  12647. // supported operations. Operators include '=' for exact match and ':'
  12648. // for prefix match or HAS match where applicable. For prefix match, the
  12649. // value should always be followed by a *. Supported fields include
  12650. // generatedResourceName, name, buildingId,
  12651. // featureInstances.feature.name. For example buildingId=US-NYC-9TH AND
  12652. // featureInstances.feature.name:Phone.
  12653. func (c *ResourcesCalendarsListCall) Query(query string) *ResourcesCalendarsListCall {
  12654. c.urlParams_.Set("query", query)
  12655. return c
  12656. }
  12657. // Fields allows partial responses to be retrieved. See
  12658. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12659. // for more information.
  12660. func (c *ResourcesCalendarsListCall) Fields(s ...googleapi.Field) *ResourcesCalendarsListCall {
  12661. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12662. return c
  12663. }
  12664. // IfNoneMatch sets the optional parameter which makes the operation
  12665. // fail if the object's ETag matches the given value. This is useful for
  12666. // getting updates only after the object has changed since the last
  12667. // request. Use googleapi.IsNotModified to check whether the response
  12668. // error from Do is the result of In-None-Match.
  12669. func (c *ResourcesCalendarsListCall) IfNoneMatch(entityTag string) *ResourcesCalendarsListCall {
  12670. c.ifNoneMatch_ = entityTag
  12671. return c
  12672. }
  12673. // Context sets the context to be used in this call's Do method. Any
  12674. // pending HTTP request will be aborted if the provided context is
  12675. // canceled.
  12676. func (c *ResourcesCalendarsListCall) Context(ctx context.Context) *ResourcesCalendarsListCall {
  12677. c.ctx_ = ctx
  12678. return c
  12679. }
  12680. // Header returns an http.Header that can be modified by the caller to
  12681. // add HTTP headers to the request.
  12682. func (c *ResourcesCalendarsListCall) Header() http.Header {
  12683. if c.header_ == nil {
  12684. c.header_ = make(http.Header)
  12685. }
  12686. return c.header_
  12687. }
  12688. func (c *ResourcesCalendarsListCall) doRequest(alt string) (*http.Response, error) {
  12689. reqHeaders := make(http.Header)
  12690. for k, v := range c.header_ {
  12691. reqHeaders[k] = v
  12692. }
  12693. reqHeaders.Set("User-Agent", c.s.userAgent())
  12694. if c.ifNoneMatch_ != "" {
  12695. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12696. }
  12697. var body io.Reader = nil
  12698. c.urlParams_.Set("alt", alt)
  12699. c.urlParams_.Set("prettyPrint", "false")
  12700. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars")
  12701. urls += "?" + c.urlParams_.Encode()
  12702. req, err := http.NewRequest("GET", urls, body)
  12703. if err != nil {
  12704. return nil, err
  12705. }
  12706. req.Header = reqHeaders
  12707. googleapi.Expand(req.URL, map[string]string{
  12708. "customer": c.customer,
  12709. })
  12710. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12711. }
  12712. // Do executes the "directory.resources.calendars.list" call.
  12713. // Exactly one of *CalendarResources or error will be non-nil. Any
  12714. // non-2xx status code is an error. Response headers are in either
  12715. // *CalendarResources.ServerResponse.Header or (if a response was
  12716. // returned at all) in error.(*googleapi.Error).Header. Use
  12717. // googleapi.IsNotModified to check whether the returned error was
  12718. // because http.StatusNotModified was returned.
  12719. func (c *ResourcesCalendarsListCall) Do(opts ...googleapi.CallOption) (*CalendarResources, error) {
  12720. gensupport.SetOptions(c.urlParams_, opts...)
  12721. res, err := c.doRequest("json")
  12722. if res != nil && res.StatusCode == http.StatusNotModified {
  12723. if res.Body != nil {
  12724. res.Body.Close()
  12725. }
  12726. return nil, &googleapi.Error{
  12727. Code: res.StatusCode,
  12728. Header: res.Header,
  12729. }
  12730. }
  12731. if err != nil {
  12732. return nil, err
  12733. }
  12734. defer googleapi.CloseBody(res)
  12735. if err := googleapi.CheckResponse(res); err != nil {
  12736. return nil, err
  12737. }
  12738. ret := &CalendarResources{
  12739. ServerResponse: googleapi.ServerResponse{
  12740. Header: res.Header,
  12741. HTTPStatusCode: res.StatusCode,
  12742. },
  12743. }
  12744. target := &ret
  12745. if err := gensupport.DecodeResponse(target, res); err != nil {
  12746. return nil, err
  12747. }
  12748. return ret, nil
  12749. // {
  12750. // "description": "Retrieves a list of calendar resources for an account.",
  12751. // "httpMethod": "GET",
  12752. // "id": "directory.resources.calendars.list",
  12753. // "parameterOrder": [
  12754. // "customer"
  12755. // ],
  12756. // "parameters": {
  12757. // "customer": {
  12758. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  12759. // "location": "path",
  12760. // "required": true,
  12761. // "type": "string"
  12762. // },
  12763. // "maxResults": {
  12764. // "description": "Maximum number of results to return.",
  12765. // "format": "int32",
  12766. // "location": "query",
  12767. // "maximum": "500",
  12768. // "minimum": "1",
  12769. // "type": "integer"
  12770. // },
  12771. // "orderBy": {
  12772. // "description": "Field(s) to sort results by in either ascending or descending order. Supported fields include resourceId, resourceName, capacity, buildingId, and floorName. If no order is specified, defaults to ascending. Should be of the form \"field [asc|desc], field [asc|desc], ...\". For example buildingId, capacity desc would return results sorted first by buildingId in ascending order then by capacity in descending order.",
  12773. // "location": "query",
  12774. // "type": "string"
  12775. // },
  12776. // "pageToken": {
  12777. // "description": "Token to specify the next page in the list.",
  12778. // "location": "query",
  12779. // "type": "string"
  12780. // },
  12781. // "query": {
  12782. // "description": "String query used to filter results. Should be of the form \"field operator value\" where field can be any of supported fields and operators can be any of supported operations. Operators include '=' for exact match and ':' for prefix match or HAS match where applicable. For prefix match, the value should always be followed by a *. Supported fields include generatedResourceName, name, buildingId, featureInstances.feature.name. For example buildingId=US-NYC-9TH AND featureInstances.feature.name:Phone.",
  12783. // "location": "query",
  12784. // "type": "string"
  12785. // }
  12786. // },
  12787. // "path": "customer/{customer}/resources/calendars",
  12788. // "response": {
  12789. // "$ref": "CalendarResources"
  12790. // },
  12791. // "scopes": [
  12792. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  12793. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  12794. // ]
  12795. // }
  12796. }
  12797. // Pages invokes f for each page of results.
  12798. // A non-nil error returned from f will halt the iteration.
  12799. // The provided context supersedes any context provided to the Context method.
  12800. func (c *ResourcesCalendarsListCall) Pages(ctx context.Context, f func(*CalendarResources) error) error {
  12801. c.ctx_ = ctx
  12802. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  12803. for {
  12804. x, err := c.Do()
  12805. if err != nil {
  12806. return err
  12807. }
  12808. if err := f(x); err != nil {
  12809. return err
  12810. }
  12811. if x.NextPageToken == "" {
  12812. return nil
  12813. }
  12814. c.PageToken(x.NextPageToken)
  12815. }
  12816. }
  12817. // method id "directory.resources.calendars.patch":
  12818. type ResourcesCalendarsPatchCall struct {
  12819. s *Service
  12820. customer string
  12821. calendarResourceId string
  12822. calendarresource *CalendarResource
  12823. urlParams_ gensupport.URLParams
  12824. ctx_ context.Context
  12825. header_ http.Header
  12826. }
  12827. // Patch: Updates a calendar resource.
  12828. //
  12829. // This method supports patch semantics, meaning you only need to
  12830. // include the fields you wish to update. Fields that are not present in
  12831. // the request will be preserved. This method supports patch semantics.
  12832. func (r *ResourcesCalendarsService) Patch(customer string, calendarResourceId string, calendarresource *CalendarResource) *ResourcesCalendarsPatchCall {
  12833. c := &ResourcesCalendarsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12834. c.customer = customer
  12835. c.calendarResourceId = calendarResourceId
  12836. c.calendarresource = calendarresource
  12837. return c
  12838. }
  12839. // Fields allows partial responses to be retrieved. See
  12840. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12841. // for more information.
  12842. func (c *ResourcesCalendarsPatchCall) Fields(s ...googleapi.Field) *ResourcesCalendarsPatchCall {
  12843. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12844. return c
  12845. }
  12846. // Context sets the context to be used in this call's Do method. Any
  12847. // pending HTTP request will be aborted if the provided context is
  12848. // canceled.
  12849. func (c *ResourcesCalendarsPatchCall) Context(ctx context.Context) *ResourcesCalendarsPatchCall {
  12850. c.ctx_ = ctx
  12851. return c
  12852. }
  12853. // Header returns an http.Header that can be modified by the caller to
  12854. // add HTTP headers to the request.
  12855. func (c *ResourcesCalendarsPatchCall) Header() http.Header {
  12856. if c.header_ == nil {
  12857. c.header_ = make(http.Header)
  12858. }
  12859. return c.header_
  12860. }
  12861. func (c *ResourcesCalendarsPatchCall) doRequest(alt string) (*http.Response, error) {
  12862. reqHeaders := make(http.Header)
  12863. for k, v := range c.header_ {
  12864. reqHeaders[k] = v
  12865. }
  12866. reqHeaders.Set("User-Agent", c.s.userAgent())
  12867. var body io.Reader = nil
  12868. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarresource)
  12869. if err != nil {
  12870. return nil, err
  12871. }
  12872. reqHeaders.Set("Content-Type", "application/json")
  12873. c.urlParams_.Set("alt", alt)
  12874. c.urlParams_.Set("prettyPrint", "false")
  12875. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  12876. urls += "?" + c.urlParams_.Encode()
  12877. req, err := http.NewRequest("PATCH", urls, body)
  12878. if err != nil {
  12879. return nil, err
  12880. }
  12881. req.Header = reqHeaders
  12882. googleapi.Expand(req.URL, map[string]string{
  12883. "customer": c.customer,
  12884. "calendarResourceId": c.calendarResourceId,
  12885. })
  12886. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12887. }
  12888. // Do executes the "directory.resources.calendars.patch" call.
  12889. // Exactly one of *CalendarResource or error will be non-nil. Any
  12890. // non-2xx status code is an error. Response headers are in either
  12891. // *CalendarResource.ServerResponse.Header or (if a response was
  12892. // returned at all) in error.(*googleapi.Error).Header. Use
  12893. // googleapi.IsNotModified to check whether the returned error was
  12894. // because http.StatusNotModified was returned.
  12895. func (c *ResourcesCalendarsPatchCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  12896. gensupport.SetOptions(c.urlParams_, opts...)
  12897. res, err := c.doRequest("json")
  12898. if res != nil && res.StatusCode == http.StatusNotModified {
  12899. if res.Body != nil {
  12900. res.Body.Close()
  12901. }
  12902. return nil, &googleapi.Error{
  12903. Code: res.StatusCode,
  12904. Header: res.Header,
  12905. }
  12906. }
  12907. if err != nil {
  12908. return nil, err
  12909. }
  12910. defer googleapi.CloseBody(res)
  12911. if err := googleapi.CheckResponse(res); err != nil {
  12912. return nil, err
  12913. }
  12914. ret := &CalendarResource{
  12915. ServerResponse: googleapi.ServerResponse{
  12916. Header: res.Header,
  12917. HTTPStatusCode: res.StatusCode,
  12918. },
  12919. }
  12920. target := &ret
  12921. if err := gensupport.DecodeResponse(target, res); err != nil {
  12922. return nil, err
  12923. }
  12924. return ret, nil
  12925. // {
  12926. // "description": "Updates a calendar resource.\n\nThis method supports patch semantics, meaning you only need to include the fields you wish to update. Fields that are not present in the request will be preserved. This method supports patch semantics.",
  12927. // "httpMethod": "PATCH",
  12928. // "id": "directory.resources.calendars.patch",
  12929. // "parameterOrder": [
  12930. // "customer",
  12931. // "calendarResourceId"
  12932. // ],
  12933. // "parameters": {
  12934. // "calendarResourceId": {
  12935. // "description": "The unique ID of the calendar resource to update.",
  12936. // "location": "path",
  12937. // "required": true,
  12938. // "type": "string"
  12939. // },
  12940. // "customer": {
  12941. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  12942. // "location": "path",
  12943. // "required": true,
  12944. // "type": "string"
  12945. // }
  12946. // },
  12947. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  12948. // "request": {
  12949. // "$ref": "CalendarResource"
  12950. // },
  12951. // "response": {
  12952. // "$ref": "CalendarResource"
  12953. // },
  12954. // "scopes": [
  12955. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  12956. // ]
  12957. // }
  12958. }
  12959. // method id "directory.resources.calendars.update":
  12960. type ResourcesCalendarsUpdateCall struct {
  12961. s *Service
  12962. customer string
  12963. calendarResourceId string
  12964. calendarresource *CalendarResource
  12965. urlParams_ gensupport.URLParams
  12966. ctx_ context.Context
  12967. header_ http.Header
  12968. }
  12969. // Update: Updates a calendar resource.
  12970. //
  12971. // This method supports patch semantics, meaning you only need to
  12972. // include the fields you wish to update. Fields that are not present in
  12973. // the request will be preserved.
  12974. func (r *ResourcesCalendarsService) Update(customer string, calendarResourceId string, calendarresource *CalendarResource) *ResourcesCalendarsUpdateCall {
  12975. c := &ResourcesCalendarsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12976. c.customer = customer
  12977. c.calendarResourceId = calendarResourceId
  12978. c.calendarresource = calendarresource
  12979. return c
  12980. }
  12981. // Fields allows partial responses to be retrieved. See
  12982. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12983. // for more information.
  12984. func (c *ResourcesCalendarsUpdateCall) Fields(s ...googleapi.Field) *ResourcesCalendarsUpdateCall {
  12985. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12986. return c
  12987. }
  12988. // Context sets the context to be used in this call's Do method. Any
  12989. // pending HTTP request will be aborted if the provided context is
  12990. // canceled.
  12991. func (c *ResourcesCalendarsUpdateCall) Context(ctx context.Context) *ResourcesCalendarsUpdateCall {
  12992. c.ctx_ = ctx
  12993. return c
  12994. }
  12995. // Header returns an http.Header that can be modified by the caller to
  12996. // add HTTP headers to the request.
  12997. func (c *ResourcesCalendarsUpdateCall) Header() http.Header {
  12998. if c.header_ == nil {
  12999. c.header_ = make(http.Header)
  13000. }
  13001. return c.header_
  13002. }
  13003. func (c *ResourcesCalendarsUpdateCall) doRequest(alt string) (*http.Response, error) {
  13004. reqHeaders := make(http.Header)
  13005. for k, v := range c.header_ {
  13006. reqHeaders[k] = v
  13007. }
  13008. reqHeaders.Set("User-Agent", c.s.userAgent())
  13009. var body io.Reader = nil
  13010. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarresource)
  13011. if err != nil {
  13012. return nil, err
  13013. }
  13014. reqHeaders.Set("Content-Type", "application/json")
  13015. c.urlParams_.Set("alt", alt)
  13016. c.urlParams_.Set("prettyPrint", "false")
  13017. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  13018. urls += "?" + c.urlParams_.Encode()
  13019. req, err := http.NewRequest("PUT", urls, body)
  13020. if err != nil {
  13021. return nil, err
  13022. }
  13023. req.Header = reqHeaders
  13024. googleapi.Expand(req.URL, map[string]string{
  13025. "customer": c.customer,
  13026. "calendarResourceId": c.calendarResourceId,
  13027. })
  13028. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13029. }
  13030. // Do executes the "directory.resources.calendars.update" call.
  13031. // Exactly one of *CalendarResource or error will be non-nil. Any
  13032. // non-2xx status code is an error. Response headers are in either
  13033. // *CalendarResource.ServerResponse.Header or (if a response was
  13034. // returned at all) in error.(*googleapi.Error).Header. Use
  13035. // googleapi.IsNotModified to check whether the returned error was
  13036. // because http.StatusNotModified was returned.
  13037. func (c *ResourcesCalendarsUpdateCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  13038. gensupport.SetOptions(c.urlParams_, opts...)
  13039. res, err := c.doRequest("json")
  13040. if res != nil && res.StatusCode == http.StatusNotModified {
  13041. if res.Body != nil {
  13042. res.Body.Close()
  13043. }
  13044. return nil, &googleapi.Error{
  13045. Code: res.StatusCode,
  13046. Header: res.Header,
  13047. }
  13048. }
  13049. if err != nil {
  13050. return nil, err
  13051. }
  13052. defer googleapi.CloseBody(res)
  13053. if err := googleapi.CheckResponse(res); err != nil {
  13054. return nil, err
  13055. }
  13056. ret := &CalendarResource{
  13057. ServerResponse: googleapi.ServerResponse{
  13058. Header: res.Header,
  13059. HTTPStatusCode: res.StatusCode,
  13060. },
  13061. }
  13062. target := &ret
  13063. if err := gensupport.DecodeResponse(target, res); err != nil {
  13064. return nil, err
  13065. }
  13066. return ret, nil
  13067. // {
  13068. // "description": "Updates a calendar resource.\n\nThis method supports patch semantics, meaning you only need to include the fields you wish to update. Fields that are not present in the request will be preserved.",
  13069. // "httpMethod": "PUT",
  13070. // "id": "directory.resources.calendars.update",
  13071. // "parameterOrder": [
  13072. // "customer",
  13073. // "calendarResourceId"
  13074. // ],
  13075. // "parameters": {
  13076. // "calendarResourceId": {
  13077. // "description": "The unique ID of the calendar resource to update.",
  13078. // "location": "path",
  13079. // "required": true,
  13080. // "type": "string"
  13081. // },
  13082. // "customer": {
  13083. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  13084. // "location": "path",
  13085. // "required": true,
  13086. // "type": "string"
  13087. // }
  13088. // },
  13089. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  13090. // "request": {
  13091. // "$ref": "CalendarResource"
  13092. // },
  13093. // "response": {
  13094. // "$ref": "CalendarResource"
  13095. // },
  13096. // "scopes": [
  13097. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  13098. // ]
  13099. // }
  13100. }
  13101. // method id "directory.resources.features.delete":
  13102. type ResourcesFeaturesDeleteCall struct {
  13103. s *Service
  13104. customer string
  13105. featureKey string
  13106. urlParams_ gensupport.URLParams
  13107. ctx_ context.Context
  13108. header_ http.Header
  13109. }
  13110. // Delete: Deletes a feature.
  13111. func (r *ResourcesFeaturesService) Delete(customer string, featureKey string) *ResourcesFeaturesDeleteCall {
  13112. c := &ResourcesFeaturesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13113. c.customer = customer
  13114. c.featureKey = featureKey
  13115. return c
  13116. }
  13117. // Fields allows partial responses to be retrieved. See
  13118. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13119. // for more information.
  13120. func (c *ResourcesFeaturesDeleteCall) Fields(s ...googleapi.Field) *ResourcesFeaturesDeleteCall {
  13121. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13122. return c
  13123. }
  13124. // Context sets the context to be used in this call's Do method. Any
  13125. // pending HTTP request will be aborted if the provided context is
  13126. // canceled.
  13127. func (c *ResourcesFeaturesDeleteCall) Context(ctx context.Context) *ResourcesFeaturesDeleteCall {
  13128. c.ctx_ = ctx
  13129. return c
  13130. }
  13131. // Header returns an http.Header that can be modified by the caller to
  13132. // add HTTP headers to the request.
  13133. func (c *ResourcesFeaturesDeleteCall) Header() http.Header {
  13134. if c.header_ == nil {
  13135. c.header_ = make(http.Header)
  13136. }
  13137. return c.header_
  13138. }
  13139. func (c *ResourcesFeaturesDeleteCall) doRequest(alt string) (*http.Response, error) {
  13140. reqHeaders := make(http.Header)
  13141. for k, v := range c.header_ {
  13142. reqHeaders[k] = v
  13143. }
  13144. reqHeaders.Set("User-Agent", c.s.userAgent())
  13145. var body io.Reader = nil
  13146. c.urlParams_.Set("alt", alt)
  13147. c.urlParams_.Set("prettyPrint", "false")
  13148. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features/{featureKey}")
  13149. urls += "?" + c.urlParams_.Encode()
  13150. req, err := http.NewRequest("DELETE", urls, body)
  13151. if err != nil {
  13152. return nil, err
  13153. }
  13154. req.Header = reqHeaders
  13155. googleapi.Expand(req.URL, map[string]string{
  13156. "customer": c.customer,
  13157. "featureKey": c.featureKey,
  13158. })
  13159. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13160. }
  13161. // Do executes the "directory.resources.features.delete" call.
  13162. func (c *ResourcesFeaturesDeleteCall) Do(opts ...googleapi.CallOption) error {
  13163. gensupport.SetOptions(c.urlParams_, opts...)
  13164. res, err := c.doRequest("json")
  13165. if err != nil {
  13166. return err
  13167. }
  13168. defer googleapi.CloseBody(res)
  13169. if err := googleapi.CheckResponse(res); err != nil {
  13170. return err
  13171. }
  13172. return nil
  13173. // {
  13174. // "description": "Deletes a feature.",
  13175. // "httpMethod": "DELETE",
  13176. // "id": "directory.resources.features.delete",
  13177. // "parameterOrder": [
  13178. // "customer",
  13179. // "featureKey"
  13180. // ],
  13181. // "parameters": {
  13182. // "customer": {
  13183. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  13184. // "location": "path",
  13185. // "required": true,
  13186. // "type": "string"
  13187. // },
  13188. // "featureKey": {
  13189. // "description": "The unique ID of the feature to delete.",
  13190. // "location": "path",
  13191. // "required": true,
  13192. // "type": "string"
  13193. // }
  13194. // },
  13195. // "path": "customer/{customer}/resources/features/{featureKey}",
  13196. // "scopes": [
  13197. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  13198. // ]
  13199. // }
  13200. }
  13201. // method id "directory.resources.features.get":
  13202. type ResourcesFeaturesGetCall struct {
  13203. s *Service
  13204. customer string
  13205. featureKey string
  13206. urlParams_ gensupport.URLParams
  13207. ifNoneMatch_ string
  13208. ctx_ context.Context
  13209. header_ http.Header
  13210. }
  13211. // Get: Retrieves a feature.
  13212. func (r *ResourcesFeaturesService) Get(customer string, featureKey string) *ResourcesFeaturesGetCall {
  13213. c := &ResourcesFeaturesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13214. c.customer = customer
  13215. c.featureKey = featureKey
  13216. return c
  13217. }
  13218. // Fields allows partial responses to be retrieved. See
  13219. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13220. // for more information.
  13221. func (c *ResourcesFeaturesGetCall) Fields(s ...googleapi.Field) *ResourcesFeaturesGetCall {
  13222. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13223. return c
  13224. }
  13225. // IfNoneMatch sets the optional parameter which makes the operation
  13226. // fail if the object's ETag matches the given value. This is useful for
  13227. // getting updates only after the object has changed since the last
  13228. // request. Use googleapi.IsNotModified to check whether the response
  13229. // error from Do is the result of In-None-Match.
  13230. func (c *ResourcesFeaturesGetCall) IfNoneMatch(entityTag string) *ResourcesFeaturesGetCall {
  13231. c.ifNoneMatch_ = entityTag
  13232. return c
  13233. }
  13234. // Context sets the context to be used in this call's Do method. Any
  13235. // pending HTTP request will be aborted if the provided context is
  13236. // canceled.
  13237. func (c *ResourcesFeaturesGetCall) Context(ctx context.Context) *ResourcesFeaturesGetCall {
  13238. c.ctx_ = ctx
  13239. return c
  13240. }
  13241. // Header returns an http.Header that can be modified by the caller to
  13242. // add HTTP headers to the request.
  13243. func (c *ResourcesFeaturesGetCall) Header() http.Header {
  13244. if c.header_ == nil {
  13245. c.header_ = make(http.Header)
  13246. }
  13247. return c.header_
  13248. }
  13249. func (c *ResourcesFeaturesGetCall) doRequest(alt string) (*http.Response, error) {
  13250. reqHeaders := make(http.Header)
  13251. for k, v := range c.header_ {
  13252. reqHeaders[k] = v
  13253. }
  13254. reqHeaders.Set("User-Agent", c.s.userAgent())
  13255. if c.ifNoneMatch_ != "" {
  13256. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  13257. }
  13258. var body io.Reader = nil
  13259. c.urlParams_.Set("alt", alt)
  13260. c.urlParams_.Set("prettyPrint", "false")
  13261. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features/{featureKey}")
  13262. urls += "?" + c.urlParams_.Encode()
  13263. req, err := http.NewRequest("GET", urls, body)
  13264. if err != nil {
  13265. return nil, err
  13266. }
  13267. req.Header = reqHeaders
  13268. googleapi.Expand(req.URL, map[string]string{
  13269. "customer": c.customer,
  13270. "featureKey": c.featureKey,
  13271. })
  13272. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13273. }
  13274. // Do executes the "directory.resources.features.get" call.
  13275. // Exactly one of *Feature or error will be non-nil. Any non-2xx status
  13276. // code is an error. Response headers are in either
  13277. // *Feature.ServerResponse.Header or (if a response was returned at all)
  13278. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  13279. // check whether the returned error was because http.StatusNotModified
  13280. // was returned.
  13281. func (c *ResourcesFeaturesGetCall) Do(opts ...googleapi.CallOption) (*Feature, error) {
  13282. gensupport.SetOptions(c.urlParams_, opts...)
  13283. res, err := c.doRequest("json")
  13284. if res != nil && res.StatusCode == http.StatusNotModified {
  13285. if res.Body != nil {
  13286. res.Body.Close()
  13287. }
  13288. return nil, &googleapi.Error{
  13289. Code: res.StatusCode,
  13290. Header: res.Header,
  13291. }
  13292. }
  13293. if err != nil {
  13294. return nil, err
  13295. }
  13296. defer googleapi.CloseBody(res)
  13297. if err := googleapi.CheckResponse(res); err != nil {
  13298. return nil, err
  13299. }
  13300. ret := &Feature{
  13301. ServerResponse: googleapi.ServerResponse{
  13302. Header: res.Header,
  13303. HTTPStatusCode: res.StatusCode,
  13304. },
  13305. }
  13306. target := &ret
  13307. if err := gensupport.DecodeResponse(target, res); err != nil {
  13308. return nil, err
  13309. }
  13310. return ret, nil
  13311. // {
  13312. // "description": "Retrieves a feature.",
  13313. // "httpMethod": "GET",
  13314. // "id": "directory.resources.features.get",
  13315. // "parameterOrder": [
  13316. // "customer",
  13317. // "featureKey"
  13318. // ],
  13319. // "parameters": {
  13320. // "customer": {
  13321. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  13322. // "location": "path",
  13323. // "required": true,
  13324. // "type": "string"
  13325. // },
  13326. // "featureKey": {
  13327. // "description": "The unique ID of the feature to retrieve.",
  13328. // "location": "path",
  13329. // "required": true,
  13330. // "type": "string"
  13331. // }
  13332. // },
  13333. // "path": "customer/{customer}/resources/features/{featureKey}",
  13334. // "response": {
  13335. // "$ref": "Feature"
  13336. // },
  13337. // "scopes": [
  13338. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  13339. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  13340. // ]
  13341. // }
  13342. }
  13343. // method id "directory.resources.features.insert":
  13344. type ResourcesFeaturesInsertCall struct {
  13345. s *Service
  13346. customer string
  13347. feature *Feature
  13348. urlParams_ gensupport.URLParams
  13349. ctx_ context.Context
  13350. header_ http.Header
  13351. }
  13352. // Insert: Inserts a feature.
  13353. func (r *ResourcesFeaturesService) Insert(customer string, feature *Feature) *ResourcesFeaturesInsertCall {
  13354. c := &ResourcesFeaturesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13355. c.customer = customer
  13356. c.feature = feature
  13357. return c
  13358. }
  13359. // Fields allows partial responses to be retrieved. See
  13360. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13361. // for more information.
  13362. func (c *ResourcesFeaturesInsertCall) Fields(s ...googleapi.Field) *ResourcesFeaturesInsertCall {
  13363. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13364. return c
  13365. }
  13366. // Context sets the context to be used in this call's Do method. Any
  13367. // pending HTTP request will be aborted if the provided context is
  13368. // canceled.
  13369. func (c *ResourcesFeaturesInsertCall) Context(ctx context.Context) *ResourcesFeaturesInsertCall {
  13370. c.ctx_ = ctx
  13371. return c
  13372. }
  13373. // Header returns an http.Header that can be modified by the caller to
  13374. // add HTTP headers to the request.
  13375. func (c *ResourcesFeaturesInsertCall) Header() http.Header {
  13376. if c.header_ == nil {
  13377. c.header_ = make(http.Header)
  13378. }
  13379. return c.header_
  13380. }
  13381. func (c *ResourcesFeaturesInsertCall) doRequest(alt string) (*http.Response, error) {
  13382. reqHeaders := make(http.Header)
  13383. for k, v := range c.header_ {
  13384. reqHeaders[k] = v
  13385. }
  13386. reqHeaders.Set("User-Agent", c.s.userAgent())
  13387. var body io.Reader = nil
  13388. body, err := googleapi.WithoutDataWrapper.JSONReader(c.feature)
  13389. if err != nil {
  13390. return nil, err
  13391. }
  13392. reqHeaders.Set("Content-Type", "application/json")
  13393. c.urlParams_.Set("alt", alt)
  13394. c.urlParams_.Set("prettyPrint", "false")
  13395. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features")
  13396. urls += "?" + c.urlParams_.Encode()
  13397. req, err := http.NewRequest("POST", urls, body)
  13398. if err != nil {
  13399. return nil, err
  13400. }
  13401. req.Header = reqHeaders
  13402. googleapi.Expand(req.URL, map[string]string{
  13403. "customer": c.customer,
  13404. })
  13405. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13406. }
  13407. // Do executes the "directory.resources.features.insert" call.
  13408. // Exactly one of *Feature or error will be non-nil. Any non-2xx status
  13409. // code is an error. Response headers are in either
  13410. // *Feature.ServerResponse.Header or (if a response was returned at all)
  13411. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  13412. // check whether the returned error was because http.StatusNotModified
  13413. // was returned.
  13414. func (c *ResourcesFeaturesInsertCall) Do(opts ...googleapi.CallOption) (*Feature, error) {
  13415. gensupport.SetOptions(c.urlParams_, opts...)
  13416. res, err := c.doRequest("json")
  13417. if res != nil && res.StatusCode == http.StatusNotModified {
  13418. if res.Body != nil {
  13419. res.Body.Close()
  13420. }
  13421. return nil, &googleapi.Error{
  13422. Code: res.StatusCode,
  13423. Header: res.Header,
  13424. }
  13425. }
  13426. if err != nil {
  13427. return nil, err
  13428. }
  13429. defer googleapi.CloseBody(res)
  13430. if err := googleapi.CheckResponse(res); err != nil {
  13431. return nil, err
  13432. }
  13433. ret := &Feature{
  13434. ServerResponse: googleapi.ServerResponse{
  13435. Header: res.Header,
  13436. HTTPStatusCode: res.StatusCode,
  13437. },
  13438. }
  13439. target := &ret
  13440. if err := gensupport.DecodeResponse(target, res); err != nil {
  13441. return nil, err
  13442. }
  13443. return ret, nil
  13444. // {
  13445. // "description": "Inserts a feature.",
  13446. // "httpMethod": "POST",
  13447. // "id": "directory.resources.features.insert",
  13448. // "parameterOrder": [
  13449. // "customer"
  13450. // ],
  13451. // "parameters": {
  13452. // "customer": {
  13453. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  13454. // "location": "path",
  13455. // "required": true,
  13456. // "type": "string"
  13457. // }
  13458. // },
  13459. // "path": "customer/{customer}/resources/features",
  13460. // "request": {
  13461. // "$ref": "Feature"
  13462. // },
  13463. // "response": {
  13464. // "$ref": "Feature"
  13465. // },
  13466. // "scopes": [
  13467. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  13468. // ]
  13469. // }
  13470. }
  13471. // method id "directory.resources.features.list":
  13472. type ResourcesFeaturesListCall struct {
  13473. s *Service
  13474. customer string
  13475. urlParams_ gensupport.URLParams
  13476. ifNoneMatch_ string
  13477. ctx_ context.Context
  13478. header_ http.Header
  13479. }
  13480. // List: Retrieves a list of features for an account.
  13481. func (r *ResourcesFeaturesService) List(customer string) *ResourcesFeaturesListCall {
  13482. c := &ResourcesFeaturesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13483. c.customer = customer
  13484. return c
  13485. }
  13486. // MaxResults sets the optional parameter "maxResults": Maximum number
  13487. // of results to return.
  13488. func (c *ResourcesFeaturesListCall) MaxResults(maxResults int64) *ResourcesFeaturesListCall {
  13489. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  13490. return c
  13491. }
  13492. // PageToken sets the optional parameter "pageToken": Token to specify
  13493. // the next page in the list.
  13494. func (c *ResourcesFeaturesListCall) PageToken(pageToken string) *ResourcesFeaturesListCall {
  13495. c.urlParams_.Set("pageToken", pageToken)
  13496. return c
  13497. }
  13498. // Fields allows partial responses to be retrieved. See
  13499. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13500. // for more information.
  13501. func (c *ResourcesFeaturesListCall) Fields(s ...googleapi.Field) *ResourcesFeaturesListCall {
  13502. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13503. return c
  13504. }
  13505. // IfNoneMatch sets the optional parameter which makes the operation
  13506. // fail if the object's ETag matches the given value. This is useful for
  13507. // getting updates only after the object has changed since the last
  13508. // request. Use googleapi.IsNotModified to check whether the response
  13509. // error from Do is the result of In-None-Match.
  13510. func (c *ResourcesFeaturesListCall) IfNoneMatch(entityTag string) *ResourcesFeaturesListCall {
  13511. c.ifNoneMatch_ = entityTag
  13512. return c
  13513. }
  13514. // Context sets the context to be used in this call's Do method. Any
  13515. // pending HTTP request will be aborted if the provided context is
  13516. // canceled.
  13517. func (c *ResourcesFeaturesListCall) Context(ctx context.Context) *ResourcesFeaturesListCall {
  13518. c.ctx_ = ctx
  13519. return c
  13520. }
  13521. // Header returns an http.Header that can be modified by the caller to
  13522. // add HTTP headers to the request.
  13523. func (c *ResourcesFeaturesListCall) Header() http.Header {
  13524. if c.header_ == nil {
  13525. c.header_ = make(http.Header)
  13526. }
  13527. return c.header_
  13528. }
  13529. func (c *ResourcesFeaturesListCall) doRequest(alt string) (*http.Response, error) {
  13530. reqHeaders := make(http.Header)
  13531. for k, v := range c.header_ {
  13532. reqHeaders[k] = v
  13533. }
  13534. reqHeaders.Set("User-Agent", c.s.userAgent())
  13535. if c.ifNoneMatch_ != "" {
  13536. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  13537. }
  13538. var body io.Reader = nil
  13539. c.urlParams_.Set("alt", alt)
  13540. c.urlParams_.Set("prettyPrint", "false")
  13541. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features")
  13542. urls += "?" + c.urlParams_.Encode()
  13543. req, err := http.NewRequest("GET", urls, body)
  13544. if err != nil {
  13545. return nil, err
  13546. }
  13547. req.Header = reqHeaders
  13548. googleapi.Expand(req.URL, map[string]string{
  13549. "customer": c.customer,
  13550. })
  13551. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13552. }
  13553. // Do executes the "directory.resources.features.list" call.
  13554. // Exactly one of *Features or error will be non-nil. Any non-2xx status
  13555. // code is an error. Response headers are in either
  13556. // *Features.ServerResponse.Header or (if a response was returned at
  13557. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  13558. // to check whether the returned error was because
  13559. // http.StatusNotModified was returned.
  13560. func (c *ResourcesFeaturesListCall) Do(opts ...googleapi.CallOption) (*Features, error) {
  13561. gensupport.SetOptions(c.urlParams_, opts...)
  13562. res, err := c.doRequest("json")
  13563. if res != nil && res.StatusCode == http.StatusNotModified {
  13564. if res.Body != nil {
  13565. res.Body.Close()
  13566. }
  13567. return nil, &googleapi.Error{
  13568. Code: res.StatusCode,
  13569. Header: res.Header,
  13570. }
  13571. }
  13572. if err != nil {
  13573. return nil, err
  13574. }
  13575. defer googleapi.CloseBody(res)
  13576. if err := googleapi.CheckResponse(res); err != nil {
  13577. return nil, err
  13578. }
  13579. ret := &Features{
  13580. ServerResponse: googleapi.ServerResponse{
  13581. Header: res.Header,
  13582. HTTPStatusCode: res.StatusCode,
  13583. },
  13584. }
  13585. target := &ret
  13586. if err := gensupport.DecodeResponse(target, res); err != nil {
  13587. return nil, err
  13588. }
  13589. return ret, nil
  13590. // {
  13591. // "description": "Retrieves a list of features for an account.",
  13592. // "httpMethod": "GET",
  13593. // "id": "directory.resources.features.list",
  13594. // "parameterOrder": [
  13595. // "customer"
  13596. // ],
  13597. // "parameters": {
  13598. // "customer": {
  13599. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  13600. // "location": "path",
  13601. // "required": true,
  13602. // "type": "string"
  13603. // },
  13604. // "maxResults": {
  13605. // "description": "Maximum number of results to return.",
  13606. // "format": "int32",
  13607. // "location": "query",
  13608. // "maximum": "500",
  13609. // "minimum": "1",
  13610. // "type": "integer"
  13611. // },
  13612. // "pageToken": {
  13613. // "description": "Token to specify the next page in the list.",
  13614. // "location": "query",
  13615. // "type": "string"
  13616. // }
  13617. // },
  13618. // "path": "customer/{customer}/resources/features",
  13619. // "response": {
  13620. // "$ref": "Features"
  13621. // },
  13622. // "scopes": [
  13623. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  13624. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  13625. // ]
  13626. // }
  13627. }
  13628. // Pages invokes f for each page of results.
  13629. // A non-nil error returned from f will halt the iteration.
  13630. // The provided context supersedes any context provided to the Context method.
  13631. func (c *ResourcesFeaturesListCall) Pages(ctx context.Context, f func(*Features) error) error {
  13632. c.ctx_ = ctx
  13633. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  13634. for {
  13635. x, err := c.Do()
  13636. if err != nil {
  13637. return err
  13638. }
  13639. if err := f(x); err != nil {
  13640. return err
  13641. }
  13642. if x.NextPageToken == "" {
  13643. return nil
  13644. }
  13645. c.PageToken(x.NextPageToken)
  13646. }
  13647. }
  13648. // method id "directory.resources.features.patch":
  13649. type ResourcesFeaturesPatchCall struct {
  13650. s *Service
  13651. customer string
  13652. featureKey string
  13653. feature *Feature
  13654. urlParams_ gensupport.URLParams
  13655. ctx_ context.Context
  13656. header_ http.Header
  13657. }
  13658. // Patch: Updates a feature. This method supports patch semantics.
  13659. func (r *ResourcesFeaturesService) Patch(customer string, featureKey string, feature *Feature) *ResourcesFeaturesPatchCall {
  13660. c := &ResourcesFeaturesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13661. c.customer = customer
  13662. c.featureKey = featureKey
  13663. c.feature = feature
  13664. return c
  13665. }
  13666. // Fields allows partial responses to be retrieved. See
  13667. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13668. // for more information.
  13669. func (c *ResourcesFeaturesPatchCall) Fields(s ...googleapi.Field) *ResourcesFeaturesPatchCall {
  13670. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13671. return c
  13672. }
  13673. // Context sets the context to be used in this call's Do method. Any
  13674. // pending HTTP request will be aborted if the provided context is
  13675. // canceled.
  13676. func (c *ResourcesFeaturesPatchCall) Context(ctx context.Context) *ResourcesFeaturesPatchCall {
  13677. c.ctx_ = ctx
  13678. return c
  13679. }
  13680. // Header returns an http.Header that can be modified by the caller to
  13681. // add HTTP headers to the request.
  13682. func (c *ResourcesFeaturesPatchCall) Header() http.Header {
  13683. if c.header_ == nil {
  13684. c.header_ = make(http.Header)
  13685. }
  13686. return c.header_
  13687. }
  13688. func (c *ResourcesFeaturesPatchCall) doRequest(alt string) (*http.Response, error) {
  13689. reqHeaders := make(http.Header)
  13690. for k, v := range c.header_ {
  13691. reqHeaders[k] = v
  13692. }
  13693. reqHeaders.Set("User-Agent", c.s.userAgent())
  13694. var body io.Reader = nil
  13695. body, err := googleapi.WithoutDataWrapper.JSONReader(c.feature)
  13696. if err != nil {
  13697. return nil, err
  13698. }
  13699. reqHeaders.Set("Content-Type", "application/json")
  13700. c.urlParams_.Set("alt", alt)
  13701. c.urlParams_.Set("prettyPrint", "false")
  13702. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features/{featureKey}")
  13703. urls += "?" + c.urlParams_.Encode()
  13704. req, err := http.NewRequest("PATCH", urls, body)
  13705. if err != nil {
  13706. return nil, err
  13707. }
  13708. req.Header = reqHeaders
  13709. googleapi.Expand(req.URL, map[string]string{
  13710. "customer": c.customer,
  13711. "featureKey": c.featureKey,
  13712. })
  13713. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13714. }
  13715. // Do executes the "directory.resources.features.patch" call.
  13716. // Exactly one of *Feature or error will be non-nil. Any non-2xx status
  13717. // code is an error. Response headers are in either
  13718. // *Feature.ServerResponse.Header or (if a response was returned at all)
  13719. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  13720. // check whether the returned error was because http.StatusNotModified
  13721. // was returned.
  13722. func (c *ResourcesFeaturesPatchCall) Do(opts ...googleapi.CallOption) (*Feature, error) {
  13723. gensupport.SetOptions(c.urlParams_, opts...)
  13724. res, err := c.doRequest("json")
  13725. if res != nil && res.StatusCode == http.StatusNotModified {
  13726. if res.Body != nil {
  13727. res.Body.Close()
  13728. }
  13729. return nil, &googleapi.Error{
  13730. Code: res.StatusCode,
  13731. Header: res.Header,
  13732. }
  13733. }
  13734. if err != nil {
  13735. return nil, err
  13736. }
  13737. defer googleapi.CloseBody(res)
  13738. if err := googleapi.CheckResponse(res); err != nil {
  13739. return nil, err
  13740. }
  13741. ret := &Feature{
  13742. ServerResponse: googleapi.ServerResponse{
  13743. Header: res.Header,
  13744. HTTPStatusCode: res.StatusCode,
  13745. },
  13746. }
  13747. target := &ret
  13748. if err := gensupport.DecodeResponse(target, res); err != nil {
  13749. return nil, err
  13750. }
  13751. return ret, nil
  13752. // {
  13753. // "description": "Updates a feature. This method supports patch semantics.",
  13754. // "httpMethod": "PATCH",
  13755. // "id": "directory.resources.features.patch",
  13756. // "parameterOrder": [
  13757. // "customer",
  13758. // "featureKey"
  13759. // ],
  13760. // "parameters": {
  13761. // "customer": {
  13762. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  13763. // "location": "path",
  13764. // "required": true,
  13765. // "type": "string"
  13766. // },
  13767. // "featureKey": {
  13768. // "description": "The unique ID of the feature to update.",
  13769. // "location": "path",
  13770. // "required": true,
  13771. // "type": "string"
  13772. // }
  13773. // },
  13774. // "path": "customer/{customer}/resources/features/{featureKey}",
  13775. // "request": {
  13776. // "$ref": "Feature"
  13777. // },
  13778. // "response": {
  13779. // "$ref": "Feature"
  13780. // },
  13781. // "scopes": [
  13782. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  13783. // ]
  13784. // }
  13785. }
  13786. // method id "directory.resources.features.rename":
  13787. type ResourcesFeaturesRenameCall struct {
  13788. s *Service
  13789. customer string
  13790. oldName string
  13791. featurerename *FeatureRename
  13792. urlParams_ gensupport.URLParams
  13793. ctx_ context.Context
  13794. header_ http.Header
  13795. }
  13796. // Rename: Renames a feature.
  13797. func (r *ResourcesFeaturesService) Rename(customer string, oldName string, featurerename *FeatureRename) *ResourcesFeaturesRenameCall {
  13798. c := &ResourcesFeaturesRenameCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13799. c.customer = customer
  13800. c.oldName = oldName
  13801. c.featurerename = featurerename
  13802. return c
  13803. }
  13804. // Fields allows partial responses to be retrieved. See
  13805. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13806. // for more information.
  13807. func (c *ResourcesFeaturesRenameCall) Fields(s ...googleapi.Field) *ResourcesFeaturesRenameCall {
  13808. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13809. return c
  13810. }
  13811. // Context sets the context to be used in this call's Do method. Any
  13812. // pending HTTP request will be aborted if the provided context is
  13813. // canceled.
  13814. func (c *ResourcesFeaturesRenameCall) Context(ctx context.Context) *ResourcesFeaturesRenameCall {
  13815. c.ctx_ = ctx
  13816. return c
  13817. }
  13818. // Header returns an http.Header that can be modified by the caller to
  13819. // add HTTP headers to the request.
  13820. func (c *ResourcesFeaturesRenameCall) Header() http.Header {
  13821. if c.header_ == nil {
  13822. c.header_ = make(http.Header)
  13823. }
  13824. return c.header_
  13825. }
  13826. func (c *ResourcesFeaturesRenameCall) doRequest(alt string) (*http.Response, error) {
  13827. reqHeaders := make(http.Header)
  13828. for k, v := range c.header_ {
  13829. reqHeaders[k] = v
  13830. }
  13831. reqHeaders.Set("User-Agent", c.s.userAgent())
  13832. var body io.Reader = nil
  13833. body, err := googleapi.WithoutDataWrapper.JSONReader(c.featurerename)
  13834. if err != nil {
  13835. return nil, err
  13836. }
  13837. reqHeaders.Set("Content-Type", "application/json")
  13838. c.urlParams_.Set("alt", alt)
  13839. c.urlParams_.Set("prettyPrint", "false")
  13840. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features/{oldName}/rename")
  13841. urls += "?" + c.urlParams_.Encode()
  13842. req, err := http.NewRequest("POST", urls, body)
  13843. if err != nil {
  13844. return nil, err
  13845. }
  13846. req.Header = reqHeaders
  13847. googleapi.Expand(req.URL, map[string]string{
  13848. "customer": c.customer,
  13849. "oldName": c.oldName,
  13850. })
  13851. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13852. }
  13853. // Do executes the "directory.resources.features.rename" call.
  13854. func (c *ResourcesFeaturesRenameCall) Do(opts ...googleapi.CallOption) error {
  13855. gensupport.SetOptions(c.urlParams_, opts...)
  13856. res, err := c.doRequest("json")
  13857. if err != nil {
  13858. return err
  13859. }
  13860. defer googleapi.CloseBody(res)
  13861. if err := googleapi.CheckResponse(res); err != nil {
  13862. return err
  13863. }
  13864. return nil
  13865. // {
  13866. // "description": "Renames a feature.",
  13867. // "httpMethod": "POST",
  13868. // "id": "directory.resources.features.rename",
  13869. // "parameterOrder": [
  13870. // "customer",
  13871. // "oldName"
  13872. // ],
  13873. // "parameters": {
  13874. // "customer": {
  13875. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  13876. // "location": "path",
  13877. // "required": true,
  13878. // "type": "string"
  13879. // },
  13880. // "oldName": {
  13881. // "description": "The unique ID of the feature to rename.",
  13882. // "location": "path",
  13883. // "required": true,
  13884. // "type": "string"
  13885. // }
  13886. // },
  13887. // "path": "customer/{customer}/resources/features/{oldName}/rename",
  13888. // "request": {
  13889. // "$ref": "FeatureRename"
  13890. // },
  13891. // "scopes": [
  13892. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  13893. // ]
  13894. // }
  13895. }
  13896. // method id "directory.resources.features.update":
  13897. type ResourcesFeaturesUpdateCall struct {
  13898. s *Service
  13899. customer string
  13900. featureKey string
  13901. feature *Feature
  13902. urlParams_ gensupport.URLParams
  13903. ctx_ context.Context
  13904. header_ http.Header
  13905. }
  13906. // Update: Updates a feature.
  13907. func (r *ResourcesFeaturesService) Update(customer string, featureKey string, feature *Feature) *ResourcesFeaturesUpdateCall {
  13908. c := &ResourcesFeaturesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13909. c.customer = customer
  13910. c.featureKey = featureKey
  13911. c.feature = feature
  13912. return c
  13913. }
  13914. // Fields allows partial responses to be retrieved. See
  13915. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13916. // for more information.
  13917. func (c *ResourcesFeaturesUpdateCall) Fields(s ...googleapi.Field) *ResourcesFeaturesUpdateCall {
  13918. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13919. return c
  13920. }
  13921. // Context sets the context to be used in this call's Do method. Any
  13922. // pending HTTP request will be aborted if the provided context is
  13923. // canceled.
  13924. func (c *ResourcesFeaturesUpdateCall) Context(ctx context.Context) *ResourcesFeaturesUpdateCall {
  13925. c.ctx_ = ctx
  13926. return c
  13927. }
  13928. // Header returns an http.Header that can be modified by the caller to
  13929. // add HTTP headers to the request.
  13930. func (c *ResourcesFeaturesUpdateCall) Header() http.Header {
  13931. if c.header_ == nil {
  13932. c.header_ = make(http.Header)
  13933. }
  13934. return c.header_
  13935. }
  13936. func (c *ResourcesFeaturesUpdateCall) doRequest(alt string) (*http.Response, error) {
  13937. reqHeaders := make(http.Header)
  13938. for k, v := range c.header_ {
  13939. reqHeaders[k] = v
  13940. }
  13941. reqHeaders.Set("User-Agent", c.s.userAgent())
  13942. var body io.Reader = nil
  13943. body, err := googleapi.WithoutDataWrapper.JSONReader(c.feature)
  13944. if err != nil {
  13945. return nil, err
  13946. }
  13947. reqHeaders.Set("Content-Type", "application/json")
  13948. c.urlParams_.Set("alt", alt)
  13949. c.urlParams_.Set("prettyPrint", "false")
  13950. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features/{featureKey}")
  13951. urls += "?" + c.urlParams_.Encode()
  13952. req, err := http.NewRequest("PUT", urls, body)
  13953. if err != nil {
  13954. return nil, err
  13955. }
  13956. req.Header = reqHeaders
  13957. googleapi.Expand(req.URL, map[string]string{
  13958. "customer": c.customer,
  13959. "featureKey": c.featureKey,
  13960. })
  13961. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13962. }
  13963. // Do executes the "directory.resources.features.update" call.
  13964. // Exactly one of *Feature or error will be non-nil. Any non-2xx status
  13965. // code is an error. Response headers are in either
  13966. // *Feature.ServerResponse.Header or (if a response was returned at all)
  13967. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  13968. // check whether the returned error was because http.StatusNotModified
  13969. // was returned.
  13970. func (c *ResourcesFeaturesUpdateCall) Do(opts ...googleapi.CallOption) (*Feature, error) {
  13971. gensupport.SetOptions(c.urlParams_, opts...)
  13972. res, err := c.doRequest("json")
  13973. if res != nil && res.StatusCode == http.StatusNotModified {
  13974. if res.Body != nil {
  13975. res.Body.Close()
  13976. }
  13977. return nil, &googleapi.Error{
  13978. Code: res.StatusCode,
  13979. Header: res.Header,
  13980. }
  13981. }
  13982. if err != nil {
  13983. return nil, err
  13984. }
  13985. defer googleapi.CloseBody(res)
  13986. if err := googleapi.CheckResponse(res); err != nil {
  13987. return nil, err
  13988. }
  13989. ret := &Feature{
  13990. ServerResponse: googleapi.ServerResponse{
  13991. Header: res.Header,
  13992. HTTPStatusCode: res.StatusCode,
  13993. },
  13994. }
  13995. target := &ret
  13996. if err := gensupport.DecodeResponse(target, res); err != nil {
  13997. return nil, err
  13998. }
  13999. return ret, nil
  14000. // {
  14001. // "description": "Updates a feature.",
  14002. // "httpMethod": "PUT",
  14003. // "id": "directory.resources.features.update",
  14004. // "parameterOrder": [
  14005. // "customer",
  14006. // "featureKey"
  14007. // ],
  14008. // "parameters": {
  14009. // "customer": {
  14010. // "description": "The unique ID for the customer's G Suite account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.",
  14011. // "location": "path",
  14012. // "required": true,
  14013. // "type": "string"
  14014. // },
  14015. // "featureKey": {
  14016. // "description": "The unique ID of the feature to update.",
  14017. // "location": "path",
  14018. // "required": true,
  14019. // "type": "string"
  14020. // }
  14021. // },
  14022. // "path": "customer/{customer}/resources/features/{featureKey}",
  14023. // "request": {
  14024. // "$ref": "Feature"
  14025. // },
  14026. // "response": {
  14027. // "$ref": "Feature"
  14028. // },
  14029. // "scopes": [
  14030. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  14031. // ]
  14032. // }
  14033. }
  14034. // method id "directory.roleAssignments.delete":
  14035. type RoleAssignmentsDeleteCall struct {
  14036. s *Service
  14037. customer string
  14038. roleAssignmentId string
  14039. urlParams_ gensupport.URLParams
  14040. ctx_ context.Context
  14041. header_ http.Header
  14042. }
  14043. // Delete: Deletes a role assignment.
  14044. func (r *RoleAssignmentsService) Delete(customer string, roleAssignmentId string) *RoleAssignmentsDeleteCall {
  14045. c := &RoleAssignmentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14046. c.customer = customer
  14047. c.roleAssignmentId = roleAssignmentId
  14048. return c
  14049. }
  14050. // Fields allows partial responses to be retrieved. See
  14051. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14052. // for more information.
  14053. func (c *RoleAssignmentsDeleteCall) Fields(s ...googleapi.Field) *RoleAssignmentsDeleteCall {
  14054. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14055. return c
  14056. }
  14057. // Context sets the context to be used in this call's Do method. Any
  14058. // pending HTTP request will be aborted if the provided context is
  14059. // canceled.
  14060. func (c *RoleAssignmentsDeleteCall) Context(ctx context.Context) *RoleAssignmentsDeleteCall {
  14061. c.ctx_ = ctx
  14062. return c
  14063. }
  14064. // Header returns an http.Header that can be modified by the caller to
  14065. // add HTTP headers to the request.
  14066. func (c *RoleAssignmentsDeleteCall) Header() http.Header {
  14067. if c.header_ == nil {
  14068. c.header_ = make(http.Header)
  14069. }
  14070. return c.header_
  14071. }
  14072. func (c *RoleAssignmentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  14073. reqHeaders := make(http.Header)
  14074. for k, v := range c.header_ {
  14075. reqHeaders[k] = v
  14076. }
  14077. reqHeaders.Set("User-Agent", c.s.userAgent())
  14078. var body io.Reader = nil
  14079. c.urlParams_.Set("alt", alt)
  14080. c.urlParams_.Set("prettyPrint", "false")
  14081. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments/{roleAssignmentId}")
  14082. urls += "?" + c.urlParams_.Encode()
  14083. req, err := http.NewRequest("DELETE", urls, body)
  14084. if err != nil {
  14085. return nil, err
  14086. }
  14087. req.Header = reqHeaders
  14088. googleapi.Expand(req.URL, map[string]string{
  14089. "customer": c.customer,
  14090. "roleAssignmentId": c.roleAssignmentId,
  14091. })
  14092. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14093. }
  14094. // Do executes the "directory.roleAssignments.delete" call.
  14095. func (c *RoleAssignmentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  14096. gensupport.SetOptions(c.urlParams_, opts...)
  14097. res, err := c.doRequest("json")
  14098. if err != nil {
  14099. return err
  14100. }
  14101. defer googleapi.CloseBody(res)
  14102. if err := googleapi.CheckResponse(res); err != nil {
  14103. return err
  14104. }
  14105. return nil
  14106. // {
  14107. // "description": "Deletes a role assignment.",
  14108. // "httpMethod": "DELETE",
  14109. // "id": "directory.roleAssignments.delete",
  14110. // "parameterOrder": [
  14111. // "customer",
  14112. // "roleAssignmentId"
  14113. // ],
  14114. // "parameters": {
  14115. // "customer": {
  14116. // "description": "Immutable ID of the G Suite account.",
  14117. // "location": "path",
  14118. // "required": true,
  14119. // "type": "string"
  14120. // },
  14121. // "roleAssignmentId": {
  14122. // "description": "Immutable ID of the role assignment.",
  14123. // "location": "path",
  14124. // "required": true,
  14125. // "type": "string"
  14126. // }
  14127. // },
  14128. // "path": "customer/{customer}/roleassignments/{roleAssignmentId}",
  14129. // "scopes": [
  14130. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  14131. // ]
  14132. // }
  14133. }
  14134. // method id "directory.roleAssignments.get":
  14135. type RoleAssignmentsGetCall struct {
  14136. s *Service
  14137. customer string
  14138. roleAssignmentId string
  14139. urlParams_ gensupport.URLParams
  14140. ifNoneMatch_ string
  14141. ctx_ context.Context
  14142. header_ http.Header
  14143. }
  14144. // Get: Retrieve a role assignment.
  14145. func (r *RoleAssignmentsService) Get(customer string, roleAssignmentId string) *RoleAssignmentsGetCall {
  14146. c := &RoleAssignmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14147. c.customer = customer
  14148. c.roleAssignmentId = roleAssignmentId
  14149. return c
  14150. }
  14151. // Fields allows partial responses to be retrieved. See
  14152. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14153. // for more information.
  14154. func (c *RoleAssignmentsGetCall) Fields(s ...googleapi.Field) *RoleAssignmentsGetCall {
  14155. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14156. return c
  14157. }
  14158. // IfNoneMatch sets the optional parameter which makes the operation
  14159. // fail if the object's ETag matches the given value. This is useful for
  14160. // getting updates only after the object has changed since the last
  14161. // request. Use googleapi.IsNotModified to check whether the response
  14162. // error from Do is the result of In-None-Match.
  14163. func (c *RoleAssignmentsGetCall) IfNoneMatch(entityTag string) *RoleAssignmentsGetCall {
  14164. c.ifNoneMatch_ = entityTag
  14165. return c
  14166. }
  14167. // Context sets the context to be used in this call's Do method. Any
  14168. // pending HTTP request will be aborted if the provided context is
  14169. // canceled.
  14170. func (c *RoleAssignmentsGetCall) Context(ctx context.Context) *RoleAssignmentsGetCall {
  14171. c.ctx_ = ctx
  14172. return c
  14173. }
  14174. // Header returns an http.Header that can be modified by the caller to
  14175. // add HTTP headers to the request.
  14176. func (c *RoleAssignmentsGetCall) Header() http.Header {
  14177. if c.header_ == nil {
  14178. c.header_ = make(http.Header)
  14179. }
  14180. return c.header_
  14181. }
  14182. func (c *RoleAssignmentsGetCall) doRequest(alt string) (*http.Response, error) {
  14183. reqHeaders := make(http.Header)
  14184. for k, v := range c.header_ {
  14185. reqHeaders[k] = v
  14186. }
  14187. reqHeaders.Set("User-Agent", c.s.userAgent())
  14188. if c.ifNoneMatch_ != "" {
  14189. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  14190. }
  14191. var body io.Reader = nil
  14192. c.urlParams_.Set("alt", alt)
  14193. c.urlParams_.Set("prettyPrint", "false")
  14194. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments/{roleAssignmentId}")
  14195. urls += "?" + c.urlParams_.Encode()
  14196. req, err := http.NewRequest("GET", urls, body)
  14197. if err != nil {
  14198. return nil, err
  14199. }
  14200. req.Header = reqHeaders
  14201. googleapi.Expand(req.URL, map[string]string{
  14202. "customer": c.customer,
  14203. "roleAssignmentId": c.roleAssignmentId,
  14204. })
  14205. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14206. }
  14207. // Do executes the "directory.roleAssignments.get" call.
  14208. // Exactly one of *RoleAssignment or error will be non-nil. Any non-2xx
  14209. // status code is an error. Response headers are in either
  14210. // *RoleAssignment.ServerResponse.Header or (if a response was returned
  14211. // at all) in error.(*googleapi.Error).Header. Use
  14212. // googleapi.IsNotModified to check whether the returned error was
  14213. // because http.StatusNotModified was returned.
  14214. func (c *RoleAssignmentsGetCall) Do(opts ...googleapi.CallOption) (*RoleAssignment, error) {
  14215. gensupport.SetOptions(c.urlParams_, opts...)
  14216. res, err := c.doRequest("json")
  14217. if res != nil && res.StatusCode == http.StatusNotModified {
  14218. if res.Body != nil {
  14219. res.Body.Close()
  14220. }
  14221. return nil, &googleapi.Error{
  14222. Code: res.StatusCode,
  14223. Header: res.Header,
  14224. }
  14225. }
  14226. if err != nil {
  14227. return nil, err
  14228. }
  14229. defer googleapi.CloseBody(res)
  14230. if err := googleapi.CheckResponse(res); err != nil {
  14231. return nil, err
  14232. }
  14233. ret := &RoleAssignment{
  14234. ServerResponse: googleapi.ServerResponse{
  14235. Header: res.Header,
  14236. HTTPStatusCode: res.StatusCode,
  14237. },
  14238. }
  14239. target := &ret
  14240. if err := gensupport.DecodeResponse(target, res); err != nil {
  14241. return nil, err
  14242. }
  14243. return ret, nil
  14244. // {
  14245. // "description": "Retrieve a role assignment.",
  14246. // "httpMethod": "GET",
  14247. // "id": "directory.roleAssignments.get",
  14248. // "parameterOrder": [
  14249. // "customer",
  14250. // "roleAssignmentId"
  14251. // ],
  14252. // "parameters": {
  14253. // "customer": {
  14254. // "description": "Immutable ID of the G Suite account.",
  14255. // "location": "path",
  14256. // "required": true,
  14257. // "type": "string"
  14258. // },
  14259. // "roleAssignmentId": {
  14260. // "description": "Immutable ID of the role assignment.",
  14261. // "location": "path",
  14262. // "required": true,
  14263. // "type": "string"
  14264. // }
  14265. // },
  14266. // "path": "customer/{customer}/roleassignments/{roleAssignmentId}",
  14267. // "response": {
  14268. // "$ref": "RoleAssignment"
  14269. // },
  14270. // "scopes": [
  14271. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  14272. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  14273. // ]
  14274. // }
  14275. }
  14276. // method id "directory.roleAssignments.insert":
  14277. type RoleAssignmentsInsertCall struct {
  14278. s *Service
  14279. customer string
  14280. roleassignment *RoleAssignment
  14281. urlParams_ gensupport.URLParams
  14282. ctx_ context.Context
  14283. header_ http.Header
  14284. }
  14285. // Insert: Creates a role assignment.
  14286. func (r *RoleAssignmentsService) Insert(customer string, roleassignment *RoleAssignment) *RoleAssignmentsInsertCall {
  14287. c := &RoleAssignmentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14288. c.customer = customer
  14289. c.roleassignment = roleassignment
  14290. return c
  14291. }
  14292. // Fields allows partial responses to be retrieved. See
  14293. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14294. // for more information.
  14295. func (c *RoleAssignmentsInsertCall) Fields(s ...googleapi.Field) *RoleAssignmentsInsertCall {
  14296. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14297. return c
  14298. }
  14299. // Context sets the context to be used in this call's Do method. Any
  14300. // pending HTTP request will be aborted if the provided context is
  14301. // canceled.
  14302. func (c *RoleAssignmentsInsertCall) Context(ctx context.Context) *RoleAssignmentsInsertCall {
  14303. c.ctx_ = ctx
  14304. return c
  14305. }
  14306. // Header returns an http.Header that can be modified by the caller to
  14307. // add HTTP headers to the request.
  14308. func (c *RoleAssignmentsInsertCall) Header() http.Header {
  14309. if c.header_ == nil {
  14310. c.header_ = make(http.Header)
  14311. }
  14312. return c.header_
  14313. }
  14314. func (c *RoleAssignmentsInsertCall) doRequest(alt string) (*http.Response, error) {
  14315. reqHeaders := make(http.Header)
  14316. for k, v := range c.header_ {
  14317. reqHeaders[k] = v
  14318. }
  14319. reqHeaders.Set("User-Agent", c.s.userAgent())
  14320. var body io.Reader = nil
  14321. body, err := googleapi.WithoutDataWrapper.JSONReader(c.roleassignment)
  14322. if err != nil {
  14323. return nil, err
  14324. }
  14325. reqHeaders.Set("Content-Type", "application/json")
  14326. c.urlParams_.Set("alt", alt)
  14327. c.urlParams_.Set("prettyPrint", "false")
  14328. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments")
  14329. urls += "?" + c.urlParams_.Encode()
  14330. req, err := http.NewRequest("POST", urls, body)
  14331. if err != nil {
  14332. return nil, err
  14333. }
  14334. req.Header = reqHeaders
  14335. googleapi.Expand(req.URL, map[string]string{
  14336. "customer": c.customer,
  14337. })
  14338. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14339. }
  14340. // Do executes the "directory.roleAssignments.insert" call.
  14341. // Exactly one of *RoleAssignment or error will be non-nil. Any non-2xx
  14342. // status code is an error. Response headers are in either
  14343. // *RoleAssignment.ServerResponse.Header or (if a response was returned
  14344. // at all) in error.(*googleapi.Error).Header. Use
  14345. // googleapi.IsNotModified to check whether the returned error was
  14346. // because http.StatusNotModified was returned.
  14347. func (c *RoleAssignmentsInsertCall) Do(opts ...googleapi.CallOption) (*RoleAssignment, error) {
  14348. gensupport.SetOptions(c.urlParams_, opts...)
  14349. res, err := c.doRequest("json")
  14350. if res != nil && res.StatusCode == http.StatusNotModified {
  14351. if res.Body != nil {
  14352. res.Body.Close()
  14353. }
  14354. return nil, &googleapi.Error{
  14355. Code: res.StatusCode,
  14356. Header: res.Header,
  14357. }
  14358. }
  14359. if err != nil {
  14360. return nil, err
  14361. }
  14362. defer googleapi.CloseBody(res)
  14363. if err := googleapi.CheckResponse(res); err != nil {
  14364. return nil, err
  14365. }
  14366. ret := &RoleAssignment{
  14367. ServerResponse: googleapi.ServerResponse{
  14368. Header: res.Header,
  14369. HTTPStatusCode: res.StatusCode,
  14370. },
  14371. }
  14372. target := &ret
  14373. if err := gensupport.DecodeResponse(target, res); err != nil {
  14374. return nil, err
  14375. }
  14376. return ret, nil
  14377. // {
  14378. // "description": "Creates a role assignment.",
  14379. // "httpMethod": "POST",
  14380. // "id": "directory.roleAssignments.insert",
  14381. // "parameterOrder": [
  14382. // "customer"
  14383. // ],
  14384. // "parameters": {
  14385. // "customer": {
  14386. // "description": "Immutable ID of the G Suite account.",
  14387. // "location": "path",
  14388. // "required": true,
  14389. // "type": "string"
  14390. // }
  14391. // },
  14392. // "path": "customer/{customer}/roleassignments",
  14393. // "request": {
  14394. // "$ref": "RoleAssignment"
  14395. // },
  14396. // "response": {
  14397. // "$ref": "RoleAssignment"
  14398. // },
  14399. // "scopes": [
  14400. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  14401. // ]
  14402. // }
  14403. }
  14404. // method id "directory.roleAssignments.list":
  14405. type RoleAssignmentsListCall struct {
  14406. s *Service
  14407. customer string
  14408. urlParams_ gensupport.URLParams
  14409. ifNoneMatch_ string
  14410. ctx_ context.Context
  14411. header_ http.Header
  14412. }
  14413. // List: Retrieves a paginated list of all roleAssignments.
  14414. func (r *RoleAssignmentsService) List(customer string) *RoleAssignmentsListCall {
  14415. c := &RoleAssignmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14416. c.customer = customer
  14417. return c
  14418. }
  14419. // MaxResults sets the optional parameter "maxResults": Maximum number
  14420. // of results to return.
  14421. func (c *RoleAssignmentsListCall) MaxResults(maxResults int64) *RoleAssignmentsListCall {
  14422. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  14423. return c
  14424. }
  14425. // PageToken sets the optional parameter "pageToken": Token to specify
  14426. // the next page in the list.
  14427. func (c *RoleAssignmentsListCall) PageToken(pageToken string) *RoleAssignmentsListCall {
  14428. c.urlParams_.Set("pageToken", pageToken)
  14429. return c
  14430. }
  14431. // RoleId sets the optional parameter "roleId": Immutable ID of a role.
  14432. // If included in the request, returns only role assignments containing
  14433. // this role ID.
  14434. func (c *RoleAssignmentsListCall) RoleId(roleId string) *RoleAssignmentsListCall {
  14435. c.urlParams_.Set("roleId", roleId)
  14436. return c
  14437. }
  14438. // UserKey sets the optional parameter "userKey": The user's primary
  14439. // email address, alias email address, or unique user ID. If included in
  14440. // the request, returns role assignments only for this user.
  14441. func (c *RoleAssignmentsListCall) UserKey(userKey string) *RoleAssignmentsListCall {
  14442. c.urlParams_.Set("userKey", userKey)
  14443. return c
  14444. }
  14445. // Fields allows partial responses to be retrieved. See
  14446. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14447. // for more information.
  14448. func (c *RoleAssignmentsListCall) Fields(s ...googleapi.Field) *RoleAssignmentsListCall {
  14449. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14450. return c
  14451. }
  14452. // IfNoneMatch sets the optional parameter which makes the operation
  14453. // fail if the object's ETag matches the given value. This is useful for
  14454. // getting updates only after the object has changed since the last
  14455. // request. Use googleapi.IsNotModified to check whether the response
  14456. // error from Do is the result of In-None-Match.
  14457. func (c *RoleAssignmentsListCall) IfNoneMatch(entityTag string) *RoleAssignmentsListCall {
  14458. c.ifNoneMatch_ = entityTag
  14459. return c
  14460. }
  14461. // Context sets the context to be used in this call's Do method. Any
  14462. // pending HTTP request will be aborted if the provided context is
  14463. // canceled.
  14464. func (c *RoleAssignmentsListCall) Context(ctx context.Context) *RoleAssignmentsListCall {
  14465. c.ctx_ = ctx
  14466. return c
  14467. }
  14468. // Header returns an http.Header that can be modified by the caller to
  14469. // add HTTP headers to the request.
  14470. func (c *RoleAssignmentsListCall) Header() http.Header {
  14471. if c.header_ == nil {
  14472. c.header_ = make(http.Header)
  14473. }
  14474. return c.header_
  14475. }
  14476. func (c *RoleAssignmentsListCall) doRequest(alt string) (*http.Response, error) {
  14477. reqHeaders := make(http.Header)
  14478. for k, v := range c.header_ {
  14479. reqHeaders[k] = v
  14480. }
  14481. reqHeaders.Set("User-Agent", c.s.userAgent())
  14482. if c.ifNoneMatch_ != "" {
  14483. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  14484. }
  14485. var body io.Reader = nil
  14486. c.urlParams_.Set("alt", alt)
  14487. c.urlParams_.Set("prettyPrint", "false")
  14488. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments")
  14489. urls += "?" + c.urlParams_.Encode()
  14490. req, err := http.NewRequest("GET", urls, body)
  14491. if err != nil {
  14492. return nil, err
  14493. }
  14494. req.Header = reqHeaders
  14495. googleapi.Expand(req.URL, map[string]string{
  14496. "customer": c.customer,
  14497. })
  14498. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14499. }
  14500. // Do executes the "directory.roleAssignments.list" call.
  14501. // Exactly one of *RoleAssignments or error will be non-nil. Any non-2xx
  14502. // status code is an error. Response headers are in either
  14503. // *RoleAssignments.ServerResponse.Header or (if a response was returned
  14504. // at all) in error.(*googleapi.Error).Header. Use
  14505. // googleapi.IsNotModified to check whether the returned error was
  14506. // because http.StatusNotModified was returned.
  14507. func (c *RoleAssignmentsListCall) Do(opts ...googleapi.CallOption) (*RoleAssignments, error) {
  14508. gensupport.SetOptions(c.urlParams_, opts...)
  14509. res, err := c.doRequest("json")
  14510. if res != nil && res.StatusCode == http.StatusNotModified {
  14511. if res.Body != nil {
  14512. res.Body.Close()
  14513. }
  14514. return nil, &googleapi.Error{
  14515. Code: res.StatusCode,
  14516. Header: res.Header,
  14517. }
  14518. }
  14519. if err != nil {
  14520. return nil, err
  14521. }
  14522. defer googleapi.CloseBody(res)
  14523. if err := googleapi.CheckResponse(res); err != nil {
  14524. return nil, err
  14525. }
  14526. ret := &RoleAssignments{
  14527. ServerResponse: googleapi.ServerResponse{
  14528. Header: res.Header,
  14529. HTTPStatusCode: res.StatusCode,
  14530. },
  14531. }
  14532. target := &ret
  14533. if err := gensupport.DecodeResponse(target, res); err != nil {
  14534. return nil, err
  14535. }
  14536. return ret, nil
  14537. // {
  14538. // "description": "Retrieves a paginated list of all roleAssignments.",
  14539. // "httpMethod": "GET",
  14540. // "id": "directory.roleAssignments.list",
  14541. // "parameterOrder": [
  14542. // "customer"
  14543. // ],
  14544. // "parameters": {
  14545. // "customer": {
  14546. // "description": "Immutable ID of the G Suite account.",
  14547. // "location": "path",
  14548. // "required": true,
  14549. // "type": "string"
  14550. // },
  14551. // "maxResults": {
  14552. // "description": "Maximum number of results to return.",
  14553. // "format": "int32",
  14554. // "location": "query",
  14555. // "maximum": "200",
  14556. // "minimum": "1",
  14557. // "type": "integer"
  14558. // },
  14559. // "pageToken": {
  14560. // "description": "Token to specify the next page in the list.",
  14561. // "location": "query",
  14562. // "type": "string"
  14563. // },
  14564. // "roleId": {
  14565. // "description": "Immutable ID of a role. If included in the request, returns only role assignments containing this role ID.",
  14566. // "location": "query",
  14567. // "type": "string"
  14568. // },
  14569. // "userKey": {
  14570. // "description": "The user's primary email address, alias email address, or unique user ID. If included in the request, returns role assignments only for this user.",
  14571. // "location": "query",
  14572. // "type": "string"
  14573. // }
  14574. // },
  14575. // "path": "customer/{customer}/roleassignments",
  14576. // "response": {
  14577. // "$ref": "RoleAssignments"
  14578. // },
  14579. // "scopes": [
  14580. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  14581. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  14582. // ]
  14583. // }
  14584. }
  14585. // Pages invokes f for each page of results.
  14586. // A non-nil error returned from f will halt the iteration.
  14587. // The provided context supersedes any context provided to the Context method.
  14588. func (c *RoleAssignmentsListCall) Pages(ctx context.Context, f func(*RoleAssignments) error) error {
  14589. c.ctx_ = ctx
  14590. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  14591. for {
  14592. x, err := c.Do()
  14593. if err != nil {
  14594. return err
  14595. }
  14596. if err := f(x); err != nil {
  14597. return err
  14598. }
  14599. if x.NextPageToken == "" {
  14600. return nil
  14601. }
  14602. c.PageToken(x.NextPageToken)
  14603. }
  14604. }
  14605. // method id "directory.roles.delete":
  14606. type RolesDeleteCall struct {
  14607. s *Service
  14608. customer string
  14609. roleId string
  14610. urlParams_ gensupport.URLParams
  14611. ctx_ context.Context
  14612. header_ http.Header
  14613. }
  14614. // Delete: Deletes a role.
  14615. func (r *RolesService) Delete(customer string, roleId string) *RolesDeleteCall {
  14616. c := &RolesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14617. c.customer = customer
  14618. c.roleId = roleId
  14619. return c
  14620. }
  14621. // Fields allows partial responses to be retrieved. See
  14622. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14623. // for more information.
  14624. func (c *RolesDeleteCall) Fields(s ...googleapi.Field) *RolesDeleteCall {
  14625. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14626. return c
  14627. }
  14628. // Context sets the context to be used in this call's Do method. Any
  14629. // pending HTTP request will be aborted if the provided context is
  14630. // canceled.
  14631. func (c *RolesDeleteCall) Context(ctx context.Context) *RolesDeleteCall {
  14632. c.ctx_ = ctx
  14633. return c
  14634. }
  14635. // Header returns an http.Header that can be modified by the caller to
  14636. // add HTTP headers to the request.
  14637. func (c *RolesDeleteCall) Header() http.Header {
  14638. if c.header_ == nil {
  14639. c.header_ = make(http.Header)
  14640. }
  14641. return c.header_
  14642. }
  14643. func (c *RolesDeleteCall) doRequest(alt string) (*http.Response, error) {
  14644. reqHeaders := make(http.Header)
  14645. for k, v := range c.header_ {
  14646. reqHeaders[k] = v
  14647. }
  14648. reqHeaders.Set("User-Agent", c.s.userAgent())
  14649. var body io.Reader = nil
  14650. c.urlParams_.Set("alt", alt)
  14651. c.urlParams_.Set("prettyPrint", "false")
  14652. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  14653. urls += "?" + c.urlParams_.Encode()
  14654. req, err := http.NewRequest("DELETE", urls, body)
  14655. if err != nil {
  14656. return nil, err
  14657. }
  14658. req.Header = reqHeaders
  14659. googleapi.Expand(req.URL, map[string]string{
  14660. "customer": c.customer,
  14661. "roleId": c.roleId,
  14662. })
  14663. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14664. }
  14665. // Do executes the "directory.roles.delete" call.
  14666. func (c *RolesDeleteCall) Do(opts ...googleapi.CallOption) error {
  14667. gensupport.SetOptions(c.urlParams_, opts...)
  14668. res, err := c.doRequest("json")
  14669. if err != nil {
  14670. return err
  14671. }
  14672. defer googleapi.CloseBody(res)
  14673. if err := googleapi.CheckResponse(res); err != nil {
  14674. return err
  14675. }
  14676. return nil
  14677. // {
  14678. // "description": "Deletes a role.",
  14679. // "httpMethod": "DELETE",
  14680. // "id": "directory.roles.delete",
  14681. // "parameterOrder": [
  14682. // "customer",
  14683. // "roleId"
  14684. // ],
  14685. // "parameters": {
  14686. // "customer": {
  14687. // "description": "Immutable ID of the G Suite account.",
  14688. // "location": "path",
  14689. // "required": true,
  14690. // "type": "string"
  14691. // },
  14692. // "roleId": {
  14693. // "description": "Immutable ID of the role.",
  14694. // "location": "path",
  14695. // "required": true,
  14696. // "type": "string"
  14697. // }
  14698. // },
  14699. // "path": "customer/{customer}/roles/{roleId}",
  14700. // "scopes": [
  14701. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  14702. // ]
  14703. // }
  14704. }
  14705. // method id "directory.roles.get":
  14706. type RolesGetCall struct {
  14707. s *Service
  14708. customer string
  14709. roleId string
  14710. urlParams_ gensupport.URLParams
  14711. ifNoneMatch_ string
  14712. ctx_ context.Context
  14713. header_ http.Header
  14714. }
  14715. // Get: Retrieves a role.
  14716. func (r *RolesService) Get(customer string, roleId string) *RolesGetCall {
  14717. c := &RolesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14718. c.customer = customer
  14719. c.roleId = roleId
  14720. return c
  14721. }
  14722. // Fields allows partial responses to be retrieved. See
  14723. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14724. // for more information.
  14725. func (c *RolesGetCall) Fields(s ...googleapi.Field) *RolesGetCall {
  14726. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14727. return c
  14728. }
  14729. // IfNoneMatch sets the optional parameter which makes the operation
  14730. // fail if the object's ETag matches the given value. This is useful for
  14731. // getting updates only after the object has changed since the last
  14732. // request. Use googleapi.IsNotModified to check whether the response
  14733. // error from Do is the result of In-None-Match.
  14734. func (c *RolesGetCall) IfNoneMatch(entityTag string) *RolesGetCall {
  14735. c.ifNoneMatch_ = entityTag
  14736. return c
  14737. }
  14738. // Context sets the context to be used in this call's Do method. Any
  14739. // pending HTTP request will be aborted if the provided context is
  14740. // canceled.
  14741. func (c *RolesGetCall) Context(ctx context.Context) *RolesGetCall {
  14742. c.ctx_ = ctx
  14743. return c
  14744. }
  14745. // Header returns an http.Header that can be modified by the caller to
  14746. // add HTTP headers to the request.
  14747. func (c *RolesGetCall) Header() http.Header {
  14748. if c.header_ == nil {
  14749. c.header_ = make(http.Header)
  14750. }
  14751. return c.header_
  14752. }
  14753. func (c *RolesGetCall) doRequest(alt string) (*http.Response, error) {
  14754. reqHeaders := make(http.Header)
  14755. for k, v := range c.header_ {
  14756. reqHeaders[k] = v
  14757. }
  14758. reqHeaders.Set("User-Agent", c.s.userAgent())
  14759. if c.ifNoneMatch_ != "" {
  14760. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  14761. }
  14762. var body io.Reader = nil
  14763. c.urlParams_.Set("alt", alt)
  14764. c.urlParams_.Set("prettyPrint", "false")
  14765. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  14766. urls += "?" + c.urlParams_.Encode()
  14767. req, err := http.NewRequest("GET", urls, body)
  14768. if err != nil {
  14769. return nil, err
  14770. }
  14771. req.Header = reqHeaders
  14772. googleapi.Expand(req.URL, map[string]string{
  14773. "customer": c.customer,
  14774. "roleId": c.roleId,
  14775. })
  14776. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14777. }
  14778. // Do executes the "directory.roles.get" call.
  14779. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  14780. // code is an error. Response headers are in either
  14781. // *Role.ServerResponse.Header or (if a response was returned at all) in
  14782. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  14783. // whether the returned error was because http.StatusNotModified was
  14784. // returned.
  14785. func (c *RolesGetCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  14786. gensupport.SetOptions(c.urlParams_, opts...)
  14787. res, err := c.doRequest("json")
  14788. if res != nil && res.StatusCode == http.StatusNotModified {
  14789. if res.Body != nil {
  14790. res.Body.Close()
  14791. }
  14792. return nil, &googleapi.Error{
  14793. Code: res.StatusCode,
  14794. Header: res.Header,
  14795. }
  14796. }
  14797. if err != nil {
  14798. return nil, err
  14799. }
  14800. defer googleapi.CloseBody(res)
  14801. if err := googleapi.CheckResponse(res); err != nil {
  14802. return nil, err
  14803. }
  14804. ret := &Role{
  14805. ServerResponse: googleapi.ServerResponse{
  14806. Header: res.Header,
  14807. HTTPStatusCode: res.StatusCode,
  14808. },
  14809. }
  14810. target := &ret
  14811. if err := gensupport.DecodeResponse(target, res); err != nil {
  14812. return nil, err
  14813. }
  14814. return ret, nil
  14815. // {
  14816. // "description": "Retrieves a role.",
  14817. // "httpMethod": "GET",
  14818. // "id": "directory.roles.get",
  14819. // "parameterOrder": [
  14820. // "customer",
  14821. // "roleId"
  14822. // ],
  14823. // "parameters": {
  14824. // "customer": {
  14825. // "description": "Immutable ID of the G Suite account.",
  14826. // "location": "path",
  14827. // "required": true,
  14828. // "type": "string"
  14829. // },
  14830. // "roleId": {
  14831. // "description": "Immutable ID of the role.",
  14832. // "location": "path",
  14833. // "required": true,
  14834. // "type": "string"
  14835. // }
  14836. // },
  14837. // "path": "customer/{customer}/roles/{roleId}",
  14838. // "response": {
  14839. // "$ref": "Role"
  14840. // },
  14841. // "scopes": [
  14842. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  14843. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  14844. // ]
  14845. // }
  14846. }
  14847. // method id "directory.roles.insert":
  14848. type RolesInsertCall struct {
  14849. s *Service
  14850. customer string
  14851. role *Role
  14852. urlParams_ gensupport.URLParams
  14853. ctx_ context.Context
  14854. header_ http.Header
  14855. }
  14856. // Insert: Creates a role.
  14857. func (r *RolesService) Insert(customer string, role *Role) *RolesInsertCall {
  14858. c := &RolesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14859. c.customer = customer
  14860. c.role = role
  14861. return c
  14862. }
  14863. // Fields allows partial responses to be retrieved. See
  14864. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14865. // for more information.
  14866. func (c *RolesInsertCall) Fields(s ...googleapi.Field) *RolesInsertCall {
  14867. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14868. return c
  14869. }
  14870. // Context sets the context to be used in this call's Do method. Any
  14871. // pending HTTP request will be aborted if the provided context is
  14872. // canceled.
  14873. func (c *RolesInsertCall) Context(ctx context.Context) *RolesInsertCall {
  14874. c.ctx_ = ctx
  14875. return c
  14876. }
  14877. // Header returns an http.Header that can be modified by the caller to
  14878. // add HTTP headers to the request.
  14879. func (c *RolesInsertCall) Header() http.Header {
  14880. if c.header_ == nil {
  14881. c.header_ = make(http.Header)
  14882. }
  14883. return c.header_
  14884. }
  14885. func (c *RolesInsertCall) doRequest(alt string) (*http.Response, error) {
  14886. reqHeaders := make(http.Header)
  14887. for k, v := range c.header_ {
  14888. reqHeaders[k] = v
  14889. }
  14890. reqHeaders.Set("User-Agent", c.s.userAgent())
  14891. var body io.Reader = nil
  14892. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  14893. if err != nil {
  14894. return nil, err
  14895. }
  14896. reqHeaders.Set("Content-Type", "application/json")
  14897. c.urlParams_.Set("alt", alt)
  14898. c.urlParams_.Set("prettyPrint", "false")
  14899. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles")
  14900. urls += "?" + c.urlParams_.Encode()
  14901. req, err := http.NewRequest("POST", urls, body)
  14902. if err != nil {
  14903. return nil, err
  14904. }
  14905. req.Header = reqHeaders
  14906. googleapi.Expand(req.URL, map[string]string{
  14907. "customer": c.customer,
  14908. })
  14909. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14910. }
  14911. // Do executes the "directory.roles.insert" call.
  14912. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  14913. // code is an error. Response headers are in either
  14914. // *Role.ServerResponse.Header or (if a response was returned at all) in
  14915. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  14916. // whether the returned error was because http.StatusNotModified was
  14917. // returned.
  14918. func (c *RolesInsertCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  14919. gensupport.SetOptions(c.urlParams_, opts...)
  14920. res, err := c.doRequest("json")
  14921. if res != nil && res.StatusCode == http.StatusNotModified {
  14922. if res.Body != nil {
  14923. res.Body.Close()
  14924. }
  14925. return nil, &googleapi.Error{
  14926. Code: res.StatusCode,
  14927. Header: res.Header,
  14928. }
  14929. }
  14930. if err != nil {
  14931. return nil, err
  14932. }
  14933. defer googleapi.CloseBody(res)
  14934. if err := googleapi.CheckResponse(res); err != nil {
  14935. return nil, err
  14936. }
  14937. ret := &Role{
  14938. ServerResponse: googleapi.ServerResponse{
  14939. Header: res.Header,
  14940. HTTPStatusCode: res.StatusCode,
  14941. },
  14942. }
  14943. target := &ret
  14944. if err := gensupport.DecodeResponse(target, res); err != nil {
  14945. return nil, err
  14946. }
  14947. return ret, nil
  14948. // {
  14949. // "description": "Creates a role.",
  14950. // "httpMethod": "POST",
  14951. // "id": "directory.roles.insert",
  14952. // "parameterOrder": [
  14953. // "customer"
  14954. // ],
  14955. // "parameters": {
  14956. // "customer": {
  14957. // "description": "Immutable ID of the G Suite account.",
  14958. // "location": "path",
  14959. // "required": true,
  14960. // "type": "string"
  14961. // }
  14962. // },
  14963. // "path": "customer/{customer}/roles",
  14964. // "request": {
  14965. // "$ref": "Role"
  14966. // },
  14967. // "response": {
  14968. // "$ref": "Role"
  14969. // },
  14970. // "scopes": [
  14971. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  14972. // ]
  14973. // }
  14974. }
  14975. // method id "directory.roles.list":
  14976. type RolesListCall struct {
  14977. s *Service
  14978. customer string
  14979. urlParams_ gensupport.URLParams
  14980. ifNoneMatch_ string
  14981. ctx_ context.Context
  14982. header_ http.Header
  14983. }
  14984. // List: Retrieves a paginated list of all the roles in a domain.
  14985. func (r *RolesService) List(customer string) *RolesListCall {
  14986. c := &RolesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14987. c.customer = customer
  14988. return c
  14989. }
  14990. // MaxResults sets the optional parameter "maxResults": Maximum number
  14991. // of results to return.
  14992. func (c *RolesListCall) MaxResults(maxResults int64) *RolesListCall {
  14993. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  14994. return c
  14995. }
  14996. // PageToken sets the optional parameter "pageToken": Token to specify
  14997. // the next page in the list.
  14998. func (c *RolesListCall) PageToken(pageToken string) *RolesListCall {
  14999. c.urlParams_.Set("pageToken", pageToken)
  15000. return c
  15001. }
  15002. // Fields allows partial responses to be retrieved. See
  15003. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15004. // for more information.
  15005. func (c *RolesListCall) Fields(s ...googleapi.Field) *RolesListCall {
  15006. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15007. return c
  15008. }
  15009. // IfNoneMatch sets the optional parameter which makes the operation
  15010. // fail if the object's ETag matches the given value. This is useful for
  15011. // getting updates only after the object has changed since the last
  15012. // request. Use googleapi.IsNotModified to check whether the response
  15013. // error from Do is the result of In-None-Match.
  15014. func (c *RolesListCall) IfNoneMatch(entityTag string) *RolesListCall {
  15015. c.ifNoneMatch_ = entityTag
  15016. return c
  15017. }
  15018. // Context sets the context to be used in this call's Do method. Any
  15019. // pending HTTP request will be aborted if the provided context is
  15020. // canceled.
  15021. func (c *RolesListCall) Context(ctx context.Context) *RolesListCall {
  15022. c.ctx_ = ctx
  15023. return c
  15024. }
  15025. // Header returns an http.Header that can be modified by the caller to
  15026. // add HTTP headers to the request.
  15027. func (c *RolesListCall) Header() http.Header {
  15028. if c.header_ == nil {
  15029. c.header_ = make(http.Header)
  15030. }
  15031. return c.header_
  15032. }
  15033. func (c *RolesListCall) doRequest(alt string) (*http.Response, error) {
  15034. reqHeaders := make(http.Header)
  15035. for k, v := range c.header_ {
  15036. reqHeaders[k] = v
  15037. }
  15038. reqHeaders.Set("User-Agent", c.s.userAgent())
  15039. if c.ifNoneMatch_ != "" {
  15040. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  15041. }
  15042. var body io.Reader = nil
  15043. c.urlParams_.Set("alt", alt)
  15044. c.urlParams_.Set("prettyPrint", "false")
  15045. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles")
  15046. urls += "?" + c.urlParams_.Encode()
  15047. req, err := http.NewRequest("GET", urls, body)
  15048. if err != nil {
  15049. return nil, err
  15050. }
  15051. req.Header = reqHeaders
  15052. googleapi.Expand(req.URL, map[string]string{
  15053. "customer": c.customer,
  15054. })
  15055. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15056. }
  15057. // Do executes the "directory.roles.list" call.
  15058. // Exactly one of *Roles or error will be non-nil. Any non-2xx status
  15059. // code is an error. Response headers are in either
  15060. // *Roles.ServerResponse.Header or (if a response was returned at all)
  15061. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  15062. // check whether the returned error was because http.StatusNotModified
  15063. // was returned.
  15064. func (c *RolesListCall) Do(opts ...googleapi.CallOption) (*Roles, error) {
  15065. gensupport.SetOptions(c.urlParams_, opts...)
  15066. res, err := c.doRequest("json")
  15067. if res != nil && res.StatusCode == http.StatusNotModified {
  15068. if res.Body != nil {
  15069. res.Body.Close()
  15070. }
  15071. return nil, &googleapi.Error{
  15072. Code: res.StatusCode,
  15073. Header: res.Header,
  15074. }
  15075. }
  15076. if err != nil {
  15077. return nil, err
  15078. }
  15079. defer googleapi.CloseBody(res)
  15080. if err := googleapi.CheckResponse(res); err != nil {
  15081. return nil, err
  15082. }
  15083. ret := &Roles{
  15084. ServerResponse: googleapi.ServerResponse{
  15085. Header: res.Header,
  15086. HTTPStatusCode: res.StatusCode,
  15087. },
  15088. }
  15089. target := &ret
  15090. if err := gensupport.DecodeResponse(target, res); err != nil {
  15091. return nil, err
  15092. }
  15093. return ret, nil
  15094. // {
  15095. // "description": "Retrieves a paginated list of all the roles in a domain.",
  15096. // "httpMethod": "GET",
  15097. // "id": "directory.roles.list",
  15098. // "parameterOrder": [
  15099. // "customer"
  15100. // ],
  15101. // "parameters": {
  15102. // "customer": {
  15103. // "description": "Immutable ID of the G Suite account.",
  15104. // "location": "path",
  15105. // "required": true,
  15106. // "type": "string"
  15107. // },
  15108. // "maxResults": {
  15109. // "description": "Maximum number of results to return.",
  15110. // "format": "int32",
  15111. // "location": "query",
  15112. // "maximum": "100",
  15113. // "minimum": "1",
  15114. // "type": "integer"
  15115. // },
  15116. // "pageToken": {
  15117. // "description": "Token to specify the next page in the list.",
  15118. // "location": "query",
  15119. // "type": "string"
  15120. // }
  15121. // },
  15122. // "path": "customer/{customer}/roles",
  15123. // "response": {
  15124. // "$ref": "Roles"
  15125. // },
  15126. // "scopes": [
  15127. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  15128. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  15129. // ]
  15130. // }
  15131. }
  15132. // Pages invokes f for each page of results.
  15133. // A non-nil error returned from f will halt the iteration.
  15134. // The provided context supersedes any context provided to the Context method.
  15135. func (c *RolesListCall) Pages(ctx context.Context, f func(*Roles) error) error {
  15136. c.ctx_ = ctx
  15137. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  15138. for {
  15139. x, err := c.Do()
  15140. if err != nil {
  15141. return err
  15142. }
  15143. if err := f(x); err != nil {
  15144. return err
  15145. }
  15146. if x.NextPageToken == "" {
  15147. return nil
  15148. }
  15149. c.PageToken(x.NextPageToken)
  15150. }
  15151. }
  15152. // method id "directory.roles.patch":
  15153. type RolesPatchCall struct {
  15154. s *Service
  15155. customer string
  15156. roleId string
  15157. role *Role
  15158. urlParams_ gensupport.URLParams
  15159. ctx_ context.Context
  15160. header_ http.Header
  15161. }
  15162. // Patch: Updates a role. This method supports patch semantics.
  15163. func (r *RolesService) Patch(customer string, roleId string, role *Role) *RolesPatchCall {
  15164. c := &RolesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15165. c.customer = customer
  15166. c.roleId = roleId
  15167. c.role = role
  15168. return c
  15169. }
  15170. // Fields allows partial responses to be retrieved. See
  15171. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15172. // for more information.
  15173. func (c *RolesPatchCall) Fields(s ...googleapi.Field) *RolesPatchCall {
  15174. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15175. return c
  15176. }
  15177. // Context sets the context to be used in this call's Do method. Any
  15178. // pending HTTP request will be aborted if the provided context is
  15179. // canceled.
  15180. func (c *RolesPatchCall) Context(ctx context.Context) *RolesPatchCall {
  15181. c.ctx_ = ctx
  15182. return c
  15183. }
  15184. // Header returns an http.Header that can be modified by the caller to
  15185. // add HTTP headers to the request.
  15186. func (c *RolesPatchCall) Header() http.Header {
  15187. if c.header_ == nil {
  15188. c.header_ = make(http.Header)
  15189. }
  15190. return c.header_
  15191. }
  15192. func (c *RolesPatchCall) doRequest(alt string) (*http.Response, error) {
  15193. reqHeaders := make(http.Header)
  15194. for k, v := range c.header_ {
  15195. reqHeaders[k] = v
  15196. }
  15197. reqHeaders.Set("User-Agent", c.s.userAgent())
  15198. var body io.Reader = nil
  15199. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  15200. if err != nil {
  15201. return nil, err
  15202. }
  15203. reqHeaders.Set("Content-Type", "application/json")
  15204. c.urlParams_.Set("alt", alt)
  15205. c.urlParams_.Set("prettyPrint", "false")
  15206. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  15207. urls += "?" + c.urlParams_.Encode()
  15208. req, err := http.NewRequest("PATCH", urls, body)
  15209. if err != nil {
  15210. return nil, err
  15211. }
  15212. req.Header = reqHeaders
  15213. googleapi.Expand(req.URL, map[string]string{
  15214. "customer": c.customer,
  15215. "roleId": c.roleId,
  15216. })
  15217. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15218. }
  15219. // Do executes the "directory.roles.patch" call.
  15220. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  15221. // code is an error. Response headers are in either
  15222. // *Role.ServerResponse.Header or (if a response was returned at all) in
  15223. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  15224. // whether the returned error was because http.StatusNotModified was
  15225. // returned.
  15226. func (c *RolesPatchCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  15227. gensupport.SetOptions(c.urlParams_, opts...)
  15228. res, err := c.doRequest("json")
  15229. if res != nil && res.StatusCode == http.StatusNotModified {
  15230. if res.Body != nil {
  15231. res.Body.Close()
  15232. }
  15233. return nil, &googleapi.Error{
  15234. Code: res.StatusCode,
  15235. Header: res.Header,
  15236. }
  15237. }
  15238. if err != nil {
  15239. return nil, err
  15240. }
  15241. defer googleapi.CloseBody(res)
  15242. if err := googleapi.CheckResponse(res); err != nil {
  15243. return nil, err
  15244. }
  15245. ret := &Role{
  15246. ServerResponse: googleapi.ServerResponse{
  15247. Header: res.Header,
  15248. HTTPStatusCode: res.StatusCode,
  15249. },
  15250. }
  15251. target := &ret
  15252. if err := gensupport.DecodeResponse(target, res); err != nil {
  15253. return nil, err
  15254. }
  15255. return ret, nil
  15256. // {
  15257. // "description": "Updates a role. This method supports patch semantics.",
  15258. // "httpMethod": "PATCH",
  15259. // "id": "directory.roles.patch",
  15260. // "parameterOrder": [
  15261. // "customer",
  15262. // "roleId"
  15263. // ],
  15264. // "parameters": {
  15265. // "customer": {
  15266. // "description": "Immutable ID of the G Suite account.",
  15267. // "location": "path",
  15268. // "required": true,
  15269. // "type": "string"
  15270. // },
  15271. // "roleId": {
  15272. // "description": "Immutable ID of the role.",
  15273. // "location": "path",
  15274. // "required": true,
  15275. // "type": "string"
  15276. // }
  15277. // },
  15278. // "path": "customer/{customer}/roles/{roleId}",
  15279. // "request": {
  15280. // "$ref": "Role"
  15281. // },
  15282. // "response": {
  15283. // "$ref": "Role"
  15284. // },
  15285. // "scopes": [
  15286. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  15287. // ]
  15288. // }
  15289. }
  15290. // method id "directory.roles.update":
  15291. type RolesUpdateCall struct {
  15292. s *Service
  15293. customer string
  15294. roleId string
  15295. role *Role
  15296. urlParams_ gensupport.URLParams
  15297. ctx_ context.Context
  15298. header_ http.Header
  15299. }
  15300. // Update: Updates a role.
  15301. func (r *RolesService) Update(customer string, roleId string, role *Role) *RolesUpdateCall {
  15302. c := &RolesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15303. c.customer = customer
  15304. c.roleId = roleId
  15305. c.role = role
  15306. return c
  15307. }
  15308. // Fields allows partial responses to be retrieved. See
  15309. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15310. // for more information.
  15311. func (c *RolesUpdateCall) Fields(s ...googleapi.Field) *RolesUpdateCall {
  15312. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15313. return c
  15314. }
  15315. // Context sets the context to be used in this call's Do method. Any
  15316. // pending HTTP request will be aborted if the provided context is
  15317. // canceled.
  15318. func (c *RolesUpdateCall) Context(ctx context.Context) *RolesUpdateCall {
  15319. c.ctx_ = ctx
  15320. return c
  15321. }
  15322. // Header returns an http.Header that can be modified by the caller to
  15323. // add HTTP headers to the request.
  15324. func (c *RolesUpdateCall) Header() http.Header {
  15325. if c.header_ == nil {
  15326. c.header_ = make(http.Header)
  15327. }
  15328. return c.header_
  15329. }
  15330. func (c *RolesUpdateCall) doRequest(alt string) (*http.Response, error) {
  15331. reqHeaders := make(http.Header)
  15332. for k, v := range c.header_ {
  15333. reqHeaders[k] = v
  15334. }
  15335. reqHeaders.Set("User-Agent", c.s.userAgent())
  15336. var body io.Reader = nil
  15337. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  15338. if err != nil {
  15339. return nil, err
  15340. }
  15341. reqHeaders.Set("Content-Type", "application/json")
  15342. c.urlParams_.Set("alt", alt)
  15343. c.urlParams_.Set("prettyPrint", "false")
  15344. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  15345. urls += "?" + c.urlParams_.Encode()
  15346. req, err := http.NewRequest("PUT", urls, body)
  15347. if err != nil {
  15348. return nil, err
  15349. }
  15350. req.Header = reqHeaders
  15351. googleapi.Expand(req.URL, map[string]string{
  15352. "customer": c.customer,
  15353. "roleId": c.roleId,
  15354. })
  15355. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15356. }
  15357. // Do executes the "directory.roles.update" call.
  15358. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  15359. // code is an error. Response headers are in either
  15360. // *Role.ServerResponse.Header or (if a response was returned at all) in
  15361. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  15362. // whether the returned error was because http.StatusNotModified was
  15363. // returned.
  15364. func (c *RolesUpdateCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  15365. gensupport.SetOptions(c.urlParams_, opts...)
  15366. res, err := c.doRequest("json")
  15367. if res != nil && res.StatusCode == http.StatusNotModified {
  15368. if res.Body != nil {
  15369. res.Body.Close()
  15370. }
  15371. return nil, &googleapi.Error{
  15372. Code: res.StatusCode,
  15373. Header: res.Header,
  15374. }
  15375. }
  15376. if err != nil {
  15377. return nil, err
  15378. }
  15379. defer googleapi.CloseBody(res)
  15380. if err := googleapi.CheckResponse(res); err != nil {
  15381. return nil, err
  15382. }
  15383. ret := &Role{
  15384. ServerResponse: googleapi.ServerResponse{
  15385. Header: res.Header,
  15386. HTTPStatusCode: res.StatusCode,
  15387. },
  15388. }
  15389. target := &ret
  15390. if err := gensupport.DecodeResponse(target, res); err != nil {
  15391. return nil, err
  15392. }
  15393. return ret, nil
  15394. // {
  15395. // "description": "Updates a role.",
  15396. // "httpMethod": "PUT",
  15397. // "id": "directory.roles.update",
  15398. // "parameterOrder": [
  15399. // "customer",
  15400. // "roleId"
  15401. // ],
  15402. // "parameters": {
  15403. // "customer": {
  15404. // "description": "Immutable ID of the G Suite account.",
  15405. // "location": "path",
  15406. // "required": true,
  15407. // "type": "string"
  15408. // },
  15409. // "roleId": {
  15410. // "description": "Immutable ID of the role.",
  15411. // "location": "path",
  15412. // "required": true,
  15413. // "type": "string"
  15414. // }
  15415. // },
  15416. // "path": "customer/{customer}/roles/{roleId}",
  15417. // "request": {
  15418. // "$ref": "Role"
  15419. // },
  15420. // "response": {
  15421. // "$ref": "Role"
  15422. // },
  15423. // "scopes": [
  15424. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  15425. // ]
  15426. // }
  15427. }
  15428. // method id "directory.schemas.delete":
  15429. type SchemasDeleteCall struct {
  15430. s *Service
  15431. customerId string
  15432. schemaKey string
  15433. urlParams_ gensupport.URLParams
  15434. ctx_ context.Context
  15435. header_ http.Header
  15436. }
  15437. // Delete: Delete schema
  15438. func (r *SchemasService) Delete(customerId string, schemaKey string) *SchemasDeleteCall {
  15439. c := &SchemasDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15440. c.customerId = customerId
  15441. c.schemaKey = schemaKey
  15442. return c
  15443. }
  15444. // Fields allows partial responses to be retrieved. See
  15445. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15446. // for more information.
  15447. func (c *SchemasDeleteCall) Fields(s ...googleapi.Field) *SchemasDeleteCall {
  15448. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15449. return c
  15450. }
  15451. // Context sets the context to be used in this call's Do method. Any
  15452. // pending HTTP request will be aborted if the provided context is
  15453. // canceled.
  15454. func (c *SchemasDeleteCall) Context(ctx context.Context) *SchemasDeleteCall {
  15455. c.ctx_ = ctx
  15456. return c
  15457. }
  15458. // Header returns an http.Header that can be modified by the caller to
  15459. // add HTTP headers to the request.
  15460. func (c *SchemasDeleteCall) Header() http.Header {
  15461. if c.header_ == nil {
  15462. c.header_ = make(http.Header)
  15463. }
  15464. return c.header_
  15465. }
  15466. func (c *SchemasDeleteCall) doRequest(alt string) (*http.Response, error) {
  15467. reqHeaders := make(http.Header)
  15468. for k, v := range c.header_ {
  15469. reqHeaders[k] = v
  15470. }
  15471. reqHeaders.Set("User-Agent", c.s.userAgent())
  15472. var body io.Reader = nil
  15473. c.urlParams_.Set("alt", alt)
  15474. c.urlParams_.Set("prettyPrint", "false")
  15475. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  15476. urls += "?" + c.urlParams_.Encode()
  15477. req, err := http.NewRequest("DELETE", urls, body)
  15478. if err != nil {
  15479. return nil, err
  15480. }
  15481. req.Header = reqHeaders
  15482. googleapi.Expand(req.URL, map[string]string{
  15483. "customerId": c.customerId,
  15484. "schemaKey": c.schemaKey,
  15485. })
  15486. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15487. }
  15488. // Do executes the "directory.schemas.delete" call.
  15489. func (c *SchemasDeleteCall) Do(opts ...googleapi.CallOption) error {
  15490. gensupport.SetOptions(c.urlParams_, opts...)
  15491. res, err := c.doRequest("json")
  15492. if err != nil {
  15493. return err
  15494. }
  15495. defer googleapi.CloseBody(res)
  15496. if err := googleapi.CheckResponse(res); err != nil {
  15497. return err
  15498. }
  15499. return nil
  15500. // {
  15501. // "description": "Delete schema",
  15502. // "httpMethod": "DELETE",
  15503. // "id": "directory.schemas.delete",
  15504. // "parameterOrder": [
  15505. // "customerId",
  15506. // "schemaKey"
  15507. // ],
  15508. // "parameters": {
  15509. // "customerId": {
  15510. // "description": "Immutable ID of the G Suite account",
  15511. // "location": "path",
  15512. // "required": true,
  15513. // "type": "string"
  15514. // },
  15515. // "schemaKey": {
  15516. // "description": "Name or immutable ID of the schema",
  15517. // "location": "path",
  15518. // "required": true,
  15519. // "type": "string"
  15520. // }
  15521. // },
  15522. // "path": "customer/{customerId}/schemas/{schemaKey}",
  15523. // "scopes": [
  15524. // "https://www.googleapis.com/auth/admin.directory.userschema"
  15525. // ]
  15526. // }
  15527. }
  15528. // method id "directory.schemas.get":
  15529. type SchemasGetCall struct {
  15530. s *Service
  15531. customerId string
  15532. schemaKey string
  15533. urlParams_ gensupport.URLParams
  15534. ifNoneMatch_ string
  15535. ctx_ context.Context
  15536. header_ http.Header
  15537. }
  15538. // Get: Retrieve schema
  15539. func (r *SchemasService) Get(customerId string, schemaKey string) *SchemasGetCall {
  15540. c := &SchemasGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15541. c.customerId = customerId
  15542. c.schemaKey = schemaKey
  15543. return c
  15544. }
  15545. // Fields allows partial responses to be retrieved. See
  15546. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15547. // for more information.
  15548. func (c *SchemasGetCall) Fields(s ...googleapi.Field) *SchemasGetCall {
  15549. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15550. return c
  15551. }
  15552. // IfNoneMatch sets the optional parameter which makes the operation
  15553. // fail if the object's ETag matches the given value. This is useful for
  15554. // getting updates only after the object has changed since the last
  15555. // request. Use googleapi.IsNotModified to check whether the response
  15556. // error from Do is the result of In-None-Match.
  15557. func (c *SchemasGetCall) IfNoneMatch(entityTag string) *SchemasGetCall {
  15558. c.ifNoneMatch_ = entityTag
  15559. return c
  15560. }
  15561. // Context sets the context to be used in this call's Do method. Any
  15562. // pending HTTP request will be aborted if the provided context is
  15563. // canceled.
  15564. func (c *SchemasGetCall) Context(ctx context.Context) *SchemasGetCall {
  15565. c.ctx_ = ctx
  15566. return c
  15567. }
  15568. // Header returns an http.Header that can be modified by the caller to
  15569. // add HTTP headers to the request.
  15570. func (c *SchemasGetCall) Header() http.Header {
  15571. if c.header_ == nil {
  15572. c.header_ = make(http.Header)
  15573. }
  15574. return c.header_
  15575. }
  15576. func (c *SchemasGetCall) doRequest(alt string) (*http.Response, error) {
  15577. reqHeaders := make(http.Header)
  15578. for k, v := range c.header_ {
  15579. reqHeaders[k] = v
  15580. }
  15581. reqHeaders.Set("User-Agent", c.s.userAgent())
  15582. if c.ifNoneMatch_ != "" {
  15583. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  15584. }
  15585. var body io.Reader = nil
  15586. c.urlParams_.Set("alt", alt)
  15587. c.urlParams_.Set("prettyPrint", "false")
  15588. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  15589. urls += "?" + c.urlParams_.Encode()
  15590. req, err := http.NewRequest("GET", urls, body)
  15591. if err != nil {
  15592. return nil, err
  15593. }
  15594. req.Header = reqHeaders
  15595. googleapi.Expand(req.URL, map[string]string{
  15596. "customerId": c.customerId,
  15597. "schemaKey": c.schemaKey,
  15598. })
  15599. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15600. }
  15601. // Do executes the "directory.schemas.get" call.
  15602. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  15603. // code is an error. Response headers are in either
  15604. // *Schema.ServerResponse.Header or (if a response was returned at all)
  15605. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  15606. // check whether the returned error was because http.StatusNotModified
  15607. // was returned.
  15608. func (c *SchemasGetCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  15609. gensupport.SetOptions(c.urlParams_, opts...)
  15610. res, err := c.doRequest("json")
  15611. if res != nil && res.StatusCode == http.StatusNotModified {
  15612. if res.Body != nil {
  15613. res.Body.Close()
  15614. }
  15615. return nil, &googleapi.Error{
  15616. Code: res.StatusCode,
  15617. Header: res.Header,
  15618. }
  15619. }
  15620. if err != nil {
  15621. return nil, err
  15622. }
  15623. defer googleapi.CloseBody(res)
  15624. if err := googleapi.CheckResponse(res); err != nil {
  15625. return nil, err
  15626. }
  15627. ret := &Schema{
  15628. ServerResponse: googleapi.ServerResponse{
  15629. Header: res.Header,
  15630. HTTPStatusCode: res.StatusCode,
  15631. },
  15632. }
  15633. target := &ret
  15634. if err := gensupport.DecodeResponse(target, res); err != nil {
  15635. return nil, err
  15636. }
  15637. return ret, nil
  15638. // {
  15639. // "description": "Retrieve schema",
  15640. // "httpMethod": "GET",
  15641. // "id": "directory.schemas.get",
  15642. // "parameterOrder": [
  15643. // "customerId",
  15644. // "schemaKey"
  15645. // ],
  15646. // "parameters": {
  15647. // "customerId": {
  15648. // "description": "Immutable ID of the G Suite account",
  15649. // "location": "path",
  15650. // "required": true,
  15651. // "type": "string"
  15652. // },
  15653. // "schemaKey": {
  15654. // "description": "Name or immutable ID of the schema",
  15655. // "location": "path",
  15656. // "required": true,
  15657. // "type": "string"
  15658. // }
  15659. // },
  15660. // "path": "customer/{customerId}/schemas/{schemaKey}",
  15661. // "response": {
  15662. // "$ref": "Schema"
  15663. // },
  15664. // "scopes": [
  15665. // "https://www.googleapis.com/auth/admin.directory.userschema",
  15666. // "https://www.googleapis.com/auth/admin.directory.userschema.readonly"
  15667. // ]
  15668. // }
  15669. }
  15670. // method id "directory.schemas.insert":
  15671. type SchemasInsertCall struct {
  15672. s *Service
  15673. customerId string
  15674. schema *Schema
  15675. urlParams_ gensupport.URLParams
  15676. ctx_ context.Context
  15677. header_ http.Header
  15678. }
  15679. // Insert: Create schema.
  15680. func (r *SchemasService) Insert(customerId string, schema *Schema) *SchemasInsertCall {
  15681. c := &SchemasInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15682. c.customerId = customerId
  15683. c.schema = schema
  15684. return c
  15685. }
  15686. // Fields allows partial responses to be retrieved. See
  15687. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15688. // for more information.
  15689. func (c *SchemasInsertCall) Fields(s ...googleapi.Field) *SchemasInsertCall {
  15690. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15691. return c
  15692. }
  15693. // Context sets the context to be used in this call's Do method. Any
  15694. // pending HTTP request will be aborted if the provided context is
  15695. // canceled.
  15696. func (c *SchemasInsertCall) Context(ctx context.Context) *SchemasInsertCall {
  15697. c.ctx_ = ctx
  15698. return c
  15699. }
  15700. // Header returns an http.Header that can be modified by the caller to
  15701. // add HTTP headers to the request.
  15702. func (c *SchemasInsertCall) Header() http.Header {
  15703. if c.header_ == nil {
  15704. c.header_ = make(http.Header)
  15705. }
  15706. return c.header_
  15707. }
  15708. func (c *SchemasInsertCall) doRequest(alt string) (*http.Response, error) {
  15709. reqHeaders := make(http.Header)
  15710. for k, v := range c.header_ {
  15711. reqHeaders[k] = v
  15712. }
  15713. reqHeaders.Set("User-Agent", c.s.userAgent())
  15714. var body io.Reader = nil
  15715. body, err := googleapi.WithoutDataWrapper.JSONReader(c.schema)
  15716. if err != nil {
  15717. return nil, err
  15718. }
  15719. reqHeaders.Set("Content-Type", "application/json")
  15720. c.urlParams_.Set("alt", alt)
  15721. c.urlParams_.Set("prettyPrint", "false")
  15722. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas")
  15723. urls += "?" + c.urlParams_.Encode()
  15724. req, err := http.NewRequest("POST", urls, body)
  15725. if err != nil {
  15726. return nil, err
  15727. }
  15728. req.Header = reqHeaders
  15729. googleapi.Expand(req.URL, map[string]string{
  15730. "customerId": c.customerId,
  15731. })
  15732. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15733. }
  15734. // Do executes the "directory.schemas.insert" call.
  15735. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  15736. // code is an error. Response headers are in either
  15737. // *Schema.ServerResponse.Header or (if a response was returned at all)
  15738. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  15739. // check whether the returned error was because http.StatusNotModified
  15740. // was returned.
  15741. func (c *SchemasInsertCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  15742. gensupport.SetOptions(c.urlParams_, opts...)
  15743. res, err := c.doRequest("json")
  15744. if res != nil && res.StatusCode == http.StatusNotModified {
  15745. if res.Body != nil {
  15746. res.Body.Close()
  15747. }
  15748. return nil, &googleapi.Error{
  15749. Code: res.StatusCode,
  15750. Header: res.Header,
  15751. }
  15752. }
  15753. if err != nil {
  15754. return nil, err
  15755. }
  15756. defer googleapi.CloseBody(res)
  15757. if err := googleapi.CheckResponse(res); err != nil {
  15758. return nil, err
  15759. }
  15760. ret := &Schema{
  15761. ServerResponse: googleapi.ServerResponse{
  15762. Header: res.Header,
  15763. HTTPStatusCode: res.StatusCode,
  15764. },
  15765. }
  15766. target := &ret
  15767. if err := gensupport.DecodeResponse(target, res); err != nil {
  15768. return nil, err
  15769. }
  15770. return ret, nil
  15771. // {
  15772. // "description": "Create schema.",
  15773. // "httpMethod": "POST",
  15774. // "id": "directory.schemas.insert",
  15775. // "parameterOrder": [
  15776. // "customerId"
  15777. // ],
  15778. // "parameters": {
  15779. // "customerId": {
  15780. // "description": "Immutable ID of the G Suite account",
  15781. // "location": "path",
  15782. // "required": true,
  15783. // "type": "string"
  15784. // }
  15785. // },
  15786. // "path": "customer/{customerId}/schemas",
  15787. // "request": {
  15788. // "$ref": "Schema"
  15789. // },
  15790. // "response": {
  15791. // "$ref": "Schema"
  15792. // },
  15793. // "scopes": [
  15794. // "https://www.googleapis.com/auth/admin.directory.userschema"
  15795. // ]
  15796. // }
  15797. }
  15798. // method id "directory.schemas.list":
  15799. type SchemasListCall struct {
  15800. s *Service
  15801. customerId string
  15802. urlParams_ gensupport.URLParams
  15803. ifNoneMatch_ string
  15804. ctx_ context.Context
  15805. header_ http.Header
  15806. }
  15807. // List: Retrieve all schemas for a customer
  15808. func (r *SchemasService) List(customerId string) *SchemasListCall {
  15809. c := &SchemasListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15810. c.customerId = customerId
  15811. return c
  15812. }
  15813. // Fields allows partial responses to be retrieved. See
  15814. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15815. // for more information.
  15816. func (c *SchemasListCall) Fields(s ...googleapi.Field) *SchemasListCall {
  15817. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15818. return c
  15819. }
  15820. // IfNoneMatch sets the optional parameter which makes the operation
  15821. // fail if the object's ETag matches the given value. This is useful for
  15822. // getting updates only after the object has changed since the last
  15823. // request. Use googleapi.IsNotModified to check whether the response
  15824. // error from Do is the result of In-None-Match.
  15825. func (c *SchemasListCall) IfNoneMatch(entityTag string) *SchemasListCall {
  15826. c.ifNoneMatch_ = entityTag
  15827. return c
  15828. }
  15829. // Context sets the context to be used in this call's Do method. Any
  15830. // pending HTTP request will be aborted if the provided context is
  15831. // canceled.
  15832. func (c *SchemasListCall) Context(ctx context.Context) *SchemasListCall {
  15833. c.ctx_ = ctx
  15834. return c
  15835. }
  15836. // Header returns an http.Header that can be modified by the caller to
  15837. // add HTTP headers to the request.
  15838. func (c *SchemasListCall) Header() http.Header {
  15839. if c.header_ == nil {
  15840. c.header_ = make(http.Header)
  15841. }
  15842. return c.header_
  15843. }
  15844. func (c *SchemasListCall) doRequest(alt string) (*http.Response, error) {
  15845. reqHeaders := make(http.Header)
  15846. for k, v := range c.header_ {
  15847. reqHeaders[k] = v
  15848. }
  15849. reqHeaders.Set("User-Agent", c.s.userAgent())
  15850. if c.ifNoneMatch_ != "" {
  15851. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  15852. }
  15853. var body io.Reader = nil
  15854. c.urlParams_.Set("alt", alt)
  15855. c.urlParams_.Set("prettyPrint", "false")
  15856. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas")
  15857. urls += "?" + c.urlParams_.Encode()
  15858. req, err := http.NewRequest("GET", urls, body)
  15859. if err != nil {
  15860. return nil, err
  15861. }
  15862. req.Header = reqHeaders
  15863. googleapi.Expand(req.URL, map[string]string{
  15864. "customerId": c.customerId,
  15865. })
  15866. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15867. }
  15868. // Do executes the "directory.schemas.list" call.
  15869. // Exactly one of *Schemas or error will be non-nil. Any non-2xx status
  15870. // code is an error. Response headers are in either
  15871. // *Schemas.ServerResponse.Header or (if a response was returned at all)
  15872. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  15873. // check whether the returned error was because http.StatusNotModified
  15874. // was returned.
  15875. func (c *SchemasListCall) Do(opts ...googleapi.CallOption) (*Schemas, error) {
  15876. gensupport.SetOptions(c.urlParams_, opts...)
  15877. res, err := c.doRequest("json")
  15878. if res != nil && res.StatusCode == http.StatusNotModified {
  15879. if res.Body != nil {
  15880. res.Body.Close()
  15881. }
  15882. return nil, &googleapi.Error{
  15883. Code: res.StatusCode,
  15884. Header: res.Header,
  15885. }
  15886. }
  15887. if err != nil {
  15888. return nil, err
  15889. }
  15890. defer googleapi.CloseBody(res)
  15891. if err := googleapi.CheckResponse(res); err != nil {
  15892. return nil, err
  15893. }
  15894. ret := &Schemas{
  15895. ServerResponse: googleapi.ServerResponse{
  15896. Header: res.Header,
  15897. HTTPStatusCode: res.StatusCode,
  15898. },
  15899. }
  15900. target := &ret
  15901. if err := gensupport.DecodeResponse(target, res); err != nil {
  15902. return nil, err
  15903. }
  15904. return ret, nil
  15905. // {
  15906. // "description": "Retrieve all schemas for a customer",
  15907. // "httpMethod": "GET",
  15908. // "id": "directory.schemas.list",
  15909. // "parameterOrder": [
  15910. // "customerId"
  15911. // ],
  15912. // "parameters": {
  15913. // "customerId": {
  15914. // "description": "Immutable ID of the G Suite account",
  15915. // "location": "path",
  15916. // "required": true,
  15917. // "type": "string"
  15918. // }
  15919. // },
  15920. // "path": "customer/{customerId}/schemas",
  15921. // "response": {
  15922. // "$ref": "Schemas"
  15923. // },
  15924. // "scopes": [
  15925. // "https://www.googleapis.com/auth/admin.directory.userschema",
  15926. // "https://www.googleapis.com/auth/admin.directory.userschema.readonly"
  15927. // ]
  15928. // }
  15929. }
  15930. // method id "directory.schemas.patch":
  15931. type SchemasPatchCall struct {
  15932. s *Service
  15933. customerId string
  15934. schemaKey string
  15935. schema *Schema
  15936. urlParams_ gensupport.URLParams
  15937. ctx_ context.Context
  15938. header_ http.Header
  15939. }
  15940. // Patch: Update schema. This method supports patch semantics.
  15941. func (r *SchemasService) Patch(customerId string, schemaKey string, schema *Schema) *SchemasPatchCall {
  15942. c := &SchemasPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15943. c.customerId = customerId
  15944. c.schemaKey = schemaKey
  15945. c.schema = schema
  15946. return c
  15947. }
  15948. // Fields allows partial responses to be retrieved. See
  15949. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15950. // for more information.
  15951. func (c *SchemasPatchCall) Fields(s ...googleapi.Field) *SchemasPatchCall {
  15952. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15953. return c
  15954. }
  15955. // Context sets the context to be used in this call's Do method. Any
  15956. // pending HTTP request will be aborted if the provided context is
  15957. // canceled.
  15958. func (c *SchemasPatchCall) Context(ctx context.Context) *SchemasPatchCall {
  15959. c.ctx_ = ctx
  15960. return c
  15961. }
  15962. // Header returns an http.Header that can be modified by the caller to
  15963. // add HTTP headers to the request.
  15964. func (c *SchemasPatchCall) Header() http.Header {
  15965. if c.header_ == nil {
  15966. c.header_ = make(http.Header)
  15967. }
  15968. return c.header_
  15969. }
  15970. func (c *SchemasPatchCall) doRequest(alt string) (*http.Response, error) {
  15971. reqHeaders := make(http.Header)
  15972. for k, v := range c.header_ {
  15973. reqHeaders[k] = v
  15974. }
  15975. reqHeaders.Set("User-Agent", c.s.userAgent())
  15976. var body io.Reader = nil
  15977. body, err := googleapi.WithoutDataWrapper.JSONReader(c.schema)
  15978. if err != nil {
  15979. return nil, err
  15980. }
  15981. reqHeaders.Set("Content-Type", "application/json")
  15982. c.urlParams_.Set("alt", alt)
  15983. c.urlParams_.Set("prettyPrint", "false")
  15984. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  15985. urls += "?" + c.urlParams_.Encode()
  15986. req, err := http.NewRequest("PATCH", urls, body)
  15987. if err != nil {
  15988. return nil, err
  15989. }
  15990. req.Header = reqHeaders
  15991. googleapi.Expand(req.URL, map[string]string{
  15992. "customerId": c.customerId,
  15993. "schemaKey": c.schemaKey,
  15994. })
  15995. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15996. }
  15997. // Do executes the "directory.schemas.patch" call.
  15998. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  15999. // code is an error. Response headers are in either
  16000. // *Schema.ServerResponse.Header or (if a response was returned at all)
  16001. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  16002. // check whether the returned error was because http.StatusNotModified
  16003. // was returned.
  16004. func (c *SchemasPatchCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  16005. gensupport.SetOptions(c.urlParams_, opts...)
  16006. res, err := c.doRequest("json")
  16007. if res != nil && res.StatusCode == http.StatusNotModified {
  16008. if res.Body != nil {
  16009. res.Body.Close()
  16010. }
  16011. return nil, &googleapi.Error{
  16012. Code: res.StatusCode,
  16013. Header: res.Header,
  16014. }
  16015. }
  16016. if err != nil {
  16017. return nil, err
  16018. }
  16019. defer googleapi.CloseBody(res)
  16020. if err := googleapi.CheckResponse(res); err != nil {
  16021. return nil, err
  16022. }
  16023. ret := &Schema{
  16024. ServerResponse: googleapi.ServerResponse{
  16025. Header: res.Header,
  16026. HTTPStatusCode: res.StatusCode,
  16027. },
  16028. }
  16029. target := &ret
  16030. if err := gensupport.DecodeResponse(target, res); err != nil {
  16031. return nil, err
  16032. }
  16033. return ret, nil
  16034. // {
  16035. // "description": "Update schema. This method supports patch semantics.",
  16036. // "httpMethod": "PATCH",
  16037. // "id": "directory.schemas.patch",
  16038. // "parameterOrder": [
  16039. // "customerId",
  16040. // "schemaKey"
  16041. // ],
  16042. // "parameters": {
  16043. // "customerId": {
  16044. // "description": "Immutable ID of the G Suite account",
  16045. // "location": "path",
  16046. // "required": true,
  16047. // "type": "string"
  16048. // },
  16049. // "schemaKey": {
  16050. // "description": "Name or immutable ID of the schema.",
  16051. // "location": "path",
  16052. // "required": true,
  16053. // "type": "string"
  16054. // }
  16055. // },
  16056. // "path": "customer/{customerId}/schemas/{schemaKey}",
  16057. // "request": {
  16058. // "$ref": "Schema"
  16059. // },
  16060. // "response": {
  16061. // "$ref": "Schema"
  16062. // },
  16063. // "scopes": [
  16064. // "https://www.googleapis.com/auth/admin.directory.userschema"
  16065. // ]
  16066. // }
  16067. }
  16068. // method id "directory.schemas.update":
  16069. type SchemasUpdateCall struct {
  16070. s *Service
  16071. customerId string
  16072. schemaKey string
  16073. schema *Schema
  16074. urlParams_ gensupport.URLParams
  16075. ctx_ context.Context
  16076. header_ http.Header
  16077. }
  16078. // Update: Update schema
  16079. func (r *SchemasService) Update(customerId string, schemaKey string, schema *Schema) *SchemasUpdateCall {
  16080. c := &SchemasUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16081. c.customerId = customerId
  16082. c.schemaKey = schemaKey
  16083. c.schema = schema
  16084. return c
  16085. }
  16086. // Fields allows partial responses to be retrieved. See
  16087. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16088. // for more information.
  16089. func (c *SchemasUpdateCall) Fields(s ...googleapi.Field) *SchemasUpdateCall {
  16090. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16091. return c
  16092. }
  16093. // Context sets the context to be used in this call's Do method. Any
  16094. // pending HTTP request will be aborted if the provided context is
  16095. // canceled.
  16096. func (c *SchemasUpdateCall) Context(ctx context.Context) *SchemasUpdateCall {
  16097. c.ctx_ = ctx
  16098. return c
  16099. }
  16100. // Header returns an http.Header that can be modified by the caller to
  16101. // add HTTP headers to the request.
  16102. func (c *SchemasUpdateCall) Header() http.Header {
  16103. if c.header_ == nil {
  16104. c.header_ = make(http.Header)
  16105. }
  16106. return c.header_
  16107. }
  16108. func (c *SchemasUpdateCall) doRequest(alt string) (*http.Response, error) {
  16109. reqHeaders := make(http.Header)
  16110. for k, v := range c.header_ {
  16111. reqHeaders[k] = v
  16112. }
  16113. reqHeaders.Set("User-Agent", c.s.userAgent())
  16114. var body io.Reader = nil
  16115. body, err := googleapi.WithoutDataWrapper.JSONReader(c.schema)
  16116. if err != nil {
  16117. return nil, err
  16118. }
  16119. reqHeaders.Set("Content-Type", "application/json")
  16120. c.urlParams_.Set("alt", alt)
  16121. c.urlParams_.Set("prettyPrint", "false")
  16122. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  16123. urls += "?" + c.urlParams_.Encode()
  16124. req, err := http.NewRequest("PUT", urls, body)
  16125. if err != nil {
  16126. return nil, err
  16127. }
  16128. req.Header = reqHeaders
  16129. googleapi.Expand(req.URL, map[string]string{
  16130. "customerId": c.customerId,
  16131. "schemaKey": c.schemaKey,
  16132. })
  16133. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16134. }
  16135. // Do executes the "directory.schemas.update" call.
  16136. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  16137. // code is an error. Response headers are in either
  16138. // *Schema.ServerResponse.Header or (if a response was returned at all)
  16139. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  16140. // check whether the returned error was because http.StatusNotModified
  16141. // was returned.
  16142. func (c *SchemasUpdateCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  16143. gensupport.SetOptions(c.urlParams_, opts...)
  16144. res, err := c.doRequest("json")
  16145. if res != nil && res.StatusCode == http.StatusNotModified {
  16146. if res.Body != nil {
  16147. res.Body.Close()
  16148. }
  16149. return nil, &googleapi.Error{
  16150. Code: res.StatusCode,
  16151. Header: res.Header,
  16152. }
  16153. }
  16154. if err != nil {
  16155. return nil, err
  16156. }
  16157. defer googleapi.CloseBody(res)
  16158. if err := googleapi.CheckResponse(res); err != nil {
  16159. return nil, err
  16160. }
  16161. ret := &Schema{
  16162. ServerResponse: googleapi.ServerResponse{
  16163. Header: res.Header,
  16164. HTTPStatusCode: res.StatusCode,
  16165. },
  16166. }
  16167. target := &ret
  16168. if err := gensupport.DecodeResponse(target, res); err != nil {
  16169. return nil, err
  16170. }
  16171. return ret, nil
  16172. // {
  16173. // "description": "Update schema",
  16174. // "httpMethod": "PUT",
  16175. // "id": "directory.schemas.update",
  16176. // "parameterOrder": [
  16177. // "customerId",
  16178. // "schemaKey"
  16179. // ],
  16180. // "parameters": {
  16181. // "customerId": {
  16182. // "description": "Immutable ID of the G Suite account",
  16183. // "location": "path",
  16184. // "required": true,
  16185. // "type": "string"
  16186. // },
  16187. // "schemaKey": {
  16188. // "description": "Name or immutable ID of the schema.",
  16189. // "location": "path",
  16190. // "required": true,
  16191. // "type": "string"
  16192. // }
  16193. // },
  16194. // "path": "customer/{customerId}/schemas/{schemaKey}",
  16195. // "request": {
  16196. // "$ref": "Schema"
  16197. // },
  16198. // "response": {
  16199. // "$ref": "Schema"
  16200. // },
  16201. // "scopes": [
  16202. // "https://www.googleapis.com/auth/admin.directory.userschema"
  16203. // ]
  16204. // }
  16205. }
  16206. // method id "directory.tokens.delete":
  16207. type TokensDeleteCall struct {
  16208. s *Service
  16209. userKey string
  16210. clientId string
  16211. urlParams_ gensupport.URLParams
  16212. ctx_ context.Context
  16213. header_ http.Header
  16214. }
  16215. // Delete: Delete all access tokens issued by a user for an application.
  16216. func (r *TokensService) Delete(userKey string, clientId string) *TokensDeleteCall {
  16217. c := &TokensDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16218. c.userKey = userKey
  16219. c.clientId = clientId
  16220. return c
  16221. }
  16222. // Fields allows partial responses to be retrieved. See
  16223. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16224. // for more information.
  16225. func (c *TokensDeleteCall) Fields(s ...googleapi.Field) *TokensDeleteCall {
  16226. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16227. return c
  16228. }
  16229. // Context sets the context to be used in this call's Do method. Any
  16230. // pending HTTP request will be aborted if the provided context is
  16231. // canceled.
  16232. func (c *TokensDeleteCall) Context(ctx context.Context) *TokensDeleteCall {
  16233. c.ctx_ = ctx
  16234. return c
  16235. }
  16236. // Header returns an http.Header that can be modified by the caller to
  16237. // add HTTP headers to the request.
  16238. func (c *TokensDeleteCall) Header() http.Header {
  16239. if c.header_ == nil {
  16240. c.header_ = make(http.Header)
  16241. }
  16242. return c.header_
  16243. }
  16244. func (c *TokensDeleteCall) doRequest(alt string) (*http.Response, error) {
  16245. reqHeaders := make(http.Header)
  16246. for k, v := range c.header_ {
  16247. reqHeaders[k] = v
  16248. }
  16249. reqHeaders.Set("User-Agent", c.s.userAgent())
  16250. var body io.Reader = nil
  16251. c.urlParams_.Set("alt", alt)
  16252. c.urlParams_.Set("prettyPrint", "false")
  16253. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/tokens/{clientId}")
  16254. urls += "?" + c.urlParams_.Encode()
  16255. req, err := http.NewRequest("DELETE", urls, body)
  16256. if err != nil {
  16257. return nil, err
  16258. }
  16259. req.Header = reqHeaders
  16260. googleapi.Expand(req.URL, map[string]string{
  16261. "userKey": c.userKey,
  16262. "clientId": c.clientId,
  16263. })
  16264. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16265. }
  16266. // Do executes the "directory.tokens.delete" call.
  16267. func (c *TokensDeleteCall) Do(opts ...googleapi.CallOption) error {
  16268. gensupport.SetOptions(c.urlParams_, opts...)
  16269. res, err := c.doRequest("json")
  16270. if err != nil {
  16271. return err
  16272. }
  16273. defer googleapi.CloseBody(res)
  16274. if err := googleapi.CheckResponse(res); err != nil {
  16275. return err
  16276. }
  16277. return nil
  16278. // {
  16279. // "description": "Delete all access tokens issued by a user for an application.",
  16280. // "httpMethod": "DELETE",
  16281. // "id": "directory.tokens.delete",
  16282. // "parameterOrder": [
  16283. // "userKey",
  16284. // "clientId"
  16285. // ],
  16286. // "parameters": {
  16287. // "clientId": {
  16288. // "description": "The Client ID of the application the token is issued to.",
  16289. // "location": "path",
  16290. // "required": true,
  16291. // "type": "string"
  16292. // },
  16293. // "userKey": {
  16294. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  16295. // "location": "path",
  16296. // "required": true,
  16297. // "type": "string"
  16298. // }
  16299. // },
  16300. // "path": "users/{userKey}/tokens/{clientId}",
  16301. // "scopes": [
  16302. // "https://www.googleapis.com/auth/admin.directory.user.security"
  16303. // ]
  16304. // }
  16305. }
  16306. // method id "directory.tokens.get":
  16307. type TokensGetCall struct {
  16308. s *Service
  16309. userKey string
  16310. clientId string
  16311. urlParams_ gensupport.URLParams
  16312. ifNoneMatch_ string
  16313. ctx_ context.Context
  16314. header_ http.Header
  16315. }
  16316. // Get: Get information about an access token issued by a user.
  16317. func (r *TokensService) Get(userKey string, clientId string) *TokensGetCall {
  16318. c := &TokensGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16319. c.userKey = userKey
  16320. c.clientId = clientId
  16321. return c
  16322. }
  16323. // Fields allows partial responses to be retrieved. See
  16324. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16325. // for more information.
  16326. func (c *TokensGetCall) Fields(s ...googleapi.Field) *TokensGetCall {
  16327. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16328. return c
  16329. }
  16330. // IfNoneMatch sets the optional parameter which makes the operation
  16331. // fail if the object's ETag matches the given value. This is useful for
  16332. // getting updates only after the object has changed since the last
  16333. // request. Use googleapi.IsNotModified to check whether the response
  16334. // error from Do is the result of In-None-Match.
  16335. func (c *TokensGetCall) IfNoneMatch(entityTag string) *TokensGetCall {
  16336. c.ifNoneMatch_ = entityTag
  16337. return c
  16338. }
  16339. // Context sets the context to be used in this call's Do method. Any
  16340. // pending HTTP request will be aborted if the provided context is
  16341. // canceled.
  16342. func (c *TokensGetCall) Context(ctx context.Context) *TokensGetCall {
  16343. c.ctx_ = ctx
  16344. return c
  16345. }
  16346. // Header returns an http.Header that can be modified by the caller to
  16347. // add HTTP headers to the request.
  16348. func (c *TokensGetCall) Header() http.Header {
  16349. if c.header_ == nil {
  16350. c.header_ = make(http.Header)
  16351. }
  16352. return c.header_
  16353. }
  16354. func (c *TokensGetCall) doRequest(alt string) (*http.Response, error) {
  16355. reqHeaders := make(http.Header)
  16356. for k, v := range c.header_ {
  16357. reqHeaders[k] = v
  16358. }
  16359. reqHeaders.Set("User-Agent", c.s.userAgent())
  16360. if c.ifNoneMatch_ != "" {
  16361. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  16362. }
  16363. var body io.Reader = nil
  16364. c.urlParams_.Set("alt", alt)
  16365. c.urlParams_.Set("prettyPrint", "false")
  16366. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/tokens/{clientId}")
  16367. urls += "?" + c.urlParams_.Encode()
  16368. req, err := http.NewRequest("GET", urls, body)
  16369. if err != nil {
  16370. return nil, err
  16371. }
  16372. req.Header = reqHeaders
  16373. googleapi.Expand(req.URL, map[string]string{
  16374. "userKey": c.userKey,
  16375. "clientId": c.clientId,
  16376. })
  16377. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16378. }
  16379. // Do executes the "directory.tokens.get" call.
  16380. // Exactly one of *Token or error will be non-nil. Any non-2xx status
  16381. // code is an error. Response headers are in either
  16382. // *Token.ServerResponse.Header or (if a response was returned at all)
  16383. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  16384. // check whether the returned error was because http.StatusNotModified
  16385. // was returned.
  16386. func (c *TokensGetCall) Do(opts ...googleapi.CallOption) (*Token, error) {
  16387. gensupport.SetOptions(c.urlParams_, opts...)
  16388. res, err := c.doRequest("json")
  16389. if res != nil && res.StatusCode == http.StatusNotModified {
  16390. if res.Body != nil {
  16391. res.Body.Close()
  16392. }
  16393. return nil, &googleapi.Error{
  16394. Code: res.StatusCode,
  16395. Header: res.Header,
  16396. }
  16397. }
  16398. if err != nil {
  16399. return nil, err
  16400. }
  16401. defer googleapi.CloseBody(res)
  16402. if err := googleapi.CheckResponse(res); err != nil {
  16403. return nil, err
  16404. }
  16405. ret := &Token{
  16406. ServerResponse: googleapi.ServerResponse{
  16407. Header: res.Header,
  16408. HTTPStatusCode: res.StatusCode,
  16409. },
  16410. }
  16411. target := &ret
  16412. if err := gensupport.DecodeResponse(target, res); err != nil {
  16413. return nil, err
  16414. }
  16415. return ret, nil
  16416. // {
  16417. // "description": "Get information about an access token issued by a user.",
  16418. // "httpMethod": "GET",
  16419. // "id": "directory.tokens.get",
  16420. // "parameterOrder": [
  16421. // "userKey",
  16422. // "clientId"
  16423. // ],
  16424. // "parameters": {
  16425. // "clientId": {
  16426. // "description": "The Client ID of the application the token is issued to.",
  16427. // "location": "path",
  16428. // "required": true,
  16429. // "type": "string"
  16430. // },
  16431. // "userKey": {
  16432. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  16433. // "location": "path",
  16434. // "required": true,
  16435. // "type": "string"
  16436. // }
  16437. // },
  16438. // "path": "users/{userKey}/tokens/{clientId}",
  16439. // "response": {
  16440. // "$ref": "Token"
  16441. // },
  16442. // "scopes": [
  16443. // "https://www.googleapis.com/auth/admin.directory.user.security"
  16444. // ]
  16445. // }
  16446. }
  16447. // method id "directory.tokens.list":
  16448. type TokensListCall struct {
  16449. s *Service
  16450. userKey string
  16451. urlParams_ gensupport.URLParams
  16452. ifNoneMatch_ string
  16453. ctx_ context.Context
  16454. header_ http.Header
  16455. }
  16456. // List: Returns the set of tokens specified user has issued to 3rd
  16457. // party applications.
  16458. func (r *TokensService) List(userKey string) *TokensListCall {
  16459. c := &TokensListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16460. c.userKey = userKey
  16461. return c
  16462. }
  16463. // Fields allows partial responses to be retrieved. See
  16464. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16465. // for more information.
  16466. func (c *TokensListCall) Fields(s ...googleapi.Field) *TokensListCall {
  16467. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16468. return c
  16469. }
  16470. // IfNoneMatch sets the optional parameter which makes the operation
  16471. // fail if the object's ETag matches the given value. This is useful for
  16472. // getting updates only after the object has changed since the last
  16473. // request. Use googleapi.IsNotModified to check whether the response
  16474. // error from Do is the result of In-None-Match.
  16475. func (c *TokensListCall) IfNoneMatch(entityTag string) *TokensListCall {
  16476. c.ifNoneMatch_ = entityTag
  16477. return c
  16478. }
  16479. // Context sets the context to be used in this call's Do method. Any
  16480. // pending HTTP request will be aborted if the provided context is
  16481. // canceled.
  16482. func (c *TokensListCall) Context(ctx context.Context) *TokensListCall {
  16483. c.ctx_ = ctx
  16484. return c
  16485. }
  16486. // Header returns an http.Header that can be modified by the caller to
  16487. // add HTTP headers to the request.
  16488. func (c *TokensListCall) Header() http.Header {
  16489. if c.header_ == nil {
  16490. c.header_ = make(http.Header)
  16491. }
  16492. return c.header_
  16493. }
  16494. func (c *TokensListCall) doRequest(alt string) (*http.Response, error) {
  16495. reqHeaders := make(http.Header)
  16496. for k, v := range c.header_ {
  16497. reqHeaders[k] = v
  16498. }
  16499. reqHeaders.Set("User-Agent", c.s.userAgent())
  16500. if c.ifNoneMatch_ != "" {
  16501. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  16502. }
  16503. var body io.Reader = nil
  16504. c.urlParams_.Set("alt", alt)
  16505. c.urlParams_.Set("prettyPrint", "false")
  16506. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/tokens")
  16507. urls += "?" + c.urlParams_.Encode()
  16508. req, err := http.NewRequest("GET", urls, body)
  16509. if err != nil {
  16510. return nil, err
  16511. }
  16512. req.Header = reqHeaders
  16513. googleapi.Expand(req.URL, map[string]string{
  16514. "userKey": c.userKey,
  16515. })
  16516. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16517. }
  16518. // Do executes the "directory.tokens.list" call.
  16519. // Exactly one of *Tokens or error will be non-nil. Any non-2xx status
  16520. // code is an error. Response headers are in either
  16521. // *Tokens.ServerResponse.Header or (if a response was returned at all)
  16522. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  16523. // check whether the returned error was because http.StatusNotModified
  16524. // was returned.
  16525. func (c *TokensListCall) Do(opts ...googleapi.CallOption) (*Tokens, error) {
  16526. gensupport.SetOptions(c.urlParams_, opts...)
  16527. res, err := c.doRequest("json")
  16528. if res != nil && res.StatusCode == http.StatusNotModified {
  16529. if res.Body != nil {
  16530. res.Body.Close()
  16531. }
  16532. return nil, &googleapi.Error{
  16533. Code: res.StatusCode,
  16534. Header: res.Header,
  16535. }
  16536. }
  16537. if err != nil {
  16538. return nil, err
  16539. }
  16540. defer googleapi.CloseBody(res)
  16541. if err := googleapi.CheckResponse(res); err != nil {
  16542. return nil, err
  16543. }
  16544. ret := &Tokens{
  16545. ServerResponse: googleapi.ServerResponse{
  16546. Header: res.Header,
  16547. HTTPStatusCode: res.StatusCode,
  16548. },
  16549. }
  16550. target := &ret
  16551. if err := gensupport.DecodeResponse(target, res); err != nil {
  16552. return nil, err
  16553. }
  16554. return ret, nil
  16555. // {
  16556. // "description": "Returns the set of tokens specified user has issued to 3rd party applications.",
  16557. // "httpMethod": "GET",
  16558. // "id": "directory.tokens.list",
  16559. // "parameterOrder": [
  16560. // "userKey"
  16561. // ],
  16562. // "parameters": {
  16563. // "userKey": {
  16564. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  16565. // "location": "path",
  16566. // "required": true,
  16567. // "type": "string"
  16568. // }
  16569. // },
  16570. // "path": "users/{userKey}/tokens",
  16571. // "response": {
  16572. // "$ref": "Tokens"
  16573. // },
  16574. // "scopes": [
  16575. // "https://www.googleapis.com/auth/admin.directory.user.security"
  16576. // ]
  16577. // }
  16578. }
  16579. // method id "directory.users.delete":
  16580. type UsersDeleteCall struct {
  16581. s *Service
  16582. userKey string
  16583. urlParams_ gensupport.URLParams
  16584. ctx_ context.Context
  16585. header_ http.Header
  16586. }
  16587. // Delete: Delete user
  16588. func (r *UsersService) Delete(userKey string) *UsersDeleteCall {
  16589. c := &UsersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16590. c.userKey = userKey
  16591. return c
  16592. }
  16593. // Fields allows partial responses to be retrieved. See
  16594. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16595. // for more information.
  16596. func (c *UsersDeleteCall) Fields(s ...googleapi.Field) *UsersDeleteCall {
  16597. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16598. return c
  16599. }
  16600. // Context sets the context to be used in this call's Do method. Any
  16601. // pending HTTP request will be aborted if the provided context is
  16602. // canceled.
  16603. func (c *UsersDeleteCall) Context(ctx context.Context) *UsersDeleteCall {
  16604. c.ctx_ = ctx
  16605. return c
  16606. }
  16607. // Header returns an http.Header that can be modified by the caller to
  16608. // add HTTP headers to the request.
  16609. func (c *UsersDeleteCall) Header() http.Header {
  16610. if c.header_ == nil {
  16611. c.header_ = make(http.Header)
  16612. }
  16613. return c.header_
  16614. }
  16615. func (c *UsersDeleteCall) doRequest(alt string) (*http.Response, error) {
  16616. reqHeaders := make(http.Header)
  16617. for k, v := range c.header_ {
  16618. reqHeaders[k] = v
  16619. }
  16620. reqHeaders.Set("User-Agent", c.s.userAgent())
  16621. var body io.Reader = nil
  16622. c.urlParams_.Set("alt", alt)
  16623. c.urlParams_.Set("prettyPrint", "false")
  16624. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  16625. urls += "?" + c.urlParams_.Encode()
  16626. req, err := http.NewRequest("DELETE", urls, body)
  16627. if err != nil {
  16628. return nil, err
  16629. }
  16630. req.Header = reqHeaders
  16631. googleapi.Expand(req.URL, map[string]string{
  16632. "userKey": c.userKey,
  16633. })
  16634. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16635. }
  16636. // Do executes the "directory.users.delete" call.
  16637. func (c *UsersDeleteCall) Do(opts ...googleapi.CallOption) error {
  16638. gensupport.SetOptions(c.urlParams_, opts...)
  16639. res, err := c.doRequest("json")
  16640. if err != nil {
  16641. return err
  16642. }
  16643. defer googleapi.CloseBody(res)
  16644. if err := googleapi.CheckResponse(res); err != nil {
  16645. return err
  16646. }
  16647. return nil
  16648. // {
  16649. // "description": "Delete user",
  16650. // "httpMethod": "DELETE",
  16651. // "id": "directory.users.delete",
  16652. // "parameterOrder": [
  16653. // "userKey"
  16654. // ],
  16655. // "parameters": {
  16656. // "userKey": {
  16657. // "description": "Email or immutable ID of the user",
  16658. // "location": "path",
  16659. // "required": true,
  16660. // "type": "string"
  16661. // }
  16662. // },
  16663. // "path": "users/{userKey}",
  16664. // "scopes": [
  16665. // "https://www.googleapis.com/auth/admin.directory.user"
  16666. // ]
  16667. // }
  16668. }
  16669. // method id "directory.users.get":
  16670. type UsersGetCall struct {
  16671. s *Service
  16672. userKey string
  16673. urlParams_ gensupport.URLParams
  16674. ifNoneMatch_ string
  16675. ctx_ context.Context
  16676. header_ http.Header
  16677. }
  16678. // Get: retrieve user
  16679. func (r *UsersService) Get(userKey string) *UsersGetCall {
  16680. c := &UsersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16681. c.userKey = userKey
  16682. return c
  16683. }
  16684. // CustomFieldMask sets the optional parameter "customFieldMask":
  16685. // Comma-separated list of schema names. All fields from these schemas
  16686. // are fetched. This should only be set when projection=custom.
  16687. func (c *UsersGetCall) CustomFieldMask(customFieldMask string) *UsersGetCall {
  16688. c.urlParams_.Set("customFieldMask", customFieldMask)
  16689. return c
  16690. }
  16691. // Projection sets the optional parameter "projection": What subset of
  16692. // fields to fetch for this user.
  16693. //
  16694. // Possible values:
  16695. // "basic" (default) - Do not include any custom fields for the user.
  16696. // "custom" - Include custom fields from schemas mentioned in
  16697. // customFieldMask.
  16698. // "full" - Include all fields associated with this user.
  16699. func (c *UsersGetCall) Projection(projection string) *UsersGetCall {
  16700. c.urlParams_.Set("projection", projection)
  16701. return c
  16702. }
  16703. // ViewType sets the optional parameter "viewType": Whether to fetch the
  16704. // ADMIN_VIEW or DOMAIN_PUBLIC view of the user.
  16705. //
  16706. // Possible values:
  16707. // "admin_view" (default) - Fetches the ADMIN_VIEW of the user.
  16708. // "domain_public" - Fetches the DOMAIN_PUBLIC view of the user.
  16709. func (c *UsersGetCall) ViewType(viewType string) *UsersGetCall {
  16710. c.urlParams_.Set("viewType", viewType)
  16711. return c
  16712. }
  16713. // Fields allows partial responses to be retrieved. See
  16714. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16715. // for more information.
  16716. func (c *UsersGetCall) Fields(s ...googleapi.Field) *UsersGetCall {
  16717. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16718. return c
  16719. }
  16720. // IfNoneMatch sets the optional parameter which makes the operation
  16721. // fail if the object's ETag matches the given value. This is useful for
  16722. // getting updates only after the object has changed since the last
  16723. // request. Use googleapi.IsNotModified to check whether the response
  16724. // error from Do is the result of In-None-Match.
  16725. func (c *UsersGetCall) IfNoneMatch(entityTag string) *UsersGetCall {
  16726. c.ifNoneMatch_ = entityTag
  16727. return c
  16728. }
  16729. // Context sets the context to be used in this call's Do method. Any
  16730. // pending HTTP request will be aborted if the provided context is
  16731. // canceled.
  16732. func (c *UsersGetCall) Context(ctx context.Context) *UsersGetCall {
  16733. c.ctx_ = ctx
  16734. return c
  16735. }
  16736. // Header returns an http.Header that can be modified by the caller to
  16737. // add HTTP headers to the request.
  16738. func (c *UsersGetCall) Header() http.Header {
  16739. if c.header_ == nil {
  16740. c.header_ = make(http.Header)
  16741. }
  16742. return c.header_
  16743. }
  16744. func (c *UsersGetCall) doRequest(alt string) (*http.Response, error) {
  16745. reqHeaders := make(http.Header)
  16746. for k, v := range c.header_ {
  16747. reqHeaders[k] = v
  16748. }
  16749. reqHeaders.Set("User-Agent", c.s.userAgent())
  16750. if c.ifNoneMatch_ != "" {
  16751. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  16752. }
  16753. var body io.Reader = nil
  16754. c.urlParams_.Set("alt", alt)
  16755. c.urlParams_.Set("prettyPrint", "false")
  16756. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  16757. urls += "?" + c.urlParams_.Encode()
  16758. req, err := http.NewRequest("GET", urls, body)
  16759. if err != nil {
  16760. return nil, err
  16761. }
  16762. req.Header = reqHeaders
  16763. googleapi.Expand(req.URL, map[string]string{
  16764. "userKey": c.userKey,
  16765. })
  16766. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16767. }
  16768. // Do executes the "directory.users.get" call.
  16769. // Exactly one of *User or error will be non-nil. Any non-2xx status
  16770. // code is an error. Response headers are in either
  16771. // *User.ServerResponse.Header or (if a response was returned at all) in
  16772. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  16773. // whether the returned error was because http.StatusNotModified was
  16774. // returned.
  16775. func (c *UsersGetCall) Do(opts ...googleapi.CallOption) (*User, error) {
  16776. gensupport.SetOptions(c.urlParams_, opts...)
  16777. res, err := c.doRequest("json")
  16778. if res != nil && res.StatusCode == http.StatusNotModified {
  16779. if res.Body != nil {
  16780. res.Body.Close()
  16781. }
  16782. return nil, &googleapi.Error{
  16783. Code: res.StatusCode,
  16784. Header: res.Header,
  16785. }
  16786. }
  16787. if err != nil {
  16788. return nil, err
  16789. }
  16790. defer googleapi.CloseBody(res)
  16791. if err := googleapi.CheckResponse(res); err != nil {
  16792. return nil, err
  16793. }
  16794. ret := &User{
  16795. ServerResponse: googleapi.ServerResponse{
  16796. Header: res.Header,
  16797. HTTPStatusCode: res.StatusCode,
  16798. },
  16799. }
  16800. target := &ret
  16801. if err := gensupport.DecodeResponse(target, res); err != nil {
  16802. return nil, err
  16803. }
  16804. return ret, nil
  16805. // {
  16806. // "description": "retrieve user",
  16807. // "httpMethod": "GET",
  16808. // "id": "directory.users.get",
  16809. // "parameterOrder": [
  16810. // "userKey"
  16811. // ],
  16812. // "parameters": {
  16813. // "customFieldMask": {
  16814. // "description": "Comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.",
  16815. // "location": "query",
  16816. // "type": "string"
  16817. // },
  16818. // "projection": {
  16819. // "default": "basic",
  16820. // "description": "What subset of fields to fetch for this user.",
  16821. // "enum": [
  16822. // "basic",
  16823. // "custom",
  16824. // "full"
  16825. // ],
  16826. // "enumDescriptions": [
  16827. // "Do not include any custom fields for the user.",
  16828. // "Include custom fields from schemas mentioned in customFieldMask.",
  16829. // "Include all fields associated with this user."
  16830. // ],
  16831. // "location": "query",
  16832. // "type": "string"
  16833. // },
  16834. // "userKey": {
  16835. // "description": "Email or immutable ID of the user",
  16836. // "location": "path",
  16837. // "required": true,
  16838. // "type": "string"
  16839. // },
  16840. // "viewType": {
  16841. // "default": "admin_view",
  16842. // "description": "Whether to fetch the ADMIN_VIEW or DOMAIN_PUBLIC view of the user.",
  16843. // "enum": [
  16844. // "admin_view",
  16845. // "domain_public"
  16846. // ],
  16847. // "enumDescriptions": [
  16848. // "Fetches the ADMIN_VIEW of the user.",
  16849. // "Fetches the DOMAIN_PUBLIC view of the user."
  16850. // ],
  16851. // "location": "query",
  16852. // "type": "string"
  16853. // }
  16854. // },
  16855. // "path": "users/{userKey}",
  16856. // "response": {
  16857. // "$ref": "User"
  16858. // },
  16859. // "scopes": [
  16860. // "https://www.googleapis.com/auth/admin.directory.user",
  16861. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  16862. // ]
  16863. // }
  16864. }
  16865. // method id "directory.users.insert":
  16866. type UsersInsertCall struct {
  16867. s *Service
  16868. user *User
  16869. urlParams_ gensupport.URLParams
  16870. ctx_ context.Context
  16871. header_ http.Header
  16872. }
  16873. // Insert: create user.
  16874. func (r *UsersService) Insert(user *User) *UsersInsertCall {
  16875. c := &UsersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16876. c.user = user
  16877. return c
  16878. }
  16879. // Fields allows partial responses to be retrieved. See
  16880. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16881. // for more information.
  16882. func (c *UsersInsertCall) Fields(s ...googleapi.Field) *UsersInsertCall {
  16883. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16884. return c
  16885. }
  16886. // Context sets the context to be used in this call's Do method. Any
  16887. // pending HTTP request will be aborted if the provided context is
  16888. // canceled.
  16889. func (c *UsersInsertCall) Context(ctx context.Context) *UsersInsertCall {
  16890. c.ctx_ = ctx
  16891. return c
  16892. }
  16893. // Header returns an http.Header that can be modified by the caller to
  16894. // add HTTP headers to the request.
  16895. func (c *UsersInsertCall) Header() http.Header {
  16896. if c.header_ == nil {
  16897. c.header_ = make(http.Header)
  16898. }
  16899. return c.header_
  16900. }
  16901. func (c *UsersInsertCall) doRequest(alt string) (*http.Response, error) {
  16902. reqHeaders := make(http.Header)
  16903. for k, v := range c.header_ {
  16904. reqHeaders[k] = v
  16905. }
  16906. reqHeaders.Set("User-Agent", c.s.userAgent())
  16907. var body io.Reader = nil
  16908. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  16909. if err != nil {
  16910. return nil, err
  16911. }
  16912. reqHeaders.Set("Content-Type", "application/json")
  16913. c.urlParams_.Set("alt", alt)
  16914. c.urlParams_.Set("prettyPrint", "false")
  16915. urls := googleapi.ResolveRelative(c.s.BasePath, "users")
  16916. urls += "?" + c.urlParams_.Encode()
  16917. req, err := http.NewRequest("POST", urls, body)
  16918. if err != nil {
  16919. return nil, err
  16920. }
  16921. req.Header = reqHeaders
  16922. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16923. }
  16924. // Do executes the "directory.users.insert" call.
  16925. // Exactly one of *User or error will be non-nil. Any non-2xx status
  16926. // code is an error. Response headers are in either
  16927. // *User.ServerResponse.Header or (if a response was returned at all) in
  16928. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  16929. // whether the returned error was because http.StatusNotModified was
  16930. // returned.
  16931. func (c *UsersInsertCall) Do(opts ...googleapi.CallOption) (*User, error) {
  16932. gensupport.SetOptions(c.urlParams_, opts...)
  16933. res, err := c.doRequest("json")
  16934. if res != nil && res.StatusCode == http.StatusNotModified {
  16935. if res.Body != nil {
  16936. res.Body.Close()
  16937. }
  16938. return nil, &googleapi.Error{
  16939. Code: res.StatusCode,
  16940. Header: res.Header,
  16941. }
  16942. }
  16943. if err != nil {
  16944. return nil, err
  16945. }
  16946. defer googleapi.CloseBody(res)
  16947. if err := googleapi.CheckResponse(res); err != nil {
  16948. return nil, err
  16949. }
  16950. ret := &User{
  16951. ServerResponse: googleapi.ServerResponse{
  16952. Header: res.Header,
  16953. HTTPStatusCode: res.StatusCode,
  16954. },
  16955. }
  16956. target := &ret
  16957. if err := gensupport.DecodeResponse(target, res); err != nil {
  16958. return nil, err
  16959. }
  16960. return ret, nil
  16961. // {
  16962. // "description": "create user.",
  16963. // "httpMethod": "POST",
  16964. // "id": "directory.users.insert",
  16965. // "path": "users",
  16966. // "request": {
  16967. // "$ref": "User"
  16968. // },
  16969. // "response": {
  16970. // "$ref": "User"
  16971. // },
  16972. // "scopes": [
  16973. // "https://www.googleapis.com/auth/admin.directory.user"
  16974. // ]
  16975. // }
  16976. }
  16977. // method id "directory.users.list":
  16978. type UsersListCall struct {
  16979. s *Service
  16980. urlParams_ gensupport.URLParams
  16981. ifNoneMatch_ string
  16982. ctx_ context.Context
  16983. header_ http.Header
  16984. }
  16985. // List: Retrieve either deleted users or all users in a domain
  16986. // (paginated)
  16987. func (r *UsersService) List() *UsersListCall {
  16988. c := &UsersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16989. return c
  16990. }
  16991. // CustomFieldMask sets the optional parameter "customFieldMask":
  16992. // Comma-separated list of schema names. All fields from these schemas
  16993. // are fetched. This should only be set when projection=custom.
  16994. func (c *UsersListCall) CustomFieldMask(customFieldMask string) *UsersListCall {
  16995. c.urlParams_.Set("customFieldMask", customFieldMask)
  16996. return c
  16997. }
  16998. // Customer sets the optional parameter "customer": Immutable ID of the
  16999. // G Suite account. In case of multi-domain, to fetch all users for a
  17000. // customer, fill this field instead of domain.
  17001. func (c *UsersListCall) Customer(customer string) *UsersListCall {
  17002. c.urlParams_.Set("customer", customer)
  17003. return c
  17004. }
  17005. // Domain sets the optional parameter "domain": Name of the domain. Fill
  17006. // this field to get users from only this domain. To return all users in
  17007. // a multi-domain fill customer field instead.
  17008. func (c *UsersListCall) Domain(domain string) *UsersListCall {
  17009. c.urlParams_.Set("domain", domain)
  17010. return c
  17011. }
  17012. // Event sets the optional parameter "event": Event on which
  17013. // subscription is intended (if subscribing)
  17014. //
  17015. // Possible values:
  17016. // "add" - User Created Event
  17017. // "delete" - User Deleted Event
  17018. // "makeAdmin" - User Admin Status Change Event
  17019. // "undelete" - User Undeleted Event
  17020. // "update" - User Updated Event
  17021. func (c *UsersListCall) Event(event string) *UsersListCall {
  17022. c.urlParams_.Set("event", event)
  17023. return c
  17024. }
  17025. // MaxResults sets the optional parameter "maxResults": Maximum number
  17026. // of results to return. Default is 100. Max allowed is 500
  17027. func (c *UsersListCall) MaxResults(maxResults int64) *UsersListCall {
  17028. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  17029. return c
  17030. }
  17031. // OrderBy sets the optional parameter "orderBy": Column to use for
  17032. // sorting results
  17033. //
  17034. // Possible values:
  17035. // "email" - Primary email of the user.
  17036. // "familyName" - User's family name.
  17037. // "givenName" - User's given name.
  17038. func (c *UsersListCall) OrderBy(orderBy string) *UsersListCall {
  17039. c.urlParams_.Set("orderBy", orderBy)
  17040. return c
  17041. }
  17042. // PageToken sets the optional parameter "pageToken": Token to specify
  17043. // next page in the list
  17044. func (c *UsersListCall) PageToken(pageToken string) *UsersListCall {
  17045. c.urlParams_.Set("pageToken", pageToken)
  17046. return c
  17047. }
  17048. // Projection sets the optional parameter "projection": What subset of
  17049. // fields to fetch for this user.
  17050. //
  17051. // Possible values:
  17052. // "basic" (default) - Do not include any custom fields for the user.
  17053. // "custom" - Include custom fields from schemas mentioned in
  17054. // customFieldMask.
  17055. // "full" - Include all fields associated with this user.
  17056. func (c *UsersListCall) Projection(projection string) *UsersListCall {
  17057. c.urlParams_.Set("projection", projection)
  17058. return c
  17059. }
  17060. // Query sets the optional parameter "query": Query string search.
  17061. // Should be of the form "". Complete documentation is at
  17062. // https://developers.google.com/admin-sdk/directory/v1/guides/search-users
  17063. func (c *UsersListCall) Query(query string) *UsersListCall {
  17064. c.urlParams_.Set("query", query)
  17065. return c
  17066. }
  17067. // ShowDeleted sets the optional parameter "showDeleted": If set to true
  17068. // retrieves the list of deleted users. Default is false
  17069. func (c *UsersListCall) ShowDeleted(showDeleted string) *UsersListCall {
  17070. c.urlParams_.Set("showDeleted", showDeleted)
  17071. return c
  17072. }
  17073. // SortOrder sets the optional parameter "sortOrder": Whether to return
  17074. // results in ascending or descending order.
  17075. //
  17076. // Possible values:
  17077. // "ASCENDING" - Ascending order.
  17078. // "DESCENDING" - Descending order.
  17079. func (c *UsersListCall) SortOrder(sortOrder string) *UsersListCall {
  17080. c.urlParams_.Set("sortOrder", sortOrder)
  17081. return c
  17082. }
  17083. // ViewType sets the optional parameter "viewType": Whether to fetch the
  17084. // ADMIN_VIEW or DOMAIN_PUBLIC view of the user.
  17085. //
  17086. // Possible values:
  17087. // "admin_view" (default) - Fetches the ADMIN_VIEW of the user.
  17088. // "domain_public" - Fetches the DOMAIN_PUBLIC view of the user.
  17089. func (c *UsersListCall) ViewType(viewType string) *UsersListCall {
  17090. c.urlParams_.Set("viewType", viewType)
  17091. return c
  17092. }
  17093. // Fields allows partial responses to be retrieved. See
  17094. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17095. // for more information.
  17096. func (c *UsersListCall) Fields(s ...googleapi.Field) *UsersListCall {
  17097. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17098. return c
  17099. }
  17100. // IfNoneMatch sets the optional parameter which makes the operation
  17101. // fail if the object's ETag matches the given value. This is useful for
  17102. // getting updates only after the object has changed since the last
  17103. // request. Use googleapi.IsNotModified to check whether the response
  17104. // error from Do is the result of In-None-Match.
  17105. func (c *UsersListCall) IfNoneMatch(entityTag string) *UsersListCall {
  17106. c.ifNoneMatch_ = entityTag
  17107. return c
  17108. }
  17109. // Context sets the context to be used in this call's Do method. Any
  17110. // pending HTTP request will be aborted if the provided context is
  17111. // canceled.
  17112. func (c *UsersListCall) Context(ctx context.Context) *UsersListCall {
  17113. c.ctx_ = ctx
  17114. return c
  17115. }
  17116. // Header returns an http.Header that can be modified by the caller to
  17117. // add HTTP headers to the request.
  17118. func (c *UsersListCall) Header() http.Header {
  17119. if c.header_ == nil {
  17120. c.header_ = make(http.Header)
  17121. }
  17122. return c.header_
  17123. }
  17124. func (c *UsersListCall) doRequest(alt string) (*http.Response, error) {
  17125. reqHeaders := make(http.Header)
  17126. for k, v := range c.header_ {
  17127. reqHeaders[k] = v
  17128. }
  17129. reqHeaders.Set("User-Agent", c.s.userAgent())
  17130. if c.ifNoneMatch_ != "" {
  17131. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  17132. }
  17133. var body io.Reader = nil
  17134. c.urlParams_.Set("alt", alt)
  17135. c.urlParams_.Set("prettyPrint", "false")
  17136. urls := googleapi.ResolveRelative(c.s.BasePath, "users")
  17137. urls += "?" + c.urlParams_.Encode()
  17138. req, err := http.NewRequest("GET", urls, body)
  17139. if err != nil {
  17140. return nil, err
  17141. }
  17142. req.Header = reqHeaders
  17143. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17144. }
  17145. // Do executes the "directory.users.list" call.
  17146. // Exactly one of *Users or error will be non-nil. Any non-2xx status
  17147. // code is an error. Response headers are in either
  17148. // *Users.ServerResponse.Header or (if a response was returned at all)
  17149. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  17150. // check whether the returned error was because http.StatusNotModified
  17151. // was returned.
  17152. func (c *UsersListCall) Do(opts ...googleapi.CallOption) (*Users, error) {
  17153. gensupport.SetOptions(c.urlParams_, opts...)
  17154. res, err := c.doRequest("json")
  17155. if res != nil && res.StatusCode == http.StatusNotModified {
  17156. if res.Body != nil {
  17157. res.Body.Close()
  17158. }
  17159. return nil, &googleapi.Error{
  17160. Code: res.StatusCode,
  17161. Header: res.Header,
  17162. }
  17163. }
  17164. if err != nil {
  17165. return nil, err
  17166. }
  17167. defer googleapi.CloseBody(res)
  17168. if err := googleapi.CheckResponse(res); err != nil {
  17169. return nil, err
  17170. }
  17171. ret := &Users{
  17172. ServerResponse: googleapi.ServerResponse{
  17173. Header: res.Header,
  17174. HTTPStatusCode: res.StatusCode,
  17175. },
  17176. }
  17177. target := &ret
  17178. if err := gensupport.DecodeResponse(target, res); err != nil {
  17179. return nil, err
  17180. }
  17181. return ret, nil
  17182. // {
  17183. // "description": "Retrieve either deleted users or all users in a domain (paginated)",
  17184. // "httpMethod": "GET",
  17185. // "id": "directory.users.list",
  17186. // "parameters": {
  17187. // "customFieldMask": {
  17188. // "description": "Comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.",
  17189. // "location": "query",
  17190. // "type": "string"
  17191. // },
  17192. // "customer": {
  17193. // "description": "Immutable ID of the G Suite account. In case of multi-domain, to fetch all users for a customer, fill this field instead of domain.",
  17194. // "location": "query",
  17195. // "type": "string"
  17196. // },
  17197. // "domain": {
  17198. // "description": "Name of the domain. Fill this field to get users from only this domain. To return all users in a multi-domain fill customer field instead.",
  17199. // "location": "query",
  17200. // "type": "string"
  17201. // },
  17202. // "event": {
  17203. // "description": "Event on which subscription is intended (if subscribing)",
  17204. // "enum": [
  17205. // "add",
  17206. // "delete",
  17207. // "makeAdmin",
  17208. // "undelete",
  17209. // "update"
  17210. // ],
  17211. // "enumDescriptions": [
  17212. // "User Created Event",
  17213. // "User Deleted Event",
  17214. // "User Admin Status Change Event",
  17215. // "User Undeleted Event",
  17216. // "User Updated Event"
  17217. // ],
  17218. // "location": "query",
  17219. // "type": "string"
  17220. // },
  17221. // "maxResults": {
  17222. // "description": "Maximum number of results to return. Default is 100. Max allowed is 500",
  17223. // "format": "int32",
  17224. // "location": "query",
  17225. // "maximum": "500",
  17226. // "minimum": "1",
  17227. // "type": "integer"
  17228. // },
  17229. // "orderBy": {
  17230. // "description": "Column to use for sorting results",
  17231. // "enum": [
  17232. // "email",
  17233. // "familyName",
  17234. // "givenName"
  17235. // ],
  17236. // "enumDescriptions": [
  17237. // "Primary email of the user.",
  17238. // "User's family name.",
  17239. // "User's given name."
  17240. // ],
  17241. // "location": "query",
  17242. // "type": "string"
  17243. // },
  17244. // "pageToken": {
  17245. // "description": "Token to specify next page in the list",
  17246. // "location": "query",
  17247. // "type": "string"
  17248. // },
  17249. // "projection": {
  17250. // "default": "basic",
  17251. // "description": "What subset of fields to fetch for this user.",
  17252. // "enum": [
  17253. // "basic",
  17254. // "custom",
  17255. // "full"
  17256. // ],
  17257. // "enumDescriptions": [
  17258. // "Do not include any custom fields for the user.",
  17259. // "Include custom fields from schemas mentioned in customFieldMask.",
  17260. // "Include all fields associated with this user."
  17261. // ],
  17262. // "location": "query",
  17263. // "type": "string"
  17264. // },
  17265. // "query": {
  17266. // "description": "Query string search. Should be of the form \"\". Complete documentation is at https://developers.google.com/admin-sdk/directory/v1/guides/search-users",
  17267. // "location": "query",
  17268. // "type": "string"
  17269. // },
  17270. // "showDeleted": {
  17271. // "description": "If set to true retrieves the list of deleted users. Default is false",
  17272. // "location": "query",
  17273. // "type": "string"
  17274. // },
  17275. // "sortOrder": {
  17276. // "description": "Whether to return results in ascending or descending order.",
  17277. // "enum": [
  17278. // "ASCENDING",
  17279. // "DESCENDING"
  17280. // ],
  17281. // "enumDescriptions": [
  17282. // "Ascending order.",
  17283. // "Descending order."
  17284. // ],
  17285. // "location": "query",
  17286. // "type": "string"
  17287. // },
  17288. // "viewType": {
  17289. // "default": "admin_view",
  17290. // "description": "Whether to fetch the ADMIN_VIEW or DOMAIN_PUBLIC view of the user.",
  17291. // "enum": [
  17292. // "admin_view",
  17293. // "domain_public"
  17294. // ],
  17295. // "enumDescriptions": [
  17296. // "Fetches the ADMIN_VIEW of the user.",
  17297. // "Fetches the DOMAIN_PUBLIC view of the user."
  17298. // ],
  17299. // "location": "query",
  17300. // "type": "string"
  17301. // }
  17302. // },
  17303. // "path": "users",
  17304. // "response": {
  17305. // "$ref": "Users"
  17306. // },
  17307. // "scopes": [
  17308. // "https://www.googleapis.com/auth/admin.directory.user",
  17309. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  17310. // ],
  17311. // "supportsSubscription": true
  17312. // }
  17313. }
  17314. // Pages invokes f for each page of results.
  17315. // A non-nil error returned from f will halt the iteration.
  17316. // The provided context supersedes any context provided to the Context method.
  17317. func (c *UsersListCall) Pages(ctx context.Context, f func(*Users) error) error {
  17318. c.ctx_ = ctx
  17319. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  17320. for {
  17321. x, err := c.Do()
  17322. if err != nil {
  17323. return err
  17324. }
  17325. if err := f(x); err != nil {
  17326. return err
  17327. }
  17328. if x.NextPageToken == "" {
  17329. return nil
  17330. }
  17331. c.PageToken(x.NextPageToken)
  17332. }
  17333. }
  17334. // method id "directory.users.makeAdmin":
  17335. type UsersMakeAdminCall struct {
  17336. s *Service
  17337. userKey string
  17338. usermakeadmin *UserMakeAdmin
  17339. urlParams_ gensupport.URLParams
  17340. ctx_ context.Context
  17341. header_ http.Header
  17342. }
  17343. // MakeAdmin: change admin status of a user
  17344. func (r *UsersService) MakeAdmin(userKey string, usermakeadmin *UserMakeAdmin) *UsersMakeAdminCall {
  17345. c := &UsersMakeAdminCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17346. c.userKey = userKey
  17347. c.usermakeadmin = usermakeadmin
  17348. return c
  17349. }
  17350. // Fields allows partial responses to be retrieved. See
  17351. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17352. // for more information.
  17353. func (c *UsersMakeAdminCall) Fields(s ...googleapi.Field) *UsersMakeAdminCall {
  17354. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17355. return c
  17356. }
  17357. // Context sets the context to be used in this call's Do method. Any
  17358. // pending HTTP request will be aborted if the provided context is
  17359. // canceled.
  17360. func (c *UsersMakeAdminCall) Context(ctx context.Context) *UsersMakeAdminCall {
  17361. c.ctx_ = ctx
  17362. return c
  17363. }
  17364. // Header returns an http.Header that can be modified by the caller to
  17365. // add HTTP headers to the request.
  17366. func (c *UsersMakeAdminCall) Header() http.Header {
  17367. if c.header_ == nil {
  17368. c.header_ = make(http.Header)
  17369. }
  17370. return c.header_
  17371. }
  17372. func (c *UsersMakeAdminCall) doRequest(alt string) (*http.Response, error) {
  17373. reqHeaders := make(http.Header)
  17374. for k, v := range c.header_ {
  17375. reqHeaders[k] = v
  17376. }
  17377. reqHeaders.Set("User-Agent", c.s.userAgent())
  17378. var body io.Reader = nil
  17379. body, err := googleapi.WithoutDataWrapper.JSONReader(c.usermakeadmin)
  17380. if err != nil {
  17381. return nil, err
  17382. }
  17383. reqHeaders.Set("Content-Type", "application/json")
  17384. c.urlParams_.Set("alt", alt)
  17385. c.urlParams_.Set("prettyPrint", "false")
  17386. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/makeAdmin")
  17387. urls += "?" + c.urlParams_.Encode()
  17388. req, err := http.NewRequest("POST", urls, body)
  17389. if err != nil {
  17390. return nil, err
  17391. }
  17392. req.Header = reqHeaders
  17393. googleapi.Expand(req.URL, map[string]string{
  17394. "userKey": c.userKey,
  17395. })
  17396. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17397. }
  17398. // Do executes the "directory.users.makeAdmin" call.
  17399. func (c *UsersMakeAdminCall) Do(opts ...googleapi.CallOption) error {
  17400. gensupport.SetOptions(c.urlParams_, opts...)
  17401. res, err := c.doRequest("json")
  17402. if err != nil {
  17403. return err
  17404. }
  17405. defer googleapi.CloseBody(res)
  17406. if err := googleapi.CheckResponse(res); err != nil {
  17407. return err
  17408. }
  17409. return nil
  17410. // {
  17411. // "description": "change admin status of a user",
  17412. // "httpMethod": "POST",
  17413. // "id": "directory.users.makeAdmin",
  17414. // "parameterOrder": [
  17415. // "userKey"
  17416. // ],
  17417. // "parameters": {
  17418. // "userKey": {
  17419. // "description": "Email or immutable ID of the user as admin",
  17420. // "location": "path",
  17421. // "required": true,
  17422. // "type": "string"
  17423. // }
  17424. // },
  17425. // "path": "users/{userKey}/makeAdmin",
  17426. // "request": {
  17427. // "$ref": "UserMakeAdmin"
  17428. // },
  17429. // "scopes": [
  17430. // "https://www.googleapis.com/auth/admin.directory.user"
  17431. // ]
  17432. // }
  17433. }
  17434. // method id "directory.users.patch":
  17435. type UsersPatchCall struct {
  17436. s *Service
  17437. userKey string
  17438. user *User
  17439. urlParams_ gensupport.URLParams
  17440. ctx_ context.Context
  17441. header_ http.Header
  17442. }
  17443. // Patch: update user. This method supports patch semantics.
  17444. func (r *UsersService) Patch(userKey string, user *User) *UsersPatchCall {
  17445. c := &UsersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17446. c.userKey = userKey
  17447. c.user = user
  17448. return c
  17449. }
  17450. // Fields allows partial responses to be retrieved. See
  17451. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17452. // for more information.
  17453. func (c *UsersPatchCall) Fields(s ...googleapi.Field) *UsersPatchCall {
  17454. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17455. return c
  17456. }
  17457. // Context sets the context to be used in this call's Do method. Any
  17458. // pending HTTP request will be aborted if the provided context is
  17459. // canceled.
  17460. func (c *UsersPatchCall) Context(ctx context.Context) *UsersPatchCall {
  17461. c.ctx_ = ctx
  17462. return c
  17463. }
  17464. // Header returns an http.Header that can be modified by the caller to
  17465. // add HTTP headers to the request.
  17466. func (c *UsersPatchCall) Header() http.Header {
  17467. if c.header_ == nil {
  17468. c.header_ = make(http.Header)
  17469. }
  17470. return c.header_
  17471. }
  17472. func (c *UsersPatchCall) doRequest(alt string) (*http.Response, error) {
  17473. reqHeaders := make(http.Header)
  17474. for k, v := range c.header_ {
  17475. reqHeaders[k] = v
  17476. }
  17477. reqHeaders.Set("User-Agent", c.s.userAgent())
  17478. var body io.Reader = nil
  17479. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  17480. if err != nil {
  17481. return nil, err
  17482. }
  17483. reqHeaders.Set("Content-Type", "application/json")
  17484. c.urlParams_.Set("alt", alt)
  17485. c.urlParams_.Set("prettyPrint", "false")
  17486. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  17487. urls += "?" + c.urlParams_.Encode()
  17488. req, err := http.NewRequest("PATCH", urls, body)
  17489. if err != nil {
  17490. return nil, err
  17491. }
  17492. req.Header = reqHeaders
  17493. googleapi.Expand(req.URL, map[string]string{
  17494. "userKey": c.userKey,
  17495. })
  17496. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17497. }
  17498. // Do executes the "directory.users.patch" call.
  17499. // Exactly one of *User or error will be non-nil. Any non-2xx status
  17500. // code is an error. Response headers are in either
  17501. // *User.ServerResponse.Header or (if a response was returned at all) in
  17502. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  17503. // whether the returned error was because http.StatusNotModified was
  17504. // returned.
  17505. func (c *UsersPatchCall) Do(opts ...googleapi.CallOption) (*User, error) {
  17506. gensupport.SetOptions(c.urlParams_, opts...)
  17507. res, err := c.doRequest("json")
  17508. if res != nil && res.StatusCode == http.StatusNotModified {
  17509. if res.Body != nil {
  17510. res.Body.Close()
  17511. }
  17512. return nil, &googleapi.Error{
  17513. Code: res.StatusCode,
  17514. Header: res.Header,
  17515. }
  17516. }
  17517. if err != nil {
  17518. return nil, err
  17519. }
  17520. defer googleapi.CloseBody(res)
  17521. if err := googleapi.CheckResponse(res); err != nil {
  17522. return nil, err
  17523. }
  17524. ret := &User{
  17525. ServerResponse: googleapi.ServerResponse{
  17526. Header: res.Header,
  17527. HTTPStatusCode: res.StatusCode,
  17528. },
  17529. }
  17530. target := &ret
  17531. if err := gensupport.DecodeResponse(target, res); err != nil {
  17532. return nil, err
  17533. }
  17534. return ret, nil
  17535. // {
  17536. // "description": "update user. This method supports patch semantics.",
  17537. // "httpMethod": "PATCH",
  17538. // "id": "directory.users.patch",
  17539. // "parameterOrder": [
  17540. // "userKey"
  17541. // ],
  17542. // "parameters": {
  17543. // "userKey": {
  17544. // "description": "Email or immutable ID of the user. If ID, it should match with id of user object",
  17545. // "location": "path",
  17546. // "required": true,
  17547. // "type": "string"
  17548. // }
  17549. // },
  17550. // "path": "users/{userKey}",
  17551. // "request": {
  17552. // "$ref": "User"
  17553. // },
  17554. // "response": {
  17555. // "$ref": "User"
  17556. // },
  17557. // "scopes": [
  17558. // "https://www.googleapis.com/auth/admin.directory.user"
  17559. // ]
  17560. // }
  17561. }
  17562. // method id "directory.users.undelete":
  17563. type UsersUndeleteCall struct {
  17564. s *Service
  17565. userKey string
  17566. userundelete *UserUndelete
  17567. urlParams_ gensupport.URLParams
  17568. ctx_ context.Context
  17569. header_ http.Header
  17570. }
  17571. // Undelete: Undelete a deleted user
  17572. func (r *UsersService) Undelete(userKey string, userundelete *UserUndelete) *UsersUndeleteCall {
  17573. c := &UsersUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17574. c.userKey = userKey
  17575. c.userundelete = userundelete
  17576. return c
  17577. }
  17578. // Fields allows partial responses to be retrieved. See
  17579. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17580. // for more information.
  17581. func (c *UsersUndeleteCall) Fields(s ...googleapi.Field) *UsersUndeleteCall {
  17582. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17583. return c
  17584. }
  17585. // Context sets the context to be used in this call's Do method. Any
  17586. // pending HTTP request will be aborted if the provided context is
  17587. // canceled.
  17588. func (c *UsersUndeleteCall) Context(ctx context.Context) *UsersUndeleteCall {
  17589. c.ctx_ = ctx
  17590. return c
  17591. }
  17592. // Header returns an http.Header that can be modified by the caller to
  17593. // add HTTP headers to the request.
  17594. func (c *UsersUndeleteCall) Header() http.Header {
  17595. if c.header_ == nil {
  17596. c.header_ = make(http.Header)
  17597. }
  17598. return c.header_
  17599. }
  17600. func (c *UsersUndeleteCall) doRequest(alt string) (*http.Response, error) {
  17601. reqHeaders := make(http.Header)
  17602. for k, v := range c.header_ {
  17603. reqHeaders[k] = v
  17604. }
  17605. reqHeaders.Set("User-Agent", c.s.userAgent())
  17606. var body io.Reader = nil
  17607. body, err := googleapi.WithoutDataWrapper.JSONReader(c.userundelete)
  17608. if err != nil {
  17609. return nil, err
  17610. }
  17611. reqHeaders.Set("Content-Type", "application/json")
  17612. c.urlParams_.Set("alt", alt)
  17613. c.urlParams_.Set("prettyPrint", "false")
  17614. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/undelete")
  17615. urls += "?" + c.urlParams_.Encode()
  17616. req, err := http.NewRequest("POST", urls, body)
  17617. if err != nil {
  17618. return nil, err
  17619. }
  17620. req.Header = reqHeaders
  17621. googleapi.Expand(req.URL, map[string]string{
  17622. "userKey": c.userKey,
  17623. })
  17624. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17625. }
  17626. // Do executes the "directory.users.undelete" call.
  17627. func (c *UsersUndeleteCall) Do(opts ...googleapi.CallOption) error {
  17628. gensupport.SetOptions(c.urlParams_, opts...)
  17629. res, err := c.doRequest("json")
  17630. if err != nil {
  17631. return err
  17632. }
  17633. defer googleapi.CloseBody(res)
  17634. if err := googleapi.CheckResponse(res); err != nil {
  17635. return err
  17636. }
  17637. return nil
  17638. // {
  17639. // "description": "Undelete a deleted user",
  17640. // "httpMethod": "POST",
  17641. // "id": "directory.users.undelete",
  17642. // "parameterOrder": [
  17643. // "userKey"
  17644. // ],
  17645. // "parameters": {
  17646. // "userKey": {
  17647. // "description": "The immutable id of the user",
  17648. // "location": "path",
  17649. // "required": true,
  17650. // "type": "string"
  17651. // }
  17652. // },
  17653. // "path": "users/{userKey}/undelete",
  17654. // "request": {
  17655. // "$ref": "UserUndelete"
  17656. // },
  17657. // "scopes": [
  17658. // "https://www.googleapis.com/auth/admin.directory.user"
  17659. // ]
  17660. // }
  17661. }
  17662. // method id "directory.users.update":
  17663. type UsersUpdateCall struct {
  17664. s *Service
  17665. userKey string
  17666. user *User
  17667. urlParams_ gensupport.URLParams
  17668. ctx_ context.Context
  17669. header_ http.Header
  17670. }
  17671. // Update: update user
  17672. func (r *UsersService) Update(userKey string, user *User) *UsersUpdateCall {
  17673. c := &UsersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17674. c.userKey = userKey
  17675. c.user = user
  17676. return c
  17677. }
  17678. // Fields allows partial responses to be retrieved. See
  17679. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17680. // for more information.
  17681. func (c *UsersUpdateCall) Fields(s ...googleapi.Field) *UsersUpdateCall {
  17682. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17683. return c
  17684. }
  17685. // Context sets the context to be used in this call's Do method. Any
  17686. // pending HTTP request will be aborted if the provided context is
  17687. // canceled.
  17688. func (c *UsersUpdateCall) Context(ctx context.Context) *UsersUpdateCall {
  17689. c.ctx_ = ctx
  17690. return c
  17691. }
  17692. // Header returns an http.Header that can be modified by the caller to
  17693. // add HTTP headers to the request.
  17694. func (c *UsersUpdateCall) Header() http.Header {
  17695. if c.header_ == nil {
  17696. c.header_ = make(http.Header)
  17697. }
  17698. return c.header_
  17699. }
  17700. func (c *UsersUpdateCall) doRequest(alt string) (*http.Response, error) {
  17701. reqHeaders := make(http.Header)
  17702. for k, v := range c.header_ {
  17703. reqHeaders[k] = v
  17704. }
  17705. reqHeaders.Set("User-Agent", c.s.userAgent())
  17706. var body io.Reader = nil
  17707. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  17708. if err != nil {
  17709. return nil, err
  17710. }
  17711. reqHeaders.Set("Content-Type", "application/json")
  17712. c.urlParams_.Set("alt", alt)
  17713. c.urlParams_.Set("prettyPrint", "false")
  17714. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  17715. urls += "?" + c.urlParams_.Encode()
  17716. req, err := http.NewRequest("PUT", urls, body)
  17717. if err != nil {
  17718. return nil, err
  17719. }
  17720. req.Header = reqHeaders
  17721. googleapi.Expand(req.URL, map[string]string{
  17722. "userKey": c.userKey,
  17723. })
  17724. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17725. }
  17726. // Do executes the "directory.users.update" call.
  17727. // Exactly one of *User or error will be non-nil. Any non-2xx status
  17728. // code is an error. Response headers are in either
  17729. // *User.ServerResponse.Header or (if a response was returned at all) in
  17730. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  17731. // whether the returned error was because http.StatusNotModified was
  17732. // returned.
  17733. func (c *UsersUpdateCall) Do(opts ...googleapi.CallOption) (*User, error) {
  17734. gensupport.SetOptions(c.urlParams_, opts...)
  17735. res, err := c.doRequest("json")
  17736. if res != nil && res.StatusCode == http.StatusNotModified {
  17737. if res.Body != nil {
  17738. res.Body.Close()
  17739. }
  17740. return nil, &googleapi.Error{
  17741. Code: res.StatusCode,
  17742. Header: res.Header,
  17743. }
  17744. }
  17745. if err != nil {
  17746. return nil, err
  17747. }
  17748. defer googleapi.CloseBody(res)
  17749. if err := googleapi.CheckResponse(res); err != nil {
  17750. return nil, err
  17751. }
  17752. ret := &User{
  17753. ServerResponse: googleapi.ServerResponse{
  17754. Header: res.Header,
  17755. HTTPStatusCode: res.StatusCode,
  17756. },
  17757. }
  17758. target := &ret
  17759. if err := gensupport.DecodeResponse(target, res); err != nil {
  17760. return nil, err
  17761. }
  17762. return ret, nil
  17763. // {
  17764. // "description": "update user",
  17765. // "httpMethod": "PUT",
  17766. // "id": "directory.users.update",
  17767. // "parameterOrder": [
  17768. // "userKey"
  17769. // ],
  17770. // "parameters": {
  17771. // "userKey": {
  17772. // "description": "Email or immutable ID of the user. If ID, it should match with id of user object",
  17773. // "location": "path",
  17774. // "required": true,
  17775. // "type": "string"
  17776. // }
  17777. // },
  17778. // "path": "users/{userKey}",
  17779. // "request": {
  17780. // "$ref": "User"
  17781. // },
  17782. // "response": {
  17783. // "$ref": "User"
  17784. // },
  17785. // "scopes": [
  17786. // "https://www.googleapis.com/auth/admin.directory.user"
  17787. // ]
  17788. // }
  17789. }
  17790. // method id "directory.users.watch":
  17791. type UsersWatchCall struct {
  17792. s *Service
  17793. channel *Channel
  17794. urlParams_ gensupport.URLParams
  17795. ctx_ context.Context
  17796. header_ http.Header
  17797. }
  17798. // Watch: Watch for changes in users list
  17799. func (r *UsersService) Watch(channel *Channel) *UsersWatchCall {
  17800. c := &UsersWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17801. c.channel = channel
  17802. return c
  17803. }
  17804. // CustomFieldMask sets the optional parameter "customFieldMask":
  17805. // Comma-separated list of schema names. All fields from these schemas
  17806. // are fetched. This should only be set when projection=custom.
  17807. func (c *UsersWatchCall) CustomFieldMask(customFieldMask string) *UsersWatchCall {
  17808. c.urlParams_.Set("customFieldMask", customFieldMask)
  17809. return c
  17810. }
  17811. // Customer sets the optional parameter "customer": Immutable ID of the
  17812. // G Suite account. In case of multi-domain, to fetch all users for a
  17813. // customer, fill this field instead of domain.
  17814. func (c *UsersWatchCall) Customer(customer string) *UsersWatchCall {
  17815. c.urlParams_.Set("customer", customer)
  17816. return c
  17817. }
  17818. // Domain sets the optional parameter "domain": Name of the domain. Fill
  17819. // this field to get users from only this domain. To return all users in
  17820. // a multi-domain fill customer field instead.
  17821. func (c *UsersWatchCall) Domain(domain string) *UsersWatchCall {
  17822. c.urlParams_.Set("domain", domain)
  17823. return c
  17824. }
  17825. // Event sets the optional parameter "event": Event on which
  17826. // subscription is intended (if subscribing)
  17827. //
  17828. // Possible values:
  17829. // "add" - User Created Event
  17830. // "delete" - User Deleted Event
  17831. // "makeAdmin" - User Admin Status Change Event
  17832. // "undelete" - User Undeleted Event
  17833. // "update" - User Updated Event
  17834. func (c *UsersWatchCall) Event(event string) *UsersWatchCall {
  17835. c.urlParams_.Set("event", event)
  17836. return c
  17837. }
  17838. // MaxResults sets the optional parameter "maxResults": Maximum number
  17839. // of results to return. Default is 100. Max allowed is 500
  17840. func (c *UsersWatchCall) MaxResults(maxResults int64) *UsersWatchCall {
  17841. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  17842. return c
  17843. }
  17844. // OrderBy sets the optional parameter "orderBy": Column to use for
  17845. // sorting results
  17846. //
  17847. // Possible values:
  17848. // "email" - Primary email of the user.
  17849. // "familyName" - User's family name.
  17850. // "givenName" - User's given name.
  17851. func (c *UsersWatchCall) OrderBy(orderBy string) *UsersWatchCall {
  17852. c.urlParams_.Set("orderBy", orderBy)
  17853. return c
  17854. }
  17855. // PageToken sets the optional parameter "pageToken": Token to specify
  17856. // next page in the list
  17857. func (c *UsersWatchCall) PageToken(pageToken string) *UsersWatchCall {
  17858. c.urlParams_.Set("pageToken", pageToken)
  17859. return c
  17860. }
  17861. // Projection sets the optional parameter "projection": What subset of
  17862. // fields to fetch for this user.
  17863. //
  17864. // Possible values:
  17865. // "basic" (default) - Do not include any custom fields for the user.
  17866. // "custom" - Include custom fields from schemas mentioned in
  17867. // customFieldMask.
  17868. // "full" - Include all fields associated with this user.
  17869. func (c *UsersWatchCall) Projection(projection string) *UsersWatchCall {
  17870. c.urlParams_.Set("projection", projection)
  17871. return c
  17872. }
  17873. // Query sets the optional parameter "query": Query string search.
  17874. // Should be of the form "". Complete documentation is at
  17875. // https://developers.google.com/admin-sdk/directory/v1/guides/search-users
  17876. func (c *UsersWatchCall) Query(query string) *UsersWatchCall {
  17877. c.urlParams_.Set("query", query)
  17878. return c
  17879. }
  17880. // ShowDeleted sets the optional parameter "showDeleted": If set to true
  17881. // retrieves the list of deleted users. Default is false
  17882. func (c *UsersWatchCall) ShowDeleted(showDeleted string) *UsersWatchCall {
  17883. c.urlParams_.Set("showDeleted", showDeleted)
  17884. return c
  17885. }
  17886. // SortOrder sets the optional parameter "sortOrder": Whether to return
  17887. // results in ascending or descending order.
  17888. //
  17889. // Possible values:
  17890. // "ASCENDING" - Ascending order.
  17891. // "DESCENDING" - Descending order.
  17892. func (c *UsersWatchCall) SortOrder(sortOrder string) *UsersWatchCall {
  17893. c.urlParams_.Set("sortOrder", sortOrder)
  17894. return c
  17895. }
  17896. // ViewType sets the optional parameter "viewType": Whether to fetch the
  17897. // ADMIN_VIEW or DOMAIN_PUBLIC view of the user.
  17898. //
  17899. // Possible values:
  17900. // "admin_view" (default) - Fetches the ADMIN_VIEW of the user.
  17901. // "domain_public" - Fetches the DOMAIN_PUBLIC view of the user.
  17902. func (c *UsersWatchCall) ViewType(viewType string) *UsersWatchCall {
  17903. c.urlParams_.Set("viewType", viewType)
  17904. return c
  17905. }
  17906. // Fields allows partial responses to be retrieved. See
  17907. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17908. // for more information.
  17909. func (c *UsersWatchCall) Fields(s ...googleapi.Field) *UsersWatchCall {
  17910. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17911. return c
  17912. }
  17913. // Context sets the context to be used in this call's Do method. Any
  17914. // pending HTTP request will be aborted if the provided context is
  17915. // canceled.
  17916. func (c *UsersWatchCall) Context(ctx context.Context) *UsersWatchCall {
  17917. c.ctx_ = ctx
  17918. return c
  17919. }
  17920. // Header returns an http.Header that can be modified by the caller to
  17921. // add HTTP headers to the request.
  17922. func (c *UsersWatchCall) Header() http.Header {
  17923. if c.header_ == nil {
  17924. c.header_ = make(http.Header)
  17925. }
  17926. return c.header_
  17927. }
  17928. func (c *UsersWatchCall) doRequest(alt string) (*http.Response, error) {
  17929. reqHeaders := make(http.Header)
  17930. for k, v := range c.header_ {
  17931. reqHeaders[k] = v
  17932. }
  17933. reqHeaders.Set("User-Agent", c.s.userAgent())
  17934. var body io.Reader = nil
  17935. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  17936. if err != nil {
  17937. return nil, err
  17938. }
  17939. reqHeaders.Set("Content-Type", "application/json")
  17940. c.urlParams_.Set("alt", alt)
  17941. c.urlParams_.Set("prettyPrint", "false")
  17942. urls := googleapi.ResolveRelative(c.s.BasePath, "users/watch")
  17943. urls += "?" + c.urlParams_.Encode()
  17944. req, err := http.NewRequest("POST", urls, body)
  17945. if err != nil {
  17946. return nil, err
  17947. }
  17948. req.Header = reqHeaders
  17949. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17950. }
  17951. // Do executes the "directory.users.watch" call.
  17952. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  17953. // code is an error. Response headers are in either
  17954. // *Channel.ServerResponse.Header or (if a response was returned at all)
  17955. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  17956. // check whether the returned error was because http.StatusNotModified
  17957. // was returned.
  17958. func (c *UsersWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  17959. gensupport.SetOptions(c.urlParams_, opts...)
  17960. res, err := c.doRequest("json")
  17961. if res != nil && res.StatusCode == http.StatusNotModified {
  17962. if res.Body != nil {
  17963. res.Body.Close()
  17964. }
  17965. return nil, &googleapi.Error{
  17966. Code: res.StatusCode,
  17967. Header: res.Header,
  17968. }
  17969. }
  17970. if err != nil {
  17971. return nil, err
  17972. }
  17973. defer googleapi.CloseBody(res)
  17974. if err := googleapi.CheckResponse(res); err != nil {
  17975. return nil, err
  17976. }
  17977. ret := &Channel{
  17978. ServerResponse: googleapi.ServerResponse{
  17979. Header: res.Header,
  17980. HTTPStatusCode: res.StatusCode,
  17981. },
  17982. }
  17983. target := &ret
  17984. if err := gensupport.DecodeResponse(target, res); err != nil {
  17985. return nil, err
  17986. }
  17987. return ret, nil
  17988. // {
  17989. // "description": "Watch for changes in users list",
  17990. // "httpMethod": "POST",
  17991. // "id": "directory.users.watch",
  17992. // "parameters": {
  17993. // "customFieldMask": {
  17994. // "description": "Comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.",
  17995. // "location": "query",
  17996. // "type": "string"
  17997. // },
  17998. // "customer": {
  17999. // "description": "Immutable ID of the G Suite account. In case of multi-domain, to fetch all users for a customer, fill this field instead of domain.",
  18000. // "location": "query",
  18001. // "type": "string"
  18002. // },
  18003. // "domain": {
  18004. // "description": "Name of the domain. Fill this field to get users from only this domain. To return all users in a multi-domain fill customer field instead.",
  18005. // "location": "query",
  18006. // "type": "string"
  18007. // },
  18008. // "event": {
  18009. // "description": "Event on which subscription is intended (if subscribing)",
  18010. // "enum": [
  18011. // "add",
  18012. // "delete",
  18013. // "makeAdmin",
  18014. // "undelete",
  18015. // "update"
  18016. // ],
  18017. // "enumDescriptions": [
  18018. // "User Created Event",
  18019. // "User Deleted Event",
  18020. // "User Admin Status Change Event",
  18021. // "User Undeleted Event",
  18022. // "User Updated Event"
  18023. // ],
  18024. // "location": "query",
  18025. // "type": "string"
  18026. // },
  18027. // "maxResults": {
  18028. // "description": "Maximum number of results to return. Default is 100. Max allowed is 500",
  18029. // "format": "int32",
  18030. // "location": "query",
  18031. // "maximum": "500",
  18032. // "minimum": "1",
  18033. // "type": "integer"
  18034. // },
  18035. // "orderBy": {
  18036. // "description": "Column to use for sorting results",
  18037. // "enum": [
  18038. // "email",
  18039. // "familyName",
  18040. // "givenName"
  18041. // ],
  18042. // "enumDescriptions": [
  18043. // "Primary email of the user.",
  18044. // "User's family name.",
  18045. // "User's given name."
  18046. // ],
  18047. // "location": "query",
  18048. // "type": "string"
  18049. // },
  18050. // "pageToken": {
  18051. // "description": "Token to specify next page in the list",
  18052. // "location": "query",
  18053. // "type": "string"
  18054. // },
  18055. // "projection": {
  18056. // "default": "basic",
  18057. // "description": "What subset of fields to fetch for this user.",
  18058. // "enum": [
  18059. // "basic",
  18060. // "custom",
  18061. // "full"
  18062. // ],
  18063. // "enumDescriptions": [
  18064. // "Do not include any custom fields for the user.",
  18065. // "Include custom fields from schemas mentioned in customFieldMask.",
  18066. // "Include all fields associated with this user."
  18067. // ],
  18068. // "location": "query",
  18069. // "type": "string"
  18070. // },
  18071. // "query": {
  18072. // "description": "Query string search. Should be of the form \"\". Complete documentation is at https://developers.google.com/admin-sdk/directory/v1/guides/search-users",
  18073. // "location": "query",
  18074. // "type": "string"
  18075. // },
  18076. // "showDeleted": {
  18077. // "description": "If set to true retrieves the list of deleted users. Default is false",
  18078. // "location": "query",
  18079. // "type": "string"
  18080. // },
  18081. // "sortOrder": {
  18082. // "description": "Whether to return results in ascending or descending order.",
  18083. // "enum": [
  18084. // "ASCENDING",
  18085. // "DESCENDING"
  18086. // ],
  18087. // "enumDescriptions": [
  18088. // "Ascending order.",
  18089. // "Descending order."
  18090. // ],
  18091. // "location": "query",
  18092. // "type": "string"
  18093. // },
  18094. // "viewType": {
  18095. // "default": "admin_view",
  18096. // "description": "Whether to fetch the ADMIN_VIEW or DOMAIN_PUBLIC view of the user.",
  18097. // "enum": [
  18098. // "admin_view",
  18099. // "domain_public"
  18100. // ],
  18101. // "enumDescriptions": [
  18102. // "Fetches the ADMIN_VIEW of the user.",
  18103. // "Fetches the DOMAIN_PUBLIC view of the user."
  18104. // ],
  18105. // "location": "query",
  18106. // "type": "string"
  18107. // }
  18108. // },
  18109. // "path": "users/watch",
  18110. // "request": {
  18111. // "$ref": "Channel",
  18112. // "parameterName": "resource"
  18113. // },
  18114. // "response": {
  18115. // "$ref": "Channel"
  18116. // },
  18117. // "scopes": [
  18118. // "https://www.googleapis.com/auth/admin.directory.user",
  18119. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  18120. // ],
  18121. // "supportsSubscription": true
  18122. // }
  18123. }
  18124. // method id "directory.users.aliases.delete":
  18125. type UsersAliasesDeleteCall struct {
  18126. s *Service
  18127. userKey string
  18128. alias string
  18129. urlParams_ gensupport.URLParams
  18130. ctx_ context.Context
  18131. header_ http.Header
  18132. }
  18133. // Delete: Remove a alias for the user
  18134. func (r *UsersAliasesService) Delete(userKey string, alias string) *UsersAliasesDeleteCall {
  18135. c := &UsersAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18136. c.userKey = userKey
  18137. c.alias = alias
  18138. return c
  18139. }
  18140. // Fields allows partial responses to be retrieved. See
  18141. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18142. // for more information.
  18143. func (c *UsersAliasesDeleteCall) Fields(s ...googleapi.Field) *UsersAliasesDeleteCall {
  18144. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18145. return c
  18146. }
  18147. // Context sets the context to be used in this call's Do method. Any
  18148. // pending HTTP request will be aborted if the provided context is
  18149. // canceled.
  18150. func (c *UsersAliasesDeleteCall) Context(ctx context.Context) *UsersAliasesDeleteCall {
  18151. c.ctx_ = ctx
  18152. return c
  18153. }
  18154. // Header returns an http.Header that can be modified by the caller to
  18155. // add HTTP headers to the request.
  18156. func (c *UsersAliasesDeleteCall) Header() http.Header {
  18157. if c.header_ == nil {
  18158. c.header_ = make(http.Header)
  18159. }
  18160. return c.header_
  18161. }
  18162. func (c *UsersAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  18163. reqHeaders := make(http.Header)
  18164. for k, v := range c.header_ {
  18165. reqHeaders[k] = v
  18166. }
  18167. reqHeaders.Set("User-Agent", c.s.userAgent())
  18168. var body io.Reader = nil
  18169. c.urlParams_.Set("alt", alt)
  18170. c.urlParams_.Set("prettyPrint", "false")
  18171. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases/{alias}")
  18172. urls += "?" + c.urlParams_.Encode()
  18173. req, err := http.NewRequest("DELETE", urls, body)
  18174. if err != nil {
  18175. return nil, err
  18176. }
  18177. req.Header = reqHeaders
  18178. googleapi.Expand(req.URL, map[string]string{
  18179. "userKey": c.userKey,
  18180. "alias": c.alias,
  18181. })
  18182. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18183. }
  18184. // Do executes the "directory.users.aliases.delete" call.
  18185. func (c *UsersAliasesDeleteCall) Do(opts ...googleapi.CallOption) error {
  18186. gensupport.SetOptions(c.urlParams_, opts...)
  18187. res, err := c.doRequest("json")
  18188. if err != nil {
  18189. return err
  18190. }
  18191. defer googleapi.CloseBody(res)
  18192. if err := googleapi.CheckResponse(res); err != nil {
  18193. return err
  18194. }
  18195. return nil
  18196. // {
  18197. // "description": "Remove a alias for the user",
  18198. // "httpMethod": "DELETE",
  18199. // "id": "directory.users.aliases.delete",
  18200. // "parameterOrder": [
  18201. // "userKey",
  18202. // "alias"
  18203. // ],
  18204. // "parameters": {
  18205. // "alias": {
  18206. // "description": "The alias to be removed",
  18207. // "location": "path",
  18208. // "required": true,
  18209. // "type": "string"
  18210. // },
  18211. // "userKey": {
  18212. // "description": "Email or immutable ID of the user",
  18213. // "location": "path",
  18214. // "required": true,
  18215. // "type": "string"
  18216. // }
  18217. // },
  18218. // "path": "users/{userKey}/aliases/{alias}",
  18219. // "scopes": [
  18220. // "https://www.googleapis.com/auth/admin.directory.user",
  18221. // "https://www.googleapis.com/auth/admin.directory.user.alias"
  18222. // ]
  18223. // }
  18224. }
  18225. // method id "directory.users.aliases.insert":
  18226. type UsersAliasesInsertCall struct {
  18227. s *Service
  18228. userKey string
  18229. alias *Alias
  18230. urlParams_ gensupport.URLParams
  18231. ctx_ context.Context
  18232. header_ http.Header
  18233. }
  18234. // Insert: Add a alias for the user
  18235. func (r *UsersAliasesService) Insert(userKey string, alias *Alias) *UsersAliasesInsertCall {
  18236. c := &UsersAliasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18237. c.userKey = userKey
  18238. c.alias = alias
  18239. return c
  18240. }
  18241. // Fields allows partial responses to be retrieved. See
  18242. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18243. // for more information.
  18244. func (c *UsersAliasesInsertCall) Fields(s ...googleapi.Field) *UsersAliasesInsertCall {
  18245. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18246. return c
  18247. }
  18248. // Context sets the context to be used in this call's Do method. Any
  18249. // pending HTTP request will be aborted if the provided context is
  18250. // canceled.
  18251. func (c *UsersAliasesInsertCall) Context(ctx context.Context) *UsersAliasesInsertCall {
  18252. c.ctx_ = ctx
  18253. return c
  18254. }
  18255. // Header returns an http.Header that can be modified by the caller to
  18256. // add HTTP headers to the request.
  18257. func (c *UsersAliasesInsertCall) Header() http.Header {
  18258. if c.header_ == nil {
  18259. c.header_ = make(http.Header)
  18260. }
  18261. return c.header_
  18262. }
  18263. func (c *UsersAliasesInsertCall) doRequest(alt string) (*http.Response, error) {
  18264. reqHeaders := make(http.Header)
  18265. for k, v := range c.header_ {
  18266. reqHeaders[k] = v
  18267. }
  18268. reqHeaders.Set("User-Agent", c.s.userAgent())
  18269. var body io.Reader = nil
  18270. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alias)
  18271. if err != nil {
  18272. return nil, err
  18273. }
  18274. reqHeaders.Set("Content-Type", "application/json")
  18275. c.urlParams_.Set("alt", alt)
  18276. c.urlParams_.Set("prettyPrint", "false")
  18277. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases")
  18278. urls += "?" + c.urlParams_.Encode()
  18279. req, err := http.NewRequest("POST", urls, body)
  18280. if err != nil {
  18281. return nil, err
  18282. }
  18283. req.Header = reqHeaders
  18284. googleapi.Expand(req.URL, map[string]string{
  18285. "userKey": c.userKey,
  18286. })
  18287. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18288. }
  18289. // Do executes the "directory.users.aliases.insert" call.
  18290. // Exactly one of *Alias or error will be non-nil. Any non-2xx status
  18291. // code is an error. Response headers are in either
  18292. // *Alias.ServerResponse.Header or (if a response was returned at all)
  18293. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  18294. // check whether the returned error was because http.StatusNotModified
  18295. // was returned.
  18296. func (c *UsersAliasesInsertCall) Do(opts ...googleapi.CallOption) (*Alias, error) {
  18297. gensupport.SetOptions(c.urlParams_, opts...)
  18298. res, err := c.doRequest("json")
  18299. if res != nil && res.StatusCode == http.StatusNotModified {
  18300. if res.Body != nil {
  18301. res.Body.Close()
  18302. }
  18303. return nil, &googleapi.Error{
  18304. Code: res.StatusCode,
  18305. Header: res.Header,
  18306. }
  18307. }
  18308. if err != nil {
  18309. return nil, err
  18310. }
  18311. defer googleapi.CloseBody(res)
  18312. if err := googleapi.CheckResponse(res); err != nil {
  18313. return nil, err
  18314. }
  18315. ret := &Alias{
  18316. ServerResponse: googleapi.ServerResponse{
  18317. Header: res.Header,
  18318. HTTPStatusCode: res.StatusCode,
  18319. },
  18320. }
  18321. target := &ret
  18322. if err := gensupport.DecodeResponse(target, res); err != nil {
  18323. return nil, err
  18324. }
  18325. return ret, nil
  18326. // {
  18327. // "description": "Add a alias for the user",
  18328. // "httpMethod": "POST",
  18329. // "id": "directory.users.aliases.insert",
  18330. // "parameterOrder": [
  18331. // "userKey"
  18332. // ],
  18333. // "parameters": {
  18334. // "userKey": {
  18335. // "description": "Email or immutable ID of the user",
  18336. // "location": "path",
  18337. // "required": true,
  18338. // "type": "string"
  18339. // }
  18340. // },
  18341. // "path": "users/{userKey}/aliases",
  18342. // "request": {
  18343. // "$ref": "Alias"
  18344. // },
  18345. // "response": {
  18346. // "$ref": "Alias"
  18347. // },
  18348. // "scopes": [
  18349. // "https://www.googleapis.com/auth/admin.directory.user",
  18350. // "https://www.googleapis.com/auth/admin.directory.user.alias"
  18351. // ]
  18352. // }
  18353. }
  18354. // method id "directory.users.aliases.list":
  18355. type UsersAliasesListCall struct {
  18356. s *Service
  18357. userKey string
  18358. urlParams_ gensupport.URLParams
  18359. ifNoneMatch_ string
  18360. ctx_ context.Context
  18361. header_ http.Header
  18362. }
  18363. // List: List all aliases for a user
  18364. func (r *UsersAliasesService) List(userKey string) *UsersAliasesListCall {
  18365. c := &UsersAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18366. c.userKey = userKey
  18367. return c
  18368. }
  18369. // Event sets the optional parameter "event": Event on which
  18370. // subscription is intended (if subscribing)
  18371. //
  18372. // Possible values:
  18373. // "add" - Alias Created Event
  18374. // "delete" - Alias Deleted Event
  18375. func (c *UsersAliasesListCall) Event(event string) *UsersAliasesListCall {
  18376. c.urlParams_.Set("event", event)
  18377. return c
  18378. }
  18379. // Fields allows partial responses to be retrieved. See
  18380. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18381. // for more information.
  18382. func (c *UsersAliasesListCall) Fields(s ...googleapi.Field) *UsersAliasesListCall {
  18383. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18384. return c
  18385. }
  18386. // IfNoneMatch sets the optional parameter which makes the operation
  18387. // fail if the object's ETag matches the given value. This is useful for
  18388. // getting updates only after the object has changed since the last
  18389. // request. Use googleapi.IsNotModified to check whether the response
  18390. // error from Do is the result of In-None-Match.
  18391. func (c *UsersAliasesListCall) IfNoneMatch(entityTag string) *UsersAliasesListCall {
  18392. c.ifNoneMatch_ = entityTag
  18393. return c
  18394. }
  18395. // Context sets the context to be used in this call's Do method. Any
  18396. // pending HTTP request will be aborted if the provided context is
  18397. // canceled.
  18398. func (c *UsersAliasesListCall) Context(ctx context.Context) *UsersAliasesListCall {
  18399. c.ctx_ = ctx
  18400. return c
  18401. }
  18402. // Header returns an http.Header that can be modified by the caller to
  18403. // add HTTP headers to the request.
  18404. func (c *UsersAliasesListCall) Header() http.Header {
  18405. if c.header_ == nil {
  18406. c.header_ = make(http.Header)
  18407. }
  18408. return c.header_
  18409. }
  18410. func (c *UsersAliasesListCall) doRequest(alt string) (*http.Response, error) {
  18411. reqHeaders := make(http.Header)
  18412. for k, v := range c.header_ {
  18413. reqHeaders[k] = v
  18414. }
  18415. reqHeaders.Set("User-Agent", c.s.userAgent())
  18416. if c.ifNoneMatch_ != "" {
  18417. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  18418. }
  18419. var body io.Reader = nil
  18420. c.urlParams_.Set("alt", alt)
  18421. c.urlParams_.Set("prettyPrint", "false")
  18422. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases")
  18423. urls += "?" + c.urlParams_.Encode()
  18424. req, err := http.NewRequest("GET", urls, body)
  18425. if err != nil {
  18426. return nil, err
  18427. }
  18428. req.Header = reqHeaders
  18429. googleapi.Expand(req.URL, map[string]string{
  18430. "userKey": c.userKey,
  18431. })
  18432. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18433. }
  18434. // Do executes the "directory.users.aliases.list" call.
  18435. // Exactly one of *Aliases or error will be non-nil. Any non-2xx status
  18436. // code is an error. Response headers are in either
  18437. // *Aliases.ServerResponse.Header or (if a response was returned at all)
  18438. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  18439. // check whether the returned error was because http.StatusNotModified
  18440. // was returned.
  18441. func (c *UsersAliasesListCall) Do(opts ...googleapi.CallOption) (*Aliases, error) {
  18442. gensupport.SetOptions(c.urlParams_, opts...)
  18443. res, err := c.doRequest("json")
  18444. if res != nil && res.StatusCode == http.StatusNotModified {
  18445. if res.Body != nil {
  18446. res.Body.Close()
  18447. }
  18448. return nil, &googleapi.Error{
  18449. Code: res.StatusCode,
  18450. Header: res.Header,
  18451. }
  18452. }
  18453. if err != nil {
  18454. return nil, err
  18455. }
  18456. defer googleapi.CloseBody(res)
  18457. if err := googleapi.CheckResponse(res); err != nil {
  18458. return nil, err
  18459. }
  18460. ret := &Aliases{
  18461. ServerResponse: googleapi.ServerResponse{
  18462. Header: res.Header,
  18463. HTTPStatusCode: res.StatusCode,
  18464. },
  18465. }
  18466. target := &ret
  18467. if err := gensupport.DecodeResponse(target, res); err != nil {
  18468. return nil, err
  18469. }
  18470. return ret, nil
  18471. // {
  18472. // "description": "List all aliases for a user",
  18473. // "httpMethod": "GET",
  18474. // "id": "directory.users.aliases.list",
  18475. // "parameterOrder": [
  18476. // "userKey"
  18477. // ],
  18478. // "parameters": {
  18479. // "event": {
  18480. // "description": "Event on which subscription is intended (if subscribing)",
  18481. // "enum": [
  18482. // "add",
  18483. // "delete"
  18484. // ],
  18485. // "enumDescriptions": [
  18486. // "Alias Created Event",
  18487. // "Alias Deleted Event"
  18488. // ],
  18489. // "location": "query",
  18490. // "type": "string"
  18491. // },
  18492. // "userKey": {
  18493. // "description": "Email or immutable ID of the user",
  18494. // "location": "path",
  18495. // "required": true,
  18496. // "type": "string"
  18497. // }
  18498. // },
  18499. // "path": "users/{userKey}/aliases",
  18500. // "response": {
  18501. // "$ref": "Aliases"
  18502. // },
  18503. // "scopes": [
  18504. // "https://www.googleapis.com/auth/admin.directory.user",
  18505. // "https://www.googleapis.com/auth/admin.directory.user.alias",
  18506. // "https://www.googleapis.com/auth/admin.directory.user.alias.readonly",
  18507. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  18508. // ],
  18509. // "supportsSubscription": true
  18510. // }
  18511. }
  18512. // method id "directory.users.aliases.watch":
  18513. type UsersAliasesWatchCall struct {
  18514. s *Service
  18515. userKey string
  18516. channel *Channel
  18517. urlParams_ gensupport.URLParams
  18518. ctx_ context.Context
  18519. header_ http.Header
  18520. }
  18521. // Watch: Watch for changes in user aliases list
  18522. func (r *UsersAliasesService) Watch(userKey string, channel *Channel) *UsersAliasesWatchCall {
  18523. c := &UsersAliasesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18524. c.userKey = userKey
  18525. c.channel = channel
  18526. return c
  18527. }
  18528. // Event sets the optional parameter "event": Event on which
  18529. // subscription is intended (if subscribing)
  18530. //
  18531. // Possible values:
  18532. // "add" - Alias Created Event
  18533. // "delete" - Alias Deleted Event
  18534. func (c *UsersAliasesWatchCall) Event(event string) *UsersAliasesWatchCall {
  18535. c.urlParams_.Set("event", event)
  18536. return c
  18537. }
  18538. // Fields allows partial responses to be retrieved. See
  18539. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18540. // for more information.
  18541. func (c *UsersAliasesWatchCall) Fields(s ...googleapi.Field) *UsersAliasesWatchCall {
  18542. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18543. return c
  18544. }
  18545. // Context sets the context to be used in this call's Do method. Any
  18546. // pending HTTP request will be aborted if the provided context is
  18547. // canceled.
  18548. func (c *UsersAliasesWatchCall) Context(ctx context.Context) *UsersAliasesWatchCall {
  18549. c.ctx_ = ctx
  18550. return c
  18551. }
  18552. // Header returns an http.Header that can be modified by the caller to
  18553. // add HTTP headers to the request.
  18554. func (c *UsersAliasesWatchCall) Header() http.Header {
  18555. if c.header_ == nil {
  18556. c.header_ = make(http.Header)
  18557. }
  18558. return c.header_
  18559. }
  18560. func (c *UsersAliasesWatchCall) doRequest(alt string) (*http.Response, error) {
  18561. reqHeaders := make(http.Header)
  18562. for k, v := range c.header_ {
  18563. reqHeaders[k] = v
  18564. }
  18565. reqHeaders.Set("User-Agent", c.s.userAgent())
  18566. var body io.Reader = nil
  18567. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  18568. if err != nil {
  18569. return nil, err
  18570. }
  18571. reqHeaders.Set("Content-Type", "application/json")
  18572. c.urlParams_.Set("alt", alt)
  18573. c.urlParams_.Set("prettyPrint", "false")
  18574. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases/watch")
  18575. urls += "?" + c.urlParams_.Encode()
  18576. req, err := http.NewRequest("POST", urls, body)
  18577. if err != nil {
  18578. return nil, err
  18579. }
  18580. req.Header = reqHeaders
  18581. googleapi.Expand(req.URL, map[string]string{
  18582. "userKey": c.userKey,
  18583. })
  18584. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18585. }
  18586. // Do executes the "directory.users.aliases.watch" call.
  18587. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  18588. // code is an error. Response headers are in either
  18589. // *Channel.ServerResponse.Header or (if a response was returned at all)
  18590. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  18591. // check whether the returned error was because http.StatusNotModified
  18592. // was returned.
  18593. func (c *UsersAliasesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  18594. gensupport.SetOptions(c.urlParams_, opts...)
  18595. res, err := c.doRequest("json")
  18596. if res != nil && res.StatusCode == http.StatusNotModified {
  18597. if res.Body != nil {
  18598. res.Body.Close()
  18599. }
  18600. return nil, &googleapi.Error{
  18601. Code: res.StatusCode,
  18602. Header: res.Header,
  18603. }
  18604. }
  18605. if err != nil {
  18606. return nil, err
  18607. }
  18608. defer googleapi.CloseBody(res)
  18609. if err := googleapi.CheckResponse(res); err != nil {
  18610. return nil, err
  18611. }
  18612. ret := &Channel{
  18613. ServerResponse: googleapi.ServerResponse{
  18614. Header: res.Header,
  18615. HTTPStatusCode: res.StatusCode,
  18616. },
  18617. }
  18618. target := &ret
  18619. if err := gensupport.DecodeResponse(target, res); err != nil {
  18620. return nil, err
  18621. }
  18622. return ret, nil
  18623. // {
  18624. // "description": "Watch for changes in user aliases list",
  18625. // "httpMethod": "POST",
  18626. // "id": "directory.users.aliases.watch",
  18627. // "parameterOrder": [
  18628. // "userKey"
  18629. // ],
  18630. // "parameters": {
  18631. // "event": {
  18632. // "description": "Event on which subscription is intended (if subscribing)",
  18633. // "enum": [
  18634. // "add",
  18635. // "delete"
  18636. // ],
  18637. // "enumDescriptions": [
  18638. // "Alias Created Event",
  18639. // "Alias Deleted Event"
  18640. // ],
  18641. // "location": "query",
  18642. // "type": "string"
  18643. // },
  18644. // "userKey": {
  18645. // "description": "Email or immutable ID of the user",
  18646. // "location": "path",
  18647. // "required": true,
  18648. // "type": "string"
  18649. // }
  18650. // },
  18651. // "path": "users/{userKey}/aliases/watch",
  18652. // "request": {
  18653. // "$ref": "Channel",
  18654. // "parameterName": "resource"
  18655. // },
  18656. // "response": {
  18657. // "$ref": "Channel"
  18658. // },
  18659. // "scopes": [
  18660. // "https://www.googleapis.com/auth/admin.directory.user",
  18661. // "https://www.googleapis.com/auth/admin.directory.user.alias",
  18662. // "https://www.googleapis.com/auth/admin.directory.user.alias.readonly",
  18663. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  18664. // ],
  18665. // "supportsSubscription": true
  18666. // }
  18667. }
  18668. // method id "directory.users.photos.delete":
  18669. type UsersPhotosDeleteCall struct {
  18670. s *Service
  18671. userKey string
  18672. urlParams_ gensupport.URLParams
  18673. ctx_ context.Context
  18674. header_ http.Header
  18675. }
  18676. // Delete: Remove photos for the user
  18677. func (r *UsersPhotosService) Delete(userKey string) *UsersPhotosDeleteCall {
  18678. c := &UsersPhotosDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18679. c.userKey = userKey
  18680. return c
  18681. }
  18682. // Fields allows partial responses to be retrieved. See
  18683. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18684. // for more information.
  18685. func (c *UsersPhotosDeleteCall) Fields(s ...googleapi.Field) *UsersPhotosDeleteCall {
  18686. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18687. return c
  18688. }
  18689. // Context sets the context to be used in this call's Do method. Any
  18690. // pending HTTP request will be aborted if the provided context is
  18691. // canceled.
  18692. func (c *UsersPhotosDeleteCall) Context(ctx context.Context) *UsersPhotosDeleteCall {
  18693. c.ctx_ = ctx
  18694. return c
  18695. }
  18696. // Header returns an http.Header that can be modified by the caller to
  18697. // add HTTP headers to the request.
  18698. func (c *UsersPhotosDeleteCall) Header() http.Header {
  18699. if c.header_ == nil {
  18700. c.header_ = make(http.Header)
  18701. }
  18702. return c.header_
  18703. }
  18704. func (c *UsersPhotosDeleteCall) doRequest(alt string) (*http.Response, error) {
  18705. reqHeaders := make(http.Header)
  18706. for k, v := range c.header_ {
  18707. reqHeaders[k] = v
  18708. }
  18709. reqHeaders.Set("User-Agent", c.s.userAgent())
  18710. var body io.Reader = nil
  18711. c.urlParams_.Set("alt", alt)
  18712. c.urlParams_.Set("prettyPrint", "false")
  18713. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  18714. urls += "?" + c.urlParams_.Encode()
  18715. req, err := http.NewRequest("DELETE", urls, body)
  18716. if err != nil {
  18717. return nil, err
  18718. }
  18719. req.Header = reqHeaders
  18720. googleapi.Expand(req.URL, map[string]string{
  18721. "userKey": c.userKey,
  18722. })
  18723. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18724. }
  18725. // Do executes the "directory.users.photos.delete" call.
  18726. func (c *UsersPhotosDeleteCall) Do(opts ...googleapi.CallOption) error {
  18727. gensupport.SetOptions(c.urlParams_, opts...)
  18728. res, err := c.doRequest("json")
  18729. if err != nil {
  18730. return err
  18731. }
  18732. defer googleapi.CloseBody(res)
  18733. if err := googleapi.CheckResponse(res); err != nil {
  18734. return err
  18735. }
  18736. return nil
  18737. // {
  18738. // "description": "Remove photos for the user",
  18739. // "httpMethod": "DELETE",
  18740. // "id": "directory.users.photos.delete",
  18741. // "parameterOrder": [
  18742. // "userKey"
  18743. // ],
  18744. // "parameters": {
  18745. // "userKey": {
  18746. // "description": "Email or immutable ID of the user",
  18747. // "location": "path",
  18748. // "required": true,
  18749. // "type": "string"
  18750. // }
  18751. // },
  18752. // "path": "users/{userKey}/photos/thumbnail",
  18753. // "scopes": [
  18754. // "https://www.googleapis.com/auth/admin.directory.user"
  18755. // ]
  18756. // }
  18757. }
  18758. // method id "directory.users.photos.get":
  18759. type UsersPhotosGetCall struct {
  18760. s *Service
  18761. userKey string
  18762. urlParams_ gensupport.URLParams
  18763. ifNoneMatch_ string
  18764. ctx_ context.Context
  18765. header_ http.Header
  18766. }
  18767. // Get: Retrieve photo of a user
  18768. func (r *UsersPhotosService) Get(userKey string) *UsersPhotosGetCall {
  18769. c := &UsersPhotosGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18770. c.userKey = userKey
  18771. return c
  18772. }
  18773. // Fields allows partial responses to be retrieved. See
  18774. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18775. // for more information.
  18776. func (c *UsersPhotosGetCall) Fields(s ...googleapi.Field) *UsersPhotosGetCall {
  18777. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18778. return c
  18779. }
  18780. // IfNoneMatch sets the optional parameter which makes the operation
  18781. // fail if the object's ETag matches the given value. This is useful for
  18782. // getting updates only after the object has changed since the last
  18783. // request. Use googleapi.IsNotModified to check whether the response
  18784. // error from Do is the result of In-None-Match.
  18785. func (c *UsersPhotosGetCall) IfNoneMatch(entityTag string) *UsersPhotosGetCall {
  18786. c.ifNoneMatch_ = entityTag
  18787. return c
  18788. }
  18789. // Context sets the context to be used in this call's Do method. Any
  18790. // pending HTTP request will be aborted if the provided context is
  18791. // canceled.
  18792. func (c *UsersPhotosGetCall) Context(ctx context.Context) *UsersPhotosGetCall {
  18793. c.ctx_ = ctx
  18794. return c
  18795. }
  18796. // Header returns an http.Header that can be modified by the caller to
  18797. // add HTTP headers to the request.
  18798. func (c *UsersPhotosGetCall) Header() http.Header {
  18799. if c.header_ == nil {
  18800. c.header_ = make(http.Header)
  18801. }
  18802. return c.header_
  18803. }
  18804. func (c *UsersPhotosGetCall) doRequest(alt string) (*http.Response, error) {
  18805. reqHeaders := make(http.Header)
  18806. for k, v := range c.header_ {
  18807. reqHeaders[k] = v
  18808. }
  18809. reqHeaders.Set("User-Agent", c.s.userAgent())
  18810. if c.ifNoneMatch_ != "" {
  18811. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  18812. }
  18813. var body io.Reader = nil
  18814. c.urlParams_.Set("alt", alt)
  18815. c.urlParams_.Set("prettyPrint", "false")
  18816. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  18817. urls += "?" + c.urlParams_.Encode()
  18818. req, err := http.NewRequest("GET", urls, body)
  18819. if err != nil {
  18820. return nil, err
  18821. }
  18822. req.Header = reqHeaders
  18823. googleapi.Expand(req.URL, map[string]string{
  18824. "userKey": c.userKey,
  18825. })
  18826. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18827. }
  18828. // Do executes the "directory.users.photos.get" call.
  18829. // Exactly one of *UserPhoto or error will be non-nil. Any non-2xx
  18830. // status code is an error. Response headers are in either
  18831. // *UserPhoto.ServerResponse.Header or (if a response was returned at
  18832. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  18833. // to check whether the returned error was because
  18834. // http.StatusNotModified was returned.
  18835. func (c *UsersPhotosGetCall) Do(opts ...googleapi.CallOption) (*UserPhoto, error) {
  18836. gensupport.SetOptions(c.urlParams_, opts...)
  18837. res, err := c.doRequest("json")
  18838. if res != nil && res.StatusCode == http.StatusNotModified {
  18839. if res.Body != nil {
  18840. res.Body.Close()
  18841. }
  18842. return nil, &googleapi.Error{
  18843. Code: res.StatusCode,
  18844. Header: res.Header,
  18845. }
  18846. }
  18847. if err != nil {
  18848. return nil, err
  18849. }
  18850. defer googleapi.CloseBody(res)
  18851. if err := googleapi.CheckResponse(res); err != nil {
  18852. return nil, err
  18853. }
  18854. ret := &UserPhoto{
  18855. ServerResponse: googleapi.ServerResponse{
  18856. Header: res.Header,
  18857. HTTPStatusCode: res.StatusCode,
  18858. },
  18859. }
  18860. target := &ret
  18861. if err := gensupport.DecodeResponse(target, res); err != nil {
  18862. return nil, err
  18863. }
  18864. return ret, nil
  18865. // {
  18866. // "description": "Retrieve photo of a user",
  18867. // "httpMethod": "GET",
  18868. // "id": "directory.users.photos.get",
  18869. // "parameterOrder": [
  18870. // "userKey"
  18871. // ],
  18872. // "parameters": {
  18873. // "userKey": {
  18874. // "description": "Email or immutable ID of the user",
  18875. // "location": "path",
  18876. // "required": true,
  18877. // "type": "string"
  18878. // }
  18879. // },
  18880. // "path": "users/{userKey}/photos/thumbnail",
  18881. // "response": {
  18882. // "$ref": "UserPhoto"
  18883. // },
  18884. // "scopes": [
  18885. // "https://www.googleapis.com/auth/admin.directory.user",
  18886. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  18887. // ]
  18888. // }
  18889. }
  18890. // method id "directory.users.photos.patch":
  18891. type UsersPhotosPatchCall struct {
  18892. s *Service
  18893. userKey string
  18894. userphoto *UserPhoto
  18895. urlParams_ gensupport.URLParams
  18896. ctx_ context.Context
  18897. header_ http.Header
  18898. }
  18899. // Patch: Add a photo for the user. This method supports patch
  18900. // semantics.
  18901. func (r *UsersPhotosService) Patch(userKey string, userphoto *UserPhoto) *UsersPhotosPatchCall {
  18902. c := &UsersPhotosPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18903. c.userKey = userKey
  18904. c.userphoto = userphoto
  18905. return c
  18906. }
  18907. // Fields allows partial responses to be retrieved. See
  18908. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18909. // for more information.
  18910. func (c *UsersPhotosPatchCall) Fields(s ...googleapi.Field) *UsersPhotosPatchCall {
  18911. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18912. return c
  18913. }
  18914. // Context sets the context to be used in this call's Do method. Any
  18915. // pending HTTP request will be aborted if the provided context is
  18916. // canceled.
  18917. func (c *UsersPhotosPatchCall) Context(ctx context.Context) *UsersPhotosPatchCall {
  18918. c.ctx_ = ctx
  18919. return c
  18920. }
  18921. // Header returns an http.Header that can be modified by the caller to
  18922. // add HTTP headers to the request.
  18923. func (c *UsersPhotosPatchCall) Header() http.Header {
  18924. if c.header_ == nil {
  18925. c.header_ = make(http.Header)
  18926. }
  18927. return c.header_
  18928. }
  18929. func (c *UsersPhotosPatchCall) doRequest(alt string) (*http.Response, error) {
  18930. reqHeaders := make(http.Header)
  18931. for k, v := range c.header_ {
  18932. reqHeaders[k] = v
  18933. }
  18934. reqHeaders.Set("User-Agent", c.s.userAgent())
  18935. var body io.Reader = nil
  18936. body, err := googleapi.WithoutDataWrapper.JSONReader(c.userphoto)
  18937. if err != nil {
  18938. return nil, err
  18939. }
  18940. reqHeaders.Set("Content-Type", "application/json")
  18941. c.urlParams_.Set("alt", alt)
  18942. c.urlParams_.Set("prettyPrint", "false")
  18943. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  18944. urls += "?" + c.urlParams_.Encode()
  18945. req, err := http.NewRequest("PATCH", urls, body)
  18946. if err != nil {
  18947. return nil, err
  18948. }
  18949. req.Header = reqHeaders
  18950. googleapi.Expand(req.URL, map[string]string{
  18951. "userKey": c.userKey,
  18952. })
  18953. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18954. }
  18955. // Do executes the "directory.users.photos.patch" call.
  18956. // Exactly one of *UserPhoto or error will be non-nil. Any non-2xx
  18957. // status code is an error. Response headers are in either
  18958. // *UserPhoto.ServerResponse.Header or (if a response was returned at
  18959. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  18960. // to check whether the returned error was because
  18961. // http.StatusNotModified was returned.
  18962. func (c *UsersPhotosPatchCall) Do(opts ...googleapi.CallOption) (*UserPhoto, error) {
  18963. gensupport.SetOptions(c.urlParams_, opts...)
  18964. res, err := c.doRequest("json")
  18965. if res != nil && res.StatusCode == http.StatusNotModified {
  18966. if res.Body != nil {
  18967. res.Body.Close()
  18968. }
  18969. return nil, &googleapi.Error{
  18970. Code: res.StatusCode,
  18971. Header: res.Header,
  18972. }
  18973. }
  18974. if err != nil {
  18975. return nil, err
  18976. }
  18977. defer googleapi.CloseBody(res)
  18978. if err := googleapi.CheckResponse(res); err != nil {
  18979. return nil, err
  18980. }
  18981. ret := &UserPhoto{
  18982. ServerResponse: googleapi.ServerResponse{
  18983. Header: res.Header,
  18984. HTTPStatusCode: res.StatusCode,
  18985. },
  18986. }
  18987. target := &ret
  18988. if err := gensupport.DecodeResponse(target, res); err != nil {
  18989. return nil, err
  18990. }
  18991. return ret, nil
  18992. // {
  18993. // "description": "Add a photo for the user. This method supports patch semantics.",
  18994. // "httpMethod": "PATCH",
  18995. // "id": "directory.users.photos.patch",
  18996. // "parameterOrder": [
  18997. // "userKey"
  18998. // ],
  18999. // "parameters": {
  19000. // "userKey": {
  19001. // "description": "Email or immutable ID of the user",
  19002. // "location": "path",
  19003. // "required": true,
  19004. // "type": "string"
  19005. // }
  19006. // },
  19007. // "path": "users/{userKey}/photos/thumbnail",
  19008. // "request": {
  19009. // "$ref": "UserPhoto"
  19010. // },
  19011. // "response": {
  19012. // "$ref": "UserPhoto"
  19013. // },
  19014. // "scopes": [
  19015. // "https://www.googleapis.com/auth/admin.directory.user"
  19016. // ]
  19017. // }
  19018. }
  19019. // method id "directory.users.photos.update":
  19020. type UsersPhotosUpdateCall struct {
  19021. s *Service
  19022. userKey string
  19023. userphoto *UserPhoto
  19024. urlParams_ gensupport.URLParams
  19025. ctx_ context.Context
  19026. header_ http.Header
  19027. }
  19028. // Update: Add a photo for the user
  19029. func (r *UsersPhotosService) Update(userKey string, userphoto *UserPhoto) *UsersPhotosUpdateCall {
  19030. c := &UsersPhotosUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  19031. c.userKey = userKey
  19032. c.userphoto = userphoto
  19033. return c
  19034. }
  19035. // Fields allows partial responses to be retrieved. See
  19036. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  19037. // for more information.
  19038. func (c *UsersPhotosUpdateCall) Fields(s ...googleapi.Field) *UsersPhotosUpdateCall {
  19039. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  19040. return c
  19041. }
  19042. // Context sets the context to be used in this call's Do method. Any
  19043. // pending HTTP request will be aborted if the provided context is
  19044. // canceled.
  19045. func (c *UsersPhotosUpdateCall) Context(ctx context.Context) *UsersPhotosUpdateCall {
  19046. c.ctx_ = ctx
  19047. return c
  19048. }
  19049. // Header returns an http.Header that can be modified by the caller to
  19050. // add HTTP headers to the request.
  19051. func (c *UsersPhotosUpdateCall) Header() http.Header {
  19052. if c.header_ == nil {
  19053. c.header_ = make(http.Header)
  19054. }
  19055. return c.header_
  19056. }
  19057. func (c *UsersPhotosUpdateCall) doRequest(alt string) (*http.Response, error) {
  19058. reqHeaders := make(http.Header)
  19059. for k, v := range c.header_ {
  19060. reqHeaders[k] = v
  19061. }
  19062. reqHeaders.Set("User-Agent", c.s.userAgent())
  19063. var body io.Reader = nil
  19064. body, err := googleapi.WithoutDataWrapper.JSONReader(c.userphoto)
  19065. if err != nil {
  19066. return nil, err
  19067. }
  19068. reqHeaders.Set("Content-Type", "application/json")
  19069. c.urlParams_.Set("alt", alt)
  19070. c.urlParams_.Set("prettyPrint", "false")
  19071. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  19072. urls += "?" + c.urlParams_.Encode()
  19073. req, err := http.NewRequest("PUT", urls, body)
  19074. if err != nil {
  19075. return nil, err
  19076. }
  19077. req.Header = reqHeaders
  19078. googleapi.Expand(req.URL, map[string]string{
  19079. "userKey": c.userKey,
  19080. })
  19081. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  19082. }
  19083. // Do executes the "directory.users.photos.update" call.
  19084. // Exactly one of *UserPhoto or error will be non-nil. Any non-2xx
  19085. // status code is an error. Response headers are in either
  19086. // *UserPhoto.ServerResponse.Header or (if a response was returned at
  19087. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  19088. // to check whether the returned error was because
  19089. // http.StatusNotModified was returned.
  19090. func (c *UsersPhotosUpdateCall) Do(opts ...googleapi.CallOption) (*UserPhoto, error) {
  19091. gensupport.SetOptions(c.urlParams_, opts...)
  19092. res, err := c.doRequest("json")
  19093. if res != nil && res.StatusCode == http.StatusNotModified {
  19094. if res.Body != nil {
  19095. res.Body.Close()
  19096. }
  19097. return nil, &googleapi.Error{
  19098. Code: res.StatusCode,
  19099. Header: res.Header,
  19100. }
  19101. }
  19102. if err != nil {
  19103. return nil, err
  19104. }
  19105. defer googleapi.CloseBody(res)
  19106. if err := googleapi.CheckResponse(res); err != nil {
  19107. return nil, err
  19108. }
  19109. ret := &UserPhoto{
  19110. ServerResponse: googleapi.ServerResponse{
  19111. Header: res.Header,
  19112. HTTPStatusCode: res.StatusCode,
  19113. },
  19114. }
  19115. target := &ret
  19116. if err := gensupport.DecodeResponse(target, res); err != nil {
  19117. return nil, err
  19118. }
  19119. return ret, nil
  19120. // {
  19121. // "description": "Add a photo for the user",
  19122. // "httpMethod": "PUT",
  19123. // "id": "directory.users.photos.update",
  19124. // "parameterOrder": [
  19125. // "userKey"
  19126. // ],
  19127. // "parameters": {
  19128. // "userKey": {
  19129. // "description": "Email or immutable ID of the user",
  19130. // "location": "path",
  19131. // "required": true,
  19132. // "type": "string"
  19133. // }
  19134. // },
  19135. // "path": "users/{userKey}/photos/thumbnail",
  19136. // "request": {
  19137. // "$ref": "UserPhoto"
  19138. // },
  19139. // "response": {
  19140. // "$ref": "UserPhoto"
  19141. // },
  19142. // "scopes": [
  19143. // "https://www.googleapis.com/auth/admin.directory.user"
  19144. // ]
  19145. // }
  19146. }
  19147. // method id "directory.verificationCodes.generate":
  19148. type VerificationCodesGenerateCall struct {
  19149. s *Service
  19150. userKey string
  19151. urlParams_ gensupport.URLParams
  19152. ctx_ context.Context
  19153. header_ http.Header
  19154. }
  19155. // Generate: Generate new backup verification codes for the user.
  19156. func (r *VerificationCodesService) Generate(userKey string) *VerificationCodesGenerateCall {
  19157. c := &VerificationCodesGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  19158. c.userKey = userKey
  19159. return c
  19160. }
  19161. // Fields allows partial responses to be retrieved. See
  19162. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  19163. // for more information.
  19164. func (c *VerificationCodesGenerateCall) Fields(s ...googleapi.Field) *VerificationCodesGenerateCall {
  19165. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  19166. return c
  19167. }
  19168. // Context sets the context to be used in this call's Do method. Any
  19169. // pending HTTP request will be aborted if the provided context is
  19170. // canceled.
  19171. func (c *VerificationCodesGenerateCall) Context(ctx context.Context) *VerificationCodesGenerateCall {
  19172. c.ctx_ = ctx
  19173. return c
  19174. }
  19175. // Header returns an http.Header that can be modified by the caller to
  19176. // add HTTP headers to the request.
  19177. func (c *VerificationCodesGenerateCall) Header() http.Header {
  19178. if c.header_ == nil {
  19179. c.header_ = make(http.Header)
  19180. }
  19181. return c.header_
  19182. }
  19183. func (c *VerificationCodesGenerateCall) doRequest(alt string) (*http.Response, error) {
  19184. reqHeaders := make(http.Header)
  19185. for k, v := range c.header_ {
  19186. reqHeaders[k] = v
  19187. }
  19188. reqHeaders.Set("User-Agent", c.s.userAgent())
  19189. var body io.Reader = nil
  19190. c.urlParams_.Set("alt", alt)
  19191. c.urlParams_.Set("prettyPrint", "false")
  19192. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/verificationCodes/generate")
  19193. urls += "?" + c.urlParams_.Encode()
  19194. req, err := http.NewRequest("POST", urls, body)
  19195. if err != nil {
  19196. return nil, err
  19197. }
  19198. req.Header = reqHeaders
  19199. googleapi.Expand(req.URL, map[string]string{
  19200. "userKey": c.userKey,
  19201. })
  19202. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  19203. }
  19204. // Do executes the "directory.verificationCodes.generate" call.
  19205. func (c *VerificationCodesGenerateCall) Do(opts ...googleapi.CallOption) error {
  19206. gensupport.SetOptions(c.urlParams_, opts...)
  19207. res, err := c.doRequest("json")
  19208. if err != nil {
  19209. return err
  19210. }
  19211. defer googleapi.CloseBody(res)
  19212. if err := googleapi.CheckResponse(res); err != nil {
  19213. return err
  19214. }
  19215. return nil
  19216. // {
  19217. // "description": "Generate new backup verification codes for the user.",
  19218. // "httpMethod": "POST",
  19219. // "id": "directory.verificationCodes.generate",
  19220. // "parameterOrder": [
  19221. // "userKey"
  19222. // ],
  19223. // "parameters": {
  19224. // "userKey": {
  19225. // "description": "Email or immutable ID of the user",
  19226. // "location": "path",
  19227. // "required": true,
  19228. // "type": "string"
  19229. // }
  19230. // },
  19231. // "path": "users/{userKey}/verificationCodes/generate",
  19232. // "scopes": [
  19233. // "https://www.googleapis.com/auth/admin.directory.user.security"
  19234. // ]
  19235. // }
  19236. }
  19237. // method id "directory.verificationCodes.invalidate":
  19238. type VerificationCodesInvalidateCall struct {
  19239. s *Service
  19240. userKey string
  19241. urlParams_ gensupport.URLParams
  19242. ctx_ context.Context
  19243. header_ http.Header
  19244. }
  19245. // Invalidate: Invalidate the current backup verification codes for the
  19246. // user.
  19247. func (r *VerificationCodesService) Invalidate(userKey string) *VerificationCodesInvalidateCall {
  19248. c := &VerificationCodesInvalidateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  19249. c.userKey = userKey
  19250. return c
  19251. }
  19252. // Fields allows partial responses to be retrieved. See
  19253. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  19254. // for more information.
  19255. func (c *VerificationCodesInvalidateCall) Fields(s ...googleapi.Field) *VerificationCodesInvalidateCall {
  19256. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  19257. return c
  19258. }
  19259. // Context sets the context to be used in this call's Do method. Any
  19260. // pending HTTP request will be aborted if the provided context is
  19261. // canceled.
  19262. func (c *VerificationCodesInvalidateCall) Context(ctx context.Context) *VerificationCodesInvalidateCall {
  19263. c.ctx_ = ctx
  19264. return c
  19265. }
  19266. // Header returns an http.Header that can be modified by the caller to
  19267. // add HTTP headers to the request.
  19268. func (c *VerificationCodesInvalidateCall) Header() http.Header {
  19269. if c.header_ == nil {
  19270. c.header_ = make(http.Header)
  19271. }
  19272. return c.header_
  19273. }
  19274. func (c *VerificationCodesInvalidateCall) doRequest(alt string) (*http.Response, error) {
  19275. reqHeaders := make(http.Header)
  19276. for k, v := range c.header_ {
  19277. reqHeaders[k] = v
  19278. }
  19279. reqHeaders.Set("User-Agent", c.s.userAgent())
  19280. var body io.Reader = nil
  19281. c.urlParams_.Set("alt", alt)
  19282. c.urlParams_.Set("prettyPrint", "false")
  19283. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/verificationCodes/invalidate")
  19284. urls += "?" + c.urlParams_.Encode()
  19285. req, err := http.NewRequest("POST", urls, body)
  19286. if err != nil {
  19287. return nil, err
  19288. }
  19289. req.Header = reqHeaders
  19290. googleapi.Expand(req.URL, map[string]string{
  19291. "userKey": c.userKey,
  19292. })
  19293. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  19294. }
  19295. // Do executes the "directory.verificationCodes.invalidate" call.
  19296. func (c *VerificationCodesInvalidateCall) Do(opts ...googleapi.CallOption) error {
  19297. gensupport.SetOptions(c.urlParams_, opts...)
  19298. res, err := c.doRequest("json")
  19299. if err != nil {
  19300. return err
  19301. }
  19302. defer googleapi.CloseBody(res)
  19303. if err := googleapi.CheckResponse(res); err != nil {
  19304. return err
  19305. }
  19306. return nil
  19307. // {
  19308. // "description": "Invalidate the current backup verification codes for the user.",
  19309. // "httpMethod": "POST",
  19310. // "id": "directory.verificationCodes.invalidate",
  19311. // "parameterOrder": [
  19312. // "userKey"
  19313. // ],
  19314. // "parameters": {
  19315. // "userKey": {
  19316. // "description": "Email or immutable ID of the user",
  19317. // "location": "path",
  19318. // "required": true,
  19319. // "type": "string"
  19320. // }
  19321. // },
  19322. // "path": "users/{userKey}/verificationCodes/invalidate",
  19323. // "scopes": [
  19324. // "https://www.googleapis.com/auth/admin.directory.user.security"
  19325. // ]
  19326. // }
  19327. }
  19328. // method id "directory.verificationCodes.list":
  19329. type VerificationCodesListCall struct {
  19330. s *Service
  19331. userKey string
  19332. urlParams_ gensupport.URLParams
  19333. ifNoneMatch_ string
  19334. ctx_ context.Context
  19335. header_ http.Header
  19336. }
  19337. // List: Returns the current set of valid backup verification codes for
  19338. // the specified user.
  19339. func (r *VerificationCodesService) List(userKey string) *VerificationCodesListCall {
  19340. c := &VerificationCodesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  19341. c.userKey = userKey
  19342. return c
  19343. }
  19344. // Fields allows partial responses to be retrieved. See
  19345. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  19346. // for more information.
  19347. func (c *VerificationCodesListCall) Fields(s ...googleapi.Field) *VerificationCodesListCall {
  19348. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  19349. return c
  19350. }
  19351. // IfNoneMatch sets the optional parameter which makes the operation
  19352. // fail if the object's ETag matches the given value. This is useful for
  19353. // getting updates only after the object has changed since the last
  19354. // request. Use googleapi.IsNotModified to check whether the response
  19355. // error from Do is the result of In-None-Match.
  19356. func (c *VerificationCodesListCall) IfNoneMatch(entityTag string) *VerificationCodesListCall {
  19357. c.ifNoneMatch_ = entityTag
  19358. return c
  19359. }
  19360. // Context sets the context to be used in this call's Do method. Any
  19361. // pending HTTP request will be aborted if the provided context is
  19362. // canceled.
  19363. func (c *VerificationCodesListCall) Context(ctx context.Context) *VerificationCodesListCall {
  19364. c.ctx_ = ctx
  19365. return c
  19366. }
  19367. // Header returns an http.Header that can be modified by the caller to
  19368. // add HTTP headers to the request.
  19369. func (c *VerificationCodesListCall) Header() http.Header {
  19370. if c.header_ == nil {
  19371. c.header_ = make(http.Header)
  19372. }
  19373. return c.header_
  19374. }
  19375. func (c *VerificationCodesListCall) doRequest(alt string) (*http.Response, error) {
  19376. reqHeaders := make(http.Header)
  19377. for k, v := range c.header_ {
  19378. reqHeaders[k] = v
  19379. }
  19380. reqHeaders.Set("User-Agent", c.s.userAgent())
  19381. if c.ifNoneMatch_ != "" {
  19382. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  19383. }
  19384. var body io.Reader = nil
  19385. c.urlParams_.Set("alt", alt)
  19386. c.urlParams_.Set("prettyPrint", "false")
  19387. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/verificationCodes")
  19388. urls += "?" + c.urlParams_.Encode()
  19389. req, err := http.NewRequest("GET", urls, body)
  19390. if err != nil {
  19391. return nil, err
  19392. }
  19393. req.Header = reqHeaders
  19394. googleapi.Expand(req.URL, map[string]string{
  19395. "userKey": c.userKey,
  19396. })
  19397. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  19398. }
  19399. // Do executes the "directory.verificationCodes.list" call.
  19400. // Exactly one of *VerificationCodes or error will be non-nil. Any
  19401. // non-2xx status code is an error. Response headers are in either
  19402. // *VerificationCodes.ServerResponse.Header or (if a response was
  19403. // returned at all) in error.(*googleapi.Error).Header. Use
  19404. // googleapi.IsNotModified to check whether the returned error was
  19405. // because http.StatusNotModified was returned.
  19406. func (c *VerificationCodesListCall) Do(opts ...googleapi.CallOption) (*VerificationCodes, error) {
  19407. gensupport.SetOptions(c.urlParams_, opts...)
  19408. res, err := c.doRequest("json")
  19409. if res != nil && res.StatusCode == http.StatusNotModified {
  19410. if res.Body != nil {
  19411. res.Body.Close()
  19412. }
  19413. return nil, &googleapi.Error{
  19414. Code: res.StatusCode,
  19415. Header: res.Header,
  19416. }
  19417. }
  19418. if err != nil {
  19419. return nil, err
  19420. }
  19421. defer googleapi.CloseBody(res)
  19422. if err := googleapi.CheckResponse(res); err != nil {
  19423. return nil, err
  19424. }
  19425. ret := &VerificationCodes{
  19426. ServerResponse: googleapi.ServerResponse{
  19427. Header: res.Header,
  19428. HTTPStatusCode: res.StatusCode,
  19429. },
  19430. }
  19431. target := &ret
  19432. if err := gensupport.DecodeResponse(target, res); err != nil {
  19433. return nil, err
  19434. }
  19435. return ret, nil
  19436. // {
  19437. // "description": "Returns the current set of valid backup verification codes for the specified user.",
  19438. // "httpMethod": "GET",
  19439. // "id": "directory.verificationCodes.list",
  19440. // "parameterOrder": [
  19441. // "userKey"
  19442. // ],
  19443. // "parameters": {
  19444. // "userKey": {
  19445. // "description": "Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.",
  19446. // "location": "path",
  19447. // "required": true,
  19448. // "type": "string"
  19449. // }
  19450. // },
  19451. // "path": "users/{userKey}/verificationCodes",
  19452. // "response": {
  19453. // "$ref": "VerificationCodes"
  19454. // },
  19455. // "scopes": [
  19456. // "https://www.googleapis.com/auth/admin.directory.user.security"
  19457. // ]
  19458. // }
  19459. }