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.
 
 
 

20676 regels
658 KiB

  1. // Package admin provides access to the Admin Directory API.
  2. //
  3. // See https://developers.google.com/admin-sdk/directory/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/admin/directory/v1"
  8. // ...
  9. // adminService, err := admin.New(oauthHttpClient)
  10. package admin // import "google.golang.org/api/admin/directory/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "admin:directory_v1"
  41. const apiName = "admin"
  42. const apiVersion = "directory_v1"
  43. const basePath = "https://www.googleapis.com/admin/directory/v1/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage customer related information
  47. AdminDirectoryCustomerScope = "https://www.googleapis.com/auth/admin.directory.customer"
  48. // View customer related information
  49. AdminDirectoryCustomerReadonlyScope = "https://www.googleapis.com/auth/admin.directory.customer.readonly"
  50. // View and manage your Chrome OS devices' metadata
  51. AdminDirectoryDeviceChromeosScope = "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  52. // View your Chrome OS devices' metadata
  53. AdminDirectoryDeviceChromeosReadonlyScope = "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly"
  54. // View and manage your mobile devices' metadata
  55. AdminDirectoryDeviceMobileScope = "https://www.googleapis.com/auth/admin.directory.device.mobile"
  56. // Manage your mobile devices by performing administrative tasks
  57. AdminDirectoryDeviceMobileActionScope = "https://www.googleapis.com/auth/admin.directory.device.mobile.action"
  58. // View your mobile devices' metadata
  59. AdminDirectoryDeviceMobileReadonlyScope = "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly"
  60. // View and manage the provisioning of domains for your customers
  61. AdminDirectoryDomainScope = "https://www.googleapis.com/auth/admin.directory.domain"
  62. // View domains related to your customers
  63. AdminDirectoryDomainReadonlyScope = "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  64. // View and manage the provisioning of groups on your domain
  65. AdminDirectoryGroupScope = "https://www.googleapis.com/auth/admin.directory.group"
  66. // View and manage group subscriptions on your domain
  67. AdminDirectoryGroupMemberScope = "https://www.googleapis.com/auth/admin.directory.group.member"
  68. // View group subscriptions on your domain
  69. AdminDirectoryGroupMemberReadonlyScope = "https://www.googleapis.com/auth/admin.directory.group.member.readonly"
  70. // View groups on your domain
  71. AdminDirectoryGroupReadonlyScope = "https://www.googleapis.com/auth/admin.directory.group.readonly"
  72. // View and manage notifications received on your domain
  73. AdminDirectoryNotificationsScope = "https://www.googleapis.com/auth/admin.directory.notifications"
  74. // View and manage organization units on your domain
  75. AdminDirectoryOrgunitScope = "https://www.googleapis.com/auth/admin.directory.orgunit"
  76. // View organization units on your domain
  77. AdminDirectoryOrgunitReadonlyScope = "https://www.googleapis.com/auth/admin.directory.orgunit.readonly"
  78. // View and manage the provisioning of calendar resources on your domain
  79. AdminDirectoryResourceCalendarScope = "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  80. // View calendar resources on your domain
  81. AdminDirectoryResourceCalendarReadonlyScope = "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  82. // Manage delegated admin roles for your domain
  83. AdminDirectoryRolemanagementScope = "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  84. // View delegated admin roles for your domain
  85. AdminDirectoryRolemanagementReadonlyScope = "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  86. // View and manage the provisioning of users on your domain
  87. AdminDirectoryUserScope = "https://www.googleapis.com/auth/admin.directory.user"
  88. // View and manage user aliases on your domain
  89. AdminDirectoryUserAliasScope = "https://www.googleapis.com/auth/admin.directory.user.alias"
  90. // View user aliases on your domain
  91. AdminDirectoryUserAliasReadonlyScope = "https://www.googleapis.com/auth/admin.directory.user.alias.readonly"
  92. // View users on your domain
  93. AdminDirectoryUserReadonlyScope = "https://www.googleapis.com/auth/admin.directory.user.readonly"
  94. // Manage data access permissions for users on your domain
  95. AdminDirectoryUserSecurityScope = "https://www.googleapis.com/auth/admin.directory.user.security"
  96. // View and manage the provisioning of user schemas on your domain
  97. AdminDirectoryUserschemaScope = "https://www.googleapis.com/auth/admin.directory.userschema"
  98. // View user schemas on your domain
  99. AdminDirectoryUserschemaReadonlyScope = "https://www.googleapis.com/auth/admin.directory.userschema.readonly"
  100. )
  101. func New(client *http.Client) (*Service, error) {
  102. if client == nil {
  103. return nil, errors.New("client is nil")
  104. }
  105. s := &Service{client: client, BasePath: basePath}
  106. s.Asps = NewAspsService(s)
  107. s.Channels = NewChannelsService(s)
  108. s.Chromeosdevices = NewChromeosdevicesService(s)
  109. s.Customers = NewCustomersService(s)
  110. s.DomainAliases = NewDomainAliasesService(s)
  111. s.Domains = NewDomainsService(s)
  112. s.Groups = NewGroupsService(s)
  113. s.Members = NewMembersService(s)
  114. s.Mobiledevices = NewMobiledevicesService(s)
  115. s.Notifications = NewNotificationsService(s)
  116. s.Orgunits = NewOrgunitsService(s)
  117. s.Privileges = NewPrivilegesService(s)
  118. s.ResolvedAppAccessSettings = NewResolvedAppAccessSettingsService(s)
  119. s.Resources = NewResourcesService(s)
  120. s.RoleAssignments = NewRoleAssignmentsService(s)
  121. s.Roles = NewRolesService(s)
  122. s.Schemas = NewSchemasService(s)
  123. s.Tokens = NewTokensService(s)
  124. s.Users = NewUsersService(s)
  125. s.VerificationCodes = NewVerificationCodesService(s)
  126. return s, nil
  127. }
  128. type Service struct {
  129. client *http.Client
  130. BasePath string // API endpoint base URL
  131. UserAgent string // optional additional User-Agent fragment
  132. Asps *AspsService
  133. Channels *ChannelsService
  134. Chromeosdevices *ChromeosdevicesService
  135. Customers *CustomersService
  136. DomainAliases *DomainAliasesService
  137. Domains *DomainsService
  138. Groups *GroupsService
  139. Members *MembersService
  140. Mobiledevices *MobiledevicesService
  141. Notifications *NotificationsService
  142. Orgunits *OrgunitsService
  143. Privileges *PrivilegesService
  144. ResolvedAppAccessSettings *ResolvedAppAccessSettingsService
  145. Resources *ResourcesService
  146. RoleAssignments *RoleAssignmentsService
  147. Roles *RolesService
  148. Schemas *SchemasService
  149. Tokens *TokensService
  150. Users *UsersService
  151. VerificationCodes *VerificationCodesService
  152. }
  153. func (s *Service) userAgent() string {
  154. if s.UserAgent == "" {
  155. return googleapi.UserAgent
  156. }
  157. return googleapi.UserAgent + " " + s.UserAgent
  158. }
  159. func NewAspsService(s *Service) *AspsService {
  160. rs := &AspsService{s: s}
  161. return rs
  162. }
  163. type AspsService struct {
  164. s *Service
  165. }
  166. func NewChannelsService(s *Service) *ChannelsService {
  167. rs := &ChannelsService{s: s}
  168. return rs
  169. }
  170. type ChannelsService struct {
  171. s *Service
  172. }
  173. func NewChromeosdevicesService(s *Service) *ChromeosdevicesService {
  174. rs := &ChromeosdevicesService{s: s}
  175. return rs
  176. }
  177. type ChromeosdevicesService struct {
  178. s *Service
  179. }
  180. func NewCustomersService(s *Service) *CustomersService {
  181. rs := &CustomersService{s: s}
  182. return rs
  183. }
  184. type CustomersService struct {
  185. s *Service
  186. }
  187. func NewDomainAliasesService(s *Service) *DomainAliasesService {
  188. rs := &DomainAliasesService{s: s}
  189. return rs
  190. }
  191. type DomainAliasesService struct {
  192. s *Service
  193. }
  194. func NewDomainsService(s *Service) *DomainsService {
  195. rs := &DomainsService{s: s}
  196. return rs
  197. }
  198. type DomainsService struct {
  199. s *Service
  200. }
  201. func NewGroupsService(s *Service) *GroupsService {
  202. rs := &GroupsService{s: s}
  203. rs.Aliases = NewGroupsAliasesService(s)
  204. return rs
  205. }
  206. type GroupsService struct {
  207. s *Service
  208. Aliases *GroupsAliasesService
  209. }
  210. func NewGroupsAliasesService(s *Service) *GroupsAliasesService {
  211. rs := &GroupsAliasesService{s: s}
  212. return rs
  213. }
  214. type GroupsAliasesService struct {
  215. s *Service
  216. }
  217. func NewMembersService(s *Service) *MembersService {
  218. rs := &MembersService{s: s}
  219. return rs
  220. }
  221. type MembersService struct {
  222. s *Service
  223. }
  224. func NewMobiledevicesService(s *Service) *MobiledevicesService {
  225. rs := &MobiledevicesService{s: s}
  226. return rs
  227. }
  228. type MobiledevicesService struct {
  229. s *Service
  230. }
  231. func NewNotificationsService(s *Service) *NotificationsService {
  232. rs := &NotificationsService{s: s}
  233. return rs
  234. }
  235. type NotificationsService struct {
  236. s *Service
  237. }
  238. func NewOrgunitsService(s *Service) *OrgunitsService {
  239. rs := &OrgunitsService{s: s}
  240. return rs
  241. }
  242. type OrgunitsService struct {
  243. s *Service
  244. }
  245. func NewPrivilegesService(s *Service) *PrivilegesService {
  246. rs := &PrivilegesService{s: s}
  247. return rs
  248. }
  249. type PrivilegesService struct {
  250. s *Service
  251. }
  252. func NewResolvedAppAccessSettingsService(s *Service) *ResolvedAppAccessSettingsService {
  253. rs := &ResolvedAppAccessSettingsService{s: s}
  254. return rs
  255. }
  256. type ResolvedAppAccessSettingsService struct {
  257. s *Service
  258. }
  259. func NewResourcesService(s *Service) *ResourcesService {
  260. rs := &ResourcesService{s: s}
  261. rs.Buildings = NewResourcesBuildingsService(s)
  262. rs.Calendars = NewResourcesCalendarsService(s)
  263. rs.Features = NewResourcesFeaturesService(s)
  264. return rs
  265. }
  266. type ResourcesService struct {
  267. s *Service
  268. Buildings *ResourcesBuildingsService
  269. Calendars *ResourcesCalendarsService
  270. Features *ResourcesFeaturesService
  271. }
  272. func NewResourcesBuildingsService(s *Service) *ResourcesBuildingsService {
  273. rs := &ResourcesBuildingsService{s: s}
  274. return rs
  275. }
  276. type ResourcesBuildingsService struct {
  277. s *Service
  278. }
  279. func NewResourcesCalendarsService(s *Service) *ResourcesCalendarsService {
  280. rs := &ResourcesCalendarsService{s: s}
  281. return rs
  282. }
  283. type ResourcesCalendarsService struct {
  284. s *Service
  285. }
  286. func NewResourcesFeaturesService(s *Service) *ResourcesFeaturesService {
  287. rs := &ResourcesFeaturesService{s: s}
  288. return rs
  289. }
  290. type ResourcesFeaturesService struct {
  291. s *Service
  292. }
  293. func NewRoleAssignmentsService(s *Service) *RoleAssignmentsService {
  294. rs := &RoleAssignmentsService{s: s}
  295. return rs
  296. }
  297. type RoleAssignmentsService struct {
  298. s *Service
  299. }
  300. func NewRolesService(s *Service) *RolesService {
  301. rs := &RolesService{s: s}
  302. return rs
  303. }
  304. type RolesService struct {
  305. s *Service
  306. }
  307. func NewSchemasService(s *Service) *SchemasService {
  308. rs := &SchemasService{s: s}
  309. return rs
  310. }
  311. type SchemasService struct {
  312. s *Service
  313. }
  314. func NewTokensService(s *Service) *TokensService {
  315. rs := &TokensService{s: s}
  316. return rs
  317. }
  318. type TokensService struct {
  319. s *Service
  320. }
  321. func NewUsersService(s *Service) *UsersService {
  322. rs := &UsersService{s: s}
  323. rs.Aliases = NewUsersAliasesService(s)
  324. rs.Photos = NewUsersPhotosService(s)
  325. return rs
  326. }
  327. type UsersService struct {
  328. s *Service
  329. Aliases *UsersAliasesService
  330. Photos *UsersPhotosService
  331. }
  332. func NewUsersAliasesService(s *Service) *UsersAliasesService {
  333. rs := &UsersAliasesService{s: s}
  334. return rs
  335. }
  336. type UsersAliasesService struct {
  337. s *Service
  338. }
  339. func NewUsersPhotosService(s *Service) *UsersPhotosService {
  340. rs := &UsersPhotosService{s: s}
  341. return rs
  342. }
  343. type UsersPhotosService struct {
  344. s *Service
  345. }
  346. func NewVerificationCodesService(s *Service) *VerificationCodesService {
  347. rs := &VerificationCodesService{s: s}
  348. return rs
  349. }
  350. type VerificationCodesService struct {
  351. s *Service
  352. }
  353. // Alias: JSON template for Alias object in Directory API.
  354. type Alias struct {
  355. // Alias: A alias email
  356. Alias string `json:"alias,omitempty"`
  357. // Etag: ETag of the resource.
  358. Etag string `json:"etag,omitempty"`
  359. // Id: Unique id of the group (Read-only) Unique id of the user
  360. // (Read-only)
  361. Id string `json:"id,omitempty"`
  362. // Kind: Kind of resource this is.
  363. Kind string `json:"kind,omitempty"`
  364. // PrimaryEmail: Group's primary email (Read-only) User's primary email
  365. // (Read-only)
  366. PrimaryEmail string `json:"primaryEmail,omitempty"`
  367. // ServerResponse contains the HTTP response code and headers from the
  368. // server.
  369. googleapi.ServerResponse `json:"-"`
  370. // ForceSendFields is a list of field names (e.g. "Alias") to
  371. // unconditionally include in API requests. By default, fields with
  372. // empty values are omitted from API requests. However, any non-pointer,
  373. // non-interface field appearing in ForceSendFields will be sent to the
  374. // server regardless of whether the field is empty or not. This may be
  375. // used to include empty fields in Patch requests.
  376. ForceSendFields []string `json:"-"`
  377. // NullFields is a list of field names (e.g. "Alias") to include in API
  378. // requests with the JSON null value. By default, fields with empty
  379. // values are omitted from API requests. However, any field with an
  380. // empty value appearing in NullFields will be sent to the server as
  381. // null. It is an error if a field in this list has a non-empty value.
  382. // This may be used to include null fields in Patch requests.
  383. NullFields []string `json:"-"`
  384. }
  385. func (s *Alias) MarshalJSON() ([]byte, error) {
  386. type NoMethod Alias
  387. raw := NoMethod(*s)
  388. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  389. }
  390. // Aliases: JSON response template to list aliases in Directory API.
  391. type Aliases struct {
  392. // Aliases: List of alias objects.
  393. Aliases []interface{} `json:"aliases,omitempty"`
  394. // Etag: ETag of the resource.
  395. Etag string `json:"etag,omitempty"`
  396. // Kind: Kind of resource this is.
  397. Kind string `json:"kind,omitempty"`
  398. // ServerResponse contains the HTTP response code and headers from the
  399. // server.
  400. googleapi.ServerResponse `json:"-"`
  401. // ForceSendFields is a list of field names (e.g. "Aliases") to
  402. // unconditionally include in API requests. By default, fields with
  403. // empty values are omitted from API requests. However, any non-pointer,
  404. // non-interface field appearing in ForceSendFields will be sent to the
  405. // server regardless of whether the field is empty or not. This may be
  406. // used to include empty fields in Patch requests.
  407. ForceSendFields []string `json:"-"`
  408. // NullFields is a list of field names (e.g. "Aliases") to include in
  409. // API requests with the JSON null value. By default, fields with empty
  410. // values are omitted from API requests. However, any field with an
  411. // empty value appearing in NullFields will be sent to the server as
  412. // null. It is an error if a field in this list has a non-empty value.
  413. // This may be used to include null fields in Patch requests.
  414. NullFields []string `json:"-"`
  415. }
  416. func (s *Aliases) MarshalJSON() ([]byte, error) {
  417. type NoMethod Aliases
  418. raw := NoMethod(*s)
  419. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  420. }
  421. // AppAccessCollections: JSON template for App Access Collections
  422. // Resource object in Directory API.
  423. type AppAccessCollections struct {
  424. // BlockedApiAccessBuckets: List of blocked api access buckets.
  425. BlockedApiAccessBuckets []string `json:"blockedApiAccessBuckets,omitempty"`
  426. // EnforceSettingsForAndroidDrive: Boolean to indicate whether to
  427. // enforce app access settings on Android Drive or not.
  428. EnforceSettingsForAndroidDrive bool `json:"enforceSettingsForAndroidDrive,omitempty"`
  429. // ErrorMessage: Error message provided by the Admin that will be shown
  430. // to the user when an app is blocked.
  431. ErrorMessage string `json:"errorMessage,omitempty"`
  432. // Etag: ETag of the resource.
  433. Etag string `json:"etag,omitempty"`
  434. // Kind: Identifies the resource as an app access collection. Value:
  435. // admin#directory#appaccesscollection
  436. Kind string `json:"kind,omitempty"`
  437. // ResourceId: Unique ID of app access collection. (Readonly)
  438. ResourceId int64 `json:"resourceId,omitempty,string"`
  439. // ResourceName: Resource name given by the customer while
  440. // creating/updating. Should be unique under given customer.
  441. ResourceName string `json:"resourceName,omitempty"`
  442. // TrustDomainOwnedApps: Boolean that indicates whether to trust domain
  443. // owned apps.
  444. TrustDomainOwnedApps bool `json:"trustDomainOwnedApps,omitempty"`
  445. // ServerResponse contains the HTTP response code and headers from the
  446. // server.
  447. googleapi.ServerResponse `json:"-"`
  448. // ForceSendFields is a list of field names (e.g.
  449. // "BlockedApiAccessBuckets") to unconditionally include in API
  450. // requests. By default, fields with empty values are omitted from API
  451. // requests. However, any non-pointer, non-interface field appearing in
  452. // ForceSendFields will be sent to the server regardless of whether the
  453. // field is empty or not. This may be used to include empty fields in
  454. // Patch requests.
  455. ForceSendFields []string `json:"-"`
  456. // NullFields is a list of field names (e.g. "BlockedApiAccessBuckets")
  457. // to include in API requests with the JSON null value. By default,
  458. // fields with empty values are omitted from API requests. However, any
  459. // field with an empty value appearing in NullFields will be sent to the
  460. // server as null. It is an error if a field in this list has a
  461. // non-empty value. This may be used to include null fields in Patch
  462. // requests.
  463. NullFields []string `json:"-"`
  464. }
  465. func (s *AppAccessCollections) MarshalJSON() ([]byte, error) {
  466. type NoMethod AppAccessCollections
  467. raw := NoMethod(*s)
  468. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  469. }
  470. // Asp: The template that returns individual ASP (Access Code) data.
  471. type Asp struct {
  472. // CodeId: The unique ID of the ASP.
  473. CodeId int64 `json:"codeId,omitempty"`
  474. // CreationTime: The time when the ASP was created. Expressed in Unix
  475. // time format.
  476. CreationTime int64 `json:"creationTime,omitempty,string"`
  477. // Etag: ETag of the ASP.
  478. Etag string `json:"etag,omitempty"`
  479. // Kind: The type of the API resource. This is always
  480. // admin#directory#asp.
  481. Kind string `json:"kind,omitempty"`
  482. // LastTimeUsed: The time when the ASP was last used. Expressed in Unix
  483. // time format.
  484. LastTimeUsed int64 `json:"lastTimeUsed,omitempty,string"`
  485. // Name: The name of the application that the user, represented by their
  486. // userId, entered when the ASP was created.
  487. Name string `json:"name,omitempty"`
  488. // UserKey: The unique ID of the user who issued the ASP.
  489. UserKey string `json:"userKey,omitempty"`
  490. // ServerResponse contains the HTTP response code and headers from the
  491. // server.
  492. googleapi.ServerResponse `json:"-"`
  493. // ForceSendFields is a list of field names (e.g. "CodeId") to
  494. // unconditionally include in API requests. By default, fields with
  495. // empty values are omitted from API requests. However, any non-pointer,
  496. // non-interface field appearing in ForceSendFields will be sent to the
  497. // server regardless of whether the field is empty or not. This may be
  498. // used to include empty fields in Patch requests.
  499. ForceSendFields []string `json:"-"`
  500. // NullFields is a list of field names (e.g. "CodeId") to include in API
  501. // requests with the JSON null value. By default, fields with empty
  502. // values are omitted from API requests. However, any field with an
  503. // empty value appearing in NullFields will be sent to the server as
  504. // null. It is an error if a field in this list has a non-empty value.
  505. // This may be used to include null fields in Patch requests.
  506. NullFields []string `json:"-"`
  507. }
  508. func (s *Asp) MarshalJSON() ([]byte, error) {
  509. type NoMethod Asp
  510. raw := NoMethod(*s)
  511. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  512. }
  513. type Asps struct {
  514. // Etag: ETag of the resource.
  515. Etag string `json:"etag,omitempty"`
  516. // Items: A list of ASP resources.
  517. Items []*Asp `json:"items,omitempty"`
  518. // Kind: The type of the API resource. This is always
  519. // admin#directory#aspList.
  520. Kind string `json:"kind,omitempty"`
  521. // ServerResponse contains the HTTP response code and headers from the
  522. // server.
  523. googleapi.ServerResponse `json:"-"`
  524. // ForceSendFields is a list of field names (e.g. "Etag") to
  525. // unconditionally include in API requests. By default, fields with
  526. // empty values are omitted from API requests. However, any non-pointer,
  527. // non-interface field appearing in ForceSendFields will be sent to the
  528. // server regardless of whether the field is empty or not. This may be
  529. // used to include empty fields in Patch requests.
  530. ForceSendFields []string `json:"-"`
  531. // NullFields is a list of field names (e.g. "Etag") to include in API
  532. // requests with the JSON null value. By default, fields with empty
  533. // values are omitted from API requests. However, any field with an
  534. // empty value appearing in NullFields will be sent to the server as
  535. // null. It is an error if a field in this list has a non-empty value.
  536. // This may be used to include null fields in Patch requests.
  537. NullFields []string `json:"-"`
  538. }
  539. func (s *Asps) MarshalJSON() ([]byte, error) {
  540. type NoMethod Asps
  541. raw := NoMethod(*s)
  542. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  543. }
  544. // Building: JSON template for Building object in Directory API.
  545. type Building struct {
  546. // BuildingId: Unique identifier for the building. The maximum length is
  547. // 100 characters.
  548. BuildingId string `json:"buildingId,omitempty"`
  549. // BuildingName: The building name as seen by users in Calendar. Must be
  550. // unique for the customer. For example, "NYC-CHEL". The maximum length
  551. // is 100 characters.
  552. BuildingName string `json:"buildingName,omitempty"`
  553. // Coordinates: The geographic coordinates of the center of the
  554. // building, expressed as latitude and longitude in decimal degrees.
  555. Coordinates *BuildingCoordinates `json:"coordinates,omitempty"`
  556. // Description: A brief description of the building. For example,
  557. // "Chelsea Market".
  558. Description string `json:"description,omitempty"`
  559. // Etags: ETag of the resource.
  560. Etags string `json:"etags,omitempty"`
  561. // FloorNames: The display names for all floors in this building. The
  562. // floors are expected to be sorted in ascending order, from lowest
  563. // floor to highest floor. For example, ["B2", "B1", "L", "1", "2",
  564. // "2M", "3", "PH"] Must contain at least one entry.
  565. FloorNames []string `json:"floorNames,omitempty"`
  566. // Kind: Kind of resource this is.
  567. Kind string `json:"kind,omitempty"`
  568. // ServerResponse contains the HTTP response code and headers from the
  569. // server.
  570. googleapi.ServerResponse `json:"-"`
  571. // ForceSendFields is a list of field names (e.g. "BuildingId") to
  572. // unconditionally include in API requests. By default, fields with
  573. // empty values are omitted from API requests. However, any non-pointer,
  574. // non-interface field appearing in ForceSendFields will be sent to the
  575. // server regardless of whether the field is empty or not. This may be
  576. // used to include empty fields in Patch requests.
  577. ForceSendFields []string `json:"-"`
  578. // NullFields is a list of field names (e.g. "BuildingId") to include in
  579. // API requests with the JSON null value. By default, fields with empty
  580. // values are omitted from API requests. However, any field with an
  581. // empty value appearing in NullFields will be sent to the server as
  582. // null. It is an error if a field in this list has a non-empty value.
  583. // This may be used to include null fields in Patch requests.
  584. NullFields []string `json:"-"`
  585. }
  586. func (s *Building) MarshalJSON() ([]byte, error) {
  587. type NoMethod Building
  588. raw := NoMethod(*s)
  589. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  590. }
  591. // BuildingCoordinates: JSON template for coordinates of a building in
  592. // Directory API.
  593. type BuildingCoordinates struct {
  594. // Latitude: Latitude in decimal degrees.
  595. Latitude float64 `json:"latitude,omitempty"`
  596. // Longitude: Longitude in decimal degrees.
  597. Longitude float64 `json:"longitude,omitempty"`
  598. // ForceSendFields is a list of field names (e.g. "Latitude") to
  599. // unconditionally include in API requests. By default, fields with
  600. // empty values are omitted from API requests. However, any non-pointer,
  601. // non-interface field appearing in ForceSendFields will be sent to the
  602. // server regardless of whether the field is empty or not. This may be
  603. // used to include empty fields in Patch requests.
  604. ForceSendFields []string `json:"-"`
  605. // NullFields is a list of field names (e.g. "Latitude") to include in
  606. // API requests with the JSON null value. By default, fields with empty
  607. // values are omitted from API requests. However, any field with an
  608. // empty value appearing in NullFields will be sent to the server as
  609. // null. It is an error if a field in this list has a non-empty value.
  610. // This may be used to include null fields in Patch requests.
  611. NullFields []string `json:"-"`
  612. }
  613. func (s *BuildingCoordinates) MarshalJSON() ([]byte, error) {
  614. type NoMethod BuildingCoordinates
  615. raw := NoMethod(*s)
  616. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  617. }
  618. func (s *BuildingCoordinates) UnmarshalJSON(data []byte) error {
  619. type NoMethod BuildingCoordinates
  620. var s1 struct {
  621. Latitude gensupport.JSONFloat64 `json:"latitude"`
  622. Longitude gensupport.JSONFloat64 `json:"longitude"`
  623. *NoMethod
  624. }
  625. s1.NoMethod = (*NoMethod)(s)
  626. if err := json.Unmarshal(data, &s1); err != nil {
  627. return err
  628. }
  629. s.Latitude = float64(s1.Latitude)
  630. s.Longitude = float64(s1.Longitude)
  631. return nil
  632. }
  633. // Buildings: JSON template for Building List Response object in
  634. // Directory API.
  635. type Buildings struct {
  636. // Buildings: The Buildings in this page of results.
  637. Buildings []*Building `json:"buildings,omitempty"`
  638. // Etag: ETag of the resource.
  639. Etag string `json:"etag,omitempty"`
  640. // Kind: Kind of resource this is.
  641. Kind string `json:"kind,omitempty"`
  642. // NextPageToken: The continuation token, used to page through large
  643. // result sets. Provide this value in a subsequent request to return the
  644. // next page of results.
  645. NextPageToken string `json:"nextPageToken,omitempty"`
  646. // ServerResponse contains the HTTP response code and headers from the
  647. // server.
  648. googleapi.ServerResponse `json:"-"`
  649. // ForceSendFields is a list of field names (e.g. "Buildings") to
  650. // unconditionally include in API requests. By default, fields with
  651. // empty values are omitted from API requests. However, any non-pointer,
  652. // non-interface field appearing in ForceSendFields will be sent to the
  653. // server regardless of whether the field is empty or not. This may be
  654. // used to include empty fields in Patch requests.
  655. ForceSendFields []string `json:"-"`
  656. // NullFields is a list of field names (e.g. "Buildings") to include in
  657. // API requests with the JSON null value. By default, fields with empty
  658. // values are omitted from API requests. However, any field with an
  659. // empty value appearing in NullFields will be sent to the server as
  660. // null. It is an error if a field in this list has a non-empty value.
  661. // This may be used to include null fields in Patch requests.
  662. NullFields []string `json:"-"`
  663. }
  664. func (s *Buildings) MarshalJSON() ([]byte, error) {
  665. type NoMethod Buildings
  666. raw := NoMethod(*s)
  667. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  668. }
  669. // CalendarResource: JSON template for Calendar Resource object in
  670. // Directory API.
  671. type CalendarResource struct {
  672. // BuildingId: Unique ID for the building a resource is located in.
  673. BuildingId string `json:"buildingId,omitempty"`
  674. // Capacity: Capacity of a resource, number of seats in a room.
  675. Capacity int64 `json:"capacity,omitempty"`
  676. // Etags: ETag of the resource.
  677. Etags string `json:"etags,omitempty"`
  678. FeatureInstances interface{} `json:"featureInstances,omitempty"`
  679. // FloorName: Name of the floor a resource is located on.
  680. FloorName string `json:"floorName,omitempty"`
  681. // FloorSection: Name of the section within a floor a resource is
  682. // located in.
  683. FloorSection string `json:"floorSection,omitempty"`
  684. // GeneratedResourceName: The read-only auto-generated name of the
  685. // calendar resource which includes metadata about the resource such as
  686. // building name, floor, capacity, etc. For example, "NYC-2-Training
  687. // Room 1A (16)".
  688. GeneratedResourceName string `json:"generatedResourceName,omitempty"`
  689. // Kind: The type of the resource. For calendar resources, the value is
  690. // admin#directory#resources#calendars#CalendarResource.
  691. Kind string `json:"kind,omitempty"`
  692. // ResourceCategory: The category of the calendar resource. Either
  693. // CONFERENCE_ROOM or OTHER. Legacy data is set to CATEGORY_UNKNOWN.
  694. ResourceCategory string `json:"resourceCategory,omitempty"`
  695. // ResourceDescription: Description of the resource, visible only to
  696. // admins.
  697. ResourceDescription string `json:"resourceDescription,omitempty"`
  698. // ResourceEmail: The read-only email for the calendar resource.
  699. // Generated as part of creating a new calendar resource.
  700. ResourceEmail string `json:"resourceEmail,omitempty"`
  701. // ResourceId: The unique ID for the calendar resource.
  702. ResourceId string `json:"resourceId,omitempty"`
  703. // ResourceName: The name of the calendar resource. For example,
  704. // "Training Room 1A".
  705. ResourceName string `json:"resourceName,omitempty"`
  706. // ResourceType: The type of the calendar resource, intended for
  707. // non-room resources.
  708. ResourceType string `json:"resourceType,omitempty"`
  709. // UserVisibleDescription: Description of the resource, visible to users
  710. // and admins.
  711. UserVisibleDescription string `json:"userVisibleDescription,omitempty"`
  712. // ServerResponse contains the HTTP response code and headers from the
  713. // server.
  714. googleapi.ServerResponse `json:"-"`
  715. // ForceSendFields is a list of field names (e.g. "BuildingId") to
  716. // unconditionally include in API requests. By default, fields with
  717. // empty values are omitted from API requests. However, any non-pointer,
  718. // non-interface field appearing in ForceSendFields will be sent to the
  719. // server regardless of whether the field is empty or not. This may be
  720. // used to include empty fields in Patch requests.
  721. ForceSendFields []string `json:"-"`
  722. // NullFields is a list of field names (e.g. "BuildingId") to include in
  723. // API requests with the JSON null value. By default, fields with empty
  724. // values are omitted from API requests. However, any field with an
  725. // empty value appearing in NullFields will be sent to the server as
  726. // null. It is an error if a field in this list has a non-empty value.
  727. // This may be used to include null fields in Patch requests.
  728. NullFields []string `json:"-"`
  729. }
  730. func (s *CalendarResource) MarshalJSON() ([]byte, error) {
  731. type NoMethod CalendarResource
  732. raw := NoMethod(*s)
  733. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  734. }
  735. // CalendarResources: JSON template for Calendar Resource List Response
  736. // object in Directory API.
  737. type CalendarResources struct {
  738. // Etag: ETag of the resource.
  739. Etag string `json:"etag,omitempty"`
  740. // Items: The CalendarResources in this page of results.
  741. Items []*CalendarResource `json:"items,omitempty"`
  742. // Kind: Identifies this as a collection of CalendarResources. This is
  743. // always admin#directory#resources#calendars#calendarResourcesList.
  744. Kind string `json:"kind,omitempty"`
  745. // NextPageToken: The continuation token, used to page through large
  746. // result sets. Provide this value in a subsequent request to return the
  747. // next page of results.
  748. NextPageToken string `json:"nextPageToken,omitempty"`
  749. // ServerResponse contains the HTTP response code and headers from the
  750. // server.
  751. googleapi.ServerResponse `json:"-"`
  752. // ForceSendFields is a list of field names (e.g. "Etag") to
  753. // unconditionally include in API requests. By default, fields with
  754. // empty values are omitted from API requests. However, any non-pointer,
  755. // non-interface field appearing in ForceSendFields will be sent to the
  756. // server regardless of whether the field is empty or not. This may be
  757. // used to include empty fields in Patch requests.
  758. ForceSendFields []string `json:"-"`
  759. // NullFields is a list of field names (e.g. "Etag") to include in API
  760. // requests with the JSON null value. By default, fields with empty
  761. // values are omitted from API requests. However, any field with an
  762. // empty value appearing in NullFields will be sent to the server as
  763. // null. It is an error if a field in this list has a non-empty value.
  764. // This may be used to include null fields in Patch requests.
  765. NullFields []string `json:"-"`
  766. }
  767. func (s *CalendarResources) MarshalJSON() ([]byte, error) {
  768. type NoMethod CalendarResources
  769. raw := NoMethod(*s)
  770. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  771. }
  772. // Channel: An notification channel used to watch for resource changes.
  773. type Channel struct {
  774. // Address: The address where notifications are delivered for this
  775. // channel.
  776. Address string `json:"address,omitempty"`
  777. // Expiration: Date and time of notification channel expiration,
  778. // expressed as a Unix timestamp, in milliseconds. Optional.
  779. Expiration int64 `json:"expiration,omitempty,string"`
  780. // Id: A UUID or similar unique string that identifies this channel.
  781. Id string `json:"id,omitempty"`
  782. // Kind: Identifies this as a notification channel used to watch for
  783. // changes to a resource. Value: the fixed string "api#channel".
  784. Kind string `json:"kind,omitempty"`
  785. // Params: Additional parameters controlling delivery channel behavior.
  786. // Optional.
  787. Params map[string]string `json:"params,omitempty"`
  788. // Payload: A Boolean value to indicate whether payload is wanted.
  789. // Optional.
  790. Payload bool `json:"payload,omitempty"`
  791. // ResourceId: An opaque ID that identifies the resource being watched
  792. // on this channel. Stable across different API versions.
  793. ResourceId string `json:"resourceId,omitempty"`
  794. // ResourceUri: A version-specific identifier for the watched resource.
  795. ResourceUri string `json:"resourceUri,omitempty"`
  796. // Token: An arbitrary string delivered to the target address with each
  797. // notification delivered over this channel. Optional.
  798. Token string `json:"token,omitempty"`
  799. // Type: The type of delivery mechanism used for this channel.
  800. Type string `json:"type,omitempty"`
  801. // ServerResponse contains the HTTP response code and headers from the
  802. // server.
  803. googleapi.ServerResponse `json:"-"`
  804. // ForceSendFields is a list of field names (e.g. "Address") to
  805. // unconditionally include in API requests. By default, fields with
  806. // empty values are omitted from API requests. However, any non-pointer,
  807. // non-interface field appearing in ForceSendFields will be sent to the
  808. // server regardless of whether the field is empty or not. This may be
  809. // used to include empty fields in Patch requests.
  810. ForceSendFields []string `json:"-"`
  811. // NullFields is a list of field names (e.g. "Address") to include in
  812. // API requests with the JSON null value. By default, fields with empty
  813. // values are omitted from API requests. However, any field with an
  814. // empty value appearing in NullFields will be sent to the server as
  815. // null. It is an error if a field in this list has a non-empty value.
  816. // This may be used to include null fields in Patch requests.
  817. NullFields []string `json:"-"`
  818. }
  819. func (s *Channel) MarshalJSON() ([]byte, error) {
  820. type NoMethod Channel
  821. raw := NoMethod(*s)
  822. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  823. }
  824. // ChromeOsDevice: JSON template for Chrome Os Device resource in
  825. // Directory API.
  826. type ChromeOsDevice struct {
  827. // ActiveTimeRanges: List of active time ranges (Read-only)
  828. ActiveTimeRanges []*ChromeOsDeviceActiveTimeRanges `json:"activeTimeRanges,omitempty"`
  829. // AnnotatedAssetId: AssetId specified during enrollment or through
  830. // later annotation
  831. AnnotatedAssetId string `json:"annotatedAssetId,omitempty"`
  832. // AnnotatedLocation: Address or location of the device as noted by the
  833. // administrator
  834. AnnotatedLocation string `json:"annotatedLocation,omitempty"`
  835. // AnnotatedUser: User of the device
  836. AnnotatedUser string `json:"annotatedUser,omitempty"`
  837. // BootMode: Chromebook boot mode (Read-only)
  838. BootMode string `json:"bootMode,omitempty"`
  839. // DeviceFiles: List of device files to download (Read-only)
  840. DeviceFiles []*ChromeOsDeviceDeviceFiles `json:"deviceFiles,omitempty"`
  841. // DeviceId: Unique identifier of Chrome OS Device (Read-only)
  842. DeviceId string `json:"deviceId,omitempty"`
  843. // Etag: ETag of the resource.
  844. Etag string `json:"etag,omitempty"`
  845. // EthernetMacAddress: Chromebook Mac Address on ethernet network
  846. // interface (Read-only)
  847. EthernetMacAddress string `json:"ethernetMacAddress,omitempty"`
  848. // FirmwareVersion: Chromebook firmware version (Read-only)
  849. FirmwareVersion string `json:"firmwareVersion,omitempty"`
  850. // Kind: Kind of resource this is.
  851. Kind string `json:"kind,omitempty"`
  852. // LastEnrollmentTime: Date and time the device was last enrolled
  853. // (Read-only)
  854. LastEnrollmentTime string `json:"lastEnrollmentTime,omitempty"`
  855. // LastSync: Date and time the device was last synchronized with the
  856. // policy settings in the G Suite administrator control panel
  857. // (Read-only)
  858. LastSync string `json:"lastSync,omitempty"`
  859. // MacAddress: Chromebook Mac Address on wifi network interface
  860. // (Read-only)
  861. MacAddress string `json:"macAddress,omitempty"`
  862. // Meid: Mobile Equipment identifier for the 3G mobile card in the
  863. // Chromebook (Read-only)
  864. Meid string `json:"meid,omitempty"`
  865. // Model: Chromebook Model (Read-only)
  866. Model string `json:"model,omitempty"`
  867. // Notes: Notes added by the administrator
  868. Notes string `json:"notes,omitempty"`
  869. // OrderNumber: Chromebook order number (Read-only)
  870. OrderNumber string `json:"orderNumber,omitempty"`
  871. // OrgUnitPath: OrgUnit of the device
  872. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  873. // OsVersion: Chromebook Os Version (Read-only)
  874. OsVersion string `json:"osVersion,omitempty"`
  875. // PlatformVersion: Chromebook platform version (Read-only)
  876. PlatformVersion string `json:"platformVersion,omitempty"`
  877. // RecentUsers: List of recent device users, in descending order by last
  878. // login time (Read-only)
  879. RecentUsers []*ChromeOsDeviceRecentUsers `json:"recentUsers,omitempty"`
  880. // SerialNumber: Chromebook serial number (Read-only)
  881. SerialNumber string `json:"serialNumber,omitempty"`
  882. // Status: status of the device (Read-only)
  883. Status string `json:"status,omitempty"`
  884. // SupportEndDate: Final date the device will be supported (Read-only)
  885. SupportEndDate string `json:"supportEndDate,omitempty"`
  886. // TpmVersionInfo: Trusted Platform Module (TPM) (Read-only)
  887. TpmVersionInfo *ChromeOsDeviceTpmVersionInfo `json:"tpmVersionInfo,omitempty"`
  888. // WillAutoRenew: Will Chromebook auto renew after support end date
  889. // (Read-only)
  890. WillAutoRenew bool `json:"willAutoRenew,omitempty"`
  891. // ServerResponse contains the HTTP response code and headers from the
  892. // server.
  893. googleapi.ServerResponse `json:"-"`
  894. // ForceSendFields is a list of field names (e.g. "ActiveTimeRanges") to
  895. // unconditionally include in API requests. By default, fields with
  896. // empty values are omitted from API requests. However, any non-pointer,
  897. // non-interface field appearing in ForceSendFields will be sent to the
  898. // server regardless of whether the field is empty or not. This may be
  899. // used to include empty fields in Patch requests.
  900. ForceSendFields []string `json:"-"`
  901. // NullFields is a list of field names (e.g. "ActiveTimeRanges") to
  902. // include in API requests with the JSON null value. By default, fields
  903. // with empty values are omitted from API requests. However, any field
  904. // with an empty value appearing in NullFields will be sent to the
  905. // server as null. It is an error if a field in this list has a
  906. // non-empty value. This may be used to include null fields in Patch
  907. // requests.
  908. NullFields []string `json:"-"`
  909. }
  910. func (s *ChromeOsDevice) MarshalJSON() ([]byte, error) {
  911. type NoMethod ChromeOsDevice
  912. raw := NoMethod(*s)
  913. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  914. }
  915. type ChromeOsDeviceActiveTimeRanges struct {
  916. // ActiveTime: Duration in milliseconds
  917. ActiveTime int64 `json:"activeTime,omitempty"`
  918. // Date: Date of usage
  919. Date string `json:"date,omitempty"`
  920. // ForceSendFields is a list of field names (e.g. "ActiveTime") to
  921. // unconditionally include in API requests. By default, fields with
  922. // empty values are omitted from API requests. However, any non-pointer,
  923. // non-interface field appearing in ForceSendFields will be sent to the
  924. // server regardless of whether the field is empty or not. This may be
  925. // used to include empty fields in Patch requests.
  926. ForceSendFields []string `json:"-"`
  927. // NullFields is a list of field names (e.g. "ActiveTime") to include in
  928. // API requests with the JSON null value. By default, fields with empty
  929. // values are omitted from API requests. However, any field with an
  930. // empty value appearing in NullFields will be sent to the server as
  931. // null. It is an error if a field in this list has a non-empty value.
  932. // This may be used to include null fields in Patch requests.
  933. NullFields []string `json:"-"`
  934. }
  935. func (s *ChromeOsDeviceActiveTimeRanges) MarshalJSON() ([]byte, error) {
  936. type NoMethod ChromeOsDeviceActiveTimeRanges
  937. raw := NoMethod(*s)
  938. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  939. }
  940. type ChromeOsDeviceDeviceFiles struct {
  941. // CreateTime: Date and time the file was created
  942. CreateTime string `json:"createTime,omitempty"`
  943. // DownloadUrl: File download URL
  944. DownloadUrl string `json:"downloadUrl,omitempty"`
  945. // Name: File name
  946. Name string `json:"name,omitempty"`
  947. // Type: File type
  948. Type string `json:"type,omitempty"`
  949. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  950. // unconditionally include in API requests. By default, fields with
  951. // empty values are omitted from API requests. However, any non-pointer,
  952. // non-interface field appearing in ForceSendFields will be sent to the
  953. // server regardless of whether the field is empty or not. This may be
  954. // used to include empty fields in Patch requests.
  955. ForceSendFields []string `json:"-"`
  956. // NullFields is a list of field names (e.g. "CreateTime") to include in
  957. // API requests with the JSON null value. By default, fields with empty
  958. // values are omitted from API requests. However, any field with an
  959. // empty value appearing in NullFields will be sent to the server as
  960. // null. It is an error if a field in this list has a non-empty value.
  961. // This may be used to include null fields in Patch requests.
  962. NullFields []string `json:"-"`
  963. }
  964. func (s *ChromeOsDeviceDeviceFiles) MarshalJSON() ([]byte, error) {
  965. type NoMethod ChromeOsDeviceDeviceFiles
  966. raw := NoMethod(*s)
  967. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  968. }
  969. type ChromeOsDeviceRecentUsers struct {
  970. // Email: Email address of the user. Present only if the user type is
  971. // managed
  972. Email string `json:"email,omitempty"`
  973. // Type: The type of the user
  974. Type string `json:"type,omitempty"`
  975. // ForceSendFields is a list of field names (e.g. "Email") to
  976. // unconditionally include in API requests. By default, fields with
  977. // empty values are omitted from API requests. However, any non-pointer,
  978. // non-interface field appearing in ForceSendFields will be sent to the
  979. // server regardless of whether the field is empty or not. This may be
  980. // used to include empty fields in Patch requests.
  981. ForceSendFields []string `json:"-"`
  982. // NullFields is a list of field names (e.g. "Email") to include in API
  983. // requests with the JSON null value. By default, fields with empty
  984. // values are omitted from API requests. However, any field with an
  985. // empty value appearing in NullFields will be sent to the server as
  986. // null. It is an error if a field in this list has a non-empty value.
  987. // This may be used to include null fields in Patch requests.
  988. NullFields []string `json:"-"`
  989. }
  990. func (s *ChromeOsDeviceRecentUsers) MarshalJSON() ([]byte, error) {
  991. type NoMethod ChromeOsDeviceRecentUsers
  992. raw := NoMethod(*s)
  993. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  994. }
  995. // ChromeOsDeviceTpmVersionInfo: Trusted Platform Module (TPM)
  996. // (Read-only)
  997. type ChromeOsDeviceTpmVersionInfo struct {
  998. // Family: TPM family.
  999. Family string `json:"family,omitempty"`
  1000. // FirmwareVersion: TPM firmware version.
  1001. FirmwareVersion string `json:"firmwareVersion,omitempty"`
  1002. // Manufacturer: TPM manufacturer code.
  1003. Manufacturer string `json:"manufacturer,omitempty"`
  1004. // SpecLevel: TPM specification level.
  1005. SpecLevel string `json:"specLevel,omitempty"`
  1006. // TpmModel: TPM model number.
  1007. TpmModel string `json:"tpmModel,omitempty"`
  1008. // VendorSpecific: Vendor-specific information such as Vendor ID.
  1009. VendorSpecific string `json:"vendorSpecific,omitempty"`
  1010. // ForceSendFields is a list of field names (e.g. "Family") to
  1011. // unconditionally include in API requests. By default, fields with
  1012. // empty values are omitted from API requests. However, any non-pointer,
  1013. // non-interface field appearing in ForceSendFields will be sent to the
  1014. // server regardless of whether the field is empty or not. This may be
  1015. // used to include empty fields in Patch requests.
  1016. ForceSendFields []string `json:"-"`
  1017. // NullFields is a list of field names (e.g. "Family") to include in API
  1018. // requests with the JSON null value. By default, fields with empty
  1019. // values are omitted from API requests. However, any field with an
  1020. // empty value appearing in NullFields will be sent to the server as
  1021. // null. It is an error if a field in this list has a non-empty value.
  1022. // This may be used to include null fields in Patch requests.
  1023. NullFields []string `json:"-"`
  1024. }
  1025. func (s *ChromeOsDeviceTpmVersionInfo) MarshalJSON() ([]byte, error) {
  1026. type NoMethod ChromeOsDeviceTpmVersionInfo
  1027. raw := NoMethod(*s)
  1028. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1029. }
  1030. // ChromeOsDeviceAction: JSON request template for firing actions on
  1031. // ChromeOs Device in Directory Devices API.
  1032. type ChromeOsDeviceAction struct {
  1033. // Action: Action to be taken on the ChromeOs Device
  1034. Action string `json:"action,omitempty"`
  1035. DeprovisionReason string `json:"deprovisionReason,omitempty"`
  1036. // ForceSendFields is a list of field names (e.g. "Action") to
  1037. // unconditionally include in API requests. By default, fields with
  1038. // empty values are omitted from API requests. However, any non-pointer,
  1039. // non-interface field appearing in ForceSendFields will be sent to the
  1040. // server regardless of whether the field is empty or not. This may be
  1041. // used to include empty fields in Patch requests.
  1042. ForceSendFields []string `json:"-"`
  1043. // NullFields is a list of field names (e.g. "Action") to include in API
  1044. // requests with the JSON null value. By default, fields with empty
  1045. // values are omitted from API requests. However, any field with an
  1046. // empty value appearing in NullFields will be sent to the server as
  1047. // null. It is an error if a field in this list has a non-empty value.
  1048. // This may be used to include null fields in Patch requests.
  1049. NullFields []string `json:"-"`
  1050. }
  1051. func (s *ChromeOsDeviceAction) MarshalJSON() ([]byte, error) {
  1052. type NoMethod ChromeOsDeviceAction
  1053. raw := NoMethod(*s)
  1054. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1055. }
  1056. // ChromeOsDevices: JSON response template for List Chrome OS Devices
  1057. // operation in Directory API.
  1058. type ChromeOsDevices struct {
  1059. // Chromeosdevices: List of Chrome OS Device objects.
  1060. Chromeosdevices []*ChromeOsDevice `json:"chromeosdevices,omitempty"`
  1061. // Etag: ETag of the resource.
  1062. Etag string `json:"etag,omitempty"`
  1063. // Kind: Kind of resource this is.
  1064. Kind string `json:"kind,omitempty"`
  1065. // NextPageToken: Token used to access next page of this result.
  1066. NextPageToken string `json:"nextPageToken,omitempty"`
  1067. // ServerResponse contains the HTTP response code and headers from the
  1068. // server.
  1069. googleapi.ServerResponse `json:"-"`
  1070. // ForceSendFields is a list of field names (e.g. "Chromeosdevices") to
  1071. // unconditionally include in API requests. By default, fields with
  1072. // empty values are omitted from API requests. However, any non-pointer,
  1073. // non-interface field appearing in ForceSendFields will be sent to the
  1074. // server regardless of whether the field is empty or not. This may be
  1075. // used to include empty fields in Patch requests.
  1076. ForceSendFields []string `json:"-"`
  1077. // NullFields is a list of field names (e.g. "Chromeosdevices") to
  1078. // include in API requests with the JSON null value. By default, fields
  1079. // with empty values are omitted from API requests. However, any field
  1080. // with an empty value appearing in NullFields will be sent to the
  1081. // server as null. It is an error if a field in this list has a
  1082. // non-empty value. This may be used to include null fields in Patch
  1083. // requests.
  1084. NullFields []string `json:"-"`
  1085. }
  1086. func (s *ChromeOsDevices) MarshalJSON() ([]byte, error) {
  1087. type NoMethod ChromeOsDevices
  1088. raw := NoMethod(*s)
  1089. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1090. }
  1091. // ChromeOsMoveDevicesToOu: JSON request template for moving ChromeOs
  1092. // Device to given OU in Directory Devices API.
  1093. type ChromeOsMoveDevicesToOu struct {
  1094. // DeviceIds: ChromeOs Devices to be moved to OU
  1095. DeviceIds []string `json:"deviceIds,omitempty"`
  1096. // ForceSendFields is a list of field names (e.g. "DeviceIds") to
  1097. // unconditionally include in API requests. By default, fields with
  1098. // empty values are omitted from API requests. However, any non-pointer,
  1099. // non-interface field appearing in ForceSendFields will be sent to the
  1100. // server regardless of whether the field is empty or not. This may be
  1101. // used to include empty fields in Patch requests.
  1102. ForceSendFields []string `json:"-"`
  1103. // NullFields is a list of field names (e.g. "DeviceIds") to include in
  1104. // API requests with the JSON null value. By default, fields with empty
  1105. // values are omitted from API requests. However, any field with an
  1106. // empty value appearing in NullFields will be sent to the server as
  1107. // null. It is an error if a field in this list has a non-empty value.
  1108. // This may be used to include null fields in Patch requests.
  1109. NullFields []string `json:"-"`
  1110. }
  1111. func (s *ChromeOsMoveDevicesToOu) MarshalJSON() ([]byte, error) {
  1112. type NoMethod ChromeOsMoveDevicesToOu
  1113. raw := NoMethod(*s)
  1114. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1115. }
  1116. // Customer: JSON template for Customer Resource object in Directory
  1117. // API.
  1118. type Customer struct {
  1119. // AlternateEmail: The customer's secondary contact email address. This
  1120. // email address cannot be on the same domain as the customerDomain
  1121. AlternateEmail string `json:"alternateEmail,omitempty"`
  1122. // CustomerCreationTime: The customer's creation time (Readonly)
  1123. CustomerCreationTime string `json:"customerCreationTime,omitempty"`
  1124. // CustomerDomain: The customer's primary domain name string. Do not
  1125. // include the www prefix when creating a new customer.
  1126. CustomerDomain string `json:"customerDomain,omitempty"`
  1127. // Etag: ETag of the resource.
  1128. Etag string `json:"etag,omitempty"`
  1129. // Id: The unique ID for the customer's G Suite account. (Readonly)
  1130. Id string `json:"id,omitempty"`
  1131. // Kind: Identifies the resource as a customer. Value:
  1132. // admin#directory#customer
  1133. Kind string `json:"kind,omitempty"`
  1134. // Language: The customer's ISO 639-2 language code. The default value
  1135. // is en-US
  1136. Language string `json:"language,omitempty"`
  1137. // PhoneNumber: The customer's contact phone number in E.164 format.
  1138. PhoneNumber string `json:"phoneNumber,omitempty"`
  1139. // PostalAddress: The customer's postal address information.
  1140. PostalAddress *CustomerPostalAddress `json:"postalAddress,omitempty"`
  1141. // ServerResponse contains the HTTP response code and headers from the
  1142. // server.
  1143. googleapi.ServerResponse `json:"-"`
  1144. // ForceSendFields is a list of field names (e.g. "AlternateEmail") to
  1145. // unconditionally include in API requests. By default, fields with
  1146. // empty values are omitted from API requests. However, any non-pointer,
  1147. // non-interface field appearing in ForceSendFields will be sent to the
  1148. // server regardless of whether the field is empty or not. This may be
  1149. // used to include empty fields in Patch requests.
  1150. ForceSendFields []string `json:"-"`
  1151. // NullFields is a list of field names (e.g. "AlternateEmail") to
  1152. // include in API requests with the JSON null value. By default, fields
  1153. // with empty values are omitted from API requests. However, any field
  1154. // with an empty value appearing in NullFields will be sent to the
  1155. // server as null. It is an error if a field in this list has a
  1156. // non-empty value. This may be used to include null fields in Patch
  1157. // requests.
  1158. NullFields []string `json:"-"`
  1159. }
  1160. func (s *Customer) MarshalJSON() ([]byte, error) {
  1161. type NoMethod Customer
  1162. raw := NoMethod(*s)
  1163. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1164. }
  1165. // CustomerPostalAddress: JSON template for postal address of a
  1166. // customer.
  1167. type CustomerPostalAddress struct {
  1168. // AddressLine1: A customer's physical address. The address can be
  1169. // composed of one to three lines.
  1170. AddressLine1 string `json:"addressLine1,omitempty"`
  1171. // AddressLine2: Address line 2 of the address.
  1172. AddressLine2 string `json:"addressLine2,omitempty"`
  1173. // AddressLine3: Address line 3 of the address.
  1174. AddressLine3 string `json:"addressLine3,omitempty"`
  1175. // ContactName: The customer contact's name.
  1176. ContactName string `json:"contactName,omitempty"`
  1177. // CountryCode: This is a required property. For countryCode information
  1178. // see the ISO 3166 country code elements.
  1179. CountryCode string `json:"countryCode,omitempty"`
  1180. // Locality: Name of the locality. An example of a locality value is the
  1181. // city of San Francisco.
  1182. Locality string `json:"locality,omitempty"`
  1183. // OrganizationName: The company or company division name.
  1184. OrganizationName string `json:"organizationName,omitempty"`
  1185. // PostalCode: The postal code. A postalCode example is a postal zip
  1186. // code such as 10009. This is in accordance with -
  1187. // http://portablecontacts.net/draft-spec.html#address_element.
  1188. PostalCode string `json:"postalCode,omitempty"`
  1189. // Region: Name of the region. An example of a region value is NY for
  1190. // the state of New York.
  1191. Region string `json:"region,omitempty"`
  1192. // ForceSendFields is a list of field names (e.g. "AddressLine1") to
  1193. // unconditionally include in API requests. By default, fields with
  1194. // empty values are omitted from API requests. However, any non-pointer,
  1195. // non-interface field appearing in ForceSendFields will be sent to the
  1196. // server regardless of whether the field is empty or not. This may be
  1197. // used to include empty fields in Patch requests.
  1198. ForceSendFields []string `json:"-"`
  1199. // NullFields is a list of field names (e.g. "AddressLine1") to include
  1200. // in API requests with the JSON null value. By default, fields with
  1201. // empty values are omitted from API requests. However, any field with
  1202. // an empty value appearing in NullFields will be sent to the server as
  1203. // null. It is an error if a field in this list has a non-empty value.
  1204. // This may be used to include null fields in Patch requests.
  1205. NullFields []string `json:"-"`
  1206. }
  1207. func (s *CustomerPostalAddress) MarshalJSON() ([]byte, error) {
  1208. type NoMethod CustomerPostalAddress
  1209. raw := NoMethod(*s)
  1210. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1211. }
  1212. // DomainAlias: JSON template for Domain Alias object in Directory API.
  1213. type DomainAlias struct {
  1214. // CreationTime: The creation time of the domain alias. (Read-only).
  1215. CreationTime int64 `json:"creationTime,omitempty,string"`
  1216. // DomainAliasName: The domain alias name.
  1217. DomainAliasName string `json:"domainAliasName,omitempty"`
  1218. // Etag: ETag of the resource.
  1219. Etag string `json:"etag,omitempty"`
  1220. // Kind: Kind of resource this is.
  1221. Kind string `json:"kind,omitempty"`
  1222. // ParentDomainName: The parent domain name that the domain alias is
  1223. // associated with. This can either be a primary or secondary domain
  1224. // name within a customer.
  1225. ParentDomainName string `json:"parentDomainName,omitempty"`
  1226. // Verified: Indicates the verification state of a domain alias.
  1227. // (Read-only)
  1228. Verified bool `json:"verified,omitempty"`
  1229. // ServerResponse contains the HTTP response code and headers from the
  1230. // server.
  1231. googleapi.ServerResponse `json:"-"`
  1232. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1233. // unconditionally include in API requests. By default, fields with
  1234. // empty values are omitted from API requests. However, any non-pointer,
  1235. // non-interface field appearing in ForceSendFields will be sent to the
  1236. // server regardless of whether the field is empty or not. This may be
  1237. // used to include empty fields in Patch requests.
  1238. ForceSendFields []string `json:"-"`
  1239. // NullFields is a list of field names (e.g. "CreationTime") to include
  1240. // in API requests with the JSON null value. By default, fields with
  1241. // empty values are omitted from API requests. However, any field with
  1242. // an empty value appearing in NullFields will be sent to the server as
  1243. // null. It is an error if a field in this list has a non-empty value.
  1244. // This may be used to include null fields in Patch requests.
  1245. NullFields []string `json:"-"`
  1246. }
  1247. func (s *DomainAlias) MarshalJSON() ([]byte, error) {
  1248. type NoMethod DomainAlias
  1249. raw := NoMethod(*s)
  1250. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1251. }
  1252. // DomainAliases: JSON response template to list domain aliases in
  1253. // Directory API.
  1254. type DomainAliases struct {
  1255. // DomainAliases: List of domain alias objects.
  1256. DomainAliases []*DomainAlias `json:"domainAliases,omitempty"`
  1257. // Etag: ETag of the resource.
  1258. Etag string `json:"etag,omitempty"`
  1259. // Kind: Kind of resource this is.
  1260. Kind string `json:"kind,omitempty"`
  1261. // ServerResponse contains the HTTP response code and headers from the
  1262. // server.
  1263. googleapi.ServerResponse `json:"-"`
  1264. // ForceSendFields is a list of field names (e.g. "DomainAliases") to
  1265. // unconditionally include in API requests. By default, fields with
  1266. // empty values are omitted from API requests. However, any non-pointer,
  1267. // non-interface field appearing in ForceSendFields will be sent to the
  1268. // server regardless of whether the field is empty or not. This may be
  1269. // used to include empty fields in Patch requests.
  1270. ForceSendFields []string `json:"-"`
  1271. // NullFields is a list of field names (e.g. "DomainAliases") to include
  1272. // in API requests with the JSON null value. By default, fields with
  1273. // empty values are omitted from API requests. However, any field with
  1274. // an empty value appearing in NullFields will be sent to the server as
  1275. // null. It is an error if a field in this list has a non-empty value.
  1276. // This may be used to include null fields in Patch requests.
  1277. NullFields []string `json:"-"`
  1278. }
  1279. func (s *DomainAliases) MarshalJSON() ([]byte, error) {
  1280. type NoMethod DomainAliases
  1281. raw := NoMethod(*s)
  1282. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1283. }
  1284. // Domains: JSON template for Domain object in Directory API.
  1285. type Domains struct {
  1286. // CreationTime: Creation time of the domain. (Read-only).
  1287. CreationTime int64 `json:"creationTime,omitempty,string"`
  1288. // DomainAliases: List of domain alias objects. (Read-only)
  1289. DomainAliases []*DomainAlias `json:"domainAliases,omitempty"`
  1290. // DomainName: The domain name of the customer.
  1291. DomainName string `json:"domainName,omitempty"`
  1292. // Etag: ETag of the resource.
  1293. Etag string `json:"etag,omitempty"`
  1294. // IsPrimary: Indicates if the domain is a primary domain (Read-only).
  1295. IsPrimary bool `json:"isPrimary,omitempty"`
  1296. // Kind: Kind of resource this is.
  1297. Kind string `json:"kind,omitempty"`
  1298. // Verified: Indicates the verification state of a domain. (Read-only).
  1299. Verified bool `json:"verified,omitempty"`
  1300. // ServerResponse contains the HTTP response code and headers from the
  1301. // server.
  1302. googleapi.ServerResponse `json:"-"`
  1303. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1304. // unconditionally include in API requests. By default, fields with
  1305. // empty values are omitted from API requests. However, any non-pointer,
  1306. // non-interface field appearing in ForceSendFields will be sent to the
  1307. // server regardless of whether the field is empty or not. This may be
  1308. // used to include empty fields in Patch requests.
  1309. ForceSendFields []string `json:"-"`
  1310. // NullFields is a list of field names (e.g. "CreationTime") to include
  1311. // in API requests with the JSON null value. By default, fields with
  1312. // empty values are omitted from API requests. However, any field with
  1313. // an empty value appearing in NullFields will be sent to the server as
  1314. // null. It is an error if a field in this list has a non-empty value.
  1315. // This may be used to include null fields in Patch requests.
  1316. NullFields []string `json:"-"`
  1317. }
  1318. func (s *Domains) MarshalJSON() ([]byte, error) {
  1319. type NoMethod Domains
  1320. raw := NoMethod(*s)
  1321. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1322. }
  1323. // Domains2: JSON response template to list Domains in Directory API.
  1324. type Domains2 struct {
  1325. // Domains: List of domain objects.
  1326. Domains []*Domains `json:"domains,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. // ServerResponse contains the HTTP response code and headers from the
  1332. // server.
  1333. googleapi.ServerResponse `json:"-"`
  1334. // ForceSendFields is a list of field names (e.g. "Domains") to
  1335. // unconditionally include in API requests. By default, fields with
  1336. // empty values are omitted from API requests. However, any non-pointer,
  1337. // non-interface field appearing in ForceSendFields will be sent to the
  1338. // server regardless of whether the field is empty or not. This may be
  1339. // used to include empty fields in Patch requests.
  1340. ForceSendFields []string `json:"-"`
  1341. // NullFields is a list of field names (e.g. "Domains") to include in
  1342. // API requests with the JSON null value. By default, fields with empty
  1343. // values are omitted from API requests. However, any field with an
  1344. // empty value appearing in NullFields will be sent to the server as
  1345. // null. It is an error if a field in this list has a non-empty value.
  1346. // This may be used to include null fields in Patch requests.
  1347. NullFields []string `json:"-"`
  1348. }
  1349. func (s *Domains2) MarshalJSON() ([]byte, error) {
  1350. type NoMethod Domains2
  1351. raw := NoMethod(*s)
  1352. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1353. }
  1354. // Feature: JSON template for Feature object in Directory API.
  1355. type Feature struct {
  1356. // Etags: ETag of the resource.
  1357. Etags string `json:"etags,omitempty"`
  1358. // Kind: Kind of resource this is.
  1359. Kind string `json:"kind,omitempty"`
  1360. // Name: The name of the feature.
  1361. Name string `json:"name,omitempty"`
  1362. // ServerResponse contains the HTTP response code and headers from the
  1363. // server.
  1364. googleapi.ServerResponse `json:"-"`
  1365. // ForceSendFields is a list of field names (e.g. "Etags") to
  1366. // unconditionally include in API requests. By default, fields with
  1367. // empty values are omitted from API requests. However, any non-pointer,
  1368. // non-interface field appearing in ForceSendFields will be sent to the
  1369. // server regardless of whether the field is empty or not. This may be
  1370. // used to include empty fields in Patch requests.
  1371. ForceSendFields []string `json:"-"`
  1372. // NullFields is a list of field names (e.g. "Etags") to include in API
  1373. // requests with the JSON null value. By default, fields with empty
  1374. // values are omitted from API requests. However, any field with an
  1375. // empty value appearing in NullFields will be sent to the server as
  1376. // null. It is an error if a field in this list has a non-empty value.
  1377. // This may be used to include null fields in Patch requests.
  1378. NullFields []string `json:"-"`
  1379. }
  1380. func (s *Feature) MarshalJSON() ([]byte, error) {
  1381. type NoMethod Feature
  1382. raw := NoMethod(*s)
  1383. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1384. }
  1385. // FeatureInstance: JSON template for a "feature instance".
  1386. type FeatureInstance struct {
  1387. // Feature: The feature that this is an instance of. A calendar resource
  1388. // may have multiple instances of a feature.
  1389. Feature *Feature `json:"feature,omitempty"`
  1390. // ForceSendFields is a list of field names (e.g. "Feature") to
  1391. // unconditionally include in API requests. By default, fields with
  1392. // empty values are omitted from API requests. However, any non-pointer,
  1393. // non-interface field appearing in ForceSendFields will be sent to the
  1394. // server regardless of whether the field is empty or not. This may be
  1395. // used to include empty fields in Patch requests.
  1396. ForceSendFields []string `json:"-"`
  1397. // NullFields is a list of field names (e.g. "Feature") to include in
  1398. // API requests with the JSON null value. By default, fields with empty
  1399. // values are omitted from API requests. However, any field with an
  1400. // empty value appearing in NullFields will be sent to the server as
  1401. // null. It is an error if a field in this list has a non-empty value.
  1402. // This may be used to include null fields in Patch requests.
  1403. NullFields []string `json:"-"`
  1404. }
  1405. func (s *FeatureInstance) MarshalJSON() ([]byte, error) {
  1406. type NoMethod FeatureInstance
  1407. raw := NoMethod(*s)
  1408. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1409. }
  1410. // FeatureRename: JSON request template for renaming a feature.
  1411. type FeatureRename struct {
  1412. // NewName: New name of the feature.
  1413. NewName string `json:"newName,omitempty"`
  1414. // ForceSendFields is a list of field names (e.g. "NewName") to
  1415. // unconditionally include in API requests. By default, fields with
  1416. // empty values are omitted from API requests. However, any non-pointer,
  1417. // non-interface field appearing in ForceSendFields will be sent to the
  1418. // server regardless of whether the field is empty or not. This may be
  1419. // used to include empty fields in Patch requests.
  1420. ForceSendFields []string `json:"-"`
  1421. // NullFields is a list of field names (e.g. "NewName") to include in
  1422. // API requests with the JSON null value. By default, fields with empty
  1423. // values are omitted from API requests. However, any field with an
  1424. // empty value appearing in NullFields will be sent to the server as
  1425. // null. It is an error if a field in this list has a non-empty value.
  1426. // This may be used to include null fields in Patch requests.
  1427. NullFields []string `json:"-"`
  1428. }
  1429. func (s *FeatureRename) MarshalJSON() ([]byte, error) {
  1430. type NoMethod FeatureRename
  1431. raw := NoMethod(*s)
  1432. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1433. }
  1434. // Features: JSON template for Feature List Response object in Directory
  1435. // API.
  1436. type Features struct {
  1437. // Etag: ETag of the resource.
  1438. Etag string `json:"etag,omitempty"`
  1439. // Features: The Features in this page of results.
  1440. Features []*Feature `json:"features,omitempty"`
  1441. // Kind: Kind of resource this is.
  1442. Kind string `json:"kind,omitempty"`
  1443. // NextPageToken: The continuation token, used to page through large
  1444. // result sets. Provide this value in a subsequent request to return the
  1445. // next page of results.
  1446. NextPageToken string `json:"nextPageToken,omitempty"`
  1447. // ServerResponse contains the HTTP response code and headers from the
  1448. // server.
  1449. googleapi.ServerResponse `json:"-"`
  1450. // ForceSendFields is a list of field names (e.g. "Etag") to
  1451. // unconditionally include in API requests. By default, fields with
  1452. // empty values are omitted from API requests. However, any non-pointer,
  1453. // non-interface field appearing in ForceSendFields will be sent to the
  1454. // server regardless of whether the field is empty or not. This may be
  1455. // used to include empty fields in Patch requests.
  1456. ForceSendFields []string `json:"-"`
  1457. // NullFields is a list of field names (e.g. "Etag") to include in API
  1458. // requests with the JSON null value. By default, fields with empty
  1459. // values are omitted from API requests. However, any field with an
  1460. // empty value appearing in NullFields will be sent to the server as
  1461. // null. It is an error if a field in this list has a non-empty value.
  1462. // This may be used to include null fields in Patch requests.
  1463. NullFields []string `json:"-"`
  1464. }
  1465. func (s *Features) MarshalJSON() ([]byte, error) {
  1466. type NoMethod Features
  1467. raw := NoMethod(*s)
  1468. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1469. }
  1470. // Group: JSON template for Group resource in Directory API.
  1471. type Group struct {
  1472. // AdminCreated: Is the group created by admin (Read-only) *
  1473. AdminCreated bool `json:"adminCreated,omitempty"`
  1474. // Aliases: List of aliases (Read-only)
  1475. Aliases []string `json:"aliases,omitempty"`
  1476. // Description: Description of the group
  1477. Description string `json:"description,omitempty"`
  1478. // DirectMembersCount: Group direct members count
  1479. DirectMembersCount int64 `json:"directMembersCount,omitempty,string"`
  1480. // Email: Email of Group
  1481. Email string `json:"email,omitempty"`
  1482. // Etag: ETag of the resource.
  1483. Etag string `json:"etag,omitempty"`
  1484. // Id: Unique identifier of Group (Read-only)
  1485. Id string `json:"id,omitempty"`
  1486. // Kind: Kind of resource this is.
  1487. Kind string `json:"kind,omitempty"`
  1488. // Name: Group name
  1489. Name string `json:"name,omitempty"`
  1490. // NonEditableAliases: List of non editable aliases (Read-only)
  1491. NonEditableAliases []string `json:"nonEditableAliases,omitempty"`
  1492. // ServerResponse contains the HTTP response code and headers from the
  1493. // server.
  1494. googleapi.ServerResponse `json:"-"`
  1495. // ForceSendFields is a list of field names (e.g. "AdminCreated") to
  1496. // unconditionally include in API requests. By default, fields with
  1497. // empty values are omitted from API requests. However, any non-pointer,
  1498. // non-interface field appearing in ForceSendFields will be sent to the
  1499. // server regardless of whether the field is empty or not. This may be
  1500. // used to include empty fields in Patch requests.
  1501. ForceSendFields []string `json:"-"`
  1502. // NullFields is a list of field names (e.g. "AdminCreated") to include
  1503. // in API requests with the JSON null value. By default, fields with
  1504. // empty values are omitted from API requests. However, any field with
  1505. // an empty value appearing in NullFields will be sent to the server as
  1506. // null. It is an error if a field in this list has a non-empty value.
  1507. // This may be used to include null fields in Patch requests.
  1508. NullFields []string `json:"-"`
  1509. }
  1510. func (s *Group) MarshalJSON() ([]byte, error) {
  1511. type NoMethod Group
  1512. raw := NoMethod(*s)
  1513. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1514. }
  1515. // Groups: JSON response template for List Groups operation in Directory
  1516. // API.
  1517. type Groups struct {
  1518. // Etag: ETag of the resource.
  1519. Etag string `json:"etag,omitempty"`
  1520. // Groups: List of group objects.
  1521. Groups []*Group `json:"groups,omitempty"`
  1522. // Kind: Kind of resource this is.
  1523. Kind string `json:"kind,omitempty"`
  1524. // NextPageToken: Token used to access next page of this result.
  1525. NextPageToken string `json:"nextPageToken,omitempty"`
  1526. // ServerResponse contains the HTTP response code and headers from the
  1527. // server.
  1528. googleapi.ServerResponse `json:"-"`
  1529. // ForceSendFields is a list of field names (e.g. "Etag") to
  1530. // unconditionally include in API requests. By default, fields with
  1531. // empty values are omitted from API requests. However, any non-pointer,
  1532. // non-interface field appearing in ForceSendFields will be sent to the
  1533. // server regardless of whether the field is empty or not. This may be
  1534. // used to include empty fields in Patch requests.
  1535. ForceSendFields []string `json:"-"`
  1536. // NullFields is a list of field names (e.g. "Etag") to include in API
  1537. // requests with the JSON null value. By default, fields with empty
  1538. // values are omitted from API requests. However, any field with an
  1539. // empty value appearing in NullFields will be sent to the server as
  1540. // null. It is an error if a field in this list has a non-empty value.
  1541. // This may be used to include null fields in Patch requests.
  1542. NullFields []string `json:"-"`
  1543. }
  1544. func (s *Groups) MarshalJSON() ([]byte, error) {
  1545. type NoMethod Groups
  1546. raw := NoMethod(*s)
  1547. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1548. }
  1549. // Member: JSON template for Member resource in Directory API.
  1550. type Member struct {
  1551. // Email: Email of member (Read-only)
  1552. Email string `json:"email,omitempty"`
  1553. // Etag: ETag of the resource.
  1554. Etag string `json:"etag,omitempty"`
  1555. // Id: Unique identifier of customer member (Read-only) Unique
  1556. // identifier of group (Read-only) Unique identifier of member
  1557. // (Read-only)
  1558. Id string `json:"id,omitempty"`
  1559. // Kind: Kind of resource this is.
  1560. Kind string `json:"kind,omitempty"`
  1561. // Role: Role of member
  1562. Role string `json:"role,omitempty"`
  1563. // Status: Status of member (Immutable)
  1564. Status string `json:"status,omitempty"`
  1565. // Type: Type of member (Immutable)
  1566. Type string `json:"type,omitempty"`
  1567. // ServerResponse contains the HTTP response code and headers from the
  1568. // server.
  1569. googleapi.ServerResponse `json:"-"`
  1570. // ForceSendFields is a list of field names (e.g. "Email") to
  1571. // unconditionally include in API requests. By default, fields with
  1572. // empty values are omitted from API requests. However, any non-pointer,
  1573. // non-interface field appearing in ForceSendFields will be sent to the
  1574. // server regardless of whether the field is empty or not. This may be
  1575. // used to include empty fields in Patch requests.
  1576. ForceSendFields []string `json:"-"`
  1577. // NullFields is a list of field names (e.g. "Email") to include in API
  1578. // requests with the JSON null value. By default, fields with empty
  1579. // values are omitted from API requests. However, any field with an
  1580. // empty value appearing in NullFields will be sent to the server as
  1581. // null. It is an error if a field in this list has a non-empty value.
  1582. // This may be used to include null fields in Patch requests.
  1583. NullFields []string `json:"-"`
  1584. }
  1585. func (s *Member) MarshalJSON() ([]byte, error) {
  1586. type NoMethod Member
  1587. raw := NoMethod(*s)
  1588. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1589. }
  1590. // Members: JSON response template for List Members operation in
  1591. // Directory API.
  1592. type Members struct {
  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. // Members: List of member objects.
  1598. Members []*Member `json:"members,omitempty"`
  1599. // NextPageToken: Token used to access next page of this result.
  1600. NextPageToken string `json:"nextPageToken,omitempty"`
  1601. // ServerResponse contains the HTTP response code and headers from the
  1602. // server.
  1603. googleapi.ServerResponse `json:"-"`
  1604. // ForceSendFields is a list of field names (e.g. "Etag") to
  1605. // unconditionally include in API requests. By default, fields with
  1606. // empty values are omitted from API requests. However, any non-pointer,
  1607. // non-interface field appearing in ForceSendFields will be sent to the
  1608. // server regardless of whether the field is empty or not. This may be
  1609. // used to include empty fields in Patch requests.
  1610. ForceSendFields []string `json:"-"`
  1611. // NullFields is a list of field names (e.g. "Etag") to include in API
  1612. // requests with the JSON null value. By default, fields with empty
  1613. // values are omitted from API requests. However, any field with an
  1614. // empty value appearing in NullFields will be sent to the server as
  1615. // null. It is an error if a field in this list has a non-empty value.
  1616. // This may be used to include null fields in Patch requests.
  1617. NullFields []string `json:"-"`
  1618. }
  1619. func (s *Members) MarshalJSON() ([]byte, error) {
  1620. type NoMethod Members
  1621. raw := NoMethod(*s)
  1622. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1623. }
  1624. // MembersHasMember: JSON template for Has Member response in Directory
  1625. // API.
  1626. type MembersHasMember struct {
  1627. // IsMember: Identifies whether the given user is a member of the group.
  1628. // Membership can be direct or nested.
  1629. IsMember bool `json:"isMember,omitempty"`
  1630. // ServerResponse contains the HTTP response code and headers from the
  1631. // server.
  1632. googleapi.ServerResponse `json:"-"`
  1633. // ForceSendFields is a list of field names (e.g. "IsMember") to
  1634. // unconditionally include in API requests. By default, fields with
  1635. // empty values are omitted from API requests. However, any non-pointer,
  1636. // non-interface field appearing in ForceSendFields will be sent to the
  1637. // server regardless of whether the field is empty or not. This may be
  1638. // used to include empty fields in Patch requests.
  1639. ForceSendFields []string `json:"-"`
  1640. // NullFields is a list of field names (e.g. "IsMember") to include in
  1641. // API requests with the JSON null value. By default, fields with empty
  1642. // values are omitted from API requests. However, any field with an
  1643. // empty value appearing in NullFields will be sent to the server as
  1644. // null. It is an error if a field in this list has a non-empty value.
  1645. // This may be used to include null fields in Patch requests.
  1646. NullFields []string `json:"-"`
  1647. }
  1648. func (s *MembersHasMember) MarshalJSON() ([]byte, error) {
  1649. type NoMethod MembersHasMember
  1650. raw := NoMethod(*s)
  1651. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1652. }
  1653. // MobileDevice: JSON template for Mobile Device resource in Directory
  1654. // API.
  1655. type MobileDevice struct {
  1656. // AdbStatus: Adb (USB debugging) enabled or disabled on device
  1657. // (Read-only)
  1658. AdbStatus bool `json:"adbStatus,omitempty"`
  1659. // Applications: List of applications installed on Mobile Device
  1660. Applications []*MobileDeviceApplications `json:"applications,omitempty"`
  1661. // BasebandVersion: Mobile Device Baseband version (Read-only)
  1662. BasebandVersion string `json:"basebandVersion,omitempty"`
  1663. // BootloaderVersion: Mobile Device Bootloader version (Read-only)
  1664. BootloaderVersion string `json:"bootloaderVersion,omitempty"`
  1665. // Brand: Mobile Device Brand (Read-only)
  1666. Brand string `json:"brand,omitempty"`
  1667. // BuildNumber: Mobile Device Build number (Read-only)
  1668. BuildNumber string `json:"buildNumber,omitempty"`
  1669. // DefaultLanguage: The default locale used on the Mobile Device
  1670. // (Read-only)
  1671. DefaultLanguage string `json:"defaultLanguage,omitempty"`
  1672. // DeveloperOptionsStatus: Developer options enabled or disabled on
  1673. // device (Read-only)
  1674. DeveloperOptionsStatus bool `json:"developerOptionsStatus,omitempty"`
  1675. // DeviceCompromisedStatus: Mobile Device compromised status (Read-only)
  1676. DeviceCompromisedStatus string `json:"deviceCompromisedStatus,omitempty"`
  1677. // DeviceId: Mobile Device serial number (Read-only)
  1678. DeviceId string `json:"deviceId,omitempty"`
  1679. // DevicePasswordStatus: DevicePasswordStatus (Read-only)
  1680. DevicePasswordStatus string `json:"devicePasswordStatus,omitempty"`
  1681. // Email: List of owner user's email addresses (Read-only)
  1682. Email []string `json:"email,omitempty"`
  1683. // EncryptionStatus: Mobile Device Encryption Status (Read-only)
  1684. EncryptionStatus string `json:"encryptionStatus,omitempty"`
  1685. // Etag: ETag of the resource.
  1686. Etag string `json:"etag,omitempty"`
  1687. // FirstSync: Date and time the device was first synchronized with the
  1688. // policy settings in the G Suite administrator control panel
  1689. // (Read-only)
  1690. FirstSync string `json:"firstSync,omitempty"`
  1691. // Hardware: Mobile Device Hardware (Read-only)
  1692. Hardware string `json:"hardware,omitempty"`
  1693. // HardwareId: Mobile Device Hardware Id (Read-only)
  1694. HardwareId string `json:"hardwareId,omitempty"`
  1695. // Imei: Mobile Device IMEI number (Read-only)
  1696. Imei string `json:"imei,omitempty"`
  1697. // KernelVersion: Mobile Device Kernel version (Read-only)
  1698. KernelVersion string `json:"kernelVersion,omitempty"`
  1699. // Kind: Kind of resource this is.
  1700. Kind string `json:"kind,omitempty"`
  1701. // LastSync: Date and time the device was last synchronized with the
  1702. // policy settings in the G Suite administrator control panel
  1703. // (Read-only)
  1704. LastSync string `json:"lastSync,omitempty"`
  1705. // ManagedAccountIsOnOwnerProfile: Boolean indicating if this account is
  1706. // on owner/primary profile or not (Read-only)
  1707. ManagedAccountIsOnOwnerProfile bool `json:"managedAccountIsOnOwnerProfile,omitempty"`
  1708. // Manufacturer: Mobile Device manufacturer (Read-only)
  1709. Manufacturer string `json:"manufacturer,omitempty"`
  1710. // Meid: Mobile Device MEID number (Read-only)
  1711. Meid string `json:"meid,omitempty"`
  1712. // Model: Name of the model of the device
  1713. Model string `json:"model,omitempty"`
  1714. // Name: List of owner user's names (Read-only)
  1715. Name []string `json:"name,omitempty"`
  1716. // NetworkOperator: Mobile Device mobile or network operator (if
  1717. // available) (Read-only)
  1718. NetworkOperator string `json:"networkOperator,omitempty"`
  1719. // Os: Name of the mobile operating system
  1720. Os string `json:"os,omitempty"`
  1721. // OtherAccountsInfo: List of accounts added on device (Read-only)
  1722. OtherAccountsInfo []string `json:"otherAccountsInfo,omitempty"`
  1723. // Privilege: DMAgentPermission (Read-only)
  1724. Privilege string `json:"privilege,omitempty"`
  1725. // ReleaseVersion: Mobile Device release version version (Read-only)
  1726. ReleaseVersion string `json:"releaseVersion,omitempty"`
  1727. // ResourceId: Unique identifier of Mobile Device (Read-only)
  1728. ResourceId string `json:"resourceId,omitempty"`
  1729. // SecurityPatchLevel: Mobile Device Security patch level (Read-only)
  1730. SecurityPatchLevel int64 `json:"securityPatchLevel,omitempty,string"`
  1731. // SerialNumber: Mobile Device SSN or Serial Number (Read-only)
  1732. SerialNumber string `json:"serialNumber,omitempty"`
  1733. // Status: Status of the device (Read-only)
  1734. Status string `json:"status,omitempty"`
  1735. // SupportsWorkProfile: Work profile supported on device (Read-only)
  1736. SupportsWorkProfile bool `json:"supportsWorkProfile,omitempty"`
  1737. // Type: The type of device (Read-only)
  1738. Type string `json:"type,omitempty"`
  1739. // UnknownSourcesStatus: Unknown sources enabled or disabled on device
  1740. // (Read-only)
  1741. UnknownSourcesStatus bool `json:"unknownSourcesStatus,omitempty"`
  1742. // UserAgent: Mobile Device user agent
  1743. UserAgent string `json:"userAgent,omitempty"`
  1744. // WifiMacAddress: Mobile Device WiFi MAC address (Read-only)
  1745. WifiMacAddress string `json:"wifiMacAddress,omitempty"`
  1746. // ServerResponse contains the HTTP response code and headers from the
  1747. // server.
  1748. googleapi.ServerResponse `json:"-"`
  1749. // ForceSendFields is a list of field names (e.g. "AdbStatus") to
  1750. // unconditionally include in API requests. By default, fields with
  1751. // empty values are omitted from API requests. However, any non-pointer,
  1752. // non-interface field appearing in ForceSendFields will be sent to the
  1753. // server regardless of whether the field is empty or not. This may be
  1754. // used to include empty fields in Patch requests.
  1755. ForceSendFields []string `json:"-"`
  1756. // NullFields is a list of field names (e.g. "AdbStatus") to include in
  1757. // API requests with the JSON null value. By default, fields with empty
  1758. // values are omitted from API requests. However, any field with an
  1759. // empty value appearing in NullFields will be sent to the server as
  1760. // null. It is an error if a field in this list has a non-empty value.
  1761. // This may be used to include null fields in Patch requests.
  1762. NullFields []string `json:"-"`
  1763. }
  1764. func (s *MobileDevice) MarshalJSON() ([]byte, error) {
  1765. type NoMethod MobileDevice
  1766. raw := NoMethod(*s)
  1767. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1768. }
  1769. type MobileDeviceApplications struct {
  1770. // DisplayName: Display name of application
  1771. DisplayName string `json:"displayName,omitempty"`
  1772. // PackageName: Package name of application
  1773. PackageName string `json:"packageName,omitempty"`
  1774. // Permission: List of Permissions for application
  1775. Permission []string `json:"permission,omitempty"`
  1776. // VersionCode: Version code of application
  1777. VersionCode int64 `json:"versionCode,omitempty"`
  1778. // VersionName: Version name of application
  1779. VersionName string `json:"versionName,omitempty"`
  1780. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1781. // unconditionally include in API requests. By default, fields with
  1782. // empty values are omitted from API requests. However, any non-pointer,
  1783. // non-interface field appearing in ForceSendFields will be sent to the
  1784. // server regardless of whether the field is empty or not. This may be
  1785. // used to include empty fields in Patch requests.
  1786. ForceSendFields []string `json:"-"`
  1787. // NullFields is a list of field names (e.g. "DisplayName") to include
  1788. // in API requests with the JSON null value. By default, fields with
  1789. // empty values are omitted from API requests. However, any field with
  1790. // an empty value appearing in NullFields will be sent to the server as
  1791. // null. It is an error if a field in this list has a non-empty value.
  1792. // This may be used to include null fields in Patch requests.
  1793. NullFields []string `json:"-"`
  1794. }
  1795. func (s *MobileDeviceApplications) MarshalJSON() ([]byte, error) {
  1796. type NoMethod MobileDeviceApplications
  1797. raw := NoMethod(*s)
  1798. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1799. }
  1800. // MobileDeviceAction: JSON request template for firing commands on
  1801. // Mobile Device in Directory Devices API.
  1802. type MobileDeviceAction struct {
  1803. // Action: Action to be taken on the Mobile Device
  1804. Action string `json:"action,omitempty"`
  1805. // ForceSendFields is a list of field names (e.g. "Action") to
  1806. // unconditionally include in API requests. By default, fields with
  1807. // empty values are omitted from API requests. However, any non-pointer,
  1808. // non-interface field appearing in ForceSendFields will be sent to the
  1809. // server regardless of whether the field is empty or not. This may be
  1810. // used to include empty fields in Patch requests.
  1811. ForceSendFields []string `json:"-"`
  1812. // NullFields is a list of field names (e.g. "Action") to include in API
  1813. // requests with the JSON null value. By default, fields with empty
  1814. // values are omitted from API requests. However, any field with an
  1815. // empty value appearing in NullFields will be sent to the server as
  1816. // null. It is an error if a field in this list has a non-empty value.
  1817. // This may be used to include null fields in Patch requests.
  1818. NullFields []string `json:"-"`
  1819. }
  1820. func (s *MobileDeviceAction) MarshalJSON() ([]byte, error) {
  1821. type NoMethod MobileDeviceAction
  1822. raw := NoMethod(*s)
  1823. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1824. }
  1825. // MobileDevices: JSON response template for List Mobile Devices
  1826. // operation in Directory API.
  1827. type MobileDevices struct {
  1828. // Etag: ETag of the resource.
  1829. Etag string `json:"etag,omitempty"`
  1830. // Kind: Kind of resource this is.
  1831. Kind string `json:"kind,omitempty"`
  1832. // Mobiledevices: List of Mobile Device objects.
  1833. Mobiledevices []*MobileDevice `json:"mobiledevices,omitempty"`
  1834. // NextPageToken: Token used to access next page of this result.
  1835. NextPageToken string `json:"nextPageToken,omitempty"`
  1836. // ServerResponse contains the HTTP response code and headers from the
  1837. // server.
  1838. googleapi.ServerResponse `json:"-"`
  1839. // ForceSendFields is a list of field names (e.g. "Etag") to
  1840. // unconditionally include in API requests. By default, fields with
  1841. // empty values are omitted from API requests. However, any non-pointer,
  1842. // non-interface field appearing in ForceSendFields will be sent to the
  1843. // server regardless of whether the field is empty or not. This may be
  1844. // used to include empty fields in Patch requests.
  1845. ForceSendFields []string `json:"-"`
  1846. // NullFields is a list of field names (e.g. "Etag") to include in API
  1847. // requests with the JSON null value. By default, fields with empty
  1848. // values are omitted from API requests. However, any field with an
  1849. // empty value appearing in NullFields will be sent to the server as
  1850. // null. It is an error if a field in this list has a non-empty value.
  1851. // This may be used to include null fields in Patch requests.
  1852. NullFields []string `json:"-"`
  1853. }
  1854. func (s *MobileDevices) MarshalJSON() ([]byte, error) {
  1855. type NoMethod MobileDevices
  1856. raw := NoMethod(*s)
  1857. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1858. }
  1859. // Notification: Template for a notification resource.
  1860. type Notification struct {
  1861. // Body: Body of the notification (Read-only)
  1862. Body string `json:"body,omitempty"`
  1863. // Etag: ETag of the resource.
  1864. Etag string `json:"etag,omitempty"`
  1865. // FromAddress: Address from which the notification is received
  1866. // (Read-only)
  1867. FromAddress string `json:"fromAddress,omitempty"`
  1868. // IsUnread: Boolean indicating whether the notification is unread or
  1869. // not.
  1870. IsUnread bool `json:"isUnread,omitempty"`
  1871. // Kind: The type of the resource.
  1872. Kind string `json:"kind,omitempty"`
  1873. NotificationId string `json:"notificationId,omitempty"`
  1874. // SendTime: Time at which notification was sent (Read-only)
  1875. SendTime string `json:"sendTime,omitempty"`
  1876. // Subject: Subject of the notification (Read-only)
  1877. Subject string `json:"subject,omitempty"`
  1878. // ServerResponse contains the HTTP response code and headers from the
  1879. // server.
  1880. googleapi.ServerResponse `json:"-"`
  1881. // ForceSendFields is a list of field names (e.g. "Body") to
  1882. // unconditionally include in API requests. By default, fields with
  1883. // empty values are omitted from API requests. However, any non-pointer,
  1884. // non-interface field appearing in ForceSendFields will be sent to the
  1885. // server regardless of whether the field is empty or not. This may be
  1886. // used to include empty fields in Patch requests.
  1887. ForceSendFields []string `json:"-"`
  1888. // NullFields is a list of field names (e.g. "Body") to include in API
  1889. // requests with the JSON null value. By default, fields with empty
  1890. // values are omitted from API requests. However, any field with an
  1891. // empty value appearing in NullFields will be sent to the server as
  1892. // null. It is an error if a field in this list has a non-empty value.
  1893. // This may be used to include null fields in Patch requests.
  1894. NullFields []string `json:"-"`
  1895. }
  1896. func (s *Notification) MarshalJSON() ([]byte, error) {
  1897. type NoMethod Notification
  1898. raw := NoMethod(*s)
  1899. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1900. }
  1901. // Notifications: Template for notifications list response.
  1902. type Notifications struct {
  1903. // Etag: ETag of the resource.
  1904. Etag string `json:"etag,omitempty"`
  1905. // Items: List of notifications in this page.
  1906. Items []*Notification `json:"items,omitempty"`
  1907. // Kind: The type of the resource.
  1908. Kind string `json:"kind,omitempty"`
  1909. // NextPageToken: Token for fetching the next page of notifications.
  1910. NextPageToken string `json:"nextPageToken,omitempty"`
  1911. // UnreadNotificationsCount: Number of unread notification for the
  1912. // domain.
  1913. UnreadNotificationsCount int64 `json:"unreadNotificationsCount,omitempty"`
  1914. // ServerResponse contains the HTTP response code and headers from the
  1915. // server.
  1916. googleapi.ServerResponse `json:"-"`
  1917. // ForceSendFields is a list of field names (e.g. "Etag") to
  1918. // unconditionally include in API requests. By default, fields with
  1919. // empty values are omitted from API requests. However, any non-pointer,
  1920. // non-interface field appearing in ForceSendFields will be sent to the
  1921. // server regardless of whether the field is empty or not. This may be
  1922. // used to include empty fields in Patch requests.
  1923. ForceSendFields []string `json:"-"`
  1924. // NullFields is a list of field names (e.g. "Etag") to include in API
  1925. // requests with the JSON null value. By default, fields with empty
  1926. // values are omitted from API requests. However, any field with an
  1927. // empty value appearing in NullFields will be sent to the server as
  1928. // null. It is an error if a field in this list has a non-empty value.
  1929. // This may be used to include null fields in Patch requests.
  1930. NullFields []string `json:"-"`
  1931. }
  1932. func (s *Notifications) MarshalJSON() ([]byte, error) {
  1933. type NoMethod Notifications
  1934. raw := NoMethod(*s)
  1935. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1936. }
  1937. // OrgUnit: JSON template for Org Unit resource in Directory API.
  1938. type OrgUnit struct {
  1939. // BlockInheritance: Should block inheritance
  1940. BlockInheritance bool `json:"blockInheritance,omitempty"`
  1941. // Description: Description of OrgUnit
  1942. Description string `json:"description,omitempty"`
  1943. // Etag: ETag of the resource.
  1944. Etag string `json:"etag,omitempty"`
  1945. // Kind: Kind of resource this is.
  1946. Kind string `json:"kind,omitempty"`
  1947. // Name: Name of OrgUnit
  1948. Name string `json:"name,omitempty"`
  1949. // OrgUnitId: Id of OrgUnit
  1950. OrgUnitId string `json:"orgUnitId,omitempty"`
  1951. // OrgUnitPath: Path of OrgUnit
  1952. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  1953. // ParentOrgUnitId: Id of parent OrgUnit
  1954. ParentOrgUnitId string `json:"parentOrgUnitId,omitempty"`
  1955. // ParentOrgUnitPath: Path of parent OrgUnit
  1956. ParentOrgUnitPath string `json:"parentOrgUnitPath,omitempty"`
  1957. // ServerResponse contains the HTTP response code and headers from the
  1958. // server.
  1959. googleapi.ServerResponse `json:"-"`
  1960. // ForceSendFields is a list of field names (e.g. "BlockInheritance") to
  1961. // unconditionally include in API requests. By default, fields with
  1962. // empty values are omitted from API requests. However, any non-pointer,
  1963. // non-interface field appearing in ForceSendFields will be sent to the
  1964. // server regardless of whether the field is empty or not. This may be
  1965. // used to include empty fields in Patch requests.
  1966. ForceSendFields []string `json:"-"`
  1967. // NullFields is a list of field names (e.g. "BlockInheritance") to
  1968. // include in API requests with the JSON null value. By default, fields
  1969. // with empty values are omitted from API requests. However, any field
  1970. // with an empty value appearing in NullFields will be sent to the
  1971. // server as null. It is an error if a field in this list has a
  1972. // non-empty value. This may be used to include null fields in Patch
  1973. // requests.
  1974. NullFields []string `json:"-"`
  1975. }
  1976. func (s *OrgUnit) MarshalJSON() ([]byte, error) {
  1977. type NoMethod OrgUnit
  1978. raw := NoMethod(*s)
  1979. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1980. }
  1981. // OrgUnits: JSON response template for List Organization Units
  1982. // operation in Directory API.
  1983. type OrgUnits struct {
  1984. // Etag: ETag of the resource.
  1985. Etag string `json:"etag,omitempty"`
  1986. // Kind: Kind of resource this is.
  1987. Kind string `json:"kind,omitempty"`
  1988. // OrganizationUnits: List of user objects.
  1989. OrganizationUnits []*OrgUnit `json:"organizationUnits,omitempty"`
  1990. // ServerResponse contains the HTTP response code and headers from the
  1991. // server.
  1992. googleapi.ServerResponse `json:"-"`
  1993. // ForceSendFields is a list of field names (e.g. "Etag") to
  1994. // unconditionally include in API requests. By default, fields with
  1995. // empty values are omitted from API requests. However, any non-pointer,
  1996. // non-interface field appearing in ForceSendFields will be sent to the
  1997. // server regardless of whether the field is empty or not. This may be
  1998. // used to include empty fields in Patch requests.
  1999. ForceSendFields []string `json:"-"`
  2000. // NullFields is a list of field names (e.g. "Etag") to include in API
  2001. // requests with the JSON null value. By default, fields with empty
  2002. // values are omitted from API requests. However, any field with an
  2003. // empty value appearing in NullFields will be sent to the server as
  2004. // null. It is an error if a field in this list has a non-empty value.
  2005. // This may be used to include null fields in Patch requests.
  2006. NullFields []string `json:"-"`
  2007. }
  2008. func (s *OrgUnits) MarshalJSON() ([]byte, error) {
  2009. type NoMethod OrgUnits
  2010. raw := NoMethod(*s)
  2011. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2012. }
  2013. // Privilege: JSON template for privilege resource in Directory API.
  2014. type Privilege struct {
  2015. // ChildPrivileges: A list of child privileges. Privileges for a service
  2016. // form a tree. Each privilege can have a list of child privileges; this
  2017. // list is empty for a leaf privilege.
  2018. ChildPrivileges []*Privilege `json:"childPrivileges,omitempty"`
  2019. // Etag: ETag of the resource.
  2020. Etag string `json:"etag,omitempty"`
  2021. // IsOuScopable: If the privilege can be restricted to an organization
  2022. // unit.
  2023. IsOuScopable bool `json:"isOuScopable,omitempty"`
  2024. // Kind: The type of the API resource. This is always
  2025. // admin#directory#privilege.
  2026. Kind string `json:"kind,omitempty"`
  2027. // PrivilegeName: The name of the privilege.
  2028. PrivilegeName string `json:"privilegeName,omitempty"`
  2029. // ServiceId: The obfuscated ID of the service this privilege is for.
  2030. ServiceId string `json:"serviceId,omitempty"`
  2031. // ServiceName: The name of the service this privilege is for.
  2032. ServiceName string `json:"serviceName,omitempty"`
  2033. // ForceSendFields is a list of field names (e.g. "ChildPrivileges") to
  2034. // unconditionally include in API requests. By default, fields with
  2035. // empty values are omitted from API requests. However, any non-pointer,
  2036. // non-interface field appearing in ForceSendFields will be sent to the
  2037. // server regardless of whether the field is empty or not. This may be
  2038. // used to include empty fields in Patch requests.
  2039. ForceSendFields []string `json:"-"`
  2040. // NullFields is a list of field names (e.g. "ChildPrivileges") to
  2041. // include in API requests with the JSON null value. By default, fields
  2042. // with empty values are omitted from API requests. However, any field
  2043. // with an empty value appearing in NullFields will be sent to the
  2044. // server as null. It is an error if a field in this list has a
  2045. // non-empty value. This may be used to include null fields in Patch
  2046. // requests.
  2047. NullFields []string `json:"-"`
  2048. }
  2049. func (s *Privilege) MarshalJSON() ([]byte, error) {
  2050. type NoMethod Privilege
  2051. raw := NoMethod(*s)
  2052. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2053. }
  2054. // Privileges: JSON response template for List privileges operation in
  2055. // Directory API.
  2056. type Privileges struct {
  2057. // Etag: ETag of the resource.
  2058. Etag string `json:"etag,omitempty"`
  2059. // Items: A list of Privilege resources.
  2060. Items []*Privilege `json:"items,omitempty"`
  2061. // Kind: The type of the API resource. This is always
  2062. // admin#directory#privileges.
  2063. Kind string `json:"kind,omitempty"`
  2064. // ServerResponse contains the HTTP response code and headers from the
  2065. // server.
  2066. googleapi.ServerResponse `json:"-"`
  2067. // ForceSendFields is a list of field names (e.g. "Etag") to
  2068. // unconditionally include in API requests. By default, fields with
  2069. // empty values are omitted from API requests. However, any non-pointer,
  2070. // non-interface field appearing in ForceSendFields will be sent to the
  2071. // server regardless of whether the field is empty or not. This may be
  2072. // used to include empty fields in Patch requests.
  2073. ForceSendFields []string `json:"-"`
  2074. // NullFields is a list of field names (e.g. "Etag") to include in API
  2075. // requests with the JSON null value. By default, fields with empty
  2076. // values are omitted from API requests. However, any field with an
  2077. // empty value appearing in NullFields will be sent to the server as
  2078. // null. It is an error if a field in this list has a non-empty value.
  2079. // This may be used to include null fields in Patch requests.
  2080. NullFields []string `json:"-"`
  2081. }
  2082. func (s *Privileges) MarshalJSON() ([]byte, error) {
  2083. type NoMethod Privileges
  2084. raw := NoMethod(*s)
  2085. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2086. }
  2087. // Role: JSON template for role resource in Directory API.
  2088. type Role struct {
  2089. // Etag: ETag of the resource.
  2090. Etag string `json:"etag,omitempty"`
  2091. // IsSuperAdminRole: Returns true if the role is a super admin role.
  2092. IsSuperAdminRole bool `json:"isSuperAdminRole,omitempty"`
  2093. // IsSystemRole: Returns true if this is a pre-defined system role.
  2094. IsSystemRole bool `json:"isSystemRole,omitempty"`
  2095. // Kind: The type of the API resource. This is always
  2096. // admin#directory#role.
  2097. Kind string `json:"kind,omitempty"`
  2098. // RoleDescription: A short description of the role.
  2099. RoleDescription string `json:"roleDescription,omitempty"`
  2100. // RoleId: ID of the role.
  2101. RoleId int64 `json:"roleId,omitempty,string"`
  2102. // RoleName: Name of the role.
  2103. RoleName string `json:"roleName,omitempty"`
  2104. // RolePrivileges: The set of privileges that are granted to this role.
  2105. RolePrivileges []*RoleRolePrivileges `json:"rolePrivileges,omitempty"`
  2106. // ServerResponse contains the HTTP response code and headers from the
  2107. // server.
  2108. googleapi.ServerResponse `json:"-"`
  2109. // ForceSendFields is a list of field names (e.g. "Etag") to
  2110. // unconditionally include in API requests. By default, fields with
  2111. // empty values are omitted from API requests. However, any non-pointer,
  2112. // non-interface field appearing in ForceSendFields will be sent to the
  2113. // server regardless of whether the field is empty or not. This may be
  2114. // used to include empty fields in Patch requests.
  2115. ForceSendFields []string `json:"-"`
  2116. // NullFields is a list of field names (e.g. "Etag") to include in API
  2117. // requests with the JSON null value. By default, fields with empty
  2118. // values are omitted from API requests. However, any field with an
  2119. // empty value appearing in NullFields will be sent to the server as
  2120. // null. It is an error if a field in this list has a non-empty value.
  2121. // This may be used to include null fields in Patch requests.
  2122. NullFields []string `json:"-"`
  2123. }
  2124. func (s *Role) MarshalJSON() ([]byte, error) {
  2125. type NoMethod Role
  2126. raw := NoMethod(*s)
  2127. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2128. }
  2129. type RoleRolePrivileges struct {
  2130. // PrivilegeName: The name of the privilege.
  2131. PrivilegeName string `json:"privilegeName,omitempty"`
  2132. // ServiceId: The obfuscated ID of the service this privilege is for.
  2133. ServiceId string `json:"serviceId,omitempty"`
  2134. // ForceSendFields is a list of field names (e.g. "PrivilegeName") to
  2135. // unconditionally include in API requests. By default, fields with
  2136. // empty values are omitted from API requests. However, any non-pointer,
  2137. // non-interface field appearing in ForceSendFields will be sent to the
  2138. // server regardless of whether the field is empty or not. This may be
  2139. // used to include empty fields in Patch requests.
  2140. ForceSendFields []string `json:"-"`
  2141. // NullFields is a list of field names (e.g. "PrivilegeName") to include
  2142. // in API requests with the JSON null value. By default, fields with
  2143. // empty values are omitted from API requests. However, any field with
  2144. // an empty value appearing in NullFields will be sent to the server as
  2145. // null. It is an error if a field in this list has a non-empty value.
  2146. // This may be used to include null fields in Patch requests.
  2147. NullFields []string `json:"-"`
  2148. }
  2149. func (s *RoleRolePrivileges) MarshalJSON() ([]byte, error) {
  2150. type NoMethod RoleRolePrivileges
  2151. raw := NoMethod(*s)
  2152. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2153. }
  2154. // RoleAssignment: JSON template for roleAssignment resource in
  2155. // Directory API.
  2156. type RoleAssignment struct {
  2157. // AssignedTo: The unique ID of the user this role is assigned to.
  2158. AssignedTo string `json:"assignedTo,omitempty"`
  2159. // Etag: ETag of the resource.
  2160. Etag string `json:"etag,omitempty"`
  2161. // Kind: The type of the API resource. This is always
  2162. // admin#directory#roleAssignment.
  2163. Kind string `json:"kind,omitempty"`
  2164. // OrgUnitId: If the role is restricted to an organization unit, this
  2165. // contains the ID for the organization unit the exercise of this role
  2166. // is restricted to.
  2167. OrgUnitId string `json:"orgUnitId,omitempty"`
  2168. // RoleAssignmentId: ID of this roleAssignment.
  2169. RoleAssignmentId int64 `json:"roleAssignmentId,omitempty,string"`
  2170. // RoleId: The ID of the role that is assigned.
  2171. RoleId int64 `json:"roleId,omitempty,string"`
  2172. // ScopeType: The scope in which this role is assigned. Possible values
  2173. // are:
  2174. // - CUSTOMER
  2175. // - ORG_UNIT
  2176. ScopeType string `json:"scopeType,omitempty"`
  2177. // ServerResponse contains the HTTP response code and headers from the
  2178. // server.
  2179. googleapi.ServerResponse `json:"-"`
  2180. // ForceSendFields is a list of field names (e.g. "AssignedTo") to
  2181. // unconditionally include in API requests. By default, fields with
  2182. // empty values are omitted from API requests. However, any non-pointer,
  2183. // non-interface field appearing in ForceSendFields will be sent to the
  2184. // server regardless of whether the field is empty or not. This may be
  2185. // used to include empty fields in Patch requests.
  2186. ForceSendFields []string `json:"-"`
  2187. // NullFields is a list of field names (e.g. "AssignedTo") to include in
  2188. // API requests with the JSON null value. By default, fields with empty
  2189. // values are omitted from API requests. However, any field with an
  2190. // empty value appearing in NullFields will be sent to the server as
  2191. // null. It is an error if a field in this list has a non-empty value.
  2192. // This may be used to include null fields in Patch requests.
  2193. NullFields []string `json:"-"`
  2194. }
  2195. func (s *RoleAssignment) MarshalJSON() ([]byte, error) {
  2196. type NoMethod RoleAssignment
  2197. raw := NoMethod(*s)
  2198. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2199. }
  2200. // RoleAssignments: JSON response template for List roleAssignments
  2201. // operation in Directory API.
  2202. type RoleAssignments struct {
  2203. // Etag: ETag of the resource.
  2204. Etag string `json:"etag,omitempty"`
  2205. // Items: A list of RoleAssignment resources.
  2206. Items []*RoleAssignment `json:"items,omitempty"`
  2207. // Kind: The type of the API resource. This is always
  2208. // admin#directory#roleAssignments.
  2209. Kind string `json:"kind,omitempty"`
  2210. NextPageToken string `json:"nextPageToken,omitempty"`
  2211. // ServerResponse contains the HTTP response code and headers from the
  2212. // server.
  2213. googleapi.ServerResponse `json:"-"`
  2214. // ForceSendFields is a list of field names (e.g. "Etag") to
  2215. // unconditionally include in API requests. By default, fields with
  2216. // empty values are omitted from API requests. However, any non-pointer,
  2217. // non-interface field appearing in ForceSendFields will be sent to the
  2218. // server regardless of whether the field is empty or not. This may be
  2219. // used to include empty fields in Patch requests.
  2220. ForceSendFields []string `json:"-"`
  2221. // NullFields is a list of field names (e.g. "Etag") to include in API
  2222. // requests with the JSON null value. By default, fields with empty
  2223. // values are omitted from API requests. However, any field with an
  2224. // empty value appearing in NullFields will be sent to the server as
  2225. // null. It is an error if a field in this list has a non-empty value.
  2226. // This may be used to include null fields in Patch requests.
  2227. NullFields []string `json:"-"`
  2228. }
  2229. func (s *RoleAssignments) MarshalJSON() ([]byte, error) {
  2230. type NoMethod RoleAssignments
  2231. raw := NoMethod(*s)
  2232. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2233. }
  2234. // Roles: JSON response template for List roles operation in Directory
  2235. // API.
  2236. type Roles struct {
  2237. // Etag: ETag of the resource.
  2238. Etag string `json:"etag,omitempty"`
  2239. // Items: A list of Role resources.
  2240. Items []*Role `json:"items,omitempty"`
  2241. // Kind: The type of the API resource. This is always
  2242. // admin#directory#roles.
  2243. Kind string `json:"kind,omitempty"`
  2244. NextPageToken string `json:"nextPageToken,omitempty"`
  2245. // ServerResponse contains the HTTP response code and headers from the
  2246. // server.
  2247. googleapi.ServerResponse `json:"-"`
  2248. // ForceSendFields is a list of field names (e.g. "Etag") to
  2249. // unconditionally include in API requests. By default, fields with
  2250. // empty values are omitted from API requests. However, any non-pointer,
  2251. // non-interface field appearing in ForceSendFields will be sent to the
  2252. // server regardless of whether the field is empty or not. This may be
  2253. // used to include empty fields in Patch requests.
  2254. ForceSendFields []string `json:"-"`
  2255. // NullFields is a list of field names (e.g. "Etag") to include in API
  2256. // requests with the JSON null value. By default, fields with empty
  2257. // values are omitted from API requests. However, any field with an
  2258. // empty value appearing in NullFields will be sent to the server as
  2259. // null. It is an error if a field in this list has a non-empty value.
  2260. // This may be used to include null fields in Patch requests.
  2261. NullFields []string `json:"-"`
  2262. }
  2263. func (s *Roles) MarshalJSON() ([]byte, error) {
  2264. type NoMethod Roles
  2265. raw := NoMethod(*s)
  2266. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2267. }
  2268. // Schema: JSON template for Schema resource in Directory API.
  2269. type Schema struct {
  2270. // DisplayName: Display name for the schema.
  2271. DisplayName string `json:"displayName,omitempty"`
  2272. // Etag: ETag of the resource.
  2273. Etag string `json:"etag,omitempty"`
  2274. // Fields: Fields of Schema
  2275. Fields []*SchemaFieldSpec `json:"fields,omitempty"`
  2276. // Kind: Kind of resource this is.
  2277. Kind string `json:"kind,omitempty"`
  2278. // SchemaId: Unique identifier of Schema (Read-only)
  2279. SchemaId string `json:"schemaId,omitempty"`
  2280. // SchemaName: Schema name
  2281. SchemaName string `json:"schemaName,omitempty"`
  2282. // ServerResponse contains the HTTP response code and headers from the
  2283. // server.
  2284. googleapi.ServerResponse `json:"-"`
  2285. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  2286. // unconditionally include in API requests. By default, fields with
  2287. // empty values are omitted from API requests. However, any non-pointer,
  2288. // non-interface field appearing in ForceSendFields will be sent to the
  2289. // server regardless of whether the field is empty or not. This may be
  2290. // used to include empty fields in Patch requests.
  2291. ForceSendFields []string `json:"-"`
  2292. // NullFields is a list of field names (e.g. "DisplayName") to include
  2293. // in API requests with the JSON null value. By default, fields with
  2294. // empty values are omitted from API requests. However, any field with
  2295. // an empty value appearing in NullFields will be sent to the server as
  2296. // null. It is an error if a field in this list has a non-empty value.
  2297. // This may be used to include null fields in Patch requests.
  2298. NullFields []string `json:"-"`
  2299. }
  2300. func (s *Schema) MarshalJSON() ([]byte, error) {
  2301. type NoMethod Schema
  2302. raw := NoMethod(*s)
  2303. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2304. }
  2305. // SchemaFieldSpec: JSON template for FieldSpec resource for Schemas in
  2306. // Directory API.
  2307. type SchemaFieldSpec struct {
  2308. // DisplayName: Display Name of the field.
  2309. DisplayName string `json:"displayName,omitempty"`
  2310. // Etag: ETag of the resource.
  2311. Etag string `json:"etag,omitempty"`
  2312. // FieldId: Unique identifier of Field (Read-only)
  2313. FieldId string `json:"fieldId,omitempty"`
  2314. // FieldName: Name of the field.
  2315. FieldName string `json:"fieldName,omitempty"`
  2316. // FieldType: Type of the field.
  2317. FieldType string `json:"fieldType,omitempty"`
  2318. // Indexed: Boolean specifying whether the field is indexed or not.
  2319. //
  2320. // Default: true
  2321. Indexed *bool `json:"indexed,omitempty"`
  2322. // Kind: Kind of resource this is.
  2323. Kind string `json:"kind,omitempty"`
  2324. // MultiValued: Boolean specifying whether this is a multi-valued field
  2325. // or not.
  2326. MultiValued bool `json:"multiValued,omitempty"`
  2327. // NumericIndexingSpec: Indexing spec for a numeric field. By default,
  2328. // only exact match queries will be supported for numeric fields.
  2329. // Setting the numericIndexingSpec allows range queries to be supported.
  2330. NumericIndexingSpec *SchemaFieldSpecNumericIndexingSpec `json:"numericIndexingSpec,omitempty"`
  2331. // ReadAccessType: Read ACLs on the field specifying who can view values
  2332. // of this field. Valid values are "ALL_DOMAIN_USERS" and
  2333. // "ADMINS_AND_SELF".
  2334. ReadAccessType string `json:"readAccessType,omitempty"`
  2335. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  2336. // unconditionally include in API requests. By default, fields with
  2337. // empty values are omitted from API requests. However, any non-pointer,
  2338. // non-interface field appearing in ForceSendFields will be sent to the
  2339. // server regardless of whether the field is empty or not. This may be
  2340. // used to include empty fields in Patch requests.
  2341. ForceSendFields []string `json:"-"`
  2342. // NullFields is a list of field names (e.g. "DisplayName") to include
  2343. // in API requests with the JSON null value. By default, fields with
  2344. // empty values are omitted from API requests. However, any field with
  2345. // an empty value appearing in NullFields will be sent to the server as
  2346. // null. It is an error if a field in this list has a non-empty value.
  2347. // This may be used to include null fields in Patch requests.
  2348. NullFields []string `json:"-"`
  2349. }
  2350. func (s *SchemaFieldSpec) MarshalJSON() ([]byte, error) {
  2351. type NoMethod SchemaFieldSpec
  2352. raw := NoMethod(*s)
  2353. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2354. }
  2355. // SchemaFieldSpecNumericIndexingSpec: Indexing spec for a numeric
  2356. // field. By default, only exact match queries will be supported for
  2357. // numeric fields. Setting the numericIndexingSpec allows range queries
  2358. // to be supported.
  2359. type SchemaFieldSpecNumericIndexingSpec struct {
  2360. // MaxValue: Maximum value of this field. This is meant to be indicative
  2361. // rather than enforced. Values outside this range will still be
  2362. // indexed, but search may not be as performant.
  2363. MaxValue float64 `json:"maxValue,omitempty"`
  2364. // MinValue: Minimum value of this field. This is meant to be indicative
  2365. // rather than enforced. Values outside this range will still be
  2366. // indexed, but search may not be as performant.
  2367. MinValue float64 `json:"minValue,omitempty"`
  2368. // ForceSendFields is a list of field names (e.g. "MaxValue") to
  2369. // unconditionally include in API requests. By default, fields with
  2370. // empty values are omitted from API requests. However, any non-pointer,
  2371. // non-interface field appearing in ForceSendFields will be sent to the
  2372. // server regardless of whether the field is empty or not. This may be
  2373. // used to include empty fields in Patch requests.
  2374. ForceSendFields []string `json:"-"`
  2375. // NullFields is a list of field names (e.g. "MaxValue") to include in
  2376. // API requests with the JSON null value. By default, fields with empty
  2377. // values are omitted from API requests. However, any field with an
  2378. // empty value appearing in NullFields will be sent to the server as
  2379. // null. It is an error if a field in this list has a non-empty value.
  2380. // This may be used to include null fields in Patch requests.
  2381. NullFields []string `json:"-"`
  2382. }
  2383. func (s *SchemaFieldSpecNumericIndexingSpec) MarshalJSON() ([]byte, error) {
  2384. type NoMethod SchemaFieldSpecNumericIndexingSpec
  2385. raw := NoMethod(*s)
  2386. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2387. }
  2388. func (s *SchemaFieldSpecNumericIndexingSpec) UnmarshalJSON(data []byte) error {
  2389. type NoMethod SchemaFieldSpecNumericIndexingSpec
  2390. var s1 struct {
  2391. MaxValue gensupport.JSONFloat64 `json:"maxValue"`
  2392. MinValue gensupport.JSONFloat64 `json:"minValue"`
  2393. *NoMethod
  2394. }
  2395. s1.NoMethod = (*NoMethod)(s)
  2396. if err := json.Unmarshal(data, &s1); err != nil {
  2397. return err
  2398. }
  2399. s.MaxValue = float64(s1.MaxValue)
  2400. s.MinValue = float64(s1.MinValue)
  2401. return nil
  2402. }
  2403. // Schemas: JSON response template for List Schema operation in
  2404. // Directory API.
  2405. type Schemas struct {
  2406. // Etag: ETag of the resource.
  2407. Etag string `json:"etag,omitempty"`
  2408. // Kind: Kind of resource this is.
  2409. Kind string `json:"kind,omitempty"`
  2410. // Schemas: List of UserSchema objects.
  2411. Schemas []*Schema `json:"schemas,omitempty"`
  2412. // ServerResponse contains the HTTP response code and headers from the
  2413. // server.
  2414. googleapi.ServerResponse `json:"-"`
  2415. // ForceSendFields is a list of field names (e.g. "Etag") to
  2416. // unconditionally include in API requests. By default, fields with
  2417. // empty values are omitted from API requests. However, any non-pointer,
  2418. // non-interface field appearing in ForceSendFields will be sent to the
  2419. // server regardless of whether the field is empty or not. This may be
  2420. // used to include empty fields in Patch requests.
  2421. ForceSendFields []string `json:"-"`
  2422. // NullFields is a list of field names (e.g. "Etag") to include in API
  2423. // requests with the JSON null value. By default, fields with empty
  2424. // values are omitted from API requests. However, any field with an
  2425. // empty value appearing in NullFields will be sent to the server as
  2426. // null. It is an error if a field in this list has a non-empty value.
  2427. // This may be used to include null fields in Patch requests.
  2428. NullFields []string `json:"-"`
  2429. }
  2430. func (s *Schemas) MarshalJSON() ([]byte, error) {
  2431. type NoMethod Schemas
  2432. raw := NoMethod(*s)
  2433. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2434. }
  2435. // Token: JSON template for token resource in Directory API.
  2436. type Token struct {
  2437. // Anonymous: Whether the application is registered with Google. The
  2438. // value is true if the application has an anonymous Client ID.
  2439. Anonymous bool `json:"anonymous,omitempty"`
  2440. // ClientId: The Client ID of the application the token is issued to.
  2441. ClientId string `json:"clientId,omitempty"`
  2442. // DisplayText: The displayable name of the application the token is
  2443. // issued to.
  2444. DisplayText string `json:"displayText,omitempty"`
  2445. // Etag: ETag of the resource.
  2446. Etag string `json:"etag,omitempty"`
  2447. // Kind: The type of the API resource. This is always
  2448. // admin#directory#token.
  2449. Kind string `json:"kind,omitempty"`
  2450. // NativeApp: Whether the token is issued to an installed application.
  2451. // The value is true if the application is installed to a desktop or
  2452. // mobile device.
  2453. NativeApp bool `json:"nativeApp,omitempty"`
  2454. // Scopes: A list of authorization scopes the application is granted.
  2455. Scopes []string `json:"scopes,omitempty"`
  2456. // UserKey: The unique ID of the user that issued the token.
  2457. UserKey string `json:"userKey,omitempty"`
  2458. // ServerResponse contains the HTTP response code and headers from the
  2459. // server.
  2460. googleapi.ServerResponse `json:"-"`
  2461. // ForceSendFields is a list of field names (e.g. "Anonymous") to
  2462. // unconditionally include in API requests. By default, fields with
  2463. // empty values are omitted from API requests. However, any non-pointer,
  2464. // non-interface field appearing in ForceSendFields will be sent to the
  2465. // server regardless of whether the field is empty or not. This may be
  2466. // used to include empty fields in Patch requests.
  2467. ForceSendFields []string `json:"-"`
  2468. // NullFields is a list of field names (e.g. "Anonymous") to include in
  2469. // API requests with the JSON null value. By default, fields with empty
  2470. // values are omitted from API requests. However, any field with an
  2471. // empty value appearing in NullFields will be sent to the server as
  2472. // null. It is an error if a field in this list has a non-empty value.
  2473. // This may be used to include null fields in Patch requests.
  2474. NullFields []string `json:"-"`
  2475. }
  2476. func (s *Token) MarshalJSON() ([]byte, error) {
  2477. type NoMethod Token
  2478. raw := NoMethod(*s)
  2479. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2480. }
  2481. // Tokens: JSON response template for List tokens operation in Directory
  2482. // API.
  2483. type Tokens struct {
  2484. // Etag: ETag of the resource.
  2485. Etag string `json:"etag,omitempty"`
  2486. // Items: A list of Token resources.
  2487. Items []*Token `json:"items,omitempty"`
  2488. // Kind: The type of the API resource. This is always
  2489. // admin#directory#tokenList.
  2490. Kind string `json:"kind,omitempty"`
  2491. // ServerResponse contains the HTTP response code and headers from the
  2492. // server.
  2493. googleapi.ServerResponse `json:"-"`
  2494. // ForceSendFields is a list of field names (e.g. "Etag") to
  2495. // unconditionally include in API requests. By default, fields with
  2496. // empty values are omitted from API requests. However, any non-pointer,
  2497. // non-interface field appearing in ForceSendFields will be sent to the
  2498. // server regardless of whether the field is empty or not. This may be
  2499. // used to include empty fields in Patch requests.
  2500. ForceSendFields []string `json:"-"`
  2501. // NullFields is a list of field names (e.g. "Etag") to include in API
  2502. // requests with the JSON null value. By default, fields with empty
  2503. // values are omitted from API requests. However, any field with an
  2504. // empty value appearing in NullFields will be sent to the server as
  2505. // null. It is an error if a field in this list has a non-empty value.
  2506. // This may be used to include null fields in Patch requests.
  2507. NullFields []string `json:"-"`
  2508. }
  2509. func (s *Tokens) MarshalJSON() ([]byte, error) {
  2510. type NoMethod Tokens
  2511. raw := NoMethod(*s)
  2512. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2513. }
  2514. // TrustedAppId: JSON template for Trusted App Ids Resource object in
  2515. // Directory API.
  2516. type TrustedAppId struct {
  2517. // AndroidPackageName: Android package name.
  2518. AndroidPackageName string `json:"androidPackageName,omitempty"`
  2519. // CertificateHashSHA1: SHA1 signature of the app certificate.
  2520. CertificateHashSHA1 string `json:"certificateHashSHA1,omitempty"`
  2521. // CertificateHashSHA256: SHA256 signature of the app certificate.
  2522. CertificateHashSHA256 string `json:"certificateHashSHA256,omitempty"`
  2523. Etag string `json:"etag,omitempty"`
  2524. // Kind: Identifies the resource as a trusted AppId.
  2525. Kind string `json:"kind,omitempty"`
  2526. // ForceSendFields is a list of field names (e.g. "AndroidPackageName")
  2527. // to unconditionally include in API requests. By default, fields with
  2528. // empty values are omitted from API requests. However, any non-pointer,
  2529. // non-interface field appearing in ForceSendFields will be sent to the
  2530. // server regardless of whether the field is empty or not. This may be
  2531. // used to include empty fields in Patch requests.
  2532. ForceSendFields []string `json:"-"`
  2533. // NullFields is a list of field names (e.g. "AndroidPackageName") to
  2534. // include in API requests with the JSON null value. By default, fields
  2535. // with empty values are omitted from API requests. However, any field
  2536. // with an empty value appearing in NullFields will be sent to the
  2537. // server as null. It is an error if a field in this list has a
  2538. // non-empty value. This may be used to include null fields in Patch
  2539. // requests.
  2540. NullFields []string `json:"-"`
  2541. }
  2542. func (s *TrustedAppId) MarshalJSON() ([]byte, error) {
  2543. type NoMethod TrustedAppId
  2544. raw := NoMethod(*s)
  2545. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2546. }
  2547. // TrustedApps: JSON template for Trusted Apps response object of a user
  2548. // in Directory API.
  2549. type TrustedApps struct {
  2550. // Etag: ETag of the resource.
  2551. Etag string `json:"etag,omitempty"`
  2552. // Kind: Identifies the resource as trusted apps response.
  2553. Kind string `json:"kind,omitempty"`
  2554. NextPageToken string `json:"nextPageToken,omitempty"`
  2555. // TrustedApps: Trusted Apps list.
  2556. TrustedApps []*TrustedAppId `json:"trustedApps,omitempty"`
  2557. // ServerResponse contains the HTTP response code and headers from the
  2558. // server.
  2559. googleapi.ServerResponse `json:"-"`
  2560. // ForceSendFields is a list of field names (e.g. "Etag") to
  2561. // unconditionally include in API requests. By default, fields with
  2562. // empty values are omitted from API requests. However, any non-pointer,
  2563. // non-interface field appearing in ForceSendFields will be sent to the
  2564. // server regardless of whether the field is empty or not. This may be
  2565. // used to include empty fields in Patch requests.
  2566. ForceSendFields []string `json:"-"`
  2567. // NullFields is a list of field names (e.g. "Etag") to include in API
  2568. // requests with the JSON null value. By default, fields with empty
  2569. // values are omitted from API requests. However, any field with an
  2570. // empty value appearing in NullFields will be sent to the server as
  2571. // null. It is an error if a field in this list has a non-empty value.
  2572. // This may be used to include null fields in Patch requests.
  2573. NullFields []string `json:"-"`
  2574. }
  2575. func (s *TrustedApps) MarshalJSON() ([]byte, error) {
  2576. type NoMethod TrustedApps
  2577. raw := NoMethod(*s)
  2578. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2579. }
  2580. // User: JSON template for User object in Directory API.
  2581. type User struct {
  2582. Addresses interface{} `json:"addresses,omitempty"`
  2583. // AgreedToTerms: Indicates if user has agreed to terms (Read-only)
  2584. AgreedToTerms bool `json:"agreedToTerms,omitempty"`
  2585. // Aliases: List of aliases (Read-only)
  2586. Aliases []string `json:"aliases,omitempty"`
  2587. // ChangePasswordAtNextLogin: Boolean indicating if the user should
  2588. // change password in next login
  2589. ChangePasswordAtNextLogin bool `json:"changePasswordAtNextLogin,omitempty"`
  2590. // CreationTime: User's G Suite account creation time. (Read-only)
  2591. CreationTime string `json:"creationTime,omitempty"`
  2592. // CustomSchemas: Custom fields of the user.
  2593. CustomSchemas map[string]googleapi.RawMessage `json:"customSchemas,omitempty"`
  2594. // CustomerId: CustomerId of User (Read-only)
  2595. CustomerId string `json:"customerId,omitempty"`
  2596. DeletionTime string `json:"deletionTime,omitempty"`
  2597. Emails interface{} `json:"emails,omitempty"`
  2598. // Etag: ETag of the resource.
  2599. Etag string `json:"etag,omitempty"`
  2600. ExternalIds interface{} `json:"externalIds,omitempty"`
  2601. Gender interface{} `json:"gender,omitempty"`
  2602. // HashFunction: Hash function name for password. Supported are MD5,
  2603. // SHA-1 and crypt
  2604. HashFunction string `json:"hashFunction,omitempty"`
  2605. // Id: Unique identifier of User (Read-only)
  2606. Id string `json:"id,omitempty"`
  2607. Ims interface{} `json:"ims,omitempty"`
  2608. // IncludeInGlobalAddressList: Boolean indicating if user is included in
  2609. // Global Address List
  2610. IncludeInGlobalAddressList bool `json:"includeInGlobalAddressList,omitempty"`
  2611. // IpWhitelisted: Boolean indicating if ip is whitelisted
  2612. IpWhitelisted bool `json:"ipWhitelisted,omitempty"`
  2613. // IsAdmin: Boolean indicating if the user is admin (Read-only)
  2614. IsAdmin bool `json:"isAdmin,omitempty"`
  2615. // IsDelegatedAdmin: Boolean indicating if the user is delegated admin
  2616. // (Read-only)
  2617. IsDelegatedAdmin bool `json:"isDelegatedAdmin,omitempty"`
  2618. // IsEnforcedIn2Sv: Is 2-step verification enforced (Read-only)
  2619. IsEnforcedIn2Sv bool `json:"isEnforcedIn2Sv,omitempty"`
  2620. // IsEnrolledIn2Sv: Is enrolled in 2-step verification (Read-only)
  2621. IsEnrolledIn2Sv bool `json:"isEnrolledIn2Sv,omitempty"`
  2622. // IsMailboxSetup: Is mailbox setup (Read-only)
  2623. IsMailboxSetup bool `json:"isMailboxSetup,omitempty"`
  2624. Keywords interface{} `json:"keywords,omitempty"`
  2625. // Kind: Kind of resource this is.
  2626. Kind string `json:"kind,omitempty"`
  2627. Languages interface{} `json:"languages,omitempty"`
  2628. // LastLoginTime: User's last login time. (Read-only)
  2629. LastLoginTime string `json:"lastLoginTime,omitempty"`
  2630. Locations interface{} `json:"locations,omitempty"`
  2631. // Name: User's name
  2632. Name *UserName `json:"name,omitempty"`
  2633. // NonEditableAliases: List of non editable aliases (Read-only)
  2634. NonEditableAliases []string `json:"nonEditableAliases,omitempty"`
  2635. Notes interface{} `json:"notes,omitempty"`
  2636. // OrgUnitPath: OrgUnit of User
  2637. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  2638. Organizations interface{} `json:"organizations,omitempty"`
  2639. // Password: User's password
  2640. Password string `json:"password,omitempty"`
  2641. Phones interface{} `json:"phones,omitempty"`
  2642. PosixAccounts interface{} `json:"posixAccounts,omitempty"`
  2643. // PrimaryEmail: username of User
  2644. PrimaryEmail string `json:"primaryEmail,omitempty"`
  2645. Relations interface{} `json:"relations,omitempty"`
  2646. SshPublicKeys interface{} `json:"sshPublicKeys,omitempty"`
  2647. // Suspended: Indicates if user is suspended
  2648. Suspended bool `json:"suspended,omitempty"`
  2649. // SuspensionReason: Suspension reason if user is suspended (Read-only)
  2650. SuspensionReason string `json:"suspensionReason,omitempty"`
  2651. // ThumbnailPhotoEtag: ETag of the user's photo (Read-only)
  2652. ThumbnailPhotoEtag string `json:"thumbnailPhotoEtag,omitempty"`
  2653. // ThumbnailPhotoUrl: Photo Url of the user (Read-only)
  2654. ThumbnailPhotoUrl string `json:"thumbnailPhotoUrl,omitempty"`
  2655. Websites interface{} `json:"websites,omitempty"`
  2656. // ServerResponse contains the HTTP response code and headers from the
  2657. // server.
  2658. googleapi.ServerResponse `json:"-"`
  2659. // ForceSendFields is a list of field names (e.g. "Addresses") to
  2660. // unconditionally include in API requests. By default, fields with
  2661. // empty values are omitted from API requests. However, any non-pointer,
  2662. // non-interface field appearing in ForceSendFields will be sent to the
  2663. // server regardless of whether the field is empty or not. This may be
  2664. // used to include empty fields in Patch requests.
  2665. ForceSendFields []string `json:"-"`
  2666. // NullFields is a list of field names (e.g. "Addresses") to include in
  2667. // API requests with the JSON null value. By default, fields with empty
  2668. // values are omitted from API requests. However, any field with an
  2669. // empty value appearing in NullFields will be sent to the server as
  2670. // null. It is an error if a field in this list has a non-empty value.
  2671. // This may be used to include null fields in Patch requests.
  2672. NullFields []string `json:"-"`
  2673. }
  2674. func (s *User) MarshalJSON() ([]byte, error) {
  2675. type NoMethod User
  2676. raw := NoMethod(*s)
  2677. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2678. }
  2679. // UserAbout: JSON template for About (notes) of a user in Directory
  2680. // API.
  2681. type UserAbout struct {
  2682. // ContentType: About entry can have a type which indicates the content
  2683. // type. It can either be plain or html. By default, notes contents are
  2684. // assumed to contain plain text.
  2685. ContentType string `json:"contentType,omitempty"`
  2686. // Value: Actual value of notes.
  2687. Value string `json:"value,omitempty"`
  2688. // ForceSendFields is a list of field names (e.g. "ContentType") to
  2689. // unconditionally include in API requests. By default, fields with
  2690. // empty values are omitted from API requests. However, any non-pointer,
  2691. // non-interface field appearing in ForceSendFields will be sent to the
  2692. // server regardless of whether the field is empty or not. This may be
  2693. // used to include empty fields in Patch requests.
  2694. ForceSendFields []string `json:"-"`
  2695. // NullFields is a list of field names (e.g. "ContentType") to include
  2696. // in API requests with the JSON null value. By default, fields with
  2697. // empty values are omitted from API requests. However, any field with
  2698. // an empty value appearing in NullFields will be sent to the server as
  2699. // null. It is an error if a field in this list has a non-empty value.
  2700. // This may be used to include null fields in Patch requests.
  2701. NullFields []string `json:"-"`
  2702. }
  2703. func (s *UserAbout) MarshalJSON() ([]byte, error) {
  2704. type NoMethod UserAbout
  2705. raw := NoMethod(*s)
  2706. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2707. }
  2708. // UserAddress: JSON template for address.
  2709. type UserAddress struct {
  2710. // Country: Country.
  2711. Country string `json:"country,omitempty"`
  2712. // CountryCode: Country code.
  2713. CountryCode string `json:"countryCode,omitempty"`
  2714. // CustomType: Custom type.
  2715. CustomType string `json:"customType,omitempty"`
  2716. // ExtendedAddress: Extended Address.
  2717. ExtendedAddress string `json:"extendedAddress,omitempty"`
  2718. // Formatted: Formatted address.
  2719. Formatted string `json:"formatted,omitempty"`
  2720. // Locality: Locality.
  2721. Locality string `json:"locality,omitempty"`
  2722. // PoBox: Other parts of address.
  2723. PoBox string `json:"poBox,omitempty"`
  2724. // PostalCode: Postal code.
  2725. PostalCode string `json:"postalCode,omitempty"`
  2726. // Primary: If this is user's primary address. Only one entry could be
  2727. // marked as primary.
  2728. Primary bool `json:"primary,omitempty"`
  2729. // Region: Region.
  2730. Region string `json:"region,omitempty"`
  2731. // SourceIsStructured: User supplied address was structured. Structured
  2732. // addresses are NOT supported at this time. You might be able to write
  2733. // structured addresses, but any values will eventually be clobbered.
  2734. SourceIsStructured bool `json:"sourceIsStructured,omitempty"`
  2735. // StreetAddress: Street.
  2736. StreetAddress string `json:"streetAddress,omitempty"`
  2737. // Type: Each entry can have a type which indicates standard values of
  2738. // that entry. For example address could be of home, work etc. In
  2739. // addition to the standard type, an entry can have a custom type and
  2740. // can take any value. Such type should have the CUSTOM value as type
  2741. // and also have a customType value.
  2742. Type string `json:"type,omitempty"`
  2743. // ForceSendFields is a list of field names (e.g. "Country") to
  2744. // unconditionally include in API requests. By default, fields with
  2745. // empty values are omitted from API requests. However, any non-pointer,
  2746. // non-interface field appearing in ForceSendFields will be sent to the
  2747. // server regardless of whether the field is empty or not. This may be
  2748. // used to include empty fields in Patch requests.
  2749. ForceSendFields []string `json:"-"`
  2750. // NullFields is a list of field names (e.g. "Country") to include in
  2751. // API requests with the JSON null value. By default, fields with empty
  2752. // values are omitted from API requests. However, any field with an
  2753. // empty value appearing in NullFields will be sent to the server as
  2754. // null. It is an error if a field in this list has a non-empty value.
  2755. // This may be used to include null fields in Patch requests.
  2756. NullFields []string `json:"-"`
  2757. }
  2758. func (s *UserAddress) MarshalJSON() ([]byte, error) {
  2759. type NoMethod UserAddress
  2760. raw := NoMethod(*s)
  2761. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2762. }
  2763. // UserEmail: JSON template for an email.
  2764. type UserEmail struct {
  2765. // Address: Email id of the user.
  2766. Address string `json:"address,omitempty"`
  2767. // CustomType: Custom Type.
  2768. CustomType string `json:"customType,omitempty"`
  2769. // Primary: If this is user's primary email. Only one entry could be
  2770. // marked as primary.
  2771. Primary bool `json:"primary,omitempty"`
  2772. // Type: Each entry can have a type which indicates standard types of
  2773. // that entry. For example email could be of home, work etc. In addition
  2774. // to the standard type, an entry can have a custom type and can take
  2775. // any value Such types should have the CUSTOM value as type and also
  2776. // have a customType value.
  2777. Type string `json:"type,omitempty"`
  2778. // ForceSendFields is a list of field names (e.g. "Address") to
  2779. // unconditionally include in API requests. By default, fields with
  2780. // empty values are omitted from API requests. However, any non-pointer,
  2781. // non-interface field appearing in ForceSendFields will be sent to the
  2782. // server regardless of whether the field is empty or not. This may be
  2783. // used to include empty fields in Patch requests.
  2784. ForceSendFields []string `json:"-"`
  2785. // NullFields is a list of field names (e.g. "Address") to include in
  2786. // API requests with the JSON null value. By default, fields with empty
  2787. // values are omitted from API requests. However, any field with an
  2788. // empty value appearing in NullFields will be sent to the server as
  2789. // null. It is an error if a field in this list has a non-empty value.
  2790. // This may be used to include null fields in Patch requests.
  2791. NullFields []string `json:"-"`
  2792. }
  2793. func (s *UserEmail) MarshalJSON() ([]byte, error) {
  2794. type NoMethod UserEmail
  2795. raw := NoMethod(*s)
  2796. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2797. }
  2798. // UserExternalId: JSON template for an externalId entry.
  2799. type UserExternalId struct {
  2800. // CustomType: Custom type.
  2801. CustomType string `json:"customType,omitempty"`
  2802. // Type: The type of the Id.
  2803. Type string `json:"type,omitempty"`
  2804. // Value: The value of the id.
  2805. Value string `json:"value,omitempty"`
  2806. // ForceSendFields is a list of field names (e.g. "CustomType") to
  2807. // unconditionally include in API requests. By default, fields with
  2808. // empty values are omitted from API requests. However, any non-pointer,
  2809. // non-interface field appearing in ForceSendFields will be sent to the
  2810. // server regardless of whether the field is empty or not. This may be
  2811. // used to include empty fields in Patch requests.
  2812. ForceSendFields []string `json:"-"`
  2813. // NullFields is a list of field names (e.g. "CustomType") to include in
  2814. // API requests with the JSON null value. By default, fields with empty
  2815. // values are omitted from API requests. However, any field with an
  2816. // empty value appearing in NullFields will be sent to the server as
  2817. // null. It is an error if a field in this list has a non-empty value.
  2818. // This may be used to include null fields in Patch requests.
  2819. NullFields []string `json:"-"`
  2820. }
  2821. func (s *UserExternalId) MarshalJSON() ([]byte, error) {
  2822. type NoMethod UserExternalId
  2823. raw := NoMethod(*s)
  2824. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2825. }
  2826. type UserGender struct {
  2827. // AddressMeAs: AddressMeAs. A human-readable string containing the
  2828. // proper way to refer to the profile owner by humans, for example
  2829. // "he/him/his" or "they/them/their".
  2830. AddressMeAs string `json:"addressMeAs,omitempty"`
  2831. // CustomGender: Custom gender.
  2832. CustomGender string `json:"customGender,omitempty"`
  2833. // Type: Gender.
  2834. Type string `json:"type,omitempty"`
  2835. // ForceSendFields is a list of field names (e.g. "AddressMeAs") to
  2836. // unconditionally include in API requests. By default, fields with
  2837. // empty values are omitted from API requests. However, any non-pointer,
  2838. // non-interface field appearing in ForceSendFields will be sent to the
  2839. // server regardless of whether the field is empty or not. This may be
  2840. // used to include empty fields in Patch requests.
  2841. ForceSendFields []string `json:"-"`
  2842. // NullFields is a list of field names (e.g. "AddressMeAs") to include
  2843. // in API requests with the JSON null value. By default, fields with
  2844. // empty values are omitted from API requests. However, any field with
  2845. // an empty value appearing in NullFields will be sent to the server as
  2846. // null. It is an error if a field in this list has a non-empty value.
  2847. // This may be used to include null fields in Patch requests.
  2848. NullFields []string `json:"-"`
  2849. }
  2850. func (s *UserGender) MarshalJSON() ([]byte, error) {
  2851. type NoMethod UserGender
  2852. raw := NoMethod(*s)
  2853. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2854. }
  2855. // UserIm: JSON template for instant messenger of an user.
  2856. type UserIm struct {
  2857. // CustomProtocol: Custom protocol.
  2858. CustomProtocol string `json:"customProtocol,omitempty"`
  2859. // CustomType: Custom type.
  2860. CustomType string `json:"customType,omitempty"`
  2861. // Im: Instant messenger id.
  2862. Im string `json:"im,omitempty"`
  2863. // Primary: If this is user's primary im. Only one entry could be marked
  2864. // as primary.
  2865. Primary bool `json:"primary,omitempty"`
  2866. // Protocol: Protocol used in the instant messenger. It should be one of
  2867. // the values from ImProtocolTypes map. Similar to type, it can take a
  2868. // CUSTOM value and specify the custom name in customProtocol field.
  2869. Protocol string `json:"protocol,omitempty"`
  2870. // Type: Each entry can have a type which indicates standard types of
  2871. // that entry. For example instant messengers could be of home, work
  2872. // etc. In addition to the standard type, an entry can have a custom
  2873. // type and can take any value. Such types should have the CUSTOM value
  2874. // as type and also have a customType value.
  2875. Type string `json:"type,omitempty"`
  2876. // ForceSendFields is a list of field names (e.g. "CustomProtocol") to
  2877. // unconditionally include in API requests. By default, fields with
  2878. // empty values are omitted from API requests. However, any non-pointer,
  2879. // non-interface field appearing in ForceSendFields will be sent to the
  2880. // server regardless of whether the field is empty or not. This may be
  2881. // used to include empty fields in Patch requests.
  2882. ForceSendFields []string `json:"-"`
  2883. // NullFields is a list of field names (e.g. "CustomProtocol") to
  2884. // include in API requests with the JSON null value. By default, fields
  2885. // with empty values are omitted from API requests. However, any field
  2886. // with an empty value appearing in NullFields will be sent to the
  2887. // server as null. It is an error if a field in this list has a
  2888. // non-empty value. This may be used to include null fields in Patch
  2889. // requests.
  2890. NullFields []string `json:"-"`
  2891. }
  2892. func (s *UserIm) MarshalJSON() ([]byte, error) {
  2893. type NoMethod UserIm
  2894. raw := NoMethod(*s)
  2895. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2896. }
  2897. // UserKeyword: JSON template for a keyword entry.
  2898. type UserKeyword struct {
  2899. // CustomType: Custom Type.
  2900. CustomType string `json:"customType,omitempty"`
  2901. // Type: Each entry can have a type which indicates standard type of
  2902. // that entry. For example, keyword could be of type occupation or
  2903. // outlook. In addition to the standard type, an entry can have a custom
  2904. // type and can give it any name. Such types should have the CUSTOM
  2905. // value as type and also have a customType value.
  2906. Type string `json:"type,omitempty"`
  2907. // Value: Keyword.
  2908. Value string `json:"value,omitempty"`
  2909. // ForceSendFields is a list of field names (e.g. "CustomType") to
  2910. // unconditionally include in API requests. By default, fields with
  2911. // empty values are omitted from API requests. However, any non-pointer,
  2912. // non-interface field appearing in ForceSendFields will be sent to the
  2913. // server regardless of whether the field is empty or not. This may be
  2914. // used to include empty fields in Patch requests.
  2915. ForceSendFields []string `json:"-"`
  2916. // NullFields is a list of field names (e.g. "CustomType") to include in
  2917. // API requests with the JSON null value. By default, fields with empty
  2918. // values are omitted from API requests. However, any field with an
  2919. // empty value appearing in NullFields will be sent to the server as
  2920. // null. It is an error if a field in this list has a non-empty value.
  2921. // This may be used to include null fields in Patch requests.
  2922. NullFields []string `json:"-"`
  2923. }
  2924. func (s *UserKeyword) MarshalJSON() ([]byte, error) {
  2925. type NoMethod UserKeyword
  2926. raw := NoMethod(*s)
  2927. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2928. }
  2929. // UserLanguage: JSON template for a language entry.
  2930. type UserLanguage struct {
  2931. // CustomLanguage: Other language. User can provide own language name if
  2932. // there is no corresponding Google III language code. If this is set
  2933. // LanguageCode can't be set
  2934. CustomLanguage string `json:"customLanguage,omitempty"`
  2935. // LanguageCode: Language Code. Should be used for storing Google III
  2936. // LanguageCode string representation for language. Illegal values cause
  2937. // SchemaException.
  2938. LanguageCode string `json:"languageCode,omitempty"`
  2939. // ForceSendFields is a list of field names (e.g. "CustomLanguage") to
  2940. // unconditionally include in API requests. By default, fields with
  2941. // empty values are omitted from API requests. However, any non-pointer,
  2942. // non-interface field appearing in ForceSendFields will be sent to the
  2943. // server regardless of whether the field is empty or not. This may be
  2944. // used to include empty fields in Patch requests.
  2945. ForceSendFields []string `json:"-"`
  2946. // NullFields is a list of field names (e.g. "CustomLanguage") to
  2947. // include in API requests with the JSON null value. By default, fields
  2948. // with empty values are omitted from API requests. However, any field
  2949. // with an empty value appearing in NullFields will be sent to the
  2950. // server as null. It is an error if a field in this list has a
  2951. // non-empty value. This may be used to include null fields in Patch
  2952. // requests.
  2953. NullFields []string `json:"-"`
  2954. }
  2955. func (s *UserLanguage) MarshalJSON() ([]byte, error) {
  2956. type NoMethod UserLanguage
  2957. raw := NoMethod(*s)
  2958. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2959. }
  2960. // UserLocation: JSON template for a location entry.
  2961. type UserLocation struct {
  2962. // Area: Textual location. This is most useful for display purposes to
  2963. // concisely describe the location. For example, "Mountain View, CA",
  2964. // "Near Seattle", "US-NYC-9TH 9A209A".
  2965. Area string `json:"area,omitempty"`
  2966. // BuildingId: Building Identifier.
  2967. BuildingId string `json:"buildingId,omitempty"`
  2968. // CustomType: Custom Type.
  2969. CustomType string `json:"customType,omitempty"`
  2970. // DeskCode: Most specific textual code of individual desk location.
  2971. DeskCode string `json:"deskCode,omitempty"`
  2972. // FloorName: Floor name/number.
  2973. FloorName string `json:"floorName,omitempty"`
  2974. // FloorSection: Floor section. More specific location within the floor.
  2975. // For example, if a floor is divided into sections "A", "B", and "C",
  2976. // this field would identify one of those values.
  2977. FloorSection string `json:"floorSection,omitempty"`
  2978. // Type: Each entry can have a type which indicates standard types of
  2979. // that entry. For example location could be of types default and desk.
  2980. // In addition to standard type, an entry can have a custom type and can
  2981. // give it any name. Such types should have "custom" as type and also
  2982. // have a customType value.
  2983. Type string `json:"type,omitempty"`
  2984. // ForceSendFields is a list of field names (e.g. "Area") to
  2985. // unconditionally include in API requests. By default, fields with
  2986. // empty values are omitted from API requests. However, any non-pointer,
  2987. // non-interface field appearing in ForceSendFields will be sent to the
  2988. // server regardless of whether the field is empty or not. This may be
  2989. // used to include empty fields in Patch requests.
  2990. ForceSendFields []string `json:"-"`
  2991. // NullFields is a list of field names (e.g. "Area") to include in API
  2992. // requests with the JSON null value. By default, fields with empty
  2993. // values are omitted from API requests. However, any field with an
  2994. // empty value appearing in NullFields will be sent to the server as
  2995. // null. It is an error if a field in this list has a non-empty value.
  2996. // This may be used to include null fields in Patch requests.
  2997. NullFields []string `json:"-"`
  2998. }
  2999. func (s *UserLocation) MarshalJSON() ([]byte, error) {
  3000. type NoMethod UserLocation
  3001. raw := NoMethod(*s)
  3002. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3003. }
  3004. // UserMakeAdmin: JSON request template for setting/revoking admin
  3005. // status of a user in Directory API.
  3006. type UserMakeAdmin struct {
  3007. // Status: Boolean indicating new admin status of the user
  3008. Status bool `json:"status,omitempty"`
  3009. // ForceSendFields is a list of field names (e.g. "Status") to
  3010. // unconditionally include in API requests. By default, fields with
  3011. // empty values are omitted from API requests. However, any non-pointer,
  3012. // non-interface field appearing in ForceSendFields will be sent to the
  3013. // server regardless of whether the field is empty or not. This may be
  3014. // used to include empty fields in Patch requests.
  3015. ForceSendFields []string `json:"-"`
  3016. // NullFields is a list of field names (e.g. "Status") to include in API
  3017. // requests with the JSON null value. By default, fields with empty
  3018. // values are omitted from API requests. However, any field with an
  3019. // empty value appearing in NullFields will be sent to the server as
  3020. // null. It is an error if a field in this list has a non-empty value.
  3021. // This may be used to include null fields in Patch requests.
  3022. NullFields []string `json:"-"`
  3023. }
  3024. func (s *UserMakeAdmin) MarshalJSON() ([]byte, error) {
  3025. type NoMethod UserMakeAdmin
  3026. raw := NoMethod(*s)
  3027. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3028. }
  3029. // UserName: JSON template for name of a user in Directory API.
  3030. type UserName struct {
  3031. // FamilyName: Last Name
  3032. FamilyName string `json:"familyName,omitempty"`
  3033. // FullName: Full Name
  3034. FullName string `json:"fullName,omitempty"`
  3035. // GivenName: First Name
  3036. GivenName string `json:"givenName,omitempty"`
  3037. // ForceSendFields is a list of field names (e.g. "FamilyName") to
  3038. // unconditionally include in API requests. By default, fields with
  3039. // empty values are omitted from API requests. However, any non-pointer,
  3040. // non-interface field appearing in ForceSendFields will be sent to the
  3041. // server regardless of whether the field is empty or not. This may be
  3042. // used to include empty fields in Patch requests.
  3043. ForceSendFields []string `json:"-"`
  3044. // NullFields is a list of field names (e.g. "FamilyName") to include in
  3045. // API requests with the JSON null value. By default, fields with empty
  3046. // values are omitted from API requests. However, any field with an
  3047. // empty value appearing in NullFields will be sent to the server as
  3048. // null. It is an error if a field in this list has a non-empty value.
  3049. // This may be used to include null fields in Patch requests.
  3050. NullFields []string `json:"-"`
  3051. }
  3052. func (s *UserName) MarshalJSON() ([]byte, error) {
  3053. type NoMethod UserName
  3054. raw := NoMethod(*s)
  3055. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3056. }
  3057. // UserOrganization: JSON template for an organization entry.
  3058. type UserOrganization struct {
  3059. // CostCenter: The cost center of the users department.
  3060. CostCenter string `json:"costCenter,omitempty"`
  3061. // CustomType: Custom type.
  3062. CustomType string `json:"customType,omitempty"`
  3063. // Department: Department within the organization.
  3064. Department string `json:"department,omitempty"`
  3065. // Description: Description of the organization.
  3066. Description string `json:"description,omitempty"`
  3067. // Domain: The domain to which the organization belongs to.
  3068. Domain string `json:"domain,omitempty"`
  3069. // FullTimeEquivalent: The full-time equivalent percent within the
  3070. // organization (100000 = 100%).
  3071. FullTimeEquivalent int64 `json:"fullTimeEquivalent,omitempty"`
  3072. // Location: Location of the organization. This need not be fully
  3073. // qualified address.
  3074. Location string `json:"location,omitempty"`
  3075. // Name: Name of the organization
  3076. Name string `json:"name,omitempty"`
  3077. // Primary: If it user's primary organization.
  3078. Primary bool `json:"primary,omitempty"`
  3079. // Symbol: Symbol of the organization.
  3080. Symbol string `json:"symbol,omitempty"`
  3081. // Title: Title (designation) of the user in the organization.
  3082. Title string `json:"title,omitempty"`
  3083. // Type: Each entry can have a type which indicates standard types of
  3084. // that entry. For example organization could be of school, work etc. In
  3085. // addition to the standard type, an entry can have a custom type and
  3086. // can give it any name. Such types should have the CUSTOM value as type
  3087. // and also have a CustomType value.
  3088. Type string `json:"type,omitempty"`
  3089. // ForceSendFields is a list of field names (e.g. "CostCenter") to
  3090. // unconditionally include in API requests. By default, fields with
  3091. // empty values are omitted from API requests. However, any non-pointer,
  3092. // non-interface field appearing in ForceSendFields will be sent to the
  3093. // server regardless of whether the field is empty or not. This may be
  3094. // used to include empty fields in Patch requests.
  3095. ForceSendFields []string `json:"-"`
  3096. // NullFields is a list of field names (e.g. "CostCenter") to include in
  3097. // API requests with the JSON null value. By default, fields with empty
  3098. // values are omitted from API requests. However, any field with an
  3099. // empty value appearing in NullFields will be sent to the server as
  3100. // null. It is an error if a field in this list has a non-empty value.
  3101. // This may be used to include null fields in Patch requests.
  3102. NullFields []string `json:"-"`
  3103. }
  3104. func (s *UserOrganization) MarshalJSON() ([]byte, error) {
  3105. type NoMethod UserOrganization
  3106. raw := NoMethod(*s)
  3107. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3108. }
  3109. // UserPhone: JSON template for a phone entry.
  3110. type UserPhone struct {
  3111. // CustomType: Custom Type.
  3112. CustomType string `json:"customType,omitempty"`
  3113. // Primary: If this is user's primary phone or not.
  3114. Primary bool `json:"primary,omitempty"`
  3115. // Type: Each entry can have a type which indicates standard types of
  3116. // that entry. For example phone could be of home_fax, work, mobile etc.
  3117. // In addition to the standard type, an entry can have a custom type and
  3118. // can give it any name. Such types should have the CUSTOM value as type
  3119. // and also have a customType value.
  3120. Type string `json:"type,omitempty"`
  3121. // Value: Phone number.
  3122. Value string `json:"value,omitempty"`
  3123. // ForceSendFields is a list of field names (e.g. "CustomType") to
  3124. // unconditionally include in API requests. By default, fields with
  3125. // empty values are omitted from API requests. However, any non-pointer,
  3126. // non-interface field appearing in ForceSendFields will be sent to the
  3127. // server regardless of whether the field is empty or not. This may be
  3128. // used to include empty fields in Patch requests.
  3129. ForceSendFields []string `json:"-"`
  3130. // NullFields is a list of field names (e.g. "CustomType") to include in
  3131. // API requests with the JSON null value. By default, fields with empty
  3132. // values are omitted from API requests. However, any field with an
  3133. // empty value appearing in NullFields will be sent to the server as
  3134. // null. It is an error if a field in this list has a non-empty value.
  3135. // This may be used to include null fields in Patch requests.
  3136. NullFields []string `json:"-"`
  3137. }
  3138. func (s *UserPhone) MarshalJSON() ([]byte, error) {
  3139. type NoMethod UserPhone
  3140. raw := NoMethod(*s)
  3141. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3142. }
  3143. // UserPhoto: JSON template for Photo object in Directory API.
  3144. type UserPhoto struct {
  3145. // Etag: ETag of the resource.
  3146. Etag string `json:"etag,omitempty"`
  3147. // Height: Height in pixels of the photo
  3148. Height int64 `json:"height,omitempty"`
  3149. // Id: Unique identifier of User (Read-only)
  3150. Id string `json:"id,omitempty"`
  3151. // Kind: Kind of resource this is.
  3152. Kind string `json:"kind,omitempty"`
  3153. // MimeType: Mime Type of the photo
  3154. MimeType string `json:"mimeType,omitempty"`
  3155. // PhotoData: Base64 encoded photo data
  3156. PhotoData string `json:"photoData,omitempty"`
  3157. // PrimaryEmail: Primary email of User (Read-only)
  3158. PrimaryEmail string `json:"primaryEmail,omitempty"`
  3159. // Width: Width in pixels of the photo
  3160. Width int64 `json:"width,omitempty"`
  3161. // ServerResponse contains the HTTP response code and headers from the
  3162. // server.
  3163. googleapi.ServerResponse `json:"-"`
  3164. // ForceSendFields is a list of field names (e.g. "Etag") to
  3165. // unconditionally include in API requests. By default, fields with
  3166. // empty values are omitted from API requests. However, any non-pointer,
  3167. // non-interface field appearing in ForceSendFields will be sent to the
  3168. // server regardless of whether the field is empty or not. This may be
  3169. // used to include empty fields in Patch requests.
  3170. ForceSendFields []string `json:"-"`
  3171. // NullFields is a list of field names (e.g. "Etag") to include in API
  3172. // requests with the JSON null value. By default, fields with empty
  3173. // values are omitted from API requests. However, any field with an
  3174. // empty value appearing in NullFields will be sent to the server as
  3175. // null. It is an error if a field in this list has a non-empty value.
  3176. // This may be used to include null fields in Patch requests.
  3177. NullFields []string `json:"-"`
  3178. }
  3179. func (s *UserPhoto) MarshalJSON() ([]byte, error) {
  3180. type NoMethod UserPhoto
  3181. raw := NoMethod(*s)
  3182. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3183. }
  3184. // UserPosixAccount: JSON template for a POSIX account entry.
  3185. // Description of the field family: go/fbs-posix.
  3186. type UserPosixAccount struct {
  3187. // AccountId: A POSIX account field identifier. (Read-only)
  3188. AccountId string `json:"accountId,omitempty"`
  3189. // Gecos: The GECOS (user information) for this account.
  3190. Gecos string `json:"gecos,omitempty"`
  3191. // Gid: The default group ID.
  3192. Gid uint64 `json:"gid,omitempty,string"`
  3193. // HomeDirectory: The path to the home directory for this account.
  3194. HomeDirectory string `json:"homeDirectory,omitempty"`
  3195. // OperatingSystemType: The operating system type for this account.
  3196. OperatingSystemType string `json:"operatingSystemType,omitempty"`
  3197. // Primary: If this is user's primary account within the SystemId.
  3198. Primary bool `json:"primary,omitempty"`
  3199. // Shell: The path to the login shell for this account.
  3200. Shell string `json:"shell,omitempty"`
  3201. // SystemId: System identifier for which account Username or Uid apply
  3202. // to.
  3203. SystemId string `json:"systemId,omitempty"`
  3204. // Uid: The POSIX compliant user ID.
  3205. Uid uint64 `json:"uid,omitempty,string"`
  3206. // Username: The username of the account.
  3207. Username string `json:"username,omitempty"`
  3208. // ForceSendFields is a list of field names (e.g. "AccountId") to
  3209. // unconditionally include in API requests. By default, fields with
  3210. // empty values are omitted from API requests. However, any non-pointer,
  3211. // non-interface field appearing in ForceSendFields will be sent to the
  3212. // server regardless of whether the field is empty or not. This may be
  3213. // used to include empty fields in Patch requests.
  3214. ForceSendFields []string `json:"-"`
  3215. // NullFields is a list of field names (e.g. "AccountId") to include in
  3216. // API requests with the JSON null value. By default, fields with empty
  3217. // values are omitted from API requests. However, any field with an
  3218. // empty value appearing in NullFields will be sent to the server as
  3219. // null. It is an error if a field in this list has a non-empty value.
  3220. // This may be used to include null fields in Patch requests.
  3221. NullFields []string `json:"-"`
  3222. }
  3223. func (s *UserPosixAccount) MarshalJSON() ([]byte, error) {
  3224. type NoMethod UserPosixAccount
  3225. raw := NoMethod(*s)
  3226. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3227. }
  3228. // UserRelation: JSON template for a relation entry.
  3229. type UserRelation struct {
  3230. // CustomType: Custom Type.
  3231. CustomType string `json:"customType,omitempty"`
  3232. // Type: The relation of the user. Some of the possible values are
  3233. // mother, father, sister, brother, manager, assistant, partner.
  3234. Type string `json:"type,omitempty"`
  3235. // Value: The name of the relation.
  3236. Value string `json:"value,omitempty"`
  3237. // ForceSendFields is a list of field names (e.g. "CustomType") to
  3238. // unconditionally include in API requests. By default, fields with
  3239. // empty values are omitted from API requests. However, any non-pointer,
  3240. // non-interface field appearing in ForceSendFields will be sent to the
  3241. // server regardless of whether the field is empty or not. This may be
  3242. // used to include empty fields in Patch requests.
  3243. ForceSendFields []string `json:"-"`
  3244. // NullFields is a list of field names (e.g. "CustomType") to include in
  3245. // API requests with the JSON null value. By default, fields with empty
  3246. // values are omitted from API requests. However, any field with an
  3247. // empty value appearing in NullFields will be sent to the server as
  3248. // null. It is an error if a field in this list has a non-empty value.
  3249. // This may be used to include null fields in Patch requests.
  3250. NullFields []string `json:"-"`
  3251. }
  3252. func (s *UserRelation) MarshalJSON() ([]byte, error) {
  3253. type NoMethod UserRelation
  3254. raw := NoMethod(*s)
  3255. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3256. }
  3257. // UserSshPublicKey: JSON template for a POSIX account entry.
  3258. type UserSshPublicKey struct {
  3259. // ExpirationTimeUsec: An expiration time in microseconds since epoch.
  3260. ExpirationTimeUsec int64 `json:"expirationTimeUsec,omitempty,string"`
  3261. // Fingerprint: A SHA-256 fingerprint of the SSH public key. (Read-only)
  3262. Fingerprint string `json:"fingerprint,omitempty"`
  3263. // Key: An SSH public key.
  3264. Key string `json:"key,omitempty"`
  3265. // ForceSendFields is a list of field names (e.g. "ExpirationTimeUsec")
  3266. // to unconditionally include in API requests. By default, fields with
  3267. // empty values are omitted from API requests. However, any non-pointer,
  3268. // non-interface field appearing in ForceSendFields will be sent to the
  3269. // server regardless of whether the field is empty or not. This may be
  3270. // used to include empty fields in Patch requests.
  3271. ForceSendFields []string `json:"-"`
  3272. // NullFields is a list of field names (e.g. "ExpirationTimeUsec") to
  3273. // include in API requests with the JSON null value. By default, fields
  3274. // with empty values are omitted from API requests. However, any field
  3275. // with an empty value appearing in NullFields will be sent to the
  3276. // server as null. It is an error if a field in this list has a
  3277. // non-empty value. This may be used to include null fields in Patch
  3278. // requests.
  3279. NullFields []string `json:"-"`
  3280. }
  3281. func (s *UserSshPublicKey) MarshalJSON() ([]byte, error) {
  3282. type NoMethod UserSshPublicKey
  3283. raw := NoMethod(*s)
  3284. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3285. }
  3286. // UserUndelete: JSON request template to undelete a user in Directory
  3287. // API.
  3288. type UserUndelete struct {
  3289. // OrgUnitPath: OrgUnit of User
  3290. OrgUnitPath string `json:"orgUnitPath,omitempty"`
  3291. // ForceSendFields is a list of field names (e.g. "OrgUnitPath") to
  3292. // unconditionally include in API requests. By default, fields with
  3293. // empty values are omitted from API requests. However, any non-pointer,
  3294. // non-interface field appearing in ForceSendFields will be sent to the
  3295. // server regardless of whether the field is empty or not. This may be
  3296. // used to include empty fields in Patch requests.
  3297. ForceSendFields []string `json:"-"`
  3298. // NullFields is a list of field names (e.g. "OrgUnitPath") to include
  3299. // in API requests with the JSON null value. By default, fields with
  3300. // empty values are omitted from API requests. However, any field with
  3301. // an empty value appearing in NullFields will be sent to the server as
  3302. // null. It is an error if a field in this list has a non-empty value.
  3303. // This may be used to include null fields in Patch requests.
  3304. NullFields []string `json:"-"`
  3305. }
  3306. func (s *UserUndelete) MarshalJSON() ([]byte, error) {
  3307. type NoMethod UserUndelete
  3308. raw := NoMethod(*s)
  3309. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3310. }
  3311. // UserWebsite: JSON template for a website entry.
  3312. type UserWebsite struct {
  3313. // CustomType: Custom Type.
  3314. CustomType string `json:"customType,omitempty"`
  3315. // Primary: If this is user's primary website or not.
  3316. Primary bool `json:"primary,omitempty"`
  3317. // Type: Each entry can have a type which indicates standard types of
  3318. // that entry. For example website could be of home, work, blog etc. In
  3319. // addition to the standard type, an entry can have a custom type and
  3320. // can give it any name. Such types should have the CUSTOM value as type
  3321. // and also have a customType value.
  3322. Type string `json:"type,omitempty"`
  3323. // Value: Website.
  3324. Value string `json:"value,omitempty"`
  3325. // ForceSendFields is a list of field names (e.g. "CustomType") to
  3326. // unconditionally include in API requests. By default, fields with
  3327. // empty values are omitted from API requests. However, any non-pointer,
  3328. // non-interface field appearing in ForceSendFields will be sent to the
  3329. // server regardless of whether the field is empty or not. This may be
  3330. // used to include empty fields in Patch requests.
  3331. ForceSendFields []string `json:"-"`
  3332. // NullFields is a list of field names (e.g. "CustomType") to include in
  3333. // API requests with the JSON null value. By default, fields with empty
  3334. // values are omitted from API requests. However, any field with an
  3335. // empty value appearing in NullFields will be sent to the server as
  3336. // null. It is an error if a field in this list has a non-empty value.
  3337. // This may be used to include null fields in Patch requests.
  3338. NullFields []string `json:"-"`
  3339. }
  3340. func (s *UserWebsite) MarshalJSON() ([]byte, error) {
  3341. type NoMethod UserWebsite
  3342. raw := NoMethod(*s)
  3343. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3344. }
  3345. // Users: JSON response template for List Users operation in Apps
  3346. // Directory API.
  3347. type Users struct {
  3348. // Etag: ETag of the resource.
  3349. Etag string `json:"etag,omitempty"`
  3350. // Kind: Kind of resource this is.
  3351. Kind string `json:"kind,omitempty"`
  3352. // NextPageToken: Token used to access next page of this result.
  3353. NextPageToken string `json:"nextPageToken,omitempty"`
  3354. // TriggerEvent: Event that triggered this response (only used in case
  3355. // of Push Response)
  3356. TriggerEvent string `json:"trigger_event,omitempty"`
  3357. // Users: List of user objects.
  3358. Users []*User `json:"users,omitempty"`
  3359. // ServerResponse contains the HTTP response code and headers from the
  3360. // server.
  3361. googleapi.ServerResponse `json:"-"`
  3362. // ForceSendFields is a list of field names (e.g. "Etag") to
  3363. // unconditionally include in API requests. By default, fields with
  3364. // empty values are omitted from API requests. However, any non-pointer,
  3365. // non-interface field appearing in ForceSendFields will be sent to the
  3366. // server regardless of whether the field is empty or not. This may be
  3367. // used to include empty fields in Patch requests.
  3368. ForceSendFields []string `json:"-"`
  3369. // NullFields is a list of field names (e.g. "Etag") to include in API
  3370. // requests with the JSON null value. By default, fields with empty
  3371. // values are omitted from API requests. However, any field with an
  3372. // empty value appearing in NullFields will be sent to the server as
  3373. // null. It is an error if a field in this list has a non-empty value.
  3374. // This may be used to include null fields in Patch requests.
  3375. NullFields []string `json:"-"`
  3376. }
  3377. func (s *Users) MarshalJSON() ([]byte, error) {
  3378. type NoMethod Users
  3379. raw := NoMethod(*s)
  3380. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3381. }
  3382. // VerificationCode: JSON template for verification codes in Directory
  3383. // API.
  3384. type VerificationCode struct {
  3385. // Etag: ETag of the resource.
  3386. Etag string `json:"etag,omitempty"`
  3387. // Kind: The type of the resource. This is always
  3388. // admin#directory#verificationCode.
  3389. Kind string `json:"kind,omitempty"`
  3390. // UserId: The obfuscated unique ID of the user.
  3391. UserId string `json:"userId,omitempty"`
  3392. // VerificationCode: A current verification code for the user.
  3393. // Invalidated or used verification codes are not returned as part of
  3394. // the result.
  3395. VerificationCode string `json:"verificationCode,omitempty"`
  3396. // ForceSendFields is a list of field names (e.g. "Etag") to
  3397. // unconditionally include in API requests. By default, fields with
  3398. // empty values are omitted from API requests. However, any non-pointer,
  3399. // non-interface field appearing in ForceSendFields will be sent to the
  3400. // server regardless of whether the field is empty or not. This may be
  3401. // used to include empty fields in Patch requests.
  3402. ForceSendFields []string `json:"-"`
  3403. // NullFields is a list of field names (e.g. "Etag") to include in API
  3404. // requests with the JSON null value. By default, fields with empty
  3405. // values are omitted from API requests. However, any field with an
  3406. // empty value appearing in NullFields will be sent to the server as
  3407. // null. It is an error if a field in this list has a non-empty value.
  3408. // This may be used to include null fields in Patch requests.
  3409. NullFields []string `json:"-"`
  3410. }
  3411. func (s *VerificationCode) MarshalJSON() ([]byte, error) {
  3412. type NoMethod VerificationCode
  3413. raw := NoMethod(*s)
  3414. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3415. }
  3416. // VerificationCodes: JSON response template for List verification codes
  3417. // operation in Directory API.
  3418. type VerificationCodes struct {
  3419. // Etag: ETag of the resource.
  3420. Etag string `json:"etag,omitempty"`
  3421. // Items: A list of verification code resources.
  3422. Items []*VerificationCode `json:"items,omitempty"`
  3423. // Kind: The type of the resource. This is always
  3424. // admin#directory#verificationCodesList.
  3425. Kind string `json:"kind,omitempty"`
  3426. // ServerResponse contains the HTTP response code and headers from the
  3427. // server.
  3428. googleapi.ServerResponse `json:"-"`
  3429. // ForceSendFields is a list of field names (e.g. "Etag") to
  3430. // unconditionally include in API requests. By default, fields with
  3431. // empty values are omitted from API requests. However, any non-pointer,
  3432. // non-interface field appearing in ForceSendFields will be sent to the
  3433. // server regardless of whether the field is empty or not. This may be
  3434. // used to include empty fields in Patch requests.
  3435. ForceSendFields []string `json:"-"`
  3436. // NullFields is a list of field names (e.g. "Etag") to include in API
  3437. // requests with the JSON null value. By default, fields with empty
  3438. // values are omitted from API requests. However, any field with an
  3439. // empty value appearing in NullFields will be sent to the server as
  3440. // null. It is an error if a field in this list has a non-empty value.
  3441. // This may be used to include null fields in Patch requests.
  3442. NullFields []string `json:"-"`
  3443. }
  3444. func (s *VerificationCodes) MarshalJSON() ([]byte, error) {
  3445. type NoMethod VerificationCodes
  3446. raw := NoMethod(*s)
  3447. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3448. }
  3449. // method id "directory.asps.delete":
  3450. type AspsDeleteCall struct {
  3451. s *Service
  3452. userKey string
  3453. codeId int64
  3454. urlParams_ gensupport.URLParams
  3455. ctx_ context.Context
  3456. header_ http.Header
  3457. }
  3458. // Delete: Delete an ASP issued by a user.
  3459. func (r *AspsService) Delete(userKey string, codeId int64) *AspsDeleteCall {
  3460. c := &AspsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3461. c.userKey = userKey
  3462. c.codeId = codeId
  3463. return c
  3464. }
  3465. // Fields allows partial responses to be retrieved. See
  3466. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3467. // for more information.
  3468. func (c *AspsDeleteCall) Fields(s ...googleapi.Field) *AspsDeleteCall {
  3469. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3470. return c
  3471. }
  3472. // Context sets the context to be used in this call's Do method. Any
  3473. // pending HTTP request will be aborted if the provided context is
  3474. // canceled.
  3475. func (c *AspsDeleteCall) Context(ctx context.Context) *AspsDeleteCall {
  3476. c.ctx_ = ctx
  3477. return c
  3478. }
  3479. // Header returns an http.Header that can be modified by the caller to
  3480. // add HTTP headers to the request.
  3481. func (c *AspsDeleteCall) Header() http.Header {
  3482. if c.header_ == nil {
  3483. c.header_ = make(http.Header)
  3484. }
  3485. return c.header_
  3486. }
  3487. func (c *AspsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3488. reqHeaders := make(http.Header)
  3489. for k, v := range c.header_ {
  3490. reqHeaders[k] = v
  3491. }
  3492. reqHeaders.Set("User-Agent", c.s.userAgent())
  3493. var body io.Reader = nil
  3494. c.urlParams_.Set("alt", alt)
  3495. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/asps/{codeId}")
  3496. urls += "?" + c.urlParams_.Encode()
  3497. req, _ := http.NewRequest("DELETE", urls, body)
  3498. req.Header = reqHeaders
  3499. googleapi.Expand(req.URL, map[string]string{
  3500. "userKey": c.userKey,
  3501. "codeId": strconv.FormatInt(c.codeId, 10),
  3502. })
  3503. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3504. }
  3505. // Do executes the "directory.asps.delete" call.
  3506. func (c *AspsDeleteCall) Do(opts ...googleapi.CallOption) error {
  3507. gensupport.SetOptions(c.urlParams_, opts...)
  3508. res, err := c.doRequest("json")
  3509. if err != nil {
  3510. return err
  3511. }
  3512. defer googleapi.CloseBody(res)
  3513. if err := googleapi.CheckResponse(res); err != nil {
  3514. return err
  3515. }
  3516. return nil
  3517. // {
  3518. // "description": "Delete an ASP issued by a user.",
  3519. // "httpMethod": "DELETE",
  3520. // "id": "directory.asps.delete",
  3521. // "parameterOrder": [
  3522. // "userKey",
  3523. // "codeId"
  3524. // ],
  3525. // "parameters": {
  3526. // "codeId": {
  3527. // "description": "The unique ID of the ASP to be deleted.",
  3528. // "format": "int32",
  3529. // "location": "path",
  3530. // "required": true,
  3531. // "type": "integer"
  3532. // },
  3533. // "userKey": {
  3534. // "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.",
  3535. // "location": "path",
  3536. // "required": true,
  3537. // "type": "string"
  3538. // }
  3539. // },
  3540. // "path": "users/{userKey}/asps/{codeId}",
  3541. // "scopes": [
  3542. // "https://www.googleapis.com/auth/admin.directory.user.security"
  3543. // ]
  3544. // }
  3545. }
  3546. // method id "directory.asps.get":
  3547. type AspsGetCall struct {
  3548. s *Service
  3549. userKey string
  3550. codeId int64
  3551. urlParams_ gensupport.URLParams
  3552. ifNoneMatch_ string
  3553. ctx_ context.Context
  3554. header_ http.Header
  3555. }
  3556. // Get: Get information about an ASP issued by a user.
  3557. func (r *AspsService) Get(userKey string, codeId int64) *AspsGetCall {
  3558. c := &AspsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3559. c.userKey = userKey
  3560. c.codeId = codeId
  3561. return c
  3562. }
  3563. // Fields allows partial responses to be retrieved. See
  3564. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3565. // for more information.
  3566. func (c *AspsGetCall) Fields(s ...googleapi.Field) *AspsGetCall {
  3567. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3568. return c
  3569. }
  3570. // IfNoneMatch sets the optional parameter which makes the operation
  3571. // fail if the object's ETag matches the given value. This is useful for
  3572. // getting updates only after the object has changed since the last
  3573. // request. Use googleapi.IsNotModified to check whether the response
  3574. // error from Do is the result of In-None-Match.
  3575. func (c *AspsGetCall) IfNoneMatch(entityTag string) *AspsGetCall {
  3576. c.ifNoneMatch_ = entityTag
  3577. return c
  3578. }
  3579. // Context sets the context to be used in this call's Do method. Any
  3580. // pending HTTP request will be aborted if the provided context is
  3581. // canceled.
  3582. func (c *AspsGetCall) Context(ctx context.Context) *AspsGetCall {
  3583. c.ctx_ = ctx
  3584. return c
  3585. }
  3586. // Header returns an http.Header that can be modified by the caller to
  3587. // add HTTP headers to the request.
  3588. func (c *AspsGetCall) Header() http.Header {
  3589. if c.header_ == nil {
  3590. c.header_ = make(http.Header)
  3591. }
  3592. return c.header_
  3593. }
  3594. func (c *AspsGetCall) doRequest(alt string) (*http.Response, error) {
  3595. reqHeaders := make(http.Header)
  3596. for k, v := range c.header_ {
  3597. reqHeaders[k] = v
  3598. }
  3599. reqHeaders.Set("User-Agent", c.s.userAgent())
  3600. if c.ifNoneMatch_ != "" {
  3601. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3602. }
  3603. var body io.Reader = nil
  3604. c.urlParams_.Set("alt", alt)
  3605. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/asps/{codeId}")
  3606. urls += "?" + c.urlParams_.Encode()
  3607. req, _ := http.NewRequest("GET", urls, body)
  3608. req.Header = reqHeaders
  3609. googleapi.Expand(req.URL, map[string]string{
  3610. "userKey": c.userKey,
  3611. "codeId": strconv.FormatInt(c.codeId, 10),
  3612. })
  3613. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3614. }
  3615. // Do executes the "directory.asps.get" call.
  3616. // Exactly one of *Asp or error will be non-nil. Any non-2xx status code
  3617. // is an error. Response headers are in either
  3618. // *Asp.ServerResponse.Header or (if a response was returned at all) in
  3619. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3620. // whether the returned error was because http.StatusNotModified was
  3621. // returned.
  3622. func (c *AspsGetCall) Do(opts ...googleapi.CallOption) (*Asp, error) {
  3623. gensupport.SetOptions(c.urlParams_, opts...)
  3624. res, err := c.doRequest("json")
  3625. if res != nil && res.StatusCode == http.StatusNotModified {
  3626. if res.Body != nil {
  3627. res.Body.Close()
  3628. }
  3629. return nil, &googleapi.Error{
  3630. Code: res.StatusCode,
  3631. Header: res.Header,
  3632. }
  3633. }
  3634. if err != nil {
  3635. return nil, err
  3636. }
  3637. defer googleapi.CloseBody(res)
  3638. if err := googleapi.CheckResponse(res); err != nil {
  3639. return nil, err
  3640. }
  3641. ret := &Asp{
  3642. ServerResponse: googleapi.ServerResponse{
  3643. Header: res.Header,
  3644. HTTPStatusCode: res.StatusCode,
  3645. },
  3646. }
  3647. target := &ret
  3648. if err := gensupport.DecodeResponse(target, res); err != nil {
  3649. return nil, err
  3650. }
  3651. return ret, nil
  3652. // {
  3653. // "description": "Get information about an ASP issued by a user.",
  3654. // "httpMethod": "GET",
  3655. // "id": "directory.asps.get",
  3656. // "parameterOrder": [
  3657. // "userKey",
  3658. // "codeId"
  3659. // ],
  3660. // "parameters": {
  3661. // "codeId": {
  3662. // "description": "The unique ID of the ASP.",
  3663. // "format": "int32",
  3664. // "location": "path",
  3665. // "required": true,
  3666. // "type": "integer"
  3667. // },
  3668. // "userKey": {
  3669. // "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.",
  3670. // "location": "path",
  3671. // "required": true,
  3672. // "type": "string"
  3673. // }
  3674. // },
  3675. // "path": "users/{userKey}/asps/{codeId}",
  3676. // "response": {
  3677. // "$ref": "Asp"
  3678. // },
  3679. // "scopes": [
  3680. // "https://www.googleapis.com/auth/admin.directory.user.security"
  3681. // ]
  3682. // }
  3683. }
  3684. // method id "directory.asps.list":
  3685. type AspsListCall struct {
  3686. s *Service
  3687. userKey string
  3688. urlParams_ gensupport.URLParams
  3689. ifNoneMatch_ string
  3690. ctx_ context.Context
  3691. header_ http.Header
  3692. }
  3693. // List: List the ASPs issued by a user.
  3694. func (r *AspsService) List(userKey string) *AspsListCall {
  3695. c := &AspsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3696. c.userKey = userKey
  3697. return c
  3698. }
  3699. // Fields allows partial responses to be retrieved. See
  3700. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3701. // for more information.
  3702. func (c *AspsListCall) Fields(s ...googleapi.Field) *AspsListCall {
  3703. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3704. return c
  3705. }
  3706. // IfNoneMatch sets the optional parameter which makes the operation
  3707. // fail if the object's ETag matches the given value. This is useful for
  3708. // getting updates only after the object has changed since the last
  3709. // request. Use googleapi.IsNotModified to check whether the response
  3710. // error from Do is the result of In-None-Match.
  3711. func (c *AspsListCall) IfNoneMatch(entityTag string) *AspsListCall {
  3712. c.ifNoneMatch_ = entityTag
  3713. return c
  3714. }
  3715. // Context sets the context to be used in this call's Do method. Any
  3716. // pending HTTP request will be aborted if the provided context is
  3717. // canceled.
  3718. func (c *AspsListCall) Context(ctx context.Context) *AspsListCall {
  3719. c.ctx_ = ctx
  3720. return c
  3721. }
  3722. // Header returns an http.Header that can be modified by the caller to
  3723. // add HTTP headers to the request.
  3724. func (c *AspsListCall) Header() http.Header {
  3725. if c.header_ == nil {
  3726. c.header_ = make(http.Header)
  3727. }
  3728. return c.header_
  3729. }
  3730. func (c *AspsListCall) doRequest(alt string) (*http.Response, error) {
  3731. reqHeaders := make(http.Header)
  3732. for k, v := range c.header_ {
  3733. reqHeaders[k] = v
  3734. }
  3735. reqHeaders.Set("User-Agent", c.s.userAgent())
  3736. if c.ifNoneMatch_ != "" {
  3737. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3738. }
  3739. var body io.Reader = nil
  3740. c.urlParams_.Set("alt", alt)
  3741. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/asps")
  3742. urls += "?" + c.urlParams_.Encode()
  3743. req, _ := http.NewRequest("GET", urls, body)
  3744. req.Header = reqHeaders
  3745. googleapi.Expand(req.URL, map[string]string{
  3746. "userKey": c.userKey,
  3747. })
  3748. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3749. }
  3750. // Do executes the "directory.asps.list" call.
  3751. // Exactly one of *Asps or error will be non-nil. Any non-2xx status
  3752. // code is an error. Response headers are in either
  3753. // *Asps.ServerResponse.Header or (if a response was returned at all) in
  3754. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3755. // whether the returned error was because http.StatusNotModified was
  3756. // returned.
  3757. func (c *AspsListCall) Do(opts ...googleapi.CallOption) (*Asps, error) {
  3758. gensupport.SetOptions(c.urlParams_, opts...)
  3759. res, err := c.doRequest("json")
  3760. if res != nil && res.StatusCode == http.StatusNotModified {
  3761. if res.Body != nil {
  3762. res.Body.Close()
  3763. }
  3764. return nil, &googleapi.Error{
  3765. Code: res.StatusCode,
  3766. Header: res.Header,
  3767. }
  3768. }
  3769. if err != nil {
  3770. return nil, err
  3771. }
  3772. defer googleapi.CloseBody(res)
  3773. if err := googleapi.CheckResponse(res); err != nil {
  3774. return nil, err
  3775. }
  3776. ret := &Asps{
  3777. ServerResponse: googleapi.ServerResponse{
  3778. Header: res.Header,
  3779. HTTPStatusCode: res.StatusCode,
  3780. },
  3781. }
  3782. target := &ret
  3783. if err := gensupport.DecodeResponse(target, res); err != nil {
  3784. return nil, err
  3785. }
  3786. return ret, nil
  3787. // {
  3788. // "description": "List the ASPs issued by a user.",
  3789. // "httpMethod": "GET",
  3790. // "id": "directory.asps.list",
  3791. // "parameterOrder": [
  3792. // "userKey"
  3793. // ],
  3794. // "parameters": {
  3795. // "userKey": {
  3796. // "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.",
  3797. // "location": "path",
  3798. // "required": true,
  3799. // "type": "string"
  3800. // }
  3801. // },
  3802. // "path": "users/{userKey}/asps",
  3803. // "response": {
  3804. // "$ref": "Asps"
  3805. // },
  3806. // "scopes": [
  3807. // "https://www.googleapis.com/auth/admin.directory.user.security"
  3808. // ]
  3809. // }
  3810. }
  3811. // method id "admin.channels.stop":
  3812. type ChannelsStopCall struct {
  3813. s *Service
  3814. channel *Channel
  3815. urlParams_ gensupport.URLParams
  3816. ctx_ context.Context
  3817. header_ http.Header
  3818. }
  3819. // Stop: Stop watching resources through this channel
  3820. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  3821. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3822. c.channel = channel
  3823. return c
  3824. }
  3825. // Fields allows partial responses to be retrieved. See
  3826. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3827. // for more information.
  3828. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  3829. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3830. return c
  3831. }
  3832. // Context sets the context to be used in this call's Do method. Any
  3833. // pending HTTP request will be aborted if the provided context is
  3834. // canceled.
  3835. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  3836. c.ctx_ = ctx
  3837. return c
  3838. }
  3839. // Header returns an http.Header that can be modified by the caller to
  3840. // add HTTP headers to the request.
  3841. func (c *ChannelsStopCall) Header() http.Header {
  3842. if c.header_ == nil {
  3843. c.header_ = make(http.Header)
  3844. }
  3845. return c.header_
  3846. }
  3847. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  3848. reqHeaders := make(http.Header)
  3849. for k, v := range c.header_ {
  3850. reqHeaders[k] = v
  3851. }
  3852. reqHeaders.Set("User-Agent", c.s.userAgent())
  3853. var body io.Reader = nil
  3854. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  3855. if err != nil {
  3856. return nil, err
  3857. }
  3858. reqHeaders.Set("Content-Type", "application/json")
  3859. c.urlParams_.Set("alt", alt)
  3860. urls := googleapi.ResolveRelative(c.s.BasePath, "/admin/directory_v1/channels/stop")
  3861. urls += "?" + c.urlParams_.Encode()
  3862. req, _ := http.NewRequest("POST", urls, body)
  3863. req.Header = reqHeaders
  3864. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3865. }
  3866. // Do executes the "admin.channels.stop" call.
  3867. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  3868. gensupport.SetOptions(c.urlParams_, opts...)
  3869. res, err := c.doRequest("json")
  3870. if err != nil {
  3871. return err
  3872. }
  3873. defer googleapi.CloseBody(res)
  3874. if err := googleapi.CheckResponse(res); err != nil {
  3875. return err
  3876. }
  3877. return nil
  3878. // {
  3879. // "description": "Stop watching resources through this channel",
  3880. // "httpMethod": "POST",
  3881. // "id": "admin.channels.stop",
  3882. // "path": "/admin/directory_v1/channels/stop",
  3883. // "request": {
  3884. // "$ref": "Channel",
  3885. // "parameterName": "resource"
  3886. // },
  3887. // "scopes": [
  3888. // "https://www.googleapis.com/auth/admin.directory.user",
  3889. // "https://www.googleapis.com/auth/admin.directory.user.alias",
  3890. // "https://www.googleapis.com/auth/admin.directory.user.alias.readonly",
  3891. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  3892. // ]
  3893. // }
  3894. }
  3895. // method id "directory.chromeosdevices.action":
  3896. type ChromeosdevicesActionCall struct {
  3897. s *Service
  3898. customerId string
  3899. resourceId string
  3900. chromeosdeviceaction *ChromeOsDeviceAction
  3901. urlParams_ gensupport.URLParams
  3902. ctx_ context.Context
  3903. header_ http.Header
  3904. }
  3905. // Action: Take action on Chrome OS Device
  3906. func (r *ChromeosdevicesService) Action(customerId string, resourceId string, chromeosdeviceaction *ChromeOsDeviceAction) *ChromeosdevicesActionCall {
  3907. c := &ChromeosdevicesActionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3908. c.customerId = customerId
  3909. c.resourceId = resourceId
  3910. c.chromeosdeviceaction = chromeosdeviceaction
  3911. return c
  3912. }
  3913. // Fields allows partial responses to be retrieved. See
  3914. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3915. // for more information.
  3916. func (c *ChromeosdevicesActionCall) Fields(s ...googleapi.Field) *ChromeosdevicesActionCall {
  3917. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3918. return c
  3919. }
  3920. // Context sets the context to be used in this call's Do method. Any
  3921. // pending HTTP request will be aborted if the provided context is
  3922. // canceled.
  3923. func (c *ChromeosdevicesActionCall) Context(ctx context.Context) *ChromeosdevicesActionCall {
  3924. c.ctx_ = ctx
  3925. return c
  3926. }
  3927. // Header returns an http.Header that can be modified by the caller to
  3928. // add HTTP headers to the request.
  3929. func (c *ChromeosdevicesActionCall) Header() http.Header {
  3930. if c.header_ == nil {
  3931. c.header_ = make(http.Header)
  3932. }
  3933. return c.header_
  3934. }
  3935. func (c *ChromeosdevicesActionCall) doRequest(alt string) (*http.Response, error) {
  3936. reqHeaders := make(http.Header)
  3937. for k, v := range c.header_ {
  3938. reqHeaders[k] = v
  3939. }
  3940. reqHeaders.Set("User-Agent", c.s.userAgent())
  3941. var body io.Reader = nil
  3942. body, err := googleapi.WithoutDataWrapper.JSONReader(c.chromeosdeviceaction)
  3943. if err != nil {
  3944. return nil, err
  3945. }
  3946. reqHeaders.Set("Content-Type", "application/json")
  3947. c.urlParams_.Set("alt", alt)
  3948. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{resourceId}/action")
  3949. urls += "?" + c.urlParams_.Encode()
  3950. req, _ := http.NewRequest("POST", urls, body)
  3951. req.Header = reqHeaders
  3952. googleapi.Expand(req.URL, map[string]string{
  3953. "customerId": c.customerId,
  3954. "resourceId": c.resourceId,
  3955. })
  3956. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3957. }
  3958. // Do executes the "directory.chromeosdevices.action" call.
  3959. func (c *ChromeosdevicesActionCall) Do(opts ...googleapi.CallOption) error {
  3960. gensupport.SetOptions(c.urlParams_, opts...)
  3961. res, err := c.doRequest("json")
  3962. if err != nil {
  3963. return err
  3964. }
  3965. defer googleapi.CloseBody(res)
  3966. if err := googleapi.CheckResponse(res); err != nil {
  3967. return err
  3968. }
  3969. return nil
  3970. // {
  3971. // "description": "Take action on Chrome OS Device",
  3972. // "httpMethod": "POST",
  3973. // "id": "directory.chromeosdevices.action",
  3974. // "parameterOrder": [
  3975. // "customerId",
  3976. // "resourceId"
  3977. // ],
  3978. // "parameters": {
  3979. // "customerId": {
  3980. // "description": "Immutable ID of the G Suite account",
  3981. // "location": "path",
  3982. // "required": true,
  3983. // "type": "string"
  3984. // },
  3985. // "resourceId": {
  3986. // "description": "Immutable ID of Chrome OS Device",
  3987. // "location": "path",
  3988. // "required": true,
  3989. // "type": "string"
  3990. // }
  3991. // },
  3992. // "path": "customer/{customerId}/devices/chromeos/{resourceId}/action",
  3993. // "request": {
  3994. // "$ref": "ChromeOsDeviceAction"
  3995. // },
  3996. // "scopes": [
  3997. // "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  3998. // ]
  3999. // }
  4000. }
  4001. // method id "directory.chromeosdevices.get":
  4002. type ChromeosdevicesGetCall struct {
  4003. s *Service
  4004. customerId string
  4005. deviceId string
  4006. urlParams_ gensupport.URLParams
  4007. ifNoneMatch_ string
  4008. ctx_ context.Context
  4009. header_ http.Header
  4010. }
  4011. // Get: Retrieve Chrome OS Device
  4012. func (r *ChromeosdevicesService) Get(customerId string, deviceId string) *ChromeosdevicesGetCall {
  4013. c := &ChromeosdevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4014. c.customerId = customerId
  4015. c.deviceId = deviceId
  4016. return c
  4017. }
  4018. // Projection sets the optional parameter "projection": Restrict
  4019. // information returned to a set of selected fields.
  4020. //
  4021. // Possible values:
  4022. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  4023. // serialNumber, status, and user)
  4024. // "FULL" - Includes all metadata fields
  4025. func (c *ChromeosdevicesGetCall) Projection(projection string) *ChromeosdevicesGetCall {
  4026. c.urlParams_.Set("projection", projection)
  4027. return c
  4028. }
  4029. // Fields allows partial responses to be retrieved. See
  4030. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4031. // for more information.
  4032. func (c *ChromeosdevicesGetCall) Fields(s ...googleapi.Field) *ChromeosdevicesGetCall {
  4033. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4034. return c
  4035. }
  4036. // IfNoneMatch sets the optional parameter which makes the operation
  4037. // fail if the object's ETag matches the given value. This is useful for
  4038. // getting updates only after the object has changed since the last
  4039. // request. Use googleapi.IsNotModified to check whether the response
  4040. // error from Do is the result of In-None-Match.
  4041. func (c *ChromeosdevicesGetCall) IfNoneMatch(entityTag string) *ChromeosdevicesGetCall {
  4042. c.ifNoneMatch_ = entityTag
  4043. return c
  4044. }
  4045. // Context sets the context to be used in this call's Do method. Any
  4046. // pending HTTP request will be aborted if the provided context is
  4047. // canceled.
  4048. func (c *ChromeosdevicesGetCall) Context(ctx context.Context) *ChromeosdevicesGetCall {
  4049. c.ctx_ = ctx
  4050. return c
  4051. }
  4052. // Header returns an http.Header that can be modified by the caller to
  4053. // add HTTP headers to the request.
  4054. func (c *ChromeosdevicesGetCall) Header() http.Header {
  4055. if c.header_ == nil {
  4056. c.header_ = make(http.Header)
  4057. }
  4058. return c.header_
  4059. }
  4060. func (c *ChromeosdevicesGetCall) doRequest(alt string) (*http.Response, error) {
  4061. reqHeaders := make(http.Header)
  4062. for k, v := range c.header_ {
  4063. reqHeaders[k] = v
  4064. }
  4065. reqHeaders.Set("User-Agent", c.s.userAgent())
  4066. if c.ifNoneMatch_ != "" {
  4067. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4068. }
  4069. var body io.Reader = nil
  4070. c.urlParams_.Set("alt", alt)
  4071. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{deviceId}")
  4072. urls += "?" + c.urlParams_.Encode()
  4073. req, _ := http.NewRequest("GET", urls, body)
  4074. req.Header = reqHeaders
  4075. googleapi.Expand(req.URL, map[string]string{
  4076. "customerId": c.customerId,
  4077. "deviceId": c.deviceId,
  4078. })
  4079. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4080. }
  4081. // Do executes the "directory.chromeosdevices.get" call.
  4082. // Exactly one of *ChromeOsDevice or error will be non-nil. Any non-2xx
  4083. // status code is an error. Response headers are in either
  4084. // *ChromeOsDevice.ServerResponse.Header or (if a response was returned
  4085. // at all) in error.(*googleapi.Error).Header. Use
  4086. // googleapi.IsNotModified to check whether the returned error was
  4087. // because http.StatusNotModified was returned.
  4088. func (c *ChromeosdevicesGetCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevice, error) {
  4089. gensupport.SetOptions(c.urlParams_, opts...)
  4090. res, err := c.doRequest("json")
  4091. if res != nil && res.StatusCode == http.StatusNotModified {
  4092. if res.Body != nil {
  4093. res.Body.Close()
  4094. }
  4095. return nil, &googleapi.Error{
  4096. Code: res.StatusCode,
  4097. Header: res.Header,
  4098. }
  4099. }
  4100. if err != nil {
  4101. return nil, err
  4102. }
  4103. defer googleapi.CloseBody(res)
  4104. if err := googleapi.CheckResponse(res); err != nil {
  4105. return nil, err
  4106. }
  4107. ret := &ChromeOsDevice{
  4108. ServerResponse: googleapi.ServerResponse{
  4109. Header: res.Header,
  4110. HTTPStatusCode: res.StatusCode,
  4111. },
  4112. }
  4113. target := &ret
  4114. if err := gensupport.DecodeResponse(target, res); err != nil {
  4115. return nil, err
  4116. }
  4117. return ret, nil
  4118. // {
  4119. // "description": "Retrieve Chrome OS Device",
  4120. // "httpMethod": "GET",
  4121. // "id": "directory.chromeosdevices.get",
  4122. // "parameterOrder": [
  4123. // "customerId",
  4124. // "deviceId"
  4125. // ],
  4126. // "parameters": {
  4127. // "customerId": {
  4128. // "description": "Immutable ID of the G Suite account",
  4129. // "location": "path",
  4130. // "required": true,
  4131. // "type": "string"
  4132. // },
  4133. // "deviceId": {
  4134. // "description": "Immutable ID of Chrome OS Device",
  4135. // "location": "path",
  4136. // "required": true,
  4137. // "type": "string"
  4138. // },
  4139. // "projection": {
  4140. // "description": "Restrict information returned to a set of selected fields.",
  4141. // "enum": [
  4142. // "BASIC",
  4143. // "FULL"
  4144. // ],
  4145. // "enumDescriptions": [
  4146. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  4147. // "Includes all metadata fields"
  4148. // ],
  4149. // "location": "query",
  4150. // "type": "string"
  4151. // }
  4152. // },
  4153. // "path": "customer/{customerId}/devices/chromeos/{deviceId}",
  4154. // "response": {
  4155. // "$ref": "ChromeOsDevice"
  4156. // },
  4157. // "scopes": [
  4158. // "https://www.googleapis.com/auth/admin.directory.device.chromeos",
  4159. // "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly"
  4160. // ]
  4161. // }
  4162. }
  4163. // method id "directory.chromeosdevices.list":
  4164. type ChromeosdevicesListCall struct {
  4165. s *Service
  4166. customerId string
  4167. urlParams_ gensupport.URLParams
  4168. ifNoneMatch_ string
  4169. ctx_ context.Context
  4170. header_ http.Header
  4171. }
  4172. // List: Retrieve all Chrome OS Devices of a customer (paginated)
  4173. func (r *ChromeosdevicesService) List(customerId string) *ChromeosdevicesListCall {
  4174. c := &ChromeosdevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4175. c.customerId = customerId
  4176. return c
  4177. }
  4178. // MaxResults sets the optional parameter "maxResults": Maximum number
  4179. // of results to return. Default is 100
  4180. func (c *ChromeosdevicesListCall) MaxResults(maxResults int64) *ChromeosdevicesListCall {
  4181. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4182. return c
  4183. }
  4184. // OrderBy sets the optional parameter "orderBy": Column to use for
  4185. // sorting results
  4186. //
  4187. // Possible values:
  4188. // "annotatedLocation" - Chromebook location as annotated by the
  4189. // administrator.
  4190. // "annotatedUser" - Chromebook user as annotated by administrator.
  4191. // "lastSync" - Chromebook last sync.
  4192. // "notes" - Chromebook notes as annotated by the administrator.
  4193. // "serialNumber" - Chromebook Serial Number.
  4194. // "status" - Chromebook status.
  4195. // "supportEndDate" - Chromebook support end date.
  4196. func (c *ChromeosdevicesListCall) OrderBy(orderBy string) *ChromeosdevicesListCall {
  4197. c.urlParams_.Set("orderBy", orderBy)
  4198. return c
  4199. }
  4200. // OrgUnitPath sets the optional parameter "orgUnitPath": Full path of
  4201. // the organizational unit or its ID
  4202. func (c *ChromeosdevicesListCall) OrgUnitPath(orgUnitPath string) *ChromeosdevicesListCall {
  4203. c.urlParams_.Set("orgUnitPath", orgUnitPath)
  4204. return c
  4205. }
  4206. // PageToken sets the optional parameter "pageToken": Token to specify
  4207. // next page in the list
  4208. func (c *ChromeosdevicesListCall) PageToken(pageToken string) *ChromeosdevicesListCall {
  4209. c.urlParams_.Set("pageToken", pageToken)
  4210. return c
  4211. }
  4212. // Projection sets the optional parameter "projection": Restrict
  4213. // information returned to a set of selected fields.
  4214. //
  4215. // Possible values:
  4216. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  4217. // serialNumber, status, and user)
  4218. // "FULL" - Includes all metadata fields
  4219. func (c *ChromeosdevicesListCall) Projection(projection string) *ChromeosdevicesListCall {
  4220. c.urlParams_.Set("projection", projection)
  4221. return c
  4222. }
  4223. // Query sets the optional parameter "query": Search string in the
  4224. // format given at
  4225. // http://support.google.com/chromeos/a/bin/answer.py?answer=1698333
  4226. func (c *ChromeosdevicesListCall) Query(query string) *ChromeosdevicesListCall {
  4227. c.urlParams_.Set("query", query)
  4228. return c
  4229. }
  4230. // SortOrder sets the optional parameter "sortOrder": Whether to return
  4231. // results in ascending or descending order. Only of use when orderBy is
  4232. // also used
  4233. //
  4234. // Possible values:
  4235. // "ASCENDING" - Ascending order.
  4236. // "DESCENDING" - Descending order.
  4237. func (c *ChromeosdevicesListCall) SortOrder(sortOrder string) *ChromeosdevicesListCall {
  4238. c.urlParams_.Set("sortOrder", sortOrder)
  4239. return c
  4240. }
  4241. // Fields allows partial responses to be retrieved. See
  4242. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4243. // for more information.
  4244. func (c *ChromeosdevicesListCall) Fields(s ...googleapi.Field) *ChromeosdevicesListCall {
  4245. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4246. return c
  4247. }
  4248. // IfNoneMatch sets the optional parameter which makes the operation
  4249. // fail if the object's ETag matches the given value. This is useful for
  4250. // getting updates only after the object has changed since the last
  4251. // request. Use googleapi.IsNotModified to check whether the response
  4252. // error from Do is the result of In-None-Match.
  4253. func (c *ChromeosdevicesListCall) IfNoneMatch(entityTag string) *ChromeosdevicesListCall {
  4254. c.ifNoneMatch_ = entityTag
  4255. return c
  4256. }
  4257. // Context sets the context to be used in this call's Do method. Any
  4258. // pending HTTP request will be aborted if the provided context is
  4259. // canceled.
  4260. func (c *ChromeosdevicesListCall) Context(ctx context.Context) *ChromeosdevicesListCall {
  4261. c.ctx_ = ctx
  4262. return c
  4263. }
  4264. // Header returns an http.Header that can be modified by the caller to
  4265. // add HTTP headers to the request.
  4266. func (c *ChromeosdevicesListCall) Header() http.Header {
  4267. if c.header_ == nil {
  4268. c.header_ = make(http.Header)
  4269. }
  4270. return c.header_
  4271. }
  4272. func (c *ChromeosdevicesListCall) doRequest(alt string) (*http.Response, error) {
  4273. reqHeaders := make(http.Header)
  4274. for k, v := range c.header_ {
  4275. reqHeaders[k] = v
  4276. }
  4277. reqHeaders.Set("User-Agent", c.s.userAgent())
  4278. if c.ifNoneMatch_ != "" {
  4279. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4280. }
  4281. var body io.Reader = nil
  4282. c.urlParams_.Set("alt", alt)
  4283. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos")
  4284. urls += "?" + c.urlParams_.Encode()
  4285. req, _ := http.NewRequest("GET", urls, body)
  4286. req.Header = reqHeaders
  4287. googleapi.Expand(req.URL, map[string]string{
  4288. "customerId": c.customerId,
  4289. })
  4290. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4291. }
  4292. // Do executes the "directory.chromeosdevices.list" call.
  4293. // Exactly one of *ChromeOsDevices or error will be non-nil. Any non-2xx
  4294. // status code is an error. Response headers are in either
  4295. // *ChromeOsDevices.ServerResponse.Header or (if a response was returned
  4296. // at all) in error.(*googleapi.Error).Header. Use
  4297. // googleapi.IsNotModified to check whether the returned error was
  4298. // because http.StatusNotModified was returned.
  4299. func (c *ChromeosdevicesListCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevices, error) {
  4300. gensupport.SetOptions(c.urlParams_, opts...)
  4301. res, err := c.doRequest("json")
  4302. if res != nil && res.StatusCode == http.StatusNotModified {
  4303. if res.Body != nil {
  4304. res.Body.Close()
  4305. }
  4306. return nil, &googleapi.Error{
  4307. Code: res.StatusCode,
  4308. Header: res.Header,
  4309. }
  4310. }
  4311. if err != nil {
  4312. return nil, err
  4313. }
  4314. defer googleapi.CloseBody(res)
  4315. if err := googleapi.CheckResponse(res); err != nil {
  4316. return nil, err
  4317. }
  4318. ret := &ChromeOsDevices{
  4319. ServerResponse: googleapi.ServerResponse{
  4320. Header: res.Header,
  4321. HTTPStatusCode: res.StatusCode,
  4322. },
  4323. }
  4324. target := &ret
  4325. if err := gensupport.DecodeResponse(target, res); err != nil {
  4326. return nil, err
  4327. }
  4328. return ret, nil
  4329. // {
  4330. // "description": "Retrieve all Chrome OS Devices of a customer (paginated)",
  4331. // "httpMethod": "GET",
  4332. // "id": "directory.chromeosdevices.list",
  4333. // "parameterOrder": [
  4334. // "customerId"
  4335. // ],
  4336. // "parameters": {
  4337. // "customerId": {
  4338. // "description": "Immutable ID of the G Suite account",
  4339. // "location": "path",
  4340. // "required": true,
  4341. // "type": "string"
  4342. // },
  4343. // "maxResults": {
  4344. // "description": "Maximum number of results to return. Default is 100",
  4345. // "format": "int32",
  4346. // "location": "query",
  4347. // "minimum": "1",
  4348. // "type": "integer"
  4349. // },
  4350. // "orderBy": {
  4351. // "description": "Column to use for sorting results",
  4352. // "enum": [
  4353. // "annotatedLocation",
  4354. // "annotatedUser",
  4355. // "lastSync",
  4356. // "notes",
  4357. // "serialNumber",
  4358. // "status",
  4359. // "supportEndDate"
  4360. // ],
  4361. // "enumDescriptions": [
  4362. // "Chromebook location as annotated by the administrator.",
  4363. // "Chromebook user as annotated by administrator.",
  4364. // "Chromebook last sync.",
  4365. // "Chromebook notes as annotated by the administrator.",
  4366. // "Chromebook Serial Number.",
  4367. // "Chromebook status.",
  4368. // "Chromebook support end date."
  4369. // ],
  4370. // "location": "query",
  4371. // "type": "string"
  4372. // },
  4373. // "orgUnitPath": {
  4374. // "description": "Full path of the organizational unit or its ID",
  4375. // "location": "query",
  4376. // "type": "string"
  4377. // },
  4378. // "pageToken": {
  4379. // "description": "Token to specify next page in the list",
  4380. // "location": "query",
  4381. // "type": "string"
  4382. // },
  4383. // "projection": {
  4384. // "description": "Restrict information returned to a set of selected fields.",
  4385. // "enum": [
  4386. // "BASIC",
  4387. // "FULL"
  4388. // ],
  4389. // "enumDescriptions": [
  4390. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  4391. // "Includes all metadata fields"
  4392. // ],
  4393. // "location": "query",
  4394. // "type": "string"
  4395. // },
  4396. // "query": {
  4397. // "description": "Search string in the format given at http://support.google.com/chromeos/a/bin/answer.py?answer=1698333",
  4398. // "location": "query",
  4399. // "type": "string"
  4400. // },
  4401. // "sortOrder": {
  4402. // "description": "Whether to return results in ascending or descending order. Only of use when orderBy is also used",
  4403. // "enum": [
  4404. // "ASCENDING",
  4405. // "DESCENDING"
  4406. // ],
  4407. // "enumDescriptions": [
  4408. // "Ascending order.",
  4409. // "Descending order."
  4410. // ],
  4411. // "location": "query",
  4412. // "type": "string"
  4413. // }
  4414. // },
  4415. // "path": "customer/{customerId}/devices/chromeos",
  4416. // "response": {
  4417. // "$ref": "ChromeOsDevices"
  4418. // },
  4419. // "scopes": [
  4420. // "https://www.googleapis.com/auth/admin.directory.device.chromeos",
  4421. // "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly"
  4422. // ]
  4423. // }
  4424. }
  4425. // Pages invokes f for each page of results.
  4426. // A non-nil error returned from f will halt the iteration.
  4427. // The provided context supersedes any context provided to the Context method.
  4428. func (c *ChromeosdevicesListCall) Pages(ctx context.Context, f func(*ChromeOsDevices) error) error {
  4429. c.ctx_ = ctx
  4430. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4431. for {
  4432. x, err := c.Do()
  4433. if err != nil {
  4434. return err
  4435. }
  4436. if err := f(x); err != nil {
  4437. return err
  4438. }
  4439. if x.NextPageToken == "" {
  4440. return nil
  4441. }
  4442. c.PageToken(x.NextPageToken)
  4443. }
  4444. }
  4445. // method id "directory.chromeosdevices.moveDevicesToOu":
  4446. type ChromeosdevicesMoveDevicesToOuCall struct {
  4447. s *Service
  4448. customerId string
  4449. chromeosmovedevicestoou *ChromeOsMoveDevicesToOu
  4450. urlParams_ gensupport.URLParams
  4451. ctx_ context.Context
  4452. header_ http.Header
  4453. }
  4454. // MoveDevicesToOu: Move or insert multiple Chrome OS Devices to
  4455. // organizational unit
  4456. func (r *ChromeosdevicesService) MoveDevicesToOu(customerId string, orgUnitPath string, chromeosmovedevicestoou *ChromeOsMoveDevicesToOu) *ChromeosdevicesMoveDevicesToOuCall {
  4457. c := &ChromeosdevicesMoveDevicesToOuCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4458. c.customerId = customerId
  4459. c.urlParams_.Set("orgUnitPath", orgUnitPath)
  4460. c.chromeosmovedevicestoou = chromeosmovedevicestoou
  4461. return c
  4462. }
  4463. // Fields allows partial responses to be retrieved. See
  4464. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4465. // for more information.
  4466. func (c *ChromeosdevicesMoveDevicesToOuCall) Fields(s ...googleapi.Field) *ChromeosdevicesMoveDevicesToOuCall {
  4467. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4468. return c
  4469. }
  4470. // Context sets the context to be used in this call's Do method. Any
  4471. // pending HTTP request will be aborted if the provided context is
  4472. // canceled.
  4473. func (c *ChromeosdevicesMoveDevicesToOuCall) Context(ctx context.Context) *ChromeosdevicesMoveDevicesToOuCall {
  4474. c.ctx_ = ctx
  4475. return c
  4476. }
  4477. // Header returns an http.Header that can be modified by the caller to
  4478. // add HTTP headers to the request.
  4479. func (c *ChromeosdevicesMoveDevicesToOuCall) Header() http.Header {
  4480. if c.header_ == nil {
  4481. c.header_ = make(http.Header)
  4482. }
  4483. return c.header_
  4484. }
  4485. func (c *ChromeosdevicesMoveDevicesToOuCall) doRequest(alt string) (*http.Response, error) {
  4486. reqHeaders := make(http.Header)
  4487. for k, v := range c.header_ {
  4488. reqHeaders[k] = v
  4489. }
  4490. reqHeaders.Set("User-Agent", c.s.userAgent())
  4491. var body io.Reader = nil
  4492. body, err := googleapi.WithoutDataWrapper.JSONReader(c.chromeosmovedevicestoou)
  4493. if err != nil {
  4494. return nil, err
  4495. }
  4496. reqHeaders.Set("Content-Type", "application/json")
  4497. c.urlParams_.Set("alt", alt)
  4498. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/moveDevicesToOu")
  4499. urls += "?" + c.urlParams_.Encode()
  4500. req, _ := http.NewRequest("POST", urls, body)
  4501. req.Header = reqHeaders
  4502. googleapi.Expand(req.URL, map[string]string{
  4503. "customerId": c.customerId,
  4504. })
  4505. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4506. }
  4507. // Do executes the "directory.chromeosdevices.moveDevicesToOu" call.
  4508. func (c *ChromeosdevicesMoveDevicesToOuCall) Do(opts ...googleapi.CallOption) error {
  4509. gensupport.SetOptions(c.urlParams_, opts...)
  4510. res, err := c.doRequest("json")
  4511. if err != nil {
  4512. return err
  4513. }
  4514. defer googleapi.CloseBody(res)
  4515. if err := googleapi.CheckResponse(res); err != nil {
  4516. return err
  4517. }
  4518. return nil
  4519. // {
  4520. // "description": "Move or insert multiple Chrome OS Devices to organizational unit",
  4521. // "httpMethod": "POST",
  4522. // "id": "directory.chromeosdevices.moveDevicesToOu",
  4523. // "parameterOrder": [
  4524. // "customerId",
  4525. // "orgUnitPath"
  4526. // ],
  4527. // "parameters": {
  4528. // "customerId": {
  4529. // "description": "Immutable ID of the G Suite account",
  4530. // "location": "path",
  4531. // "required": true,
  4532. // "type": "string"
  4533. // },
  4534. // "orgUnitPath": {
  4535. // "description": "Full path of the target organizational unit or its ID",
  4536. // "location": "query",
  4537. // "required": true,
  4538. // "type": "string"
  4539. // }
  4540. // },
  4541. // "path": "customer/{customerId}/devices/chromeos/moveDevicesToOu",
  4542. // "request": {
  4543. // "$ref": "ChromeOsMoveDevicesToOu"
  4544. // },
  4545. // "scopes": [
  4546. // "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  4547. // ]
  4548. // }
  4549. }
  4550. // method id "directory.chromeosdevices.patch":
  4551. type ChromeosdevicesPatchCall struct {
  4552. s *Service
  4553. customerId string
  4554. deviceId string
  4555. chromeosdevice *ChromeOsDevice
  4556. urlParams_ gensupport.URLParams
  4557. ctx_ context.Context
  4558. header_ http.Header
  4559. }
  4560. // Patch: Update Chrome OS Device. This method supports patch semantics.
  4561. func (r *ChromeosdevicesService) Patch(customerId string, deviceId string, chromeosdevice *ChromeOsDevice) *ChromeosdevicesPatchCall {
  4562. c := &ChromeosdevicesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4563. c.customerId = customerId
  4564. c.deviceId = deviceId
  4565. c.chromeosdevice = chromeosdevice
  4566. return c
  4567. }
  4568. // Projection sets the optional parameter "projection": Restrict
  4569. // information returned to a set of selected fields.
  4570. //
  4571. // Possible values:
  4572. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  4573. // serialNumber, status, and user)
  4574. // "FULL" - Includes all metadata fields
  4575. func (c *ChromeosdevicesPatchCall) Projection(projection string) *ChromeosdevicesPatchCall {
  4576. c.urlParams_.Set("projection", projection)
  4577. return c
  4578. }
  4579. // Fields allows partial responses to be retrieved. See
  4580. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4581. // for more information.
  4582. func (c *ChromeosdevicesPatchCall) Fields(s ...googleapi.Field) *ChromeosdevicesPatchCall {
  4583. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4584. return c
  4585. }
  4586. // Context sets the context to be used in this call's Do method. Any
  4587. // pending HTTP request will be aborted if the provided context is
  4588. // canceled.
  4589. func (c *ChromeosdevicesPatchCall) Context(ctx context.Context) *ChromeosdevicesPatchCall {
  4590. c.ctx_ = ctx
  4591. return c
  4592. }
  4593. // Header returns an http.Header that can be modified by the caller to
  4594. // add HTTP headers to the request.
  4595. func (c *ChromeosdevicesPatchCall) Header() http.Header {
  4596. if c.header_ == nil {
  4597. c.header_ = make(http.Header)
  4598. }
  4599. return c.header_
  4600. }
  4601. func (c *ChromeosdevicesPatchCall) doRequest(alt string) (*http.Response, error) {
  4602. reqHeaders := make(http.Header)
  4603. for k, v := range c.header_ {
  4604. reqHeaders[k] = v
  4605. }
  4606. reqHeaders.Set("User-Agent", c.s.userAgent())
  4607. var body io.Reader = nil
  4608. body, err := googleapi.WithoutDataWrapper.JSONReader(c.chromeosdevice)
  4609. if err != nil {
  4610. return nil, err
  4611. }
  4612. reqHeaders.Set("Content-Type", "application/json")
  4613. c.urlParams_.Set("alt", alt)
  4614. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{deviceId}")
  4615. urls += "?" + c.urlParams_.Encode()
  4616. req, _ := http.NewRequest("PATCH", urls, body)
  4617. req.Header = reqHeaders
  4618. googleapi.Expand(req.URL, map[string]string{
  4619. "customerId": c.customerId,
  4620. "deviceId": c.deviceId,
  4621. })
  4622. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4623. }
  4624. // Do executes the "directory.chromeosdevices.patch" call.
  4625. // Exactly one of *ChromeOsDevice or error will be non-nil. Any non-2xx
  4626. // status code is an error. Response headers are in either
  4627. // *ChromeOsDevice.ServerResponse.Header or (if a response was returned
  4628. // at all) in error.(*googleapi.Error).Header. Use
  4629. // googleapi.IsNotModified to check whether the returned error was
  4630. // because http.StatusNotModified was returned.
  4631. func (c *ChromeosdevicesPatchCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevice, error) {
  4632. gensupport.SetOptions(c.urlParams_, opts...)
  4633. res, err := c.doRequest("json")
  4634. if res != nil && res.StatusCode == http.StatusNotModified {
  4635. if res.Body != nil {
  4636. res.Body.Close()
  4637. }
  4638. return nil, &googleapi.Error{
  4639. Code: res.StatusCode,
  4640. Header: res.Header,
  4641. }
  4642. }
  4643. if err != nil {
  4644. return nil, err
  4645. }
  4646. defer googleapi.CloseBody(res)
  4647. if err := googleapi.CheckResponse(res); err != nil {
  4648. return nil, err
  4649. }
  4650. ret := &ChromeOsDevice{
  4651. ServerResponse: googleapi.ServerResponse{
  4652. Header: res.Header,
  4653. HTTPStatusCode: res.StatusCode,
  4654. },
  4655. }
  4656. target := &ret
  4657. if err := gensupport.DecodeResponse(target, res); err != nil {
  4658. return nil, err
  4659. }
  4660. return ret, nil
  4661. // {
  4662. // "description": "Update Chrome OS Device. This method supports patch semantics.",
  4663. // "httpMethod": "PATCH",
  4664. // "id": "directory.chromeosdevices.patch",
  4665. // "parameterOrder": [
  4666. // "customerId",
  4667. // "deviceId"
  4668. // ],
  4669. // "parameters": {
  4670. // "customerId": {
  4671. // "description": "Immutable ID of the G Suite account",
  4672. // "location": "path",
  4673. // "required": true,
  4674. // "type": "string"
  4675. // },
  4676. // "deviceId": {
  4677. // "description": "Immutable ID of Chrome OS Device",
  4678. // "location": "path",
  4679. // "required": true,
  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. // },
  4696. // "path": "customer/{customerId}/devices/chromeos/{deviceId}",
  4697. // "request": {
  4698. // "$ref": "ChromeOsDevice"
  4699. // },
  4700. // "response": {
  4701. // "$ref": "ChromeOsDevice"
  4702. // },
  4703. // "scopes": [
  4704. // "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  4705. // ]
  4706. // }
  4707. }
  4708. // method id "directory.chromeosdevices.update":
  4709. type ChromeosdevicesUpdateCall struct {
  4710. s *Service
  4711. customerId string
  4712. deviceId string
  4713. chromeosdevice *ChromeOsDevice
  4714. urlParams_ gensupport.URLParams
  4715. ctx_ context.Context
  4716. header_ http.Header
  4717. }
  4718. // Update: Update Chrome OS Device
  4719. func (r *ChromeosdevicesService) Update(customerId string, deviceId string, chromeosdevice *ChromeOsDevice) *ChromeosdevicesUpdateCall {
  4720. c := &ChromeosdevicesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4721. c.customerId = customerId
  4722. c.deviceId = deviceId
  4723. c.chromeosdevice = chromeosdevice
  4724. return c
  4725. }
  4726. // Projection sets the optional parameter "projection": Restrict
  4727. // information returned to a set of selected fields.
  4728. //
  4729. // Possible values:
  4730. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  4731. // serialNumber, status, and user)
  4732. // "FULL" - Includes all metadata fields
  4733. func (c *ChromeosdevicesUpdateCall) Projection(projection string) *ChromeosdevicesUpdateCall {
  4734. c.urlParams_.Set("projection", projection)
  4735. return c
  4736. }
  4737. // Fields allows partial responses to be retrieved. See
  4738. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4739. // for more information.
  4740. func (c *ChromeosdevicesUpdateCall) Fields(s ...googleapi.Field) *ChromeosdevicesUpdateCall {
  4741. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4742. return c
  4743. }
  4744. // Context sets the context to be used in this call's Do method. Any
  4745. // pending HTTP request will be aborted if the provided context is
  4746. // canceled.
  4747. func (c *ChromeosdevicesUpdateCall) Context(ctx context.Context) *ChromeosdevicesUpdateCall {
  4748. c.ctx_ = ctx
  4749. return c
  4750. }
  4751. // Header returns an http.Header that can be modified by the caller to
  4752. // add HTTP headers to the request.
  4753. func (c *ChromeosdevicesUpdateCall) Header() http.Header {
  4754. if c.header_ == nil {
  4755. c.header_ = make(http.Header)
  4756. }
  4757. return c.header_
  4758. }
  4759. func (c *ChromeosdevicesUpdateCall) doRequest(alt string) (*http.Response, error) {
  4760. reqHeaders := make(http.Header)
  4761. for k, v := range c.header_ {
  4762. reqHeaders[k] = v
  4763. }
  4764. reqHeaders.Set("User-Agent", c.s.userAgent())
  4765. var body io.Reader = nil
  4766. body, err := googleapi.WithoutDataWrapper.JSONReader(c.chromeosdevice)
  4767. if err != nil {
  4768. return nil, err
  4769. }
  4770. reqHeaders.Set("Content-Type", "application/json")
  4771. c.urlParams_.Set("alt", alt)
  4772. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/chromeos/{deviceId}")
  4773. urls += "?" + c.urlParams_.Encode()
  4774. req, _ := http.NewRequest("PUT", urls, body)
  4775. req.Header = reqHeaders
  4776. googleapi.Expand(req.URL, map[string]string{
  4777. "customerId": c.customerId,
  4778. "deviceId": c.deviceId,
  4779. })
  4780. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4781. }
  4782. // Do executes the "directory.chromeosdevices.update" call.
  4783. // Exactly one of *ChromeOsDevice or error will be non-nil. Any non-2xx
  4784. // status code is an error. Response headers are in either
  4785. // *ChromeOsDevice.ServerResponse.Header or (if a response was returned
  4786. // at all) in error.(*googleapi.Error).Header. Use
  4787. // googleapi.IsNotModified to check whether the returned error was
  4788. // because http.StatusNotModified was returned.
  4789. func (c *ChromeosdevicesUpdateCall) Do(opts ...googleapi.CallOption) (*ChromeOsDevice, error) {
  4790. gensupport.SetOptions(c.urlParams_, opts...)
  4791. res, err := c.doRequest("json")
  4792. if res != nil && res.StatusCode == http.StatusNotModified {
  4793. if res.Body != nil {
  4794. res.Body.Close()
  4795. }
  4796. return nil, &googleapi.Error{
  4797. Code: res.StatusCode,
  4798. Header: res.Header,
  4799. }
  4800. }
  4801. if err != nil {
  4802. return nil, err
  4803. }
  4804. defer googleapi.CloseBody(res)
  4805. if err := googleapi.CheckResponse(res); err != nil {
  4806. return nil, err
  4807. }
  4808. ret := &ChromeOsDevice{
  4809. ServerResponse: googleapi.ServerResponse{
  4810. Header: res.Header,
  4811. HTTPStatusCode: res.StatusCode,
  4812. },
  4813. }
  4814. target := &ret
  4815. if err := gensupport.DecodeResponse(target, res); err != nil {
  4816. return nil, err
  4817. }
  4818. return ret, nil
  4819. // {
  4820. // "description": "Update Chrome OS Device",
  4821. // "httpMethod": "PUT",
  4822. // "id": "directory.chromeosdevices.update",
  4823. // "parameterOrder": [
  4824. // "customerId",
  4825. // "deviceId"
  4826. // ],
  4827. // "parameters": {
  4828. // "customerId": {
  4829. // "description": "Immutable ID of the G Suite account",
  4830. // "location": "path",
  4831. // "required": true,
  4832. // "type": "string"
  4833. // },
  4834. // "deviceId": {
  4835. // "description": "Immutable ID of Chrome OS Device",
  4836. // "location": "path",
  4837. // "required": true,
  4838. // "type": "string"
  4839. // },
  4840. // "projection": {
  4841. // "description": "Restrict information returned to a set of selected fields.",
  4842. // "enum": [
  4843. // "BASIC",
  4844. // "FULL"
  4845. // ],
  4846. // "enumDescriptions": [
  4847. // "Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)",
  4848. // "Includes all metadata fields"
  4849. // ],
  4850. // "location": "query",
  4851. // "type": "string"
  4852. // }
  4853. // },
  4854. // "path": "customer/{customerId}/devices/chromeos/{deviceId}",
  4855. // "request": {
  4856. // "$ref": "ChromeOsDevice"
  4857. // },
  4858. // "response": {
  4859. // "$ref": "ChromeOsDevice"
  4860. // },
  4861. // "scopes": [
  4862. // "https://www.googleapis.com/auth/admin.directory.device.chromeos"
  4863. // ]
  4864. // }
  4865. }
  4866. // method id "directory.customers.get":
  4867. type CustomersGetCall struct {
  4868. s *Service
  4869. customerKey string
  4870. urlParams_ gensupport.URLParams
  4871. ifNoneMatch_ string
  4872. ctx_ context.Context
  4873. header_ http.Header
  4874. }
  4875. // Get: Retrieves a customer.
  4876. func (r *CustomersService) Get(customerKey string) *CustomersGetCall {
  4877. c := &CustomersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4878. c.customerKey = customerKey
  4879. return c
  4880. }
  4881. // Fields allows partial responses to be retrieved. See
  4882. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4883. // for more information.
  4884. func (c *CustomersGetCall) Fields(s ...googleapi.Field) *CustomersGetCall {
  4885. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4886. return c
  4887. }
  4888. // IfNoneMatch sets the optional parameter which makes the operation
  4889. // fail if the object's ETag matches the given value. This is useful for
  4890. // getting updates only after the object has changed since the last
  4891. // request. Use googleapi.IsNotModified to check whether the response
  4892. // error from Do is the result of In-None-Match.
  4893. func (c *CustomersGetCall) IfNoneMatch(entityTag string) *CustomersGetCall {
  4894. c.ifNoneMatch_ = entityTag
  4895. return c
  4896. }
  4897. // Context sets the context to be used in this call's Do method. Any
  4898. // pending HTTP request will be aborted if the provided context is
  4899. // canceled.
  4900. func (c *CustomersGetCall) Context(ctx context.Context) *CustomersGetCall {
  4901. c.ctx_ = ctx
  4902. return c
  4903. }
  4904. // Header returns an http.Header that can be modified by the caller to
  4905. // add HTTP headers to the request.
  4906. func (c *CustomersGetCall) Header() http.Header {
  4907. if c.header_ == nil {
  4908. c.header_ = make(http.Header)
  4909. }
  4910. return c.header_
  4911. }
  4912. func (c *CustomersGetCall) doRequest(alt string) (*http.Response, error) {
  4913. reqHeaders := make(http.Header)
  4914. for k, v := range c.header_ {
  4915. reqHeaders[k] = v
  4916. }
  4917. reqHeaders.Set("User-Agent", c.s.userAgent())
  4918. if c.ifNoneMatch_ != "" {
  4919. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4920. }
  4921. var body io.Reader = nil
  4922. c.urlParams_.Set("alt", alt)
  4923. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerKey}")
  4924. urls += "?" + c.urlParams_.Encode()
  4925. req, _ := http.NewRequest("GET", urls, body)
  4926. req.Header = reqHeaders
  4927. googleapi.Expand(req.URL, map[string]string{
  4928. "customerKey": c.customerKey,
  4929. })
  4930. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4931. }
  4932. // Do executes the "directory.customers.get" call.
  4933. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  4934. // code is an error. Response headers are in either
  4935. // *Customer.ServerResponse.Header or (if a response was returned at
  4936. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4937. // to check whether the returned error was because
  4938. // http.StatusNotModified was returned.
  4939. func (c *CustomersGetCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  4940. gensupport.SetOptions(c.urlParams_, opts...)
  4941. res, err := c.doRequest("json")
  4942. if res != nil && res.StatusCode == http.StatusNotModified {
  4943. if res.Body != nil {
  4944. res.Body.Close()
  4945. }
  4946. return nil, &googleapi.Error{
  4947. Code: res.StatusCode,
  4948. Header: res.Header,
  4949. }
  4950. }
  4951. if err != nil {
  4952. return nil, err
  4953. }
  4954. defer googleapi.CloseBody(res)
  4955. if err := googleapi.CheckResponse(res); err != nil {
  4956. return nil, err
  4957. }
  4958. ret := &Customer{
  4959. ServerResponse: googleapi.ServerResponse{
  4960. Header: res.Header,
  4961. HTTPStatusCode: res.StatusCode,
  4962. },
  4963. }
  4964. target := &ret
  4965. if err := gensupport.DecodeResponse(target, res); err != nil {
  4966. return nil, err
  4967. }
  4968. return ret, nil
  4969. // {
  4970. // "description": "Retrieves a customer.",
  4971. // "httpMethod": "GET",
  4972. // "id": "directory.customers.get",
  4973. // "parameterOrder": [
  4974. // "customerKey"
  4975. // ],
  4976. // "parameters": {
  4977. // "customerKey": {
  4978. // "description": "Id of the customer to be retrieved",
  4979. // "location": "path",
  4980. // "required": true,
  4981. // "type": "string"
  4982. // }
  4983. // },
  4984. // "path": "customers/{customerKey}",
  4985. // "response": {
  4986. // "$ref": "Customer"
  4987. // },
  4988. // "scopes": [
  4989. // "https://www.googleapis.com/auth/admin.directory.customer",
  4990. // "https://www.googleapis.com/auth/admin.directory.customer.readonly"
  4991. // ]
  4992. // }
  4993. }
  4994. // method id "directory.customers.patch":
  4995. type CustomersPatchCall struct {
  4996. s *Service
  4997. customerKey string
  4998. customer *Customer
  4999. urlParams_ gensupport.URLParams
  5000. ctx_ context.Context
  5001. header_ http.Header
  5002. }
  5003. // Patch: Updates a customer. This method supports patch semantics.
  5004. func (r *CustomersService) Patch(customerKey string, customer *Customer) *CustomersPatchCall {
  5005. c := &CustomersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5006. c.customerKey = customerKey
  5007. c.customer = customer
  5008. return c
  5009. }
  5010. // Fields allows partial responses to be retrieved. See
  5011. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5012. // for more information.
  5013. func (c *CustomersPatchCall) Fields(s ...googleapi.Field) *CustomersPatchCall {
  5014. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5015. return c
  5016. }
  5017. // Context sets the context to be used in this call's Do method. Any
  5018. // pending HTTP request will be aborted if the provided context is
  5019. // canceled.
  5020. func (c *CustomersPatchCall) Context(ctx context.Context) *CustomersPatchCall {
  5021. c.ctx_ = ctx
  5022. return c
  5023. }
  5024. // Header returns an http.Header that can be modified by the caller to
  5025. // add HTTP headers to the request.
  5026. func (c *CustomersPatchCall) Header() http.Header {
  5027. if c.header_ == nil {
  5028. c.header_ = make(http.Header)
  5029. }
  5030. return c.header_
  5031. }
  5032. func (c *CustomersPatchCall) doRequest(alt string) (*http.Response, error) {
  5033. reqHeaders := make(http.Header)
  5034. for k, v := range c.header_ {
  5035. reqHeaders[k] = v
  5036. }
  5037. reqHeaders.Set("User-Agent", c.s.userAgent())
  5038. var body io.Reader = nil
  5039. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  5040. if err != nil {
  5041. return nil, err
  5042. }
  5043. reqHeaders.Set("Content-Type", "application/json")
  5044. c.urlParams_.Set("alt", alt)
  5045. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerKey}")
  5046. urls += "?" + c.urlParams_.Encode()
  5047. req, _ := http.NewRequest("PATCH", urls, body)
  5048. req.Header = reqHeaders
  5049. googleapi.Expand(req.URL, map[string]string{
  5050. "customerKey": c.customerKey,
  5051. })
  5052. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5053. }
  5054. // Do executes the "directory.customers.patch" call.
  5055. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  5056. // code is an error. Response headers are in either
  5057. // *Customer.ServerResponse.Header or (if a response was returned at
  5058. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5059. // to check whether the returned error was because
  5060. // http.StatusNotModified was returned.
  5061. func (c *CustomersPatchCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  5062. gensupport.SetOptions(c.urlParams_, opts...)
  5063. res, err := c.doRequest("json")
  5064. if res != nil && res.StatusCode == http.StatusNotModified {
  5065. if res.Body != nil {
  5066. res.Body.Close()
  5067. }
  5068. return nil, &googleapi.Error{
  5069. Code: res.StatusCode,
  5070. Header: res.Header,
  5071. }
  5072. }
  5073. if err != nil {
  5074. return nil, err
  5075. }
  5076. defer googleapi.CloseBody(res)
  5077. if err := googleapi.CheckResponse(res); err != nil {
  5078. return nil, err
  5079. }
  5080. ret := &Customer{
  5081. ServerResponse: googleapi.ServerResponse{
  5082. Header: res.Header,
  5083. HTTPStatusCode: res.StatusCode,
  5084. },
  5085. }
  5086. target := &ret
  5087. if err := gensupport.DecodeResponse(target, res); err != nil {
  5088. return nil, err
  5089. }
  5090. return ret, nil
  5091. // {
  5092. // "description": "Updates a customer. This method supports patch semantics.",
  5093. // "httpMethod": "PATCH",
  5094. // "id": "directory.customers.patch",
  5095. // "parameterOrder": [
  5096. // "customerKey"
  5097. // ],
  5098. // "parameters": {
  5099. // "customerKey": {
  5100. // "description": "Id of the customer to be updated",
  5101. // "location": "path",
  5102. // "required": true,
  5103. // "type": "string"
  5104. // }
  5105. // },
  5106. // "path": "customers/{customerKey}",
  5107. // "request": {
  5108. // "$ref": "Customer"
  5109. // },
  5110. // "response": {
  5111. // "$ref": "Customer"
  5112. // },
  5113. // "scopes": [
  5114. // "https://www.googleapis.com/auth/admin.directory.customer"
  5115. // ]
  5116. // }
  5117. }
  5118. // method id "directory.customers.update":
  5119. type CustomersUpdateCall struct {
  5120. s *Service
  5121. customerKey string
  5122. customer *Customer
  5123. urlParams_ gensupport.URLParams
  5124. ctx_ context.Context
  5125. header_ http.Header
  5126. }
  5127. // Update: Updates a customer.
  5128. func (r *CustomersService) Update(customerKey string, customer *Customer) *CustomersUpdateCall {
  5129. c := &CustomersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5130. c.customerKey = customerKey
  5131. c.customer = customer
  5132. return c
  5133. }
  5134. // Fields allows partial responses to be retrieved. See
  5135. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5136. // for more information.
  5137. func (c *CustomersUpdateCall) Fields(s ...googleapi.Field) *CustomersUpdateCall {
  5138. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5139. return c
  5140. }
  5141. // Context sets the context to be used in this call's Do method. Any
  5142. // pending HTTP request will be aborted if the provided context is
  5143. // canceled.
  5144. func (c *CustomersUpdateCall) Context(ctx context.Context) *CustomersUpdateCall {
  5145. c.ctx_ = ctx
  5146. return c
  5147. }
  5148. // Header returns an http.Header that can be modified by the caller to
  5149. // add HTTP headers to the request.
  5150. func (c *CustomersUpdateCall) Header() http.Header {
  5151. if c.header_ == nil {
  5152. c.header_ = make(http.Header)
  5153. }
  5154. return c.header_
  5155. }
  5156. func (c *CustomersUpdateCall) doRequest(alt string) (*http.Response, error) {
  5157. reqHeaders := make(http.Header)
  5158. for k, v := range c.header_ {
  5159. reqHeaders[k] = v
  5160. }
  5161. reqHeaders.Set("User-Agent", c.s.userAgent())
  5162. var body io.Reader = nil
  5163. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  5164. if err != nil {
  5165. return nil, err
  5166. }
  5167. reqHeaders.Set("Content-Type", "application/json")
  5168. c.urlParams_.Set("alt", alt)
  5169. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerKey}")
  5170. urls += "?" + c.urlParams_.Encode()
  5171. req, _ := http.NewRequest("PUT", urls, body)
  5172. req.Header = reqHeaders
  5173. googleapi.Expand(req.URL, map[string]string{
  5174. "customerKey": c.customerKey,
  5175. })
  5176. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5177. }
  5178. // Do executes the "directory.customers.update" call.
  5179. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  5180. // code is an error. Response headers are in either
  5181. // *Customer.ServerResponse.Header or (if a response was returned at
  5182. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5183. // to check whether the returned error was because
  5184. // http.StatusNotModified was returned.
  5185. func (c *CustomersUpdateCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  5186. gensupport.SetOptions(c.urlParams_, opts...)
  5187. res, err := c.doRequest("json")
  5188. if res != nil && res.StatusCode == http.StatusNotModified {
  5189. if res.Body != nil {
  5190. res.Body.Close()
  5191. }
  5192. return nil, &googleapi.Error{
  5193. Code: res.StatusCode,
  5194. Header: res.Header,
  5195. }
  5196. }
  5197. if err != nil {
  5198. return nil, err
  5199. }
  5200. defer googleapi.CloseBody(res)
  5201. if err := googleapi.CheckResponse(res); err != nil {
  5202. return nil, err
  5203. }
  5204. ret := &Customer{
  5205. ServerResponse: googleapi.ServerResponse{
  5206. Header: res.Header,
  5207. HTTPStatusCode: res.StatusCode,
  5208. },
  5209. }
  5210. target := &ret
  5211. if err := gensupport.DecodeResponse(target, res); err != nil {
  5212. return nil, err
  5213. }
  5214. return ret, nil
  5215. // {
  5216. // "description": "Updates a customer.",
  5217. // "httpMethod": "PUT",
  5218. // "id": "directory.customers.update",
  5219. // "parameterOrder": [
  5220. // "customerKey"
  5221. // ],
  5222. // "parameters": {
  5223. // "customerKey": {
  5224. // "description": "Id of the customer to be updated",
  5225. // "location": "path",
  5226. // "required": true,
  5227. // "type": "string"
  5228. // }
  5229. // },
  5230. // "path": "customers/{customerKey}",
  5231. // "request": {
  5232. // "$ref": "Customer"
  5233. // },
  5234. // "response": {
  5235. // "$ref": "Customer"
  5236. // },
  5237. // "scopes": [
  5238. // "https://www.googleapis.com/auth/admin.directory.customer"
  5239. // ]
  5240. // }
  5241. }
  5242. // method id "directory.domainAliases.delete":
  5243. type DomainAliasesDeleteCall struct {
  5244. s *Service
  5245. customer string
  5246. domainAliasName string
  5247. urlParams_ gensupport.URLParams
  5248. ctx_ context.Context
  5249. header_ http.Header
  5250. }
  5251. // Delete: Deletes a Domain Alias of the customer.
  5252. func (r *DomainAliasesService) Delete(customer string, domainAliasName string) *DomainAliasesDeleteCall {
  5253. c := &DomainAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5254. c.customer = customer
  5255. c.domainAliasName = domainAliasName
  5256. return c
  5257. }
  5258. // Fields allows partial responses to be retrieved. See
  5259. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5260. // for more information.
  5261. func (c *DomainAliasesDeleteCall) Fields(s ...googleapi.Field) *DomainAliasesDeleteCall {
  5262. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5263. return c
  5264. }
  5265. // Context sets the context to be used in this call's Do method. Any
  5266. // pending HTTP request will be aborted if the provided context is
  5267. // canceled.
  5268. func (c *DomainAliasesDeleteCall) Context(ctx context.Context) *DomainAliasesDeleteCall {
  5269. c.ctx_ = ctx
  5270. return c
  5271. }
  5272. // Header returns an http.Header that can be modified by the caller to
  5273. // add HTTP headers to the request.
  5274. func (c *DomainAliasesDeleteCall) Header() http.Header {
  5275. if c.header_ == nil {
  5276. c.header_ = make(http.Header)
  5277. }
  5278. return c.header_
  5279. }
  5280. func (c *DomainAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  5281. reqHeaders := make(http.Header)
  5282. for k, v := range c.header_ {
  5283. reqHeaders[k] = v
  5284. }
  5285. reqHeaders.Set("User-Agent", c.s.userAgent())
  5286. var body io.Reader = nil
  5287. c.urlParams_.Set("alt", alt)
  5288. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases/{domainAliasName}")
  5289. urls += "?" + c.urlParams_.Encode()
  5290. req, _ := http.NewRequest("DELETE", urls, body)
  5291. req.Header = reqHeaders
  5292. googleapi.Expand(req.URL, map[string]string{
  5293. "customer": c.customer,
  5294. "domainAliasName": c.domainAliasName,
  5295. })
  5296. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5297. }
  5298. // Do executes the "directory.domainAliases.delete" call.
  5299. func (c *DomainAliasesDeleteCall) Do(opts ...googleapi.CallOption) error {
  5300. gensupport.SetOptions(c.urlParams_, opts...)
  5301. res, err := c.doRequest("json")
  5302. if err != nil {
  5303. return err
  5304. }
  5305. defer googleapi.CloseBody(res)
  5306. if err := googleapi.CheckResponse(res); err != nil {
  5307. return err
  5308. }
  5309. return nil
  5310. // {
  5311. // "description": "Deletes a Domain Alias of the customer.",
  5312. // "httpMethod": "DELETE",
  5313. // "id": "directory.domainAliases.delete",
  5314. // "parameterOrder": [
  5315. // "customer",
  5316. // "domainAliasName"
  5317. // ],
  5318. // "parameters": {
  5319. // "customer": {
  5320. // "description": "Immutable ID of the G Suite account.",
  5321. // "location": "path",
  5322. // "required": true,
  5323. // "type": "string"
  5324. // },
  5325. // "domainAliasName": {
  5326. // "description": "Name of domain alias to be retrieved.",
  5327. // "location": "path",
  5328. // "required": true,
  5329. // "type": "string"
  5330. // }
  5331. // },
  5332. // "path": "customer/{customer}/domainaliases/{domainAliasName}",
  5333. // "scopes": [
  5334. // "https://www.googleapis.com/auth/admin.directory.domain"
  5335. // ]
  5336. // }
  5337. }
  5338. // method id "directory.domainAliases.get":
  5339. type DomainAliasesGetCall struct {
  5340. s *Service
  5341. customer string
  5342. domainAliasName string
  5343. urlParams_ gensupport.URLParams
  5344. ifNoneMatch_ string
  5345. ctx_ context.Context
  5346. header_ http.Header
  5347. }
  5348. // Get: Retrieves a domain alias of the customer.
  5349. func (r *DomainAliasesService) Get(customer string, domainAliasName string) *DomainAliasesGetCall {
  5350. c := &DomainAliasesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5351. c.customer = customer
  5352. c.domainAliasName = domainAliasName
  5353. return c
  5354. }
  5355. // Fields allows partial responses to be retrieved. See
  5356. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5357. // for more information.
  5358. func (c *DomainAliasesGetCall) Fields(s ...googleapi.Field) *DomainAliasesGetCall {
  5359. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5360. return c
  5361. }
  5362. // IfNoneMatch sets the optional parameter which makes the operation
  5363. // fail if the object's ETag matches the given value. This is useful for
  5364. // getting updates only after the object has changed since the last
  5365. // request. Use googleapi.IsNotModified to check whether the response
  5366. // error from Do is the result of In-None-Match.
  5367. func (c *DomainAliasesGetCall) IfNoneMatch(entityTag string) *DomainAliasesGetCall {
  5368. c.ifNoneMatch_ = entityTag
  5369. return c
  5370. }
  5371. // Context sets the context to be used in this call's Do method. Any
  5372. // pending HTTP request will be aborted if the provided context is
  5373. // canceled.
  5374. func (c *DomainAliasesGetCall) Context(ctx context.Context) *DomainAliasesGetCall {
  5375. c.ctx_ = ctx
  5376. return c
  5377. }
  5378. // Header returns an http.Header that can be modified by the caller to
  5379. // add HTTP headers to the request.
  5380. func (c *DomainAliasesGetCall) Header() http.Header {
  5381. if c.header_ == nil {
  5382. c.header_ = make(http.Header)
  5383. }
  5384. return c.header_
  5385. }
  5386. func (c *DomainAliasesGetCall) doRequest(alt string) (*http.Response, error) {
  5387. reqHeaders := make(http.Header)
  5388. for k, v := range c.header_ {
  5389. reqHeaders[k] = v
  5390. }
  5391. reqHeaders.Set("User-Agent", c.s.userAgent())
  5392. if c.ifNoneMatch_ != "" {
  5393. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5394. }
  5395. var body io.Reader = nil
  5396. c.urlParams_.Set("alt", alt)
  5397. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases/{domainAliasName}")
  5398. urls += "?" + c.urlParams_.Encode()
  5399. req, _ := http.NewRequest("GET", urls, body)
  5400. req.Header = reqHeaders
  5401. googleapi.Expand(req.URL, map[string]string{
  5402. "customer": c.customer,
  5403. "domainAliasName": c.domainAliasName,
  5404. })
  5405. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5406. }
  5407. // Do executes the "directory.domainAliases.get" call.
  5408. // Exactly one of *DomainAlias or error will be non-nil. Any non-2xx
  5409. // status code is an error. Response headers are in either
  5410. // *DomainAlias.ServerResponse.Header or (if a response was returned at
  5411. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5412. // to check whether the returned error was because
  5413. // http.StatusNotModified was returned.
  5414. func (c *DomainAliasesGetCall) Do(opts ...googleapi.CallOption) (*DomainAlias, error) {
  5415. gensupport.SetOptions(c.urlParams_, opts...)
  5416. res, err := c.doRequest("json")
  5417. if res != nil && res.StatusCode == http.StatusNotModified {
  5418. if res.Body != nil {
  5419. res.Body.Close()
  5420. }
  5421. return nil, &googleapi.Error{
  5422. Code: res.StatusCode,
  5423. Header: res.Header,
  5424. }
  5425. }
  5426. if err != nil {
  5427. return nil, err
  5428. }
  5429. defer googleapi.CloseBody(res)
  5430. if err := googleapi.CheckResponse(res); err != nil {
  5431. return nil, err
  5432. }
  5433. ret := &DomainAlias{
  5434. ServerResponse: googleapi.ServerResponse{
  5435. Header: res.Header,
  5436. HTTPStatusCode: res.StatusCode,
  5437. },
  5438. }
  5439. target := &ret
  5440. if err := gensupport.DecodeResponse(target, res); err != nil {
  5441. return nil, err
  5442. }
  5443. return ret, nil
  5444. // {
  5445. // "description": "Retrieves a domain alias of the customer.",
  5446. // "httpMethod": "GET",
  5447. // "id": "directory.domainAliases.get",
  5448. // "parameterOrder": [
  5449. // "customer",
  5450. // "domainAliasName"
  5451. // ],
  5452. // "parameters": {
  5453. // "customer": {
  5454. // "description": "Immutable ID of the G Suite account.",
  5455. // "location": "path",
  5456. // "required": true,
  5457. // "type": "string"
  5458. // },
  5459. // "domainAliasName": {
  5460. // "description": "Name of domain alias to be retrieved.",
  5461. // "location": "path",
  5462. // "required": true,
  5463. // "type": "string"
  5464. // }
  5465. // },
  5466. // "path": "customer/{customer}/domainaliases/{domainAliasName}",
  5467. // "response": {
  5468. // "$ref": "DomainAlias"
  5469. // },
  5470. // "scopes": [
  5471. // "https://www.googleapis.com/auth/admin.directory.domain",
  5472. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  5473. // ]
  5474. // }
  5475. }
  5476. // method id "directory.domainAliases.insert":
  5477. type DomainAliasesInsertCall struct {
  5478. s *Service
  5479. customer string
  5480. domainalias *DomainAlias
  5481. urlParams_ gensupport.URLParams
  5482. ctx_ context.Context
  5483. header_ http.Header
  5484. }
  5485. // Insert: Inserts a Domain alias of the customer.
  5486. func (r *DomainAliasesService) Insert(customer string, domainalias *DomainAlias) *DomainAliasesInsertCall {
  5487. c := &DomainAliasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5488. c.customer = customer
  5489. c.domainalias = domainalias
  5490. return c
  5491. }
  5492. // Fields allows partial responses to be retrieved. See
  5493. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5494. // for more information.
  5495. func (c *DomainAliasesInsertCall) Fields(s ...googleapi.Field) *DomainAliasesInsertCall {
  5496. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5497. return c
  5498. }
  5499. // Context sets the context to be used in this call's Do method. Any
  5500. // pending HTTP request will be aborted if the provided context is
  5501. // canceled.
  5502. func (c *DomainAliasesInsertCall) Context(ctx context.Context) *DomainAliasesInsertCall {
  5503. c.ctx_ = ctx
  5504. return c
  5505. }
  5506. // Header returns an http.Header that can be modified by the caller to
  5507. // add HTTP headers to the request.
  5508. func (c *DomainAliasesInsertCall) Header() http.Header {
  5509. if c.header_ == nil {
  5510. c.header_ = make(http.Header)
  5511. }
  5512. return c.header_
  5513. }
  5514. func (c *DomainAliasesInsertCall) doRequest(alt string) (*http.Response, error) {
  5515. reqHeaders := make(http.Header)
  5516. for k, v := range c.header_ {
  5517. reqHeaders[k] = v
  5518. }
  5519. reqHeaders.Set("User-Agent", c.s.userAgent())
  5520. var body io.Reader = nil
  5521. body, err := googleapi.WithoutDataWrapper.JSONReader(c.domainalias)
  5522. if err != nil {
  5523. return nil, err
  5524. }
  5525. reqHeaders.Set("Content-Type", "application/json")
  5526. c.urlParams_.Set("alt", alt)
  5527. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases")
  5528. urls += "?" + c.urlParams_.Encode()
  5529. req, _ := http.NewRequest("POST", urls, body)
  5530. req.Header = reqHeaders
  5531. googleapi.Expand(req.URL, map[string]string{
  5532. "customer": c.customer,
  5533. })
  5534. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5535. }
  5536. // Do executes the "directory.domainAliases.insert" call.
  5537. // Exactly one of *DomainAlias or error will be non-nil. Any non-2xx
  5538. // status code is an error. Response headers are in either
  5539. // *DomainAlias.ServerResponse.Header or (if a response was returned at
  5540. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5541. // to check whether the returned error was because
  5542. // http.StatusNotModified was returned.
  5543. func (c *DomainAliasesInsertCall) Do(opts ...googleapi.CallOption) (*DomainAlias, error) {
  5544. gensupport.SetOptions(c.urlParams_, opts...)
  5545. res, err := c.doRequest("json")
  5546. if res != nil && res.StatusCode == http.StatusNotModified {
  5547. if res.Body != nil {
  5548. res.Body.Close()
  5549. }
  5550. return nil, &googleapi.Error{
  5551. Code: res.StatusCode,
  5552. Header: res.Header,
  5553. }
  5554. }
  5555. if err != nil {
  5556. return nil, err
  5557. }
  5558. defer googleapi.CloseBody(res)
  5559. if err := googleapi.CheckResponse(res); err != nil {
  5560. return nil, err
  5561. }
  5562. ret := &DomainAlias{
  5563. ServerResponse: googleapi.ServerResponse{
  5564. Header: res.Header,
  5565. HTTPStatusCode: res.StatusCode,
  5566. },
  5567. }
  5568. target := &ret
  5569. if err := gensupport.DecodeResponse(target, res); err != nil {
  5570. return nil, err
  5571. }
  5572. return ret, nil
  5573. // {
  5574. // "description": "Inserts a Domain alias of the customer.",
  5575. // "httpMethod": "POST",
  5576. // "id": "directory.domainAliases.insert",
  5577. // "parameterOrder": [
  5578. // "customer"
  5579. // ],
  5580. // "parameters": {
  5581. // "customer": {
  5582. // "description": "Immutable ID of the G Suite account.",
  5583. // "location": "path",
  5584. // "required": true,
  5585. // "type": "string"
  5586. // }
  5587. // },
  5588. // "path": "customer/{customer}/domainaliases",
  5589. // "request": {
  5590. // "$ref": "DomainAlias"
  5591. // },
  5592. // "response": {
  5593. // "$ref": "DomainAlias"
  5594. // },
  5595. // "scopes": [
  5596. // "https://www.googleapis.com/auth/admin.directory.domain"
  5597. // ]
  5598. // }
  5599. }
  5600. // method id "directory.domainAliases.list":
  5601. type DomainAliasesListCall struct {
  5602. s *Service
  5603. customer string
  5604. urlParams_ gensupport.URLParams
  5605. ifNoneMatch_ string
  5606. ctx_ context.Context
  5607. header_ http.Header
  5608. }
  5609. // List: Lists the domain aliases of the customer.
  5610. func (r *DomainAliasesService) List(customer string) *DomainAliasesListCall {
  5611. c := &DomainAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5612. c.customer = customer
  5613. return c
  5614. }
  5615. // ParentDomainName sets the optional parameter "parentDomainName": Name
  5616. // of the parent domain for which domain aliases are to be fetched.
  5617. func (c *DomainAliasesListCall) ParentDomainName(parentDomainName string) *DomainAliasesListCall {
  5618. c.urlParams_.Set("parentDomainName", parentDomainName)
  5619. return c
  5620. }
  5621. // Fields allows partial responses to be retrieved. See
  5622. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5623. // for more information.
  5624. func (c *DomainAliasesListCall) Fields(s ...googleapi.Field) *DomainAliasesListCall {
  5625. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5626. return c
  5627. }
  5628. // IfNoneMatch sets the optional parameter which makes the operation
  5629. // fail if the object's ETag matches the given value. This is useful for
  5630. // getting updates only after the object has changed since the last
  5631. // request. Use googleapi.IsNotModified to check whether the response
  5632. // error from Do is the result of In-None-Match.
  5633. func (c *DomainAliasesListCall) IfNoneMatch(entityTag string) *DomainAliasesListCall {
  5634. c.ifNoneMatch_ = entityTag
  5635. return c
  5636. }
  5637. // Context sets the context to be used in this call's Do method. Any
  5638. // pending HTTP request will be aborted if the provided context is
  5639. // canceled.
  5640. func (c *DomainAliasesListCall) Context(ctx context.Context) *DomainAliasesListCall {
  5641. c.ctx_ = ctx
  5642. return c
  5643. }
  5644. // Header returns an http.Header that can be modified by the caller to
  5645. // add HTTP headers to the request.
  5646. func (c *DomainAliasesListCall) Header() http.Header {
  5647. if c.header_ == nil {
  5648. c.header_ = make(http.Header)
  5649. }
  5650. return c.header_
  5651. }
  5652. func (c *DomainAliasesListCall) doRequest(alt string) (*http.Response, error) {
  5653. reqHeaders := make(http.Header)
  5654. for k, v := range c.header_ {
  5655. reqHeaders[k] = v
  5656. }
  5657. reqHeaders.Set("User-Agent", c.s.userAgent())
  5658. if c.ifNoneMatch_ != "" {
  5659. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5660. }
  5661. var body io.Reader = nil
  5662. c.urlParams_.Set("alt", alt)
  5663. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domainaliases")
  5664. urls += "?" + c.urlParams_.Encode()
  5665. req, _ := http.NewRequest("GET", urls, body)
  5666. req.Header = reqHeaders
  5667. googleapi.Expand(req.URL, map[string]string{
  5668. "customer": c.customer,
  5669. })
  5670. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5671. }
  5672. // Do executes the "directory.domainAliases.list" call.
  5673. // Exactly one of *DomainAliases or error will be non-nil. Any non-2xx
  5674. // status code is an error. Response headers are in either
  5675. // *DomainAliases.ServerResponse.Header or (if a response was returned
  5676. // at all) in error.(*googleapi.Error).Header. Use
  5677. // googleapi.IsNotModified to check whether the returned error was
  5678. // because http.StatusNotModified was returned.
  5679. func (c *DomainAliasesListCall) Do(opts ...googleapi.CallOption) (*DomainAliases, error) {
  5680. gensupport.SetOptions(c.urlParams_, opts...)
  5681. res, err := c.doRequest("json")
  5682. if res != nil && res.StatusCode == http.StatusNotModified {
  5683. if res.Body != nil {
  5684. res.Body.Close()
  5685. }
  5686. return nil, &googleapi.Error{
  5687. Code: res.StatusCode,
  5688. Header: res.Header,
  5689. }
  5690. }
  5691. if err != nil {
  5692. return nil, err
  5693. }
  5694. defer googleapi.CloseBody(res)
  5695. if err := googleapi.CheckResponse(res); err != nil {
  5696. return nil, err
  5697. }
  5698. ret := &DomainAliases{
  5699. ServerResponse: googleapi.ServerResponse{
  5700. Header: res.Header,
  5701. HTTPStatusCode: res.StatusCode,
  5702. },
  5703. }
  5704. target := &ret
  5705. if err := gensupport.DecodeResponse(target, res); err != nil {
  5706. return nil, err
  5707. }
  5708. return ret, nil
  5709. // {
  5710. // "description": "Lists the domain aliases of the customer.",
  5711. // "httpMethod": "GET",
  5712. // "id": "directory.domainAliases.list",
  5713. // "parameterOrder": [
  5714. // "customer"
  5715. // ],
  5716. // "parameters": {
  5717. // "customer": {
  5718. // "description": "Immutable ID of the G Suite account.",
  5719. // "location": "path",
  5720. // "required": true,
  5721. // "type": "string"
  5722. // },
  5723. // "parentDomainName": {
  5724. // "description": "Name of the parent domain for which domain aliases are to be fetched.",
  5725. // "location": "query",
  5726. // "type": "string"
  5727. // }
  5728. // },
  5729. // "path": "customer/{customer}/domainaliases",
  5730. // "response": {
  5731. // "$ref": "DomainAliases"
  5732. // },
  5733. // "scopes": [
  5734. // "https://www.googleapis.com/auth/admin.directory.domain",
  5735. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  5736. // ]
  5737. // }
  5738. }
  5739. // method id "directory.domains.delete":
  5740. type DomainsDeleteCall struct {
  5741. s *Service
  5742. customer string
  5743. domainName string
  5744. urlParams_ gensupport.URLParams
  5745. ctx_ context.Context
  5746. header_ http.Header
  5747. }
  5748. // Delete: Deletes a domain of the customer.
  5749. func (r *DomainsService) Delete(customer string, domainName string) *DomainsDeleteCall {
  5750. c := &DomainsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5751. c.customer = customer
  5752. c.domainName = domainName
  5753. return c
  5754. }
  5755. // Fields allows partial responses to be retrieved. See
  5756. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5757. // for more information.
  5758. func (c *DomainsDeleteCall) Fields(s ...googleapi.Field) *DomainsDeleteCall {
  5759. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5760. return c
  5761. }
  5762. // Context sets the context to be used in this call's Do method. Any
  5763. // pending HTTP request will be aborted if the provided context is
  5764. // canceled.
  5765. func (c *DomainsDeleteCall) Context(ctx context.Context) *DomainsDeleteCall {
  5766. c.ctx_ = ctx
  5767. return c
  5768. }
  5769. // Header returns an http.Header that can be modified by the caller to
  5770. // add HTTP headers to the request.
  5771. func (c *DomainsDeleteCall) Header() http.Header {
  5772. if c.header_ == nil {
  5773. c.header_ = make(http.Header)
  5774. }
  5775. return c.header_
  5776. }
  5777. func (c *DomainsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5778. reqHeaders := make(http.Header)
  5779. for k, v := range c.header_ {
  5780. reqHeaders[k] = v
  5781. }
  5782. reqHeaders.Set("User-Agent", c.s.userAgent())
  5783. var body io.Reader = nil
  5784. c.urlParams_.Set("alt", alt)
  5785. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains/{domainName}")
  5786. urls += "?" + c.urlParams_.Encode()
  5787. req, _ := http.NewRequest("DELETE", urls, body)
  5788. req.Header = reqHeaders
  5789. googleapi.Expand(req.URL, map[string]string{
  5790. "customer": c.customer,
  5791. "domainName": c.domainName,
  5792. })
  5793. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5794. }
  5795. // Do executes the "directory.domains.delete" call.
  5796. func (c *DomainsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5797. gensupport.SetOptions(c.urlParams_, opts...)
  5798. res, err := c.doRequest("json")
  5799. if err != nil {
  5800. return err
  5801. }
  5802. defer googleapi.CloseBody(res)
  5803. if err := googleapi.CheckResponse(res); err != nil {
  5804. return err
  5805. }
  5806. return nil
  5807. // {
  5808. // "description": "Deletes a domain of the customer.",
  5809. // "httpMethod": "DELETE",
  5810. // "id": "directory.domains.delete",
  5811. // "parameterOrder": [
  5812. // "customer",
  5813. // "domainName"
  5814. // ],
  5815. // "parameters": {
  5816. // "customer": {
  5817. // "description": "Immutable ID of the G Suite account.",
  5818. // "location": "path",
  5819. // "required": true,
  5820. // "type": "string"
  5821. // },
  5822. // "domainName": {
  5823. // "description": "Name of domain to be deleted",
  5824. // "location": "path",
  5825. // "required": true,
  5826. // "type": "string"
  5827. // }
  5828. // },
  5829. // "path": "customer/{customer}/domains/{domainName}",
  5830. // "scopes": [
  5831. // "https://www.googleapis.com/auth/admin.directory.domain"
  5832. // ]
  5833. // }
  5834. }
  5835. // method id "directory.domains.get":
  5836. type DomainsGetCall struct {
  5837. s *Service
  5838. customer string
  5839. domainName string
  5840. urlParams_ gensupport.URLParams
  5841. ifNoneMatch_ string
  5842. ctx_ context.Context
  5843. header_ http.Header
  5844. }
  5845. // Get: Retrieves a domain of the customer.
  5846. func (r *DomainsService) Get(customer string, domainName string) *DomainsGetCall {
  5847. c := &DomainsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5848. c.customer = customer
  5849. c.domainName = domainName
  5850. return c
  5851. }
  5852. // Fields allows partial responses to be retrieved. See
  5853. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5854. // for more information.
  5855. func (c *DomainsGetCall) Fields(s ...googleapi.Field) *DomainsGetCall {
  5856. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5857. return c
  5858. }
  5859. // IfNoneMatch sets the optional parameter which makes the operation
  5860. // fail if the object's ETag matches the given value. This is useful for
  5861. // getting updates only after the object has changed since the last
  5862. // request. Use googleapi.IsNotModified to check whether the response
  5863. // error from Do is the result of In-None-Match.
  5864. func (c *DomainsGetCall) IfNoneMatch(entityTag string) *DomainsGetCall {
  5865. c.ifNoneMatch_ = entityTag
  5866. return c
  5867. }
  5868. // Context sets the context to be used in this call's Do method. Any
  5869. // pending HTTP request will be aborted if the provided context is
  5870. // canceled.
  5871. func (c *DomainsGetCall) Context(ctx context.Context) *DomainsGetCall {
  5872. c.ctx_ = ctx
  5873. return c
  5874. }
  5875. // Header returns an http.Header that can be modified by the caller to
  5876. // add HTTP headers to the request.
  5877. func (c *DomainsGetCall) Header() http.Header {
  5878. if c.header_ == nil {
  5879. c.header_ = make(http.Header)
  5880. }
  5881. return c.header_
  5882. }
  5883. func (c *DomainsGetCall) doRequest(alt string) (*http.Response, error) {
  5884. reqHeaders := make(http.Header)
  5885. for k, v := range c.header_ {
  5886. reqHeaders[k] = v
  5887. }
  5888. reqHeaders.Set("User-Agent", c.s.userAgent())
  5889. if c.ifNoneMatch_ != "" {
  5890. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5891. }
  5892. var body io.Reader = nil
  5893. c.urlParams_.Set("alt", alt)
  5894. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains/{domainName}")
  5895. urls += "?" + c.urlParams_.Encode()
  5896. req, _ := http.NewRequest("GET", urls, body)
  5897. req.Header = reqHeaders
  5898. googleapi.Expand(req.URL, map[string]string{
  5899. "customer": c.customer,
  5900. "domainName": c.domainName,
  5901. })
  5902. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5903. }
  5904. // Do executes the "directory.domains.get" call.
  5905. // Exactly one of *Domains or error will be non-nil. Any non-2xx status
  5906. // code is an error. Response headers are in either
  5907. // *Domains.ServerResponse.Header or (if a response was returned at all)
  5908. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5909. // check whether the returned error was because http.StatusNotModified
  5910. // was returned.
  5911. func (c *DomainsGetCall) Do(opts ...googleapi.CallOption) (*Domains, error) {
  5912. gensupport.SetOptions(c.urlParams_, opts...)
  5913. res, err := c.doRequest("json")
  5914. if res != nil && res.StatusCode == http.StatusNotModified {
  5915. if res.Body != nil {
  5916. res.Body.Close()
  5917. }
  5918. return nil, &googleapi.Error{
  5919. Code: res.StatusCode,
  5920. Header: res.Header,
  5921. }
  5922. }
  5923. if err != nil {
  5924. return nil, err
  5925. }
  5926. defer googleapi.CloseBody(res)
  5927. if err := googleapi.CheckResponse(res); err != nil {
  5928. return nil, err
  5929. }
  5930. ret := &Domains{
  5931. ServerResponse: googleapi.ServerResponse{
  5932. Header: res.Header,
  5933. HTTPStatusCode: res.StatusCode,
  5934. },
  5935. }
  5936. target := &ret
  5937. if err := gensupport.DecodeResponse(target, res); err != nil {
  5938. return nil, err
  5939. }
  5940. return ret, nil
  5941. // {
  5942. // "description": "Retrieves a domain of the customer.",
  5943. // "httpMethod": "GET",
  5944. // "id": "directory.domains.get",
  5945. // "parameterOrder": [
  5946. // "customer",
  5947. // "domainName"
  5948. // ],
  5949. // "parameters": {
  5950. // "customer": {
  5951. // "description": "Immutable ID of the G Suite account.",
  5952. // "location": "path",
  5953. // "required": true,
  5954. // "type": "string"
  5955. // },
  5956. // "domainName": {
  5957. // "description": "Name of domain to be retrieved",
  5958. // "location": "path",
  5959. // "required": true,
  5960. // "type": "string"
  5961. // }
  5962. // },
  5963. // "path": "customer/{customer}/domains/{domainName}",
  5964. // "response": {
  5965. // "$ref": "Domains"
  5966. // },
  5967. // "scopes": [
  5968. // "https://www.googleapis.com/auth/admin.directory.domain",
  5969. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  5970. // ]
  5971. // }
  5972. }
  5973. // method id "directory.domains.insert":
  5974. type DomainsInsertCall struct {
  5975. s *Service
  5976. customer string
  5977. domains *Domains
  5978. urlParams_ gensupport.URLParams
  5979. ctx_ context.Context
  5980. header_ http.Header
  5981. }
  5982. // Insert: Inserts a domain of the customer.
  5983. func (r *DomainsService) Insert(customer string, domains *Domains) *DomainsInsertCall {
  5984. c := &DomainsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5985. c.customer = customer
  5986. c.domains = domains
  5987. return c
  5988. }
  5989. // Fields allows partial responses to be retrieved. See
  5990. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5991. // for more information.
  5992. func (c *DomainsInsertCall) Fields(s ...googleapi.Field) *DomainsInsertCall {
  5993. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5994. return c
  5995. }
  5996. // Context sets the context to be used in this call's Do method. Any
  5997. // pending HTTP request will be aborted if the provided context is
  5998. // canceled.
  5999. func (c *DomainsInsertCall) Context(ctx context.Context) *DomainsInsertCall {
  6000. c.ctx_ = ctx
  6001. return c
  6002. }
  6003. // Header returns an http.Header that can be modified by the caller to
  6004. // add HTTP headers to the request.
  6005. func (c *DomainsInsertCall) Header() http.Header {
  6006. if c.header_ == nil {
  6007. c.header_ = make(http.Header)
  6008. }
  6009. return c.header_
  6010. }
  6011. func (c *DomainsInsertCall) doRequest(alt string) (*http.Response, error) {
  6012. reqHeaders := make(http.Header)
  6013. for k, v := range c.header_ {
  6014. reqHeaders[k] = v
  6015. }
  6016. reqHeaders.Set("User-Agent", c.s.userAgent())
  6017. var body io.Reader = nil
  6018. body, err := googleapi.WithoutDataWrapper.JSONReader(c.domains)
  6019. if err != nil {
  6020. return nil, err
  6021. }
  6022. reqHeaders.Set("Content-Type", "application/json")
  6023. c.urlParams_.Set("alt", alt)
  6024. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains")
  6025. urls += "?" + c.urlParams_.Encode()
  6026. req, _ := http.NewRequest("POST", urls, body)
  6027. req.Header = reqHeaders
  6028. googleapi.Expand(req.URL, map[string]string{
  6029. "customer": c.customer,
  6030. })
  6031. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6032. }
  6033. // Do executes the "directory.domains.insert" call.
  6034. // Exactly one of *Domains or error will be non-nil. Any non-2xx status
  6035. // code is an error. Response headers are in either
  6036. // *Domains.ServerResponse.Header or (if a response was returned at all)
  6037. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6038. // check whether the returned error was because http.StatusNotModified
  6039. // was returned.
  6040. func (c *DomainsInsertCall) Do(opts ...googleapi.CallOption) (*Domains, error) {
  6041. gensupport.SetOptions(c.urlParams_, opts...)
  6042. res, err := c.doRequest("json")
  6043. if res != nil && res.StatusCode == http.StatusNotModified {
  6044. if res.Body != nil {
  6045. res.Body.Close()
  6046. }
  6047. return nil, &googleapi.Error{
  6048. Code: res.StatusCode,
  6049. Header: res.Header,
  6050. }
  6051. }
  6052. if err != nil {
  6053. return nil, err
  6054. }
  6055. defer googleapi.CloseBody(res)
  6056. if err := googleapi.CheckResponse(res); err != nil {
  6057. return nil, err
  6058. }
  6059. ret := &Domains{
  6060. ServerResponse: googleapi.ServerResponse{
  6061. Header: res.Header,
  6062. HTTPStatusCode: res.StatusCode,
  6063. },
  6064. }
  6065. target := &ret
  6066. if err := gensupport.DecodeResponse(target, res); err != nil {
  6067. return nil, err
  6068. }
  6069. return ret, nil
  6070. // {
  6071. // "description": "Inserts a domain of the customer.",
  6072. // "httpMethod": "POST",
  6073. // "id": "directory.domains.insert",
  6074. // "parameterOrder": [
  6075. // "customer"
  6076. // ],
  6077. // "parameters": {
  6078. // "customer": {
  6079. // "description": "Immutable ID of the G Suite account.",
  6080. // "location": "path",
  6081. // "required": true,
  6082. // "type": "string"
  6083. // }
  6084. // },
  6085. // "path": "customer/{customer}/domains",
  6086. // "request": {
  6087. // "$ref": "Domains"
  6088. // },
  6089. // "response": {
  6090. // "$ref": "Domains"
  6091. // },
  6092. // "scopes": [
  6093. // "https://www.googleapis.com/auth/admin.directory.domain"
  6094. // ]
  6095. // }
  6096. }
  6097. // method id "directory.domains.list":
  6098. type DomainsListCall struct {
  6099. s *Service
  6100. customer string
  6101. urlParams_ gensupport.URLParams
  6102. ifNoneMatch_ string
  6103. ctx_ context.Context
  6104. header_ http.Header
  6105. }
  6106. // List: Lists the domains of the customer.
  6107. func (r *DomainsService) List(customer string) *DomainsListCall {
  6108. c := &DomainsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6109. c.customer = customer
  6110. return c
  6111. }
  6112. // Fields allows partial responses to be retrieved. See
  6113. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6114. // for more information.
  6115. func (c *DomainsListCall) Fields(s ...googleapi.Field) *DomainsListCall {
  6116. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6117. return c
  6118. }
  6119. // IfNoneMatch sets the optional parameter which makes the operation
  6120. // fail if the object's ETag matches the given value. This is useful for
  6121. // getting updates only after the object has changed since the last
  6122. // request. Use googleapi.IsNotModified to check whether the response
  6123. // error from Do is the result of In-None-Match.
  6124. func (c *DomainsListCall) IfNoneMatch(entityTag string) *DomainsListCall {
  6125. c.ifNoneMatch_ = entityTag
  6126. return c
  6127. }
  6128. // Context sets the context to be used in this call's Do method. Any
  6129. // pending HTTP request will be aborted if the provided context is
  6130. // canceled.
  6131. func (c *DomainsListCall) Context(ctx context.Context) *DomainsListCall {
  6132. c.ctx_ = ctx
  6133. return c
  6134. }
  6135. // Header returns an http.Header that can be modified by the caller to
  6136. // add HTTP headers to the request.
  6137. func (c *DomainsListCall) Header() http.Header {
  6138. if c.header_ == nil {
  6139. c.header_ = make(http.Header)
  6140. }
  6141. return c.header_
  6142. }
  6143. func (c *DomainsListCall) doRequest(alt string) (*http.Response, error) {
  6144. reqHeaders := make(http.Header)
  6145. for k, v := range c.header_ {
  6146. reqHeaders[k] = v
  6147. }
  6148. reqHeaders.Set("User-Agent", c.s.userAgent())
  6149. if c.ifNoneMatch_ != "" {
  6150. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6151. }
  6152. var body io.Reader = nil
  6153. c.urlParams_.Set("alt", alt)
  6154. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/domains")
  6155. urls += "?" + c.urlParams_.Encode()
  6156. req, _ := http.NewRequest("GET", urls, body)
  6157. req.Header = reqHeaders
  6158. googleapi.Expand(req.URL, map[string]string{
  6159. "customer": c.customer,
  6160. })
  6161. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6162. }
  6163. // Do executes the "directory.domains.list" call.
  6164. // Exactly one of *Domains2 or error will be non-nil. Any non-2xx status
  6165. // code is an error. Response headers are in either
  6166. // *Domains2.ServerResponse.Header or (if a response was returned at
  6167. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6168. // to check whether the returned error was because
  6169. // http.StatusNotModified was returned.
  6170. func (c *DomainsListCall) Do(opts ...googleapi.CallOption) (*Domains2, error) {
  6171. gensupport.SetOptions(c.urlParams_, opts...)
  6172. res, err := c.doRequest("json")
  6173. if res != nil && res.StatusCode == http.StatusNotModified {
  6174. if res.Body != nil {
  6175. res.Body.Close()
  6176. }
  6177. return nil, &googleapi.Error{
  6178. Code: res.StatusCode,
  6179. Header: res.Header,
  6180. }
  6181. }
  6182. if err != nil {
  6183. return nil, err
  6184. }
  6185. defer googleapi.CloseBody(res)
  6186. if err := googleapi.CheckResponse(res); err != nil {
  6187. return nil, err
  6188. }
  6189. ret := &Domains2{
  6190. ServerResponse: googleapi.ServerResponse{
  6191. Header: res.Header,
  6192. HTTPStatusCode: res.StatusCode,
  6193. },
  6194. }
  6195. target := &ret
  6196. if err := gensupport.DecodeResponse(target, res); err != nil {
  6197. return nil, err
  6198. }
  6199. return ret, nil
  6200. // {
  6201. // "description": "Lists the domains of the customer.",
  6202. // "httpMethod": "GET",
  6203. // "id": "directory.domains.list",
  6204. // "parameterOrder": [
  6205. // "customer"
  6206. // ],
  6207. // "parameters": {
  6208. // "customer": {
  6209. // "description": "Immutable ID of the G Suite account.",
  6210. // "location": "path",
  6211. // "required": true,
  6212. // "type": "string"
  6213. // }
  6214. // },
  6215. // "path": "customer/{customer}/domains",
  6216. // "response": {
  6217. // "$ref": "Domains2"
  6218. // },
  6219. // "scopes": [
  6220. // "https://www.googleapis.com/auth/admin.directory.domain",
  6221. // "https://www.googleapis.com/auth/admin.directory.domain.readonly"
  6222. // ]
  6223. // }
  6224. }
  6225. // method id "directory.groups.delete":
  6226. type GroupsDeleteCall struct {
  6227. s *Service
  6228. groupKey string
  6229. urlParams_ gensupport.URLParams
  6230. ctx_ context.Context
  6231. header_ http.Header
  6232. }
  6233. // Delete: Delete Group
  6234. func (r *GroupsService) Delete(groupKey string) *GroupsDeleteCall {
  6235. c := &GroupsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6236. c.groupKey = groupKey
  6237. return c
  6238. }
  6239. // Fields allows partial responses to be retrieved. See
  6240. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6241. // for more information.
  6242. func (c *GroupsDeleteCall) Fields(s ...googleapi.Field) *GroupsDeleteCall {
  6243. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6244. return c
  6245. }
  6246. // Context sets the context to be used in this call's Do method. Any
  6247. // pending HTTP request will be aborted if the provided context is
  6248. // canceled.
  6249. func (c *GroupsDeleteCall) Context(ctx context.Context) *GroupsDeleteCall {
  6250. c.ctx_ = ctx
  6251. return c
  6252. }
  6253. // Header returns an http.Header that can be modified by the caller to
  6254. // add HTTP headers to the request.
  6255. func (c *GroupsDeleteCall) Header() http.Header {
  6256. if c.header_ == nil {
  6257. c.header_ = make(http.Header)
  6258. }
  6259. return c.header_
  6260. }
  6261. func (c *GroupsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6262. reqHeaders := make(http.Header)
  6263. for k, v := range c.header_ {
  6264. reqHeaders[k] = v
  6265. }
  6266. reqHeaders.Set("User-Agent", c.s.userAgent())
  6267. var body io.Reader = nil
  6268. c.urlParams_.Set("alt", alt)
  6269. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  6270. urls += "?" + c.urlParams_.Encode()
  6271. req, _ := http.NewRequest("DELETE", urls, body)
  6272. req.Header = reqHeaders
  6273. googleapi.Expand(req.URL, map[string]string{
  6274. "groupKey": c.groupKey,
  6275. })
  6276. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6277. }
  6278. // Do executes the "directory.groups.delete" call.
  6279. func (c *GroupsDeleteCall) Do(opts ...googleapi.CallOption) error {
  6280. gensupport.SetOptions(c.urlParams_, opts...)
  6281. res, err := c.doRequest("json")
  6282. if err != nil {
  6283. return err
  6284. }
  6285. defer googleapi.CloseBody(res)
  6286. if err := googleapi.CheckResponse(res); err != nil {
  6287. return err
  6288. }
  6289. return nil
  6290. // {
  6291. // "description": "Delete Group",
  6292. // "httpMethod": "DELETE",
  6293. // "id": "directory.groups.delete",
  6294. // "parameterOrder": [
  6295. // "groupKey"
  6296. // ],
  6297. // "parameters": {
  6298. // "groupKey": {
  6299. // "description": "Email or immutable ID of the group",
  6300. // "location": "path",
  6301. // "required": true,
  6302. // "type": "string"
  6303. // }
  6304. // },
  6305. // "path": "groups/{groupKey}",
  6306. // "scopes": [
  6307. // "https://www.googleapis.com/auth/admin.directory.group"
  6308. // ]
  6309. // }
  6310. }
  6311. // method id "directory.groups.get":
  6312. type GroupsGetCall struct {
  6313. s *Service
  6314. groupKey string
  6315. urlParams_ gensupport.URLParams
  6316. ifNoneMatch_ string
  6317. ctx_ context.Context
  6318. header_ http.Header
  6319. }
  6320. // Get: Retrieve Group
  6321. func (r *GroupsService) Get(groupKey string) *GroupsGetCall {
  6322. c := &GroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6323. c.groupKey = groupKey
  6324. return c
  6325. }
  6326. // Fields allows partial responses to be retrieved. See
  6327. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6328. // for more information.
  6329. func (c *GroupsGetCall) Fields(s ...googleapi.Field) *GroupsGetCall {
  6330. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6331. return c
  6332. }
  6333. // IfNoneMatch sets the optional parameter which makes the operation
  6334. // fail if the object's ETag matches the given value. This is useful for
  6335. // getting updates only after the object has changed since the last
  6336. // request. Use googleapi.IsNotModified to check whether the response
  6337. // error from Do is the result of In-None-Match.
  6338. func (c *GroupsGetCall) IfNoneMatch(entityTag string) *GroupsGetCall {
  6339. c.ifNoneMatch_ = entityTag
  6340. return c
  6341. }
  6342. // Context sets the context to be used in this call's Do method. Any
  6343. // pending HTTP request will be aborted if the provided context is
  6344. // canceled.
  6345. func (c *GroupsGetCall) Context(ctx context.Context) *GroupsGetCall {
  6346. c.ctx_ = ctx
  6347. return c
  6348. }
  6349. // Header returns an http.Header that can be modified by the caller to
  6350. // add HTTP headers to the request.
  6351. func (c *GroupsGetCall) Header() http.Header {
  6352. if c.header_ == nil {
  6353. c.header_ = make(http.Header)
  6354. }
  6355. return c.header_
  6356. }
  6357. func (c *GroupsGetCall) doRequest(alt string) (*http.Response, error) {
  6358. reqHeaders := make(http.Header)
  6359. for k, v := range c.header_ {
  6360. reqHeaders[k] = v
  6361. }
  6362. reqHeaders.Set("User-Agent", c.s.userAgent())
  6363. if c.ifNoneMatch_ != "" {
  6364. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6365. }
  6366. var body io.Reader = nil
  6367. c.urlParams_.Set("alt", alt)
  6368. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  6369. urls += "?" + c.urlParams_.Encode()
  6370. req, _ := http.NewRequest("GET", urls, body)
  6371. req.Header = reqHeaders
  6372. googleapi.Expand(req.URL, map[string]string{
  6373. "groupKey": c.groupKey,
  6374. })
  6375. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6376. }
  6377. // Do executes the "directory.groups.get" call.
  6378. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  6379. // code is an error. Response headers are in either
  6380. // *Group.ServerResponse.Header or (if a response was returned at all)
  6381. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6382. // check whether the returned error was because http.StatusNotModified
  6383. // was returned.
  6384. func (c *GroupsGetCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  6385. gensupport.SetOptions(c.urlParams_, opts...)
  6386. res, err := c.doRequest("json")
  6387. if res != nil && res.StatusCode == http.StatusNotModified {
  6388. if res.Body != nil {
  6389. res.Body.Close()
  6390. }
  6391. return nil, &googleapi.Error{
  6392. Code: res.StatusCode,
  6393. Header: res.Header,
  6394. }
  6395. }
  6396. if err != nil {
  6397. return nil, err
  6398. }
  6399. defer googleapi.CloseBody(res)
  6400. if err := googleapi.CheckResponse(res); err != nil {
  6401. return nil, err
  6402. }
  6403. ret := &Group{
  6404. ServerResponse: googleapi.ServerResponse{
  6405. Header: res.Header,
  6406. HTTPStatusCode: res.StatusCode,
  6407. },
  6408. }
  6409. target := &ret
  6410. if err := gensupport.DecodeResponse(target, res); err != nil {
  6411. return nil, err
  6412. }
  6413. return ret, nil
  6414. // {
  6415. // "description": "Retrieve Group",
  6416. // "httpMethod": "GET",
  6417. // "id": "directory.groups.get",
  6418. // "parameterOrder": [
  6419. // "groupKey"
  6420. // ],
  6421. // "parameters": {
  6422. // "groupKey": {
  6423. // "description": "Email or immutable ID of the group",
  6424. // "location": "path",
  6425. // "required": true,
  6426. // "type": "string"
  6427. // }
  6428. // },
  6429. // "path": "groups/{groupKey}",
  6430. // "response": {
  6431. // "$ref": "Group"
  6432. // },
  6433. // "scopes": [
  6434. // "https://www.googleapis.com/auth/admin.directory.group",
  6435. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  6436. // ]
  6437. // }
  6438. }
  6439. // method id "directory.groups.insert":
  6440. type GroupsInsertCall struct {
  6441. s *Service
  6442. group *Group
  6443. urlParams_ gensupport.URLParams
  6444. ctx_ context.Context
  6445. header_ http.Header
  6446. }
  6447. // Insert: Create Group
  6448. func (r *GroupsService) Insert(group *Group) *GroupsInsertCall {
  6449. c := &GroupsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6450. c.group = group
  6451. return c
  6452. }
  6453. // Fields allows partial responses to be retrieved. See
  6454. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6455. // for more information.
  6456. func (c *GroupsInsertCall) Fields(s ...googleapi.Field) *GroupsInsertCall {
  6457. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6458. return c
  6459. }
  6460. // Context sets the context to be used in this call's Do method. Any
  6461. // pending HTTP request will be aborted if the provided context is
  6462. // canceled.
  6463. func (c *GroupsInsertCall) Context(ctx context.Context) *GroupsInsertCall {
  6464. c.ctx_ = ctx
  6465. return c
  6466. }
  6467. // Header returns an http.Header that can be modified by the caller to
  6468. // add HTTP headers to the request.
  6469. func (c *GroupsInsertCall) Header() http.Header {
  6470. if c.header_ == nil {
  6471. c.header_ = make(http.Header)
  6472. }
  6473. return c.header_
  6474. }
  6475. func (c *GroupsInsertCall) doRequest(alt string) (*http.Response, error) {
  6476. reqHeaders := make(http.Header)
  6477. for k, v := range c.header_ {
  6478. reqHeaders[k] = v
  6479. }
  6480. reqHeaders.Set("User-Agent", c.s.userAgent())
  6481. var body io.Reader = nil
  6482. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  6483. if err != nil {
  6484. return nil, err
  6485. }
  6486. reqHeaders.Set("Content-Type", "application/json")
  6487. c.urlParams_.Set("alt", alt)
  6488. urls := googleapi.ResolveRelative(c.s.BasePath, "groups")
  6489. urls += "?" + c.urlParams_.Encode()
  6490. req, _ := http.NewRequest("POST", urls, body)
  6491. req.Header = reqHeaders
  6492. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6493. }
  6494. // Do executes the "directory.groups.insert" call.
  6495. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  6496. // code is an error. Response headers are in either
  6497. // *Group.ServerResponse.Header or (if a response was returned at all)
  6498. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6499. // check whether the returned error was because http.StatusNotModified
  6500. // was returned.
  6501. func (c *GroupsInsertCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  6502. gensupport.SetOptions(c.urlParams_, opts...)
  6503. res, err := c.doRequest("json")
  6504. if res != nil && res.StatusCode == http.StatusNotModified {
  6505. if res.Body != nil {
  6506. res.Body.Close()
  6507. }
  6508. return nil, &googleapi.Error{
  6509. Code: res.StatusCode,
  6510. Header: res.Header,
  6511. }
  6512. }
  6513. if err != nil {
  6514. return nil, err
  6515. }
  6516. defer googleapi.CloseBody(res)
  6517. if err := googleapi.CheckResponse(res); err != nil {
  6518. return nil, err
  6519. }
  6520. ret := &Group{
  6521. ServerResponse: googleapi.ServerResponse{
  6522. Header: res.Header,
  6523. HTTPStatusCode: res.StatusCode,
  6524. },
  6525. }
  6526. target := &ret
  6527. if err := gensupport.DecodeResponse(target, res); err != nil {
  6528. return nil, err
  6529. }
  6530. return ret, nil
  6531. // {
  6532. // "description": "Create Group",
  6533. // "httpMethod": "POST",
  6534. // "id": "directory.groups.insert",
  6535. // "path": "groups",
  6536. // "request": {
  6537. // "$ref": "Group"
  6538. // },
  6539. // "response": {
  6540. // "$ref": "Group"
  6541. // },
  6542. // "scopes": [
  6543. // "https://www.googleapis.com/auth/admin.directory.group"
  6544. // ]
  6545. // }
  6546. }
  6547. // method id "directory.groups.list":
  6548. type GroupsListCall struct {
  6549. s *Service
  6550. urlParams_ gensupport.URLParams
  6551. ifNoneMatch_ string
  6552. ctx_ context.Context
  6553. header_ http.Header
  6554. }
  6555. // List: Retrieve all groups of a domain or of a user given a userKey
  6556. // (paginated)
  6557. func (r *GroupsService) List() *GroupsListCall {
  6558. c := &GroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6559. return c
  6560. }
  6561. // Customer sets the optional parameter "customer": Immutable ID of the
  6562. // G Suite account. In case of multi-domain, to fetch all groups for a
  6563. // customer, fill this field instead of domain.
  6564. func (c *GroupsListCall) Customer(customer string) *GroupsListCall {
  6565. c.urlParams_.Set("customer", customer)
  6566. return c
  6567. }
  6568. // Domain sets the optional parameter "domain": Name of the domain. Fill
  6569. // this field to get groups from only this domain. To return all groups
  6570. // in a multi-domain fill customer field instead.
  6571. func (c *GroupsListCall) Domain(domain string) *GroupsListCall {
  6572. c.urlParams_.Set("domain", domain)
  6573. return c
  6574. }
  6575. // MaxResults sets the optional parameter "maxResults": Maximum number
  6576. // of results to return. Default is 200
  6577. func (c *GroupsListCall) MaxResults(maxResults int64) *GroupsListCall {
  6578. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6579. return c
  6580. }
  6581. // OrderBy sets the optional parameter "orderBy": Column to use for
  6582. // sorting results
  6583. //
  6584. // Possible values:
  6585. // "email" - Email of the group.
  6586. func (c *GroupsListCall) OrderBy(orderBy string) *GroupsListCall {
  6587. c.urlParams_.Set("orderBy", orderBy)
  6588. return c
  6589. }
  6590. // PageToken sets the optional parameter "pageToken": Token to specify
  6591. // next page in the list
  6592. func (c *GroupsListCall) PageToken(pageToken string) *GroupsListCall {
  6593. c.urlParams_.Set("pageToken", pageToken)
  6594. return c
  6595. }
  6596. // Query sets the optional parameter "query": Query string search.
  6597. // Should be of the form "". Complete documentation is at
  6598. // https://developers.google.com/admin-sdk/directory/v1/guides/search-groups
  6599. func (c *GroupsListCall) Query(query string) *GroupsListCall {
  6600. c.urlParams_.Set("query", query)
  6601. return c
  6602. }
  6603. // SortOrder sets the optional parameter "sortOrder": Whether to return
  6604. // results in ascending or descending order. Only of use when orderBy is
  6605. // also used
  6606. //
  6607. // Possible values:
  6608. // "ASCENDING" - Ascending order.
  6609. // "DESCENDING" - Descending order.
  6610. func (c *GroupsListCall) SortOrder(sortOrder string) *GroupsListCall {
  6611. c.urlParams_.Set("sortOrder", sortOrder)
  6612. return c
  6613. }
  6614. // UserKey sets the optional parameter "userKey": Email or immutable Id
  6615. // of the user if only those groups are to be listed, the given user is
  6616. // a member of. If Id, it should match with id of user object
  6617. func (c *GroupsListCall) UserKey(userKey string) *GroupsListCall {
  6618. c.urlParams_.Set("userKey", userKey)
  6619. return c
  6620. }
  6621. // Fields allows partial responses to be retrieved. See
  6622. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6623. // for more information.
  6624. func (c *GroupsListCall) Fields(s ...googleapi.Field) *GroupsListCall {
  6625. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6626. return c
  6627. }
  6628. // IfNoneMatch sets the optional parameter which makes the operation
  6629. // fail if the object's ETag matches the given value. This is useful for
  6630. // getting updates only after the object has changed since the last
  6631. // request. Use googleapi.IsNotModified to check whether the response
  6632. // error from Do is the result of In-None-Match.
  6633. func (c *GroupsListCall) IfNoneMatch(entityTag string) *GroupsListCall {
  6634. c.ifNoneMatch_ = entityTag
  6635. return c
  6636. }
  6637. // Context sets the context to be used in this call's Do method. Any
  6638. // pending HTTP request will be aborted if the provided context is
  6639. // canceled.
  6640. func (c *GroupsListCall) Context(ctx context.Context) *GroupsListCall {
  6641. c.ctx_ = ctx
  6642. return c
  6643. }
  6644. // Header returns an http.Header that can be modified by the caller to
  6645. // add HTTP headers to the request.
  6646. func (c *GroupsListCall) Header() http.Header {
  6647. if c.header_ == nil {
  6648. c.header_ = make(http.Header)
  6649. }
  6650. return c.header_
  6651. }
  6652. func (c *GroupsListCall) doRequest(alt string) (*http.Response, error) {
  6653. reqHeaders := make(http.Header)
  6654. for k, v := range c.header_ {
  6655. reqHeaders[k] = v
  6656. }
  6657. reqHeaders.Set("User-Agent", c.s.userAgent())
  6658. if c.ifNoneMatch_ != "" {
  6659. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6660. }
  6661. var body io.Reader = nil
  6662. c.urlParams_.Set("alt", alt)
  6663. urls := googleapi.ResolveRelative(c.s.BasePath, "groups")
  6664. urls += "?" + c.urlParams_.Encode()
  6665. req, _ := http.NewRequest("GET", urls, body)
  6666. req.Header = reqHeaders
  6667. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6668. }
  6669. // Do executes the "directory.groups.list" call.
  6670. // Exactly one of *Groups or error will be non-nil. Any non-2xx status
  6671. // code is an error. Response headers are in either
  6672. // *Groups.ServerResponse.Header or (if a response was returned at all)
  6673. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6674. // check whether the returned error was because http.StatusNotModified
  6675. // was returned.
  6676. func (c *GroupsListCall) Do(opts ...googleapi.CallOption) (*Groups, error) {
  6677. gensupport.SetOptions(c.urlParams_, opts...)
  6678. res, err := c.doRequest("json")
  6679. if res != nil && res.StatusCode == http.StatusNotModified {
  6680. if res.Body != nil {
  6681. res.Body.Close()
  6682. }
  6683. return nil, &googleapi.Error{
  6684. Code: res.StatusCode,
  6685. Header: res.Header,
  6686. }
  6687. }
  6688. if err != nil {
  6689. return nil, err
  6690. }
  6691. defer googleapi.CloseBody(res)
  6692. if err := googleapi.CheckResponse(res); err != nil {
  6693. return nil, err
  6694. }
  6695. ret := &Groups{
  6696. ServerResponse: googleapi.ServerResponse{
  6697. Header: res.Header,
  6698. HTTPStatusCode: res.StatusCode,
  6699. },
  6700. }
  6701. target := &ret
  6702. if err := gensupport.DecodeResponse(target, res); err != nil {
  6703. return nil, err
  6704. }
  6705. return ret, nil
  6706. // {
  6707. // "description": "Retrieve all groups of a domain or of a user given a userKey (paginated)",
  6708. // "httpMethod": "GET",
  6709. // "id": "directory.groups.list",
  6710. // "parameters": {
  6711. // "customer": {
  6712. // "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.",
  6713. // "location": "query",
  6714. // "type": "string"
  6715. // },
  6716. // "domain": {
  6717. // "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.",
  6718. // "location": "query",
  6719. // "type": "string"
  6720. // },
  6721. // "maxResults": {
  6722. // "description": "Maximum number of results to return. Default is 200",
  6723. // "format": "int32",
  6724. // "location": "query",
  6725. // "minimum": "1",
  6726. // "type": "integer"
  6727. // },
  6728. // "orderBy": {
  6729. // "description": "Column to use for sorting results",
  6730. // "enum": [
  6731. // "email"
  6732. // ],
  6733. // "enumDescriptions": [
  6734. // "Email of the group."
  6735. // ],
  6736. // "location": "query",
  6737. // "type": "string"
  6738. // },
  6739. // "pageToken": {
  6740. // "description": "Token to specify next page in the list",
  6741. // "location": "query",
  6742. // "type": "string"
  6743. // },
  6744. // "query": {
  6745. // "description": "Query string search. Should be of the form \"\". Complete documentation is at https://developers.google.com/admin-sdk/directory/v1/guides/search-groups",
  6746. // "location": "query",
  6747. // "type": "string"
  6748. // },
  6749. // "sortOrder": {
  6750. // "description": "Whether to return results in ascending or descending order. Only of use when orderBy is also used",
  6751. // "enum": [
  6752. // "ASCENDING",
  6753. // "DESCENDING"
  6754. // ],
  6755. // "enumDescriptions": [
  6756. // "Ascending order.",
  6757. // "Descending order."
  6758. // ],
  6759. // "location": "query",
  6760. // "type": "string"
  6761. // },
  6762. // "userKey": {
  6763. // "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",
  6764. // "location": "query",
  6765. // "type": "string"
  6766. // }
  6767. // },
  6768. // "path": "groups",
  6769. // "response": {
  6770. // "$ref": "Groups"
  6771. // },
  6772. // "scopes": [
  6773. // "https://www.googleapis.com/auth/admin.directory.group",
  6774. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  6775. // ]
  6776. // }
  6777. }
  6778. // Pages invokes f for each page of results.
  6779. // A non-nil error returned from f will halt the iteration.
  6780. // The provided context supersedes any context provided to the Context method.
  6781. func (c *GroupsListCall) Pages(ctx context.Context, f func(*Groups) error) error {
  6782. c.ctx_ = ctx
  6783. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6784. for {
  6785. x, err := c.Do()
  6786. if err != nil {
  6787. return err
  6788. }
  6789. if err := f(x); err != nil {
  6790. return err
  6791. }
  6792. if x.NextPageToken == "" {
  6793. return nil
  6794. }
  6795. c.PageToken(x.NextPageToken)
  6796. }
  6797. }
  6798. // method id "directory.groups.patch":
  6799. type GroupsPatchCall struct {
  6800. s *Service
  6801. groupKey string
  6802. group *Group
  6803. urlParams_ gensupport.URLParams
  6804. ctx_ context.Context
  6805. header_ http.Header
  6806. }
  6807. // Patch: Update Group. This method supports patch semantics.
  6808. func (r *GroupsService) Patch(groupKey string, group *Group) *GroupsPatchCall {
  6809. c := &GroupsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6810. c.groupKey = groupKey
  6811. c.group = group
  6812. return c
  6813. }
  6814. // Fields allows partial responses to be retrieved. See
  6815. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6816. // for more information.
  6817. func (c *GroupsPatchCall) Fields(s ...googleapi.Field) *GroupsPatchCall {
  6818. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6819. return c
  6820. }
  6821. // Context sets the context to be used in this call's Do method. Any
  6822. // pending HTTP request will be aborted if the provided context is
  6823. // canceled.
  6824. func (c *GroupsPatchCall) Context(ctx context.Context) *GroupsPatchCall {
  6825. c.ctx_ = ctx
  6826. return c
  6827. }
  6828. // Header returns an http.Header that can be modified by the caller to
  6829. // add HTTP headers to the request.
  6830. func (c *GroupsPatchCall) Header() http.Header {
  6831. if c.header_ == nil {
  6832. c.header_ = make(http.Header)
  6833. }
  6834. return c.header_
  6835. }
  6836. func (c *GroupsPatchCall) doRequest(alt string) (*http.Response, error) {
  6837. reqHeaders := make(http.Header)
  6838. for k, v := range c.header_ {
  6839. reqHeaders[k] = v
  6840. }
  6841. reqHeaders.Set("User-Agent", c.s.userAgent())
  6842. var body io.Reader = nil
  6843. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  6844. if err != nil {
  6845. return nil, err
  6846. }
  6847. reqHeaders.Set("Content-Type", "application/json")
  6848. c.urlParams_.Set("alt", alt)
  6849. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  6850. urls += "?" + c.urlParams_.Encode()
  6851. req, _ := http.NewRequest("PATCH", urls, body)
  6852. req.Header = reqHeaders
  6853. googleapi.Expand(req.URL, map[string]string{
  6854. "groupKey": c.groupKey,
  6855. })
  6856. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6857. }
  6858. // Do executes the "directory.groups.patch" call.
  6859. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  6860. // code is an error. Response headers are in either
  6861. // *Group.ServerResponse.Header or (if a response was returned at all)
  6862. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6863. // check whether the returned error was because http.StatusNotModified
  6864. // was returned.
  6865. func (c *GroupsPatchCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  6866. gensupport.SetOptions(c.urlParams_, opts...)
  6867. res, err := c.doRequest("json")
  6868. if res != nil && res.StatusCode == http.StatusNotModified {
  6869. if res.Body != nil {
  6870. res.Body.Close()
  6871. }
  6872. return nil, &googleapi.Error{
  6873. Code: res.StatusCode,
  6874. Header: res.Header,
  6875. }
  6876. }
  6877. if err != nil {
  6878. return nil, err
  6879. }
  6880. defer googleapi.CloseBody(res)
  6881. if err := googleapi.CheckResponse(res); err != nil {
  6882. return nil, err
  6883. }
  6884. ret := &Group{
  6885. ServerResponse: googleapi.ServerResponse{
  6886. Header: res.Header,
  6887. HTTPStatusCode: res.StatusCode,
  6888. },
  6889. }
  6890. target := &ret
  6891. if err := gensupport.DecodeResponse(target, res); err != nil {
  6892. return nil, err
  6893. }
  6894. return ret, nil
  6895. // {
  6896. // "description": "Update Group. This method supports patch semantics.",
  6897. // "httpMethod": "PATCH",
  6898. // "id": "directory.groups.patch",
  6899. // "parameterOrder": [
  6900. // "groupKey"
  6901. // ],
  6902. // "parameters": {
  6903. // "groupKey": {
  6904. // "description": "Email or immutable ID of the group. If ID, it should match with id of group object",
  6905. // "location": "path",
  6906. // "required": true,
  6907. // "type": "string"
  6908. // }
  6909. // },
  6910. // "path": "groups/{groupKey}",
  6911. // "request": {
  6912. // "$ref": "Group"
  6913. // },
  6914. // "response": {
  6915. // "$ref": "Group"
  6916. // },
  6917. // "scopes": [
  6918. // "https://www.googleapis.com/auth/admin.directory.group"
  6919. // ]
  6920. // }
  6921. }
  6922. // method id "directory.groups.update":
  6923. type GroupsUpdateCall struct {
  6924. s *Service
  6925. groupKey string
  6926. group *Group
  6927. urlParams_ gensupport.URLParams
  6928. ctx_ context.Context
  6929. header_ http.Header
  6930. }
  6931. // Update: Update Group
  6932. func (r *GroupsService) Update(groupKey string, group *Group) *GroupsUpdateCall {
  6933. c := &GroupsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6934. c.groupKey = groupKey
  6935. c.group = group
  6936. return c
  6937. }
  6938. // Fields allows partial responses to be retrieved. See
  6939. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6940. // for more information.
  6941. func (c *GroupsUpdateCall) Fields(s ...googleapi.Field) *GroupsUpdateCall {
  6942. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6943. return c
  6944. }
  6945. // Context sets the context to be used in this call's Do method. Any
  6946. // pending HTTP request will be aborted if the provided context is
  6947. // canceled.
  6948. func (c *GroupsUpdateCall) Context(ctx context.Context) *GroupsUpdateCall {
  6949. c.ctx_ = ctx
  6950. return c
  6951. }
  6952. // Header returns an http.Header that can be modified by the caller to
  6953. // add HTTP headers to the request.
  6954. func (c *GroupsUpdateCall) Header() http.Header {
  6955. if c.header_ == nil {
  6956. c.header_ = make(http.Header)
  6957. }
  6958. return c.header_
  6959. }
  6960. func (c *GroupsUpdateCall) doRequest(alt string) (*http.Response, error) {
  6961. reqHeaders := make(http.Header)
  6962. for k, v := range c.header_ {
  6963. reqHeaders[k] = v
  6964. }
  6965. reqHeaders.Set("User-Agent", c.s.userAgent())
  6966. var body io.Reader = nil
  6967. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  6968. if err != nil {
  6969. return nil, err
  6970. }
  6971. reqHeaders.Set("Content-Type", "application/json")
  6972. c.urlParams_.Set("alt", alt)
  6973. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}")
  6974. urls += "?" + c.urlParams_.Encode()
  6975. req, _ := http.NewRequest("PUT", urls, body)
  6976. req.Header = reqHeaders
  6977. googleapi.Expand(req.URL, map[string]string{
  6978. "groupKey": c.groupKey,
  6979. })
  6980. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6981. }
  6982. // Do executes the "directory.groups.update" call.
  6983. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  6984. // code is an error. Response headers are in either
  6985. // *Group.ServerResponse.Header or (if a response was returned at all)
  6986. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6987. // check whether the returned error was because http.StatusNotModified
  6988. // was returned.
  6989. func (c *GroupsUpdateCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  6990. gensupport.SetOptions(c.urlParams_, opts...)
  6991. res, err := c.doRequest("json")
  6992. if res != nil && res.StatusCode == http.StatusNotModified {
  6993. if res.Body != nil {
  6994. res.Body.Close()
  6995. }
  6996. return nil, &googleapi.Error{
  6997. Code: res.StatusCode,
  6998. Header: res.Header,
  6999. }
  7000. }
  7001. if err != nil {
  7002. return nil, err
  7003. }
  7004. defer googleapi.CloseBody(res)
  7005. if err := googleapi.CheckResponse(res); err != nil {
  7006. return nil, err
  7007. }
  7008. ret := &Group{
  7009. ServerResponse: googleapi.ServerResponse{
  7010. Header: res.Header,
  7011. HTTPStatusCode: res.StatusCode,
  7012. },
  7013. }
  7014. target := &ret
  7015. if err := gensupport.DecodeResponse(target, res); err != nil {
  7016. return nil, err
  7017. }
  7018. return ret, nil
  7019. // {
  7020. // "description": "Update Group",
  7021. // "httpMethod": "PUT",
  7022. // "id": "directory.groups.update",
  7023. // "parameterOrder": [
  7024. // "groupKey"
  7025. // ],
  7026. // "parameters": {
  7027. // "groupKey": {
  7028. // "description": "Email or immutable ID of the group. If ID, it should match with id of group object",
  7029. // "location": "path",
  7030. // "required": true,
  7031. // "type": "string"
  7032. // }
  7033. // },
  7034. // "path": "groups/{groupKey}",
  7035. // "request": {
  7036. // "$ref": "Group"
  7037. // },
  7038. // "response": {
  7039. // "$ref": "Group"
  7040. // },
  7041. // "scopes": [
  7042. // "https://www.googleapis.com/auth/admin.directory.group"
  7043. // ]
  7044. // }
  7045. }
  7046. // method id "directory.groups.aliases.delete":
  7047. type GroupsAliasesDeleteCall struct {
  7048. s *Service
  7049. groupKey string
  7050. alias string
  7051. urlParams_ gensupport.URLParams
  7052. ctx_ context.Context
  7053. header_ http.Header
  7054. }
  7055. // Delete: Remove a alias for the group
  7056. func (r *GroupsAliasesService) Delete(groupKey string, alias string) *GroupsAliasesDeleteCall {
  7057. c := &GroupsAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7058. c.groupKey = groupKey
  7059. c.alias = alias
  7060. return c
  7061. }
  7062. // Fields allows partial responses to be retrieved. See
  7063. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7064. // for more information.
  7065. func (c *GroupsAliasesDeleteCall) Fields(s ...googleapi.Field) *GroupsAliasesDeleteCall {
  7066. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7067. return c
  7068. }
  7069. // Context sets the context to be used in this call's Do method. Any
  7070. // pending HTTP request will be aborted if the provided context is
  7071. // canceled.
  7072. func (c *GroupsAliasesDeleteCall) Context(ctx context.Context) *GroupsAliasesDeleteCall {
  7073. c.ctx_ = ctx
  7074. return c
  7075. }
  7076. // Header returns an http.Header that can be modified by the caller to
  7077. // add HTTP headers to the request.
  7078. func (c *GroupsAliasesDeleteCall) Header() http.Header {
  7079. if c.header_ == nil {
  7080. c.header_ = make(http.Header)
  7081. }
  7082. return c.header_
  7083. }
  7084. func (c *GroupsAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  7085. reqHeaders := make(http.Header)
  7086. for k, v := range c.header_ {
  7087. reqHeaders[k] = v
  7088. }
  7089. reqHeaders.Set("User-Agent", c.s.userAgent())
  7090. var body io.Reader = nil
  7091. c.urlParams_.Set("alt", alt)
  7092. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/aliases/{alias}")
  7093. urls += "?" + c.urlParams_.Encode()
  7094. req, _ := http.NewRequest("DELETE", urls, body)
  7095. req.Header = reqHeaders
  7096. googleapi.Expand(req.URL, map[string]string{
  7097. "groupKey": c.groupKey,
  7098. "alias": c.alias,
  7099. })
  7100. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7101. }
  7102. // Do executes the "directory.groups.aliases.delete" call.
  7103. func (c *GroupsAliasesDeleteCall) Do(opts ...googleapi.CallOption) error {
  7104. gensupport.SetOptions(c.urlParams_, opts...)
  7105. res, err := c.doRequest("json")
  7106. if err != nil {
  7107. return err
  7108. }
  7109. defer googleapi.CloseBody(res)
  7110. if err := googleapi.CheckResponse(res); err != nil {
  7111. return err
  7112. }
  7113. return nil
  7114. // {
  7115. // "description": "Remove a alias for the group",
  7116. // "httpMethod": "DELETE",
  7117. // "id": "directory.groups.aliases.delete",
  7118. // "parameterOrder": [
  7119. // "groupKey",
  7120. // "alias"
  7121. // ],
  7122. // "parameters": {
  7123. // "alias": {
  7124. // "description": "The alias to be removed",
  7125. // "location": "path",
  7126. // "required": true,
  7127. // "type": "string"
  7128. // },
  7129. // "groupKey": {
  7130. // "description": "Email or immutable ID of the group",
  7131. // "location": "path",
  7132. // "required": true,
  7133. // "type": "string"
  7134. // }
  7135. // },
  7136. // "path": "groups/{groupKey}/aliases/{alias}",
  7137. // "scopes": [
  7138. // "https://www.googleapis.com/auth/admin.directory.group"
  7139. // ]
  7140. // }
  7141. }
  7142. // method id "directory.groups.aliases.insert":
  7143. type GroupsAliasesInsertCall struct {
  7144. s *Service
  7145. groupKey string
  7146. alias *Alias
  7147. urlParams_ gensupport.URLParams
  7148. ctx_ context.Context
  7149. header_ http.Header
  7150. }
  7151. // Insert: Add a alias for the group
  7152. func (r *GroupsAliasesService) Insert(groupKey string, alias *Alias) *GroupsAliasesInsertCall {
  7153. c := &GroupsAliasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7154. c.groupKey = groupKey
  7155. c.alias = alias
  7156. return c
  7157. }
  7158. // Fields allows partial responses to be retrieved. See
  7159. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7160. // for more information.
  7161. func (c *GroupsAliasesInsertCall) Fields(s ...googleapi.Field) *GroupsAliasesInsertCall {
  7162. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7163. return c
  7164. }
  7165. // Context sets the context to be used in this call's Do method. Any
  7166. // pending HTTP request will be aborted if the provided context is
  7167. // canceled.
  7168. func (c *GroupsAliasesInsertCall) Context(ctx context.Context) *GroupsAliasesInsertCall {
  7169. c.ctx_ = ctx
  7170. return c
  7171. }
  7172. // Header returns an http.Header that can be modified by the caller to
  7173. // add HTTP headers to the request.
  7174. func (c *GroupsAliasesInsertCall) Header() http.Header {
  7175. if c.header_ == nil {
  7176. c.header_ = make(http.Header)
  7177. }
  7178. return c.header_
  7179. }
  7180. func (c *GroupsAliasesInsertCall) doRequest(alt string) (*http.Response, error) {
  7181. reqHeaders := make(http.Header)
  7182. for k, v := range c.header_ {
  7183. reqHeaders[k] = v
  7184. }
  7185. reqHeaders.Set("User-Agent", c.s.userAgent())
  7186. var body io.Reader = nil
  7187. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alias)
  7188. if err != nil {
  7189. return nil, err
  7190. }
  7191. reqHeaders.Set("Content-Type", "application/json")
  7192. c.urlParams_.Set("alt", alt)
  7193. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/aliases")
  7194. urls += "?" + c.urlParams_.Encode()
  7195. req, _ := http.NewRequest("POST", urls, body)
  7196. req.Header = reqHeaders
  7197. googleapi.Expand(req.URL, map[string]string{
  7198. "groupKey": c.groupKey,
  7199. })
  7200. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7201. }
  7202. // Do executes the "directory.groups.aliases.insert" call.
  7203. // Exactly one of *Alias or error will be non-nil. Any non-2xx status
  7204. // code is an error. Response headers are in either
  7205. // *Alias.ServerResponse.Header or (if a response was returned at all)
  7206. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7207. // check whether the returned error was because http.StatusNotModified
  7208. // was returned.
  7209. func (c *GroupsAliasesInsertCall) Do(opts ...googleapi.CallOption) (*Alias, error) {
  7210. gensupport.SetOptions(c.urlParams_, opts...)
  7211. res, err := c.doRequest("json")
  7212. if res != nil && res.StatusCode == http.StatusNotModified {
  7213. if res.Body != nil {
  7214. res.Body.Close()
  7215. }
  7216. return nil, &googleapi.Error{
  7217. Code: res.StatusCode,
  7218. Header: res.Header,
  7219. }
  7220. }
  7221. if err != nil {
  7222. return nil, err
  7223. }
  7224. defer googleapi.CloseBody(res)
  7225. if err := googleapi.CheckResponse(res); err != nil {
  7226. return nil, err
  7227. }
  7228. ret := &Alias{
  7229. ServerResponse: googleapi.ServerResponse{
  7230. Header: res.Header,
  7231. HTTPStatusCode: res.StatusCode,
  7232. },
  7233. }
  7234. target := &ret
  7235. if err := gensupport.DecodeResponse(target, res); err != nil {
  7236. return nil, err
  7237. }
  7238. return ret, nil
  7239. // {
  7240. // "description": "Add a alias for the group",
  7241. // "httpMethod": "POST",
  7242. // "id": "directory.groups.aliases.insert",
  7243. // "parameterOrder": [
  7244. // "groupKey"
  7245. // ],
  7246. // "parameters": {
  7247. // "groupKey": {
  7248. // "description": "Email or immutable ID of the group",
  7249. // "location": "path",
  7250. // "required": true,
  7251. // "type": "string"
  7252. // }
  7253. // },
  7254. // "path": "groups/{groupKey}/aliases",
  7255. // "request": {
  7256. // "$ref": "Alias"
  7257. // },
  7258. // "response": {
  7259. // "$ref": "Alias"
  7260. // },
  7261. // "scopes": [
  7262. // "https://www.googleapis.com/auth/admin.directory.group"
  7263. // ]
  7264. // }
  7265. }
  7266. // method id "directory.groups.aliases.list":
  7267. type GroupsAliasesListCall struct {
  7268. s *Service
  7269. groupKey string
  7270. urlParams_ gensupport.URLParams
  7271. ifNoneMatch_ string
  7272. ctx_ context.Context
  7273. header_ http.Header
  7274. }
  7275. // List: List all aliases for a group
  7276. func (r *GroupsAliasesService) List(groupKey string) *GroupsAliasesListCall {
  7277. c := &GroupsAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7278. c.groupKey = groupKey
  7279. return c
  7280. }
  7281. // Fields allows partial responses to be retrieved. See
  7282. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7283. // for more information.
  7284. func (c *GroupsAliasesListCall) Fields(s ...googleapi.Field) *GroupsAliasesListCall {
  7285. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7286. return c
  7287. }
  7288. // IfNoneMatch sets the optional parameter which makes the operation
  7289. // fail if the object's ETag matches the given value. This is useful for
  7290. // getting updates only after the object has changed since the last
  7291. // request. Use googleapi.IsNotModified to check whether the response
  7292. // error from Do is the result of In-None-Match.
  7293. func (c *GroupsAliasesListCall) IfNoneMatch(entityTag string) *GroupsAliasesListCall {
  7294. c.ifNoneMatch_ = entityTag
  7295. return c
  7296. }
  7297. // Context sets the context to be used in this call's Do method. Any
  7298. // pending HTTP request will be aborted if the provided context is
  7299. // canceled.
  7300. func (c *GroupsAliasesListCall) Context(ctx context.Context) *GroupsAliasesListCall {
  7301. c.ctx_ = ctx
  7302. return c
  7303. }
  7304. // Header returns an http.Header that can be modified by the caller to
  7305. // add HTTP headers to the request.
  7306. func (c *GroupsAliasesListCall) Header() http.Header {
  7307. if c.header_ == nil {
  7308. c.header_ = make(http.Header)
  7309. }
  7310. return c.header_
  7311. }
  7312. func (c *GroupsAliasesListCall) doRequest(alt string) (*http.Response, error) {
  7313. reqHeaders := make(http.Header)
  7314. for k, v := range c.header_ {
  7315. reqHeaders[k] = v
  7316. }
  7317. reqHeaders.Set("User-Agent", c.s.userAgent())
  7318. if c.ifNoneMatch_ != "" {
  7319. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7320. }
  7321. var body io.Reader = nil
  7322. c.urlParams_.Set("alt", alt)
  7323. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/aliases")
  7324. urls += "?" + c.urlParams_.Encode()
  7325. req, _ := http.NewRequest("GET", urls, body)
  7326. req.Header = reqHeaders
  7327. googleapi.Expand(req.URL, map[string]string{
  7328. "groupKey": c.groupKey,
  7329. })
  7330. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7331. }
  7332. // Do executes the "directory.groups.aliases.list" call.
  7333. // Exactly one of *Aliases or error will be non-nil. Any non-2xx status
  7334. // code is an error. Response headers are in either
  7335. // *Aliases.ServerResponse.Header or (if a response was returned at all)
  7336. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7337. // check whether the returned error was because http.StatusNotModified
  7338. // was returned.
  7339. func (c *GroupsAliasesListCall) Do(opts ...googleapi.CallOption) (*Aliases, error) {
  7340. gensupport.SetOptions(c.urlParams_, opts...)
  7341. res, err := c.doRequest("json")
  7342. if res != nil && res.StatusCode == http.StatusNotModified {
  7343. if res.Body != nil {
  7344. res.Body.Close()
  7345. }
  7346. return nil, &googleapi.Error{
  7347. Code: res.StatusCode,
  7348. Header: res.Header,
  7349. }
  7350. }
  7351. if err != nil {
  7352. return nil, err
  7353. }
  7354. defer googleapi.CloseBody(res)
  7355. if err := googleapi.CheckResponse(res); err != nil {
  7356. return nil, err
  7357. }
  7358. ret := &Aliases{
  7359. ServerResponse: googleapi.ServerResponse{
  7360. Header: res.Header,
  7361. HTTPStatusCode: res.StatusCode,
  7362. },
  7363. }
  7364. target := &ret
  7365. if err := gensupport.DecodeResponse(target, res); err != nil {
  7366. return nil, err
  7367. }
  7368. return ret, nil
  7369. // {
  7370. // "description": "List all aliases for a group",
  7371. // "httpMethod": "GET",
  7372. // "id": "directory.groups.aliases.list",
  7373. // "parameterOrder": [
  7374. // "groupKey"
  7375. // ],
  7376. // "parameters": {
  7377. // "groupKey": {
  7378. // "description": "Email or immutable ID of the group",
  7379. // "location": "path",
  7380. // "required": true,
  7381. // "type": "string"
  7382. // }
  7383. // },
  7384. // "path": "groups/{groupKey}/aliases",
  7385. // "response": {
  7386. // "$ref": "Aliases"
  7387. // },
  7388. // "scopes": [
  7389. // "https://www.googleapis.com/auth/admin.directory.group",
  7390. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  7391. // ],
  7392. // "supportsSubscription": true
  7393. // }
  7394. }
  7395. // method id "directory.members.delete":
  7396. type MembersDeleteCall struct {
  7397. s *Service
  7398. groupKey string
  7399. memberKey string
  7400. urlParams_ gensupport.URLParams
  7401. ctx_ context.Context
  7402. header_ http.Header
  7403. }
  7404. // Delete: Remove membership.
  7405. func (r *MembersService) Delete(groupKey string, memberKey string) *MembersDeleteCall {
  7406. c := &MembersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7407. c.groupKey = groupKey
  7408. c.memberKey = memberKey
  7409. return c
  7410. }
  7411. // Fields allows partial responses to be retrieved. See
  7412. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7413. // for more information.
  7414. func (c *MembersDeleteCall) Fields(s ...googleapi.Field) *MembersDeleteCall {
  7415. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7416. return c
  7417. }
  7418. // Context sets the context to be used in this call's Do method. Any
  7419. // pending HTTP request will be aborted if the provided context is
  7420. // canceled.
  7421. func (c *MembersDeleteCall) Context(ctx context.Context) *MembersDeleteCall {
  7422. c.ctx_ = ctx
  7423. return c
  7424. }
  7425. // Header returns an http.Header that can be modified by the caller to
  7426. // add HTTP headers to the request.
  7427. func (c *MembersDeleteCall) Header() http.Header {
  7428. if c.header_ == nil {
  7429. c.header_ = make(http.Header)
  7430. }
  7431. return c.header_
  7432. }
  7433. func (c *MembersDeleteCall) doRequest(alt string) (*http.Response, error) {
  7434. reqHeaders := make(http.Header)
  7435. for k, v := range c.header_ {
  7436. reqHeaders[k] = v
  7437. }
  7438. reqHeaders.Set("User-Agent", c.s.userAgent())
  7439. var body io.Reader = nil
  7440. c.urlParams_.Set("alt", alt)
  7441. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  7442. urls += "?" + c.urlParams_.Encode()
  7443. req, _ := http.NewRequest("DELETE", urls, body)
  7444. req.Header = reqHeaders
  7445. googleapi.Expand(req.URL, map[string]string{
  7446. "groupKey": c.groupKey,
  7447. "memberKey": c.memberKey,
  7448. })
  7449. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7450. }
  7451. // Do executes the "directory.members.delete" call.
  7452. func (c *MembersDeleteCall) Do(opts ...googleapi.CallOption) error {
  7453. gensupport.SetOptions(c.urlParams_, opts...)
  7454. res, err := c.doRequest("json")
  7455. if err != nil {
  7456. return err
  7457. }
  7458. defer googleapi.CloseBody(res)
  7459. if err := googleapi.CheckResponse(res); err != nil {
  7460. return err
  7461. }
  7462. return nil
  7463. // {
  7464. // "description": "Remove membership.",
  7465. // "httpMethod": "DELETE",
  7466. // "id": "directory.members.delete",
  7467. // "parameterOrder": [
  7468. // "groupKey",
  7469. // "memberKey"
  7470. // ],
  7471. // "parameters": {
  7472. // "groupKey": {
  7473. // "description": "Email or immutable ID of the group",
  7474. // "location": "path",
  7475. // "required": true,
  7476. // "type": "string"
  7477. // },
  7478. // "memberKey": {
  7479. // "description": "Email or immutable ID of the member",
  7480. // "location": "path",
  7481. // "required": true,
  7482. // "type": "string"
  7483. // }
  7484. // },
  7485. // "path": "groups/{groupKey}/members/{memberKey}",
  7486. // "scopes": [
  7487. // "https://www.googleapis.com/auth/admin.directory.group",
  7488. // "https://www.googleapis.com/auth/admin.directory.group.member"
  7489. // ]
  7490. // }
  7491. }
  7492. // method id "directory.members.get":
  7493. type MembersGetCall struct {
  7494. s *Service
  7495. groupKey string
  7496. memberKey string
  7497. urlParams_ gensupport.URLParams
  7498. ifNoneMatch_ string
  7499. ctx_ context.Context
  7500. header_ http.Header
  7501. }
  7502. // Get: Retrieve Group Member
  7503. func (r *MembersService) Get(groupKey string, memberKey string) *MembersGetCall {
  7504. c := &MembersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7505. c.groupKey = groupKey
  7506. c.memberKey = memberKey
  7507. return c
  7508. }
  7509. // Fields allows partial responses to be retrieved. See
  7510. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7511. // for more information.
  7512. func (c *MembersGetCall) Fields(s ...googleapi.Field) *MembersGetCall {
  7513. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7514. return c
  7515. }
  7516. // IfNoneMatch sets the optional parameter which makes the operation
  7517. // fail if the object's ETag matches the given value. This is useful for
  7518. // getting updates only after the object has changed since the last
  7519. // request. Use googleapi.IsNotModified to check whether the response
  7520. // error from Do is the result of In-None-Match.
  7521. func (c *MembersGetCall) IfNoneMatch(entityTag string) *MembersGetCall {
  7522. c.ifNoneMatch_ = entityTag
  7523. return c
  7524. }
  7525. // Context sets the context to be used in this call's Do method. Any
  7526. // pending HTTP request will be aborted if the provided context is
  7527. // canceled.
  7528. func (c *MembersGetCall) Context(ctx context.Context) *MembersGetCall {
  7529. c.ctx_ = ctx
  7530. return c
  7531. }
  7532. // Header returns an http.Header that can be modified by the caller to
  7533. // add HTTP headers to the request.
  7534. func (c *MembersGetCall) Header() http.Header {
  7535. if c.header_ == nil {
  7536. c.header_ = make(http.Header)
  7537. }
  7538. return c.header_
  7539. }
  7540. func (c *MembersGetCall) doRequest(alt string) (*http.Response, error) {
  7541. reqHeaders := make(http.Header)
  7542. for k, v := range c.header_ {
  7543. reqHeaders[k] = v
  7544. }
  7545. reqHeaders.Set("User-Agent", c.s.userAgent())
  7546. if c.ifNoneMatch_ != "" {
  7547. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7548. }
  7549. var body io.Reader = nil
  7550. c.urlParams_.Set("alt", alt)
  7551. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  7552. urls += "?" + c.urlParams_.Encode()
  7553. req, _ := http.NewRequest("GET", urls, body)
  7554. req.Header = reqHeaders
  7555. googleapi.Expand(req.URL, map[string]string{
  7556. "groupKey": c.groupKey,
  7557. "memberKey": c.memberKey,
  7558. })
  7559. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7560. }
  7561. // Do executes the "directory.members.get" call.
  7562. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  7563. // code is an error. Response headers are in either
  7564. // *Member.ServerResponse.Header or (if a response was returned at all)
  7565. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7566. // check whether the returned error was because http.StatusNotModified
  7567. // was returned.
  7568. func (c *MembersGetCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  7569. gensupport.SetOptions(c.urlParams_, opts...)
  7570. res, err := c.doRequest("json")
  7571. if res != nil && res.StatusCode == http.StatusNotModified {
  7572. if res.Body != nil {
  7573. res.Body.Close()
  7574. }
  7575. return nil, &googleapi.Error{
  7576. Code: res.StatusCode,
  7577. Header: res.Header,
  7578. }
  7579. }
  7580. if err != nil {
  7581. return nil, err
  7582. }
  7583. defer googleapi.CloseBody(res)
  7584. if err := googleapi.CheckResponse(res); err != nil {
  7585. return nil, err
  7586. }
  7587. ret := &Member{
  7588. ServerResponse: googleapi.ServerResponse{
  7589. Header: res.Header,
  7590. HTTPStatusCode: res.StatusCode,
  7591. },
  7592. }
  7593. target := &ret
  7594. if err := gensupport.DecodeResponse(target, res); err != nil {
  7595. return nil, err
  7596. }
  7597. return ret, nil
  7598. // {
  7599. // "description": "Retrieve Group Member",
  7600. // "httpMethod": "GET",
  7601. // "id": "directory.members.get",
  7602. // "parameterOrder": [
  7603. // "groupKey",
  7604. // "memberKey"
  7605. // ],
  7606. // "parameters": {
  7607. // "groupKey": {
  7608. // "description": "Email or immutable ID of the group",
  7609. // "location": "path",
  7610. // "required": true,
  7611. // "type": "string"
  7612. // },
  7613. // "memberKey": {
  7614. // "description": "Email or immutable ID of the member",
  7615. // "location": "path",
  7616. // "required": true,
  7617. // "type": "string"
  7618. // }
  7619. // },
  7620. // "path": "groups/{groupKey}/members/{memberKey}",
  7621. // "response": {
  7622. // "$ref": "Member"
  7623. // },
  7624. // "scopes": [
  7625. // "https://www.googleapis.com/auth/admin.directory.group",
  7626. // "https://www.googleapis.com/auth/admin.directory.group.member",
  7627. // "https://www.googleapis.com/auth/admin.directory.group.member.readonly",
  7628. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  7629. // ]
  7630. // }
  7631. }
  7632. // method id "directory.members.hasMember":
  7633. type MembersHasMemberCall struct {
  7634. s *Service
  7635. groupKey string
  7636. memberKey string
  7637. urlParams_ gensupport.URLParams
  7638. ifNoneMatch_ string
  7639. ctx_ context.Context
  7640. header_ http.Header
  7641. }
  7642. // HasMember: Checks whether the given user is a member of the group.
  7643. // Membership can be direct or nested.
  7644. func (r *MembersService) HasMember(groupKey string, memberKey string) *MembersHasMemberCall {
  7645. c := &MembersHasMemberCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7646. c.groupKey = groupKey
  7647. c.memberKey = memberKey
  7648. return c
  7649. }
  7650. // Fields allows partial responses to be retrieved. See
  7651. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7652. // for more information.
  7653. func (c *MembersHasMemberCall) Fields(s ...googleapi.Field) *MembersHasMemberCall {
  7654. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7655. return c
  7656. }
  7657. // IfNoneMatch sets the optional parameter which makes the operation
  7658. // fail if the object's ETag matches the given value. This is useful for
  7659. // getting updates only after the object has changed since the last
  7660. // request. Use googleapi.IsNotModified to check whether the response
  7661. // error from Do is the result of In-None-Match.
  7662. func (c *MembersHasMemberCall) IfNoneMatch(entityTag string) *MembersHasMemberCall {
  7663. c.ifNoneMatch_ = entityTag
  7664. return c
  7665. }
  7666. // Context sets the context to be used in this call's Do method. Any
  7667. // pending HTTP request will be aborted if the provided context is
  7668. // canceled.
  7669. func (c *MembersHasMemberCall) Context(ctx context.Context) *MembersHasMemberCall {
  7670. c.ctx_ = ctx
  7671. return c
  7672. }
  7673. // Header returns an http.Header that can be modified by the caller to
  7674. // add HTTP headers to the request.
  7675. func (c *MembersHasMemberCall) Header() http.Header {
  7676. if c.header_ == nil {
  7677. c.header_ = make(http.Header)
  7678. }
  7679. return c.header_
  7680. }
  7681. func (c *MembersHasMemberCall) doRequest(alt string) (*http.Response, error) {
  7682. reqHeaders := make(http.Header)
  7683. for k, v := range c.header_ {
  7684. reqHeaders[k] = v
  7685. }
  7686. reqHeaders.Set("User-Agent", c.s.userAgent())
  7687. if c.ifNoneMatch_ != "" {
  7688. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7689. }
  7690. var body io.Reader = nil
  7691. c.urlParams_.Set("alt", alt)
  7692. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/hasMember/{memberKey}")
  7693. urls += "?" + c.urlParams_.Encode()
  7694. req, _ := http.NewRequest("GET", urls, body)
  7695. req.Header = reqHeaders
  7696. googleapi.Expand(req.URL, map[string]string{
  7697. "groupKey": c.groupKey,
  7698. "memberKey": c.memberKey,
  7699. })
  7700. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7701. }
  7702. // Do executes the "directory.members.hasMember" call.
  7703. // Exactly one of *MembersHasMember or error will be non-nil. Any
  7704. // non-2xx status code is an error. Response headers are in either
  7705. // *MembersHasMember.ServerResponse.Header or (if a response was
  7706. // returned at all) in error.(*googleapi.Error).Header. Use
  7707. // googleapi.IsNotModified to check whether the returned error was
  7708. // because http.StatusNotModified was returned.
  7709. func (c *MembersHasMemberCall) Do(opts ...googleapi.CallOption) (*MembersHasMember, error) {
  7710. gensupport.SetOptions(c.urlParams_, opts...)
  7711. res, err := c.doRequest("json")
  7712. if res != nil && res.StatusCode == http.StatusNotModified {
  7713. if res.Body != nil {
  7714. res.Body.Close()
  7715. }
  7716. return nil, &googleapi.Error{
  7717. Code: res.StatusCode,
  7718. Header: res.Header,
  7719. }
  7720. }
  7721. if err != nil {
  7722. return nil, err
  7723. }
  7724. defer googleapi.CloseBody(res)
  7725. if err := googleapi.CheckResponse(res); err != nil {
  7726. return nil, err
  7727. }
  7728. ret := &MembersHasMember{
  7729. ServerResponse: googleapi.ServerResponse{
  7730. Header: res.Header,
  7731. HTTPStatusCode: res.StatusCode,
  7732. },
  7733. }
  7734. target := &ret
  7735. if err := gensupport.DecodeResponse(target, res); err != nil {
  7736. return nil, err
  7737. }
  7738. return ret, nil
  7739. // {
  7740. // "description": "Checks whether the given user is a member of the group. Membership can be direct or nested.",
  7741. // "httpMethod": "GET",
  7742. // "id": "directory.members.hasMember",
  7743. // "parameterOrder": [
  7744. // "groupKey",
  7745. // "memberKey"
  7746. // ],
  7747. // "parameters": {
  7748. // "groupKey": {
  7749. // "description": "Identifies the group in the API request. The value can be the group's email address, group alias, or the unique group ID.",
  7750. // "location": "path",
  7751. // "required": true,
  7752. // "type": "string"
  7753. // },
  7754. // "memberKey": {
  7755. // "description": "Identifies the user member in the API request. The value can be the user's primary email address, alias, or unique ID.",
  7756. // "location": "path",
  7757. // "required": true,
  7758. // "type": "string"
  7759. // }
  7760. // },
  7761. // "path": "groups/{groupKey}/hasMember/{memberKey}",
  7762. // "response": {
  7763. // "$ref": "MembersHasMember"
  7764. // },
  7765. // "scopes": [
  7766. // "https://www.googleapis.com/auth/admin.directory.group",
  7767. // "https://www.googleapis.com/auth/admin.directory.group.member",
  7768. // "https://www.googleapis.com/auth/admin.directory.group.member.readonly",
  7769. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  7770. // ]
  7771. // }
  7772. }
  7773. // method id "directory.members.insert":
  7774. type MembersInsertCall struct {
  7775. s *Service
  7776. groupKey string
  7777. member *Member
  7778. urlParams_ gensupport.URLParams
  7779. ctx_ context.Context
  7780. header_ http.Header
  7781. }
  7782. // Insert: Add user to the specified group.
  7783. func (r *MembersService) Insert(groupKey string, member *Member) *MembersInsertCall {
  7784. c := &MembersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7785. c.groupKey = groupKey
  7786. c.member = member
  7787. return c
  7788. }
  7789. // Fields allows partial responses to be retrieved. See
  7790. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7791. // for more information.
  7792. func (c *MembersInsertCall) Fields(s ...googleapi.Field) *MembersInsertCall {
  7793. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7794. return c
  7795. }
  7796. // Context sets the context to be used in this call's Do method. Any
  7797. // pending HTTP request will be aborted if the provided context is
  7798. // canceled.
  7799. func (c *MembersInsertCall) Context(ctx context.Context) *MembersInsertCall {
  7800. c.ctx_ = ctx
  7801. return c
  7802. }
  7803. // Header returns an http.Header that can be modified by the caller to
  7804. // add HTTP headers to the request.
  7805. func (c *MembersInsertCall) Header() http.Header {
  7806. if c.header_ == nil {
  7807. c.header_ = make(http.Header)
  7808. }
  7809. return c.header_
  7810. }
  7811. func (c *MembersInsertCall) doRequest(alt string) (*http.Response, error) {
  7812. reqHeaders := make(http.Header)
  7813. for k, v := range c.header_ {
  7814. reqHeaders[k] = v
  7815. }
  7816. reqHeaders.Set("User-Agent", c.s.userAgent())
  7817. var body io.Reader = nil
  7818. body, err := googleapi.WithoutDataWrapper.JSONReader(c.member)
  7819. if err != nil {
  7820. return nil, err
  7821. }
  7822. reqHeaders.Set("Content-Type", "application/json")
  7823. c.urlParams_.Set("alt", alt)
  7824. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members")
  7825. urls += "?" + c.urlParams_.Encode()
  7826. req, _ := http.NewRequest("POST", urls, body)
  7827. req.Header = reqHeaders
  7828. googleapi.Expand(req.URL, map[string]string{
  7829. "groupKey": c.groupKey,
  7830. })
  7831. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7832. }
  7833. // Do executes the "directory.members.insert" call.
  7834. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  7835. // code is an error. Response headers are in either
  7836. // *Member.ServerResponse.Header or (if a response was returned at all)
  7837. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7838. // check whether the returned error was because http.StatusNotModified
  7839. // was returned.
  7840. func (c *MembersInsertCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  7841. gensupport.SetOptions(c.urlParams_, opts...)
  7842. res, err := c.doRequest("json")
  7843. if res != nil && res.StatusCode == http.StatusNotModified {
  7844. if res.Body != nil {
  7845. res.Body.Close()
  7846. }
  7847. return nil, &googleapi.Error{
  7848. Code: res.StatusCode,
  7849. Header: res.Header,
  7850. }
  7851. }
  7852. if err != nil {
  7853. return nil, err
  7854. }
  7855. defer googleapi.CloseBody(res)
  7856. if err := googleapi.CheckResponse(res); err != nil {
  7857. return nil, err
  7858. }
  7859. ret := &Member{
  7860. ServerResponse: googleapi.ServerResponse{
  7861. Header: res.Header,
  7862. HTTPStatusCode: res.StatusCode,
  7863. },
  7864. }
  7865. target := &ret
  7866. if err := gensupport.DecodeResponse(target, res); err != nil {
  7867. return nil, err
  7868. }
  7869. return ret, nil
  7870. // {
  7871. // "description": "Add user to the specified group.",
  7872. // "httpMethod": "POST",
  7873. // "id": "directory.members.insert",
  7874. // "parameterOrder": [
  7875. // "groupKey"
  7876. // ],
  7877. // "parameters": {
  7878. // "groupKey": {
  7879. // "description": "Email or immutable ID of the group",
  7880. // "location": "path",
  7881. // "required": true,
  7882. // "type": "string"
  7883. // }
  7884. // },
  7885. // "path": "groups/{groupKey}/members",
  7886. // "request": {
  7887. // "$ref": "Member"
  7888. // },
  7889. // "response": {
  7890. // "$ref": "Member"
  7891. // },
  7892. // "scopes": [
  7893. // "https://www.googleapis.com/auth/admin.directory.group",
  7894. // "https://www.googleapis.com/auth/admin.directory.group.member"
  7895. // ]
  7896. // }
  7897. }
  7898. // method id "directory.members.list":
  7899. type MembersListCall struct {
  7900. s *Service
  7901. groupKey string
  7902. urlParams_ gensupport.URLParams
  7903. ifNoneMatch_ string
  7904. ctx_ context.Context
  7905. header_ http.Header
  7906. }
  7907. // List: Retrieve all members in a group (paginated)
  7908. func (r *MembersService) List(groupKey string) *MembersListCall {
  7909. c := &MembersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7910. c.groupKey = groupKey
  7911. return c
  7912. }
  7913. // IncludeDerivedMembership sets the optional parameter
  7914. // "includeDerivedMembership": Whether to list indirect memberships.
  7915. // Default: false.
  7916. func (c *MembersListCall) IncludeDerivedMembership(includeDerivedMembership bool) *MembersListCall {
  7917. c.urlParams_.Set("includeDerivedMembership", fmt.Sprint(includeDerivedMembership))
  7918. return c
  7919. }
  7920. // MaxResults sets the optional parameter "maxResults": Maximum number
  7921. // of results to return. Default is 200
  7922. func (c *MembersListCall) MaxResults(maxResults int64) *MembersListCall {
  7923. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  7924. return c
  7925. }
  7926. // PageToken sets the optional parameter "pageToken": Token to specify
  7927. // next page in the list
  7928. func (c *MembersListCall) PageToken(pageToken string) *MembersListCall {
  7929. c.urlParams_.Set("pageToken", pageToken)
  7930. return c
  7931. }
  7932. // Roles sets the optional parameter "roles": Comma separated role
  7933. // values to filter list results on.
  7934. func (c *MembersListCall) Roles(roles string) *MembersListCall {
  7935. c.urlParams_.Set("roles", roles)
  7936. return c
  7937. }
  7938. // Fields allows partial responses to be retrieved. See
  7939. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7940. // for more information.
  7941. func (c *MembersListCall) Fields(s ...googleapi.Field) *MembersListCall {
  7942. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7943. return c
  7944. }
  7945. // IfNoneMatch sets the optional parameter which makes the operation
  7946. // fail if the object's ETag matches the given value. This is useful for
  7947. // getting updates only after the object has changed since the last
  7948. // request. Use googleapi.IsNotModified to check whether the response
  7949. // error from Do is the result of In-None-Match.
  7950. func (c *MembersListCall) IfNoneMatch(entityTag string) *MembersListCall {
  7951. c.ifNoneMatch_ = entityTag
  7952. return c
  7953. }
  7954. // Context sets the context to be used in this call's Do method. Any
  7955. // pending HTTP request will be aborted if the provided context is
  7956. // canceled.
  7957. func (c *MembersListCall) Context(ctx context.Context) *MembersListCall {
  7958. c.ctx_ = ctx
  7959. return c
  7960. }
  7961. // Header returns an http.Header that can be modified by the caller to
  7962. // add HTTP headers to the request.
  7963. func (c *MembersListCall) Header() http.Header {
  7964. if c.header_ == nil {
  7965. c.header_ = make(http.Header)
  7966. }
  7967. return c.header_
  7968. }
  7969. func (c *MembersListCall) doRequest(alt string) (*http.Response, error) {
  7970. reqHeaders := make(http.Header)
  7971. for k, v := range c.header_ {
  7972. reqHeaders[k] = v
  7973. }
  7974. reqHeaders.Set("User-Agent", c.s.userAgent())
  7975. if c.ifNoneMatch_ != "" {
  7976. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7977. }
  7978. var body io.Reader = nil
  7979. c.urlParams_.Set("alt", alt)
  7980. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members")
  7981. urls += "?" + c.urlParams_.Encode()
  7982. req, _ := http.NewRequest("GET", urls, body)
  7983. req.Header = reqHeaders
  7984. googleapi.Expand(req.URL, map[string]string{
  7985. "groupKey": c.groupKey,
  7986. })
  7987. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7988. }
  7989. // Do executes the "directory.members.list" call.
  7990. // Exactly one of *Members or error will be non-nil. Any non-2xx status
  7991. // code is an error. Response headers are in either
  7992. // *Members.ServerResponse.Header or (if a response was returned at all)
  7993. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7994. // check whether the returned error was because http.StatusNotModified
  7995. // was returned.
  7996. func (c *MembersListCall) Do(opts ...googleapi.CallOption) (*Members, error) {
  7997. gensupport.SetOptions(c.urlParams_, opts...)
  7998. res, err := c.doRequest("json")
  7999. if res != nil && res.StatusCode == http.StatusNotModified {
  8000. if res.Body != nil {
  8001. res.Body.Close()
  8002. }
  8003. return nil, &googleapi.Error{
  8004. Code: res.StatusCode,
  8005. Header: res.Header,
  8006. }
  8007. }
  8008. if err != nil {
  8009. return nil, err
  8010. }
  8011. defer googleapi.CloseBody(res)
  8012. if err := googleapi.CheckResponse(res); err != nil {
  8013. return nil, err
  8014. }
  8015. ret := &Members{
  8016. ServerResponse: googleapi.ServerResponse{
  8017. Header: res.Header,
  8018. HTTPStatusCode: res.StatusCode,
  8019. },
  8020. }
  8021. target := &ret
  8022. if err := gensupport.DecodeResponse(target, res); err != nil {
  8023. return nil, err
  8024. }
  8025. return ret, nil
  8026. // {
  8027. // "description": "Retrieve all members in a group (paginated)",
  8028. // "httpMethod": "GET",
  8029. // "id": "directory.members.list",
  8030. // "parameterOrder": [
  8031. // "groupKey"
  8032. // ],
  8033. // "parameters": {
  8034. // "groupKey": {
  8035. // "description": "Email or immutable ID of the group",
  8036. // "location": "path",
  8037. // "required": true,
  8038. // "type": "string"
  8039. // },
  8040. // "includeDerivedMembership": {
  8041. // "description": "Whether to list indirect memberships. Default: false.",
  8042. // "location": "query",
  8043. // "type": "boolean"
  8044. // },
  8045. // "maxResults": {
  8046. // "description": "Maximum number of results to return. Default is 200",
  8047. // "format": "int32",
  8048. // "location": "query",
  8049. // "minimum": "1",
  8050. // "type": "integer"
  8051. // },
  8052. // "pageToken": {
  8053. // "description": "Token to specify next page in the list",
  8054. // "location": "query",
  8055. // "type": "string"
  8056. // },
  8057. // "roles": {
  8058. // "description": "Comma separated role values to filter list results on.",
  8059. // "location": "query",
  8060. // "type": "string"
  8061. // }
  8062. // },
  8063. // "path": "groups/{groupKey}/members",
  8064. // "response": {
  8065. // "$ref": "Members"
  8066. // },
  8067. // "scopes": [
  8068. // "https://www.googleapis.com/auth/admin.directory.group",
  8069. // "https://www.googleapis.com/auth/admin.directory.group.member",
  8070. // "https://www.googleapis.com/auth/admin.directory.group.member.readonly",
  8071. // "https://www.googleapis.com/auth/admin.directory.group.readonly"
  8072. // ]
  8073. // }
  8074. }
  8075. // Pages invokes f for each page of results.
  8076. // A non-nil error returned from f will halt the iteration.
  8077. // The provided context supersedes any context provided to the Context method.
  8078. func (c *MembersListCall) Pages(ctx context.Context, f func(*Members) error) error {
  8079. c.ctx_ = ctx
  8080. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8081. for {
  8082. x, err := c.Do()
  8083. if err != nil {
  8084. return err
  8085. }
  8086. if err := f(x); err != nil {
  8087. return err
  8088. }
  8089. if x.NextPageToken == "" {
  8090. return nil
  8091. }
  8092. c.PageToken(x.NextPageToken)
  8093. }
  8094. }
  8095. // method id "directory.members.patch":
  8096. type MembersPatchCall struct {
  8097. s *Service
  8098. groupKey string
  8099. memberKey string
  8100. member *Member
  8101. urlParams_ gensupport.URLParams
  8102. ctx_ context.Context
  8103. header_ http.Header
  8104. }
  8105. // Patch: Update membership of a user in the specified group. This
  8106. // method supports patch semantics.
  8107. func (r *MembersService) Patch(groupKey string, memberKey string, member *Member) *MembersPatchCall {
  8108. c := &MembersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8109. c.groupKey = groupKey
  8110. c.memberKey = memberKey
  8111. c.member = member
  8112. return c
  8113. }
  8114. // Fields allows partial responses to be retrieved. See
  8115. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8116. // for more information.
  8117. func (c *MembersPatchCall) Fields(s ...googleapi.Field) *MembersPatchCall {
  8118. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8119. return c
  8120. }
  8121. // Context sets the context to be used in this call's Do method. Any
  8122. // pending HTTP request will be aborted if the provided context is
  8123. // canceled.
  8124. func (c *MembersPatchCall) Context(ctx context.Context) *MembersPatchCall {
  8125. c.ctx_ = ctx
  8126. return c
  8127. }
  8128. // Header returns an http.Header that can be modified by the caller to
  8129. // add HTTP headers to the request.
  8130. func (c *MembersPatchCall) Header() http.Header {
  8131. if c.header_ == nil {
  8132. c.header_ = make(http.Header)
  8133. }
  8134. return c.header_
  8135. }
  8136. func (c *MembersPatchCall) doRequest(alt string) (*http.Response, error) {
  8137. reqHeaders := make(http.Header)
  8138. for k, v := range c.header_ {
  8139. reqHeaders[k] = v
  8140. }
  8141. reqHeaders.Set("User-Agent", c.s.userAgent())
  8142. var body io.Reader = nil
  8143. body, err := googleapi.WithoutDataWrapper.JSONReader(c.member)
  8144. if err != nil {
  8145. return nil, err
  8146. }
  8147. reqHeaders.Set("Content-Type", "application/json")
  8148. c.urlParams_.Set("alt", alt)
  8149. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  8150. urls += "?" + c.urlParams_.Encode()
  8151. req, _ := http.NewRequest("PATCH", urls, body)
  8152. req.Header = reqHeaders
  8153. googleapi.Expand(req.URL, map[string]string{
  8154. "groupKey": c.groupKey,
  8155. "memberKey": c.memberKey,
  8156. })
  8157. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8158. }
  8159. // Do executes the "directory.members.patch" call.
  8160. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  8161. // code is an error. Response headers are in either
  8162. // *Member.ServerResponse.Header or (if a response was returned at all)
  8163. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8164. // check whether the returned error was because http.StatusNotModified
  8165. // was returned.
  8166. func (c *MembersPatchCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  8167. gensupport.SetOptions(c.urlParams_, opts...)
  8168. res, err := c.doRequest("json")
  8169. if res != nil && res.StatusCode == http.StatusNotModified {
  8170. if res.Body != nil {
  8171. res.Body.Close()
  8172. }
  8173. return nil, &googleapi.Error{
  8174. Code: res.StatusCode,
  8175. Header: res.Header,
  8176. }
  8177. }
  8178. if err != nil {
  8179. return nil, err
  8180. }
  8181. defer googleapi.CloseBody(res)
  8182. if err := googleapi.CheckResponse(res); err != nil {
  8183. return nil, err
  8184. }
  8185. ret := &Member{
  8186. ServerResponse: googleapi.ServerResponse{
  8187. Header: res.Header,
  8188. HTTPStatusCode: res.StatusCode,
  8189. },
  8190. }
  8191. target := &ret
  8192. if err := gensupport.DecodeResponse(target, res); err != nil {
  8193. return nil, err
  8194. }
  8195. return ret, nil
  8196. // {
  8197. // "description": "Update membership of a user in the specified group. This method supports patch semantics.",
  8198. // "httpMethod": "PATCH",
  8199. // "id": "directory.members.patch",
  8200. // "parameterOrder": [
  8201. // "groupKey",
  8202. // "memberKey"
  8203. // ],
  8204. // "parameters": {
  8205. // "groupKey": {
  8206. // "description": "Email or immutable ID of the group. If ID, it should match with id of group object",
  8207. // "location": "path",
  8208. // "required": true,
  8209. // "type": "string"
  8210. // },
  8211. // "memberKey": {
  8212. // "description": "Email or immutable ID of the user. If ID, it should match with id of member object",
  8213. // "location": "path",
  8214. // "required": true,
  8215. // "type": "string"
  8216. // }
  8217. // },
  8218. // "path": "groups/{groupKey}/members/{memberKey}",
  8219. // "request": {
  8220. // "$ref": "Member"
  8221. // },
  8222. // "response": {
  8223. // "$ref": "Member"
  8224. // },
  8225. // "scopes": [
  8226. // "https://www.googleapis.com/auth/admin.directory.group",
  8227. // "https://www.googleapis.com/auth/admin.directory.group.member"
  8228. // ]
  8229. // }
  8230. }
  8231. // method id "directory.members.update":
  8232. type MembersUpdateCall struct {
  8233. s *Service
  8234. groupKey string
  8235. memberKey string
  8236. member *Member
  8237. urlParams_ gensupport.URLParams
  8238. ctx_ context.Context
  8239. header_ http.Header
  8240. }
  8241. // Update: Update membership of a user in the specified group.
  8242. func (r *MembersService) Update(groupKey string, memberKey string, member *Member) *MembersUpdateCall {
  8243. c := &MembersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8244. c.groupKey = groupKey
  8245. c.memberKey = memberKey
  8246. c.member = member
  8247. return c
  8248. }
  8249. // Fields allows partial responses to be retrieved. See
  8250. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8251. // for more information.
  8252. func (c *MembersUpdateCall) Fields(s ...googleapi.Field) *MembersUpdateCall {
  8253. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8254. return c
  8255. }
  8256. // Context sets the context to be used in this call's Do method. Any
  8257. // pending HTTP request will be aborted if the provided context is
  8258. // canceled.
  8259. func (c *MembersUpdateCall) Context(ctx context.Context) *MembersUpdateCall {
  8260. c.ctx_ = ctx
  8261. return c
  8262. }
  8263. // Header returns an http.Header that can be modified by the caller to
  8264. // add HTTP headers to the request.
  8265. func (c *MembersUpdateCall) Header() http.Header {
  8266. if c.header_ == nil {
  8267. c.header_ = make(http.Header)
  8268. }
  8269. return c.header_
  8270. }
  8271. func (c *MembersUpdateCall) doRequest(alt string) (*http.Response, error) {
  8272. reqHeaders := make(http.Header)
  8273. for k, v := range c.header_ {
  8274. reqHeaders[k] = v
  8275. }
  8276. reqHeaders.Set("User-Agent", c.s.userAgent())
  8277. var body io.Reader = nil
  8278. body, err := googleapi.WithoutDataWrapper.JSONReader(c.member)
  8279. if err != nil {
  8280. return nil, err
  8281. }
  8282. reqHeaders.Set("Content-Type", "application/json")
  8283. c.urlParams_.Set("alt", alt)
  8284. urls := googleapi.ResolveRelative(c.s.BasePath, "groups/{groupKey}/members/{memberKey}")
  8285. urls += "?" + c.urlParams_.Encode()
  8286. req, _ := http.NewRequest("PUT", urls, body)
  8287. req.Header = reqHeaders
  8288. googleapi.Expand(req.URL, map[string]string{
  8289. "groupKey": c.groupKey,
  8290. "memberKey": c.memberKey,
  8291. })
  8292. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8293. }
  8294. // Do executes the "directory.members.update" call.
  8295. // Exactly one of *Member or error will be non-nil. Any non-2xx status
  8296. // code is an error. Response headers are in either
  8297. // *Member.ServerResponse.Header or (if a response was returned at all)
  8298. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8299. // check whether the returned error was because http.StatusNotModified
  8300. // was returned.
  8301. func (c *MembersUpdateCall) Do(opts ...googleapi.CallOption) (*Member, error) {
  8302. gensupport.SetOptions(c.urlParams_, opts...)
  8303. res, err := c.doRequest("json")
  8304. if res != nil && res.StatusCode == http.StatusNotModified {
  8305. if res.Body != nil {
  8306. res.Body.Close()
  8307. }
  8308. return nil, &googleapi.Error{
  8309. Code: res.StatusCode,
  8310. Header: res.Header,
  8311. }
  8312. }
  8313. if err != nil {
  8314. return nil, err
  8315. }
  8316. defer googleapi.CloseBody(res)
  8317. if err := googleapi.CheckResponse(res); err != nil {
  8318. return nil, err
  8319. }
  8320. ret := &Member{
  8321. ServerResponse: googleapi.ServerResponse{
  8322. Header: res.Header,
  8323. HTTPStatusCode: res.StatusCode,
  8324. },
  8325. }
  8326. target := &ret
  8327. if err := gensupport.DecodeResponse(target, res); err != nil {
  8328. return nil, err
  8329. }
  8330. return ret, nil
  8331. // {
  8332. // "description": "Update membership of a user in the specified group.",
  8333. // "httpMethod": "PUT",
  8334. // "id": "directory.members.update",
  8335. // "parameterOrder": [
  8336. // "groupKey",
  8337. // "memberKey"
  8338. // ],
  8339. // "parameters": {
  8340. // "groupKey": {
  8341. // "description": "Email or immutable ID of the group. If ID, it should match with id of group object",
  8342. // "location": "path",
  8343. // "required": true,
  8344. // "type": "string"
  8345. // },
  8346. // "memberKey": {
  8347. // "description": "Email or immutable ID of the user. If ID, it should match with id of member object",
  8348. // "location": "path",
  8349. // "required": true,
  8350. // "type": "string"
  8351. // }
  8352. // },
  8353. // "path": "groups/{groupKey}/members/{memberKey}",
  8354. // "request": {
  8355. // "$ref": "Member"
  8356. // },
  8357. // "response": {
  8358. // "$ref": "Member"
  8359. // },
  8360. // "scopes": [
  8361. // "https://www.googleapis.com/auth/admin.directory.group",
  8362. // "https://www.googleapis.com/auth/admin.directory.group.member"
  8363. // ]
  8364. // }
  8365. }
  8366. // method id "directory.mobiledevices.action":
  8367. type MobiledevicesActionCall struct {
  8368. s *Service
  8369. customerId string
  8370. resourceId string
  8371. mobiledeviceaction *MobileDeviceAction
  8372. urlParams_ gensupport.URLParams
  8373. ctx_ context.Context
  8374. header_ http.Header
  8375. }
  8376. // Action: Take action on Mobile Device
  8377. func (r *MobiledevicesService) Action(customerId string, resourceId string, mobiledeviceaction *MobileDeviceAction) *MobiledevicesActionCall {
  8378. c := &MobiledevicesActionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8379. c.customerId = customerId
  8380. c.resourceId = resourceId
  8381. c.mobiledeviceaction = mobiledeviceaction
  8382. return c
  8383. }
  8384. // Fields allows partial responses to be retrieved. See
  8385. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8386. // for more information.
  8387. func (c *MobiledevicesActionCall) Fields(s ...googleapi.Field) *MobiledevicesActionCall {
  8388. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8389. return c
  8390. }
  8391. // Context sets the context to be used in this call's Do method. Any
  8392. // pending HTTP request will be aborted if the provided context is
  8393. // canceled.
  8394. func (c *MobiledevicesActionCall) Context(ctx context.Context) *MobiledevicesActionCall {
  8395. c.ctx_ = ctx
  8396. return c
  8397. }
  8398. // Header returns an http.Header that can be modified by the caller to
  8399. // add HTTP headers to the request.
  8400. func (c *MobiledevicesActionCall) Header() http.Header {
  8401. if c.header_ == nil {
  8402. c.header_ = make(http.Header)
  8403. }
  8404. return c.header_
  8405. }
  8406. func (c *MobiledevicesActionCall) doRequest(alt string) (*http.Response, error) {
  8407. reqHeaders := make(http.Header)
  8408. for k, v := range c.header_ {
  8409. reqHeaders[k] = v
  8410. }
  8411. reqHeaders.Set("User-Agent", c.s.userAgent())
  8412. var body io.Reader = nil
  8413. body, err := googleapi.WithoutDataWrapper.JSONReader(c.mobiledeviceaction)
  8414. if err != nil {
  8415. return nil, err
  8416. }
  8417. reqHeaders.Set("Content-Type", "application/json")
  8418. c.urlParams_.Set("alt", alt)
  8419. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile/{resourceId}/action")
  8420. urls += "?" + c.urlParams_.Encode()
  8421. req, _ := http.NewRequest("POST", urls, body)
  8422. req.Header = reqHeaders
  8423. googleapi.Expand(req.URL, map[string]string{
  8424. "customerId": c.customerId,
  8425. "resourceId": c.resourceId,
  8426. })
  8427. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8428. }
  8429. // Do executes the "directory.mobiledevices.action" call.
  8430. func (c *MobiledevicesActionCall) Do(opts ...googleapi.CallOption) error {
  8431. gensupport.SetOptions(c.urlParams_, opts...)
  8432. res, err := c.doRequest("json")
  8433. if err != nil {
  8434. return err
  8435. }
  8436. defer googleapi.CloseBody(res)
  8437. if err := googleapi.CheckResponse(res); err != nil {
  8438. return err
  8439. }
  8440. return nil
  8441. // {
  8442. // "description": "Take action on Mobile Device",
  8443. // "httpMethod": "POST",
  8444. // "id": "directory.mobiledevices.action",
  8445. // "parameterOrder": [
  8446. // "customerId",
  8447. // "resourceId"
  8448. // ],
  8449. // "parameters": {
  8450. // "customerId": {
  8451. // "description": "Immutable ID of the G Suite account",
  8452. // "location": "path",
  8453. // "required": true,
  8454. // "type": "string"
  8455. // },
  8456. // "resourceId": {
  8457. // "description": "Immutable ID of Mobile Device",
  8458. // "location": "path",
  8459. // "required": true,
  8460. // "type": "string"
  8461. // }
  8462. // },
  8463. // "path": "customer/{customerId}/devices/mobile/{resourceId}/action",
  8464. // "request": {
  8465. // "$ref": "MobileDeviceAction"
  8466. // },
  8467. // "scopes": [
  8468. // "https://www.googleapis.com/auth/admin.directory.device.mobile",
  8469. // "https://www.googleapis.com/auth/admin.directory.device.mobile.action"
  8470. // ]
  8471. // }
  8472. }
  8473. // method id "directory.mobiledevices.delete":
  8474. type MobiledevicesDeleteCall struct {
  8475. s *Service
  8476. customerId string
  8477. resourceId string
  8478. urlParams_ gensupport.URLParams
  8479. ctx_ context.Context
  8480. header_ http.Header
  8481. }
  8482. // Delete: Delete Mobile Device
  8483. func (r *MobiledevicesService) Delete(customerId string, resourceId string) *MobiledevicesDeleteCall {
  8484. c := &MobiledevicesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8485. c.customerId = customerId
  8486. c.resourceId = resourceId
  8487. return c
  8488. }
  8489. // Fields allows partial responses to be retrieved. See
  8490. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8491. // for more information.
  8492. func (c *MobiledevicesDeleteCall) Fields(s ...googleapi.Field) *MobiledevicesDeleteCall {
  8493. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8494. return c
  8495. }
  8496. // Context sets the context to be used in this call's Do method. Any
  8497. // pending HTTP request will be aborted if the provided context is
  8498. // canceled.
  8499. func (c *MobiledevicesDeleteCall) Context(ctx context.Context) *MobiledevicesDeleteCall {
  8500. c.ctx_ = ctx
  8501. return c
  8502. }
  8503. // Header returns an http.Header that can be modified by the caller to
  8504. // add HTTP headers to the request.
  8505. func (c *MobiledevicesDeleteCall) Header() http.Header {
  8506. if c.header_ == nil {
  8507. c.header_ = make(http.Header)
  8508. }
  8509. return c.header_
  8510. }
  8511. func (c *MobiledevicesDeleteCall) doRequest(alt string) (*http.Response, error) {
  8512. reqHeaders := make(http.Header)
  8513. for k, v := range c.header_ {
  8514. reqHeaders[k] = v
  8515. }
  8516. reqHeaders.Set("User-Agent", c.s.userAgent())
  8517. var body io.Reader = nil
  8518. c.urlParams_.Set("alt", alt)
  8519. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile/{resourceId}")
  8520. urls += "?" + c.urlParams_.Encode()
  8521. req, _ := http.NewRequest("DELETE", urls, body)
  8522. req.Header = reqHeaders
  8523. googleapi.Expand(req.URL, map[string]string{
  8524. "customerId": c.customerId,
  8525. "resourceId": c.resourceId,
  8526. })
  8527. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8528. }
  8529. // Do executes the "directory.mobiledevices.delete" call.
  8530. func (c *MobiledevicesDeleteCall) Do(opts ...googleapi.CallOption) error {
  8531. gensupport.SetOptions(c.urlParams_, opts...)
  8532. res, err := c.doRequest("json")
  8533. if err != nil {
  8534. return err
  8535. }
  8536. defer googleapi.CloseBody(res)
  8537. if err := googleapi.CheckResponse(res); err != nil {
  8538. return err
  8539. }
  8540. return nil
  8541. // {
  8542. // "description": "Delete Mobile Device",
  8543. // "httpMethod": "DELETE",
  8544. // "id": "directory.mobiledevices.delete",
  8545. // "parameterOrder": [
  8546. // "customerId",
  8547. // "resourceId"
  8548. // ],
  8549. // "parameters": {
  8550. // "customerId": {
  8551. // "description": "Immutable ID of the G Suite account",
  8552. // "location": "path",
  8553. // "required": true,
  8554. // "type": "string"
  8555. // },
  8556. // "resourceId": {
  8557. // "description": "Immutable ID of Mobile Device",
  8558. // "location": "path",
  8559. // "required": true,
  8560. // "type": "string"
  8561. // }
  8562. // },
  8563. // "path": "customer/{customerId}/devices/mobile/{resourceId}",
  8564. // "scopes": [
  8565. // "https://www.googleapis.com/auth/admin.directory.device.mobile"
  8566. // ]
  8567. // }
  8568. }
  8569. // method id "directory.mobiledevices.get":
  8570. type MobiledevicesGetCall struct {
  8571. s *Service
  8572. customerId string
  8573. resourceId string
  8574. urlParams_ gensupport.URLParams
  8575. ifNoneMatch_ string
  8576. ctx_ context.Context
  8577. header_ http.Header
  8578. }
  8579. // Get: Retrieve Mobile Device
  8580. func (r *MobiledevicesService) Get(customerId string, resourceId string) *MobiledevicesGetCall {
  8581. c := &MobiledevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8582. c.customerId = customerId
  8583. c.resourceId = resourceId
  8584. return c
  8585. }
  8586. // Projection sets the optional parameter "projection": Restrict
  8587. // information returned to a set of selected fields.
  8588. //
  8589. // Possible values:
  8590. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  8591. // model, status, type, and status)
  8592. // "FULL" - Includes all metadata fields
  8593. func (c *MobiledevicesGetCall) Projection(projection string) *MobiledevicesGetCall {
  8594. c.urlParams_.Set("projection", projection)
  8595. return c
  8596. }
  8597. // Fields allows partial responses to be retrieved. See
  8598. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8599. // for more information.
  8600. func (c *MobiledevicesGetCall) Fields(s ...googleapi.Field) *MobiledevicesGetCall {
  8601. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8602. return c
  8603. }
  8604. // IfNoneMatch sets the optional parameter which makes the operation
  8605. // fail if the object's ETag matches the given value. This is useful for
  8606. // getting updates only after the object has changed since the last
  8607. // request. Use googleapi.IsNotModified to check whether the response
  8608. // error from Do is the result of In-None-Match.
  8609. func (c *MobiledevicesGetCall) IfNoneMatch(entityTag string) *MobiledevicesGetCall {
  8610. c.ifNoneMatch_ = entityTag
  8611. return c
  8612. }
  8613. // Context sets the context to be used in this call's Do method. Any
  8614. // pending HTTP request will be aborted if the provided context is
  8615. // canceled.
  8616. func (c *MobiledevicesGetCall) Context(ctx context.Context) *MobiledevicesGetCall {
  8617. c.ctx_ = ctx
  8618. return c
  8619. }
  8620. // Header returns an http.Header that can be modified by the caller to
  8621. // add HTTP headers to the request.
  8622. func (c *MobiledevicesGetCall) Header() http.Header {
  8623. if c.header_ == nil {
  8624. c.header_ = make(http.Header)
  8625. }
  8626. return c.header_
  8627. }
  8628. func (c *MobiledevicesGetCall) doRequest(alt string) (*http.Response, error) {
  8629. reqHeaders := make(http.Header)
  8630. for k, v := range c.header_ {
  8631. reqHeaders[k] = v
  8632. }
  8633. reqHeaders.Set("User-Agent", c.s.userAgent())
  8634. if c.ifNoneMatch_ != "" {
  8635. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8636. }
  8637. var body io.Reader = nil
  8638. c.urlParams_.Set("alt", alt)
  8639. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile/{resourceId}")
  8640. urls += "?" + c.urlParams_.Encode()
  8641. req, _ := http.NewRequest("GET", urls, body)
  8642. req.Header = reqHeaders
  8643. googleapi.Expand(req.URL, map[string]string{
  8644. "customerId": c.customerId,
  8645. "resourceId": c.resourceId,
  8646. })
  8647. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8648. }
  8649. // Do executes the "directory.mobiledevices.get" call.
  8650. // Exactly one of *MobileDevice or error will be non-nil. Any non-2xx
  8651. // status code is an error. Response headers are in either
  8652. // *MobileDevice.ServerResponse.Header or (if a response was returned at
  8653. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8654. // to check whether the returned error was because
  8655. // http.StatusNotModified was returned.
  8656. func (c *MobiledevicesGetCall) Do(opts ...googleapi.CallOption) (*MobileDevice, error) {
  8657. gensupport.SetOptions(c.urlParams_, opts...)
  8658. res, err := c.doRequest("json")
  8659. if res != nil && res.StatusCode == http.StatusNotModified {
  8660. if res.Body != nil {
  8661. res.Body.Close()
  8662. }
  8663. return nil, &googleapi.Error{
  8664. Code: res.StatusCode,
  8665. Header: res.Header,
  8666. }
  8667. }
  8668. if err != nil {
  8669. return nil, err
  8670. }
  8671. defer googleapi.CloseBody(res)
  8672. if err := googleapi.CheckResponse(res); err != nil {
  8673. return nil, err
  8674. }
  8675. ret := &MobileDevice{
  8676. ServerResponse: googleapi.ServerResponse{
  8677. Header: res.Header,
  8678. HTTPStatusCode: res.StatusCode,
  8679. },
  8680. }
  8681. target := &ret
  8682. if err := gensupport.DecodeResponse(target, res); err != nil {
  8683. return nil, err
  8684. }
  8685. return ret, nil
  8686. // {
  8687. // "description": "Retrieve Mobile Device",
  8688. // "httpMethod": "GET",
  8689. // "id": "directory.mobiledevices.get",
  8690. // "parameterOrder": [
  8691. // "customerId",
  8692. // "resourceId"
  8693. // ],
  8694. // "parameters": {
  8695. // "customerId": {
  8696. // "description": "Immutable ID of the G Suite account",
  8697. // "location": "path",
  8698. // "required": true,
  8699. // "type": "string"
  8700. // },
  8701. // "projection": {
  8702. // "description": "Restrict information returned to a set of selected fields.",
  8703. // "enum": [
  8704. // "BASIC",
  8705. // "FULL"
  8706. // ],
  8707. // "enumDescriptions": [
  8708. // "Includes only the basic metadata fields (e.g., deviceId, model, status, type, and status)",
  8709. // "Includes all metadata fields"
  8710. // ],
  8711. // "location": "query",
  8712. // "type": "string"
  8713. // },
  8714. // "resourceId": {
  8715. // "description": "Immutable ID of Mobile Device",
  8716. // "location": "path",
  8717. // "required": true,
  8718. // "type": "string"
  8719. // }
  8720. // },
  8721. // "path": "customer/{customerId}/devices/mobile/{resourceId}",
  8722. // "response": {
  8723. // "$ref": "MobileDevice"
  8724. // },
  8725. // "scopes": [
  8726. // "https://www.googleapis.com/auth/admin.directory.device.mobile",
  8727. // "https://www.googleapis.com/auth/admin.directory.device.mobile.action",
  8728. // "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly"
  8729. // ]
  8730. // }
  8731. }
  8732. // method id "directory.mobiledevices.list":
  8733. type MobiledevicesListCall struct {
  8734. s *Service
  8735. customerId string
  8736. urlParams_ gensupport.URLParams
  8737. ifNoneMatch_ string
  8738. ctx_ context.Context
  8739. header_ http.Header
  8740. }
  8741. // List: Retrieve all Mobile Devices of a customer (paginated)
  8742. func (r *MobiledevicesService) List(customerId string) *MobiledevicesListCall {
  8743. c := &MobiledevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8744. c.customerId = customerId
  8745. return c
  8746. }
  8747. // MaxResults sets the optional parameter "maxResults": Maximum number
  8748. // of results to return. Default is 100
  8749. func (c *MobiledevicesListCall) MaxResults(maxResults int64) *MobiledevicesListCall {
  8750. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  8751. return c
  8752. }
  8753. // OrderBy sets the optional parameter "orderBy": Column to use for
  8754. // sorting results
  8755. //
  8756. // Possible values:
  8757. // "deviceId" - Mobile Device serial number.
  8758. // "email" - Owner user email.
  8759. // "lastSync" - Last policy settings sync date time of the device.
  8760. // "model" - Mobile Device model.
  8761. // "name" - Owner user name.
  8762. // "os" - Mobile operating system.
  8763. // "status" - Status of the device.
  8764. // "type" - Type of the device.
  8765. func (c *MobiledevicesListCall) OrderBy(orderBy string) *MobiledevicesListCall {
  8766. c.urlParams_.Set("orderBy", orderBy)
  8767. return c
  8768. }
  8769. // PageToken sets the optional parameter "pageToken": Token to specify
  8770. // next page in the list
  8771. func (c *MobiledevicesListCall) PageToken(pageToken string) *MobiledevicesListCall {
  8772. c.urlParams_.Set("pageToken", pageToken)
  8773. return c
  8774. }
  8775. // Projection sets the optional parameter "projection": Restrict
  8776. // information returned to a set of selected fields.
  8777. //
  8778. // Possible values:
  8779. // "BASIC" - Includes only the basic metadata fields (e.g., deviceId,
  8780. // model, status, type, and status)
  8781. // "FULL" - Includes all metadata fields
  8782. func (c *MobiledevicesListCall) Projection(projection string) *MobiledevicesListCall {
  8783. c.urlParams_.Set("projection", projection)
  8784. return c
  8785. }
  8786. // Query sets the optional parameter "query": Search string in the
  8787. // format given at
  8788. // http://support.google.com/a/bin/answer.py?answer=1408863#search
  8789. func (c *MobiledevicesListCall) Query(query string) *MobiledevicesListCall {
  8790. c.urlParams_.Set("query", query)
  8791. return c
  8792. }
  8793. // SortOrder sets the optional parameter "sortOrder": Whether to return
  8794. // results in ascending or descending order. Only of use when orderBy is
  8795. // also used
  8796. //
  8797. // Possible values:
  8798. // "ASCENDING" - Ascending order.
  8799. // "DESCENDING" - Descending order.
  8800. func (c *MobiledevicesListCall) SortOrder(sortOrder string) *MobiledevicesListCall {
  8801. c.urlParams_.Set("sortOrder", sortOrder)
  8802. return c
  8803. }
  8804. // Fields allows partial responses to be retrieved. See
  8805. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8806. // for more information.
  8807. func (c *MobiledevicesListCall) Fields(s ...googleapi.Field) *MobiledevicesListCall {
  8808. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8809. return c
  8810. }
  8811. // IfNoneMatch sets the optional parameter which makes the operation
  8812. // fail if the object's ETag matches the given value. This is useful for
  8813. // getting updates only after the object has changed since the last
  8814. // request. Use googleapi.IsNotModified to check whether the response
  8815. // error from Do is the result of In-None-Match.
  8816. func (c *MobiledevicesListCall) IfNoneMatch(entityTag string) *MobiledevicesListCall {
  8817. c.ifNoneMatch_ = entityTag
  8818. return c
  8819. }
  8820. // Context sets the context to be used in this call's Do method. Any
  8821. // pending HTTP request will be aborted if the provided context is
  8822. // canceled.
  8823. func (c *MobiledevicesListCall) Context(ctx context.Context) *MobiledevicesListCall {
  8824. c.ctx_ = ctx
  8825. return c
  8826. }
  8827. // Header returns an http.Header that can be modified by the caller to
  8828. // add HTTP headers to the request.
  8829. func (c *MobiledevicesListCall) Header() http.Header {
  8830. if c.header_ == nil {
  8831. c.header_ = make(http.Header)
  8832. }
  8833. return c.header_
  8834. }
  8835. func (c *MobiledevicesListCall) doRequest(alt string) (*http.Response, error) {
  8836. reqHeaders := make(http.Header)
  8837. for k, v := range c.header_ {
  8838. reqHeaders[k] = v
  8839. }
  8840. reqHeaders.Set("User-Agent", c.s.userAgent())
  8841. if c.ifNoneMatch_ != "" {
  8842. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8843. }
  8844. var body io.Reader = nil
  8845. c.urlParams_.Set("alt", alt)
  8846. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/devices/mobile")
  8847. urls += "?" + c.urlParams_.Encode()
  8848. req, _ := http.NewRequest("GET", urls, body)
  8849. req.Header = reqHeaders
  8850. googleapi.Expand(req.URL, map[string]string{
  8851. "customerId": c.customerId,
  8852. })
  8853. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8854. }
  8855. // Do executes the "directory.mobiledevices.list" call.
  8856. // Exactly one of *MobileDevices or error will be non-nil. Any non-2xx
  8857. // status code is an error. Response headers are in either
  8858. // *MobileDevices.ServerResponse.Header or (if a response was returned
  8859. // at all) in error.(*googleapi.Error).Header. Use
  8860. // googleapi.IsNotModified to check whether the returned error was
  8861. // because http.StatusNotModified was returned.
  8862. func (c *MobiledevicesListCall) Do(opts ...googleapi.CallOption) (*MobileDevices, error) {
  8863. gensupport.SetOptions(c.urlParams_, opts...)
  8864. res, err := c.doRequest("json")
  8865. if res != nil && res.StatusCode == http.StatusNotModified {
  8866. if res.Body != nil {
  8867. res.Body.Close()
  8868. }
  8869. return nil, &googleapi.Error{
  8870. Code: res.StatusCode,
  8871. Header: res.Header,
  8872. }
  8873. }
  8874. if err != nil {
  8875. return nil, err
  8876. }
  8877. defer googleapi.CloseBody(res)
  8878. if err := googleapi.CheckResponse(res); err != nil {
  8879. return nil, err
  8880. }
  8881. ret := &MobileDevices{
  8882. ServerResponse: googleapi.ServerResponse{
  8883. Header: res.Header,
  8884. HTTPStatusCode: res.StatusCode,
  8885. },
  8886. }
  8887. target := &ret
  8888. if err := gensupport.DecodeResponse(target, res); err != nil {
  8889. return nil, err
  8890. }
  8891. return ret, nil
  8892. // {
  8893. // "description": "Retrieve all Mobile Devices of a customer (paginated)",
  8894. // "httpMethod": "GET",
  8895. // "id": "directory.mobiledevices.list",
  8896. // "parameterOrder": [
  8897. // "customerId"
  8898. // ],
  8899. // "parameters": {
  8900. // "customerId": {
  8901. // "description": "Immutable ID of the G Suite account",
  8902. // "location": "path",
  8903. // "required": true,
  8904. // "type": "string"
  8905. // },
  8906. // "maxResults": {
  8907. // "description": "Maximum number of results to return. Default is 100",
  8908. // "format": "int32",
  8909. // "location": "query",
  8910. // "minimum": "1",
  8911. // "type": "integer"
  8912. // },
  8913. // "orderBy": {
  8914. // "description": "Column to use for sorting results",
  8915. // "enum": [
  8916. // "deviceId",
  8917. // "email",
  8918. // "lastSync",
  8919. // "model",
  8920. // "name",
  8921. // "os",
  8922. // "status",
  8923. // "type"
  8924. // ],
  8925. // "enumDescriptions": [
  8926. // "Mobile Device serial number.",
  8927. // "Owner user email.",
  8928. // "Last policy settings sync date time of the device.",
  8929. // "Mobile Device model.",
  8930. // "Owner user name.",
  8931. // "Mobile operating system.",
  8932. // "Status of the device.",
  8933. // "Type of the device."
  8934. // ],
  8935. // "location": "query",
  8936. // "type": "string"
  8937. // },
  8938. // "pageToken": {
  8939. // "description": "Token to specify next page in the list",
  8940. // "location": "query",
  8941. // "type": "string"
  8942. // },
  8943. // "projection": {
  8944. // "description": "Restrict information returned to a set of selected fields.",
  8945. // "enum": [
  8946. // "BASIC",
  8947. // "FULL"
  8948. // ],
  8949. // "enumDescriptions": [
  8950. // "Includes only the basic metadata fields (e.g., deviceId, model, status, type, and status)",
  8951. // "Includes all metadata fields"
  8952. // ],
  8953. // "location": "query",
  8954. // "type": "string"
  8955. // },
  8956. // "query": {
  8957. // "description": "Search string in the format given at http://support.google.com/a/bin/answer.py?answer=1408863#search",
  8958. // "location": "query",
  8959. // "type": "string"
  8960. // },
  8961. // "sortOrder": {
  8962. // "description": "Whether to return results in ascending or descending order. Only of use when orderBy is also used",
  8963. // "enum": [
  8964. // "ASCENDING",
  8965. // "DESCENDING"
  8966. // ],
  8967. // "enumDescriptions": [
  8968. // "Ascending order.",
  8969. // "Descending order."
  8970. // ],
  8971. // "location": "query",
  8972. // "type": "string"
  8973. // }
  8974. // },
  8975. // "path": "customer/{customerId}/devices/mobile",
  8976. // "response": {
  8977. // "$ref": "MobileDevices"
  8978. // },
  8979. // "scopes": [
  8980. // "https://www.googleapis.com/auth/admin.directory.device.mobile",
  8981. // "https://www.googleapis.com/auth/admin.directory.device.mobile.action",
  8982. // "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly"
  8983. // ]
  8984. // }
  8985. }
  8986. // Pages invokes f for each page of results.
  8987. // A non-nil error returned from f will halt the iteration.
  8988. // The provided context supersedes any context provided to the Context method.
  8989. func (c *MobiledevicesListCall) Pages(ctx context.Context, f func(*MobileDevices) error) error {
  8990. c.ctx_ = ctx
  8991. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8992. for {
  8993. x, err := c.Do()
  8994. if err != nil {
  8995. return err
  8996. }
  8997. if err := f(x); err != nil {
  8998. return err
  8999. }
  9000. if x.NextPageToken == "" {
  9001. return nil
  9002. }
  9003. c.PageToken(x.NextPageToken)
  9004. }
  9005. }
  9006. // method id "directory.notifications.delete":
  9007. type NotificationsDeleteCall struct {
  9008. s *Service
  9009. customer string
  9010. notificationId string
  9011. urlParams_ gensupport.URLParams
  9012. ctx_ context.Context
  9013. header_ http.Header
  9014. }
  9015. // Delete: Deletes a notification
  9016. func (r *NotificationsService) Delete(customer string, notificationId string) *NotificationsDeleteCall {
  9017. c := &NotificationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9018. c.customer = customer
  9019. c.notificationId = notificationId
  9020. return c
  9021. }
  9022. // Fields allows partial responses to be retrieved. See
  9023. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9024. // for more information.
  9025. func (c *NotificationsDeleteCall) Fields(s ...googleapi.Field) *NotificationsDeleteCall {
  9026. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9027. return c
  9028. }
  9029. // Context sets the context to be used in this call's Do method. Any
  9030. // pending HTTP request will be aborted if the provided context is
  9031. // canceled.
  9032. func (c *NotificationsDeleteCall) Context(ctx context.Context) *NotificationsDeleteCall {
  9033. c.ctx_ = ctx
  9034. return c
  9035. }
  9036. // Header returns an http.Header that can be modified by the caller to
  9037. // add HTTP headers to the request.
  9038. func (c *NotificationsDeleteCall) Header() http.Header {
  9039. if c.header_ == nil {
  9040. c.header_ = make(http.Header)
  9041. }
  9042. return c.header_
  9043. }
  9044. func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9045. reqHeaders := make(http.Header)
  9046. for k, v := range c.header_ {
  9047. reqHeaders[k] = v
  9048. }
  9049. reqHeaders.Set("User-Agent", c.s.userAgent())
  9050. var body io.Reader = nil
  9051. c.urlParams_.Set("alt", alt)
  9052. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  9053. urls += "?" + c.urlParams_.Encode()
  9054. req, _ := http.NewRequest("DELETE", urls, body)
  9055. req.Header = reqHeaders
  9056. googleapi.Expand(req.URL, map[string]string{
  9057. "customer": c.customer,
  9058. "notificationId": c.notificationId,
  9059. })
  9060. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9061. }
  9062. // Do executes the "directory.notifications.delete" call.
  9063. func (c *NotificationsDeleteCall) Do(opts ...googleapi.CallOption) error {
  9064. gensupport.SetOptions(c.urlParams_, opts...)
  9065. res, err := c.doRequest("json")
  9066. if err != nil {
  9067. return err
  9068. }
  9069. defer googleapi.CloseBody(res)
  9070. if err := googleapi.CheckResponse(res); err != nil {
  9071. return err
  9072. }
  9073. return nil
  9074. // {
  9075. // "description": "Deletes a notification",
  9076. // "httpMethod": "DELETE",
  9077. // "id": "directory.notifications.delete",
  9078. // "parameterOrder": [
  9079. // "customer",
  9080. // "notificationId"
  9081. // ],
  9082. // "parameters": {
  9083. // "customer": {
  9084. // "description": "The unique ID for the customer's G Suite account. The customerId is also returned as part of the Users resource.",
  9085. // "location": "path",
  9086. // "required": true,
  9087. // "type": "string"
  9088. // },
  9089. // "notificationId": {
  9090. // "description": "The unique ID of the notification.",
  9091. // "location": "path",
  9092. // "required": true,
  9093. // "type": "string"
  9094. // }
  9095. // },
  9096. // "path": "customer/{customer}/notifications/{notificationId}",
  9097. // "scopes": [
  9098. // "https://www.googleapis.com/auth/admin.directory.notifications"
  9099. // ]
  9100. // }
  9101. }
  9102. // method id "directory.notifications.get":
  9103. type NotificationsGetCall struct {
  9104. s *Service
  9105. customer string
  9106. notificationId string
  9107. urlParams_ gensupport.URLParams
  9108. ifNoneMatch_ string
  9109. ctx_ context.Context
  9110. header_ http.Header
  9111. }
  9112. // Get: Retrieves a notification.
  9113. func (r *NotificationsService) Get(customer string, notificationId string) *NotificationsGetCall {
  9114. c := &NotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9115. c.customer = customer
  9116. c.notificationId = notificationId
  9117. return c
  9118. }
  9119. // Fields allows partial responses to be retrieved. See
  9120. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9121. // for more information.
  9122. func (c *NotificationsGetCall) Fields(s ...googleapi.Field) *NotificationsGetCall {
  9123. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9124. return c
  9125. }
  9126. // IfNoneMatch sets the optional parameter which makes the operation
  9127. // fail if the object's ETag matches the given value. This is useful for
  9128. // getting updates only after the object has changed since the last
  9129. // request. Use googleapi.IsNotModified to check whether the response
  9130. // error from Do is the result of In-None-Match.
  9131. func (c *NotificationsGetCall) IfNoneMatch(entityTag string) *NotificationsGetCall {
  9132. c.ifNoneMatch_ = entityTag
  9133. return c
  9134. }
  9135. // Context sets the context to be used in this call's Do method. Any
  9136. // pending HTTP request will be aborted if the provided context is
  9137. // canceled.
  9138. func (c *NotificationsGetCall) Context(ctx context.Context) *NotificationsGetCall {
  9139. c.ctx_ = ctx
  9140. return c
  9141. }
  9142. // Header returns an http.Header that can be modified by the caller to
  9143. // add HTTP headers to the request.
  9144. func (c *NotificationsGetCall) Header() http.Header {
  9145. if c.header_ == nil {
  9146. c.header_ = make(http.Header)
  9147. }
  9148. return c.header_
  9149. }
  9150. func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) {
  9151. reqHeaders := make(http.Header)
  9152. for k, v := range c.header_ {
  9153. reqHeaders[k] = v
  9154. }
  9155. reqHeaders.Set("User-Agent", c.s.userAgent())
  9156. if c.ifNoneMatch_ != "" {
  9157. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9158. }
  9159. var body io.Reader = nil
  9160. c.urlParams_.Set("alt", alt)
  9161. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  9162. urls += "?" + c.urlParams_.Encode()
  9163. req, _ := http.NewRequest("GET", urls, body)
  9164. req.Header = reqHeaders
  9165. googleapi.Expand(req.URL, map[string]string{
  9166. "customer": c.customer,
  9167. "notificationId": c.notificationId,
  9168. })
  9169. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9170. }
  9171. // Do executes the "directory.notifications.get" call.
  9172. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  9173. // status code is an error. Response headers are in either
  9174. // *Notification.ServerResponse.Header or (if a response was returned at
  9175. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9176. // to check whether the returned error was because
  9177. // http.StatusNotModified was returned.
  9178. func (c *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  9179. gensupport.SetOptions(c.urlParams_, opts...)
  9180. res, err := c.doRequest("json")
  9181. if res != nil && res.StatusCode == http.StatusNotModified {
  9182. if res.Body != nil {
  9183. res.Body.Close()
  9184. }
  9185. return nil, &googleapi.Error{
  9186. Code: res.StatusCode,
  9187. Header: res.Header,
  9188. }
  9189. }
  9190. if err != nil {
  9191. return nil, err
  9192. }
  9193. defer googleapi.CloseBody(res)
  9194. if err := googleapi.CheckResponse(res); err != nil {
  9195. return nil, err
  9196. }
  9197. ret := &Notification{
  9198. ServerResponse: googleapi.ServerResponse{
  9199. Header: res.Header,
  9200. HTTPStatusCode: res.StatusCode,
  9201. },
  9202. }
  9203. target := &ret
  9204. if err := gensupport.DecodeResponse(target, res); err != nil {
  9205. return nil, err
  9206. }
  9207. return ret, nil
  9208. // {
  9209. // "description": "Retrieves a notification.",
  9210. // "httpMethod": "GET",
  9211. // "id": "directory.notifications.get",
  9212. // "parameterOrder": [
  9213. // "customer",
  9214. // "notificationId"
  9215. // ],
  9216. // "parameters": {
  9217. // "customer": {
  9218. // "description": "The unique ID for the customer's G Suite account. The customerId is also returned as part of the Users resource.",
  9219. // "location": "path",
  9220. // "required": true,
  9221. // "type": "string"
  9222. // },
  9223. // "notificationId": {
  9224. // "description": "The unique ID of the notification.",
  9225. // "location": "path",
  9226. // "required": true,
  9227. // "type": "string"
  9228. // }
  9229. // },
  9230. // "path": "customer/{customer}/notifications/{notificationId}",
  9231. // "response": {
  9232. // "$ref": "Notification"
  9233. // },
  9234. // "scopes": [
  9235. // "https://www.googleapis.com/auth/admin.directory.notifications"
  9236. // ]
  9237. // }
  9238. }
  9239. // method id "directory.notifications.list":
  9240. type NotificationsListCall struct {
  9241. s *Service
  9242. customer string
  9243. urlParams_ gensupport.URLParams
  9244. ifNoneMatch_ string
  9245. ctx_ context.Context
  9246. header_ http.Header
  9247. }
  9248. // List: Retrieves a list of notifications.
  9249. func (r *NotificationsService) List(customer string) *NotificationsListCall {
  9250. c := &NotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9251. c.customer = customer
  9252. return c
  9253. }
  9254. // Language sets the optional parameter "language": The ISO 639-1 code
  9255. // of the language notifications are returned in. The default is English
  9256. // (en).
  9257. func (c *NotificationsListCall) Language(language string) *NotificationsListCall {
  9258. c.urlParams_.Set("language", language)
  9259. return c
  9260. }
  9261. // MaxResults sets the optional parameter "maxResults": Maximum number
  9262. // of notifications to return per page. The default is 100.
  9263. func (c *NotificationsListCall) MaxResults(maxResults int64) *NotificationsListCall {
  9264. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  9265. return c
  9266. }
  9267. // PageToken sets the optional parameter "pageToken": The token to
  9268. // specify the page of results to retrieve.
  9269. func (c *NotificationsListCall) PageToken(pageToken string) *NotificationsListCall {
  9270. c.urlParams_.Set("pageToken", pageToken)
  9271. return c
  9272. }
  9273. // Fields allows partial responses to be retrieved. See
  9274. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9275. // for more information.
  9276. func (c *NotificationsListCall) Fields(s ...googleapi.Field) *NotificationsListCall {
  9277. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9278. return c
  9279. }
  9280. // IfNoneMatch sets the optional parameter which makes the operation
  9281. // fail if the object's ETag matches the given value. This is useful for
  9282. // getting updates only after the object has changed since the last
  9283. // request. Use googleapi.IsNotModified to check whether the response
  9284. // error from Do is the result of In-None-Match.
  9285. func (c *NotificationsListCall) IfNoneMatch(entityTag string) *NotificationsListCall {
  9286. c.ifNoneMatch_ = entityTag
  9287. return c
  9288. }
  9289. // Context sets the context to be used in this call's Do method. Any
  9290. // pending HTTP request will be aborted if the provided context is
  9291. // canceled.
  9292. func (c *NotificationsListCall) Context(ctx context.Context) *NotificationsListCall {
  9293. c.ctx_ = ctx
  9294. return c
  9295. }
  9296. // Header returns an http.Header that can be modified by the caller to
  9297. // add HTTP headers to the request.
  9298. func (c *NotificationsListCall) Header() http.Header {
  9299. if c.header_ == nil {
  9300. c.header_ = make(http.Header)
  9301. }
  9302. return c.header_
  9303. }
  9304. func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) {
  9305. reqHeaders := make(http.Header)
  9306. for k, v := range c.header_ {
  9307. reqHeaders[k] = v
  9308. }
  9309. reqHeaders.Set("User-Agent", c.s.userAgent())
  9310. if c.ifNoneMatch_ != "" {
  9311. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9312. }
  9313. var body io.Reader = nil
  9314. c.urlParams_.Set("alt", alt)
  9315. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications")
  9316. urls += "?" + c.urlParams_.Encode()
  9317. req, _ := http.NewRequest("GET", urls, body)
  9318. req.Header = reqHeaders
  9319. googleapi.Expand(req.URL, map[string]string{
  9320. "customer": c.customer,
  9321. })
  9322. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9323. }
  9324. // Do executes the "directory.notifications.list" call.
  9325. // Exactly one of *Notifications or error will be non-nil. Any non-2xx
  9326. // status code is an error. Response headers are in either
  9327. // *Notifications.ServerResponse.Header or (if a response was returned
  9328. // at all) in error.(*googleapi.Error).Header. Use
  9329. // googleapi.IsNotModified to check whether the returned error was
  9330. // because http.StatusNotModified was returned.
  9331. func (c *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications, error) {
  9332. gensupport.SetOptions(c.urlParams_, opts...)
  9333. res, err := c.doRequest("json")
  9334. if res != nil && res.StatusCode == http.StatusNotModified {
  9335. if res.Body != nil {
  9336. res.Body.Close()
  9337. }
  9338. return nil, &googleapi.Error{
  9339. Code: res.StatusCode,
  9340. Header: res.Header,
  9341. }
  9342. }
  9343. if err != nil {
  9344. return nil, err
  9345. }
  9346. defer googleapi.CloseBody(res)
  9347. if err := googleapi.CheckResponse(res); err != nil {
  9348. return nil, err
  9349. }
  9350. ret := &Notifications{
  9351. ServerResponse: googleapi.ServerResponse{
  9352. Header: res.Header,
  9353. HTTPStatusCode: res.StatusCode,
  9354. },
  9355. }
  9356. target := &ret
  9357. if err := gensupport.DecodeResponse(target, res); err != nil {
  9358. return nil, err
  9359. }
  9360. return ret, nil
  9361. // {
  9362. // "description": "Retrieves a list of notifications.",
  9363. // "httpMethod": "GET",
  9364. // "id": "directory.notifications.list",
  9365. // "parameterOrder": [
  9366. // "customer"
  9367. // ],
  9368. // "parameters": {
  9369. // "customer": {
  9370. // "description": "The unique ID for the customer's G Suite account.",
  9371. // "location": "path",
  9372. // "required": true,
  9373. // "type": "string"
  9374. // },
  9375. // "language": {
  9376. // "description": "The ISO 639-1 code of the language notifications are returned in. The default is English (en).",
  9377. // "location": "query",
  9378. // "type": "string"
  9379. // },
  9380. // "maxResults": {
  9381. // "description": "Maximum number of notifications to return per page. The default is 100.",
  9382. // "format": "uint32",
  9383. // "location": "query",
  9384. // "type": "integer"
  9385. // },
  9386. // "pageToken": {
  9387. // "description": "The token to specify the page of results to retrieve.",
  9388. // "location": "query",
  9389. // "type": "string"
  9390. // }
  9391. // },
  9392. // "path": "customer/{customer}/notifications",
  9393. // "response": {
  9394. // "$ref": "Notifications"
  9395. // },
  9396. // "scopes": [
  9397. // "https://www.googleapis.com/auth/admin.directory.notifications"
  9398. // ]
  9399. // }
  9400. }
  9401. // Pages invokes f for each page of results.
  9402. // A non-nil error returned from f will halt the iteration.
  9403. // The provided context supersedes any context provided to the Context method.
  9404. func (c *NotificationsListCall) Pages(ctx context.Context, f func(*Notifications) error) error {
  9405. c.ctx_ = ctx
  9406. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9407. for {
  9408. x, err := c.Do()
  9409. if err != nil {
  9410. return err
  9411. }
  9412. if err := f(x); err != nil {
  9413. return err
  9414. }
  9415. if x.NextPageToken == "" {
  9416. return nil
  9417. }
  9418. c.PageToken(x.NextPageToken)
  9419. }
  9420. }
  9421. // method id "directory.notifications.patch":
  9422. type NotificationsPatchCall struct {
  9423. s *Service
  9424. customer string
  9425. notificationId string
  9426. notification *Notification
  9427. urlParams_ gensupport.URLParams
  9428. ctx_ context.Context
  9429. header_ http.Header
  9430. }
  9431. // Patch: Updates a notification. This method supports patch semantics.
  9432. func (r *NotificationsService) Patch(customer string, notificationId string, notification *Notification) *NotificationsPatchCall {
  9433. c := &NotificationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9434. c.customer = customer
  9435. c.notificationId = notificationId
  9436. c.notification = notification
  9437. return c
  9438. }
  9439. // Fields allows partial responses to be retrieved. See
  9440. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9441. // for more information.
  9442. func (c *NotificationsPatchCall) Fields(s ...googleapi.Field) *NotificationsPatchCall {
  9443. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9444. return c
  9445. }
  9446. // Context sets the context to be used in this call's Do method. Any
  9447. // pending HTTP request will be aborted if the provided context is
  9448. // canceled.
  9449. func (c *NotificationsPatchCall) Context(ctx context.Context) *NotificationsPatchCall {
  9450. c.ctx_ = ctx
  9451. return c
  9452. }
  9453. // Header returns an http.Header that can be modified by the caller to
  9454. // add HTTP headers to the request.
  9455. func (c *NotificationsPatchCall) Header() http.Header {
  9456. if c.header_ == nil {
  9457. c.header_ = make(http.Header)
  9458. }
  9459. return c.header_
  9460. }
  9461. func (c *NotificationsPatchCall) doRequest(alt string) (*http.Response, error) {
  9462. reqHeaders := make(http.Header)
  9463. for k, v := range c.header_ {
  9464. reqHeaders[k] = v
  9465. }
  9466. reqHeaders.Set("User-Agent", c.s.userAgent())
  9467. var body io.Reader = nil
  9468. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  9469. if err != nil {
  9470. return nil, err
  9471. }
  9472. reqHeaders.Set("Content-Type", "application/json")
  9473. c.urlParams_.Set("alt", alt)
  9474. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  9475. urls += "?" + c.urlParams_.Encode()
  9476. req, _ := http.NewRequest("PATCH", urls, body)
  9477. req.Header = reqHeaders
  9478. googleapi.Expand(req.URL, map[string]string{
  9479. "customer": c.customer,
  9480. "notificationId": c.notificationId,
  9481. })
  9482. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9483. }
  9484. // Do executes the "directory.notifications.patch" call.
  9485. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  9486. // status code is an error. Response headers are in either
  9487. // *Notification.ServerResponse.Header or (if a response was returned at
  9488. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9489. // to check whether the returned error was because
  9490. // http.StatusNotModified was returned.
  9491. func (c *NotificationsPatchCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  9492. gensupport.SetOptions(c.urlParams_, opts...)
  9493. res, err := c.doRequest("json")
  9494. if res != nil && res.StatusCode == http.StatusNotModified {
  9495. if res.Body != nil {
  9496. res.Body.Close()
  9497. }
  9498. return nil, &googleapi.Error{
  9499. Code: res.StatusCode,
  9500. Header: res.Header,
  9501. }
  9502. }
  9503. if err != nil {
  9504. return nil, err
  9505. }
  9506. defer googleapi.CloseBody(res)
  9507. if err := googleapi.CheckResponse(res); err != nil {
  9508. return nil, err
  9509. }
  9510. ret := &Notification{
  9511. ServerResponse: googleapi.ServerResponse{
  9512. Header: res.Header,
  9513. HTTPStatusCode: res.StatusCode,
  9514. },
  9515. }
  9516. target := &ret
  9517. if err := gensupport.DecodeResponse(target, res); err != nil {
  9518. return nil, err
  9519. }
  9520. return ret, nil
  9521. // {
  9522. // "description": "Updates a notification. This method supports patch semantics.",
  9523. // "httpMethod": "PATCH",
  9524. // "id": "directory.notifications.patch",
  9525. // "parameterOrder": [
  9526. // "customer",
  9527. // "notificationId"
  9528. // ],
  9529. // "parameters": {
  9530. // "customer": {
  9531. // "description": "The unique ID for the customer's G Suite account.",
  9532. // "location": "path",
  9533. // "required": true,
  9534. // "type": "string"
  9535. // },
  9536. // "notificationId": {
  9537. // "description": "The unique ID of the notification.",
  9538. // "location": "path",
  9539. // "required": true,
  9540. // "type": "string"
  9541. // }
  9542. // },
  9543. // "path": "customer/{customer}/notifications/{notificationId}",
  9544. // "request": {
  9545. // "$ref": "Notification"
  9546. // },
  9547. // "response": {
  9548. // "$ref": "Notification"
  9549. // },
  9550. // "scopes": [
  9551. // "https://www.googleapis.com/auth/admin.directory.notifications"
  9552. // ]
  9553. // }
  9554. }
  9555. // method id "directory.notifications.update":
  9556. type NotificationsUpdateCall struct {
  9557. s *Service
  9558. customer string
  9559. notificationId string
  9560. notification *Notification
  9561. urlParams_ gensupport.URLParams
  9562. ctx_ context.Context
  9563. header_ http.Header
  9564. }
  9565. // Update: Updates a notification.
  9566. func (r *NotificationsService) Update(customer string, notificationId string, notification *Notification) *NotificationsUpdateCall {
  9567. c := &NotificationsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9568. c.customer = customer
  9569. c.notificationId = notificationId
  9570. c.notification = notification
  9571. return c
  9572. }
  9573. // Fields allows partial responses to be retrieved. See
  9574. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9575. // for more information.
  9576. func (c *NotificationsUpdateCall) Fields(s ...googleapi.Field) *NotificationsUpdateCall {
  9577. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9578. return c
  9579. }
  9580. // Context sets the context to be used in this call's Do method. Any
  9581. // pending HTTP request will be aborted if the provided context is
  9582. // canceled.
  9583. func (c *NotificationsUpdateCall) Context(ctx context.Context) *NotificationsUpdateCall {
  9584. c.ctx_ = ctx
  9585. return c
  9586. }
  9587. // Header returns an http.Header that can be modified by the caller to
  9588. // add HTTP headers to the request.
  9589. func (c *NotificationsUpdateCall) Header() http.Header {
  9590. if c.header_ == nil {
  9591. c.header_ = make(http.Header)
  9592. }
  9593. return c.header_
  9594. }
  9595. func (c *NotificationsUpdateCall) doRequest(alt string) (*http.Response, error) {
  9596. reqHeaders := make(http.Header)
  9597. for k, v := range c.header_ {
  9598. reqHeaders[k] = v
  9599. }
  9600. reqHeaders.Set("User-Agent", c.s.userAgent())
  9601. var body io.Reader = nil
  9602. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  9603. if err != nil {
  9604. return nil, err
  9605. }
  9606. reqHeaders.Set("Content-Type", "application/json")
  9607. c.urlParams_.Set("alt", alt)
  9608. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/notifications/{notificationId}")
  9609. urls += "?" + c.urlParams_.Encode()
  9610. req, _ := http.NewRequest("PUT", urls, body)
  9611. req.Header = reqHeaders
  9612. googleapi.Expand(req.URL, map[string]string{
  9613. "customer": c.customer,
  9614. "notificationId": c.notificationId,
  9615. })
  9616. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9617. }
  9618. // Do executes the "directory.notifications.update" call.
  9619. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  9620. // status code is an error. Response headers are in either
  9621. // *Notification.ServerResponse.Header or (if a response was returned at
  9622. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9623. // to check whether the returned error was because
  9624. // http.StatusNotModified was returned.
  9625. func (c *NotificationsUpdateCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  9626. gensupport.SetOptions(c.urlParams_, opts...)
  9627. res, err := c.doRequest("json")
  9628. if res != nil && res.StatusCode == http.StatusNotModified {
  9629. if res.Body != nil {
  9630. res.Body.Close()
  9631. }
  9632. return nil, &googleapi.Error{
  9633. Code: res.StatusCode,
  9634. Header: res.Header,
  9635. }
  9636. }
  9637. if err != nil {
  9638. return nil, err
  9639. }
  9640. defer googleapi.CloseBody(res)
  9641. if err := googleapi.CheckResponse(res); err != nil {
  9642. return nil, err
  9643. }
  9644. ret := &Notification{
  9645. ServerResponse: googleapi.ServerResponse{
  9646. Header: res.Header,
  9647. HTTPStatusCode: res.StatusCode,
  9648. },
  9649. }
  9650. target := &ret
  9651. if err := gensupport.DecodeResponse(target, res); err != nil {
  9652. return nil, err
  9653. }
  9654. return ret, nil
  9655. // {
  9656. // "description": "Updates a notification.",
  9657. // "httpMethod": "PUT",
  9658. // "id": "directory.notifications.update",
  9659. // "parameterOrder": [
  9660. // "customer",
  9661. // "notificationId"
  9662. // ],
  9663. // "parameters": {
  9664. // "customer": {
  9665. // "description": "The unique ID for the customer's G Suite account.",
  9666. // "location": "path",
  9667. // "required": true,
  9668. // "type": "string"
  9669. // },
  9670. // "notificationId": {
  9671. // "description": "The unique ID of the notification.",
  9672. // "location": "path",
  9673. // "required": true,
  9674. // "type": "string"
  9675. // }
  9676. // },
  9677. // "path": "customer/{customer}/notifications/{notificationId}",
  9678. // "request": {
  9679. // "$ref": "Notification"
  9680. // },
  9681. // "response": {
  9682. // "$ref": "Notification"
  9683. // },
  9684. // "scopes": [
  9685. // "https://www.googleapis.com/auth/admin.directory.notifications"
  9686. // ]
  9687. // }
  9688. }
  9689. // method id "directory.orgunits.delete":
  9690. type OrgunitsDeleteCall struct {
  9691. s *Service
  9692. customerId string
  9693. orgUnitPath []string
  9694. urlParams_ gensupport.URLParams
  9695. ctx_ context.Context
  9696. header_ http.Header
  9697. }
  9698. // Delete: Remove organizational unit
  9699. func (r *OrgunitsService) Delete(customerId string, orgUnitPath []string) *OrgunitsDeleteCall {
  9700. c := &OrgunitsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9701. c.customerId = customerId
  9702. c.orgUnitPath = append([]string{}, orgUnitPath...)
  9703. return c
  9704. }
  9705. // Fields allows partial responses to be retrieved. See
  9706. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9707. // for more information.
  9708. func (c *OrgunitsDeleteCall) Fields(s ...googleapi.Field) *OrgunitsDeleteCall {
  9709. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9710. return c
  9711. }
  9712. // Context sets the context to be used in this call's Do method. Any
  9713. // pending HTTP request will be aborted if the provided context is
  9714. // canceled.
  9715. func (c *OrgunitsDeleteCall) Context(ctx context.Context) *OrgunitsDeleteCall {
  9716. c.ctx_ = ctx
  9717. return c
  9718. }
  9719. // Header returns an http.Header that can be modified by the caller to
  9720. // add HTTP headers to the request.
  9721. func (c *OrgunitsDeleteCall) Header() http.Header {
  9722. if c.header_ == nil {
  9723. c.header_ = make(http.Header)
  9724. }
  9725. return c.header_
  9726. }
  9727. func (c *OrgunitsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9728. reqHeaders := make(http.Header)
  9729. for k, v := range c.header_ {
  9730. reqHeaders[k] = v
  9731. }
  9732. reqHeaders.Set("User-Agent", c.s.userAgent())
  9733. var body io.Reader = nil
  9734. c.urlParams_.Set("alt", alt)
  9735. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  9736. urls += "?" + c.urlParams_.Encode()
  9737. req, _ := http.NewRequest("DELETE", urls, body)
  9738. req.Header = reqHeaders
  9739. googleapi.Expand(req.URL, map[string]string{
  9740. "customerId": c.customerId,
  9741. "orgUnitPath": c.orgUnitPath[0],
  9742. })
  9743. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9744. }
  9745. // Do executes the "directory.orgunits.delete" call.
  9746. func (c *OrgunitsDeleteCall) Do(opts ...googleapi.CallOption) error {
  9747. gensupport.SetOptions(c.urlParams_, opts...)
  9748. res, err := c.doRequest("json")
  9749. if err != nil {
  9750. return err
  9751. }
  9752. defer googleapi.CloseBody(res)
  9753. if err := googleapi.CheckResponse(res); err != nil {
  9754. return err
  9755. }
  9756. return nil
  9757. // {
  9758. // "description": "Remove organizational unit",
  9759. // "httpMethod": "DELETE",
  9760. // "id": "directory.orgunits.delete",
  9761. // "parameterOrder": [
  9762. // "customerId",
  9763. // "orgUnitPath"
  9764. // ],
  9765. // "parameters": {
  9766. // "customerId": {
  9767. // "description": "Immutable ID of the G Suite account",
  9768. // "location": "path",
  9769. // "required": true,
  9770. // "type": "string"
  9771. // },
  9772. // "orgUnitPath": {
  9773. // "description": "Full path of the organizational unit or its ID",
  9774. // "location": "path",
  9775. // "repeated": true,
  9776. // "required": true,
  9777. // "type": "string"
  9778. // }
  9779. // },
  9780. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  9781. // "scopes": [
  9782. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  9783. // ]
  9784. // }
  9785. }
  9786. // method id "directory.orgunits.get":
  9787. type OrgunitsGetCall struct {
  9788. s *Service
  9789. customerId string
  9790. orgUnitPath []string
  9791. urlParams_ gensupport.URLParams
  9792. ifNoneMatch_ string
  9793. ctx_ context.Context
  9794. header_ http.Header
  9795. }
  9796. // Get: Retrieve organizational unit
  9797. func (r *OrgunitsService) Get(customerId string, orgUnitPath []string) *OrgunitsGetCall {
  9798. c := &OrgunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9799. c.customerId = customerId
  9800. c.orgUnitPath = append([]string{}, orgUnitPath...)
  9801. return c
  9802. }
  9803. // Fields allows partial responses to be retrieved. See
  9804. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9805. // for more information.
  9806. func (c *OrgunitsGetCall) Fields(s ...googleapi.Field) *OrgunitsGetCall {
  9807. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9808. return c
  9809. }
  9810. // IfNoneMatch sets the optional parameter which makes the operation
  9811. // fail if the object's ETag matches the given value. This is useful for
  9812. // getting updates only after the object has changed since the last
  9813. // request. Use googleapi.IsNotModified to check whether the response
  9814. // error from Do is the result of In-None-Match.
  9815. func (c *OrgunitsGetCall) IfNoneMatch(entityTag string) *OrgunitsGetCall {
  9816. c.ifNoneMatch_ = entityTag
  9817. return c
  9818. }
  9819. // Context sets the context to be used in this call's Do method. Any
  9820. // pending HTTP request will be aborted if the provided context is
  9821. // canceled.
  9822. func (c *OrgunitsGetCall) Context(ctx context.Context) *OrgunitsGetCall {
  9823. c.ctx_ = ctx
  9824. return c
  9825. }
  9826. // Header returns an http.Header that can be modified by the caller to
  9827. // add HTTP headers to the request.
  9828. func (c *OrgunitsGetCall) Header() http.Header {
  9829. if c.header_ == nil {
  9830. c.header_ = make(http.Header)
  9831. }
  9832. return c.header_
  9833. }
  9834. func (c *OrgunitsGetCall) doRequest(alt string) (*http.Response, error) {
  9835. reqHeaders := make(http.Header)
  9836. for k, v := range c.header_ {
  9837. reqHeaders[k] = v
  9838. }
  9839. reqHeaders.Set("User-Agent", c.s.userAgent())
  9840. if c.ifNoneMatch_ != "" {
  9841. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9842. }
  9843. var body io.Reader = nil
  9844. c.urlParams_.Set("alt", alt)
  9845. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  9846. urls += "?" + c.urlParams_.Encode()
  9847. req, _ := http.NewRequest("GET", urls, body)
  9848. req.Header = reqHeaders
  9849. googleapi.Expand(req.URL, map[string]string{
  9850. "customerId": c.customerId,
  9851. "orgUnitPath": c.orgUnitPath[0],
  9852. })
  9853. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9854. }
  9855. // Do executes the "directory.orgunits.get" call.
  9856. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  9857. // code is an error. Response headers are in either
  9858. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  9859. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9860. // check whether the returned error was because http.StatusNotModified
  9861. // was returned.
  9862. func (c *OrgunitsGetCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  9863. gensupport.SetOptions(c.urlParams_, opts...)
  9864. res, err := c.doRequest("json")
  9865. if res != nil && res.StatusCode == http.StatusNotModified {
  9866. if res.Body != nil {
  9867. res.Body.Close()
  9868. }
  9869. return nil, &googleapi.Error{
  9870. Code: res.StatusCode,
  9871. Header: res.Header,
  9872. }
  9873. }
  9874. if err != nil {
  9875. return nil, err
  9876. }
  9877. defer googleapi.CloseBody(res)
  9878. if err := googleapi.CheckResponse(res); err != nil {
  9879. return nil, err
  9880. }
  9881. ret := &OrgUnit{
  9882. ServerResponse: googleapi.ServerResponse{
  9883. Header: res.Header,
  9884. HTTPStatusCode: res.StatusCode,
  9885. },
  9886. }
  9887. target := &ret
  9888. if err := gensupport.DecodeResponse(target, res); err != nil {
  9889. return nil, err
  9890. }
  9891. return ret, nil
  9892. // {
  9893. // "description": "Retrieve organizational unit",
  9894. // "httpMethod": "GET",
  9895. // "id": "directory.orgunits.get",
  9896. // "parameterOrder": [
  9897. // "customerId",
  9898. // "orgUnitPath"
  9899. // ],
  9900. // "parameters": {
  9901. // "customerId": {
  9902. // "description": "Immutable ID of the G Suite account",
  9903. // "location": "path",
  9904. // "required": true,
  9905. // "type": "string"
  9906. // },
  9907. // "orgUnitPath": {
  9908. // "description": "Full path of the organizational unit or its ID",
  9909. // "location": "path",
  9910. // "repeated": true,
  9911. // "required": true,
  9912. // "type": "string"
  9913. // }
  9914. // },
  9915. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  9916. // "response": {
  9917. // "$ref": "OrgUnit"
  9918. // },
  9919. // "scopes": [
  9920. // "https://www.googleapis.com/auth/admin.directory.orgunit",
  9921. // "https://www.googleapis.com/auth/admin.directory.orgunit.readonly"
  9922. // ]
  9923. // }
  9924. }
  9925. // method id "directory.orgunits.insert":
  9926. type OrgunitsInsertCall struct {
  9927. s *Service
  9928. customerId string
  9929. orgunit *OrgUnit
  9930. urlParams_ gensupport.URLParams
  9931. ctx_ context.Context
  9932. header_ http.Header
  9933. }
  9934. // Insert: Add organizational unit
  9935. func (r *OrgunitsService) Insert(customerId string, orgunit *OrgUnit) *OrgunitsInsertCall {
  9936. c := &OrgunitsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9937. c.customerId = customerId
  9938. c.orgunit = orgunit
  9939. return c
  9940. }
  9941. // Fields allows partial responses to be retrieved. See
  9942. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9943. // for more information.
  9944. func (c *OrgunitsInsertCall) Fields(s ...googleapi.Field) *OrgunitsInsertCall {
  9945. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9946. return c
  9947. }
  9948. // Context sets the context to be used in this call's Do method. Any
  9949. // pending HTTP request will be aborted if the provided context is
  9950. // canceled.
  9951. func (c *OrgunitsInsertCall) Context(ctx context.Context) *OrgunitsInsertCall {
  9952. c.ctx_ = ctx
  9953. return c
  9954. }
  9955. // Header returns an http.Header that can be modified by the caller to
  9956. // add HTTP headers to the request.
  9957. func (c *OrgunitsInsertCall) Header() http.Header {
  9958. if c.header_ == nil {
  9959. c.header_ = make(http.Header)
  9960. }
  9961. return c.header_
  9962. }
  9963. func (c *OrgunitsInsertCall) doRequest(alt string) (*http.Response, error) {
  9964. reqHeaders := make(http.Header)
  9965. for k, v := range c.header_ {
  9966. reqHeaders[k] = v
  9967. }
  9968. reqHeaders.Set("User-Agent", c.s.userAgent())
  9969. var body io.Reader = nil
  9970. body, err := googleapi.WithoutDataWrapper.JSONReader(c.orgunit)
  9971. if err != nil {
  9972. return nil, err
  9973. }
  9974. reqHeaders.Set("Content-Type", "application/json")
  9975. c.urlParams_.Set("alt", alt)
  9976. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits")
  9977. urls += "?" + c.urlParams_.Encode()
  9978. req, _ := http.NewRequest("POST", urls, body)
  9979. req.Header = reqHeaders
  9980. googleapi.Expand(req.URL, map[string]string{
  9981. "customerId": c.customerId,
  9982. })
  9983. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9984. }
  9985. // Do executes the "directory.orgunits.insert" call.
  9986. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  9987. // code is an error. Response headers are in either
  9988. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  9989. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9990. // check whether the returned error was because http.StatusNotModified
  9991. // was returned.
  9992. func (c *OrgunitsInsertCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  9993. gensupport.SetOptions(c.urlParams_, opts...)
  9994. res, err := c.doRequest("json")
  9995. if res != nil && res.StatusCode == http.StatusNotModified {
  9996. if res.Body != nil {
  9997. res.Body.Close()
  9998. }
  9999. return nil, &googleapi.Error{
  10000. Code: res.StatusCode,
  10001. Header: res.Header,
  10002. }
  10003. }
  10004. if err != nil {
  10005. return nil, err
  10006. }
  10007. defer googleapi.CloseBody(res)
  10008. if err := googleapi.CheckResponse(res); err != nil {
  10009. return nil, err
  10010. }
  10011. ret := &OrgUnit{
  10012. ServerResponse: googleapi.ServerResponse{
  10013. Header: res.Header,
  10014. HTTPStatusCode: res.StatusCode,
  10015. },
  10016. }
  10017. target := &ret
  10018. if err := gensupport.DecodeResponse(target, res); err != nil {
  10019. return nil, err
  10020. }
  10021. return ret, nil
  10022. // {
  10023. // "description": "Add organizational unit",
  10024. // "httpMethod": "POST",
  10025. // "id": "directory.orgunits.insert",
  10026. // "parameterOrder": [
  10027. // "customerId"
  10028. // ],
  10029. // "parameters": {
  10030. // "customerId": {
  10031. // "description": "Immutable ID of the G Suite account",
  10032. // "location": "path",
  10033. // "required": true,
  10034. // "type": "string"
  10035. // }
  10036. // },
  10037. // "path": "customer/{customerId}/orgunits",
  10038. // "request": {
  10039. // "$ref": "OrgUnit"
  10040. // },
  10041. // "response": {
  10042. // "$ref": "OrgUnit"
  10043. // },
  10044. // "scopes": [
  10045. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  10046. // ]
  10047. // }
  10048. }
  10049. // method id "directory.orgunits.list":
  10050. type OrgunitsListCall struct {
  10051. s *Service
  10052. customerId string
  10053. urlParams_ gensupport.URLParams
  10054. ifNoneMatch_ string
  10055. ctx_ context.Context
  10056. header_ http.Header
  10057. }
  10058. // List: Retrieve all organizational units
  10059. func (r *OrgunitsService) List(customerId string) *OrgunitsListCall {
  10060. c := &OrgunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10061. c.customerId = customerId
  10062. return c
  10063. }
  10064. // OrgUnitPath sets the optional parameter "orgUnitPath": the
  10065. // URL-encoded organizational unit's path or its ID
  10066. func (c *OrgunitsListCall) OrgUnitPath(orgUnitPath string) *OrgunitsListCall {
  10067. c.urlParams_.Set("orgUnitPath", orgUnitPath)
  10068. return c
  10069. }
  10070. // Type sets the optional parameter "type": Whether to return all
  10071. // sub-organizations or just immediate children
  10072. //
  10073. // Possible values:
  10074. // "all" - All sub-organizational units.
  10075. // "children" - Immediate children only (default).
  10076. func (c *OrgunitsListCall) Type(type_ string) *OrgunitsListCall {
  10077. c.urlParams_.Set("type", type_)
  10078. return c
  10079. }
  10080. // Fields allows partial responses to be retrieved. See
  10081. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10082. // for more information.
  10083. func (c *OrgunitsListCall) Fields(s ...googleapi.Field) *OrgunitsListCall {
  10084. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10085. return c
  10086. }
  10087. // IfNoneMatch sets the optional parameter which makes the operation
  10088. // fail if the object's ETag matches the given value. This is useful for
  10089. // getting updates only after the object has changed since the last
  10090. // request. Use googleapi.IsNotModified to check whether the response
  10091. // error from Do is the result of In-None-Match.
  10092. func (c *OrgunitsListCall) IfNoneMatch(entityTag string) *OrgunitsListCall {
  10093. c.ifNoneMatch_ = entityTag
  10094. return c
  10095. }
  10096. // Context sets the context to be used in this call's Do method. Any
  10097. // pending HTTP request will be aborted if the provided context is
  10098. // canceled.
  10099. func (c *OrgunitsListCall) Context(ctx context.Context) *OrgunitsListCall {
  10100. c.ctx_ = ctx
  10101. return c
  10102. }
  10103. // Header returns an http.Header that can be modified by the caller to
  10104. // add HTTP headers to the request.
  10105. func (c *OrgunitsListCall) Header() http.Header {
  10106. if c.header_ == nil {
  10107. c.header_ = make(http.Header)
  10108. }
  10109. return c.header_
  10110. }
  10111. func (c *OrgunitsListCall) doRequest(alt string) (*http.Response, error) {
  10112. reqHeaders := make(http.Header)
  10113. for k, v := range c.header_ {
  10114. reqHeaders[k] = v
  10115. }
  10116. reqHeaders.Set("User-Agent", c.s.userAgent())
  10117. if c.ifNoneMatch_ != "" {
  10118. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10119. }
  10120. var body io.Reader = nil
  10121. c.urlParams_.Set("alt", alt)
  10122. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits")
  10123. urls += "?" + c.urlParams_.Encode()
  10124. req, _ := http.NewRequest("GET", urls, body)
  10125. req.Header = reqHeaders
  10126. googleapi.Expand(req.URL, map[string]string{
  10127. "customerId": c.customerId,
  10128. })
  10129. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10130. }
  10131. // Do executes the "directory.orgunits.list" call.
  10132. // Exactly one of *OrgUnits or error will be non-nil. Any non-2xx status
  10133. // code is an error. Response headers are in either
  10134. // *OrgUnits.ServerResponse.Header or (if a response was returned at
  10135. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10136. // to check whether the returned error was because
  10137. // http.StatusNotModified was returned.
  10138. func (c *OrgunitsListCall) Do(opts ...googleapi.CallOption) (*OrgUnits, error) {
  10139. gensupport.SetOptions(c.urlParams_, opts...)
  10140. res, err := c.doRequest("json")
  10141. if res != nil && res.StatusCode == http.StatusNotModified {
  10142. if res.Body != nil {
  10143. res.Body.Close()
  10144. }
  10145. return nil, &googleapi.Error{
  10146. Code: res.StatusCode,
  10147. Header: res.Header,
  10148. }
  10149. }
  10150. if err != nil {
  10151. return nil, err
  10152. }
  10153. defer googleapi.CloseBody(res)
  10154. if err := googleapi.CheckResponse(res); err != nil {
  10155. return nil, err
  10156. }
  10157. ret := &OrgUnits{
  10158. ServerResponse: googleapi.ServerResponse{
  10159. Header: res.Header,
  10160. HTTPStatusCode: res.StatusCode,
  10161. },
  10162. }
  10163. target := &ret
  10164. if err := gensupport.DecodeResponse(target, res); err != nil {
  10165. return nil, err
  10166. }
  10167. return ret, nil
  10168. // {
  10169. // "description": "Retrieve all organizational units",
  10170. // "httpMethod": "GET",
  10171. // "id": "directory.orgunits.list",
  10172. // "parameterOrder": [
  10173. // "customerId"
  10174. // ],
  10175. // "parameters": {
  10176. // "customerId": {
  10177. // "description": "Immutable ID of the G Suite account",
  10178. // "location": "path",
  10179. // "required": true,
  10180. // "type": "string"
  10181. // },
  10182. // "orgUnitPath": {
  10183. // "default": "",
  10184. // "description": "the URL-encoded organizational unit's path or its ID",
  10185. // "location": "query",
  10186. // "type": "string"
  10187. // },
  10188. // "type": {
  10189. // "description": "Whether to return all sub-organizations or just immediate children",
  10190. // "enum": [
  10191. // "all",
  10192. // "children"
  10193. // ],
  10194. // "enumDescriptions": [
  10195. // "All sub-organizational units.",
  10196. // "Immediate children only (default)."
  10197. // ],
  10198. // "location": "query",
  10199. // "type": "string"
  10200. // }
  10201. // },
  10202. // "path": "customer/{customerId}/orgunits",
  10203. // "response": {
  10204. // "$ref": "OrgUnits"
  10205. // },
  10206. // "scopes": [
  10207. // "https://www.googleapis.com/auth/admin.directory.orgunit",
  10208. // "https://www.googleapis.com/auth/admin.directory.orgunit.readonly"
  10209. // ]
  10210. // }
  10211. }
  10212. // method id "directory.orgunits.patch":
  10213. type OrgunitsPatchCall struct {
  10214. s *Service
  10215. customerId string
  10216. orgUnitPath []string
  10217. orgunit *OrgUnit
  10218. urlParams_ gensupport.URLParams
  10219. ctx_ context.Context
  10220. header_ http.Header
  10221. }
  10222. // Patch: Update organizational unit. This method supports patch
  10223. // semantics.
  10224. func (r *OrgunitsService) Patch(customerId string, orgUnitPath []string, orgunit *OrgUnit) *OrgunitsPatchCall {
  10225. c := &OrgunitsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10226. c.customerId = customerId
  10227. c.orgUnitPath = append([]string{}, orgUnitPath...)
  10228. c.orgunit = orgunit
  10229. return c
  10230. }
  10231. // Fields allows partial responses to be retrieved. See
  10232. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10233. // for more information.
  10234. func (c *OrgunitsPatchCall) Fields(s ...googleapi.Field) *OrgunitsPatchCall {
  10235. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10236. return c
  10237. }
  10238. // Context sets the context to be used in this call's Do method. Any
  10239. // pending HTTP request will be aborted if the provided context is
  10240. // canceled.
  10241. func (c *OrgunitsPatchCall) Context(ctx context.Context) *OrgunitsPatchCall {
  10242. c.ctx_ = ctx
  10243. return c
  10244. }
  10245. // Header returns an http.Header that can be modified by the caller to
  10246. // add HTTP headers to the request.
  10247. func (c *OrgunitsPatchCall) Header() http.Header {
  10248. if c.header_ == nil {
  10249. c.header_ = make(http.Header)
  10250. }
  10251. return c.header_
  10252. }
  10253. func (c *OrgunitsPatchCall) doRequest(alt string) (*http.Response, error) {
  10254. reqHeaders := make(http.Header)
  10255. for k, v := range c.header_ {
  10256. reqHeaders[k] = v
  10257. }
  10258. reqHeaders.Set("User-Agent", c.s.userAgent())
  10259. var body io.Reader = nil
  10260. body, err := googleapi.WithoutDataWrapper.JSONReader(c.orgunit)
  10261. if err != nil {
  10262. return nil, err
  10263. }
  10264. reqHeaders.Set("Content-Type", "application/json")
  10265. c.urlParams_.Set("alt", alt)
  10266. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  10267. urls += "?" + c.urlParams_.Encode()
  10268. req, _ := http.NewRequest("PATCH", urls, body)
  10269. req.Header = reqHeaders
  10270. googleapi.Expand(req.URL, map[string]string{
  10271. "customerId": c.customerId,
  10272. "orgUnitPath": c.orgUnitPath[0],
  10273. })
  10274. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10275. }
  10276. // Do executes the "directory.orgunits.patch" call.
  10277. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  10278. // code is an error. Response headers are in either
  10279. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  10280. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10281. // check whether the returned error was because http.StatusNotModified
  10282. // was returned.
  10283. func (c *OrgunitsPatchCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  10284. gensupport.SetOptions(c.urlParams_, opts...)
  10285. res, err := c.doRequest("json")
  10286. if res != nil && res.StatusCode == http.StatusNotModified {
  10287. if res.Body != nil {
  10288. res.Body.Close()
  10289. }
  10290. return nil, &googleapi.Error{
  10291. Code: res.StatusCode,
  10292. Header: res.Header,
  10293. }
  10294. }
  10295. if err != nil {
  10296. return nil, err
  10297. }
  10298. defer googleapi.CloseBody(res)
  10299. if err := googleapi.CheckResponse(res); err != nil {
  10300. return nil, err
  10301. }
  10302. ret := &OrgUnit{
  10303. ServerResponse: googleapi.ServerResponse{
  10304. Header: res.Header,
  10305. HTTPStatusCode: res.StatusCode,
  10306. },
  10307. }
  10308. target := &ret
  10309. if err := gensupport.DecodeResponse(target, res); err != nil {
  10310. return nil, err
  10311. }
  10312. return ret, nil
  10313. // {
  10314. // "description": "Update organizational unit. This method supports patch semantics.",
  10315. // "httpMethod": "PATCH",
  10316. // "id": "directory.orgunits.patch",
  10317. // "parameterOrder": [
  10318. // "customerId",
  10319. // "orgUnitPath"
  10320. // ],
  10321. // "parameters": {
  10322. // "customerId": {
  10323. // "description": "Immutable ID of the G Suite account",
  10324. // "location": "path",
  10325. // "required": true,
  10326. // "type": "string"
  10327. // },
  10328. // "orgUnitPath": {
  10329. // "description": "Full path of the organizational unit or its ID",
  10330. // "location": "path",
  10331. // "repeated": true,
  10332. // "required": true,
  10333. // "type": "string"
  10334. // }
  10335. // },
  10336. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  10337. // "request": {
  10338. // "$ref": "OrgUnit"
  10339. // },
  10340. // "response": {
  10341. // "$ref": "OrgUnit"
  10342. // },
  10343. // "scopes": [
  10344. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  10345. // ]
  10346. // }
  10347. }
  10348. // method id "directory.orgunits.update":
  10349. type OrgunitsUpdateCall struct {
  10350. s *Service
  10351. customerId string
  10352. orgUnitPath []string
  10353. orgunit *OrgUnit
  10354. urlParams_ gensupport.URLParams
  10355. ctx_ context.Context
  10356. header_ http.Header
  10357. }
  10358. // Update: Update organizational unit
  10359. func (r *OrgunitsService) Update(customerId string, orgUnitPath []string, orgunit *OrgUnit) *OrgunitsUpdateCall {
  10360. c := &OrgunitsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10361. c.customerId = customerId
  10362. c.orgUnitPath = append([]string{}, orgUnitPath...)
  10363. c.orgunit = orgunit
  10364. return c
  10365. }
  10366. // Fields allows partial responses to be retrieved. See
  10367. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10368. // for more information.
  10369. func (c *OrgunitsUpdateCall) Fields(s ...googleapi.Field) *OrgunitsUpdateCall {
  10370. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10371. return c
  10372. }
  10373. // Context sets the context to be used in this call's Do method. Any
  10374. // pending HTTP request will be aborted if the provided context is
  10375. // canceled.
  10376. func (c *OrgunitsUpdateCall) Context(ctx context.Context) *OrgunitsUpdateCall {
  10377. c.ctx_ = ctx
  10378. return c
  10379. }
  10380. // Header returns an http.Header that can be modified by the caller to
  10381. // add HTTP headers to the request.
  10382. func (c *OrgunitsUpdateCall) Header() http.Header {
  10383. if c.header_ == nil {
  10384. c.header_ = make(http.Header)
  10385. }
  10386. return c.header_
  10387. }
  10388. func (c *OrgunitsUpdateCall) doRequest(alt string) (*http.Response, error) {
  10389. reqHeaders := make(http.Header)
  10390. for k, v := range c.header_ {
  10391. reqHeaders[k] = v
  10392. }
  10393. reqHeaders.Set("User-Agent", c.s.userAgent())
  10394. var body io.Reader = nil
  10395. body, err := googleapi.WithoutDataWrapper.JSONReader(c.orgunit)
  10396. if err != nil {
  10397. return nil, err
  10398. }
  10399. reqHeaders.Set("Content-Type", "application/json")
  10400. c.urlParams_.Set("alt", alt)
  10401. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/orgunits{/orgUnitPath*}")
  10402. urls += "?" + c.urlParams_.Encode()
  10403. req, _ := http.NewRequest("PUT", urls, body)
  10404. req.Header = reqHeaders
  10405. googleapi.Expand(req.URL, map[string]string{
  10406. "customerId": c.customerId,
  10407. "orgUnitPath": c.orgUnitPath[0],
  10408. })
  10409. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10410. }
  10411. // Do executes the "directory.orgunits.update" call.
  10412. // Exactly one of *OrgUnit or error will be non-nil. Any non-2xx status
  10413. // code is an error. Response headers are in either
  10414. // *OrgUnit.ServerResponse.Header or (if a response was returned at all)
  10415. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10416. // check whether the returned error was because http.StatusNotModified
  10417. // was returned.
  10418. func (c *OrgunitsUpdateCall) Do(opts ...googleapi.CallOption) (*OrgUnit, error) {
  10419. gensupport.SetOptions(c.urlParams_, opts...)
  10420. res, err := c.doRequest("json")
  10421. if res != nil && res.StatusCode == http.StatusNotModified {
  10422. if res.Body != nil {
  10423. res.Body.Close()
  10424. }
  10425. return nil, &googleapi.Error{
  10426. Code: res.StatusCode,
  10427. Header: res.Header,
  10428. }
  10429. }
  10430. if err != nil {
  10431. return nil, err
  10432. }
  10433. defer googleapi.CloseBody(res)
  10434. if err := googleapi.CheckResponse(res); err != nil {
  10435. return nil, err
  10436. }
  10437. ret := &OrgUnit{
  10438. ServerResponse: googleapi.ServerResponse{
  10439. Header: res.Header,
  10440. HTTPStatusCode: res.StatusCode,
  10441. },
  10442. }
  10443. target := &ret
  10444. if err := gensupport.DecodeResponse(target, res); err != nil {
  10445. return nil, err
  10446. }
  10447. return ret, nil
  10448. // {
  10449. // "description": "Update organizational unit",
  10450. // "httpMethod": "PUT",
  10451. // "id": "directory.orgunits.update",
  10452. // "parameterOrder": [
  10453. // "customerId",
  10454. // "orgUnitPath"
  10455. // ],
  10456. // "parameters": {
  10457. // "customerId": {
  10458. // "description": "Immutable ID of the G Suite account",
  10459. // "location": "path",
  10460. // "required": true,
  10461. // "type": "string"
  10462. // },
  10463. // "orgUnitPath": {
  10464. // "description": "Full path of the organizational unit or its ID",
  10465. // "location": "path",
  10466. // "repeated": true,
  10467. // "required": true,
  10468. // "type": "string"
  10469. // }
  10470. // },
  10471. // "path": "customer/{customerId}/orgunits{/orgUnitPath*}",
  10472. // "request": {
  10473. // "$ref": "OrgUnit"
  10474. // },
  10475. // "response": {
  10476. // "$ref": "OrgUnit"
  10477. // },
  10478. // "scopes": [
  10479. // "https://www.googleapis.com/auth/admin.directory.orgunit"
  10480. // ]
  10481. // }
  10482. }
  10483. // method id "directory.privileges.list":
  10484. type PrivilegesListCall struct {
  10485. s *Service
  10486. customer string
  10487. urlParams_ gensupport.URLParams
  10488. ifNoneMatch_ string
  10489. ctx_ context.Context
  10490. header_ http.Header
  10491. }
  10492. // List: Retrieves a paginated list of all privileges for a customer.
  10493. func (r *PrivilegesService) List(customer string) *PrivilegesListCall {
  10494. c := &PrivilegesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10495. c.customer = customer
  10496. return c
  10497. }
  10498. // Fields allows partial responses to be retrieved. See
  10499. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10500. // for more information.
  10501. func (c *PrivilegesListCall) Fields(s ...googleapi.Field) *PrivilegesListCall {
  10502. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10503. return c
  10504. }
  10505. // IfNoneMatch sets the optional parameter which makes the operation
  10506. // fail if the object's ETag matches the given value. This is useful for
  10507. // getting updates only after the object has changed since the last
  10508. // request. Use googleapi.IsNotModified to check whether the response
  10509. // error from Do is the result of In-None-Match.
  10510. func (c *PrivilegesListCall) IfNoneMatch(entityTag string) *PrivilegesListCall {
  10511. c.ifNoneMatch_ = entityTag
  10512. return c
  10513. }
  10514. // Context sets the context to be used in this call's Do method. Any
  10515. // pending HTTP request will be aborted if the provided context is
  10516. // canceled.
  10517. func (c *PrivilegesListCall) Context(ctx context.Context) *PrivilegesListCall {
  10518. c.ctx_ = ctx
  10519. return c
  10520. }
  10521. // Header returns an http.Header that can be modified by the caller to
  10522. // add HTTP headers to the request.
  10523. func (c *PrivilegesListCall) Header() http.Header {
  10524. if c.header_ == nil {
  10525. c.header_ = make(http.Header)
  10526. }
  10527. return c.header_
  10528. }
  10529. func (c *PrivilegesListCall) doRequest(alt string) (*http.Response, error) {
  10530. reqHeaders := make(http.Header)
  10531. for k, v := range c.header_ {
  10532. reqHeaders[k] = v
  10533. }
  10534. reqHeaders.Set("User-Agent", c.s.userAgent())
  10535. if c.ifNoneMatch_ != "" {
  10536. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10537. }
  10538. var body io.Reader = nil
  10539. c.urlParams_.Set("alt", alt)
  10540. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/ALL/privileges")
  10541. urls += "?" + c.urlParams_.Encode()
  10542. req, _ := http.NewRequest("GET", urls, body)
  10543. req.Header = reqHeaders
  10544. googleapi.Expand(req.URL, map[string]string{
  10545. "customer": c.customer,
  10546. })
  10547. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10548. }
  10549. // Do executes the "directory.privileges.list" call.
  10550. // Exactly one of *Privileges or error will be non-nil. Any non-2xx
  10551. // status code is an error. Response headers are in either
  10552. // *Privileges.ServerResponse.Header or (if a response was returned at
  10553. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10554. // to check whether the returned error was because
  10555. // http.StatusNotModified was returned.
  10556. func (c *PrivilegesListCall) Do(opts ...googleapi.CallOption) (*Privileges, error) {
  10557. gensupport.SetOptions(c.urlParams_, opts...)
  10558. res, err := c.doRequest("json")
  10559. if res != nil && res.StatusCode == http.StatusNotModified {
  10560. if res.Body != nil {
  10561. res.Body.Close()
  10562. }
  10563. return nil, &googleapi.Error{
  10564. Code: res.StatusCode,
  10565. Header: res.Header,
  10566. }
  10567. }
  10568. if err != nil {
  10569. return nil, err
  10570. }
  10571. defer googleapi.CloseBody(res)
  10572. if err := googleapi.CheckResponse(res); err != nil {
  10573. return nil, err
  10574. }
  10575. ret := &Privileges{
  10576. ServerResponse: googleapi.ServerResponse{
  10577. Header: res.Header,
  10578. HTTPStatusCode: res.StatusCode,
  10579. },
  10580. }
  10581. target := &ret
  10582. if err := gensupport.DecodeResponse(target, res); err != nil {
  10583. return nil, err
  10584. }
  10585. return ret, nil
  10586. // {
  10587. // "description": "Retrieves a paginated list of all privileges for a customer.",
  10588. // "httpMethod": "GET",
  10589. // "id": "directory.privileges.list",
  10590. // "parameterOrder": [
  10591. // "customer"
  10592. // ],
  10593. // "parameters": {
  10594. // "customer": {
  10595. // "description": "Immutable ID of the G Suite account.",
  10596. // "location": "path",
  10597. // "required": true,
  10598. // "type": "string"
  10599. // }
  10600. // },
  10601. // "path": "customer/{customer}/roles/ALL/privileges",
  10602. // "response": {
  10603. // "$ref": "Privileges"
  10604. // },
  10605. // "scopes": [
  10606. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  10607. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  10608. // ]
  10609. // }
  10610. }
  10611. // method id "directory.resolvedAppAccessSettings.GetSettings":
  10612. type ResolvedAppAccessSettingsGetSettingsCall struct {
  10613. s *Service
  10614. urlParams_ gensupport.URLParams
  10615. ifNoneMatch_ string
  10616. ctx_ context.Context
  10617. header_ http.Header
  10618. }
  10619. // GetSettings: Retrieves resolved app access settings of the logged in
  10620. // user.
  10621. func (r *ResolvedAppAccessSettingsService) GetSettings() *ResolvedAppAccessSettingsGetSettingsCall {
  10622. c := &ResolvedAppAccessSettingsGetSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10623. return c
  10624. }
  10625. // Fields allows partial responses to be retrieved. See
  10626. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10627. // for more information.
  10628. func (c *ResolvedAppAccessSettingsGetSettingsCall) Fields(s ...googleapi.Field) *ResolvedAppAccessSettingsGetSettingsCall {
  10629. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10630. return c
  10631. }
  10632. // IfNoneMatch sets the optional parameter which makes the operation
  10633. // fail if the object's ETag matches the given value. This is useful for
  10634. // getting updates only after the object has changed since the last
  10635. // request. Use googleapi.IsNotModified to check whether the response
  10636. // error from Do is the result of In-None-Match.
  10637. func (c *ResolvedAppAccessSettingsGetSettingsCall) IfNoneMatch(entityTag string) *ResolvedAppAccessSettingsGetSettingsCall {
  10638. c.ifNoneMatch_ = entityTag
  10639. return c
  10640. }
  10641. // Context sets the context to be used in this call's Do method. Any
  10642. // pending HTTP request will be aborted if the provided context is
  10643. // canceled.
  10644. func (c *ResolvedAppAccessSettingsGetSettingsCall) Context(ctx context.Context) *ResolvedAppAccessSettingsGetSettingsCall {
  10645. c.ctx_ = ctx
  10646. return c
  10647. }
  10648. // Header returns an http.Header that can be modified by the caller to
  10649. // add HTTP headers to the request.
  10650. func (c *ResolvedAppAccessSettingsGetSettingsCall) Header() http.Header {
  10651. if c.header_ == nil {
  10652. c.header_ = make(http.Header)
  10653. }
  10654. return c.header_
  10655. }
  10656. func (c *ResolvedAppAccessSettingsGetSettingsCall) doRequest(alt string) (*http.Response, error) {
  10657. reqHeaders := make(http.Header)
  10658. for k, v := range c.header_ {
  10659. reqHeaders[k] = v
  10660. }
  10661. reqHeaders.Set("User-Agent", c.s.userAgent())
  10662. if c.ifNoneMatch_ != "" {
  10663. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10664. }
  10665. var body io.Reader = nil
  10666. c.urlParams_.Set("alt", alt)
  10667. urls := googleapi.ResolveRelative(c.s.BasePath, "resolvedappaccesssettings")
  10668. urls += "?" + c.urlParams_.Encode()
  10669. req, _ := http.NewRequest("GET", urls, body)
  10670. req.Header = reqHeaders
  10671. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10672. }
  10673. // Do executes the "directory.resolvedAppAccessSettings.GetSettings" call.
  10674. // Exactly one of *AppAccessCollections or error will be non-nil. Any
  10675. // non-2xx status code is an error. Response headers are in either
  10676. // *AppAccessCollections.ServerResponse.Header or (if a response was
  10677. // returned at all) in error.(*googleapi.Error).Header. Use
  10678. // googleapi.IsNotModified to check whether the returned error was
  10679. // because http.StatusNotModified was returned.
  10680. func (c *ResolvedAppAccessSettingsGetSettingsCall) Do(opts ...googleapi.CallOption) (*AppAccessCollections, error) {
  10681. gensupport.SetOptions(c.urlParams_, opts...)
  10682. res, err := c.doRequest("json")
  10683. if res != nil && res.StatusCode == http.StatusNotModified {
  10684. if res.Body != nil {
  10685. res.Body.Close()
  10686. }
  10687. return nil, &googleapi.Error{
  10688. Code: res.StatusCode,
  10689. Header: res.Header,
  10690. }
  10691. }
  10692. if err != nil {
  10693. return nil, err
  10694. }
  10695. defer googleapi.CloseBody(res)
  10696. if err := googleapi.CheckResponse(res); err != nil {
  10697. return nil, err
  10698. }
  10699. ret := &AppAccessCollections{
  10700. ServerResponse: googleapi.ServerResponse{
  10701. Header: res.Header,
  10702. HTTPStatusCode: res.StatusCode,
  10703. },
  10704. }
  10705. target := &ret
  10706. if err := gensupport.DecodeResponse(target, res); err != nil {
  10707. return nil, err
  10708. }
  10709. return ret, nil
  10710. // {
  10711. // "description": "Retrieves resolved app access settings of the logged in user.",
  10712. // "httpMethod": "GET",
  10713. // "id": "directory.resolvedAppAccessSettings.GetSettings",
  10714. // "path": "resolvedappaccesssettings",
  10715. // "response": {
  10716. // "$ref": "AppAccessCollections"
  10717. // }
  10718. // }
  10719. }
  10720. // method id "directory.resolvedAppAccessSettings.ListTrustedApps":
  10721. type ResolvedAppAccessSettingsListTrustedAppsCall struct {
  10722. s *Service
  10723. urlParams_ gensupport.URLParams
  10724. ifNoneMatch_ string
  10725. ctx_ context.Context
  10726. header_ http.Header
  10727. }
  10728. // ListTrustedApps: Retrieves the list of apps trusted by the admin of
  10729. // the logged in user.
  10730. func (r *ResolvedAppAccessSettingsService) ListTrustedApps() *ResolvedAppAccessSettingsListTrustedAppsCall {
  10731. c := &ResolvedAppAccessSettingsListTrustedAppsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10732. return c
  10733. }
  10734. // Fields allows partial responses to be retrieved. See
  10735. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10736. // for more information.
  10737. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) Fields(s ...googleapi.Field) *ResolvedAppAccessSettingsListTrustedAppsCall {
  10738. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10739. return c
  10740. }
  10741. // IfNoneMatch sets the optional parameter which makes the operation
  10742. // fail if the object's ETag matches the given value. This is useful for
  10743. // getting updates only after the object has changed since the last
  10744. // request. Use googleapi.IsNotModified to check whether the response
  10745. // error from Do is the result of In-None-Match.
  10746. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) IfNoneMatch(entityTag string) *ResolvedAppAccessSettingsListTrustedAppsCall {
  10747. c.ifNoneMatch_ = entityTag
  10748. return c
  10749. }
  10750. // Context sets the context to be used in this call's Do method. Any
  10751. // pending HTTP request will be aborted if the provided context is
  10752. // canceled.
  10753. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) Context(ctx context.Context) *ResolvedAppAccessSettingsListTrustedAppsCall {
  10754. c.ctx_ = ctx
  10755. return c
  10756. }
  10757. // Header returns an http.Header that can be modified by the caller to
  10758. // add HTTP headers to the request.
  10759. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) Header() http.Header {
  10760. if c.header_ == nil {
  10761. c.header_ = make(http.Header)
  10762. }
  10763. return c.header_
  10764. }
  10765. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) doRequest(alt string) (*http.Response, error) {
  10766. reqHeaders := make(http.Header)
  10767. for k, v := range c.header_ {
  10768. reqHeaders[k] = v
  10769. }
  10770. reqHeaders.Set("User-Agent", c.s.userAgent())
  10771. if c.ifNoneMatch_ != "" {
  10772. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10773. }
  10774. var body io.Reader = nil
  10775. c.urlParams_.Set("alt", alt)
  10776. urls := googleapi.ResolveRelative(c.s.BasePath, "trustedapps")
  10777. urls += "?" + c.urlParams_.Encode()
  10778. req, _ := http.NewRequest("GET", urls, body)
  10779. req.Header = reqHeaders
  10780. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10781. }
  10782. // Do executes the "directory.resolvedAppAccessSettings.ListTrustedApps" call.
  10783. // Exactly one of *TrustedApps or error will be non-nil. Any non-2xx
  10784. // status code is an error. Response headers are in either
  10785. // *TrustedApps.ServerResponse.Header or (if a response was returned at
  10786. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10787. // to check whether the returned error was because
  10788. // http.StatusNotModified was returned.
  10789. func (c *ResolvedAppAccessSettingsListTrustedAppsCall) Do(opts ...googleapi.CallOption) (*TrustedApps, error) {
  10790. gensupport.SetOptions(c.urlParams_, opts...)
  10791. res, err := c.doRequest("json")
  10792. if res != nil && res.StatusCode == http.StatusNotModified {
  10793. if res.Body != nil {
  10794. res.Body.Close()
  10795. }
  10796. return nil, &googleapi.Error{
  10797. Code: res.StatusCode,
  10798. Header: res.Header,
  10799. }
  10800. }
  10801. if err != nil {
  10802. return nil, err
  10803. }
  10804. defer googleapi.CloseBody(res)
  10805. if err := googleapi.CheckResponse(res); err != nil {
  10806. return nil, err
  10807. }
  10808. ret := &TrustedApps{
  10809. ServerResponse: googleapi.ServerResponse{
  10810. Header: res.Header,
  10811. HTTPStatusCode: res.StatusCode,
  10812. },
  10813. }
  10814. target := &ret
  10815. if err := gensupport.DecodeResponse(target, res); err != nil {
  10816. return nil, err
  10817. }
  10818. return ret, nil
  10819. // {
  10820. // "description": "Retrieves the list of apps trusted by the admin of the logged in user.",
  10821. // "httpMethod": "GET",
  10822. // "id": "directory.resolvedAppAccessSettings.ListTrustedApps",
  10823. // "path": "trustedapps",
  10824. // "response": {
  10825. // "$ref": "TrustedApps"
  10826. // }
  10827. // }
  10828. }
  10829. // method id "directory.resources.buildings.delete":
  10830. type ResourcesBuildingsDeleteCall struct {
  10831. s *Service
  10832. customer string
  10833. buildingId string
  10834. urlParams_ gensupport.URLParams
  10835. ctx_ context.Context
  10836. header_ http.Header
  10837. }
  10838. // Delete: Deletes a building.
  10839. func (r *ResourcesBuildingsService) Delete(customer string, buildingId string) *ResourcesBuildingsDeleteCall {
  10840. c := &ResourcesBuildingsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10841. c.customer = customer
  10842. c.buildingId = buildingId
  10843. return c
  10844. }
  10845. // Fields allows partial responses to be retrieved. See
  10846. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10847. // for more information.
  10848. func (c *ResourcesBuildingsDeleteCall) Fields(s ...googleapi.Field) *ResourcesBuildingsDeleteCall {
  10849. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10850. return c
  10851. }
  10852. // Context sets the context to be used in this call's Do method. Any
  10853. // pending HTTP request will be aborted if the provided context is
  10854. // canceled.
  10855. func (c *ResourcesBuildingsDeleteCall) Context(ctx context.Context) *ResourcesBuildingsDeleteCall {
  10856. c.ctx_ = ctx
  10857. return c
  10858. }
  10859. // Header returns an http.Header that can be modified by the caller to
  10860. // add HTTP headers to the request.
  10861. func (c *ResourcesBuildingsDeleteCall) Header() http.Header {
  10862. if c.header_ == nil {
  10863. c.header_ = make(http.Header)
  10864. }
  10865. return c.header_
  10866. }
  10867. func (c *ResourcesBuildingsDeleteCall) doRequest(alt string) (*http.Response, error) {
  10868. reqHeaders := make(http.Header)
  10869. for k, v := range c.header_ {
  10870. reqHeaders[k] = v
  10871. }
  10872. reqHeaders.Set("User-Agent", c.s.userAgent())
  10873. var body io.Reader = nil
  10874. c.urlParams_.Set("alt", alt)
  10875. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings/{buildingId}")
  10876. urls += "?" + c.urlParams_.Encode()
  10877. req, _ := http.NewRequest("DELETE", urls, body)
  10878. req.Header = reqHeaders
  10879. googleapi.Expand(req.URL, map[string]string{
  10880. "customer": c.customer,
  10881. "buildingId": c.buildingId,
  10882. })
  10883. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10884. }
  10885. // Do executes the "directory.resources.buildings.delete" call.
  10886. func (c *ResourcesBuildingsDeleteCall) Do(opts ...googleapi.CallOption) error {
  10887. gensupport.SetOptions(c.urlParams_, opts...)
  10888. res, err := c.doRequest("json")
  10889. if err != nil {
  10890. return err
  10891. }
  10892. defer googleapi.CloseBody(res)
  10893. if err := googleapi.CheckResponse(res); err != nil {
  10894. return err
  10895. }
  10896. return nil
  10897. // {
  10898. // "description": "Deletes a building.",
  10899. // "httpMethod": "DELETE",
  10900. // "id": "directory.resources.buildings.delete",
  10901. // "parameterOrder": [
  10902. // "customer",
  10903. // "buildingId"
  10904. // ],
  10905. // "parameters": {
  10906. // "buildingId": {
  10907. // "description": "The ID of the building to delete.",
  10908. // "location": "path",
  10909. // "required": true,
  10910. // "type": "string"
  10911. // },
  10912. // "customer": {
  10913. // "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.",
  10914. // "location": "path",
  10915. // "required": true,
  10916. // "type": "string"
  10917. // }
  10918. // },
  10919. // "path": "customer/{customer}/resources/buildings/{buildingId}",
  10920. // "scopes": [
  10921. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  10922. // ]
  10923. // }
  10924. }
  10925. // method id "directory.resources.buildings.get":
  10926. type ResourcesBuildingsGetCall struct {
  10927. s *Service
  10928. customer string
  10929. buildingId string
  10930. urlParams_ gensupport.URLParams
  10931. ifNoneMatch_ string
  10932. ctx_ context.Context
  10933. header_ http.Header
  10934. }
  10935. // Get: Retrieves a building.
  10936. func (r *ResourcesBuildingsService) Get(customer string, buildingId string) *ResourcesBuildingsGetCall {
  10937. c := &ResourcesBuildingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10938. c.customer = customer
  10939. c.buildingId = buildingId
  10940. return c
  10941. }
  10942. // Fields allows partial responses to be retrieved. See
  10943. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10944. // for more information.
  10945. func (c *ResourcesBuildingsGetCall) Fields(s ...googleapi.Field) *ResourcesBuildingsGetCall {
  10946. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10947. return c
  10948. }
  10949. // IfNoneMatch sets the optional parameter which makes the operation
  10950. // fail if the object's ETag matches the given value. This is useful for
  10951. // getting updates only after the object has changed since the last
  10952. // request. Use googleapi.IsNotModified to check whether the response
  10953. // error from Do is the result of In-None-Match.
  10954. func (c *ResourcesBuildingsGetCall) IfNoneMatch(entityTag string) *ResourcesBuildingsGetCall {
  10955. c.ifNoneMatch_ = entityTag
  10956. return c
  10957. }
  10958. // Context sets the context to be used in this call's Do method. Any
  10959. // pending HTTP request will be aborted if the provided context is
  10960. // canceled.
  10961. func (c *ResourcesBuildingsGetCall) Context(ctx context.Context) *ResourcesBuildingsGetCall {
  10962. c.ctx_ = ctx
  10963. return c
  10964. }
  10965. // Header returns an http.Header that can be modified by the caller to
  10966. // add HTTP headers to the request.
  10967. func (c *ResourcesBuildingsGetCall) Header() http.Header {
  10968. if c.header_ == nil {
  10969. c.header_ = make(http.Header)
  10970. }
  10971. return c.header_
  10972. }
  10973. func (c *ResourcesBuildingsGetCall) doRequest(alt string) (*http.Response, error) {
  10974. reqHeaders := make(http.Header)
  10975. for k, v := range c.header_ {
  10976. reqHeaders[k] = v
  10977. }
  10978. reqHeaders.Set("User-Agent", c.s.userAgent())
  10979. if c.ifNoneMatch_ != "" {
  10980. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10981. }
  10982. var body io.Reader = nil
  10983. c.urlParams_.Set("alt", alt)
  10984. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings/{buildingId}")
  10985. urls += "?" + c.urlParams_.Encode()
  10986. req, _ := http.NewRequest("GET", urls, body)
  10987. req.Header = reqHeaders
  10988. googleapi.Expand(req.URL, map[string]string{
  10989. "customer": c.customer,
  10990. "buildingId": c.buildingId,
  10991. })
  10992. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10993. }
  10994. // Do executes the "directory.resources.buildings.get" call.
  10995. // Exactly one of *Building or error will be non-nil. Any non-2xx status
  10996. // code is an error. Response headers are in either
  10997. // *Building.ServerResponse.Header or (if a response was returned at
  10998. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10999. // to check whether the returned error was because
  11000. // http.StatusNotModified was returned.
  11001. func (c *ResourcesBuildingsGetCall) Do(opts ...googleapi.CallOption) (*Building, error) {
  11002. gensupport.SetOptions(c.urlParams_, opts...)
  11003. res, err := c.doRequest("json")
  11004. if res != nil && res.StatusCode == http.StatusNotModified {
  11005. if res.Body != nil {
  11006. res.Body.Close()
  11007. }
  11008. return nil, &googleapi.Error{
  11009. Code: res.StatusCode,
  11010. Header: res.Header,
  11011. }
  11012. }
  11013. if err != nil {
  11014. return nil, err
  11015. }
  11016. defer googleapi.CloseBody(res)
  11017. if err := googleapi.CheckResponse(res); err != nil {
  11018. return nil, err
  11019. }
  11020. ret := &Building{
  11021. ServerResponse: googleapi.ServerResponse{
  11022. Header: res.Header,
  11023. HTTPStatusCode: res.StatusCode,
  11024. },
  11025. }
  11026. target := &ret
  11027. if err := gensupport.DecodeResponse(target, res); err != nil {
  11028. return nil, err
  11029. }
  11030. return ret, nil
  11031. // {
  11032. // "description": "Retrieves a building.",
  11033. // "httpMethod": "GET",
  11034. // "id": "directory.resources.buildings.get",
  11035. // "parameterOrder": [
  11036. // "customer",
  11037. // "buildingId"
  11038. // ],
  11039. // "parameters": {
  11040. // "buildingId": {
  11041. // "description": "The unique ID of the building to retrieve.",
  11042. // "location": "path",
  11043. // "required": true,
  11044. // "type": "string"
  11045. // },
  11046. // "customer": {
  11047. // "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.",
  11048. // "location": "path",
  11049. // "required": true,
  11050. // "type": "string"
  11051. // }
  11052. // },
  11053. // "path": "customer/{customer}/resources/buildings/{buildingId}",
  11054. // "response": {
  11055. // "$ref": "Building"
  11056. // },
  11057. // "scopes": [
  11058. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  11059. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  11060. // ]
  11061. // }
  11062. }
  11063. // method id "directory.resources.buildings.insert":
  11064. type ResourcesBuildingsInsertCall struct {
  11065. s *Service
  11066. customer string
  11067. building *Building
  11068. urlParams_ gensupport.URLParams
  11069. ctx_ context.Context
  11070. header_ http.Header
  11071. }
  11072. // Insert: Inserts a building.
  11073. func (r *ResourcesBuildingsService) Insert(customer string, building *Building) *ResourcesBuildingsInsertCall {
  11074. c := &ResourcesBuildingsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11075. c.customer = customer
  11076. c.building = building
  11077. return c
  11078. }
  11079. // Fields allows partial responses to be retrieved. See
  11080. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11081. // for more information.
  11082. func (c *ResourcesBuildingsInsertCall) Fields(s ...googleapi.Field) *ResourcesBuildingsInsertCall {
  11083. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11084. return c
  11085. }
  11086. // Context sets the context to be used in this call's Do method. Any
  11087. // pending HTTP request will be aborted if the provided context is
  11088. // canceled.
  11089. func (c *ResourcesBuildingsInsertCall) Context(ctx context.Context) *ResourcesBuildingsInsertCall {
  11090. c.ctx_ = ctx
  11091. return c
  11092. }
  11093. // Header returns an http.Header that can be modified by the caller to
  11094. // add HTTP headers to the request.
  11095. func (c *ResourcesBuildingsInsertCall) Header() http.Header {
  11096. if c.header_ == nil {
  11097. c.header_ = make(http.Header)
  11098. }
  11099. return c.header_
  11100. }
  11101. func (c *ResourcesBuildingsInsertCall) doRequest(alt string) (*http.Response, error) {
  11102. reqHeaders := make(http.Header)
  11103. for k, v := range c.header_ {
  11104. reqHeaders[k] = v
  11105. }
  11106. reqHeaders.Set("User-Agent", c.s.userAgent())
  11107. var body io.Reader = nil
  11108. body, err := googleapi.WithoutDataWrapper.JSONReader(c.building)
  11109. if err != nil {
  11110. return nil, err
  11111. }
  11112. reqHeaders.Set("Content-Type", "application/json")
  11113. c.urlParams_.Set("alt", alt)
  11114. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings")
  11115. urls += "?" + c.urlParams_.Encode()
  11116. req, _ := http.NewRequest("POST", urls, body)
  11117. req.Header = reqHeaders
  11118. googleapi.Expand(req.URL, map[string]string{
  11119. "customer": c.customer,
  11120. })
  11121. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11122. }
  11123. // Do executes the "directory.resources.buildings.insert" call.
  11124. // Exactly one of *Building or error will be non-nil. Any non-2xx status
  11125. // code is an error. Response headers are in either
  11126. // *Building.ServerResponse.Header or (if a response was returned at
  11127. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11128. // to check whether the returned error was because
  11129. // http.StatusNotModified was returned.
  11130. func (c *ResourcesBuildingsInsertCall) Do(opts ...googleapi.CallOption) (*Building, error) {
  11131. gensupport.SetOptions(c.urlParams_, opts...)
  11132. res, err := c.doRequest("json")
  11133. if res != nil && res.StatusCode == http.StatusNotModified {
  11134. if res.Body != nil {
  11135. res.Body.Close()
  11136. }
  11137. return nil, &googleapi.Error{
  11138. Code: res.StatusCode,
  11139. Header: res.Header,
  11140. }
  11141. }
  11142. if err != nil {
  11143. return nil, err
  11144. }
  11145. defer googleapi.CloseBody(res)
  11146. if err := googleapi.CheckResponse(res); err != nil {
  11147. return nil, err
  11148. }
  11149. ret := &Building{
  11150. ServerResponse: googleapi.ServerResponse{
  11151. Header: res.Header,
  11152. HTTPStatusCode: res.StatusCode,
  11153. },
  11154. }
  11155. target := &ret
  11156. if err := gensupport.DecodeResponse(target, res); err != nil {
  11157. return nil, err
  11158. }
  11159. return ret, nil
  11160. // {
  11161. // "description": "Inserts a building.",
  11162. // "httpMethod": "POST",
  11163. // "id": "directory.resources.buildings.insert",
  11164. // "parameterOrder": [
  11165. // "customer"
  11166. // ],
  11167. // "parameters": {
  11168. // "customer": {
  11169. // "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.",
  11170. // "location": "path",
  11171. // "required": true,
  11172. // "type": "string"
  11173. // }
  11174. // },
  11175. // "path": "customer/{customer}/resources/buildings",
  11176. // "request": {
  11177. // "$ref": "Building"
  11178. // },
  11179. // "response": {
  11180. // "$ref": "Building"
  11181. // },
  11182. // "scopes": [
  11183. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  11184. // ]
  11185. // }
  11186. }
  11187. // method id "directory.resources.buildings.list":
  11188. type ResourcesBuildingsListCall struct {
  11189. s *Service
  11190. customer string
  11191. urlParams_ gensupport.URLParams
  11192. ifNoneMatch_ string
  11193. ctx_ context.Context
  11194. header_ http.Header
  11195. }
  11196. // List: Retrieves a list of buildings for an account.
  11197. func (r *ResourcesBuildingsService) List(customer string) *ResourcesBuildingsListCall {
  11198. c := &ResourcesBuildingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11199. c.customer = customer
  11200. return c
  11201. }
  11202. // MaxResults sets the optional parameter "maxResults": Maximum number
  11203. // of results to return.
  11204. func (c *ResourcesBuildingsListCall) MaxResults(maxResults int64) *ResourcesBuildingsListCall {
  11205. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  11206. return c
  11207. }
  11208. // PageToken sets the optional parameter "pageToken": Token to specify
  11209. // the next page in the list.
  11210. func (c *ResourcesBuildingsListCall) PageToken(pageToken string) *ResourcesBuildingsListCall {
  11211. c.urlParams_.Set("pageToken", pageToken)
  11212. return c
  11213. }
  11214. // Fields allows partial responses to be retrieved. See
  11215. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11216. // for more information.
  11217. func (c *ResourcesBuildingsListCall) Fields(s ...googleapi.Field) *ResourcesBuildingsListCall {
  11218. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11219. return c
  11220. }
  11221. // IfNoneMatch sets the optional parameter which makes the operation
  11222. // fail if the object's ETag matches the given value. This is useful for
  11223. // getting updates only after the object has changed since the last
  11224. // request. Use googleapi.IsNotModified to check whether the response
  11225. // error from Do is the result of In-None-Match.
  11226. func (c *ResourcesBuildingsListCall) IfNoneMatch(entityTag string) *ResourcesBuildingsListCall {
  11227. c.ifNoneMatch_ = entityTag
  11228. return c
  11229. }
  11230. // Context sets the context to be used in this call's Do method. Any
  11231. // pending HTTP request will be aborted if the provided context is
  11232. // canceled.
  11233. func (c *ResourcesBuildingsListCall) Context(ctx context.Context) *ResourcesBuildingsListCall {
  11234. c.ctx_ = ctx
  11235. return c
  11236. }
  11237. // Header returns an http.Header that can be modified by the caller to
  11238. // add HTTP headers to the request.
  11239. func (c *ResourcesBuildingsListCall) Header() http.Header {
  11240. if c.header_ == nil {
  11241. c.header_ = make(http.Header)
  11242. }
  11243. return c.header_
  11244. }
  11245. func (c *ResourcesBuildingsListCall) doRequest(alt string) (*http.Response, error) {
  11246. reqHeaders := make(http.Header)
  11247. for k, v := range c.header_ {
  11248. reqHeaders[k] = v
  11249. }
  11250. reqHeaders.Set("User-Agent", c.s.userAgent())
  11251. if c.ifNoneMatch_ != "" {
  11252. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11253. }
  11254. var body io.Reader = nil
  11255. c.urlParams_.Set("alt", alt)
  11256. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings")
  11257. urls += "?" + c.urlParams_.Encode()
  11258. req, _ := http.NewRequest("GET", urls, body)
  11259. req.Header = reqHeaders
  11260. googleapi.Expand(req.URL, map[string]string{
  11261. "customer": c.customer,
  11262. })
  11263. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11264. }
  11265. // Do executes the "directory.resources.buildings.list" call.
  11266. // Exactly one of *Buildings or error will be non-nil. Any non-2xx
  11267. // status code is an error. Response headers are in either
  11268. // *Buildings.ServerResponse.Header or (if a response was returned at
  11269. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11270. // to check whether the returned error was because
  11271. // http.StatusNotModified was returned.
  11272. func (c *ResourcesBuildingsListCall) Do(opts ...googleapi.CallOption) (*Buildings, error) {
  11273. gensupport.SetOptions(c.urlParams_, opts...)
  11274. res, err := c.doRequest("json")
  11275. if res != nil && res.StatusCode == http.StatusNotModified {
  11276. if res.Body != nil {
  11277. res.Body.Close()
  11278. }
  11279. return nil, &googleapi.Error{
  11280. Code: res.StatusCode,
  11281. Header: res.Header,
  11282. }
  11283. }
  11284. if err != nil {
  11285. return nil, err
  11286. }
  11287. defer googleapi.CloseBody(res)
  11288. if err := googleapi.CheckResponse(res); err != nil {
  11289. return nil, err
  11290. }
  11291. ret := &Buildings{
  11292. ServerResponse: googleapi.ServerResponse{
  11293. Header: res.Header,
  11294. HTTPStatusCode: res.StatusCode,
  11295. },
  11296. }
  11297. target := &ret
  11298. if err := gensupport.DecodeResponse(target, res); err != nil {
  11299. return nil, err
  11300. }
  11301. return ret, nil
  11302. // {
  11303. // "description": "Retrieves a list of buildings for an account.",
  11304. // "httpMethod": "GET",
  11305. // "id": "directory.resources.buildings.list",
  11306. // "parameterOrder": [
  11307. // "customer"
  11308. // ],
  11309. // "parameters": {
  11310. // "customer": {
  11311. // "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.",
  11312. // "location": "path",
  11313. // "required": true,
  11314. // "type": "string"
  11315. // },
  11316. // "maxResults": {
  11317. // "description": "Maximum number of results to return.",
  11318. // "format": "int32",
  11319. // "location": "query",
  11320. // "maximum": "500",
  11321. // "minimum": "1",
  11322. // "type": "integer"
  11323. // },
  11324. // "pageToken": {
  11325. // "description": "Token to specify the next page in the list.",
  11326. // "location": "query",
  11327. // "type": "string"
  11328. // }
  11329. // },
  11330. // "path": "customer/{customer}/resources/buildings",
  11331. // "response": {
  11332. // "$ref": "Buildings"
  11333. // },
  11334. // "scopes": [
  11335. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  11336. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  11337. // ]
  11338. // }
  11339. }
  11340. // Pages invokes f for each page of results.
  11341. // A non-nil error returned from f will halt the iteration.
  11342. // The provided context supersedes any context provided to the Context method.
  11343. func (c *ResourcesBuildingsListCall) Pages(ctx context.Context, f func(*Buildings) error) error {
  11344. c.ctx_ = ctx
  11345. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  11346. for {
  11347. x, err := c.Do()
  11348. if err != nil {
  11349. return err
  11350. }
  11351. if err := f(x); err != nil {
  11352. return err
  11353. }
  11354. if x.NextPageToken == "" {
  11355. return nil
  11356. }
  11357. c.PageToken(x.NextPageToken)
  11358. }
  11359. }
  11360. // method id "directory.resources.buildings.patch":
  11361. type ResourcesBuildingsPatchCall struct {
  11362. s *Service
  11363. customer string
  11364. buildingId string
  11365. building *Building
  11366. urlParams_ gensupport.URLParams
  11367. ctx_ context.Context
  11368. header_ http.Header
  11369. }
  11370. // Patch: Updates a building. This method supports patch semantics.
  11371. func (r *ResourcesBuildingsService) Patch(customer string, buildingId string, building *Building) *ResourcesBuildingsPatchCall {
  11372. c := &ResourcesBuildingsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11373. c.customer = customer
  11374. c.buildingId = buildingId
  11375. c.building = building
  11376. return c
  11377. }
  11378. // Fields allows partial responses to be retrieved. See
  11379. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11380. // for more information.
  11381. func (c *ResourcesBuildingsPatchCall) Fields(s ...googleapi.Field) *ResourcesBuildingsPatchCall {
  11382. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11383. return c
  11384. }
  11385. // Context sets the context to be used in this call's Do method. Any
  11386. // pending HTTP request will be aborted if the provided context is
  11387. // canceled.
  11388. func (c *ResourcesBuildingsPatchCall) Context(ctx context.Context) *ResourcesBuildingsPatchCall {
  11389. c.ctx_ = ctx
  11390. return c
  11391. }
  11392. // Header returns an http.Header that can be modified by the caller to
  11393. // add HTTP headers to the request.
  11394. func (c *ResourcesBuildingsPatchCall) Header() http.Header {
  11395. if c.header_ == nil {
  11396. c.header_ = make(http.Header)
  11397. }
  11398. return c.header_
  11399. }
  11400. func (c *ResourcesBuildingsPatchCall) doRequest(alt string) (*http.Response, error) {
  11401. reqHeaders := make(http.Header)
  11402. for k, v := range c.header_ {
  11403. reqHeaders[k] = v
  11404. }
  11405. reqHeaders.Set("User-Agent", c.s.userAgent())
  11406. var body io.Reader = nil
  11407. body, err := googleapi.WithoutDataWrapper.JSONReader(c.building)
  11408. if err != nil {
  11409. return nil, err
  11410. }
  11411. reqHeaders.Set("Content-Type", "application/json")
  11412. c.urlParams_.Set("alt", alt)
  11413. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings/{buildingId}")
  11414. urls += "?" + c.urlParams_.Encode()
  11415. req, _ := http.NewRequest("PATCH", urls, body)
  11416. req.Header = reqHeaders
  11417. googleapi.Expand(req.URL, map[string]string{
  11418. "customer": c.customer,
  11419. "buildingId": c.buildingId,
  11420. })
  11421. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11422. }
  11423. // Do executes the "directory.resources.buildings.patch" call.
  11424. // Exactly one of *Building or error will be non-nil. Any non-2xx status
  11425. // code is an error. Response headers are in either
  11426. // *Building.ServerResponse.Header or (if a response was returned at
  11427. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11428. // to check whether the returned error was because
  11429. // http.StatusNotModified was returned.
  11430. func (c *ResourcesBuildingsPatchCall) Do(opts ...googleapi.CallOption) (*Building, error) {
  11431. gensupport.SetOptions(c.urlParams_, opts...)
  11432. res, err := c.doRequest("json")
  11433. if res != nil && res.StatusCode == http.StatusNotModified {
  11434. if res.Body != nil {
  11435. res.Body.Close()
  11436. }
  11437. return nil, &googleapi.Error{
  11438. Code: res.StatusCode,
  11439. Header: res.Header,
  11440. }
  11441. }
  11442. if err != nil {
  11443. return nil, err
  11444. }
  11445. defer googleapi.CloseBody(res)
  11446. if err := googleapi.CheckResponse(res); err != nil {
  11447. return nil, err
  11448. }
  11449. ret := &Building{
  11450. ServerResponse: googleapi.ServerResponse{
  11451. Header: res.Header,
  11452. HTTPStatusCode: res.StatusCode,
  11453. },
  11454. }
  11455. target := &ret
  11456. if err := gensupport.DecodeResponse(target, res); err != nil {
  11457. return nil, err
  11458. }
  11459. return ret, nil
  11460. // {
  11461. // "description": "Updates a building. This method supports patch semantics.",
  11462. // "httpMethod": "PATCH",
  11463. // "id": "directory.resources.buildings.patch",
  11464. // "parameterOrder": [
  11465. // "customer",
  11466. // "buildingId"
  11467. // ],
  11468. // "parameters": {
  11469. // "buildingId": {
  11470. // "description": "The ID of the building to update.",
  11471. // "location": "path",
  11472. // "required": true,
  11473. // "type": "string"
  11474. // },
  11475. // "customer": {
  11476. // "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.",
  11477. // "location": "path",
  11478. // "required": true,
  11479. // "type": "string"
  11480. // }
  11481. // },
  11482. // "path": "customer/{customer}/resources/buildings/{buildingId}",
  11483. // "request": {
  11484. // "$ref": "Building"
  11485. // },
  11486. // "response": {
  11487. // "$ref": "Building"
  11488. // },
  11489. // "scopes": [
  11490. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  11491. // ]
  11492. // }
  11493. }
  11494. // method id "directory.resources.buildings.update":
  11495. type ResourcesBuildingsUpdateCall struct {
  11496. s *Service
  11497. customer string
  11498. buildingId string
  11499. building *Building
  11500. urlParams_ gensupport.URLParams
  11501. ctx_ context.Context
  11502. header_ http.Header
  11503. }
  11504. // Update: Updates a building.
  11505. func (r *ResourcesBuildingsService) Update(customer string, buildingId string, building *Building) *ResourcesBuildingsUpdateCall {
  11506. c := &ResourcesBuildingsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11507. c.customer = customer
  11508. c.buildingId = buildingId
  11509. c.building = building
  11510. return c
  11511. }
  11512. // Fields allows partial responses to be retrieved. See
  11513. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11514. // for more information.
  11515. func (c *ResourcesBuildingsUpdateCall) Fields(s ...googleapi.Field) *ResourcesBuildingsUpdateCall {
  11516. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11517. return c
  11518. }
  11519. // Context sets the context to be used in this call's Do method. Any
  11520. // pending HTTP request will be aborted if the provided context is
  11521. // canceled.
  11522. func (c *ResourcesBuildingsUpdateCall) Context(ctx context.Context) *ResourcesBuildingsUpdateCall {
  11523. c.ctx_ = ctx
  11524. return c
  11525. }
  11526. // Header returns an http.Header that can be modified by the caller to
  11527. // add HTTP headers to the request.
  11528. func (c *ResourcesBuildingsUpdateCall) Header() http.Header {
  11529. if c.header_ == nil {
  11530. c.header_ = make(http.Header)
  11531. }
  11532. return c.header_
  11533. }
  11534. func (c *ResourcesBuildingsUpdateCall) doRequest(alt string) (*http.Response, error) {
  11535. reqHeaders := make(http.Header)
  11536. for k, v := range c.header_ {
  11537. reqHeaders[k] = v
  11538. }
  11539. reqHeaders.Set("User-Agent", c.s.userAgent())
  11540. var body io.Reader = nil
  11541. body, err := googleapi.WithoutDataWrapper.JSONReader(c.building)
  11542. if err != nil {
  11543. return nil, err
  11544. }
  11545. reqHeaders.Set("Content-Type", "application/json")
  11546. c.urlParams_.Set("alt", alt)
  11547. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/buildings/{buildingId}")
  11548. urls += "?" + c.urlParams_.Encode()
  11549. req, _ := http.NewRequest("PUT", urls, body)
  11550. req.Header = reqHeaders
  11551. googleapi.Expand(req.URL, map[string]string{
  11552. "customer": c.customer,
  11553. "buildingId": c.buildingId,
  11554. })
  11555. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11556. }
  11557. // Do executes the "directory.resources.buildings.update" call.
  11558. // Exactly one of *Building or error will be non-nil. Any non-2xx status
  11559. // code is an error. Response headers are in either
  11560. // *Building.ServerResponse.Header or (if a response was returned at
  11561. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11562. // to check whether the returned error was because
  11563. // http.StatusNotModified was returned.
  11564. func (c *ResourcesBuildingsUpdateCall) Do(opts ...googleapi.CallOption) (*Building, error) {
  11565. gensupport.SetOptions(c.urlParams_, opts...)
  11566. res, err := c.doRequest("json")
  11567. if res != nil && res.StatusCode == http.StatusNotModified {
  11568. if res.Body != nil {
  11569. res.Body.Close()
  11570. }
  11571. return nil, &googleapi.Error{
  11572. Code: res.StatusCode,
  11573. Header: res.Header,
  11574. }
  11575. }
  11576. if err != nil {
  11577. return nil, err
  11578. }
  11579. defer googleapi.CloseBody(res)
  11580. if err := googleapi.CheckResponse(res); err != nil {
  11581. return nil, err
  11582. }
  11583. ret := &Building{
  11584. ServerResponse: googleapi.ServerResponse{
  11585. Header: res.Header,
  11586. HTTPStatusCode: res.StatusCode,
  11587. },
  11588. }
  11589. target := &ret
  11590. if err := gensupport.DecodeResponse(target, res); err != nil {
  11591. return nil, err
  11592. }
  11593. return ret, nil
  11594. // {
  11595. // "description": "Updates a building.",
  11596. // "httpMethod": "PUT",
  11597. // "id": "directory.resources.buildings.update",
  11598. // "parameterOrder": [
  11599. // "customer",
  11600. // "buildingId"
  11601. // ],
  11602. // "parameters": {
  11603. // "buildingId": {
  11604. // "description": "The ID of the building to update.",
  11605. // "location": "path",
  11606. // "required": true,
  11607. // "type": "string"
  11608. // },
  11609. // "customer": {
  11610. // "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.",
  11611. // "location": "path",
  11612. // "required": true,
  11613. // "type": "string"
  11614. // }
  11615. // },
  11616. // "path": "customer/{customer}/resources/buildings/{buildingId}",
  11617. // "request": {
  11618. // "$ref": "Building"
  11619. // },
  11620. // "response": {
  11621. // "$ref": "Building"
  11622. // },
  11623. // "scopes": [
  11624. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  11625. // ]
  11626. // }
  11627. }
  11628. // method id "directory.resources.calendars.delete":
  11629. type ResourcesCalendarsDeleteCall struct {
  11630. s *Service
  11631. customer string
  11632. calendarResourceId string
  11633. urlParams_ gensupport.URLParams
  11634. ctx_ context.Context
  11635. header_ http.Header
  11636. }
  11637. // Delete: Deletes a calendar resource.
  11638. func (r *ResourcesCalendarsService) Delete(customer string, calendarResourceId string) *ResourcesCalendarsDeleteCall {
  11639. c := &ResourcesCalendarsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11640. c.customer = customer
  11641. c.calendarResourceId = calendarResourceId
  11642. return c
  11643. }
  11644. // Fields allows partial responses to be retrieved. See
  11645. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11646. // for more information.
  11647. func (c *ResourcesCalendarsDeleteCall) Fields(s ...googleapi.Field) *ResourcesCalendarsDeleteCall {
  11648. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11649. return c
  11650. }
  11651. // Context sets the context to be used in this call's Do method. Any
  11652. // pending HTTP request will be aborted if the provided context is
  11653. // canceled.
  11654. func (c *ResourcesCalendarsDeleteCall) Context(ctx context.Context) *ResourcesCalendarsDeleteCall {
  11655. c.ctx_ = ctx
  11656. return c
  11657. }
  11658. // Header returns an http.Header that can be modified by the caller to
  11659. // add HTTP headers to the request.
  11660. func (c *ResourcesCalendarsDeleteCall) Header() http.Header {
  11661. if c.header_ == nil {
  11662. c.header_ = make(http.Header)
  11663. }
  11664. return c.header_
  11665. }
  11666. func (c *ResourcesCalendarsDeleteCall) doRequest(alt string) (*http.Response, error) {
  11667. reqHeaders := make(http.Header)
  11668. for k, v := range c.header_ {
  11669. reqHeaders[k] = v
  11670. }
  11671. reqHeaders.Set("User-Agent", c.s.userAgent())
  11672. var body io.Reader = nil
  11673. c.urlParams_.Set("alt", alt)
  11674. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  11675. urls += "?" + c.urlParams_.Encode()
  11676. req, _ := http.NewRequest("DELETE", urls, body)
  11677. req.Header = reqHeaders
  11678. googleapi.Expand(req.URL, map[string]string{
  11679. "customer": c.customer,
  11680. "calendarResourceId": c.calendarResourceId,
  11681. })
  11682. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11683. }
  11684. // Do executes the "directory.resources.calendars.delete" call.
  11685. func (c *ResourcesCalendarsDeleteCall) Do(opts ...googleapi.CallOption) error {
  11686. gensupport.SetOptions(c.urlParams_, opts...)
  11687. res, err := c.doRequest("json")
  11688. if err != nil {
  11689. return err
  11690. }
  11691. defer googleapi.CloseBody(res)
  11692. if err := googleapi.CheckResponse(res); err != nil {
  11693. return err
  11694. }
  11695. return nil
  11696. // {
  11697. // "description": "Deletes a calendar resource.",
  11698. // "httpMethod": "DELETE",
  11699. // "id": "directory.resources.calendars.delete",
  11700. // "parameterOrder": [
  11701. // "customer",
  11702. // "calendarResourceId"
  11703. // ],
  11704. // "parameters": {
  11705. // "calendarResourceId": {
  11706. // "description": "The unique ID of the calendar resource to delete.",
  11707. // "location": "path",
  11708. // "required": true,
  11709. // "type": "string"
  11710. // },
  11711. // "customer": {
  11712. // "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.",
  11713. // "location": "path",
  11714. // "required": true,
  11715. // "type": "string"
  11716. // }
  11717. // },
  11718. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  11719. // "scopes": [
  11720. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  11721. // ]
  11722. // }
  11723. }
  11724. // method id "directory.resources.calendars.get":
  11725. type ResourcesCalendarsGetCall struct {
  11726. s *Service
  11727. customer string
  11728. calendarResourceId string
  11729. urlParams_ gensupport.URLParams
  11730. ifNoneMatch_ string
  11731. ctx_ context.Context
  11732. header_ http.Header
  11733. }
  11734. // Get: Retrieves a calendar resource.
  11735. func (r *ResourcesCalendarsService) Get(customer string, calendarResourceId string) *ResourcesCalendarsGetCall {
  11736. c := &ResourcesCalendarsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11737. c.customer = customer
  11738. c.calendarResourceId = calendarResourceId
  11739. return c
  11740. }
  11741. // Fields allows partial responses to be retrieved. See
  11742. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11743. // for more information.
  11744. func (c *ResourcesCalendarsGetCall) Fields(s ...googleapi.Field) *ResourcesCalendarsGetCall {
  11745. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11746. return c
  11747. }
  11748. // IfNoneMatch sets the optional parameter which makes the operation
  11749. // fail if the object's ETag matches the given value. This is useful for
  11750. // getting updates only after the object has changed since the last
  11751. // request. Use googleapi.IsNotModified to check whether the response
  11752. // error from Do is the result of In-None-Match.
  11753. func (c *ResourcesCalendarsGetCall) IfNoneMatch(entityTag string) *ResourcesCalendarsGetCall {
  11754. c.ifNoneMatch_ = entityTag
  11755. return c
  11756. }
  11757. // Context sets the context to be used in this call's Do method. Any
  11758. // pending HTTP request will be aborted if the provided context is
  11759. // canceled.
  11760. func (c *ResourcesCalendarsGetCall) Context(ctx context.Context) *ResourcesCalendarsGetCall {
  11761. c.ctx_ = ctx
  11762. return c
  11763. }
  11764. // Header returns an http.Header that can be modified by the caller to
  11765. // add HTTP headers to the request.
  11766. func (c *ResourcesCalendarsGetCall) Header() http.Header {
  11767. if c.header_ == nil {
  11768. c.header_ = make(http.Header)
  11769. }
  11770. return c.header_
  11771. }
  11772. func (c *ResourcesCalendarsGetCall) doRequest(alt string) (*http.Response, error) {
  11773. reqHeaders := make(http.Header)
  11774. for k, v := range c.header_ {
  11775. reqHeaders[k] = v
  11776. }
  11777. reqHeaders.Set("User-Agent", c.s.userAgent())
  11778. if c.ifNoneMatch_ != "" {
  11779. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11780. }
  11781. var body io.Reader = nil
  11782. c.urlParams_.Set("alt", alt)
  11783. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  11784. urls += "?" + c.urlParams_.Encode()
  11785. req, _ := http.NewRequest("GET", urls, body)
  11786. req.Header = reqHeaders
  11787. googleapi.Expand(req.URL, map[string]string{
  11788. "customer": c.customer,
  11789. "calendarResourceId": c.calendarResourceId,
  11790. })
  11791. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11792. }
  11793. // Do executes the "directory.resources.calendars.get" call.
  11794. // Exactly one of *CalendarResource or error will be non-nil. Any
  11795. // non-2xx status code is an error. Response headers are in either
  11796. // *CalendarResource.ServerResponse.Header or (if a response was
  11797. // returned at all) in error.(*googleapi.Error).Header. Use
  11798. // googleapi.IsNotModified to check whether the returned error was
  11799. // because http.StatusNotModified was returned.
  11800. func (c *ResourcesCalendarsGetCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  11801. gensupport.SetOptions(c.urlParams_, opts...)
  11802. res, err := c.doRequest("json")
  11803. if res != nil && res.StatusCode == http.StatusNotModified {
  11804. if res.Body != nil {
  11805. res.Body.Close()
  11806. }
  11807. return nil, &googleapi.Error{
  11808. Code: res.StatusCode,
  11809. Header: res.Header,
  11810. }
  11811. }
  11812. if err != nil {
  11813. return nil, err
  11814. }
  11815. defer googleapi.CloseBody(res)
  11816. if err := googleapi.CheckResponse(res); err != nil {
  11817. return nil, err
  11818. }
  11819. ret := &CalendarResource{
  11820. ServerResponse: googleapi.ServerResponse{
  11821. Header: res.Header,
  11822. HTTPStatusCode: res.StatusCode,
  11823. },
  11824. }
  11825. target := &ret
  11826. if err := gensupport.DecodeResponse(target, res); err != nil {
  11827. return nil, err
  11828. }
  11829. return ret, nil
  11830. // {
  11831. // "description": "Retrieves a calendar resource.",
  11832. // "httpMethod": "GET",
  11833. // "id": "directory.resources.calendars.get",
  11834. // "parameterOrder": [
  11835. // "customer",
  11836. // "calendarResourceId"
  11837. // ],
  11838. // "parameters": {
  11839. // "calendarResourceId": {
  11840. // "description": "The unique ID of the calendar resource to retrieve.",
  11841. // "location": "path",
  11842. // "required": true,
  11843. // "type": "string"
  11844. // },
  11845. // "customer": {
  11846. // "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.",
  11847. // "location": "path",
  11848. // "required": true,
  11849. // "type": "string"
  11850. // }
  11851. // },
  11852. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  11853. // "response": {
  11854. // "$ref": "CalendarResource"
  11855. // },
  11856. // "scopes": [
  11857. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  11858. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  11859. // ]
  11860. // }
  11861. }
  11862. // method id "directory.resources.calendars.insert":
  11863. type ResourcesCalendarsInsertCall struct {
  11864. s *Service
  11865. customer string
  11866. calendarresource *CalendarResource
  11867. urlParams_ gensupport.URLParams
  11868. ctx_ context.Context
  11869. header_ http.Header
  11870. }
  11871. // Insert: Inserts a calendar resource.
  11872. func (r *ResourcesCalendarsService) Insert(customer string, calendarresource *CalendarResource) *ResourcesCalendarsInsertCall {
  11873. c := &ResourcesCalendarsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11874. c.customer = customer
  11875. c.calendarresource = calendarresource
  11876. return c
  11877. }
  11878. // Fields allows partial responses to be retrieved. See
  11879. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11880. // for more information.
  11881. func (c *ResourcesCalendarsInsertCall) Fields(s ...googleapi.Field) *ResourcesCalendarsInsertCall {
  11882. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11883. return c
  11884. }
  11885. // Context sets the context to be used in this call's Do method. Any
  11886. // pending HTTP request will be aborted if the provided context is
  11887. // canceled.
  11888. func (c *ResourcesCalendarsInsertCall) Context(ctx context.Context) *ResourcesCalendarsInsertCall {
  11889. c.ctx_ = ctx
  11890. return c
  11891. }
  11892. // Header returns an http.Header that can be modified by the caller to
  11893. // add HTTP headers to the request.
  11894. func (c *ResourcesCalendarsInsertCall) Header() http.Header {
  11895. if c.header_ == nil {
  11896. c.header_ = make(http.Header)
  11897. }
  11898. return c.header_
  11899. }
  11900. func (c *ResourcesCalendarsInsertCall) doRequest(alt string) (*http.Response, error) {
  11901. reqHeaders := make(http.Header)
  11902. for k, v := range c.header_ {
  11903. reqHeaders[k] = v
  11904. }
  11905. reqHeaders.Set("User-Agent", c.s.userAgent())
  11906. var body io.Reader = nil
  11907. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarresource)
  11908. if err != nil {
  11909. return nil, err
  11910. }
  11911. reqHeaders.Set("Content-Type", "application/json")
  11912. c.urlParams_.Set("alt", alt)
  11913. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars")
  11914. urls += "?" + c.urlParams_.Encode()
  11915. req, _ := http.NewRequest("POST", urls, body)
  11916. req.Header = reqHeaders
  11917. googleapi.Expand(req.URL, map[string]string{
  11918. "customer": c.customer,
  11919. })
  11920. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11921. }
  11922. // Do executes the "directory.resources.calendars.insert" call.
  11923. // Exactly one of *CalendarResource or error will be non-nil. Any
  11924. // non-2xx status code is an error. Response headers are in either
  11925. // *CalendarResource.ServerResponse.Header or (if a response was
  11926. // returned at all) in error.(*googleapi.Error).Header. Use
  11927. // googleapi.IsNotModified to check whether the returned error was
  11928. // because http.StatusNotModified was returned.
  11929. func (c *ResourcesCalendarsInsertCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  11930. gensupport.SetOptions(c.urlParams_, opts...)
  11931. res, err := c.doRequest("json")
  11932. if res != nil && res.StatusCode == http.StatusNotModified {
  11933. if res.Body != nil {
  11934. res.Body.Close()
  11935. }
  11936. return nil, &googleapi.Error{
  11937. Code: res.StatusCode,
  11938. Header: res.Header,
  11939. }
  11940. }
  11941. if err != nil {
  11942. return nil, err
  11943. }
  11944. defer googleapi.CloseBody(res)
  11945. if err := googleapi.CheckResponse(res); err != nil {
  11946. return nil, err
  11947. }
  11948. ret := &CalendarResource{
  11949. ServerResponse: googleapi.ServerResponse{
  11950. Header: res.Header,
  11951. HTTPStatusCode: res.StatusCode,
  11952. },
  11953. }
  11954. target := &ret
  11955. if err := gensupport.DecodeResponse(target, res); err != nil {
  11956. return nil, err
  11957. }
  11958. return ret, nil
  11959. // {
  11960. // "description": "Inserts a calendar resource.",
  11961. // "httpMethod": "POST",
  11962. // "id": "directory.resources.calendars.insert",
  11963. // "parameterOrder": [
  11964. // "customer"
  11965. // ],
  11966. // "parameters": {
  11967. // "customer": {
  11968. // "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.",
  11969. // "location": "path",
  11970. // "required": true,
  11971. // "type": "string"
  11972. // }
  11973. // },
  11974. // "path": "customer/{customer}/resources/calendars",
  11975. // "request": {
  11976. // "$ref": "CalendarResource"
  11977. // },
  11978. // "response": {
  11979. // "$ref": "CalendarResource"
  11980. // },
  11981. // "scopes": [
  11982. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  11983. // ]
  11984. // }
  11985. }
  11986. // method id "directory.resources.calendars.list":
  11987. type ResourcesCalendarsListCall struct {
  11988. s *Service
  11989. customer string
  11990. urlParams_ gensupport.URLParams
  11991. ifNoneMatch_ string
  11992. ctx_ context.Context
  11993. header_ http.Header
  11994. }
  11995. // List: Retrieves a list of calendar resources for an account.
  11996. func (r *ResourcesCalendarsService) List(customer string) *ResourcesCalendarsListCall {
  11997. c := &ResourcesCalendarsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11998. c.customer = customer
  11999. return c
  12000. }
  12001. // MaxResults sets the optional parameter "maxResults": Maximum number
  12002. // of results to return.
  12003. func (c *ResourcesCalendarsListCall) MaxResults(maxResults int64) *ResourcesCalendarsListCall {
  12004. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  12005. return c
  12006. }
  12007. // OrderBy sets the optional parameter "orderBy": Field(s) to sort
  12008. // results by in either ascending or descending order. Supported fields
  12009. // include resourceId, resourceName, capacity, buildingId, and
  12010. // floorName. If no order is specified, defaults to ascending. Should be
  12011. // of the form "field [asc|desc], field [asc|desc], ...". For example
  12012. // buildingId, capacity desc would return results sorted first by
  12013. // buildingId in ascending order then by capacity in descending order.
  12014. func (c *ResourcesCalendarsListCall) OrderBy(orderBy string) *ResourcesCalendarsListCall {
  12015. c.urlParams_.Set("orderBy", orderBy)
  12016. return c
  12017. }
  12018. // PageToken sets the optional parameter "pageToken": Token to specify
  12019. // the next page in the list.
  12020. func (c *ResourcesCalendarsListCall) PageToken(pageToken string) *ResourcesCalendarsListCall {
  12021. c.urlParams_.Set("pageToken", pageToken)
  12022. return c
  12023. }
  12024. // Query sets the optional parameter "query": String query used to
  12025. // filter results. Should be of the form "field operator value" where
  12026. // field can be any of supported fields and operators can be any of
  12027. // supported operations. Operators include '=' for exact match and ':'
  12028. // for prefix match or HAS match where applicable. For prefix match, the
  12029. // value should always be followed by a *. Supported fields include
  12030. // generatedResourceName, name, buildingId,
  12031. // featureInstances.feature.name. For example buildingId=US-NYC-9TH AND
  12032. // featureInstances.feature.name:Phone.
  12033. func (c *ResourcesCalendarsListCall) Query(query string) *ResourcesCalendarsListCall {
  12034. c.urlParams_.Set("query", query)
  12035. return c
  12036. }
  12037. // Fields allows partial responses to be retrieved. See
  12038. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12039. // for more information.
  12040. func (c *ResourcesCalendarsListCall) Fields(s ...googleapi.Field) *ResourcesCalendarsListCall {
  12041. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12042. return c
  12043. }
  12044. // IfNoneMatch sets the optional parameter which makes the operation
  12045. // fail if the object's ETag matches the given value. This is useful for
  12046. // getting updates only after the object has changed since the last
  12047. // request. Use googleapi.IsNotModified to check whether the response
  12048. // error from Do is the result of In-None-Match.
  12049. func (c *ResourcesCalendarsListCall) IfNoneMatch(entityTag string) *ResourcesCalendarsListCall {
  12050. c.ifNoneMatch_ = entityTag
  12051. return c
  12052. }
  12053. // Context sets the context to be used in this call's Do method. Any
  12054. // pending HTTP request will be aborted if the provided context is
  12055. // canceled.
  12056. func (c *ResourcesCalendarsListCall) Context(ctx context.Context) *ResourcesCalendarsListCall {
  12057. c.ctx_ = ctx
  12058. return c
  12059. }
  12060. // Header returns an http.Header that can be modified by the caller to
  12061. // add HTTP headers to the request.
  12062. func (c *ResourcesCalendarsListCall) Header() http.Header {
  12063. if c.header_ == nil {
  12064. c.header_ = make(http.Header)
  12065. }
  12066. return c.header_
  12067. }
  12068. func (c *ResourcesCalendarsListCall) doRequest(alt string) (*http.Response, error) {
  12069. reqHeaders := make(http.Header)
  12070. for k, v := range c.header_ {
  12071. reqHeaders[k] = v
  12072. }
  12073. reqHeaders.Set("User-Agent", c.s.userAgent())
  12074. if c.ifNoneMatch_ != "" {
  12075. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12076. }
  12077. var body io.Reader = nil
  12078. c.urlParams_.Set("alt", alt)
  12079. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars")
  12080. urls += "?" + c.urlParams_.Encode()
  12081. req, _ := http.NewRequest("GET", urls, body)
  12082. req.Header = reqHeaders
  12083. googleapi.Expand(req.URL, map[string]string{
  12084. "customer": c.customer,
  12085. })
  12086. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12087. }
  12088. // Do executes the "directory.resources.calendars.list" call.
  12089. // Exactly one of *CalendarResources or error will be non-nil. Any
  12090. // non-2xx status code is an error. Response headers are in either
  12091. // *CalendarResources.ServerResponse.Header or (if a response was
  12092. // returned at all) in error.(*googleapi.Error).Header. Use
  12093. // googleapi.IsNotModified to check whether the returned error was
  12094. // because http.StatusNotModified was returned.
  12095. func (c *ResourcesCalendarsListCall) Do(opts ...googleapi.CallOption) (*CalendarResources, error) {
  12096. gensupport.SetOptions(c.urlParams_, opts...)
  12097. res, err := c.doRequest("json")
  12098. if res != nil && res.StatusCode == http.StatusNotModified {
  12099. if res.Body != nil {
  12100. res.Body.Close()
  12101. }
  12102. return nil, &googleapi.Error{
  12103. Code: res.StatusCode,
  12104. Header: res.Header,
  12105. }
  12106. }
  12107. if err != nil {
  12108. return nil, err
  12109. }
  12110. defer googleapi.CloseBody(res)
  12111. if err := googleapi.CheckResponse(res); err != nil {
  12112. return nil, err
  12113. }
  12114. ret := &CalendarResources{
  12115. ServerResponse: googleapi.ServerResponse{
  12116. Header: res.Header,
  12117. HTTPStatusCode: res.StatusCode,
  12118. },
  12119. }
  12120. target := &ret
  12121. if err := gensupport.DecodeResponse(target, res); err != nil {
  12122. return nil, err
  12123. }
  12124. return ret, nil
  12125. // {
  12126. // "description": "Retrieves a list of calendar resources for an account.",
  12127. // "httpMethod": "GET",
  12128. // "id": "directory.resources.calendars.list",
  12129. // "parameterOrder": [
  12130. // "customer"
  12131. // ],
  12132. // "parameters": {
  12133. // "customer": {
  12134. // "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.",
  12135. // "location": "path",
  12136. // "required": true,
  12137. // "type": "string"
  12138. // },
  12139. // "maxResults": {
  12140. // "description": "Maximum number of results to return.",
  12141. // "format": "int32",
  12142. // "location": "query",
  12143. // "maximum": "500",
  12144. // "minimum": "1",
  12145. // "type": "integer"
  12146. // },
  12147. // "orderBy": {
  12148. // "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.",
  12149. // "location": "query",
  12150. // "type": "string"
  12151. // },
  12152. // "pageToken": {
  12153. // "description": "Token to specify the next page in the list.",
  12154. // "location": "query",
  12155. // "type": "string"
  12156. // },
  12157. // "query": {
  12158. // "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.",
  12159. // "location": "query",
  12160. // "type": "string"
  12161. // }
  12162. // },
  12163. // "path": "customer/{customer}/resources/calendars",
  12164. // "response": {
  12165. // "$ref": "CalendarResources"
  12166. // },
  12167. // "scopes": [
  12168. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  12169. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  12170. // ]
  12171. // }
  12172. }
  12173. // Pages invokes f for each page of results.
  12174. // A non-nil error returned from f will halt the iteration.
  12175. // The provided context supersedes any context provided to the Context method.
  12176. func (c *ResourcesCalendarsListCall) Pages(ctx context.Context, f func(*CalendarResources) error) error {
  12177. c.ctx_ = ctx
  12178. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  12179. for {
  12180. x, err := c.Do()
  12181. if err != nil {
  12182. return err
  12183. }
  12184. if err := f(x); err != nil {
  12185. return err
  12186. }
  12187. if x.NextPageToken == "" {
  12188. return nil
  12189. }
  12190. c.PageToken(x.NextPageToken)
  12191. }
  12192. }
  12193. // method id "directory.resources.calendars.patch":
  12194. type ResourcesCalendarsPatchCall struct {
  12195. s *Service
  12196. customer string
  12197. calendarResourceId string
  12198. calendarresource *CalendarResource
  12199. urlParams_ gensupport.URLParams
  12200. ctx_ context.Context
  12201. header_ http.Header
  12202. }
  12203. // Patch: Updates a calendar resource.
  12204. //
  12205. // This method supports patch semantics, meaning you only need to
  12206. // include the fields you wish to update. Fields that are not present in
  12207. // the request will be preserved. This method supports patch semantics.
  12208. func (r *ResourcesCalendarsService) Patch(customer string, calendarResourceId string, calendarresource *CalendarResource) *ResourcesCalendarsPatchCall {
  12209. c := &ResourcesCalendarsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12210. c.customer = customer
  12211. c.calendarResourceId = calendarResourceId
  12212. c.calendarresource = calendarresource
  12213. return c
  12214. }
  12215. // Fields allows partial responses to be retrieved. See
  12216. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12217. // for more information.
  12218. func (c *ResourcesCalendarsPatchCall) Fields(s ...googleapi.Field) *ResourcesCalendarsPatchCall {
  12219. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12220. return c
  12221. }
  12222. // Context sets the context to be used in this call's Do method. Any
  12223. // pending HTTP request will be aborted if the provided context is
  12224. // canceled.
  12225. func (c *ResourcesCalendarsPatchCall) Context(ctx context.Context) *ResourcesCalendarsPatchCall {
  12226. c.ctx_ = ctx
  12227. return c
  12228. }
  12229. // Header returns an http.Header that can be modified by the caller to
  12230. // add HTTP headers to the request.
  12231. func (c *ResourcesCalendarsPatchCall) Header() http.Header {
  12232. if c.header_ == nil {
  12233. c.header_ = make(http.Header)
  12234. }
  12235. return c.header_
  12236. }
  12237. func (c *ResourcesCalendarsPatchCall) doRequest(alt string) (*http.Response, error) {
  12238. reqHeaders := make(http.Header)
  12239. for k, v := range c.header_ {
  12240. reqHeaders[k] = v
  12241. }
  12242. reqHeaders.Set("User-Agent", c.s.userAgent())
  12243. var body io.Reader = nil
  12244. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarresource)
  12245. if err != nil {
  12246. return nil, err
  12247. }
  12248. reqHeaders.Set("Content-Type", "application/json")
  12249. c.urlParams_.Set("alt", alt)
  12250. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  12251. urls += "?" + c.urlParams_.Encode()
  12252. req, _ := http.NewRequest("PATCH", urls, body)
  12253. req.Header = reqHeaders
  12254. googleapi.Expand(req.URL, map[string]string{
  12255. "customer": c.customer,
  12256. "calendarResourceId": c.calendarResourceId,
  12257. })
  12258. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12259. }
  12260. // Do executes the "directory.resources.calendars.patch" call.
  12261. // Exactly one of *CalendarResource or error will be non-nil. Any
  12262. // non-2xx status code is an error. Response headers are in either
  12263. // *CalendarResource.ServerResponse.Header or (if a response was
  12264. // returned at all) in error.(*googleapi.Error).Header. Use
  12265. // googleapi.IsNotModified to check whether the returned error was
  12266. // because http.StatusNotModified was returned.
  12267. func (c *ResourcesCalendarsPatchCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  12268. gensupport.SetOptions(c.urlParams_, opts...)
  12269. res, err := c.doRequest("json")
  12270. if res != nil && res.StatusCode == http.StatusNotModified {
  12271. if res.Body != nil {
  12272. res.Body.Close()
  12273. }
  12274. return nil, &googleapi.Error{
  12275. Code: res.StatusCode,
  12276. Header: res.Header,
  12277. }
  12278. }
  12279. if err != nil {
  12280. return nil, err
  12281. }
  12282. defer googleapi.CloseBody(res)
  12283. if err := googleapi.CheckResponse(res); err != nil {
  12284. return nil, err
  12285. }
  12286. ret := &CalendarResource{
  12287. ServerResponse: googleapi.ServerResponse{
  12288. Header: res.Header,
  12289. HTTPStatusCode: res.StatusCode,
  12290. },
  12291. }
  12292. target := &ret
  12293. if err := gensupport.DecodeResponse(target, res); err != nil {
  12294. return nil, err
  12295. }
  12296. return ret, nil
  12297. // {
  12298. // "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.",
  12299. // "httpMethod": "PATCH",
  12300. // "id": "directory.resources.calendars.patch",
  12301. // "parameterOrder": [
  12302. // "customer",
  12303. // "calendarResourceId"
  12304. // ],
  12305. // "parameters": {
  12306. // "calendarResourceId": {
  12307. // "description": "The unique ID of the calendar resource to update.",
  12308. // "location": "path",
  12309. // "required": true,
  12310. // "type": "string"
  12311. // },
  12312. // "customer": {
  12313. // "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.",
  12314. // "location": "path",
  12315. // "required": true,
  12316. // "type": "string"
  12317. // }
  12318. // },
  12319. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  12320. // "request": {
  12321. // "$ref": "CalendarResource"
  12322. // },
  12323. // "response": {
  12324. // "$ref": "CalendarResource"
  12325. // },
  12326. // "scopes": [
  12327. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  12328. // ]
  12329. // }
  12330. }
  12331. // method id "directory.resources.calendars.update":
  12332. type ResourcesCalendarsUpdateCall struct {
  12333. s *Service
  12334. customer string
  12335. calendarResourceId string
  12336. calendarresource *CalendarResource
  12337. urlParams_ gensupport.URLParams
  12338. ctx_ context.Context
  12339. header_ http.Header
  12340. }
  12341. // Update: Updates a calendar resource.
  12342. //
  12343. // This method supports patch semantics, meaning you only need to
  12344. // include the fields you wish to update. Fields that are not present in
  12345. // the request will be preserved.
  12346. func (r *ResourcesCalendarsService) Update(customer string, calendarResourceId string, calendarresource *CalendarResource) *ResourcesCalendarsUpdateCall {
  12347. c := &ResourcesCalendarsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12348. c.customer = customer
  12349. c.calendarResourceId = calendarResourceId
  12350. c.calendarresource = calendarresource
  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 *ResourcesCalendarsUpdateCall) Fields(s ...googleapi.Field) *ResourcesCalendarsUpdateCall {
  12357. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12358. return c
  12359. }
  12360. // Context sets the context to be used in this call's Do method. Any
  12361. // pending HTTP request will be aborted if the provided context is
  12362. // canceled.
  12363. func (c *ResourcesCalendarsUpdateCall) Context(ctx context.Context) *ResourcesCalendarsUpdateCall {
  12364. c.ctx_ = ctx
  12365. return c
  12366. }
  12367. // Header returns an http.Header that can be modified by the caller to
  12368. // add HTTP headers to the request.
  12369. func (c *ResourcesCalendarsUpdateCall) Header() http.Header {
  12370. if c.header_ == nil {
  12371. c.header_ = make(http.Header)
  12372. }
  12373. return c.header_
  12374. }
  12375. func (c *ResourcesCalendarsUpdateCall) doRequest(alt string) (*http.Response, error) {
  12376. reqHeaders := make(http.Header)
  12377. for k, v := range c.header_ {
  12378. reqHeaders[k] = v
  12379. }
  12380. reqHeaders.Set("User-Agent", c.s.userAgent())
  12381. var body io.Reader = nil
  12382. body, err := googleapi.WithoutDataWrapper.JSONReader(c.calendarresource)
  12383. if err != nil {
  12384. return nil, err
  12385. }
  12386. reqHeaders.Set("Content-Type", "application/json")
  12387. c.urlParams_.Set("alt", alt)
  12388. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/calendars/{calendarResourceId}")
  12389. urls += "?" + c.urlParams_.Encode()
  12390. req, _ := http.NewRequest("PUT", urls, body)
  12391. req.Header = reqHeaders
  12392. googleapi.Expand(req.URL, map[string]string{
  12393. "customer": c.customer,
  12394. "calendarResourceId": c.calendarResourceId,
  12395. })
  12396. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12397. }
  12398. // Do executes the "directory.resources.calendars.update" call.
  12399. // Exactly one of *CalendarResource or error will be non-nil. Any
  12400. // non-2xx status code is an error. Response headers are in either
  12401. // *CalendarResource.ServerResponse.Header or (if a response was
  12402. // returned at all) in error.(*googleapi.Error).Header. Use
  12403. // googleapi.IsNotModified to check whether the returned error was
  12404. // because http.StatusNotModified was returned.
  12405. func (c *ResourcesCalendarsUpdateCall) Do(opts ...googleapi.CallOption) (*CalendarResource, error) {
  12406. gensupport.SetOptions(c.urlParams_, opts...)
  12407. res, err := c.doRequest("json")
  12408. if res != nil && res.StatusCode == http.StatusNotModified {
  12409. if res.Body != nil {
  12410. res.Body.Close()
  12411. }
  12412. return nil, &googleapi.Error{
  12413. Code: res.StatusCode,
  12414. Header: res.Header,
  12415. }
  12416. }
  12417. if err != nil {
  12418. return nil, err
  12419. }
  12420. defer googleapi.CloseBody(res)
  12421. if err := googleapi.CheckResponse(res); err != nil {
  12422. return nil, err
  12423. }
  12424. ret := &CalendarResource{
  12425. ServerResponse: googleapi.ServerResponse{
  12426. Header: res.Header,
  12427. HTTPStatusCode: res.StatusCode,
  12428. },
  12429. }
  12430. target := &ret
  12431. if err := gensupport.DecodeResponse(target, res); err != nil {
  12432. return nil, err
  12433. }
  12434. return ret, nil
  12435. // {
  12436. // "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.",
  12437. // "httpMethod": "PUT",
  12438. // "id": "directory.resources.calendars.update",
  12439. // "parameterOrder": [
  12440. // "customer",
  12441. // "calendarResourceId"
  12442. // ],
  12443. // "parameters": {
  12444. // "calendarResourceId": {
  12445. // "description": "The unique ID of the calendar resource to update.",
  12446. // "location": "path",
  12447. // "required": true,
  12448. // "type": "string"
  12449. // },
  12450. // "customer": {
  12451. // "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.",
  12452. // "location": "path",
  12453. // "required": true,
  12454. // "type": "string"
  12455. // }
  12456. // },
  12457. // "path": "customer/{customer}/resources/calendars/{calendarResourceId}",
  12458. // "request": {
  12459. // "$ref": "CalendarResource"
  12460. // },
  12461. // "response": {
  12462. // "$ref": "CalendarResource"
  12463. // },
  12464. // "scopes": [
  12465. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  12466. // ]
  12467. // }
  12468. }
  12469. // method id "directory.resources.features.delete":
  12470. type ResourcesFeaturesDeleteCall struct {
  12471. s *Service
  12472. customer string
  12473. featureKey string
  12474. urlParams_ gensupport.URLParams
  12475. ctx_ context.Context
  12476. header_ http.Header
  12477. }
  12478. // Delete: Deletes a feature.
  12479. func (r *ResourcesFeaturesService) Delete(customer string, featureKey string) *ResourcesFeaturesDeleteCall {
  12480. c := &ResourcesFeaturesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12481. c.customer = customer
  12482. c.featureKey = featureKey
  12483. return c
  12484. }
  12485. // Fields allows partial responses to be retrieved. See
  12486. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12487. // for more information.
  12488. func (c *ResourcesFeaturesDeleteCall) Fields(s ...googleapi.Field) *ResourcesFeaturesDeleteCall {
  12489. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12490. return c
  12491. }
  12492. // Context sets the context to be used in this call's Do method. Any
  12493. // pending HTTP request will be aborted if the provided context is
  12494. // canceled.
  12495. func (c *ResourcesFeaturesDeleteCall) Context(ctx context.Context) *ResourcesFeaturesDeleteCall {
  12496. c.ctx_ = ctx
  12497. return c
  12498. }
  12499. // Header returns an http.Header that can be modified by the caller to
  12500. // add HTTP headers to the request.
  12501. func (c *ResourcesFeaturesDeleteCall) Header() http.Header {
  12502. if c.header_ == nil {
  12503. c.header_ = make(http.Header)
  12504. }
  12505. return c.header_
  12506. }
  12507. func (c *ResourcesFeaturesDeleteCall) doRequest(alt string) (*http.Response, error) {
  12508. reqHeaders := make(http.Header)
  12509. for k, v := range c.header_ {
  12510. reqHeaders[k] = v
  12511. }
  12512. reqHeaders.Set("User-Agent", c.s.userAgent())
  12513. var body io.Reader = nil
  12514. c.urlParams_.Set("alt", alt)
  12515. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features/{featureKey}")
  12516. urls += "?" + c.urlParams_.Encode()
  12517. req, _ := http.NewRequest("DELETE", urls, body)
  12518. req.Header = reqHeaders
  12519. googleapi.Expand(req.URL, map[string]string{
  12520. "customer": c.customer,
  12521. "featureKey": c.featureKey,
  12522. })
  12523. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12524. }
  12525. // Do executes the "directory.resources.features.delete" call.
  12526. func (c *ResourcesFeaturesDeleteCall) Do(opts ...googleapi.CallOption) error {
  12527. gensupport.SetOptions(c.urlParams_, opts...)
  12528. res, err := c.doRequest("json")
  12529. if err != nil {
  12530. return err
  12531. }
  12532. defer googleapi.CloseBody(res)
  12533. if err := googleapi.CheckResponse(res); err != nil {
  12534. return err
  12535. }
  12536. return nil
  12537. // {
  12538. // "description": "Deletes a feature.",
  12539. // "httpMethod": "DELETE",
  12540. // "id": "directory.resources.features.delete",
  12541. // "parameterOrder": [
  12542. // "customer",
  12543. // "featureKey"
  12544. // ],
  12545. // "parameters": {
  12546. // "customer": {
  12547. // "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.",
  12548. // "location": "path",
  12549. // "required": true,
  12550. // "type": "string"
  12551. // },
  12552. // "featureKey": {
  12553. // "description": "The unique ID of the feature to delete.",
  12554. // "location": "path",
  12555. // "required": true,
  12556. // "type": "string"
  12557. // }
  12558. // },
  12559. // "path": "customer/{customer}/resources/features/{featureKey}",
  12560. // "scopes": [
  12561. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  12562. // ]
  12563. // }
  12564. }
  12565. // method id "directory.resources.features.get":
  12566. type ResourcesFeaturesGetCall struct {
  12567. s *Service
  12568. customer string
  12569. featureKey string
  12570. urlParams_ gensupport.URLParams
  12571. ifNoneMatch_ string
  12572. ctx_ context.Context
  12573. header_ http.Header
  12574. }
  12575. // Get: Retrieves a feature.
  12576. func (r *ResourcesFeaturesService) Get(customer string, featureKey string) *ResourcesFeaturesGetCall {
  12577. c := &ResourcesFeaturesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12578. c.customer = customer
  12579. c.featureKey = featureKey
  12580. return c
  12581. }
  12582. // Fields allows partial responses to be retrieved. See
  12583. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12584. // for more information.
  12585. func (c *ResourcesFeaturesGetCall) Fields(s ...googleapi.Field) *ResourcesFeaturesGetCall {
  12586. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12587. return c
  12588. }
  12589. // IfNoneMatch sets the optional parameter which makes the operation
  12590. // fail if the object's ETag matches the given value. This is useful for
  12591. // getting updates only after the object has changed since the last
  12592. // request. Use googleapi.IsNotModified to check whether the response
  12593. // error from Do is the result of In-None-Match.
  12594. func (c *ResourcesFeaturesGetCall) IfNoneMatch(entityTag string) *ResourcesFeaturesGetCall {
  12595. c.ifNoneMatch_ = entityTag
  12596. return c
  12597. }
  12598. // Context sets the context to be used in this call's Do method. Any
  12599. // pending HTTP request will be aborted if the provided context is
  12600. // canceled.
  12601. func (c *ResourcesFeaturesGetCall) Context(ctx context.Context) *ResourcesFeaturesGetCall {
  12602. c.ctx_ = ctx
  12603. return c
  12604. }
  12605. // Header returns an http.Header that can be modified by the caller to
  12606. // add HTTP headers to the request.
  12607. func (c *ResourcesFeaturesGetCall) Header() http.Header {
  12608. if c.header_ == nil {
  12609. c.header_ = make(http.Header)
  12610. }
  12611. return c.header_
  12612. }
  12613. func (c *ResourcesFeaturesGetCall) doRequest(alt string) (*http.Response, error) {
  12614. reqHeaders := make(http.Header)
  12615. for k, v := range c.header_ {
  12616. reqHeaders[k] = v
  12617. }
  12618. reqHeaders.Set("User-Agent", c.s.userAgent())
  12619. if c.ifNoneMatch_ != "" {
  12620. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12621. }
  12622. var body io.Reader = nil
  12623. c.urlParams_.Set("alt", alt)
  12624. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features/{featureKey}")
  12625. urls += "?" + c.urlParams_.Encode()
  12626. req, _ := http.NewRequest("GET", urls, body)
  12627. req.Header = reqHeaders
  12628. googleapi.Expand(req.URL, map[string]string{
  12629. "customer": c.customer,
  12630. "featureKey": c.featureKey,
  12631. })
  12632. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12633. }
  12634. // Do executes the "directory.resources.features.get" call.
  12635. // Exactly one of *Feature or error will be non-nil. Any non-2xx status
  12636. // code is an error. Response headers are in either
  12637. // *Feature.ServerResponse.Header or (if a response was returned at all)
  12638. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12639. // check whether the returned error was because http.StatusNotModified
  12640. // was returned.
  12641. func (c *ResourcesFeaturesGetCall) Do(opts ...googleapi.CallOption) (*Feature, error) {
  12642. gensupport.SetOptions(c.urlParams_, opts...)
  12643. res, err := c.doRequest("json")
  12644. if res != nil && res.StatusCode == http.StatusNotModified {
  12645. if res.Body != nil {
  12646. res.Body.Close()
  12647. }
  12648. return nil, &googleapi.Error{
  12649. Code: res.StatusCode,
  12650. Header: res.Header,
  12651. }
  12652. }
  12653. if err != nil {
  12654. return nil, err
  12655. }
  12656. defer googleapi.CloseBody(res)
  12657. if err := googleapi.CheckResponse(res); err != nil {
  12658. return nil, err
  12659. }
  12660. ret := &Feature{
  12661. ServerResponse: googleapi.ServerResponse{
  12662. Header: res.Header,
  12663. HTTPStatusCode: res.StatusCode,
  12664. },
  12665. }
  12666. target := &ret
  12667. if err := gensupport.DecodeResponse(target, res); err != nil {
  12668. return nil, err
  12669. }
  12670. return ret, nil
  12671. // {
  12672. // "description": "Retrieves a feature.",
  12673. // "httpMethod": "GET",
  12674. // "id": "directory.resources.features.get",
  12675. // "parameterOrder": [
  12676. // "customer",
  12677. // "featureKey"
  12678. // ],
  12679. // "parameters": {
  12680. // "customer": {
  12681. // "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.",
  12682. // "location": "path",
  12683. // "required": true,
  12684. // "type": "string"
  12685. // },
  12686. // "featureKey": {
  12687. // "description": "The unique ID of the feature to retrieve.",
  12688. // "location": "path",
  12689. // "required": true,
  12690. // "type": "string"
  12691. // }
  12692. // },
  12693. // "path": "customer/{customer}/resources/features/{featureKey}",
  12694. // "response": {
  12695. // "$ref": "Feature"
  12696. // },
  12697. // "scopes": [
  12698. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  12699. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  12700. // ]
  12701. // }
  12702. }
  12703. // method id "directory.resources.features.insert":
  12704. type ResourcesFeaturesInsertCall struct {
  12705. s *Service
  12706. customer string
  12707. feature *Feature
  12708. urlParams_ gensupport.URLParams
  12709. ctx_ context.Context
  12710. header_ http.Header
  12711. }
  12712. // Insert: Inserts a feature.
  12713. func (r *ResourcesFeaturesService) Insert(customer string, feature *Feature) *ResourcesFeaturesInsertCall {
  12714. c := &ResourcesFeaturesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12715. c.customer = customer
  12716. c.feature = feature
  12717. return c
  12718. }
  12719. // Fields allows partial responses to be retrieved. See
  12720. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12721. // for more information.
  12722. func (c *ResourcesFeaturesInsertCall) Fields(s ...googleapi.Field) *ResourcesFeaturesInsertCall {
  12723. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12724. return c
  12725. }
  12726. // Context sets the context to be used in this call's Do method. Any
  12727. // pending HTTP request will be aborted if the provided context is
  12728. // canceled.
  12729. func (c *ResourcesFeaturesInsertCall) Context(ctx context.Context) *ResourcesFeaturesInsertCall {
  12730. c.ctx_ = ctx
  12731. return c
  12732. }
  12733. // Header returns an http.Header that can be modified by the caller to
  12734. // add HTTP headers to the request.
  12735. func (c *ResourcesFeaturesInsertCall) Header() http.Header {
  12736. if c.header_ == nil {
  12737. c.header_ = make(http.Header)
  12738. }
  12739. return c.header_
  12740. }
  12741. func (c *ResourcesFeaturesInsertCall) doRequest(alt string) (*http.Response, error) {
  12742. reqHeaders := make(http.Header)
  12743. for k, v := range c.header_ {
  12744. reqHeaders[k] = v
  12745. }
  12746. reqHeaders.Set("User-Agent", c.s.userAgent())
  12747. var body io.Reader = nil
  12748. body, err := googleapi.WithoutDataWrapper.JSONReader(c.feature)
  12749. if err != nil {
  12750. return nil, err
  12751. }
  12752. reqHeaders.Set("Content-Type", "application/json")
  12753. c.urlParams_.Set("alt", alt)
  12754. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features")
  12755. urls += "?" + c.urlParams_.Encode()
  12756. req, _ := http.NewRequest("POST", urls, body)
  12757. req.Header = reqHeaders
  12758. googleapi.Expand(req.URL, map[string]string{
  12759. "customer": c.customer,
  12760. })
  12761. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12762. }
  12763. // Do executes the "directory.resources.features.insert" call.
  12764. // Exactly one of *Feature or error will be non-nil. Any non-2xx status
  12765. // code is an error. Response headers are in either
  12766. // *Feature.ServerResponse.Header or (if a response was returned at all)
  12767. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12768. // check whether the returned error was because http.StatusNotModified
  12769. // was returned.
  12770. func (c *ResourcesFeaturesInsertCall) Do(opts ...googleapi.CallOption) (*Feature, error) {
  12771. gensupport.SetOptions(c.urlParams_, opts...)
  12772. res, err := c.doRequest("json")
  12773. if res != nil && res.StatusCode == http.StatusNotModified {
  12774. if res.Body != nil {
  12775. res.Body.Close()
  12776. }
  12777. return nil, &googleapi.Error{
  12778. Code: res.StatusCode,
  12779. Header: res.Header,
  12780. }
  12781. }
  12782. if err != nil {
  12783. return nil, err
  12784. }
  12785. defer googleapi.CloseBody(res)
  12786. if err := googleapi.CheckResponse(res); err != nil {
  12787. return nil, err
  12788. }
  12789. ret := &Feature{
  12790. ServerResponse: googleapi.ServerResponse{
  12791. Header: res.Header,
  12792. HTTPStatusCode: res.StatusCode,
  12793. },
  12794. }
  12795. target := &ret
  12796. if err := gensupport.DecodeResponse(target, res); err != nil {
  12797. return nil, err
  12798. }
  12799. return ret, nil
  12800. // {
  12801. // "description": "Inserts a feature.",
  12802. // "httpMethod": "POST",
  12803. // "id": "directory.resources.features.insert",
  12804. // "parameterOrder": [
  12805. // "customer"
  12806. // ],
  12807. // "parameters": {
  12808. // "customer": {
  12809. // "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.",
  12810. // "location": "path",
  12811. // "required": true,
  12812. // "type": "string"
  12813. // }
  12814. // },
  12815. // "path": "customer/{customer}/resources/features",
  12816. // "request": {
  12817. // "$ref": "Feature"
  12818. // },
  12819. // "response": {
  12820. // "$ref": "Feature"
  12821. // },
  12822. // "scopes": [
  12823. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  12824. // ]
  12825. // }
  12826. }
  12827. // method id "directory.resources.features.list":
  12828. type ResourcesFeaturesListCall struct {
  12829. s *Service
  12830. customer string
  12831. urlParams_ gensupport.URLParams
  12832. ifNoneMatch_ string
  12833. ctx_ context.Context
  12834. header_ http.Header
  12835. }
  12836. // List: Retrieves a list of features for an account.
  12837. func (r *ResourcesFeaturesService) List(customer string) *ResourcesFeaturesListCall {
  12838. c := &ResourcesFeaturesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12839. c.customer = customer
  12840. return c
  12841. }
  12842. // MaxResults sets the optional parameter "maxResults": Maximum number
  12843. // of results to return.
  12844. func (c *ResourcesFeaturesListCall) MaxResults(maxResults int64) *ResourcesFeaturesListCall {
  12845. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  12846. return c
  12847. }
  12848. // PageToken sets the optional parameter "pageToken": Token to specify
  12849. // the next page in the list.
  12850. func (c *ResourcesFeaturesListCall) PageToken(pageToken string) *ResourcesFeaturesListCall {
  12851. c.urlParams_.Set("pageToken", pageToken)
  12852. return c
  12853. }
  12854. // Fields allows partial responses to be retrieved. See
  12855. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12856. // for more information.
  12857. func (c *ResourcesFeaturesListCall) Fields(s ...googleapi.Field) *ResourcesFeaturesListCall {
  12858. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12859. return c
  12860. }
  12861. // IfNoneMatch sets the optional parameter which makes the operation
  12862. // fail if the object's ETag matches the given value. This is useful for
  12863. // getting updates only after the object has changed since the last
  12864. // request. Use googleapi.IsNotModified to check whether the response
  12865. // error from Do is the result of In-None-Match.
  12866. func (c *ResourcesFeaturesListCall) IfNoneMatch(entityTag string) *ResourcesFeaturesListCall {
  12867. c.ifNoneMatch_ = entityTag
  12868. return c
  12869. }
  12870. // Context sets the context to be used in this call's Do method. Any
  12871. // pending HTTP request will be aborted if the provided context is
  12872. // canceled.
  12873. func (c *ResourcesFeaturesListCall) Context(ctx context.Context) *ResourcesFeaturesListCall {
  12874. c.ctx_ = ctx
  12875. return c
  12876. }
  12877. // Header returns an http.Header that can be modified by the caller to
  12878. // add HTTP headers to the request.
  12879. func (c *ResourcesFeaturesListCall) Header() http.Header {
  12880. if c.header_ == nil {
  12881. c.header_ = make(http.Header)
  12882. }
  12883. return c.header_
  12884. }
  12885. func (c *ResourcesFeaturesListCall) doRequest(alt string) (*http.Response, error) {
  12886. reqHeaders := make(http.Header)
  12887. for k, v := range c.header_ {
  12888. reqHeaders[k] = v
  12889. }
  12890. reqHeaders.Set("User-Agent", c.s.userAgent())
  12891. if c.ifNoneMatch_ != "" {
  12892. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12893. }
  12894. var body io.Reader = nil
  12895. c.urlParams_.Set("alt", alt)
  12896. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features")
  12897. urls += "?" + c.urlParams_.Encode()
  12898. req, _ := http.NewRequest("GET", urls, body)
  12899. req.Header = reqHeaders
  12900. googleapi.Expand(req.URL, map[string]string{
  12901. "customer": c.customer,
  12902. })
  12903. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12904. }
  12905. // Do executes the "directory.resources.features.list" call.
  12906. // Exactly one of *Features or error will be non-nil. Any non-2xx status
  12907. // code is an error. Response headers are in either
  12908. // *Features.ServerResponse.Header or (if a response was returned at
  12909. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12910. // to check whether the returned error was because
  12911. // http.StatusNotModified was returned.
  12912. func (c *ResourcesFeaturesListCall) Do(opts ...googleapi.CallOption) (*Features, error) {
  12913. gensupport.SetOptions(c.urlParams_, opts...)
  12914. res, err := c.doRequest("json")
  12915. if res != nil && res.StatusCode == http.StatusNotModified {
  12916. if res.Body != nil {
  12917. res.Body.Close()
  12918. }
  12919. return nil, &googleapi.Error{
  12920. Code: res.StatusCode,
  12921. Header: res.Header,
  12922. }
  12923. }
  12924. if err != nil {
  12925. return nil, err
  12926. }
  12927. defer googleapi.CloseBody(res)
  12928. if err := googleapi.CheckResponse(res); err != nil {
  12929. return nil, err
  12930. }
  12931. ret := &Features{
  12932. ServerResponse: googleapi.ServerResponse{
  12933. Header: res.Header,
  12934. HTTPStatusCode: res.StatusCode,
  12935. },
  12936. }
  12937. target := &ret
  12938. if err := gensupport.DecodeResponse(target, res); err != nil {
  12939. return nil, err
  12940. }
  12941. return ret, nil
  12942. // {
  12943. // "description": "Retrieves a list of features for an account.",
  12944. // "httpMethod": "GET",
  12945. // "id": "directory.resources.features.list",
  12946. // "parameterOrder": [
  12947. // "customer"
  12948. // ],
  12949. // "parameters": {
  12950. // "customer": {
  12951. // "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.",
  12952. // "location": "path",
  12953. // "required": true,
  12954. // "type": "string"
  12955. // },
  12956. // "maxResults": {
  12957. // "description": "Maximum number of results to return.",
  12958. // "format": "int32",
  12959. // "location": "query",
  12960. // "maximum": "500",
  12961. // "minimum": "1",
  12962. // "type": "integer"
  12963. // },
  12964. // "pageToken": {
  12965. // "description": "Token to specify the next page in the list.",
  12966. // "location": "query",
  12967. // "type": "string"
  12968. // }
  12969. // },
  12970. // "path": "customer/{customer}/resources/features",
  12971. // "response": {
  12972. // "$ref": "Features"
  12973. // },
  12974. // "scopes": [
  12975. // "https://www.googleapis.com/auth/admin.directory.resource.calendar",
  12976. // "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly"
  12977. // ]
  12978. // }
  12979. }
  12980. // Pages invokes f for each page of results.
  12981. // A non-nil error returned from f will halt the iteration.
  12982. // The provided context supersedes any context provided to the Context method.
  12983. func (c *ResourcesFeaturesListCall) Pages(ctx context.Context, f func(*Features) error) error {
  12984. c.ctx_ = ctx
  12985. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  12986. for {
  12987. x, err := c.Do()
  12988. if err != nil {
  12989. return err
  12990. }
  12991. if err := f(x); err != nil {
  12992. return err
  12993. }
  12994. if x.NextPageToken == "" {
  12995. return nil
  12996. }
  12997. c.PageToken(x.NextPageToken)
  12998. }
  12999. }
  13000. // method id "directory.resources.features.patch":
  13001. type ResourcesFeaturesPatchCall struct {
  13002. s *Service
  13003. customer string
  13004. featureKey string
  13005. feature *Feature
  13006. urlParams_ gensupport.URLParams
  13007. ctx_ context.Context
  13008. header_ http.Header
  13009. }
  13010. // Patch: Updates a feature. This method supports patch semantics.
  13011. func (r *ResourcesFeaturesService) Patch(customer string, featureKey string, feature *Feature) *ResourcesFeaturesPatchCall {
  13012. c := &ResourcesFeaturesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13013. c.customer = customer
  13014. c.featureKey = featureKey
  13015. c.feature = feature
  13016. return c
  13017. }
  13018. // Fields allows partial responses to be retrieved. See
  13019. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13020. // for more information.
  13021. func (c *ResourcesFeaturesPatchCall) Fields(s ...googleapi.Field) *ResourcesFeaturesPatchCall {
  13022. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13023. return c
  13024. }
  13025. // Context sets the context to be used in this call's Do method. Any
  13026. // pending HTTP request will be aborted if the provided context is
  13027. // canceled.
  13028. func (c *ResourcesFeaturesPatchCall) Context(ctx context.Context) *ResourcesFeaturesPatchCall {
  13029. c.ctx_ = ctx
  13030. return c
  13031. }
  13032. // Header returns an http.Header that can be modified by the caller to
  13033. // add HTTP headers to the request.
  13034. func (c *ResourcesFeaturesPatchCall) Header() http.Header {
  13035. if c.header_ == nil {
  13036. c.header_ = make(http.Header)
  13037. }
  13038. return c.header_
  13039. }
  13040. func (c *ResourcesFeaturesPatchCall) doRequest(alt string) (*http.Response, error) {
  13041. reqHeaders := make(http.Header)
  13042. for k, v := range c.header_ {
  13043. reqHeaders[k] = v
  13044. }
  13045. reqHeaders.Set("User-Agent", c.s.userAgent())
  13046. var body io.Reader = nil
  13047. body, err := googleapi.WithoutDataWrapper.JSONReader(c.feature)
  13048. if err != nil {
  13049. return nil, err
  13050. }
  13051. reqHeaders.Set("Content-Type", "application/json")
  13052. c.urlParams_.Set("alt", alt)
  13053. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features/{featureKey}")
  13054. urls += "?" + c.urlParams_.Encode()
  13055. req, _ := http.NewRequest("PATCH", urls, body)
  13056. req.Header = reqHeaders
  13057. googleapi.Expand(req.URL, map[string]string{
  13058. "customer": c.customer,
  13059. "featureKey": c.featureKey,
  13060. })
  13061. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13062. }
  13063. // Do executes the "directory.resources.features.patch" call.
  13064. // Exactly one of *Feature or error will be non-nil. Any non-2xx status
  13065. // code is an error. Response headers are in either
  13066. // *Feature.ServerResponse.Header or (if a response was returned at all)
  13067. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  13068. // check whether the returned error was because http.StatusNotModified
  13069. // was returned.
  13070. func (c *ResourcesFeaturesPatchCall) Do(opts ...googleapi.CallOption) (*Feature, error) {
  13071. gensupport.SetOptions(c.urlParams_, opts...)
  13072. res, err := c.doRequest("json")
  13073. if res != nil && res.StatusCode == http.StatusNotModified {
  13074. if res.Body != nil {
  13075. res.Body.Close()
  13076. }
  13077. return nil, &googleapi.Error{
  13078. Code: res.StatusCode,
  13079. Header: res.Header,
  13080. }
  13081. }
  13082. if err != nil {
  13083. return nil, err
  13084. }
  13085. defer googleapi.CloseBody(res)
  13086. if err := googleapi.CheckResponse(res); err != nil {
  13087. return nil, err
  13088. }
  13089. ret := &Feature{
  13090. ServerResponse: googleapi.ServerResponse{
  13091. Header: res.Header,
  13092. HTTPStatusCode: res.StatusCode,
  13093. },
  13094. }
  13095. target := &ret
  13096. if err := gensupport.DecodeResponse(target, res); err != nil {
  13097. return nil, err
  13098. }
  13099. return ret, nil
  13100. // {
  13101. // "description": "Updates a feature. This method supports patch semantics.",
  13102. // "httpMethod": "PATCH",
  13103. // "id": "directory.resources.features.patch",
  13104. // "parameterOrder": [
  13105. // "customer",
  13106. // "featureKey"
  13107. // ],
  13108. // "parameters": {
  13109. // "customer": {
  13110. // "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.",
  13111. // "location": "path",
  13112. // "required": true,
  13113. // "type": "string"
  13114. // },
  13115. // "featureKey": {
  13116. // "description": "The unique ID of the feature to update.",
  13117. // "location": "path",
  13118. // "required": true,
  13119. // "type": "string"
  13120. // }
  13121. // },
  13122. // "path": "customer/{customer}/resources/features/{featureKey}",
  13123. // "request": {
  13124. // "$ref": "Feature"
  13125. // },
  13126. // "response": {
  13127. // "$ref": "Feature"
  13128. // },
  13129. // "scopes": [
  13130. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  13131. // ]
  13132. // }
  13133. }
  13134. // method id "directory.resources.features.rename":
  13135. type ResourcesFeaturesRenameCall struct {
  13136. s *Service
  13137. customer string
  13138. oldName string
  13139. featurerename *FeatureRename
  13140. urlParams_ gensupport.URLParams
  13141. ctx_ context.Context
  13142. header_ http.Header
  13143. }
  13144. // Rename: Renames a feature.
  13145. func (r *ResourcesFeaturesService) Rename(customer string, oldName string, featurerename *FeatureRename) *ResourcesFeaturesRenameCall {
  13146. c := &ResourcesFeaturesRenameCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13147. c.customer = customer
  13148. c.oldName = oldName
  13149. c.featurerename = featurerename
  13150. return c
  13151. }
  13152. // Fields allows partial responses to be retrieved. See
  13153. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13154. // for more information.
  13155. func (c *ResourcesFeaturesRenameCall) Fields(s ...googleapi.Field) *ResourcesFeaturesRenameCall {
  13156. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13157. return c
  13158. }
  13159. // Context sets the context to be used in this call's Do method. Any
  13160. // pending HTTP request will be aborted if the provided context is
  13161. // canceled.
  13162. func (c *ResourcesFeaturesRenameCall) Context(ctx context.Context) *ResourcesFeaturesRenameCall {
  13163. c.ctx_ = ctx
  13164. return c
  13165. }
  13166. // Header returns an http.Header that can be modified by the caller to
  13167. // add HTTP headers to the request.
  13168. func (c *ResourcesFeaturesRenameCall) Header() http.Header {
  13169. if c.header_ == nil {
  13170. c.header_ = make(http.Header)
  13171. }
  13172. return c.header_
  13173. }
  13174. func (c *ResourcesFeaturesRenameCall) doRequest(alt string) (*http.Response, error) {
  13175. reqHeaders := make(http.Header)
  13176. for k, v := range c.header_ {
  13177. reqHeaders[k] = v
  13178. }
  13179. reqHeaders.Set("User-Agent", c.s.userAgent())
  13180. var body io.Reader = nil
  13181. body, err := googleapi.WithoutDataWrapper.JSONReader(c.featurerename)
  13182. if err != nil {
  13183. return nil, err
  13184. }
  13185. reqHeaders.Set("Content-Type", "application/json")
  13186. c.urlParams_.Set("alt", alt)
  13187. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features/{oldName}/rename")
  13188. urls += "?" + c.urlParams_.Encode()
  13189. req, _ := http.NewRequest("POST", urls, body)
  13190. req.Header = reqHeaders
  13191. googleapi.Expand(req.URL, map[string]string{
  13192. "customer": c.customer,
  13193. "oldName": c.oldName,
  13194. })
  13195. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13196. }
  13197. // Do executes the "directory.resources.features.rename" call.
  13198. func (c *ResourcesFeaturesRenameCall) Do(opts ...googleapi.CallOption) error {
  13199. gensupport.SetOptions(c.urlParams_, opts...)
  13200. res, err := c.doRequest("json")
  13201. if err != nil {
  13202. return err
  13203. }
  13204. defer googleapi.CloseBody(res)
  13205. if err := googleapi.CheckResponse(res); err != nil {
  13206. return err
  13207. }
  13208. return nil
  13209. // {
  13210. // "description": "Renames a feature.",
  13211. // "httpMethod": "POST",
  13212. // "id": "directory.resources.features.rename",
  13213. // "parameterOrder": [
  13214. // "customer",
  13215. // "oldName"
  13216. // ],
  13217. // "parameters": {
  13218. // "customer": {
  13219. // "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.",
  13220. // "location": "path",
  13221. // "required": true,
  13222. // "type": "string"
  13223. // },
  13224. // "oldName": {
  13225. // "description": "The unique ID of the feature to rename.",
  13226. // "location": "path",
  13227. // "required": true,
  13228. // "type": "string"
  13229. // }
  13230. // },
  13231. // "path": "customer/{customer}/resources/features/{oldName}/rename",
  13232. // "request": {
  13233. // "$ref": "FeatureRename"
  13234. // },
  13235. // "scopes": [
  13236. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  13237. // ]
  13238. // }
  13239. }
  13240. // method id "directory.resources.features.update":
  13241. type ResourcesFeaturesUpdateCall struct {
  13242. s *Service
  13243. customer string
  13244. featureKey string
  13245. feature *Feature
  13246. urlParams_ gensupport.URLParams
  13247. ctx_ context.Context
  13248. header_ http.Header
  13249. }
  13250. // Update: Updates a feature.
  13251. func (r *ResourcesFeaturesService) Update(customer string, featureKey string, feature *Feature) *ResourcesFeaturesUpdateCall {
  13252. c := &ResourcesFeaturesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13253. c.customer = customer
  13254. c.featureKey = featureKey
  13255. c.feature = feature
  13256. return c
  13257. }
  13258. // Fields allows partial responses to be retrieved. See
  13259. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13260. // for more information.
  13261. func (c *ResourcesFeaturesUpdateCall) Fields(s ...googleapi.Field) *ResourcesFeaturesUpdateCall {
  13262. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13263. return c
  13264. }
  13265. // Context sets the context to be used in this call's Do method. Any
  13266. // pending HTTP request will be aborted if the provided context is
  13267. // canceled.
  13268. func (c *ResourcesFeaturesUpdateCall) Context(ctx context.Context) *ResourcesFeaturesUpdateCall {
  13269. c.ctx_ = ctx
  13270. return c
  13271. }
  13272. // Header returns an http.Header that can be modified by the caller to
  13273. // add HTTP headers to the request.
  13274. func (c *ResourcesFeaturesUpdateCall) Header() http.Header {
  13275. if c.header_ == nil {
  13276. c.header_ = make(http.Header)
  13277. }
  13278. return c.header_
  13279. }
  13280. func (c *ResourcesFeaturesUpdateCall) doRequest(alt string) (*http.Response, error) {
  13281. reqHeaders := make(http.Header)
  13282. for k, v := range c.header_ {
  13283. reqHeaders[k] = v
  13284. }
  13285. reqHeaders.Set("User-Agent", c.s.userAgent())
  13286. var body io.Reader = nil
  13287. body, err := googleapi.WithoutDataWrapper.JSONReader(c.feature)
  13288. if err != nil {
  13289. return nil, err
  13290. }
  13291. reqHeaders.Set("Content-Type", "application/json")
  13292. c.urlParams_.Set("alt", alt)
  13293. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/resources/features/{featureKey}")
  13294. urls += "?" + c.urlParams_.Encode()
  13295. req, _ := http.NewRequest("PUT", urls, body)
  13296. req.Header = reqHeaders
  13297. googleapi.Expand(req.URL, map[string]string{
  13298. "customer": c.customer,
  13299. "featureKey": c.featureKey,
  13300. })
  13301. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13302. }
  13303. // Do executes the "directory.resources.features.update" call.
  13304. // Exactly one of *Feature or error will be non-nil. Any non-2xx status
  13305. // code is an error. Response headers are in either
  13306. // *Feature.ServerResponse.Header or (if a response was returned at all)
  13307. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  13308. // check whether the returned error was because http.StatusNotModified
  13309. // was returned.
  13310. func (c *ResourcesFeaturesUpdateCall) Do(opts ...googleapi.CallOption) (*Feature, error) {
  13311. gensupport.SetOptions(c.urlParams_, opts...)
  13312. res, err := c.doRequest("json")
  13313. if res != nil && res.StatusCode == http.StatusNotModified {
  13314. if res.Body != nil {
  13315. res.Body.Close()
  13316. }
  13317. return nil, &googleapi.Error{
  13318. Code: res.StatusCode,
  13319. Header: res.Header,
  13320. }
  13321. }
  13322. if err != nil {
  13323. return nil, err
  13324. }
  13325. defer googleapi.CloseBody(res)
  13326. if err := googleapi.CheckResponse(res); err != nil {
  13327. return nil, err
  13328. }
  13329. ret := &Feature{
  13330. ServerResponse: googleapi.ServerResponse{
  13331. Header: res.Header,
  13332. HTTPStatusCode: res.StatusCode,
  13333. },
  13334. }
  13335. target := &ret
  13336. if err := gensupport.DecodeResponse(target, res); err != nil {
  13337. return nil, err
  13338. }
  13339. return ret, nil
  13340. // {
  13341. // "description": "Updates a feature.",
  13342. // "httpMethod": "PUT",
  13343. // "id": "directory.resources.features.update",
  13344. // "parameterOrder": [
  13345. // "customer",
  13346. // "featureKey"
  13347. // ],
  13348. // "parameters": {
  13349. // "customer": {
  13350. // "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.",
  13351. // "location": "path",
  13352. // "required": true,
  13353. // "type": "string"
  13354. // },
  13355. // "featureKey": {
  13356. // "description": "The unique ID of the feature to update.",
  13357. // "location": "path",
  13358. // "required": true,
  13359. // "type": "string"
  13360. // }
  13361. // },
  13362. // "path": "customer/{customer}/resources/features/{featureKey}",
  13363. // "request": {
  13364. // "$ref": "Feature"
  13365. // },
  13366. // "response": {
  13367. // "$ref": "Feature"
  13368. // },
  13369. // "scopes": [
  13370. // "https://www.googleapis.com/auth/admin.directory.resource.calendar"
  13371. // ]
  13372. // }
  13373. }
  13374. // method id "directory.roleAssignments.delete":
  13375. type RoleAssignmentsDeleteCall struct {
  13376. s *Service
  13377. customer string
  13378. roleAssignmentId string
  13379. urlParams_ gensupport.URLParams
  13380. ctx_ context.Context
  13381. header_ http.Header
  13382. }
  13383. // Delete: Deletes a role assignment.
  13384. func (r *RoleAssignmentsService) Delete(customer string, roleAssignmentId string) *RoleAssignmentsDeleteCall {
  13385. c := &RoleAssignmentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13386. c.customer = customer
  13387. c.roleAssignmentId = roleAssignmentId
  13388. return c
  13389. }
  13390. // Fields allows partial responses to be retrieved. See
  13391. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13392. // for more information.
  13393. func (c *RoleAssignmentsDeleteCall) Fields(s ...googleapi.Field) *RoleAssignmentsDeleteCall {
  13394. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13395. return c
  13396. }
  13397. // Context sets the context to be used in this call's Do method. Any
  13398. // pending HTTP request will be aborted if the provided context is
  13399. // canceled.
  13400. func (c *RoleAssignmentsDeleteCall) Context(ctx context.Context) *RoleAssignmentsDeleteCall {
  13401. c.ctx_ = ctx
  13402. return c
  13403. }
  13404. // Header returns an http.Header that can be modified by the caller to
  13405. // add HTTP headers to the request.
  13406. func (c *RoleAssignmentsDeleteCall) Header() http.Header {
  13407. if c.header_ == nil {
  13408. c.header_ = make(http.Header)
  13409. }
  13410. return c.header_
  13411. }
  13412. func (c *RoleAssignmentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  13413. reqHeaders := make(http.Header)
  13414. for k, v := range c.header_ {
  13415. reqHeaders[k] = v
  13416. }
  13417. reqHeaders.Set("User-Agent", c.s.userAgent())
  13418. var body io.Reader = nil
  13419. c.urlParams_.Set("alt", alt)
  13420. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments/{roleAssignmentId}")
  13421. urls += "?" + c.urlParams_.Encode()
  13422. req, _ := http.NewRequest("DELETE", urls, body)
  13423. req.Header = reqHeaders
  13424. googleapi.Expand(req.URL, map[string]string{
  13425. "customer": c.customer,
  13426. "roleAssignmentId": c.roleAssignmentId,
  13427. })
  13428. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13429. }
  13430. // Do executes the "directory.roleAssignments.delete" call.
  13431. func (c *RoleAssignmentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  13432. gensupport.SetOptions(c.urlParams_, opts...)
  13433. res, err := c.doRequest("json")
  13434. if err != nil {
  13435. return err
  13436. }
  13437. defer googleapi.CloseBody(res)
  13438. if err := googleapi.CheckResponse(res); err != nil {
  13439. return err
  13440. }
  13441. return nil
  13442. // {
  13443. // "description": "Deletes a role assignment.",
  13444. // "httpMethod": "DELETE",
  13445. // "id": "directory.roleAssignments.delete",
  13446. // "parameterOrder": [
  13447. // "customer",
  13448. // "roleAssignmentId"
  13449. // ],
  13450. // "parameters": {
  13451. // "customer": {
  13452. // "description": "Immutable ID of the G Suite account.",
  13453. // "location": "path",
  13454. // "required": true,
  13455. // "type": "string"
  13456. // },
  13457. // "roleAssignmentId": {
  13458. // "description": "Immutable ID of the role assignment.",
  13459. // "location": "path",
  13460. // "required": true,
  13461. // "type": "string"
  13462. // }
  13463. // },
  13464. // "path": "customer/{customer}/roleassignments/{roleAssignmentId}",
  13465. // "scopes": [
  13466. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  13467. // ]
  13468. // }
  13469. }
  13470. // method id "directory.roleAssignments.get":
  13471. type RoleAssignmentsGetCall struct {
  13472. s *Service
  13473. customer string
  13474. roleAssignmentId string
  13475. urlParams_ gensupport.URLParams
  13476. ifNoneMatch_ string
  13477. ctx_ context.Context
  13478. header_ http.Header
  13479. }
  13480. // Get: Retrieve a role assignment.
  13481. func (r *RoleAssignmentsService) Get(customer string, roleAssignmentId string) *RoleAssignmentsGetCall {
  13482. c := &RoleAssignmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13483. c.customer = customer
  13484. c.roleAssignmentId = roleAssignmentId
  13485. return c
  13486. }
  13487. // Fields allows partial responses to be retrieved. See
  13488. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13489. // for more information.
  13490. func (c *RoleAssignmentsGetCall) Fields(s ...googleapi.Field) *RoleAssignmentsGetCall {
  13491. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13492. return c
  13493. }
  13494. // IfNoneMatch sets the optional parameter which makes the operation
  13495. // fail if the object's ETag matches the given value. This is useful for
  13496. // getting updates only after the object has changed since the last
  13497. // request. Use googleapi.IsNotModified to check whether the response
  13498. // error from Do is the result of In-None-Match.
  13499. func (c *RoleAssignmentsGetCall) IfNoneMatch(entityTag string) *RoleAssignmentsGetCall {
  13500. c.ifNoneMatch_ = entityTag
  13501. return c
  13502. }
  13503. // Context sets the context to be used in this call's Do method. Any
  13504. // pending HTTP request will be aborted if the provided context is
  13505. // canceled.
  13506. func (c *RoleAssignmentsGetCall) Context(ctx context.Context) *RoleAssignmentsGetCall {
  13507. c.ctx_ = ctx
  13508. return c
  13509. }
  13510. // Header returns an http.Header that can be modified by the caller to
  13511. // add HTTP headers to the request.
  13512. func (c *RoleAssignmentsGetCall) Header() http.Header {
  13513. if c.header_ == nil {
  13514. c.header_ = make(http.Header)
  13515. }
  13516. return c.header_
  13517. }
  13518. func (c *RoleAssignmentsGetCall) doRequest(alt string) (*http.Response, error) {
  13519. reqHeaders := make(http.Header)
  13520. for k, v := range c.header_ {
  13521. reqHeaders[k] = v
  13522. }
  13523. reqHeaders.Set("User-Agent", c.s.userAgent())
  13524. if c.ifNoneMatch_ != "" {
  13525. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  13526. }
  13527. var body io.Reader = nil
  13528. c.urlParams_.Set("alt", alt)
  13529. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments/{roleAssignmentId}")
  13530. urls += "?" + c.urlParams_.Encode()
  13531. req, _ := http.NewRequest("GET", urls, body)
  13532. req.Header = reqHeaders
  13533. googleapi.Expand(req.URL, map[string]string{
  13534. "customer": c.customer,
  13535. "roleAssignmentId": c.roleAssignmentId,
  13536. })
  13537. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13538. }
  13539. // Do executes the "directory.roleAssignments.get" call.
  13540. // Exactly one of *RoleAssignment or error will be non-nil. Any non-2xx
  13541. // status code is an error. Response headers are in either
  13542. // *RoleAssignment.ServerResponse.Header or (if a response was returned
  13543. // at all) in error.(*googleapi.Error).Header. Use
  13544. // googleapi.IsNotModified to check whether the returned error was
  13545. // because http.StatusNotModified was returned.
  13546. func (c *RoleAssignmentsGetCall) Do(opts ...googleapi.CallOption) (*RoleAssignment, error) {
  13547. gensupport.SetOptions(c.urlParams_, opts...)
  13548. res, err := c.doRequest("json")
  13549. if res != nil && res.StatusCode == http.StatusNotModified {
  13550. if res.Body != nil {
  13551. res.Body.Close()
  13552. }
  13553. return nil, &googleapi.Error{
  13554. Code: res.StatusCode,
  13555. Header: res.Header,
  13556. }
  13557. }
  13558. if err != nil {
  13559. return nil, err
  13560. }
  13561. defer googleapi.CloseBody(res)
  13562. if err := googleapi.CheckResponse(res); err != nil {
  13563. return nil, err
  13564. }
  13565. ret := &RoleAssignment{
  13566. ServerResponse: googleapi.ServerResponse{
  13567. Header: res.Header,
  13568. HTTPStatusCode: res.StatusCode,
  13569. },
  13570. }
  13571. target := &ret
  13572. if err := gensupport.DecodeResponse(target, res); err != nil {
  13573. return nil, err
  13574. }
  13575. return ret, nil
  13576. // {
  13577. // "description": "Retrieve a role assignment.",
  13578. // "httpMethod": "GET",
  13579. // "id": "directory.roleAssignments.get",
  13580. // "parameterOrder": [
  13581. // "customer",
  13582. // "roleAssignmentId"
  13583. // ],
  13584. // "parameters": {
  13585. // "customer": {
  13586. // "description": "Immutable ID of the G Suite account.",
  13587. // "location": "path",
  13588. // "required": true,
  13589. // "type": "string"
  13590. // },
  13591. // "roleAssignmentId": {
  13592. // "description": "Immutable ID of the role assignment.",
  13593. // "location": "path",
  13594. // "required": true,
  13595. // "type": "string"
  13596. // }
  13597. // },
  13598. // "path": "customer/{customer}/roleassignments/{roleAssignmentId}",
  13599. // "response": {
  13600. // "$ref": "RoleAssignment"
  13601. // },
  13602. // "scopes": [
  13603. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  13604. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  13605. // ]
  13606. // }
  13607. }
  13608. // method id "directory.roleAssignments.insert":
  13609. type RoleAssignmentsInsertCall struct {
  13610. s *Service
  13611. customer string
  13612. roleassignment *RoleAssignment
  13613. urlParams_ gensupport.URLParams
  13614. ctx_ context.Context
  13615. header_ http.Header
  13616. }
  13617. // Insert: Creates a role assignment.
  13618. func (r *RoleAssignmentsService) Insert(customer string, roleassignment *RoleAssignment) *RoleAssignmentsInsertCall {
  13619. c := &RoleAssignmentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13620. c.customer = customer
  13621. c.roleassignment = roleassignment
  13622. return c
  13623. }
  13624. // Fields allows partial responses to be retrieved. See
  13625. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13626. // for more information.
  13627. func (c *RoleAssignmentsInsertCall) Fields(s ...googleapi.Field) *RoleAssignmentsInsertCall {
  13628. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13629. return c
  13630. }
  13631. // Context sets the context to be used in this call's Do method. Any
  13632. // pending HTTP request will be aborted if the provided context is
  13633. // canceled.
  13634. func (c *RoleAssignmentsInsertCall) Context(ctx context.Context) *RoleAssignmentsInsertCall {
  13635. c.ctx_ = ctx
  13636. return c
  13637. }
  13638. // Header returns an http.Header that can be modified by the caller to
  13639. // add HTTP headers to the request.
  13640. func (c *RoleAssignmentsInsertCall) Header() http.Header {
  13641. if c.header_ == nil {
  13642. c.header_ = make(http.Header)
  13643. }
  13644. return c.header_
  13645. }
  13646. func (c *RoleAssignmentsInsertCall) doRequest(alt string) (*http.Response, error) {
  13647. reqHeaders := make(http.Header)
  13648. for k, v := range c.header_ {
  13649. reqHeaders[k] = v
  13650. }
  13651. reqHeaders.Set("User-Agent", c.s.userAgent())
  13652. var body io.Reader = nil
  13653. body, err := googleapi.WithoutDataWrapper.JSONReader(c.roleassignment)
  13654. if err != nil {
  13655. return nil, err
  13656. }
  13657. reqHeaders.Set("Content-Type", "application/json")
  13658. c.urlParams_.Set("alt", alt)
  13659. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments")
  13660. urls += "?" + c.urlParams_.Encode()
  13661. req, _ := http.NewRequest("POST", urls, body)
  13662. req.Header = reqHeaders
  13663. googleapi.Expand(req.URL, map[string]string{
  13664. "customer": c.customer,
  13665. })
  13666. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13667. }
  13668. // Do executes the "directory.roleAssignments.insert" call.
  13669. // Exactly one of *RoleAssignment or error will be non-nil. Any non-2xx
  13670. // status code is an error. Response headers are in either
  13671. // *RoleAssignment.ServerResponse.Header or (if a response was returned
  13672. // at all) in error.(*googleapi.Error).Header. Use
  13673. // googleapi.IsNotModified to check whether the returned error was
  13674. // because http.StatusNotModified was returned.
  13675. func (c *RoleAssignmentsInsertCall) Do(opts ...googleapi.CallOption) (*RoleAssignment, error) {
  13676. gensupport.SetOptions(c.urlParams_, opts...)
  13677. res, err := c.doRequest("json")
  13678. if res != nil && res.StatusCode == http.StatusNotModified {
  13679. if res.Body != nil {
  13680. res.Body.Close()
  13681. }
  13682. return nil, &googleapi.Error{
  13683. Code: res.StatusCode,
  13684. Header: res.Header,
  13685. }
  13686. }
  13687. if err != nil {
  13688. return nil, err
  13689. }
  13690. defer googleapi.CloseBody(res)
  13691. if err := googleapi.CheckResponse(res); err != nil {
  13692. return nil, err
  13693. }
  13694. ret := &RoleAssignment{
  13695. ServerResponse: googleapi.ServerResponse{
  13696. Header: res.Header,
  13697. HTTPStatusCode: res.StatusCode,
  13698. },
  13699. }
  13700. target := &ret
  13701. if err := gensupport.DecodeResponse(target, res); err != nil {
  13702. return nil, err
  13703. }
  13704. return ret, nil
  13705. // {
  13706. // "description": "Creates a role assignment.",
  13707. // "httpMethod": "POST",
  13708. // "id": "directory.roleAssignments.insert",
  13709. // "parameterOrder": [
  13710. // "customer"
  13711. // ],
  13712. // "parameters": {
  13713. // "customer": {
  13714. // "description": "Immutable ID of the G Suite account.",
  13715. // "location": "path",
  13716. // "required": true,
  13717. // "type": "string"
  13718. // }
  13719. // },
  13720. // "path": "customer/{customer}/roleassignments",
  13721. // "request": {
  13722. // "$ref": "RoleAssignment"
  13723. // },
  13724. // "response": {
  13725. // "$ref": "RoleAssignment"
  13726. // },
  13727. // "scopes": [
  13728. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  13729. // ]
  13730. // }
  13731. }
  13732. // method id "directory.roleAssignments.list":
  13733. type RoleAssignmentsListCall struct {
  13734. s *Service
  13735. customer string
  13736. urlParams_ gensupport.URLParams
  13737. ifNoneMatch_ string
  13738. ctx_ context.Context
  13739. header_ http.Header
  13740. }
  13741. // List: Retrieves a paginated list of all roleAssignments.
  13742. func (r *RoleAssignmentsService) List(customer string) *RoleAssignmentsListCall {
  13743. c := &RoleAssignmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13744. c.customer = customer
  13745. return c
  13746. }
  13747. // MaxResults sets the optional parameter "maxResults": Maximum number
  13748. // of results to return.
  13749. func (c *RoleAssignmentsListCall) MaxResults(maxResults int64) *RoleAssignmentsListCall {
  13750. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  13751. return c
  13752. }
  13753. // PageToken sets the optional parameter "pageToken": Token to specify
  13754. // the next page in the list.
  13755. func (c *RoleAssignmentsListCall) PageToken(pageToken string) *RoleAssignmentsListCall {
  13756. c.urlParams_.Set("pageToken", pageToken)
  13757. return c
  13758. }
  13759. // RoleId sets the optional parameter "roleId": Immutable ID of a role.
  13760. // If included in the request, returns only role assignments containing
  13761. // this role ID.
  13762. func (c *RoleAssignmentsListCall) RoleId(roleId string) *RoleAssignmentsListCall {
  13763. c.urlParams_.Set("roleId", roleId)
  13764. return c
  13765. }
  13766. // UserKey sets the optional parameter "userKey": The user's primary
  13767. // email address, alias email address, or unique user ID. If included in
  13768. // the request, returns role assignments only for this user.
  13769. func (c *RoleAssignmentsListCall) UserKey(userKey string) *RoleAssignmentsListCall {
  13770. c.urlParams_.Set("userKey", userKey)
  13771. return c
  13772. }
  13773. // Fields allows partial responses to be retrieved. See
  13774. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13775. // for more information.
  13776. func (c *RoleAssignmentsListCall) Fields(s ...googleapi.Field) *RoleAssignmentsListCall {
  13777. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13778. return c
  13779. }
  13780. // IfNoneMatch sets the optional parameter which makes the operation
  13781. // fail if the object's ETag matches the given value. This is useful for
  13782. // getting updates only after the object has changed since the last
  13783. // request. Use googleapi.IsNotModified to check whether the response
  13784. // error from Do is the result of In-None-Match.
  13785. func (c *RoleAssignmentsListCall) IfNoneMatch(entityTag string) *RoleAssignmentsListCall {
  13786. c.ifNoneMatch_ = entityTag
  13787. return c
  13788. }
  13789. // Context sets the context to be used in this call's Do method. Any
  13790. // pending HTTP request will be aborted if the provided context is
  13791. // canceled.
  13792. func (c *RoleAssignmentsListCall) Context(ctx context.Context) *RoleAssignmentsListCall {
  13793. c.ctx_ = ctx
  13794. return c
  13795. }
  13796. // Header returns an http.Header that can be modified by the caller to
  13797. // add HTTP headers to the request.
  13798. func (c *RoleAssignmentsListCall) Header() http.Header {
  13799. if c.header_ == nil {
  13800. c.header_ = make(http.Header)
  13801. }
  13802. return c.header_
  13803. }
  13804. func (c *RoleAssignmentsListCall) doRequest(alt string) (*http.Response, error) {
  13805. reqHeaders := make(http.Header)
  13806. for k, v := range c.header_ {
  13807. reqHeaders[k] = v
  13808. }
  13809. reqHeaders.Set("User-Agent", c.s.userAgent())
  13810. if c.ifNoneMatch_ != "" {
  13811. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  13812. }
  13813. var body io.Reader = nil
  13814. c.urlParams_.Set("alt", alt)
  13815. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roleassignments")
  13816. urls += "?" + c.urlParams_.Encode()
  13817. req, _ := http.NewRequest("GET", urls, body)
  13818. req.Header = reqHeaders
  13819. googleapi.Expand(req.URL, map[string]string{
  13820. "customer": c.customer,
  13821. })
  13822. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13823. }
  13824. // Do executes the "directory.roleAssignments.list" call.
  13825. // Exactly one of *RoleAssignments or error will be non-nil. Any non-2xx
  13826. // status code is an error. Response headers are in either
  13827. // *RoleAssignments.ServerResponse.Header or (if a response was returned
  13828. // at all) in error.(*googleapi.Error).Header. Use
  13829. // googleapi.IsNotModified to check whether the returned error was
  13830. // because http.StatusNotModified was returned.
  13831. func (c *RoleAssignmentsListCall) Do(opts ...googleapi.CallOption) (*RoleAssignments, error) {
  13832. gensupport.SetOptions(c.urlParams_, opts...)
  13833. res, err := c.doRequest("json")
  13834. if res != nil && res.StatusCode == http.StatusNotModified {
  13835. if res.Body != nil {
  13836. res.Body.Close()
  13837. }
  13838. return nil, &googleapi.Error{
  13839. Code: res.StatusCode,
  13840. Header: res.Header,
  13841. }
  13842. }
  13843. if err != nil {
  13844. return nil, err
  13845. }
  13846. defer googleapi.CloseBody(res)
  13847. if err := googleapi.CheckResponse(res); err != nil {
  13848. return nil, err
  13849. }
  13850. ret := &RoleAssignments{
  13851. ServerResponse: googleapi.ServerResponse{
  13852. Header: res.Header,
  13853. HTTPStatusCode: res.StatusCode,
  13854. },
  13855. }
  13856. target := &ret
  13857. if err := gensupport.DecodeResponse(target, res); err != nil {
  13858. return nil, err
  13859. }
  13860. return ret, nil
  13861. // {
  13862. // "description": "Retrieves a paginated list of all roleAssignments.",
  13863. // "httpMethod": "GET",
  13864. // "id": "directory.roleAssignments.list",
  13865. // "parameterOrder": [
  13866. // "customer"
  13867. // ],
  13868. // "parameters": {
  13869. // "customer": {
  13870. // "description": "Immutable ID of the G Suite account.",
  13871. // "location": "path",
  13872. // "required": true,
  13873. // "type": "string"
  13874. // },
  13875. // "maxResults": {
  13876. // "description": "Maximum number of results to return.",
  13877. // "format": "int32",
  13878. // "location": "query",
  13879. // "maximum": "200",
  13880. // "minimum": "1",
  13881. // "type": "integer"
  13882. // },
  13883. // "pageToken": {
  13884. // "description": "Token to specify the next page in the list.",
  13885. // "location": "query",
  13886. // "type": "string"
  13887. // },
  13888. // "roleId": {
  13889. // "description": "Immutable ID of a role. If included in the request, returns only role assignments containing this role ID.",
  13890. // "location": "query",
  13891. // "type": "string"
  13892. // },
  13893. // "userKey": {
  13894. // "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.",
  13895. // "location": "query",
  13896. // "type": "string"
  13897. // }
  13898. // },
  13899. // "path": "customer/{customer}/roleassignments",
  13900. // "response": {
  13901. // "$ref": "RoleAssignments"
  13902. // },
  13903. // "scopes": [
  13904. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  13905. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  13906. // ]
  13907. // }
  13908. }
  13909. // Pages invokes f for each page of results.
  13910. // A non-nil error returned from f will halt the iteration.
  13911. // The provided context supersedes any context provided to the Context method.
  13912. func (c *RoleAssignmentsListCall) Pages(ctx context.Context, f func(*RoleAssignments) error) error {
  13913. c.ctx_ = ctx
  13914. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  13915. for {
  13916. x, err := c.Do()
  13917. if err != nil {
  13918. return err
  13919. }
  13920. if err := f(x); err != nil {
  13921. return err
  13922. }
  13923. if x.NextPageToken == "" {
  13924. return nil
  13925. }
  13926. c.PageToken(x.NextPageToken)
  13927. }
  13928. }
  13929. // method id "directory.roles.delete":
  13930. type RolesDeleteCall struct {
  13931. s *Service
  13932. customer string
  13933. roleId string
  13934. urlParams_ gensupport.URLParams
  13935. ctx_ context.Context
  13936. header_ http.Header
  13937. }
  13938. // Delete: Deletes a role.
  13939. func (r *RolesService) Delete(customer string, roleId string) *RolesDeleteCall {
  13940. c := &RolesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13941. c.customer = customer
  13942. c.roleId = roleId
  13943. return c
  13944. }
  13945. // Fields allows partial responses to be retrieved. See
  13946. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13947. // for more information.
  13948. func (c *RolesDeleteCall) Fields(s ...googleapi.Field) *RolesDeleteCall {
  13949. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13950. return c
  13951. }
  13952. // Context sets the context to be used in this call's Do method. Any
  13953. // pending HTTP request will be aborted if the provided context is
  13954. // canceled.
  13955. func (c *RolesDeleteCall) Context(ctx context.Context) *RolesDeleteCall {
  13956. c.ctx_ = ctx
  13957. return c
  13958. }
  13959. // Header returns an http.Header that can be modified by the caller to
  13960. // add HTTP headers to the request.
  13961. func (c *RolesDeleteCall) Header() http.Header {
  13962. if c.header_ == nil {
  13963. c.header_ = make(http.Header)
  13964. }
  13965. return c.header_
  13966. }
  13967. func (c *RolesDeleteCall) doRequest(alt string) (*http.Response, error) {
  13968. reqHeaders := make(http.Header)
  13969. for k, v := range c.header_ {
  13970. reqHeaders[k] = v
  13971. }
  13972. reqHeaders.Set("User-Agent", c.s.userAgent())
  13973. var body io.Reader = nil
  13974. c.urlParams_.Set("alt", alt)
  13975. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  13976. urls += "?" + c.urlParams_.Encode()
  13977. req, _ := http.NewRequest("DELETE", urls, body)
  13978. req.Header = reqHeaders
  13979. googleapi.Expand(req.URL, map[string]string{
  13980. "customer": c.customer,
  13981. "roleId": c.roleId,
  13982. })
  13983. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13984. }
  13985. // Do executes the "directory.roles.delete" call.
  13986. func (c *RolesDeleteCall) Do(opts ...googleapi.CallOption) error {
  13987. gensupport.SetOptions(c.urlParams_, opts...)
  13988. res, err := c.doRequest("json")
  13989. if err != nil {
  13990. return err
  13991. }
  13992. defer googleapi.CloseBody(res)
  13993. if err := googleapi.CheckResponse(res); err != nil {
  13994. return err
  13995. }
  13996. return nil
  13997. // {
  13998. // "description": "Deletes a role.",
  13999. // "httpMethod": "DELETE",
  14000. // "id": "directory.roles.delete",
  14001. // "parameterOrder": [
  14002. // "customer",
  14003. // "roleId"
  14004. // ],
  14005. // "parameters": {
  14006. // "customer": {
  14007. // "description": "Immutable ID of the G Suite account.",
  14008. // "location": "path",
  14009. // "required": true,
  14010. // "type": "string"
  14011. // },
  14012. // "roleId": {
  14013. // "description": "Immutable ID of the role.",
  14014. // "location": "path",
  14015. // "required": true,
  14016. // "type": "string"
  14017. // }
  14018. // },
  14019. // "path": "customer/{customer}/roles/{roleId}",
  14020. // "scopes": [
  14021. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  14022. // ]
  14023. // }
  14024. }
  14025. // method id "directory.roles.get":
  14026. type RolesGetCall struct {
  14027. s *Service
  14028. customer string
  14029. roleId string
  14030. urlParams_ gensupport.URLParams
  14031. ifNoneMatch_ string
  14032. ctx_ context.Context
  14033. header_ http.Header
  14034. }
  14035. // Get: Retrieves a role.
  14036. func (r *RolesService) Get(customer string, roleId string) *RolesGetCall {
  14037. c := &RolesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14038. c.customer = customer
  14039. c.roleId = roleId
  14040. return c
  14041. }
  14042. // Fields allows partial responses to be retrieved. See
  14043. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14044. // for more information.
  14045. func (c *RolesGetCall) Fields(s ...googleapi.Field) *RolesGetCall {
  14046. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14047. return c
  14048. }
  14049. // IfNoneMatch sets the optional parameter which makes the operation
  14050. // fail if the object's ETag matches the given value. This is useful for
  14051. // getting updates only after the object has changed since the last
  14052. // request. Use googleapi.IsNotModified to check whether the response
  14053. // error from Do is the result of In-None-Match.
  14054. func (c *RolesGetCall) IfNoneMatch(entityTag string) *RolesGetCall {
  14055. c.ifNoneMatch_ = entityTag
  14056. return c
  14057. }
  14058. // Context sets the context to be used in this call's Do method. Any
  14059. // pending HTTP request will be aborted if the provided context is
  14060. // canceled.
  14061. func (c *RolesGetCall) Context(ctx context.Context) *RolesGetCall {
  14062. c.ctx_ = ctx
  14063. return c
  14064. }
  14065. // Header returns an http.Header that can be modified by the caller to
  14066. // add HTTP headers to the request.
  14067. func (c *RolesGetCall) Header() http.Header {
  14068. if c.header_ == nil {
  14069. c.header_ = make(http.Header)
  14070. }
  14071. return c.header_
  14072. }
  14073. func (c *RolesGetCall) doRequest(alt string) (*http.Response, error) {
  14074. reqHeaders := make(http.Header)
  14075. for k, v := range c.header_ {
  14076. reqHeaders[k] = v
  14077. }
  14078. reqHeaders.Set("User-Agent", c.s.userAgent())
  14079. if c.ifNoneMatch_ != "" {
  14080. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  14081. }
  14082. var body io.Reader = nil
  14083. c.urlParams_.Set("alt", alt)
  14084. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  14085. urls += "?" + c.urlParams_.Encode()
  14086. req, _ := http.NewRequest("GET", urls, body)
  14087. req.Header = reqHeaders
  14088. googleapi.Expand(req.URL, map[string]string{
  14089. "customer": c.customer,
  14090. "roleId": c.roleId,
  14091. })
  14092. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14093. }
  14094. // Do executes the "directory.roles.get" call.
  14095. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  14096. // code is an error. Response headers are in either
  14097. // *Role.ServerResponse.Header or (if a response was returned at all) in
  14098. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  14099. // whether the returned error was because http.StatusNotModified was
  14100. // returned.
  14101. func (c *RolesGetCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  14102. gensupport.SetOptions(c.urlParams_, opts...)
  14103. res, err := c.doRequest("json")
  14104. if res != nil && res.StatusCode == http.StatusNotModified {
  14105. if res.Body != nil {
  14106. res.Body.Close()
  14107. }
  14108. return nil, &googleapi.Error{
  14109. Code: res.StatusCode,
  14110. Header: res.Header,
  14111. }
  14112. }
  14113. if err != nil {
  14114. return nil, err
  14115. }
  14116. defer googleapi.CloseBody(res)
  14117. if err := googleapi.CheckResponse(res); err != nil {
  14118. return nil, err
  14119. }
  14120. ret := &Role{
  14121. ServerResponse: googleapi.ServerResponse{
  14122. Header: res.Header,
  14123. HTTPStatusCode: res.StatusCode,
  14124. },
  14125. }
  14126. target := &ret
  14127. if err := gensupport.DecodeResponse(target, res); err != nil {
  14128. return nil, err
  14129. }
  14130. return ret, nil
  14131. // {
  14132. // "description": "Retrieves a role.",
  14133. // "httpMethod": "GET",
  14134. // "id": "directory.roles.get",
  14135. // "parameterOrder": [
  14136. // "customer",
  14137. // "roleId"
  14138. // ],
  14139. // "parameters": {
  14140. // "customer": {
  14141. // "description": "Immutable ID of the G Suite account.",
  14142. // "location": "path",
  14143. // "required": true,
  14144. // "type": "string"
  14145. // },
  14146. // "roleId": {
  14147. // "description": "Immutable ID of the role.",
  14148. // "location": "path",
  14149. // "required": true,
  14150. // "type": "string"
  14151. // }
  14152. // },
  14153. // "path": "customer/{customer}/roles/{roleId}",
  14154. // "response": {
  14155. // "$ref": "Role"
  14156. // },
  14157. // "scopes": [
  14158. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  14159. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  14160. // ]
  14161. // }
  14162. }
  14163. // method id "directory.roles.insert":
  14164. type RolesInsertCall struct {
  14165. s *Service
  14166. customer string
  14167. role *Role
  14168. urlParams_ gensupport.URLParams
  14169. ctx_ context.Context
  14170. header_ http.Header
  14171. }
  14172. // Insert: Creates a role.
  14173. func (r *RolesService) Insert(customer string, role *Role) *RolesInsertCall {
  14174. c := &RolesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14175. c.customer = customer
  14176. c.role = role
  14177. return c
  14178. }
  14179. // Fields allows partial responses to be retrieved. See
  14180. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14181. // for more information.
  14182. func (c *RolesInsertCall) Fields(s ...googleapi.Field) *RolesInsertCall {
  14183. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14184. return c
  14185. }
  14186. // Context sets the context to be used in this call's Do method. Any
  14187. // pending HTTP request will be aborted if the provided context is
  14188. // canceled.
  14189. func (c *RolesInsertCall) Context(ctx context.Context) *RolesInsertCall {
  14190. c.ctx_ = ctx
  14191. return c
  14192. }
  14193. // Header returns an http.Header that can be modified by the caller to
  14194. // add HTTP headers to the request.
  14195. func (c *RolesInsertCall) Header() http.Header {
  14196. if c.header_ == nil {
  14197. c.header_ = make(http.Header)
  14198. }
  14199. return c.header_
  14200. }
  14201. func (c *RolesInsertCall) doRequest(alt string) (*http.Response, error) {
  14202. reqHeaders := make(http.Header)
  14203. for k, v := range c.header_ {
  14204. reqHeaders[k] = v
  14205. }
  14206. reqHeaders.Set("User-Agent", c.s.userAgent())
  14207. var body io.Reader = nil
  14208. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  14209. if err != nil {
  14210. return nil, err
  14211. }
  14212. reqHeaders.Set("Content-Type", "application/json")
  14213. c.urlParams_.Set("alt", alt)
  14214. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles")
  14215. urls += "?" + c.urlParams_.Encode()
  14216. req, _ := http.NewRequest("POST", urls, body)
  14217. req.Header = reqHeaders
  14218. googleapi.Expand(req.URL, map[string]string{
  14219. "customer": c.customer,
  14220. })
  14221. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14222. }
  14223. // Do executes the "directory.roles.insert" call.
  14224. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  14225. // code is an error. Response headers are in either
  14226. // *Role.ServerResponse.Header or (if a response was returned at all) in
  14227. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  14228. // whether the returned error was because http.StatusNotModified was
  14229. // returned.
  14230. func (c *RolesInsertCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  14231. gensupport.SetOptions(c.urlParams_, opts...)
  14232. res, err := c.doRequest("json")
  14233. if res != nil && res.StatusCode == http.StatusNotModified {
  14234. if res.Body != nil {
  14235. res.Body.Close()
  14236. }
  14237. return nil, &googleapi.Error{
  14238. Code: res.StatusCode,
  14239. Header: res.Header,
  14240. }
  14241. }
  14242. if err != nil {
  14243. return nil, err
  14244. }
  14245. defer googleapi.CloseBody(res)
  14246. if err := googleapi.CheckResponse(res); err != nil {
  14247. return nil, err
  14248. }
  14249. ret := &Role{
  14250. ServerResponse: googleapi.ServerResponse{
  14251. Header: res.Header,
  14252. HTTPStatusCode: res.StatusCode,
  14253. },
  14254. }
  14255. target := &ret
  14256. if err := gensupport.DecodeResponse(target, res); err != nil {
  14257. return nil, err
  14258. }
  14259. return ret, nil
  14260. // {
  14261. // "description": "Creates a role.",
  14262. // "httpMethod": "POST",
  14263. // "id": "directory.roles.insert",
  14264. // "parameterOrder": [
  14265. // "customer"
  14266. // ],
  14267. // "parameters": {
  14268. // "customer": {
  14269. // "description": "Immutable ID of the G Suite account.",
  14270. // "location": "path",
  14271. // "required": true,
  14272. // "type": "string"
  14273. // }
  14274. // },
  14275. // "path": "customer/{customer}/roles",
  14276. // "request": {
  14277. // "$ref": "Role"
  14278. // },
  14279. // "response": {
  14280. // "$ref": "Role"
  14281. // },
  14282. // "scopes": [
  14283. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  14284. // ]
  14285. // }
  14286. }
  14287. // method id "directory.roles.list":
  14288. type RolesListCall struct {
  14289. s *Service
  14290. customer string
  14291. urlParams_ gensupport.URLParams
  14292. ifNoneMatch_ string
  14293. ctx_ context.Context
  14294. header_ http.Header
  14295. }
  14296. // List: Retrieves a paginated list of all the roles in a domain.
  14297. func (r *RolesService) List(customer string) *RolesListCall {
  14298. c := &RolesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14299. c.customer = customer
  14300. return c
  14301. }
  14302. // MaxResults sets the optional parameter "maxResults": Maximum number
  14303. // of results to return.
  14304. func (c *RolesListCall) MaxResults(maxResults int64) *RolesListCall {
  14305. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  14306. return c
  14307. }
  14308. // PageToken sets the optional parameter "pageToken": Token to specify
  14309. // the next page in the list.
  14310. func (c *RolesListCall) PageToken(pageToken string) *RolesListCall {
  14311. c.urlParams_.Set("pageToken", pageToken)
  14312. return c
  14313. }
  14314. // Fields allows partial responses to be retrieved. See
  14315. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14316. // for more information.
  14317. func (c *RolesListCall) Fields(s ...googleapi.Field) *RolesListCall {
  14318. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14319. return c
  14320. }
  14321. // IfNoneMatch sets the optional parameter which makes the operation
  14322. // fail if the object's ETag matches the given value. This is useful for
  14323. // getting updates only after the object has changed since the last
  14324. // request. Use googleapi.IsNotModified to check whether the response
  14325. // error from Do is the result of In-None-Match.
  14326. func (c *RolesListCall) IfNoneMatch(entityTag string) *RolesListCall {
  14327. c.ifNoneMatch_ = entityTag
  14328. return c
  14329. }
  14330. // Context sets the context to be used in this call's Do method. Any
  14331. // pending HTTP request will be aborted if the provided context is
  14332. // canceled.
  14333. func (c *RolesListCall) Context(ctx context.Context) *RolesListCall {
  14334. c.ctx_ = ctx
  14335. return c
  14336. }
  14337. // Header returns an http.Header that can be modified by the caller to
  14338. // add HTTP headers to the request.
  14339. func (c *RolesListCall) Header() http.Header {
  14340. if c.header_ == nil {
  14341. c.header_ = make(http.Header)
  14342. }
  14343. return c.header_
  14344. }
  14345. func (c *RolesListCall) doRequest(alt string) (*http.Response, error) {
  14346. reqHeaders := make(http.Header)
  14347. for k, v := range c.header_ {
  14348. reqHeaders[k] = v
  14349. }
  14350. reqHeaders.Set("User-Agent", c.s.userAgent())
  14351. if c.ifNoneMatch_ != "" {
  14352. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  14353. }
  14354. var body io.Reader = nil
  14355. c.urlParams_.Set("alt", alt)
  14356. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles")
  14357. urls += "?" + c.urlParams_.Encode()
  14358. req, _ := http.NewRequest("GET", urls, body)
  14359. req.Header = reqHeaders
  14360. googleapi.Expand(req.URL, map[string]string{
  14361. "customer": c.customer,
  14362. })
  14363. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14364. }
  14365. // Do executes the "directory.roles.list" call.
  14366. // Exactly one of *Roles or error will be non-nil. Any non-2xx status
  14367. // code is an error. Response headers are in either
  14368. // *Roles.ServerResponse.Header or (if a response was returned at all)
  14369. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  14370. // check whether the returned error was because http.StatusNotModified
  14371. // was returned.
  14372. func (c *RolesListCall) Do(opts ...googleapi.CallOption) (*Roles, error) {
  14373. gensupport.SetOptions(c.urlParams_, opts...)
  14374. res, err := c.doRequest("json")
  14375. if res != nil && res.StatusCode == http.StatusNotModified {
  14376. if res.Body != nil {
  14377. res.Body.Close()
  14378. }
  14379. return nil, &googleapi.Error{
  14380. Code: res.StatusCode,
  14381. Header: res.Header,
  14382. }
  14383. }
  14384. if err != nil {
  14385. return nil, err
  14386. }
  14387. defer googleapi.CloseBody(res)
  14388. if err := googleapi.CheckResponse(res); err != nil {
  14389. return nil, err
  14390. }
  14391. ret := &Roles{
  14392. ServerResponse: googleapi.ServerResponse{
  14393. Header: res.Header,
  14394. HTTPStatusCode: res.StatusCode,
  14395. },
  14396. }
  14397. target := &ret
  14398. if err := gensupport.DecodeResponse(target, res); err != nil {
  14399. return nil, err
  14400. }
  14401. return ret, nil
  14402. // {
  14403. // "description": "Retrieves a paginated list of all the roles in a domain.",
  14404. // "httpMethod": "GET",
  14405. // "id": "directory.roles.list",
  14406. // "parameterOrder": [
  14407. // "customer"
  14408. // ],
  14409. // "parameters": {
  14410. // "customer": {
  14411. // "description": "Immutable ID of the G Suite account.",
  14412. // "location": "path",
  14413. // "required": true,
  14414. // "type": "string"
  14415. // },
  14416. // "maxResults": {
  14417. // "description": "Maximum number of results to return.",
  14418. // "format": "int32",
  14419. // "location": "query",
  14420. // "maximum": "100",
  14421. // "minimum": "1",
  14422. // "type": "integer"
  14423. // },
  14424. // "pageToken": {
  14425. // "description": "Token to specify the next page in the list.",
  14426. // "location": "query",
  14427. // "type": "string"
  14428. // }
  14429. // },
  14430. // "path": "customer/{customer}/roles",
  14431. // "response": {
  14432. // "$ref": "Roles"
  14433. // },
  14434. // "scopes": [
  14435. // "https://www.googleapis.com/auth/admin.directory.rolemanagement",
  14436. // "https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly"
  14437. // ]
  14438. // }
  14439. }
  14440. // Pages invokes f for each page of results.
  14441. // A non-nil error returned from f will halt the iteration.
  14442. // The provided context supersedes any context provided to the Context method.
  14443. func (c *RolesListCall) Pages(ctx context.Context, f func(*Roles) error) error {
  14444. c.ctx_ = ctx
  14445. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  14446. for {
  14447. x, err := c.Do()
  14448. if err != nil {
  14449. return err
  14450. }
  14451. if err := f(x); err != nil {
  14452. return err
  14453. }
  14454. if x.NextPageToken == "" {
  14455. return nil
  14456. }
  14457. c.PageToken(x.NextPageToken)
  14458. }
  14459. }
  14460. // method id "directory.roles.patch":
  14461. type RolesPatchCall struct {
  14462. s *Service
  14463. customer string
  14464. roleId string
  14465. role *Role
  14466. urlParams_ gensupport.URLParams
  14467. ctx_ context.Context
  14468. header_ http.Header
  14469. }
  14470. // Patch: Updates a role. This method supports patch semantics.
  14471. func (r *RolesService) Patch(customer string, roleId string, role *Role) *RolesPatchCall {
  14472. c := &RolesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14473. c.customer = customer
  14474. c.roleId = roleId
  14475. c.role = role
  14476. return c
  14477. }
  14478. // Fields allows partial responses to be retrieved. See
  14479. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14480. // for more information.
  14481. func (c *RolesPatchCall) Fields(s ...googleapi.Field) *RolesPatchCall {
  14482. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14483. return c
  14484. }
  14485. // Context sets the context to be used in this call's Do method. Any
  14486. // pending HTTP request will be aborted if the provided context is
  14487. // canceled.
  14488. func (c *RolesPatchCall) Context(ctx context.Context) *RolesPatchCall {
  14489. c.ctx_ = ctx
  14490. return c
  14491. }
  14492. // Header returns an http.Header that can be modified by the caller to
  14493. // add HTTP headers to the request.
  14494. func (c *RolesPatchCall) Header() http.Header {
  14495. if c.header_ == nil {
  14496. c.header_ = make(http.Header)
  14497. }
  14498. return c.header_
  14499. }
  14500. func (c *RolesPatchCall) doRequest(alt string) (*http.Response, error) {
  14501. reqHeaders := make(http.Header)
  14502. for k, v := range c.header_ {
  14503. reqHeaders[k] = v
  14504. }
  14505. reqHeaders.Set("User-Agent", c.s.userAgent())
  14506. var body io.Reader = nil
  14507. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  14508. if err != nil {
  14509. return nil, err
  14510. }
  14511. reqHeaders.Set("Content-Type", "application/json")
  14512. c.urlParams_.Set("alt", alt)
  14513. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  14514. urls += "?" + c.urlParams_.Encode()
  14515. req, _ := http.NewRequest("PATCH", urls, body)
  14516. req.Header = reqHeaders
  14517. googleapi.Expand(req.URL, map[string]string{
  14518. "customer": c.customer,
  14519. "roleId": c.roleId,
  14520. })
  14521. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14522. }
  14523. // Do executes the "directory.roles.patch" call.
  14524. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  14525. // code is an error. Response headers are in either
  14526. // *Role.ServerResponse.Header or (if a response was returned at all) in
  14527. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  14528. // whether the returned error was because http.StatusNotModified was
  14529. // returned.
  14530. func (c *RolesPatchCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  14531. gensupport.SetOptions(c.urlParams_, opts...)
  14532. res, err := c.doRequest("json")
  14533. if res != nil && res.StatusCode == http.StatusNotModified {
  14534. if res.Body != nil {
  14535. res.Body.Close()
  14536. }
  14537. return nil, &googleapi.Error{
  14538. Code: res.StatusCode,
  14539. Header: res.Header,
  14540. }
  14541. }
  14542. if err != nil {
  14543. return nil, err
  14544. }
  14545. defer googleapi.CloseBody(res)
  14546. if err := googleapi.CheckResponse(res); err != nil {
  14547. return nil, err
  14548. }
  14549. ret := &Role{
  14550. ServerResponse: googleapi.ServerResponse{
  14551. Header: res.Header,
  14552. HTTPStatusCode: res.StatusCode,
  14553. },
  14554. }
  14555. target := &ret
  14556. if err := gensupport.DecodeResponse(target, res); err != nil {
  14557. return nil, err
  14558. }
  14559. return ret, nil
  14560. // {
  14561. // "description": "Updates a role. This method supports patch semantics.",
  14562. // "httpMethod": "PATCH",
  14563. // "id": "directory.roles.patch",
  14564. // "parameterOrder": [
  14565. // "customer",
  14566. // "roleId"
  14567. // ],
  14568. // "parameters": {
  14569. // "customer": {
  14570. // "description": "Immutable ID of the G Suite account.",
  14571. // "location": "path",
  14572. // "required": true,
  14573. // "type": "string"
  14574. // },
  14575. // "roleId": {
  14576. // "description": "Immutable ID of the role.",
  14577. // "location": "path",
  14578. // "required": true,
  14579. // "type": "string"
  14580. // }
  14581. // },
  14582. // "path": "customer/{customer}/roles/{roleId}",
  14583. // "request": {
  14584. // "$ref": "Role"
  14585. // },
  14586. // "response": {
  14587. // "$ref": "Role"
  14588. // },
  14589. // "scopes": [
  14590. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  14591. // ]
  14592. // }
  14593. }
  14594. // method id "directory.roles.update":
  14595. type RolesUpdateCall struct {
  14596. s *Service
  14597. customer string
  14598. roleId string
  14599. role *Role
  14600. urlParams_ gensupport.URLParams
  14601. ctx_ context.Context
  14602. header_ http.Header
  14603. }
  14604. // Update: Updates a role.
  14605. func (r *RolesService) Update(customer string, roleId string, role *Role) *RolesUpdateCall {
  14606. c := &RolesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14607. c.customer = customer
  14608. c.roleId = roleId
  14609. c.role = role
  14610. return c
  14611. }
  14612. // Fields allows partial responses to be retrieved. See
  14613. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14614. // for more information.
  14615. func (c *RolesUpdateCall) Fields(s ...googleapi.Field) *RolesUpdateCall {
  14616. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14617. return c
  14618. }
  14619. // Context sets the context to be used in this call's Do method. Any
  14620. // pending HTTP request will be aborted if the provided context is
  14621. // canceled.
  14622. func (c *RolesUpdateCall) Context(ctx context.Context) *RolesUpdateCall {
  14623. c.ctx_ = ctx
  14624. return c
  14625. }
  14626. // Header returns an http.Header that can be modified by the caller to
  14627. // add HTTP headers to the request.
  14628. func (c *RolesUpdateCall) Header() http.Header {
  14629. if c.header_ == nil {
  14630. c.header_ = make(http.Header)
  14631. }
  14632. return c.header_
  14633. }
  14634. func (c *RolesUpdateCall) doRequest(alt string) (*http.Response, error) {
  14635. reqHeaders := make(http.Header)
  14636. for k, v := range c.header_ {
  14637. reqHeaders[k] = v
  14638. }
  14639. reqHeaders.Set("User-Agent", c.s.userAgent())
  14640. var body io.Reader = nil
  14641. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  14642. if err != nil {
  14643. return nil, err
  14644. }
  14645. reqHeaders.Set("Content-Type", "application/json")
  14646. c.urlParams_.Set("alt", alt)
  14647. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customer}/roles/{roleId}")
  14648. urls += "?" + c.urlParams_.Encode()
  14649. req, _ := http.NewRequest("PUT", urls, body)
  14650. req.Header = reqHeaders
  14651. googleapi.Expand(req.URL, map[string]string{
  14652. "customer": c.customer,
  14653. "roleId": c.roleId,
  14654. })
  14655. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14656. }
  14657. // Do executes the "directory.roles.update" call.
  14658. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  14659. // code is an error. Response headers are in either
  14660. // *Role.ServerResponse.Header or (if a response was returned at all) in
  14661. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  14662. // whether the returned error was because http.StatusNotModified was
  14663. // returned.
  14664. func (c *RolesUpdateCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  14665. gensupport.SetOptions(c.urlParams_, opts...)
  14666. res, err := c.doRequest("json")
  14667. if res != nil && res.StatusCode == http.StatusNotModified {
  14668. if res.Body != nil {
  14669. res.Body.Close()
  14670. }
  14671. return nil, &googleapi.Error{
  14672. Code: res.StatusCode,
  14673. Header: res.Header,
  14674. }
  14675. }
  14676. if err != nil {
  14677. return nil, err
  14678. }
  14679. defer googleapi.CloseBody(res)
  14680. if err := googleapi.CheckResponse(res); err != nil {
  14681. return nil, err
  14682. }
  14683. ret := &Role{
  14684. ServerResponse: googleapi.ServerResponse{
  14685. Header: res.Header,
  14686. HTTPStatusCode: res.StatusCode,
  14687. },
  14688. }
  14689. target := &ret
  14690. if err := gensupport.DecodeResponse(target, res); err != nil {
  14691. return nil, err
  14692. }
  14693. return ret, nil
  14694. // {
  14695. // "description": "Updates a role.",
  14696. // "httpMethod": "PUT",
  14697. // "id": "directory.roles.update",
  14698. // "parameterOrder": [
  14699. // "customer",
  14700. // "roleId"
  14701. // ],
  14702. // "parameters": {
  14703. // "customer": {
  14704. // "description": "Immutable ID of the G Suite account.",
  14705. // "location": "path",
  14706. // "required": true,
  14707. // "type": "string"
  14708. // },
  14709. // "roleId": {
  14710. // "description": "Immutable ID of the role.",
  14711. // "location": "path",
  14712. // "required": true,
  14713. // "type": "string"
  14714. // }
  14715. // },
  14716. // "path": "customer/{customer}/roles/{roleId}",
  14717. // "request": {
  14718. // "$ref": "Role"
  14719. // },
  14720. // "response": {
  14721. // "$ref": "Role"
  14722. // },
  14723. // "scopes": [
  14724. // "https://www.googleapis.com/auth/admin.directory.rolemanagement"
  14725. // ]
  14726. // }
  14727. }
  14728. // method id "directory.schemas.delete":
  14729. type SchemasDeleteCall struct {
  14730. s *Service
  14731. customerId string
  14732. schemaKey string
  14733. urlParams_ gensupport.URLParams
  14734. ctx_ context.Context
  14735. header_ http.Header
  14736. }
  14737. // Delete: Delete schema
  14738. func (r *SchemasService) Delete(customerId string, schemaKey string) *SchemasDeleteCall {
  14739. c := &SchemasDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14740. c.customerId = customerId
  14741. c.schemaKey = schemaKey
  14742. return c
  14743. }
  14744. // Fields allows partial responses to be retrieved. See
  14745. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14746. // for more information.
  14747. func (c *SchemasDeleteCall) Fields(s ...googleapi.Field) *SchemasDeleteCall {
  14748. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14749. return c
  14750. }
  14751. // Context sets the context to be used in this call's Do method. Any
  14752. // pending HTTP request will be aborted if the provided context is
  14753. // canceled.
  14754. func (c *SchemasDeleteCall) Context(ctx context.Context) *SchemasDeleteCall {
  14755. c.ctx_ = ctx
  14756. return c
  14757. }
  14758. // Header returns an http.Header that can be modified by the caller to
  14759. // add HTTP headers to the request.
  14760. func (c *SchemasDeleteCall) Header() http.Header {
  14761. if c.header_ == nil {
  14762. c.header_ = make(http.Header)
  14763. }
  14764. return c.header_
  14765. }
  14766. func (c *SchemasDeleteCall) doRequest(alt string) (*http.Response, error) {
  14767. reqHeaders := make(http.Header)
  14768. for k, v := range c.header_ {
  14769. reqHeaders[k] = v
  14770. }
  14771. reqHeaders.Set("User-Agent", c.s.userAgent())
  14772. var body io.Reader = nil
  14773. c.urlParams_.Set("alt", alt)
  14774. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  14775. urls += "?" + c.urlParams_.Encode()
  14776. req, _ := http.NewRequest("DELETE", urls, body)
  14777. req.Header = reqHeaders
  14778. googleapi.Expand(req.URL, map[string]string{
  14779. "customerId": c.customerId,
  14780. "schemaKey": c.schemaKey,
  14781. })
  14782. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14783. }
  14784. // Do executes the "directory.schemas.delete" call.
  14785. func (c *SchemasDeleteCall) Do(opts ...googleapi.CallOption) error {
  14786. gensupport.SetOptions(c.urlParams_, opts...)
  14787. res, err := c.doRequest("json")
  14788. if err != nil {
  14789. return err
  14790. }
  14791. defer googleapi.CloseBody(res)
  14792. if err := googleapi.CheckResponse(res); err != nil {
  14793. return err
  14794. }
  14795. return nil
  14796. // {
  14797. // "description": "Delete schema",
  14798. // "httpMethod": "DELETE",
  14799. // "id": "directory.schemas.delete",
  14800. // "parameterOrder": [
  14801. // "customerId",
  14802. // "schemaKey"
  14803. // ],
  14804. // "parameters": {
  14805. // "customerId": {
  14806. // "description": "Immutable ID of the G Suite account",
  14807. // "location": "path",
  14808. // "required": true,
  14809. // "type": "string"
  14810. // },
  14811. // "schemaKey": {
  14812. // "description": "Name or immutable ID of the schema",
  14813. // "location": "path",
  14814. // "required": true,
  14815. // "type": "string"
  14816. // }
  14817. // },
  14818. // "path": "customer/{customerId}/schemas/{schemaKey}",
  14819. // "scopes": [
  14820. // "https://www.googleapis.com/auth/admin.directory.userschema"
  14821. // ]
  14822. // }
  14823. }
  14824. // method id "directory.schemas.get":
  14825. type SchemasGetCall struct {
  14826. s *Service
  14827. customerId string
  14828. schemaKey string
  14829. urlParams_ gensupport.URLParams
  14830. ifNoneMatch_ string
  14831. ctx_ context.Context
  14832. header_ http.Header
  14833. }
  14834. // Get: Retrieve schema
  14835. func (r *SchemasService) Get(customerId string, schemaKey string) *SchemasGetCall {
  14836. c := &SchemasGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14837. c.customerId = customerId
  14838. c.schemaKey = schemaKey
  14839. return c
  14840. }
  14841. // Fields allows partial responses to be retrieved. See
  14842. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14843. // for more information.
  14844. func (c *SchemasGetCall) Fields(s ...googleapi.Field) *SchemasGetCall {
  14845. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14846. return c
  14847. }
  14848. // IfNoneMatch sets the optional parameter which makes the operation
  14849. // fail if the object's ETag matches the given value. This is useful for
  14850. // getting updates only after the object has changed since the last
  14851. // request. Use googleapi.IsNotModified to check whether the response
  14852. // error from Do is the result of In-None-Match.
  14853. func (c *SchemasGetCall) IfNoneMatch(entityTag string) *SchemasGetCall {
  14854. c.ifNoneMatch_ = entityTag
  14855. return c
  14856. }
  14857. // Context sets the context to be used in this call's Do method. Any
  14858. // pending HTTP request will be aborted if the provided context is
  14859. // canceled.
  14860. func (c *SchemasGetCall) Context(ctx context.Context) *SchemasGetCall {
  14861. c.ctx_ = ctx
  14862. return c
  14863. }
  14864. // Header returns an http.Header that can be modified by the caller to
  14865. // add HTTP headers to the request.
  14866. func (c *SchemasGetCall) Header() http.Header {
  14867. if c.header_ == nil {
  14868. c.header_ = make(http.Header)
  14869. }
  14870. return c.header_
  14871. }
  14872. func (c *SchemasGetCall) doRequest(alt string) (*http.Response, error) {
  14873. reqHeaders := make(http.Header)
  14874. for k, v := range c.header_ {
  14875. reqHeaders[k] = v
  14876. }
  14877. reqHeaders.Set("User-Agent", c.s.userAgent())
  14878. if c.ifNoneMatch_ != "" {
  14879. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  14880. }
  14881. var body io.Reader = nil
  14882. c.urlParams_.Set("alt", alt)
  14883. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  14884. urls += "?" + c.urlParams_.Encode()
  14885. req, _ := http.NewRequest("GET", urls, body)
  14886. req.Header = reqHeaders
  14887. googleapi.Expand(req.URL, map[string]string{
  14888. "customerId": c.customerId,
  14889. "schemaKey": c.schemaKey,
  14890. })
  14891. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  14892. }
  14893. // Do executes the "directory.schemas.get" call.
  14894. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  14895. // code is an error. Response headers are in either
  14896. // *Schema.ServerResponse.Header or (if a response was returned at all)
  14897. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  14898. // check whether the returned error was because http.StatusNotModified
  14899. // was returned.
  14900. func (c *SchemasGetCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  14901. gensupport.SetOptions(c.urlParams_, opts...)
  14902. res, err := c.doRequest("json")
  14903. if res != nil && res.StatusCode == http.StatusNotModified {
  14904. if res.Body != nil {
  14905. res.Body.Close()
  14906. }
  14907. return nil, &googleapi.Error{
  14908. Code: res.StatusCode,
  14909. Header: res.Header,
  14910. }
  14911. }
  14912. if err != nil {
  14913. return nil, err
  14914. }
  14915. defer googleapi.CloseBody(res)
  14916. if err := googleapi.CheckResponse(res); err != nil {
  14917. return nil, err
  14918. }
  14919. ret := &Schema{
  14920. ServerResponse: googleapi.ServerResponse{
  14921. Header: res.Header,
  14922. HTTPStatusCode: res.StatusCode,
  14923. },
  14924. }
  14925. target := &ret
  14926. if err := gensupport.DecodeResponse(target, res); err != nil {
  14927. return nil, err
  14928. }
  14929. return ret, nil
  14930. // {
  14931. // "description": "Retrieve schema",
  14932. // "httpMethod": "GET",
  14933. // "id": "directory.schemas.get",
  14934. // "parameterOrder": [
  14935. // "customerId",
  14936. // "schemaKey"
  14937. // ],
  14938. // "parameters": {
  14939. // "customerId": {
  14940. // "description": "Immutable ID of the G Suite account",
  14941. // "location": "path",
  14942. // "required": true,
  14943. // "type": "string"
  14944. // },
  14945. // "schemaKey": {
  14946. // "description": "Name or immutable ID of the schema",
  14947. // "location": "path",
  14948. // "required": true,
  14949. // "type": "string"
  14950. // }
  14951. // },
  14952. // "path": "customer/{customerId}/schemas/{schemaKey}",
  14953. // "response": {
  14954. // "$ref": "Schema"
  14955. // },
  14956. // "scopes": [
  14957. // "https://www.googleapis.com/auth/admin.directory.userschema",
  14958. // "https://www.googleapis.com/auth/admin.directory.userschema.readonly"
  14959. // ]
  14960. // }
  14961. }
  14962. // method id "directory.schemas.insert":
  14963. type SchemasInsertCall struct {
  14964. s *Service
  14965. customerId string
  14966. schema *Schema
  14967. urlParams_ gensupport.URLParams
  14968. ctx_ context.Context
  14969. header_ http.Header
  14970. }
  14971. // Insert: Create schema.
  14972. func (r *SchemasService) Insert(customerId string, schema *Schema) *SchemasInsertCall {
  14973. c := &SchemasInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  14974. c.customerId = customerId
  14975. c.schema = schema
  14976. return c
  14977. }
  14978. // Fields allows partial responses to be retrieved. See
  14979. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  14980. // for more information.
  14981. func (c *SchemasInsertCall) Fields(s ...googleapi.Field) *SchemasInsertCall {
  14982. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  14983. return c
  14984. }
  14985. // Context sets the context to be used in this call's Do method. Any
  14986. // pending HTTP request will be aborted if the provided context is
  14987. // canceled.
  14988. func (c *SchemasInsertCall) Context(ctx context.Context) *SchemasInsertCall {
  14989. c.ctx_ = ctx
  14990. return c
  14991. }
  14992. // Header returns an http.Header that can be modified by the caller to
  14993. // add HTTP headers to the request.
  14994. func (c *SchemasInsertCall) Header() http.Header {
  14995. if c.header_ == nil {
  14996. c.header_ = make(http.Header)
  14997. }
  14998. return c.header_
  14999. }
  15000. func (c *SchemasInsertCall) doRequest(alt string) (*http.Response, error) {
  15001. reqHeaders := make(http.Header)
  15002. for k, v := range c.header_ {
  15003. reqHeaders[k] = v
  15004. }
  15005. reqHeaders.Set("User-Agent", c.s.userAgent())
  15006. var body io.Reader = nil
  15007. body, err := googleapi.WithoutDataWrapper.JSONReader(c.schema)
  15008. if err != nil {
  15009. return nil, err
  15010. }
  15011. reqHeaders.Set("Content-Type", "application/json")
  15012. c.urlParams_.Set("alt", alt)
  15013. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas")
  15014. urls += "?" + c.urlParams_.Encode()
  15015. req, _ := http.NewRequest("POST", urls, body)
  15016. req.Header = reqHeaders
  15017. googleapi.Expand(req.URL, map[string]string{
  15018. "customerId": c.customerId,
  15019. })
  15020. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15021. }
  15022. // Do executes the "directory.schemas.insert" call.
  15023. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  15024. // code is an error. Response headers are in either
  15025. // *Schema.ServerResponse.Header or (if a response was returned at all)
  15026. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  15027. // check whether the returned error was because http.StatusNotModified
  15028. // was returned.
  15029. func (c *SchemasInsertCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  15030. gensupport.SetOptions(c.urlParams_, opts...)
  15031. res, err := c.doRequest("json")
  15032. if res != nil && res.StatusCode == http.StatusNotModified {
  15033. if res.Body != nil {
  15034. res.Body.Close()
  15035. }
  15036. return nil, &googleapi.Error{
  15037. Code: res.StatusCode,
  15038. Header: res.Header,
  15039. }
  15040. }
  15041. if err != nil {
  15042. return nil, err
  15043. }
  15044. defer googleapi.CloseBody(res)
  15045. if err := googleapi.CheckResponse(res); err != nil {
  15046. return nil, err
  15047. }
  15048. ret := &Schema{
  15049. ServerResponse: googleapi.ServerResponse{
  15050. Header: res.Header,
  15051. HTTPStatusCode: res.StatusCode,
  15052. },
  15053. }
  15054. target := &ret
  15055. if err := gensupport.DecodeResponse(target, res); err != nil {
  15056. return nil, err
  15057. }
  15058. return ret, nil
  15059. // {
  15060. // "description": "Create schema.",
  15061. // "httpMethod": "POST",
  15062. // "id": "directory.schemas.insert",
  15063. // "parameterOrder": [
  15064. // "customerId"
  15065. // ],
  15066. // "parameters": {
  15067. // "customerId": {
  15068. // "description": "Immutable ID of the G Suite account",
  15069. // "location": "path",
  15070. // "required": true,
  15071. // "type": "string"
  15072. // }
  15073. // },
  15074. // "path": "customer/{customerId}/schemas",
  15075. // "request": {
  15076. // "$ref": "Schema"
  15077. // },
  15078. // "response": {
  15079. // "$ref": "Schema"
  15080. // },
  15081. // "scopes": [
  15082. // "https://www.googleapis.com/auth/admin.directory.userschema"
  15083. // ]
  15084. // }
  15085. }
  15086. // method id "directory.schemas.list":
  15087. type SchemasListCall struct {
  15088. s *Service
  15089. customerId string
  15090. urlParams_ gensupport.URLParams
  15091. ifNoneMatch_ string
  15092. ctx_ context.Context
  15093. header_ http.Header
  15094. }
  15095. // List: Retrieve all schemas for a customer
  15096. func (r *SchemasService) List(customerId string) *SchemasListCall {
  15097. c := &SchemasListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15098. c.customerId = customerId
  15099. return c
  15100. }
  15101. // Fields allows partial responses to be retrieved. See
  15102. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15103. // for more information.
  15104. func (c *SchemasListCall) Fields(s ...googleapi.Field) *SchemasListCall {
  15105. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15106. return c
  15107. }
  15108. // IfNoneMatch sets the optional parameter which makes the operation
  15109. // fail if the object's ETag matches the given value. This is useful for
  15110. // getting updates only after the object has changed since the last
  15111. // request. Use googleapi.IsNotModified to check whether the response
  15112. // error from Do is the result of In-None-Match.
  15113. func (c *SchemasListCall) IfNoneMatch(entityTag string) *SchemasListCall {
  15114. c.ifNoneMatch_ = entityTag
  15115. return c
  15116. }
  15117. // Context sets the context to be used in this call's Do method. Any
  15118. // pending HTTP request will be aborted if the provided context is
  15119. // canceled.
  15120. func (c *SchemasListCall) Context(ctx context.Context) *SchemasListCall {
  15121. c.ctx_ = ctx
  15122. return c
  15123. }
  15124. // Header returns an http.Header that can be modified by the caller to
  15125. // add HTTP headers to the request.
  15126. func (c *SchemasListCall) Header() http.Header {
  15127. if c.header_ == nil {
  15128. c.header_ = make(http.Header)
  15129. }
  15130. return c.header_
  15131. }
  15132. func (c *SchemasListCall) doRequest(alt string) (*http.Response, error) {
  15133. reqHeaders := make(http.Header)
  15134. for k, v := range c.header_ {
  15135. reqHeaders[k] = v
  15136. }
  15137. reqHeaders.Set("User-Agent", c.s.userAgent())
  15138. if c.ifNoneMatch_ != "" {
  15139. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  15140. }
  15141. var body io.Reader = nil
  15142. c.urlParams_.Set("alt", alt)
  15143. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas")
  15144. urls += "?" + c.urlParams_.Encode()
  15145. req, _ := http.NewRequest("GET", urls, body)
  15146. req.Header = reqHeaders
  15147. googleapi.Expand(req.URL, map[string]string{
  15148. "customerId": c.customerId,
  15149. })
  15150. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15151. }
  15152. // Do executes the "directory.schemas.list" call.
  15153. // Exactly one of *Schemas or error will be non-nil. Any non-2xx status
  15154. // code is an error. Response headers are in either
  15155. // *Schemas.ServerResponse.Header or (if a response was returned at all)
  15156. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  15157. // check whether the returned error was because http.StatusNotModified
  15158. // was returned.
  15159. func (c *SchemasListCall) Do(opts ...googleapi.CallOption) (*Schemas, error) {
  15160. gensupport.SetOptions(c.urlParams_, opts...)
  15161. res, err := c.doRequest("json")
  15162. if res != nil && res.StatusCode == http.StatusNotModified {
  15163. if res.Body != nil {
  15164. res.Body.Close()
  15165. }
  15166. return nil, &googleapi.Error{
  15167. Code: res.StatusCode,
  15168. Header: res.Header,
  15169. }
  15170. }
  15171. if err != nil {
  15172. return nil, err
  15173. }
  15174. defer googleapi.CloseBody(res)
  15175. if err := googleapi.CheckResponse(res); err != nil {
  15176. return nil, err
  15177. }
  15178. ret := &Schemas{
  15179. ServerResponse: googleapi.ServerResponse{
  15180. Header: res.Header,
  15181. HTTPStatusCode: res.StatusCode,
  15182. },
  15183. }
  15184. target := &ret
  15185. if err := gensupport.DecodeResponse(target, res); err != nil {
  15186. return nil, err
  15187. }
  15188. return ret, nil
  15189. // {
  15190. // "description": "Retrieve all schemas for a customer",
  15191. // "httpMethod": "GET",
  15192. // "id": "directory.schemas.list",
  15193. // "parameterOrder": [
  15194. // "customerId"
  15195. // ],
  15196. // "parameters": {
  15197. // "customerId": {
  15198. // "description": "Immutable ID of the G Suite account",
  15199. // "location": "path",
  15200. // "required": true,
  15201. // "type": "string"
  15202. // }
  15203. // },
  15204. // "path": "customer/{customerId}/schemas",
  15205. // "response": {
  15206. // "$ref": "Schemas"
  15207. // },
  15208. // "scopes": [
  15209. // "https://www.googleapis.com/auth/admin.directory.userschema",
  15210. // "https://www.googleapis.com/auth/admin.directory.userschema.readonly"
  15211. // ]
  15212. // }
  15213. }
  15214. // method id "directory.schemas.patch":
  15215. type SchemasPatchCall struct {
  15216. s *Service
  15217. customerId string
  15218. schemaKey string
  15219. schema *Schema
  15220. urlParams_ gensupport.URLParams
  15221. ctx_ context.Context
  15222. header_ http.Header
  15223. }
  15224. // Patch: Update schema. This method supports patch semantics.
  15225. func (r *SchemasService) Patch(customerId string, schemaKey string, schema *Schema) *SchemasPatchCall {
  15226. c := &SchemasPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15227. c.customerId = customerId
  15228. c.schemaKey = schemaKey
  15229. c.schema = schema
  15230. return c
  15231. }
  15232. // Fields allows partial responses to be retrieved. See
  15233. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15234. // for more information.
  15235. func (c *SchemasPatchCall) Fields(s ...googleapi.Field) *SchemasPatchCall {
  15236. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15237. return c
  15238. }
  15239. // Context sets the context to be used in this call's Do method. Any
  15240. // pending HTTP request will be aborted if the provided context is
  15241. // canceled.
  15242. func (c *SchemasPatchCall) Context(ctx context.Context) *SchemasPatchCall {
  15243. c.ctx_ = ctx
  15244. return c
  15245. }
  15246. // Header returns an http.Header that can be modified by the caller to
  15247. // add HTTP headers to the request.
  15248. func (c *SchemasPatchCall) Header() http.Header {
  15249. if c.header_ == nil {
  15250. c.header_ = make(http.Header)
  15251. }
  15252. return c.header_
  15253. }
  15254. func (c *SchemasPatchCall) doRequest(alt string) (*http.Response, error) {
  15255. reqHeaders := make(http.Header)
  15256. for k, v := range c.header_ {
  15257. reqHeaders[k] = v
  15258. }
  15259. reqHeaders.Set("User-Agent", c.s.userAgent())
  15260. var body io.Reader = nil
  15261. body, err := googleapi.WithoutDataWrapper.JSONReader(c.schema)
  15262. if err != nil {
  15263. return nil, err
  15264. }
  15265. reqHeaders.Set("Content-Type", "application/json")
  15266. c.urlParams_.Set("alt", alt)
  15267. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  15268. urls += "?" + c.urlParams_.Encode()
  15269. req, _ := http.NewRequest("PATCH", urls, body)
  15270. req.Header = reqHeaders
  15271. googleapi.Expand(req.URL, map[string]string{
  15272. "customerId": c.customerId,
  15273. "schemaKey": c.schemaKey,
  15274. })
  15275. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15276. }
  15277. // Do executes the "directory.schemas.patch" call.
  15278. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  15279. // code is an error. Response headers are in either
  15280. // *Schema.ServerResponse.Header or (if a response was returned at all)
  15281. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  15282. // check whether the returned error was because http.StatusNotModified
  15283. // was returned.
  15284. func (c *SchemasPatchCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  15285. gensupport.SetOptions(c.urlParams_, opts...)
  15286. res, err := c.doRequest("json")
  15287. if res != nil && res.StatusCode == http.StatusNotModified {
  15288. if res.Body != nil {
  15289. res.Body.Close()
  15290. }
  15291. return nil, &googleapi.Error{
  15292. Code: res.StatusCode,
  15293. Header: res.Header,
  15294. }
  15295. }
  15296. if err != nil {
  15297. return nil, err
  15298. }
  15299. defer googleapi.CloseBody(res)
  15300. if err := googleapi.CheckResponse(res); err != nil {
  15301. return nil, err
  15302. }
  15303. ret := &Schema{
  15304. ServerResponse: googleapi.ServerResponse{
  15305. Header: res.Header,
  15306. HTTPStatusCode: res.StatusCode,
  15307. },
  15308. }
  15309. target := &ret
  15310. if err := gensupport.DecodeResponse(target, res); err != nil {
  15311. return nil, err
  15312. }
  15313. return ret, nil
  15314. // {
  15315. // "description": "Update schema. This method supports patch semantics.",
  15316. // "httpMethod": "PATCH",
  15317. // "id": "directory.schemas.patch",
  15318. // "parameterOrder": [
  15319. // "customerId",
  15320. // "schemaKey"
  15321. // ],
  15322. // "parameters": {
  15323. // "customerId": {
  15324. // "description": "Immutable ID of the G Suite account",
  15325. // "location": "path",
  15326. // "required": true,
  15327. // "type": "string"
  15328. // },
  15329. // "schemaKey": {
  15330. // "description": "Name or immutable ID of the schema.",
  15331. // "location": "path",
  15332. // "required": true,
  15333. // "type": "string"
  15334. // }
  15335. // },
  15336. // "path": "customer/{customerId}/schemas/{schemaKey}",
  15337. // "request": {
  15338. // "$ref": "Schema"
  15339. // },
  15340. // "response": {
  15341. // "$ref": "Schema"
  15342. // },
  15343. // "scopes": [
  15344. // "https://www.googleapis.com/auth/admin.directory.userschema"
  15345. // ]
  15346. // }
  15347. }
  15348. // method id "directory.schemas.update":
  15349. type SchemasUpdateCall struct {
  15350. s *Service
  15351. customerId string
  15352. schemaKey string
  15353. schema *Schema
  15354. urlParams_ gensupport.URLParams
  15355. ctx_ context.Context
  15356. header_ http.Header
  15357. }
  15358. // Update: Update schema
  15359. func (r *SchemasService) Update(customerId string, schemaKey string, schema *Schema) *SchemasUpdateCall {
  15360. c := &SchemasUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15361. c.customerId = customerId
  15362. c.schemaKey = schemaKey
  15363. c.schema = schema
  15364. return c
  15365. }
  15366. // Fields allows partial responses to be retrieved. See
  15367. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15368. // for more information.
  15369. func (c *SchemasUpdateCall) Fields(s ...googleapi.Field) *SchemasUpdateCall {
  15370. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15371. return c
  15372. }
  15373. // Context sets the context to be used in this call's Do method. Any
  15374. // pending HTTP request will be aborted if the provided context is
  15375. // canceled.
  15376. func (c *SchemasUpdateCall) Context(ctx context.Context) *SchemasUpdateCall {
  15377. c.ctx_ = ctx
  15378. return c
  15379. }
  15380. // Header returns an http.Header that can be modified by the caller to
  15381. // add HTTP headers to the request.
  15382. func (c *SchemasUpdateCall) Header() http.Header {
  15383. if c.header_ == nil {
  15384. c.header_ = make(http.Header)
  15385. }
  15386. return c.header_
  15387. }
  15388. func (c *SchemasUpdateCall) doRequest(alt string) (*http.Response, error) {
  15389. reqHeaders := make(http.Header)
  15390. for k, v := range c.header_ {
  15391. reqHeaders[k] = v
  15392. }
  15393. reqHeaders.Set("User-Agent", c.s.userAgent())
  15394. var body io.Reader = nil
  15395. body, err := googleapi.WithoutDataWrapper.JSONReader(c.schema)
  15396. if err != nil {
  15397. return nil, err
  15398. }
  15399. reqHeaders.Set("Content-Type", "application/json")
  15400. c.urlParams_.Set("alt", alt)
  15401. urls := googleapi.ResolveRelative(c.s.BasePath, "customer/{customerId}/schemas/{schemaKey}")
  15402. urls += "?" + c.urlParams_.Encode()
  15403. req, _ := http.NewRequest("PUT", urls, body)
  15404. req.Header = reqHeaders
  15405. googleapi.Expand(req.URL, map[string]string{
  15406. "customerId": c.customerId,
  15407. "schemaKey": c.schemaKey,
  15408. })
  15409. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15410. }
  15411. // Do executes the "directory.schemas.update" call.
  15412. // Exactly one of *Schema or error will be non-nil. Any non-2xx status
  15413. // code is an error. Response headers are in either
  15414. // *Schema.ServerResponse.Header or (if a response was returned at all)
  15415. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  15416. // check whether the returned error was because http.StatusNotModified
  15417. // was returned.
  15418. func (c *SchemasUpdateCall) Do(opts ...googleapi.CallOption) (*Schema, error) {
  15419. gensupport.SetOptions(c.urlParams_, opts...)
  15420. res, err := c.doRequest("json")
  15421. if res != nil && res.StatusCode == http.StatusNotModified {
  15422. if res.Body != nil {
  15423. res.Body.Close()
  15424. }
  15425. return nil, &googleapi.Error{
  15426. Code: res.StatusCode,
  15427. Header: res.Header,
  15428. }
  15429. }
  15430. if err != nil {
  15431. return nil, err
  15432. }
  15433. defer googleapi.CloseBody(res)
  15434. if err := googleapi.CheckResponse(res); err != nil {
  15435. return nil, err
  15436. }
  15437. ret := &Schema{
  15438. ServerResponse: googleapi.ServerResponse{
  15439. Header: res.Header,
  15440. HTTPStatusCode: res.StatusCode,
  15441. },
  15442. }
  15443. target := &ret
  15444. if err := gensupport.DecodeResponse(target, res); err != nil {
  15445. return nil, err
  15446. }
  15447. return ret, nil
  15448. // {
  15449. // "description": "Update schema",
  15450. // "httpMethod": "PUT",
  15451. // "id": "directory.schemas.update",
  15452. // "parameterOrder": [
  15453. // "customerId",
  15454. // "schemaKey"
  15455. // ],
  15456. // "parameters": {
  15457. // "customerId": {
  15458. // "description": "Immutable ID of the G Suite account",
  15459. // "location": "path",
  15460. // "required": true,
  15461. // "type": "string"
  15462. // },
  15463. // "schemaKey": {
  15464. // "description": "Name or immutable ID of the schema.",
  15465. // "location": "path",
  15466. // "required": true,
  15467. // "type": "string"
  15468. // }
  15469. // },
  15470. // "path": "customer/{customerId}/schemas/{schemaKey}",
  15471. // "request": {
  15472. // "$ref": "Schema"
  15473. // },
  15474. // "response": {
  15475. // "$ref": "Schema"
  15476. // },
  15477. // "scopes": [
  15478. // "https://www.googleapis.com/auth/admin.directory.userschema"
  15479. // ]
  15480. // }
  15481. }
  15482. // method id "directory.tokens.delete":
  15483. type TokensDeleteCall struct {
  15484. s *Service
  15485. userKey string
  15486. clientId string
  15487. urlParams_ gensupport.URLParams
  15488. ctx_ context.Context
  15489. header_ http.Header
  15490. }
  15491. // Delete: Delete all access tokens issued by a user for an application.
  15492. func (r *TokensService) Delete(userKey string, clientId string) *TokensDeleteCall {
  15493. c := &TokensDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15494. c.userKey = userKey
  15495. c.clientId = clientId
  15496. return c
  15497. }
  15498. // Fields allows partial responses to be retrieved. See
  15499. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15500. // for more information.
  15501. func (c *TokensDeleteCall) Fields(s ...googleapi.Field) *TokensDeleteCall {
  15502. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15503. return c
  15504. }
  15505. // Context sets the context to be used in this call's Do method. Any
  15506. // pending HTTP request will be aborted if the provided context is
  15507. // canceled.
  15508. func (c *TokensDeleteCall) Context(ctx context.Context) *TokensDeleteCall {
  15509. c.ctx_ = ctx
  15510. return c
  15511. }
  15512. // Header returns an http.Header that can be modified by the caller to
  15513. // add HTTP headers to the request.
  15514. func (c *TokensDeleteCall) Header() http.Header {
  15515. if c.header_ == nil {
  15516. c.header_ = make(http.Header)
  15517. }
  15518. return c.header_
  15519. }
  15520. func (c *TokensDeleteCall) doRequest(alt string) (*http.Response, error) {
  15521. reqHeaders := make(http.Header)
  15522. for k, v := range c.header_ {
  15523. reqHeaders[k] = v
  15524. }
  15525. reqHeaders.Set("User-Agent", c.s.userAgent())
  15526. var body io.Reader = nil
  15527. c.urlParams_.Set("alt", alt)
  15528. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/tokens/{clientId}")
  15529. urls += "?" + c.urlParams_.Encode()
  15530. req, _ := http.NewRequest("DELETE", urls, body)
  15531. req.Header = reqHeaders
  15532. googleapi.Expand(req.URL, map[string]string{
  15533. "userKey": c.userKey,
  15534. "clientId": c.clientId,
  15535. })
  15536. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15537. }
  15538. // Do executes the "directory.tokens.delete" call.
  15539. func (c *TokensDeleteCall) Do(opts ...googleapi.CallOption) error {
  15540. gensupport.SetOptions(c.urlParams_, opts...)
  15541. res, err := c.doRequest("json")
  15542. if err != nil {
  15543. return err
  15544. }
  15545. defer googleapi.CloseBody(res)
  15546. if err := googleapi.CheckResponse(res); err != nil {
  15547. return err
  15548. }
  15549. return nil
  15550. // {
  15551. // "description": "Delete all access tokens issued by a user for an application.",
  15552. // "httpMethod": "DELETE",
  15553. // "id": "directory.tokens.delete",
  15554. // "parameterOrder": [
  15555. // "userKey",
  15556. // "clientId"
  15557. // ],
  15558. // "parameters": {
  15559. // "clientId": {
  15560. // "description": "The Client ID of the application the token is issued to.",
  15561. // "location": "path",
  15562. // "required": true,
  15563. // "type": "string"
  15564. // },
  15565. // "userKey": {
  15566. // "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.",
  15567. // "location": "path",
  15568. // "required": true,
  15569. // "type": "string"
  15570. // }
  15571. // },
  15572. // "path": "users/{userKey}/tokens/{clientId}",
  15573. // "scopes": [
  15574. // "https://www.googleapis.com/auth/admin.directory.user.security"
  15575. // ]
  15576. // }
  15577. }
  15578. // method id "directory.tokens.get":
  15579. type TokensGetCall struct {
  15580. s *Service
  15581. userKey string
  15582. clientId string
  15583. urlParams_ gensupport.URLParams
  15584. ifNoneMatch_ string
  15585. ctx_ context.Context
  15586. header_ http.Header
  15587. }
  15588. // Get: Get information about an access token issued by a user.
  15589. func (r *TokensService) Get(userKey string, clientId string) *TokensGetCall {
  15590. c := &TokensGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15591. c.userKey = userKey
  15592. c.clientId = clientId
  15593. return c
  15594. }
  15595. // Fields allows partial responses to be retrieved. See
  15596. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15597. // for more information.
  15598. func (c *TokensGetCall) Fields(s ...googleapi.Field) *TokensGetCall {
  15599. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15600. return c
  15601. }
  15602. // IfNoneMatch sets the optional parameter which makes the operation
  15603. // fail if the object's ETag matches the given value. This is useful for
  15604. // getting updates only after the object has changed since the last
  15605. // request. Use googleapi.IsNotModified to check whether the response
  15606. // error from Do is the result of In-None-Match.
  15607. func (c *TokensGetCall) IfNoneMatch(entityTag string) *TokensGetCall {
  15608. c.ifNoneMatch_ = entityTag
  15609. return c
  15610. }
  15611. // Context sets the context to be used in this call's Do method. Any
  15612. // pending HTTP request will be aborted if the provided context is
  15613. // canceled.
  15614. func (c *TokensGetCall) Context(ctx context.Context) *TokensGetCall {
  15615. c.ctx_ = ctx
  15616. return c
  15617. }
  15618. // Header returns an http.Header that can be modified by the caller to
  15619. // add HTTP headers to the request.
  15620. func (c *TokensGetCall) Header() http.Header {
  15621. if c.header_ == nil {
  15622. c.header_ = make(http.Header)
  15623. }
  15624. return c.header_
  15625. }
  15626. func (c *TokensGetCall) doRequest(alt string) (*http.Response, error) {
  15627. reqHeaders := make(http.Header)
  15628. for k, v := range c.header_ {
  15629. reqHeaders[k] = v
  15630. }
  15631. reqHeaders.Set("User-Agent", c.s.userAgent())
  15632. if c.ifNoneMatch_ != "" {
  15633. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  15634. }
  15635. var body io.Reader = nil
  15636. c.urlParams_.Set("alt", alt)
  15637. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/tokens/{clientId}")
  15638. urls += "?" + c.urlParams_.Encode()
  15639. req, _ := http.NewRequest("GET", urls, body)
  15640. req.Header = reqHeaders
  15641. googleapi.Expand(req.URL, map[string]string{
  15642. "userKey": c.userKey,
  15643. "clientId": c.clientId,
  15644. })
  15645. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15646. }
  15647. // Do executes the "directory.tokens.get" call.
  15648. // Exactly one of *Token or error will be non-nil. Any non-2xx status
  15649. // code is an error. Response headers are in either
  15650. // *Token.ServerResponse.Header or (if a response was returned at all)
  15651. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  15652. // check whether the returned error was because http.StatusNotModified
  15653. // was returned.
  15654. func (c *TokensGetCall) Do(opts ...googleapi.CallOption) (*Token, error) {
  15655. gensupport.SetOptions(c.urlParams_, opts...)
  15656. res, err := c.doRequest("json")
  15657. if res != nil && res.StatusCode == http.StatusNotModified {
  15658. if res.Body != nil {
  15659. res.Body.Close()
  15660. }
  15661. return nil, &googleapi.Error{
  15662. Code: res.StatusCode,
  15663. Header: res.Header,
  15664. }
  15665. }
  15666. if err != nil {
  15667. return nil, err
  15668. }
  15669. defer googleapi.CloseBody(res)
  15670. if err := googleapi.CheckResponse(res); err != nil {
  15671. return nil, err
  15672. }
  15673. ret := &Token{
  15674. ServerResponse: googleapi.ServerResponse{
  15675. Header: res.Header,
  15676. HTTPStatusCode: res.StatusCode,
  15677. },
  15678. }
  15679. target := &ret
  15680. if err := gensupport.DecodeResponse(target, res); err != nil {
  15681. return nil, err
  15682. }
  15683. return ret, nil
  15684. // {
  15685. // "description": "Get information about an access token issued by a user.",
  15686. // "httpMethod": "GET",
  15687. // "id": "directory.tokens.get",
  15688. // "parameterOrder": [
  15689. // "userKey",
  15690. // "clientId"
  15691. // ],
  15692. // "parameters": {
  15693. // "clientId": {
  15694. // "description": "The Client ID of the application the token is issued to.",
  15695. // "location": "path",
  15696. // "required": true,
  15697. // "type": "string"
  15698. // },
  15699. // "userKey": {
  15700. // "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.",
  15701. // "location": "path",
  15702. // "required": true,
  15703. // "type": "string"
  15704. // }
  15705. // },
  15706. // "path": "users/{userKey}/tokens/{clientId}",
  15707. // "response": {
  15708. // "$ref": "Token"
  15709. // },
  15710. // "scopes": [
  15711. // "https://www.googleapis.com/auth/admin.directory.user.security"
  15712. // ]
  15713. // }
  15714. }
  15715. // method id "directory.tokens.list":
  15716. type TokensListCall struct {
  15717. s *Service
  15718. userKey string
  15719. urlParams_ gensupport.URLParams
  15720. ifNoneMatch_ string
  15721. ctx_ context.Context
  15722. header_ http.Header
  15723. }
  15724. // List: Returns the set of tokens specified user has issued to 3rd
  15725. // party applications.
  15726. func (r *TokensService) List(userKey string) *TokensListCall {
  15727. c := &TokensListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15728. c.userKey = userKey
  15729. return c
  15730. }
  15731. // Fields allows partial responses to be retrieved. See
  15732. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15733. // for more information.
  15734. func (c *TokensListCall) Fields(s ...googleapi.Field) *TokensListCall {
  15735. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15736. return c
  15737. }
  15738. // IfNoneMatch sets the optional parameter which makes the operation
  15739. // fail if the object's ETag matches the given value. This is useful for
  15740. // getting updates only after the object has changed since the last
  15741. // request. Use googleapi.IsNotModified to check whether the response
  15742. // error from Do is the result of In-None-Match.
  15743. func (c *TokensListCall) IfNoneMatch(entityTag string) *TokensListCall {
  15744. c.ifNoneMatch_ = entityTag
  15745. return c
  15746. }
  15747. // Context sets the context to be used in this call's Do method. Any
  15748. // pending HTTP request will be aborted if the provided context is
  15749. // canceled.
  15750. func (c *TokensListCall) Context(ctx context.Context) *TokensListCall {
  15751. c.ctx_ = ctx
  15752. return c
  15753. }
  15754. // Header returns an http.Header that can be modified by the caller to
  15755. // add HTTP headers to the request.
  15756. func (c *TokensListCall) Header() http.Header {
  15757. if c.header_ == nil {
  15758. c.header_ = make(http.Header)
  15759. }
  15760. return c.header_
  15761. }
  15762. func (c *TokensListCall) doRequest(alt string) (*http.Response, error) {
  15763. reqHeaders := make(http.Header)
  15764. for k, v := range c.header_ {
  15765. reqHeaders[k] = v
  15766. }
  15767. reqHeaders.Set("User-Agent", c.s.userAgent())
  15768. if c.ifNoneMatch_ != "" {
  15769. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  15770. }
  15771. var body io.Reader = nil
  15772. c.urlParams_.Set("alt", alt)
  15773. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/tokens")
  15774. urls += "?" + c.urlParams_.Encode()
  15775. req, _ := http.NewRequest("GET", urls, body)
  15776. req.Header = reqHeaders
  15777. googleapi.Expand(req.URL, map[string]string{
  15778. "userKey": c.userKey,
  15779. })
  15780. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15781. }
  15782. // Do executes the "directory.tokens.list" call.
  15783. // Exactly one of *Tokens or error will be non-nil. Any non-2xx status
  15784. // code is an error. Response headers are in either
  15785. // *Tokens.ServerResponse.Header or (if a response was returned at all)
  15786. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  15787. // check whether the returned error was because http.StatusNotModified
  15788. // was returned.
  15789. func (c *TokensListCall) Do(opts ...googleapi.CallOption) (*Tokens, error) {
  15790. gensupport.SetOptions(c.urlParams_, opts...)
  15791. res, err := c.doRequest("json")
  15792. if res != nil && res.StatusCode == http.StatusNotModified {
  15793. if res.Body != nil {
  15794. res.Body.Close()
  15795. }
  15796. return nil, &googleapi.Error{
  15797. Code: res.StatusCode,
  15798. Header: res.Header,
  15799. }
  15800. }
  15801. if err != nil {
  15802. return nil, err
  15803. }
  15804. defer googleapi.CloseBody(res)
  15805. if err := googleapi.CheckResponse(res); err != nil {
  15806. return nil, err
  15807. }
  15808. ret := &Tokens{
  15809. ServerResponse: googleapi.ServerResponse{
  15810. Header: res.Header,
  15811. HTTPStatusCode: res.StatusCode,
  15812. },
  15813. }
  15814. target := &ret
  15815. if err := gensupport.DecodeResponse(target, res); err != nil {
  15816. return nil, err
  15817. }
  15818. return ret, nil
  15819. // {
  15820. // "description": "Returns the set of tokens specified user has issued to 3rd party applications.",
  15821. // "httpMethod": "GET",
  15822. // "id": "directory.tokens.list",
  15823. // "parameterOrder": [
  15824. // "userKey"
  15825. // ],
  15826. // "parameters": {
  15827. // "userKey": {
  15828. // "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.",
  15829. // "location": "path",
  15830. // "required": true,
  15831. // "type": "string"
  15832. // }
  15833. // },
  15834. // "path": "users/{userKey}/tokens",
  15835. // "response": {
  15836. // "$ref": "Tokens"
  15837. // },
  15838. // "scopes": [
  15839. // "https://www.googleapis.com/auth/admin.directory.user.security"
  15840. // ]
  15841. // }
  15842. }
  15843. // method id "directory.users.delete":
  15844. type UsersDeleteCall struct {
  15845. s *Service
  15846. userKey string
  15847. urlParams_ gensupport.URLParams
  15848. ctx_ context.Context
  15849. header_ http.Header
  15850. }
  15851. // Delete: Delete user
  15852. func (r *UsersService) Delete(userKey string) *UsersDeleteCall {
  15853. c := &UsersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15854. c.userKey = userKey
  15855. return c
  15856. }
  15857. // Fields allows partial responses to be retrieved. See
  15858. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15859. // for more information.
  15860. func (c *UsersDeleteCall) Fields(s ...googleapi.Field) *UsersDeleteCall {
  15861. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15862. return c
  15863. }
  15864. // Context sets the context to be used in this call's Do method. Any
  15865. // pending HTTP request will be aborted if the provided context is
  15866. // canceled.
  15867. func (c *UsersDeleteCall) Context(ctx context.Context) *UsersDeleteCall {
  15868. c.ctx_ = ctx
  15869. return c
  15870. }
  15871. // Header returns an http.Header that can be modified by the caller to
  15872. // add HTTP headers to the request.
  15873. func (c *UsersDeleteCall) Header() http.Header {
  15874. if c.header_ == nil {
  15875. c.header_ = make(http.Header)
  15876. }
  15877. return c.header_
  15878. }
  15879. func (c *UsersDeleteCall) doRequest(alt string) (*http.Response, error) {
  15880. reqHeaders := make(http.Header)
  15881. for k, v := range c.header_ {
  15882. reqHeaders[k] = v
  15883. }
  15884. reqHeaders.Set("User-Agent", c.s.userAgent())
  15885. var body io.Reader = nil
  15886. c.urlParams_.Set("alt", alt)
  15887. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  15888. urls += "?" + c.urlParams_.Encode()
  15889. req, _ := http.NewRequest("DELETE", urls, body)
  15890. req.Header = reqHeaders
  15891. googleapi.Expand(req.URL, map[string]string{
  15892. "userKey": c.userKey,
  15893. })
  15894. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  15895. }
  15896. // Do executes the "directory.users.delete" call.
  15897. func (c *UsersDeleteCall) Do(opts ...googleapi.CallOption) error {
  15898. gensupport.SetOptions(c.urlParams_, opts...)
  15899. res, err := c.doRequest("json")
  15900. if err != nil {
  15901. return err
  15902. }
  15903. defer googleapi.CloseBody(res)
  15904. if err := googleapi.CheckResponse(res); err != nil {
  15905. return err
  15906. }
  15907. return nil
  15908. // {
  15909. // "description": "Delete user",
  15910. // "httpMethod": "DELETE",
  15911. // "id": "directory.users.delete",
  15912. // "parameterOrder": [
  15913. // "userKey"
  15914. // ],
  15915. // "parameters": {
  15916. // "userKey": {
  15917. // "description": "Email or immutable ID of the user",
  15918. // "location": "path",
  15919. // "required": true,
  15920. // "type": "string"
  15921. // }
  15922. // },
  15923. // "path": "users/{userKey}",
  15924. // "scopes": [
  15925. // "https://www.googleapis.com/auth/admin.directory.user"
  15926. // ]
  15927. // }
  15928. }
  15929. // method id "directory.users.get":
  15930. type UsersGetCall struct {
  15931. s *Service
  15932. userKey string
  15933. urlParams_ gensupport.URLParams
  15934. ifNoneMatch_ string
  15935. ctx_ context.Context
  15936. header_ http.Header
  15937. }
  15938. // Get: retrieve user
  15939. func (r *UsersService) Get(userKey string) *UsersGetCall {
  15940. c := &UsersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  15941. c.userKey = userKey
  15942. return c
  15943. }
  15944. // CustomFieldMask sets the optional parameter "customFieldMask":
  15945. // Comma-separated list of schema names. All fields from these schemas
  15946. // are fetched. This should only be set when projection=custom.
  15947. func (c *UsersGetCall) CustomFieldMask(customFieldMask string) *UsersGetCall {
  15948. c.urlParams_.Set("customFieldMask", customFieldMask)
  15949. return c
  15950. }
  15951. // Projection sets the optional parameter "projection": What subset of
  15952. // fields to fetch for this user.
  15953. //
  15954. // Possible values:
  15955. // "basic" (default) - Do not include any custom fields for the user.
  15956. // "custom" - Include custom fields from schemas mentioned in
  15957. // customFieldMask.
  15958. // "full" - Include all fields associated with this user.
  15959. func (c *UsersGetCall) Projection(projection string) *UsersGetCall {
  15960. c.urlParams_.Set("projection", projection)
  15961. return c
  15962. }
  15963. // ViewType sets the optional parameter "viewType": Whether to fetch the
  15964. // ADMIN_VIEW or DOMAIN_PUBLIC view of the user.
  15965. //
  15966. // Possible values:
  15967. // "admin_view" (default) - Fetches the ADMIN_VIEW of the user.
  15968. // "domain_public" - Fetches the DOMAIN_PUBLIC view of the user.
  15969. func (c *UsersGetCall) ViewType(viewType string) *UsersGetCall {
  15970. c.urlParams_.Set("viewType", viewType)
  15971. return c
  15972. }
  15973. // Fields allows partial responses to be retrieved. See
  15974. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  15975. // for more information.
  15976. func (c *UsersGetCall) Fields(s ...googleapi.Field) *UsersGetCall {
  15977. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  15978. return c
  15979. }
  15980. // IfNoneMatch sets the optional parameter which makes the operation
  15981. // fail if the object's ETag matches the given value. This is useful for
  15982. // getting updates only after the object has changed since the last
  15983. // request. Use googleapi.IsNotModified to check whether the response
  15984. // error from Do is the result of In-None-Match.
  15985. func (c *UsersGetCall) IfNoneMatch(entityTag string) *UsersGetCall {
  15986. c.ifNoneMatch_ = entityTag
  15987. return c
  15988. }
  15989. // Context sets the context to be used in this call's Do method. Any
  15990. // pending HTTP request will be aborted if the provided context is
  15991. // canceled.
  15992. func (c *UsersGetCall) Context(ctx context.Context) *UsersGetCall {
  15993. c.ctx_ = ctx
  15994. return c
  15995. }
  15996. // Header returns an http.Header that can be modified by the caller to
  15997. // add HTTP headers to the request.
  15998. func (c *UsersGetCall) Header() http.Header {
  15999. if c.header_ == nil {
  16000. c.header_ = make(http.Header)
  16001. }
  16002. return c.header_
  16003. }
  16004. func (c *UsersGetCall) doRequest(alt string) (*http.Response, error) {
  16005. reqHeaders := make(http.Header)
  16006. for k, v := range c.header_ {
  16007. reqHeaders[k] = v
  16008. }
  16009. reqHeaders.Set("User-Agent", c.s.userAgent())
  16010. if c.ifNoneMatch_ != "" {
  16011. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  16012. }
  16013. var body io.Reader = nil
  16014. c.urlParams_.Set("alt", alt)
  16015. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  16016. urls += "?" + c.urlParams_.Encode()
  16017. req, _ := http.NewRequest("GET", urls, body)
  16018. req.Header = reqHeaders
  16019. googleapi.Expand(req.URL, map[string]string{
  16020. "userKey": c.userKey,
  16021. })
  16022. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16023. }
  16024. // Do executes the "directory.users.get" call.
  16025. // Exactly one of *User or error will be non-nil. Any non-2xx status
  16026. // code is an error. Response headers are in either
  16027. // *User.ServerResponse.Header or (if a response was returned at all) in
  16028. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  16029. // whether the returned error was because http.StatusNotModified was
  16030. // returned.
  16031. func (c *UsersGetCall) Do(opts ...googleapi.CallOption) (*User, error) {
  16032. gensupport.SetOptions(c.urlParams_, opts...)
  16033. res, err := c.doRequest("json")
  16034. if res != nil && res.StatusCode == http.StatusNotModified {
  16035. if res.Body != nil {
  16036. res.Body.Close()
  16037. }
  16038. return nil, &googleapi.Error{
  16039. Code: res.StatusCode,
  16040. Header: res.Header,
  16041. }
  16042. }
  16043. if err != nil {
  16044. return nil, err
  16045. }
  16046. defer googleapi.CloseBody(res)
  16047. if err := googleapi.CheckResponse(res); err != nil {
  16048. return nil, err
  16049. }
  16050. ret := &User{
  16051. ServerResponse: googleapi.ServerResponse{
  16052. Header: res.Header,
  16053. HTTPStatusCode: res.StatusCode,
  16054. },
  16055. }
  16056. target := &ret
  16057. if err := gensupport.DecodeResponse(target, res); err != nil {
  16058. return nil, err
  16059. }
  16060. return ret, nil
  16061. // {
  16062. // "description": "retrieve user",
  16063. // "httpMethod": "GET",
  16064. // "id": "directory.users.get",
  16065. // "parameterOrder": [
  16066. // "userKey"
  16067. // ],
  16068. // "parameters": {
  16069. // "customFieldMask": {
  16070. // "description": "Comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.",
  16071. // "location": "query",
  16072. // "type": "string"
  16073. // },
  16074. // "projection": {
  16075. // "default": "basic",
  16076. // "description": "What subset of fields to fetch for this user.",
  16077. // "enum": [
  16078. // "basic",
  16079. // "custom",
  16080. // "full"
  16081. // ],
  16082. // "enumDescriptions": [
  16083. // "Do not include any custom fields for the user.",
  16084. // "Include custom fields from schemas mentioned in customFieldMask.",
  16085. // "Include all fields associated with this user."
  16086. // ],
  16087. // "location": "query",
  16088. // "type": "string"
  16089. // },
  16090. // "userKey": {
  16091. // "description": "Email or immutable ID of the user",
  16092. // "location": "path",
  16093. // "required": true,
  16094. // "type": "string"
  16095. // },
  16096. // "viewType": {
  16097. // "default": "admin_view",
  16098. // "description": "Whether to fetch the ADMIN_VIEW or DOMAIN_PUBLIC view of the user.",
  16099. // "enum": [
  16100. // "admin_view",
  16101. // "domain_public"
  16102. // ],
  16103. // "enumDescriptions": [
  16104. // "Fetches the ADMIN_VIEW of the user.",
  16105. // "Fetches the DOMAIN_PUBLIC view of the user."
  16106. // ],
  16107. // "location": "query",
  16108. // "type": "string"
  16109. // }
  16110. // },
  16111. // "path": "users/{userKey}",
  16112. // "response": {
  16113. // "$ref": "User"
  16114. // },
  16115. // "scopes": [
  16116. // "https://www.googleapis.com/auth/admin.directory.user",
  16117. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  16118. // ]
  16119. // }
  16120. }
  16121. // method id "directory.users.insert":
  16122. type UsersInsertCall struct {
  16123. s *Service
  16124. user *User
  16125. urlParams_ gensupport.URLParams
  16126. ctx_ context.Context
  16127. header_ http.Header
  16128. }
  16129. // Insert: create user.
  16130. func (r *UsersService) Insert(user *User) *UsersInsertCall {
  16131. c := &UsersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16132. c.user = user
  16133. return c
  16134. }
  16135. // Fields allows partial responses to be retrieved. See
  16136. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16137. // for more information.
  16138. func (c *UsersInsertCall) Fields(s ...googleapi.Field) *UsersInsertCall {
  16139. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16140. return c
  16141. }
  16142. // Context sets the context to be used in this call's Do method. Any
  16143. // pending HTTP request will be aborted if the provided context is
  16144. // canceled.
  16145. func (c *UsersInsertCall) Context(ctx context.Context) *UsersInsertCall {
  16146. c.ctx_ = ctx
  16147. return c
  16148. }
  16149. // Header returns an http.Header that can be modified by the caller to
  16150. // add HTTP headers to the request.
  16151. func (c *UsersInsertCall) Header() http.Header {
  16152. if c.header_ == nil {
  16153. c.header_ = make(http.Header)
  16154. }
  16155. return c.header_
  16156. }
  16157. func (c *UsersInsertCall) doRequest(alt string) (*http.Response, error) {
  16158. reqHeaders := make(http.Header)
  16159. for k, v := range c.header_ {
  16160. reqHeaders[k] = v
  16161. }
  16162. reqHeaders.Set("User-Agent", c.s.userAgent())
  16163. var body io.Reader = nil
  16164. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  16165. if err != nil {
  16166. return nil, err
  16167. }
  16168. reqHeaders.Set("Content-Type", "application/json")
  16169. c.urlParams_.Set("alt", alt)
  16170. urls := googleapi.ResolveRelative(c.s.BasePath, "users")
  16171. urls += "?" + c.urlParams_.Encode()
  16172. req, _ := http.NewRequest("POST", urls, body)
  16173. req.Header = reqHeaders
  16174. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16175. }
  16176. // Do executes the "directory.users.insert" call.
  16177. // Exactly one of *User or error will be non-nil. Any non-2xx status
  16178. // code is an error. Response headers are in either
  16179. // *User.ServerResponse.Header or (if a response was returned at all) in
  16180. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  16181. // whether the returned error was because http.StatusNotModified was
  16182. // returned.
  16183. func (c *UsersInsertCall) Do(opts ...googleapi.CallOption) (*User, error) {
  16184. gensupport.SetOptions(c.urlParams_, opts...)
  16185. res, err := c.doRequest("json")
  16186. if res != nil && res.StatusCode == http.StatusNotModified {
  16187. if res.Body != nil {
  16188. res.Body.Close()
  16189. }
  16190. return nil, &googleapi.Error{
  16191. Code: res.StatusCode,
  16192. Header: res.Header,
  16193. }
  16194. }
  16195. if err != nil {
  16196. return nil, err
  16197. }
  16198. defer googleapi.CloseBody(res)
  16199. if err := googleapi.CheckResponse(res); err != nil {
  16200. return nil, err
  16201. }
  16202. ret := &User{
  16203. ServerResponse: googleapi.ServerResponse{
  16204. Header: res.Header,
  16205. HTTPStatusCode: res.StatusCode,
  16206. },
  16207. }
  16208. target := &ret
  16209. if err := gensupport.DecodeResponse(target, res); err != nil {
  16210. return nil, err
  16211. }
  16212. return ret, nil
  16213. // {
  16214. // "description": "create user.",
  16215. // "httpMethod": "POST",
  16216. // "id": "directory.users.insert",
  16217. // "path": "users",
  16218. // "request": {
  16219. // "$ref": "User"
  16220. // },
  16221. // "response": {
  16222. // "$ref": "User"
  16223. // },
  16224. // "scopes": [
  16225. // "https://www.googleapis.com/auth/admin.directory.user"
  16226. // ]
  16227. // }
  16228. }
  16229. // method id "directory.users.list":
  16230. type UsersListCall struct {
  16231. s *Service
  16232. urlParams_ gensupport.URLParams
  16233. ifNoneMatch_ string
  16234. ctx_ context.Context
  16235. header_ http.Header
  16236. }
  16237. // List: Retrieve either deleted users or all users in a domain
  16238. // (paginated)
  16239. func (r *UsersService) List() *UsersListCall {
  16240. c := &UsersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16241. return c
  16242. }
  16243. // CustomFieldMask sets the optional parameter "customFieldMask":
  16244. // Comma-separated list of schema names. All fields from these schemas
  16245. // are fetched. This should only be set when projection=custom.
  16246. func (c *UsersListCall) CustomFieldMask(customFieldMask string) *UsersListCall {
  16247. c.urlParams_.Set("customFieldMask", customFieldMask)
  16248. return c
  16249. }
  16250. // Customer sets the optional parameter "customer": Immutable ID of the
  16251. // G Suite account. In case of multi-domain, to fetch all users for a
  16252. // customer, fill this field instead of domain.
  16253. func (c *UsersListCall) Customer(customer string) *UsersListCall {
  16254. c.urlParams_.Set("customer", customer)
  16255. return c
  16256. }
  16257. // Domain sets the optional parameter "domain": Name of the domain. Fill
  16258. // this field to get users from only this domain. To return all users in
  16259. // a multi-domain fill customer field instead.
  16260. func (c *UsersListCall) Domain(domain string) *UsersListCall {
  16261. c.urlParams_.Set("domain", domain)
  16262. return c
  16263. }
  16264. // Event sets the optional parameter "event": Event on which
  16265. // subscription is intended (if subscribing)
  16266. //
  16267. // Possible values:
  16268. // "add" - User Created Event
  16269. // "delete" - User Deleted Event
  16270. // "makeAdmin" - User Admin Status Change Event
  16271. // "undelete" - User Undeleted Event
  16272. // "update" - User Updated Event
  16273. func (c *UsersListCall) Event(event string) *UsersListCall {
  16274. c.urlParams_.Set("event", event)
  16275. return c
  16276. }
  16277. // MaxResults sets the optional parameter "maxResults": Maximum number
  16278. // of results to return. Default is 100. Max allowed is 500
  16279. func (c *UsersListCall) MaxResults(maxResults int64) *UsersListCall {
  16280. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  16281. return c
  16282. }
  16283. // OrderBy sets the optional parameter "orderBy": Column to use for
  16284. // sorting results
  16285. //
  16286. // Possible values:
  16287. // "email" - Primary email of the user.
  16288. // "familyName" - User's family name.
  16289. // "givenName" - User's given name.
  16290. func (c *UsersListCall) OrderBy(orderBy string) *UsersListCall {
  16291. c.urlParams_.Set("orderBy", orderBy)
  16292. return c
  16293. }
  16294. // PageToken sets the optional parameter "pageToken": Token to specify
  16295. // next page in the list
  16296. func (c *UsersListCall) PageToken(pageToken string) *UsersListCall {
  16297. c.urlParams_.Set("pageToken", pageToken)
  16298. return c
  16299. }
  16300. // Projection sets the optional parameter "projection": What subset of
  16301. // fields to fetch for this user.
  16302. //
  16303. // Possible values:
  16304. // "basic" (default) - Do not include any custom fields for the user.
  16305. // "custom" - Include custom fields from schemas mentioned in
  16306. // customFieldMask.
  16307. // "full" - Include all fields associated with this user.
  16308. func (c *UsersListCall) Projection(projection string) *UsersListCall {
  16309. c.urlParams_.Set("projection", projection)
  16310. return c
  16311. }
  16312. // Query sets the optional parameter "query": Query string search.
  16313. // Should be of the form "". Complete documentation is at
  16314. // https://developers.google.com/admin-sdk/directory/v1/guides/search-users
  16315. func (c *UsersListCall) Query(query string) *UsersListCall {
  16316. c.urlParams_.Set("query", query)
  16317. return c
  16318. }
  16319. // ShowDeleted sets the optional parameter "showDeleted": If set to true
  16320. // retrieves the list of deleted users. Default is false
  16321. func (c *UsersListCall) ShowDeleted(showDeleted string) *UsersListCall {
  16322. c.urlParams_.Set("showDeleted", showDeleted)
  16323. return c
  16324. }
  16325. // SortOrder sets the optional parameter "sortOrder": Whether to return
  16326. // results in ascending or descending order.
  16327. //
  16328. // Possible values:
  16329. // "ASCENDING" - Ascending order.
  16330. // "DESCENDING" - Descending order.
  16331. func (c *UsersListCall) SortOrder(sortOrder string) *UsersListCall {
  16332. c.urlParams_.Set("sortOrder", sortOrder)
  16333. return c
  16334. }
  16335. // ViewType sets the optional parameter "viewType": Whether to fetch the
  16336. // ADMIN_VIEW or DOMAIN_PUBLIC view of the user.
  16337. //
  16338. // Possible values:
  16339. // "admin_view" (default) - Fetches the ADMIN_VIEW of the user.
  16340. // "domain_public" - Fetches the DOMAIN_PUBLIC view of the user.
  16341. func (c *UsersListCall) ViewType(viewType string) *UsersListCall {
  16342. c.urlParams_.Set("viewType", viewType)
  16343. return c
  16344. }
  16345. // Fields allows partial responses to be retrieved. See
  16346. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16347. // for more information.
  16348. func (c *UsersListCall) Fields(s ...googleapi.Field) *UsersListCall {
  16349. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16350. return c
  16351. }
  16352. // IfNoneMatch sets the optional parameter which makes the operation
  16353. // fail if the object's ETag matches the given value. This is useful for
  16354. // getting updates only after the object has changed since the last
  16355. // request. Use googleapi.IsNotModified to check whether the response
  16356. // error from Do is the result of In-None-Match.
  16357. func (c *UsersListCall) IfNoneMatch(entityTag string) *UsersListCall {
  16358. c.ifNoneMatch_ = entityTag
  16359. return c
  16360. }
  16361. // Context sets the context to be used in this call's Do method. Any
  16362. // pending HTTP request will be aborted if the provided context is
  16363. // canceled.
  16364. func (c *UsersListCall) Context(ctx context.Context) *UsersListCall {
  16365. c.ctx_ = ctx
  16366. return c
  16367. }
  16368. // Header returns an http.Header that can be modified by the caller to
  16369. // add HTTP headers to the request.
  16370. func (c *UsersListCall) Header() http.Header {
  16371. if c.header_ == nil {
  16372. c.header_ = make(http.Header)
  16373. }
  16374. return c.header_
  16375. }
  16376. func (c *UsersListCall) doRequest(alt string) (*http.Response, error) {
  16377. reqHeaders := make(http.Header)
  16378. for k, v := range c.header_ {
  16379. reqHeaders[k] = v
  16380. }
  16381. reqHeaders.Set("User-Agent", c.s.userAgent())
  16382. if c.ifNoneMatch_ != "" {
  16383. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  16384. }
  16385. var body io.Reader = nil
  16386. c.urlParams_.Set("alt", alt)
  16387. urls := googleapi.ResolveRelative(c.s.BasePath, "users")
  16388. urls += "?" + c.urlParams_.Encode()
  16389. req, _ := http.NewRequest("GET", urls, body)
  16390. req.Header = reqHeaders
  16391. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16392. }
  16393. // Do executes the "directory.users.list" call.
  16394. // Exactly one of *Users or error will be non-nil. Any non-2xx status
  16395. // code is an error. Response headers are in either
  16396. // *Users.ServerResponse.Header or (if a response was returned at all)
  16397. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  16398. // check whether the returned error was because http.StatusNotModified
  16399. // was returned.
  16400. func (c *UsersListCall) Do(opts ...googleapi.CallOption) (*Users, error) {
  16401. gensupport.SetOptions(c.urlParams_, opts...)
  16402. res, err := c.doRequest("json")
  16403. if res != nil && res.StatusCode == http.StatusNotModified {
  16404. if res.Body != nil {
  16405. res.Body.Close()
  16406. }
  16407. return nil, &googleapi.Error{
  16408. Code: res.StatusCode,
  16409. Header: res.Header,
  16410. }
  16411. }
  16412. if err != nil {
  16413. return nil, err
  16414. }
  16415. defer googleapi.CloseBody(res)
  16416. if err := googleapi.CheckResponse(res); err != nil {
  16417. return nil, err
  16418. }
  16419. ret := &Users{
  16420. ServerResponse: googleapi.ServerResponse{
  16421. Header: res.Header,
  16422. HTTPStatusCode: res.StatusCode,
  16423. },
  16424. }
  16425. target := &ret
  16426. if err := gensupport.DecodeResponse(target, res); err != nil {
  16427. return nil, err
  16428. }
  16429. return ret, nil
  16430. // {
  16431. // "description": "Retrieve either deleted users or all users in a domain (paginated)",
  16432. // "httpMethod": "GET",
  16433. // "id": "directory.users.list",
  16434. // "parameters": {
  16435. // "customFieldMask": {
  16436. // "description": "Comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.",
  16437. // "location": "query",
  16438. // "type": "string"
  16439. // },
  16440. // "customer": {
  16441. // "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.",
  16442. // "location": "query",
  16443. // "type": "string"
  16444. // },
  16445. // "domain": {
  16446. // "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.",
  16447. // "location": "query",
  16448. // "type": "string"
  16449. // },
  16450. // "event": {
  16451. // "description": "Event on which subscription is intended (if subscribing)",
  16452. // "enum": [
  16453. // "add",
  16454. // "delete",
  16455. // "makeAdmin",
  16456. // "undelete",
  16457. // "update"
  16458. // ],
  16459. // "enumDescriptions": [
  16460. // "User Created Event",
  16461. // "User Deleted Event",
  16462. // "User Admin Status Change Event",
  16463. // "User Undeleted Event",
  16464. // "User Updated Event"
  16465. // ],
  16466. // "location": "query",
  16467. // "type": "string"
  16468. // },
  16469. // "maxResults": {
  16470. // "description": "Maximum number of results to return. Default is 100. Max allowed is 500",
  16471. // "format": "int32",
  16472. // "location": "query",
  16473. // "maximum": "500",
  16474. // "minimum": "1",
  16475. // "type": "integer"
  16476. // },
  16477. // "orderBy": {
  16478. // "description": "Column to use for sorting results",
  16479. // "enum": [
  16480. // "email",
  16481. // "familyName",
  16482. // "givenName"
  16483. // ],
  16484. // "enumDescriptions": [
  16485. // "Primary email of the user.",
  16486. // "User's family name.",
  16487. // "User's given name."
  16488. // ],
  16489. // "location": "query",
  16490. // "type": "string"
  16491. // },
  16492. // "pageToken": {
  16493. // "description": "Token to specify next page in the list",
  16494. // "location": "query",
  16495. // "type": "string"
  16496. // },
  16497. // "projection": {
  16498. // "default": "basic",
  16499. // "description": "What subset of fields to fetch for this user.",
  16500. // "enum": [
  16501. // "basic",
  16502. // "custom",
  16503. // "full"
  16504. // ],
  16505. // "enumDescriptions": [
  16506. // "Do not include any custom fields for the user.",
  16507. // "Include custom fields from schemas mentioned in customFieldMask.",
  16508. // "Include all fields associated with this user."
  16509. // ],
  16510. // "location": "query",
  16511. // "type": "string"
  16512. // },
  16513. // "query": {
  16514. // "description": "Query string search. Should be of the form \"\". Complete documentation is at https://developers.google.com/admin-sdk/directory/v1/guides/search-users",
  16515. // "location": "query",
  16516. // "type": "string"
  16517. // },
  16518. // "showDeleted": {
  16519. // "description": "If set to true retrieves the list of deleted users. Default is false",
  16520. // "location": "query",
  16521. // "type": "string"
  16522. // },
  16523. // "sortOrder": {
  16524. // "description": "Whether to return results in ascending or descending order.",
  16525. // "enum": [
  16526. // "ASCENDING",
  16527. // "DESCENDING"
  16528. // ],
  16529. // "enumDescriptions": [
  16530. // "Ascending order.",
  16531. // "Descending order."
  16532. // ],
  16533. // "location": "query",
  16534. // "type": "string"
  16535. // },
  16536. // "viewType": {
  16537. // "default": "admin_view",
  16538. // "description": "Whether to fetch the ADMIN_VIEW or DOMAIN_PUBLIC view of the user.",
  16539. // "enum": [
  16540. // "admin_view",
  16541. // "domain_public"
  16542. // ],
  16543. // "enumDescriptions": [
  16544. // "Fetches the ADMIN_VIEW of the user.",
  16545. // "Fetches the DOMAIN_PUBLIC view of the user."
  16546. // ],
  16547. // "location": "query",
  16548. // "type": "string"
  16549. // }
  16550. // },
  16551. // "path": "users",
  16552. // "response": {
  16553. // "$ref": "Users"
  16554. // },
  16555. // "scopes": [
  16556. // "https://www.googleapis.com/auth/admin.directory.user",
  16557. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  16558. // ],
  16559. // "supportsSubscription": true
  16560. // }
  16561. }
  16562. // Pages invokes f for each page of results.
  16563. // A non-nil error returned from f will halt the iteration.
  16564. // The provided context supersedes any context provided to the Context method.
  16565. func (c *UsersListCall) Pages(ctx context.Context, f func(*Users) error) error {
  16566. c.ctx_ = ctx
  16567. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  16568. for {
  16569. x, err := c.Do()
  16570. if err != nil {
  16571. return err
  16572. }
  16573. if err := f(x); err != nil {
  16574. return err
  16575. }
  16576. if x.NextPageToken == "" {
  16577. return nil
  16578. }
  16579. c.PageToken(x.NextPageToken)
  16580. }
  16581. }
  16582. // method id "directory.users.makeAdmin":
  16583. type UsersMakeAdminCall struct {
  16584. s *Service
  16585. userKey string
  16586. usermakeadmin *UserMakeAdmin
  16587. urlParams_ gensupport.URLParams
  16588. ctx_ context.Context
  16589. header_ http.Header
  16590. }
  16591. // MakeAdmin: change admin status of a user
  16592. func (r *UsersService) MakeAdmin(userKey string, usermakeadmin *UserMakeAdmin) *UsersMakeAdminCall {
  16593. c := &UsersMakeAdminCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16594. c.userKey = userKey
  16595. c.usermakeadmin = usermakeadmin
  16596. return c
  16597. }
  16598. // Fields allows partial responses to be retrieved. See
  16599. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16600. // for more information.
  16601. func (c *UsersMakeAdminCall) Fields(s ...googleapi.Field) *UsersMakeAdminCall {
  16602. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16603. return c
  16604. }
  16605. // Context sets the context to be used in this call's Do method. Any
  16606. // pending HTTP request will be aborted if the provided context is
  16607. // canceled.
  16608. func (c *UsersMakeAdminCall) Context(ctx context.Context) *UsersMakeAdminCall {
  16609. c.ctx_ = ctx
  16610. return c
  16611. }
  16612. // Header returns an http.Header that can be modified by the caller to
  16613. // add HTTP headers to the request.
  16614. func (c *UsersMakeAdminCall) Header() http.Header {
  16615. if c.header_ == nil {
  16616. c.header_ = make(http.Header)
  16617. }
  16618. return c.header_
  16619. }
  16620. func (c *UsersMakeAdminCall) doRequest(alt string) (*http.Response, error) {
  16621. reqHeaders := make(http.Header)
  16622. for k, v := range c.header_ {
  16623. reqHeaders[k] = v
  16624. }
  16625. reqHeaders.Set("User-Agent", c.s.userAgent())
  16626. var body io.Reader = nil
  16627. body, err := googleapi.WithoutDataWrapper.JSONReader(c.usermakeadmin)
  16628. if err != nil {
  16629. return nil, err
  16630. }
  16631. reqHeaders.Set("Content-Type", "application/json")
  16632. c.urlParams_.Set("alt", alt)
  16633. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/makeAdmin")
  16634. urls += "?" + c.urlParams_.Encode()
  16635. req, _ := http.NewRequest("POST", urls, body)
  16636. req.Header = reqHeaders
  16637. googleapi.Expand(req.URL, map[string]string{
  16638. "userKey": c.userKey,
  16639. })
  16640. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16641. }
  16642. // Do executes the "directory.users.makeAdmin" call.
  16643. func (c *UsersMakeAdminCall) Do(opts ...googleapi.CallOption) error {
  16644. gensupport.SetOptions(c.urlParams_, opts...)
  16645. res, err := c.doRequest("json")
  16646. if err != nil {
  16647. return err
  16648. }
  16649. defer googleapi.CloseBody(res)
  16650. if err := googleapi.CheckResponse(res); err != nil {
  16651. return err
  16652. }
  16653. return nil
  16654. // {
  16655. // "description": "change admin status of a user",
  16656. // "httpMethod": "POST",
  16657. // "id": "directory.users.makeAdmin",
  16658. // "parameterOrder": [
  16659. // "userKey"
  16660. // ],
  16661. // "parameters": {
  16662. // "userKey": {
  16663. // "description": "Email or immutable ID of the user as admin",
  16664. // "location": "path",
  16665. // "required": true,
  16666. // "type": "string"
  16667. // }
  16668. // },
  16669. // "path": "users/{userKey}/makeAdmin",
  16670. // "request": {
  16671. // "$ref": "UserMakeAdmin"
  16672. // },
  16673. // "scopes": [
  16674. // "https://www.googleapis.com/auth/admin.directory.user"
  16675. // ]
  16676. // }
  16677. }
  16678. // method id "directory.users.patch":
  16679. type UsersPatchCall struct {
  16680. s *Service
  16681. userKey string
  16682. user *User
  16683. urlParams_ gensupport.URLParams
  16684. ctx_ context.Context
  16685. header_ http.Header
  16686. }
  16687. // Patch: update user. This method supports patch semantics.
  16688. func (r *UsersService) Patch(userKey string, user *User) *UsersPatchCall {
  16689. c := &UsersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16690. c.userKey = userKey
  16691. c.user = user
  16692. return c
  16693. }
  16694. // Fields allows partial responses to be retrieved. See
  16695. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16696. // for more information.
  16697. func (c *UsersPatchCall) Fields(s ...googleapi.Field) *UsersPatchCall {
  16698. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16699. return c
  16700. }
  16701. // Context sets the context to be used in this call's Do method. Any
  16702. // pending HTTP request will be aborted if the provided context is
  16703. // canceled.
  16704. func (c *UsersPatchCall) Context(ctx context.Context) *UsersPatchCall {
  16705. c.ctx_ = ctx
  16706. return c
  16707. }
  16708. // Header returns an http.Header that can be modified by the caller to
  16709. // add HTTP headers to the request.
  16710. func (c *UsersPatchCall) Header() http.Header {
  16711. if c.header_ == nil {
  16712. c.header_ = make(http.Header)
  16713. }
  16714. return c.header_
  16715. }
  16716. func (c *UsersPatchCall) doRequest(alt string) (*http.Response, error) {
  16717. reqHeaders := make(http.Header)
  16718. for k, v := range c.header_ {
  16719. reqHeaders[k] = v
  16720. }
  16721. reqHeaders.Set("User-Agent", c.s.userAgent())
  16722. var body io.Reader = nil
  16723. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  16724. if err != nil {
  16725. return nil, err
  16726. }
  16727. reqHeaders.Set("Content-Type", "application/json")
  16728. c.urlParams_.Set("alt", alt)
  16729. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  16730. urls += "?" + c.urlParams_.Encode()
  16731. req, _ := http.NewRequest("PATCH", urls, body)
  16732. req.Header = reqHeaders
  16733. googleapi.Expand(req.URL, map[string]string{
  16734. "userKey": c.userKey,
  16735. })
  16736. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16737. }
  16738. // Do executes the "directory.users.patch" call.
  16739. // Exactly one of *User or error will be non-nil. Any non-2xx status
  16740. // code is an error. Response headers are in either
  16741. // *User.ServerResponse.Header or (if a response was returned at all) in
  16742. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  16743. // whether the returned error was because http.StatusNotModified was
  16744. // returned.
  16745. func (c *UsersPatchCall) Do(opts ...googleapi.CallOption) (*User, error) {
  16746. gensupport.SetOptions(c.urlParams_, opts...)
  16747. res, err := c.doRequest("json")
  16748. if res != nil && res.StatusCode == http.StatusNotModified {
  16749. if res.Body != nil {
  16750. res.Body.Close()
  16751. }
  16752. return nil, &googleapi.Error{
  16753. Code: res.StatusCode,
  16754. Header: res.Header,
  16755. }
  16756. }
  16757. if err != nil {
  16758. return nil, err
  16759. }
  16760. defer googleapi.CloseBody(res)
  16761. if err := googleapi.CheckResponse(res); err != nil {
  16762. return nil, err
  16763. }
  16764. ret := &User{
  16765. ServerResponse: googleapi.ServerResponse{
  16766. Header: res.Header,
  16767. HTTPStatusCode: res.StatusCode,
  16768. },
  16769. }
  16770. target := &ret
  16771. if err := gensupport.DecodeResponse(target, res); err != nil {
  16772. return nil, err
  16773. }
  16774. return ret, nil
  16775. // {
  16776. // "description": "update user. This method supports patch semantics.",
  16777. // "httpMethod": "PATCH",
  16778. // "id": "directory.users.patch",
  16779. // "parameterOrder": [
  16780. // "userKey"
  16781. // ],
  16782. // "parameters": {
  16783. // "userKey": {
  16784. // "description": "Email or immutable ID of the user. If ID, it should match with id of user object",
  16785. // "location": "path",
  16786. // "required": true,
  16787. // "type": "string"
  16788. // }
  16789. // },
  16790. // "path": "users/{userKey}",
  16791. // "request": {
  16792. // "$ref": "User"
  16793. // },
  16794. // "response": {
  16795. // "$ref": "User"
  16796. // },
  16797. // "scopes": [
  16798. // "https://www.googleapis.com/auth/admin.directory.user"
  16799. // ]
  16800. // }
  16801. }
  16802. // method id "directory.users.undelete":
  16803. type UsersUndeleteCall struct {
  16804. s *Service
  16805. userKey string
  16806. userundelete *UserUndelete
  16807. urlParams_ gensupport.URLParams
  16808. ctx_ context.Context
  16809. header_ http.Header
  16810. }
  16811. // Undelete: Undelete a deleted user
  16812. func (r *UsersService) Undelete(userKey string, userundelete *UserUndelete) *UsersUndeleteCall {
  16813. c := &UsersUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16814. c.userKey = userKey
  16815. c.userundelete = userundelete
  16816. return c
  16817. }
  16818. // Fields allows partial responses to be retrieved. See
  16819. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16820. // for more information.
  16821. func (c *UsersUndeleteCall) Fields(s ...googleapi.Field) *UsersUndeleteCall {
  16822. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16823. return c
  16824. }
  16825. // Context sets the context to be used in this call's Do method. Any
  16826. // pending HTTP request will be aborted if the provided context is
  16827. // canceled.
  16828. func (c *UsersUndeleteCall) Context(ctx context.Context) *UsersUndeleteCall {
  16829. c.ctx_ = ctx
  16830. return c
  16831. }
  16832. // Header returns an http.Header that can be modified by the caller to
  16833. // add HTTP headers to the request.
  16834. func (c *UsersUndeleteCall) Header() http.Header {
  16835. if c.header_ == nil {
  16836. c.header_ = make(http.Header)
  16837. }
  16838. return c.header_
  16839. }
  16840. func (c *UsersUndeleteCall) doRequest(alt string) (*http.Response, error) {
  16841. reqHeaders := make(http.Header)
  16842. for k, v := range c.header_ {
  16843. reqHeaders[k] = v
  16844. }
  16845. reqHeaders.Set("User-Agent", c.s.userAgent())
  16846. var body io.Reader = nil
  16847. body, err := googleapi.WithoutDataWrapper.JSONReader(c.userundelete)
  16848. if err != nil {
  16849. return nil, err
  16850. }
  16851. reqHeaders.Set("Content-Type", "application/json")
  16852. c.urlParams_.Set("alt", alt)
  16853. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/undelete")
  16854. urls += "?" + c.urlParams_.Encode()
  16855. req, _ := http.NewRequest("POST", urls, body)
  16856. req.Header = reqHeaders
  16857. googleapi.Expand(req.URL, map[string]string{
  16858. "userKey": c.userKey,
  16859. })
  16860. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16861. }
  16862. // Do executes the "directory.users.undelete" call.
  16863. func (c *UsersUndeleteCall) Do(opts ...googleapi.CallOption) error {
  16864. gensupport.SetOptions(c.urlParams_, opts...)
  16865. res, err := c.doRequest("json")
  16866. if err != nil {
  16867. return err
  16868. }
  16869. defer googleapi.CloseBody(res)
  16870. if err := googleapi.CheckResponse(res); err != nil {
  16871. return err
  16872. }
  16873. return nil
  16874. // {
  16875. // "description": "Undelete a deleted user",
  16876. // "httpMethod": "POST",
  16877. // "id": "directory.users.undelete",
  16878. // "parameterOrder": [
  16879. // "userKey"
  16880. // ],
  16881. // "parameters": {
  16882. // "userKey": {
  16883. // "description": "The immutable id of the user",
  16884. // "location": "path",
  16885. // "required": true,
  16886. // "type": "string"
  16887. // }
  16888. // },
  16889. // "path": "users/{userKey}/undelete",
  16890. // "request": {
  16891. // "$ref": "UserUndelete"
  16892. // },
  16893. // "scopes": [
  16894. // "https://www.googleapis.com/auth/admin.directory.user"
  16895. // ]
  16896. // }
  16897. }
  16898. // method id "directory.users.update":
  16899. type UsersUpdateCall struct {
  16900. s *Service
  16901. userKey string
  16902. user *User
  16903. urlParams_ gensupport.URLParams
  16904. ctx_ context.Context
  16905. header_ http.Header
  16906. }
  16907. // Update: update user
  16908. func (r *UsersService) Update(userKey string, user *User) *UsersUpdateCall {
  16909. c := &UsersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  16910. c.userKey = userKey
  16911. c.user = user
  16912. return c
  16913. }
  16914. // Fields allows partial responses to be retrieved. See
  16915. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  16916. // for more information.
  16917. func (c *UsersUpdateCall) Fields(s ...googleapi.Field) *UsersUpdateCall {
  16918. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  16919. return c
  16920. }
  16921. // Context sets the context to be used in this call's Do method. Any
  16922. // pending HTTP request will be aborted if the provided context is
  16923. // canceled.
  16924. func (c *UsersUpdateCall) Context(ctx context.Context) *UsersUpdateCall {
  16925. c.ctx_ = ctx
  16926. return c
  16927. }
  16928. // Header returns an http.Header that can be modified by the caller to
  16929. // add HTTP headers to the request.
  16930. func (c *UsersUpdateCall) Header() http.Header {
  16931. if c.header_ == nil {
  16932. c.header_ = make(http.Header)
  16933. }
  16934. return c.header_
  16935. }
  16936. func (c *UsersUpdateCall) doRequest(alt string) (*http.Response, error) {
  16937. reqHeaders := make(http.Header)
  16938. for k, v := range c.header_ {
  16939. reqHeaders[k] = v
  16940. }
  16941. reqHeaders.Set("User-Agent", c.s.userAgent())
  16942. var body io.Reader = nil
  16943. body, err := googleapi.WithoutDataWrapper.JSONReader(c.user)
  16944. if err != nil {
  16945. return nil, err
  16946. }
  16947. reqHeaders.Set("Content-Type", "application/json")
  16948. c.urlParams_.Set("alt", alt)
  16949. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}")
  16950. urls += "?" + c.urlParams_.Encode()
  16951. req, _ := http.NewRequest("PUT", urls, body)
  16952. req.Header = reqHeaders
  16953. googleapi.Expand(req.URL, map[string]string{
  16954. "userKey": c.userKey,
  16955. })
  16956. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  16957. }
  16958. // Do executes the "directory.users.update" call.
  16959. // Exactly one of *User or error will be non-nil. Any non-2xx status
  16960. // code is an error. Response headers are in either
  16961. // *User.ServerResponse.Header or (if a response was returned at all) in
  16962. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  16963. // whether the returned error was because http.StatusNotModified was
  16964. // returned.
  16965. func (c *UsersUpdateCall) Do(opts ...googleapi.CallOption) (*User, error) {
  16966. gensupport.SetOptions(c.urlParams_, opts...)
  16967. res, err := c.doRequest("json")
  16968. if res != nil && res.StatusCode == http.StatusNotModified {
  16969. if res.Body != nil {
  16970. res.Body.Close()
  16971. }
  16972. return nil, &googleapi.Error{
  16973. Code: res.StatusCode,
  16974. Header: res.Header,
  16975. }
  16976. }
  16977. if err != nil {
  16978. return nil, err
  16979. }
  16980. defer googleapi.CloseBody(res)
  16981. if err := googleapi.CheckResponse(res); err != nil {
  16982. return nil, err
  16983. }
  16984. ret := &User{
  16985. ServerResponse: googleapi.ServerResponse{
  16986. Header: res.Header,
  16987. HTTPStatusCode: res.StatusCode,
  16988. },
  16989. }
  16990. target := &ret
  16991. if err := gensupport.DecodeResponse(target, res); err != nil {
  16992. return nil, err
  16993. }
  16994. return ret, nil
  16995. // {
  16996. // "description": "update user",
  16997. // "httpMethod": "PUT",
  16998. // "id": "directory.users.update",
  16999. // "parameterOrder": [
  17000. // "userKey"
  17001. // ],
  17002. // "parameters": {
  17003. // "userKey": {
  17004. // "description": "Email or immutable ID of the user. If ID, it should match with id of user object",
  17005. // "location": "path",
  17006. // "required": true,
  17007. // "type": "string"
  17008. // }
  17009. // },
  17010. // "path": "users/{userKey}",
  17011. // "request": {
  17012. // "$ref": "User"
  17013. // },
  17014. // "response": {
  17015. // "$ref": "User"
  17016. // },
  17017. // "scopes": [
  17018. // "https://www.googleapis.com/auth/admin.directory.user"
  17019. // ]
  17020. // }
  17021. }
  17022. // method id "directory.users.watch":
  17023. type UsersWatchCall struct {
  17024. s *Service
  17025. channel *Channel
  17026. urlParams_ gensupport.URLParams
  17027. ctx_ context.Context
  17028. header_ http.Header
  17029. }
  17030. // Watch: Watch for changes in users list
  17031. func (r *UsersService) Watch(channel *Channel) *UsersWatchCall {
  17032. c := &UsersWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17033. c.channel = channel
  17034. return c
  17035. }
  17036. // CustomFieldMask sets the optional parameter "customFieldMask":
  17037. // Comma-separated list of schema names. All fields from these schemas
  17038. // are fetched. This should only be set when projection=custom.
  17039. func (c *UsersWatchCall) CustomFieldMask(customFieldMask string) *UsersWatchCall {
  17040. c.urlParams_.Set("customFieldMask", customFieldMask)
  17041. return c
  17042. }
  17043. // Customer sets the optional parameter "customer": Immutable ID of the
  17044. // G Suite account. In case of multi-domain, to fetch all users for a
  17045. // customer, fill this field instead of domain.
  17046. func (c *UsersWatchCall) Customer(customer string) *UsersWatchCall {
  17047. c.urlParams_.Set("customer", customer)
  17048. return c
  17049. }
  17050. // Domain sets the optional parameter "domain": Name of the domain. Fill
  17051. // this field to get users from only this domain. To return all users in
  17052. // a multi-domain fill customer field instead.
  17053. func (c *UsersWatchCall) Domain(domain string) *UsersWatchCall {
  17054. c.urlParams_.Set("domain", domain)
  17055. return c
  17056. }
  17057. // Event sets the optional parameter "event": Event on which
  17058. // subscription is intended (if subscribing)
  17059. //
  17060. // Possible values:
  17061. // "add" - User Created Event
  17062. // "delete" - User Deleted Event
  17063. // "makeAdmin" - User Admin Status Change Event
  17064. // "undelete" - User Undeleted Event
  17065. // "update" - User Updated Event
  17066. func (c *UsersWatchCall) Event(event string) *UsersWatchCall {
  17067. c.urlParams_.Set("event", event)
  17068. return c
  17069. }
  17070. // MaxResults sets the optional parameter "maxResults": Maximum number
  17071. // of results to return. Default is 100. Max allowed is 500
  17072. func (c *UsersWatchCall) MaxResults(maxResults int64) *UsersWatchCall {
  17073. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  17074. return c
  17075. }
  17076. // OrderBy sets the optional parameter "orderBy": Column to use for
  17077. // sorting results
  17078. //
  17079. // Possible values:
  17080. // "email" - Primary email of the user.
  17081. // "familyName" - User's family name.
  17082. // "givenName" - User's given name.
  17083. func (c *UsersWatchCall) OrderBy(orderBy string) *UsersWatchCall {
  17084. c.urlParams_.Set("orderBy", orderBy)
  17085. return c
  17086. }
  17087. // PageToken sets the optional parameter "pageToken": Token to specify
  17088. // next page in the list
  17089. func (c *UsersWatchCall) PageToken(pageToken string) *UsersWatchCall {
  17090. c.urlParams_.Set("pageToken", pageToken)
  17091. return c
  17092. }
  17093. // Projection sets the optional parameter "projection": What subset of
  17094. // fields to fetch for this user.
  17095. //
  17096. // Possible values:
  17097. // "basic" (default) - Do not include any custom fields for the user.
  17098. // "custom" - Include custom fields from schemas mentioned in
  17099. // customFieldMask.
  17100. // "full" - Include all fields associated with this user.
  17101. func (c *UsersWatchCall) Projection(projection string) *UsersWatchCall {
  17102. c.urlParams_.Set("projection", projection)
  17103. return c
  17104. }
  17105. // Query sets the optional parameter "query": Query string search.
  17106. // Should be of the form "". Complete documentation is at
  17107. // https://developers.google.com/admin-sdk/directory/v1/guides/search-users
  17108. func (c *UsersWatchCall) Query(query string) *UsersWatchCall {
  17109. c.urlParams_.Set("query", query)
  17110. return c
  17111. }
  17112. // ShowDeleted sets the optional parameter "showDeleted": If set to true
  17113. // retrieves the list of deleted users. Default is false
  17114. func (c *UsersWatchCall) ShowDeleted(showDeleted string) *UsersWatchCall {
  17115. c.urlParams_.Set("showDeleted", showDeleted)
  17116. return c
  17117. }
  17118. // SortOrder sets the optional parameter "sortOrder": Whether to return
  17119. // results in ascending or descending order.
  17120. //
  17121. // Possible values:
  17122. // "ASCENDING" - Ascending order.
  17123. // "DESCENDING" - Descending order.
  17124. func (c *UsersWatchCall) SortOrder(sortOrder string) *UsersWatchCall {
  17125. c.urlParams_.Set("sortOrder", sortOrder)
  17126. return c
  17127. }
  17128. // ViewType sets the optional parameter "viewType": Whether to fetch the
  17129. // ADMIN_VIEW or DOMAIN_PUBLIC view of the user.
  17130. //
  17131. // Possible values:
  17132. // "admin_view" (default) - Fetches the ADMIN_VIEW of the user.
  17133. // "domain_public" - Fetches the DOMAIN_PUBLIC view of the user.
  17134. func (c *UsersWatchCall) ViewType(viewType string) *UsersWatchCall {
  17135. c.urlParams_.Set("viewType", viewType)
  17136. return c
  17137. }
  17138. // Fields allows partial responses to be retrieved. See
  17139. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17140. // for more information.
  17141. func (c *UsersWatchCall) Fields(s ...googleapi.Field) *UsersWatchCall {
  17142. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17143. return c
  17144. }
  17145. // Context sets the context to be used in this call's Do method. Any
  17146. // pending HTTP request will be aborted if the provided context is
  17147. // canceled.
  17148. func (c *UsersWatchCall) Context(ctx context.Context) *UsersWatchCall {
  17149. c.ctx_ = ctx
  17150. return c
  17151. }
  17152. // Header returns an http.Header that can be modified by the caller to
  17153. // add HTTP headers to the request.
  17154. func (c *UsersWatchCall) Header() http.Header {
  17155. if c.header_ == nil {
  17156. c.header_ = make(http.Header)
  17157. }
  17158. return c.header_
  17159. }
  17160. func (c *UsersWatchCall) doRequest(alt string) (*http.Response, error) {
  17161. reqHeaders := make(http.Header)
  17162. for k, v := range c.header_ {
  17163. reqHeaders[k] = v
  17164. }
  17165. reqHeaders.Set("User-Agent", c.s.userAgent())
  17166. var body io.Reader = nil
  17167. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  17168. if err != nil {
  17169. return nil, err
  17170. }
  17171. reqHeaders.Set("Content-Type", "application/json")
  17172. c.urlParams_.Set("alt", alt)
  17173. urls := googleapi.ResolveRelative(c.s.BasePath, "users/watch")
  17174. urls += "?" + c.urlParams_.Encode()
  17175. req, _ := http.NewRequest("POST", urls, body)
  17176. req.Header = reqHeaders
  17177. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17178. }
  17179. // Do executes the "directory.users.watch" call.
  17180. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  17181. // code is an error. Response headers are in either
  17182. // *Channel.ServerResponse.Header or (if a response was returned at all)
  17183. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  17184. // check whether the returned error was because http.StatusNotModified
  17185. // was returned.
  17186. func (c *UsersWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  17187. gensupport.SetOptions(c.urlParams_, opts...)
  17188. res, err := c.doRequest("json")
  17189. if res != nil && res.StatusCode == http.StatusNotModified {
  17190. if res.Body != nil {
  17191. res.Body.Close()
  17192. }
  17193. return nil, &googleapi.Error{
  17194. Code: res.StatusCode,
  17195. Header: res.Header,
  17196. }
  17197. }
  17198. if err != nil {
  17199. return nil, err
  17200. }
  17201. defer googleapi.CloseBody(res)
  17202. if err := googleapi.CheckResponse(res); err != nil {
  17203. return nil, err
  17204. }
  17205. ret := &Channel{
  17206. ServerResponse: googleapi.ServerResponse{
  17207. Header: res.Header,
  17208. HTTPStatusCode: res.StatusCode,
  17209. },
  17210. }
  17211. target := &ret
  17212. if err := gensupport.DecodeResponse(target, res); err != nil {
  17213. return nil, err
  17214. }
  17215. return ret, nil
  17216. // {
  17217. // "description": "Watch for changes in users list",
  17218. // "httpMethod": "POST",
  17219. // "id": "directory.users.watch",
  17220. // "parameters": {
  17221. // "customFieldMask": {
  17222. // "description": "Comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.",
  17223. // "location": "query",
  17224. // "type": "string"
  17225. // },
  17226. // "customer": {
  17227. // "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.",
  17228. // "location": "query",
  17229. // "type": "string"
  17230. // },
  17231. // "domain": {
  17232. // "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.",
  17233. // "location": "query",
  17234. // "type": "string"
  17235. // },
  17236. // "event": {
  17237. // "description": "Event on which subscription is intended (if subscribing)",
  17238. // "enum": [
  17239. // "add",
  17240. // "delete",
  17241. // "makeAdmin",
  17242. // "undelete",
  17243. // "update"
  17244. // ],
  17245. // "enumDescriptions": [
  17246. // "User Created Event",
  17247. // "User Deleted Event",
  17248. // "User Admin Status Change Event",
  17249. // "User Undeleted Event",
  17250. // "User Updated Event"
  17251. // ],
  17252. // "location": "query",
  17253. // "type": "string"
  17254. // },
  17255. // "maxResults": {
  17256. // "description": "Maximum number of results to return. Default is 100. Max allowed is 500",
  17257. // "format": "int32",
  17258. // "location": "query",
  17259. // "maximum": "500",
  17260. // "minimum": "1",
  17261. // "type": "integer"
  17262. // },
  17263. // "orderBy": {
  17264. // "description": "Column to use for sorting results",
  17265. // "enum": [
  17266. // "email",
  17267. // "familyName",
  17268. // "givenName"
  17269. // ],
  17270. // "enumDescriptions": [
  17271. // "Primary email of the user.",
  17272. // "User's family name.",
  17273. // "User's given name."
  17274. // ],
  17275. // "location": "query",
  17276. // "type": "string"
  17277. // },
  17278. // "pageToken": {
  17279. // "description": "Token to specify next page in the list",
  17280. // "location": "query",
  17281. // "type": "string"
  17282. // },
  17283. // "projection": {
  17284. // "default": "basic",
  17285. // "description": "What subset of fields to fetch for this user.",
  17286. // "enum": [
  17287. // "basic",
  17288. // "custom",
  17289. // "full"
  17290. // ],
  17291. // "enumDescriptions": [
  17292. // "Do not include any custom fields for the user.",
  17293. // "Include custom fields from schemas mentioned in customFieldMask.",
  17294. // "Include all fields associated with this user."
  17295. // ],
  17296. // "location": "query",
  17297. // "type": "string"
  17298. // },
  17299. // "query": {
  17300. // "description": "Query string search. Should be of the form \"\". Complete documentation is at https://developers.google.com/admin-sdk/directory/v1/guides/search-users",
  17301. // "location": "query",
  17302. // "type": "string"
  17303. // },
  17304. // "showDeleted": {
  17305. // "description": "If set to true retrieves the list of deleted users. Default is false",
  17306. // "location": "query",
  17307. // "type": "string"
  17308. // },
  17309. // "sortOrder": {
  17310. // "description": "Whether to return results in ascending or descending order.",
  17311. // "enum": [
  17312. // "ASCENDING",
  17313. // "DESCENDING"
  17314. // ],
  17315. // "enumDescriptions": [
  17316. // "Ascending order.",
  17317. // "Descending order."
  17318. // ],
  17319. // "location": "query",
  17320. // "type": "string"
  17321. // },
  17322. // "viewType": {
  17323. // "default": "admin_view",
  17324. // "description": "Whether to fetch the ADMIN_VIEW or DOMAIN_PUBLIC view of the user.",
  17325. // "enum": [
  17326. // "admin_view",
  17327. // "domain_public"
  17328. // ],
  17329. // "enumDescriptions": [
  17330. // "Fetches the ADMIN_VIEW of the user.",
  17331. // "Fetches the DOMAIN_PUBLIC view of the user."
  17332. // ],
  17333. // "location": "query",
  17334. // "type": "string"
  17335. // }
  17336. // },
  17337. // "path": "users/watch",
  17338. // "request": {
  17339. // "$ref": "Channel",
  17340. // "parameterName": "resource"
  17341. // },
  17342. // "response": {
  17343. // "$ref": "Channel"
  17344. // },
  17345. // "scopes": [
  17346. // "https://www.googleapis.com/auth/admin.directory.user",
  17347. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  17348. // ],
  17349. // "supportsSubscription": true
  17350. // }
  17351. }
  17352. // method id "directory.users.aliases.delete":
  17353. type UsersAliasesDeleteCall struct {
  17354. s *Service
  17355. userKey string
  17356. alias string
  17357. urlParams_ gensupport.URLParams
  17358. ctx_ context.Context
  17359. header_ http.Header
  17360. }
  17361. // Delete: Remove a alias for the user
  17362. func (r *UsersAliasesService) Delete(userKey string, alias string) *UsersAliasesDeleteCall {
  17363. c := &UsersAliasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17364. c.userKey = userKey
  17365. c.alias = alias
  17366. return c
  17367. }
  17368. // Fields allows partial responses to be retrieved. See
  17369. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17370. // for more information.
  17371. func (c *UsersAliasesDeleteCall) Fields(s ...googleapi.Field) *UsersAliasesDeleteCall {
  17372. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17373. return c
  17374. }
  17375. // Context sets the context to be used in this call's Do method. Any
  17376. // pending HTTP request will be aborted if the provided context is
  17377. // canceled.
  17378. func (c *UsersAliasesDeleteCall) Context(ctx context.Context) *UsersAliasesDeleteCall {
  17379. c.ctx_ = ctx
  17380. return c
  17381. }
  17382. // Header returns an http.Header that can be modified by the caller to
  17383. // add HTTP headers to the request.
  17384. func (c *UsersAliasesDeleteCall) Header() http.Header {
  17385. if c.header_ == nil {
  17386. c.header_ = make(http.Header)
  17387. }
  17388. return c.header_
  17389. }
  17390. func (c *UsersAliasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  17391. reqHeaders := make(http.Header)
  17392. for k, v := range c.header_ {
  17393. reqHeaders[k] = v
  17394. }
  17395. reqHeaders.Set("User-Agent", c.s.userAgent())
  17396. var body io.Reader = nil
  17397. c.urlParams_.Set("alt", alt)
  17398. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases/{alias}")
  17399. urls += "?" + c.urlParams_.Encode()
  17400. req, _ := http.NewRequest("DELETE", urls, body)
  17401. req.Header = reqHeaders
  17402. googleapi.Expand(req.URL, map[string]string{
  17403. "userKey": c.userKey,
  17404. "alias": c.alias,
  17405. })
  17406. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17407. }
  17408. // Do executes the "directory.users.aliases.delete" call.
  17409. func (c *UsersAliasesDeleteCall) Do(opts ...googleapi.CallOption) error {
  17410. gensupport.SetOptions(c.urlParams_, opts...)
  17411. res, err := c.doRequest("json")
  17412. if err != nil {
  17413. return err
  17414. }
  17415. defer googleapi.CloseBody(res)
  17416. if err := googleapi.CheckResponse(res); err != nil {
  17417. return err
  17418. }
  17419. return nil
  17420. // {
  17421. // "description": "Remove a alias for the user",
  17422. // "httpMethod": "DELETE",
  17423. // "id": "directory.users.aliases.delete",
  17424. // "parameterOrder": [
  17425. // "userKey",
  17426. // "alias"
  17427. // ],
  17428. // "parameters": {
  17429. // "alias": {
  17430. // "description": "The alias to be removed",
  17431. // "location": "path",
  17432. // "required": true,
  17433. // "type": "string"
  17434. // },
  17435. // "userKey": {
  17436. // "description": "Email or immutable ID of the user",
  17437. // "location": "path",
  17438. // "required": true,
  17439. // "type": "string"
  17440. // }
  17441. // },
  17442. // "path": "users/{userKey}/aliases/{alias}",
  17443. // "scopes": [
  17444. // "https://www.googleapis.com/auth/admin.directory.user",
  17445. // "https://www.googleapis.com/auth/admin.directory.user.alias"
  17446. // ]
  17447. // }
  17448. }
  17449. // method id "directory.users.aliases.insert":
  17450. type UsersAliasesInsertCall struct {
  17451. s *Service
  17452. userKey string
  17453. alias *Alias
  17454. urlParams_ gensupport.URLParams
  17455. ctx_ context.Context
  17456. header_ http.Header
  17457. }
  17458. // Insert: Add a alias for the user
  17459. func (r *UsersAliasesService) Insert(userKey string, alias *Alias) *UsersAliasesInsertCall {
  17460. c := &UsersAliasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17461. c.userKey = userKey
  17462. c.alias = alias
  17463. return c
  17464. }
  17465. // Fields allows partial responses to be retrieved. See
  17466. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17467. // for more information.
  17468. func (c *UsersAliasesInsertCall) Fields(s ...googleapi.Field) *UsersAliasesInsertCall {
  17469. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17470. return c
  17471. }
  17472. // Context sets the context to be used in this call's Do method. Any
  17473. // pending HTTP request will be aborted if the provided context is
  17474. // canceled.
  17475. func (c *UsersAliasesInsertCall) Context(ctx context.Context) *UsersAliasesInsertCall {
  17476. c.ctx_ = ctx
  17477. return c
  17478. }
  17479. // Header returns an http.Header that can be modified by the caller to
  17480. // add HTTP headers to the request.
  17481. func (c *UsersAliasesInsertCall) Header() http.Header {
  17482. if c.header_ == nil {
  17483. c.header_ = make(http.Header)
  17484. }
  17485. return c.header_
  17486. }
  17487. func (c *UsersAliasesInsertCall) doRequest(alt string) (*http.Response, error) {
  17488. reqHeaders := make(http.Header)
  17489. for k, v := range c.header_ {
  17490. reqHeaders[k] = v
  17491. }
  17492. reqHeaders.Set("User-Agent", c.s.userAgent())
  17493. var body io.Reader = nil
  17494. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alias)
  17495. if err != nil {
  17496. return nil, err
  17497. }
  17498. reqHeaders.Set("Content-Type", "application/json")
  17499. c.urlParams_.Set("alt", alt)
  17500. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases")
  17501. urls += "?" + c.urlParams_.Encode()
  17502. req, _ := http.NewRequest("POST", urls, body)
  17503. req.Header = reqHeaders
  17504. googleapi.Expand(req.URL, map[string]string{
  17505. "userKey": c.userKey,
  17506. })
  17507. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17508. }
  17509. // Do executes the "directory.users.aliases.insert" call.
  17510. // Exactly one of *Alias or error will be non-nil. Any non-2xx status
  17511. // code is an error. Response headers are in either
  17512. // *Alias.ServerResponse.Header or (if a response was returned at all)
  17513. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  17514. // check whether the returned error was because http.StatusNotModified
  17515. // was returned.
  17516. func (c *UsersAliasesInsertCall) Do(opts ...googleapi.CallOption) (*Alias, error) {
  17517. gensupport.SetOptions(c.urlParams_, opts...)
  17518. res, err := c.doRequest("json")
  17519. if res != nil && res.StatusCode == http.StatusNotModified {
  17520. if res.Body != nil {
  17521. res.Body.Close()
  17522. }
  17523. return nil, &googleapi.Error{
  17524. Code: res.StatusCode,
  17525. Header: res.Header,
  17526. }
  17527. }
  17528. if err != nil {
  17529. return nil, err
  17530. }
  17531. defer googleapi.CloseBody(res)
  17532. if err := googleapi.CheckResponse(res); err != nil {
  17533. return nil, err
  17534. }
  17535. ret := &Alias{
  17536. ServerResponse: googleapi.ServerResponse{
  17537. Header: res.Header,
  17538. HTTPStatusCode: res.StatusCode,
  17539. },
  17540. }
  17541. target := &ret
  17542. if err := gensupport.DecodeResponse(target, res); err != nil {
  17543. return nil, err
  17544. }
  17545. return ret, nil
  17546. // {
  17547. // "description": "Add a alias for the user",
  17548. // "httpMethod": "POST",
  17549. // "id": "directory.users.aliases.insert",
  17550. // "parameterOrder": [
  17551. // "userKey"
  17552. // ],
  17553. // "parameters": {
  17554. // "userKey": {
  17555. // "description": "Email or immutable ID of the user",
  17556. // "location": "path",
  17557. // "required": true,
  17558. // "type": "string"
  17559. // }
  17560. // },
  17561. // "path": "users/{userKey}/aliases",
  17562. // "request": {
  17563. // "$ref": "Alias"
  17564. // },
  17565. // "response": {
  17566. // "$ref": "Alias"
  17567. // },
  17568. // "scopes": [
  17569. // "https://www.googleapis.com/auth/admin.directory.user",
  17570. // "https://www.googleapis.com/auth/admin.directory.user.alias"
  17571. // ]
  17572. // }
  17573. }
  17574. // method id "directory.users.aliases.list":
  17575. type UsersAliasesListCall struct {
  17576. s *Service
  17577. userKey string
  17578. urlParams_ gensupport.URLParams
  17579. ifNoneMatch_ string
  17580. ctx_ context.Context
  17581. header_ http.Header
  17582. }
  17583. // List: List all aliases for a user
  17584. func (r *UsersAliasesService) List(userKey string) *UsersAliasesListCall {
  17585. c := &UsersAliasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17586. c.userKey = userKey
  17587. return c
  17588. }
  17589. // Event sets the optional parameter "event": Event on which
  17590. // subscription is intended (if subscribing)
  17591. //
  17592. // Possible values:
  17593. // "add" - Alias Created Event
  17594. // "delete" - Alias Deleted Event
  17595. func (c *UsersAliasesListCall) Event(event string) *UsersAliasesListCall {
  17596. c.urlParams_.Set("event", event)
  17597. return c
  17598. }
  17599. // Fields allows partial responses to be retrieved. See
  17600. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17601. // for more information.
  17602. func (c *UsersAliasesListCall) Fields(s ...googleapi.Field) *UsersAliasesListCall {
  17603. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17604. return c
  17605. }
  17606. // IfNoneMatch sets the optional parameter which makes the operation
  17607. // fail if the object's ETag matches the given value. This is useful for
  17608. // getting updates only after the object has changed since the last
  17609. // request. Use googleapi.IsNotModified to check whether the response
  17610. // error from Do is the result of In-None-Match.
  17611. func (c *UsersAliasesListCall) IfNoneMatch(entityTag string) *UsersAliasesListCall {
  17612. c.ifNoneMatch_ = entityTag
  17613. return c
  17614. }
  17615. // Context sets the context to be used in this call's Do method. Any
  17616. // pending HTTP request will be aborted if the provided context is
  17617. // canceled.
  17618. func (c *UsersAliasesListCall) Context(ctx context.Context) *UsersAliasesListCall {
  17619. c.ctx_ = ctx
  17620. return c
  17621. }
  17622. // Header returns an http.Header that can be modified by the caller to
  17623. // add HTTP headers to the request.
  17624. func (c *UsersAliasesListCall) Header() http.Header {
  17625. if c.header_ == nil {
  17626. c.header_ = make(http.Header)
  17627. }
  17628. return c.header_
  17629. }
  17630. func (c *UsersAliasesListCall) doRequest(alt string) (*http.Response, error) {
  17631. reqHeaders := make(http.Header)
  17632. for k, v := range c.header_ {
  17633. reqHeaders[k] = v
  17634. }
  17635. reqHeaders.Set("User-Agent", c.s.userAgent())
  17636. if c.ifNoneMatch_ != "" {
  17637. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  17638. }
  17639. var body io.Reader = nil
  17640. c.urlParams_.Set("alt", alt)
  17641. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases")
  17642. urls += "?" + c.urlParams_.Encode()
  17643. req, _ := http.NewRequest("GET", urls, body)
  17644. req.Header = reqHeaders
  17645. googleapi.Expand(req.URL, map[string]string{
  17646. "userKey": c.userKey,
  17647. })
  17648. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17649. }
  17650. // Do executes the "directory.users.aliases.list" call.
  17651. // Exactly one of *Aliases or error will be non-nil. Any non-2xx status
  17652. // code is an error. Response headers are in either
  17653. // *Aliases.ServerResponse.Header or (if a response was returned at all)
  17654. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  17655. // check whether the returned error was because http.StatusNotModified
  17656. // was returned.
  17657. func (c *UsersAliasesListCall) Do(opts ...googleapi.CallOption) (*Aliases, error) {
  17658. gensupport.SetOptions(c.urlParams_, opts...)
  17659. res, err := c.doRequest("json")
  17660. if res != nil && res.StatusCode == http.StatusNotModified {
  17661. if res.Body != nil {
  17662. res.Body.Close()
  17663. }
  17664. return nil, &googleapi.Error{
  17665. Code: res.StatusCode,
  17666. Header: res.Header,
  17667. }
  17668. }
  17669. if err != nil {
  17670. return nil, err
  17671. }
  17672. defer googleapi.CloseBody(res)
  17673. if err := googleapi.CheckResponse(res); err != nil {
  17674. return nil, err
  17675. }
  17676. ret := &Aliases{
  17677. ServerResponse: googleapi.ServerResponse{
  17678. Header: res.Header,
  17679. HTTPStatusCode: res.StatusCode,
  17680. },
  17681. }
  17682. target := &ret
  17683. if err := gensupport.DecodeResponse(target, res); err != nil {
  17684. return nil, err
  17685. }
  17686. return ret, nil
  17687. // {
  17688. // "description": "List all aliases for a user",
  17689. // "httpMethod": "GET",
  17690. // "id": "directory.users.aliases.list",
  17691. // "parameterOrder": [
  17692. // "userKey"
  17693. // ],
  17694. // "parameters": {
  17695. // "event": {
  17696. // "description": "Event on which subscription is intended (if subscribing)",
  17697. // "enum": [
  17698. // "add",
  17699. // "delete"
  17700. // ],
  17701. // "enumDescriptions": [
  17702. // "Alias Created Event",
  17703. // "Alias Deleted Event"
  17704. // ],
  17705. // "location": "query",
  17706. // "type": "string"
  17707. // },
  17708. // "userKey": {
  17709. // "description": "Email or immutable ID of the user",
  17710. // "location": "path",
  17711. // "required": true,
  17712. // "type": "string"
  17713. // }
  17714. // },
  17715. // "path": "users/{userKey}/aliases",
  17716. // "response": {
  17717. // "$ref": "Aliases"
  17718. // },
  17719. // "scopes": [
  17720. // "https://www.googleapis.com/auth/admin.directory.user",
  17721. // "https://www.googleapis.com/auth/admin.directory.user.alias",
  17722. // "https://www.googleapis.com/auth/admin.directory.user.alias.readonly",
  17723. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  17724. // ],
  17725. // "supportsSubscription": true
  17726. // }
  17727. }
  17728. // method id "directory.users.aliases.watch":
  17729. type UsersAliasesWatchCall struct {
  17730. s *Service
  17731. userKey string
  17732. channel *Channel
  17733. urlParams_ gensupport.URLParams
  17734. ctx_ context.Context
  17735. header_ http.Header
  17736. }
  17737. // Watch: Watch for changes in user aliases list
  17738. func (r *UsersAliasesService) Watch(userKey string, channel *Channel) *UsersAliasesWatchCall {
  17739. c := &UsersAliasesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17740. c.userKey = userKey
  17741. c.channel = channel
  17742. return c
  17743. }
  17744. // Event sets the optional parameter "event": Event on which
  17745. // subscription is intended (if subscribing)
  17746. //
  17747. // Possible values:
  17748. // "add" - Alias Created Event
  17749. // "delete" - Alias Deleted Event
  17750. func (c *UsersAliasesWatchCall) Event(event string) *UsersAliasesWatchCall {
  17751. c.urlParams_.Set("event", event)
  17752. return c
  17753. }
  17754. // Fields allows partial responses to be retrieved. See
  17755. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17756. // for more information.
  17757. func (c *UsersAliasesWatchCall) Fields(s ...googleapi.Field) *UsersAliasesWatchCall {
  17758. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17759. return c
  17760. }
  17761. // Context sets the context to be used in this call's Do method. Any
  17762. // pending HTTP request will be aborted if the provided context is
  17763. // canceled.
  17764. func (c *UsersAliasesWatchCall) Context(ctx context.Context) *UsersAliasesWatchCall {
  17765. c.ctx_ = ctx
  17766. return c
  17767. }
  17768. // Header returns an http.Header that can be modified by the caller to
  17769. // add HTTP headers to the request.
  17770. func (c *UsersAliasesWatchCall) Header() http.Header {
  17771. if c.header_ == nil {
  17772. c.header_ = make(http.Header)
  17773. }
  17774. return c.header_
  17775. }
  17776. func (c *UsersAliasesWatchCall) doRequest(alt string) (*http.Response, error) {
  17777. reqHeaders := make(http.Header)
  17778. for k, v := range c.header_ {
  17779. reqHeaders[k] = v
  17780. }
  17781. reqHeaders.Set("User-Agent", c.s.userAgent())
  17782. var body io.Reader = nil
  17783. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  17784. if err != nil {
  17785. return nil, err
  17786. }
  17787. reqHeaders.Set("Content-Type", "application/json")
  17788. c.urlParams_.Set("alt", alt)
  17789. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/aliases/watch")
  17790. urls += "?" + c.urlParams_.Encode()
  17791. req, _ := http.NewRequest("POST", urls, body)
  17792. req.Header = reqHeaders
  17793. googleapi.Expand(req.URL, map[string]string{
  17794. "userKey": c.userKey,
  17795. })
  17796. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17797. }
  17798. // Do executes the "directory.users.aliases.watch" call.
  17799. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  17800. // code is an error. Response headers are in either
  17801. // *Channel.ServerResponse.Header or (if a response was returned at all)
  17802. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  17803. // check whether the returned error was because http.StatusNotModified
  17804. // was returned.
  17805. func (c *UsersAliasesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  17806. gensupport.SetOptions(c.urlParams_, opts...)
  17807. res, err := c.doRequest("json")
  17808. if res != nil && res.StatusCode == http.StatusNotModified {
  17809. if res.Body != nil {
  17810. res.Body.Close()
  17811. }
  17812. return nil, &googleapi.Error{
  17813. Code: res.StatusCode,
  17814. Header: res.Header,
  17815. }
  17816. }
  17817. if err != nil {
  17818. return nil, err
  17819. }
  17820. defer googleapi.CloseBody(res)
  17821. if err := googleapi.CheckResponse(res); err != nil {
  17822. return nil, err
  17823. }
  17824. ret := &Channel{
  17825. ServerResponse: googleapi.ServerResponse{
  17826. Header: res.Header,
  17827. HTTPStatusCode: res.StatusCode,
  17828. },
  17829. }
  17830. target := &ret
  17831. if err := gensupport.DecodeResponse(target, res); err != nil {
  17832. return nil, err
  17833. }
  17834. return ret, nil
  17835. // {
  17836. // "description": "Watch for changes in user aliases list",
  17837. // "httpMethod": "POST",
  17838. // "id": "directory.users.aliases.watch",
  17839. // "parameterOrder": [
  17840. // "userKey"
  17841. // ],
  17842. // "parameters": {
  17843. // "event": {
  17844. // "description": "Event on which subscription is intended (if subscribing)",
  17845. // "enum": [
  17846. // "add",
  17847. // "delete"
  17848. // ],
  17849. // "enumDescriptions": [
  17850. // "Alias Created Event",
  17851. // "Alias Deleted Event"
  17852. // ],
  17853. // "location": "query",
  17854. // "type": "string"
  17855. // },
  17856. // "userKey": {
  17857. // "description": "Email or immutable ID of the user",
  17858. // "location": "path",
  17859. // "required": true,
  17860. // "type": "string"
  17861. // }
  17862. // },
  17863. // "path": "users/{userKey}/aliases/watch",
  17864. // "request": {
  17865. // "$ref": "Channel",
  17866. // "parameterName": "resource"
  17867. // },
  17868. // "response": {
  17869. // "$ref": "Channel"
  17870. // },
  17871. // "scopes": [
  17872. // "https://www.googleapis.com/auth/admin.directory.user",
  17873. // "https://www.googleapis.com/auth/admin.directory.user.alias",
  17874. // "https://www.googleapis.com/auth/admin.directory.user.alias.readonly",
  17875. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  17876. // ],
  17877. // "supportsSubscription": true
  17878. // }
  17879. }
  17880. // method id "directory.users.photos.delete":
  17881. type UsersPhotosDeleteCall struct {
  17882. s *Service
  17883. userKey string
  17884. urlParams_ gensupport.URLParams
  17885. ctx_ context.Context
  17886. header_ http.Header
  17887. }
  17888. // Delete: Remove photos for the user
  17889. func (r *UsersPhotosService) Delete(userKey string) *UsersPhotosDeleteCall {
  17890. c := &UsersPhotosDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17891. c.userKey = userKey
  17892. return c
  17893. }
  17894. // Fields allows partial responses to be retrieved. See
  17895. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17896. // for more information.
  17897. func (c *UsersPhotosDeleteCall) Fields(s ...googleapi.Field) *UsersPhotosDeleteCall {
  17898. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17899. return c
  17900. }
  17901. // Context sets the context to be used in this call's Do method. Any
  17902. // pending HTTP request will be aborted if the provided context is
  17903. // canceled.
  17904. func (c *UsersPhotosDeleteCall) Context(ctx context.Context) *UsersPhotosDeleteCall {
  17905. c.ctx_ = ctx
  17906. return c
  17907. }
  17908. // Header returns an http.Header that can be modified by the caller to
  17909. // add HTTP headers to the request.
  17910. func (c *UsersPhotosDeleteCall) Header() http.Header {
  17911. if c.header_ == nil {
  17912. c.header_ = make(http.Header)
  17913. }
  17914. return c.header_
  17915. }
  17916. func (c *UsersPhotosDeleteCall) doRequest(alt string) (*http.Response, error) {
  17917. reqHeaders := make(http.Header)
  17918. for k, v := range c.header_ {
  17919. reqHeaders[k] = v
  17920. }
  17921. reqHeaders.Set("User-Agent", c.s.userAgent())
  17922. var body io.Reader = nil
  17923. c.urlParams_.Set("alt", alt)
  17924. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  17925. urls += "?" + c.urlParams_.Encode()
  17926. req, _ := http.NewRequest("DELETE", urls, body)
  17927. req.Header = reqHeaders
  17928. googleapi.Expand(req.URL, map[string]string{
  17929. "userKey": c.userKey,
  17930. })
  17931. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  17932. }
  17933. // Do executes the "directory.users.photos.delete" call.
  17934. func (c *UsersPhotosDeleteCall) Do(opts ...googleapi.CallOption) error {
  17935. gensupport.SetOptions(c.urlParams_, opts...)
  17936. res, err := c.doRequest("json")
  17937. if err != nil {
  17938. return err
  17939. }
  17940. defer googleapi.CloseBody(res)
  17941. if err := googleapi.CheckResponse(res); err != nil {
  17942. return err
  17943. }
  17944. return nil
  17945. // {
  17946. // "description": "Remove photos for the user",
  17947. // "httpMethod": "DELETE",
  17948. // "id": "directory.users.photos.delete",
  17949. // "parameterOrder": [
  17950. // "userKey"
  17951. // ],
  17952. // "parameters": {
  17953. // "userKey": {
  17954. // "description": "Email or immutable ID of the user",
  17955. // "location": "path",
  17956. // "required": true,
  17957. // "type": "string"
  17958. // }
  17959. // },
  17960. // "path": "users/{userKey}/photos/thumbnail",
  17961. // "scopes": [
  17962. // "https://www.googleapis.com/auth/admin.directory.user"
  17963. // ]
  17964. // }
  17965. }
  17966. // method id "directory.users.photos.get":
  17967. type UsersPhotosGetCall struct {
  17968. s *Service
  17969. userKey string
  17970. urlParams_ gensupport.URLParams
  17971. ifNoneMatch_ string
  17972. ctx_ context.Context
  17973. header_ http.Header
  17974. }
  17975. // Get: Retrieve photo of a user
  17976. func (r *UsersPhotosService) Get(userKey string) *UsersPhotosGetCall {
  17977. c := &UsersPhotosGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  17978. c.userKey = userKey
  17979. return c
  17980. }
  17981. // Fields allows partial responses to be retrieved. See
  17982. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  17983. // for more information.
  17984. func (c *UsersPhotosGetCall) Fields(s ...googleapi.Field) *UsersPhotosGetCall {
  17985. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  17986. return c
  17987. }
  17988. // IfNoneMatch sets the optional parameter which makes the operation
  17989. // fail if the object's ETag matches the given value. This is useful for
  17990. // getting updates only after the object has changed since the last
  17991. // request. Use googleapi.IsNotModified to check whether the response
  17992. // error from Do is the result of In-None-Match.
  17993. func (c *UsersPhotosGetCall) IfNoneMatch(entityTag string) *UsersPhotosGetCall {
  17994. c.ifNoneMatch_ = entityTag
  17995. return c
  17996. }
  17997. // Context sets the context to be used in this call's Do method. Any
  17998. // pending HTTP request will be aborted if the provided context is
  17999. // canceled.
  18000. func (c *UsersPhotosGetCall) Context(ctx context.Context) *UsersPhotosGetCall {
  18001. c.ctx_ = ctx
  18002. return c
  18003. }
  18004. // Header returns an http.Header that can be modified by the caller to
  18005. // add HTTP headers to the request.
  18006. func (c *UsersPhotosGetCall) Header() http.Header {
  18007. if c.header_ == nil {
  18008. c.header_ = make(http.Header)
  18009. }
  18010. return c.header_
  18011. }
  18012. func (c *UsersPhotosGetCall) doRequest(alt string) (*http.Response, error) {
  18013. reqHeaders := make(http.Header)
  18014. for k, v := range c.header_ {
  18015. reqHeaders[k] = v
  18016. }
  18017. reqHeaders.Set("User-Agent", c.s.userAgent())
  18018. if c.ifNoneMatch_ != "" {
  18019. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  18020. }
  18021. var body io.Reader = nil
  18022. c.urlParams_.Set("alt", alt)
  18023. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  18024. urls += "?" + c.urlParams_.Encode()
  18025. req, _ := http.NewRequest("GET", urls, body)
  18026. req.Header = reqHeaders
  18027. googleapi.Expand(req.URL, map[string]string{
  18028. "userKey": c.userKey,
  18029. })
  18030. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18031. }
  18032. // Do executes the "directory.users.photos.get" call.
  18033. // Exactly one of *UserPhoto or error will be non-nil. Any non-2xx
  18034. // status code is an error. Response headers are in either
  18035. // *UserPhoto.ServerResponse.Header or (if a response was returned at
  18036. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  18037. // to check whether the returned error was because
  18038. // http.StatusNotModified was returned.
  18039. func (c *UsersPhotosGetCall) Do(opts ...googleapi.CallOption) (*UserPhoto, error) {
  18040. gensupport.SetOptions(c.urlParams_, opts...)
  18041. res, err := c.doRequest("json")
  18042. if res != nil && res.StatusCode == http.StatusNotModified {
  18043. if res.Body != nil {
  18044. res.Body.Close()
  18045. }
  18046. return nil, &googleapi.Error{
  18047. Code: res.StatusCode,
  18048. Header: res.Header,
  18049. }
  18050. }
  18051. if err != nil {
  18052. return nil, err
  18053. }
  18054. defer googleapi.CloseBody(res)
  18055. if err := googleapi.CheckResponse(res); err != nil {
  18056. return nil, err
  18057. }
  18058. ret := &UserPhoto{
  18059. ServerResponse: googleapi.ServerResponse{
  18060. Header: res.Header,
  18061. HTTPStatusCode: res.StatusCode,
  18062. },
  18063. }
  18064. target := &ret
  18065. if err := gensupport.DecodeResponse(target, res); err != nil {
  18066. return nil, err
  18067. }
  18068. return ret, nil
  18069. // {
  18070. // "description": "Retrieve photo of a user",
  18071. // "httpMethod": "GET",
  18072. // "id": "directory.users.photos.get",
  18073. // "parameterOrder": [
  18074. // "userKey"
  18075. // ],
  18076. // "parameters": {
  18077. // "userKey": {
  18078. // "description": "Email or immutable ID of the user",
  18079. // "location": "path",
  18080. // "required": true,
  18081. // "type": "string"
  18082. // }
  18083. // },
  18084. // "path": "users/{userKey}/photos/thumbnail",
  18085. // "response": {
  18086. // "$ref": "UserPhoto"
  18087. // },
  18088. // "scopes": [
  18089. // "https://www.googleapis.com/auth/admin.directory.user",
  18090. // "https://www.googleapis.com/auth/admin.directory.user.readonly"
  18091. // ]
  18092. // }
  18093. }
  18094. // method id "directory.users.photos.patch":
  18095. type UsersPhotosPatchCall struct {
  18096. s *Service
  18097. userKey string
  18098. userphoto *UserPhoto
  18099. urlParams_ gensupport.URLParams
  18100. ctx_ context.Context
  18101. header_ http.Header
  18102. }
  18103. // Patch: Add a photo for the user. This method supports patch
  18104. // semantics.
  18105. func (r *UsersPhotosService) Patch(userKey string, userphoto *UserPhoto) *UsersPhotosPatchCall {
  18106. c := &UsersPhotosPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18107. c.userKey = userKey
  18108. c.userphoto = userphoto
  18109. return c
  18110. }
  18111. // Fields allows partial responses to be retrieved. See
  18112. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18113. // for more information.
  18114. func (c *UsersPhotosPatchCall) Fields(s ...googleapi.Field) *UsersPhotosPatchCall {
  18115. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18116. return c
  18117. }
  18118. // Context sets the context to be used in this call's Do method. Any
  18119. // pending HTTP request will be aborted if the provided context is
  18120. // canceled.
  18121. func (c *UsersPhotosPatchCall) Context(ctx context.Context) *UsersPhotosPatchCall {
  18122. c.ctx_ = ctx
  18123. return c
  18124. }
  18125. // Header returns an http.Header that can be modified by the caller to
  18126. // add HTTP headers to the request.
  18127. func (c *UsersPhotosPatchCall) Header() http.Header {
  18128. if c.header_ == nil {
  18129. c.header_ = make(http.Header)
  18130. }
  18131. return c.header_
  18132. }
  18133. func (c *UsersPhotosPatchCall) doRequest(alt string) (*http.Response, error) {
  18134. reqHeaders := make(http.Header)
  18135. for k, v := range c.header_ {
  18136. reqHeaders[k] = v
  18137. }
  18138. reqHeaders.Set("User-Agent", c.s.userAgent())
  18139. var body io.Reader = nil
  18140. body, err := googleapi.WithoutDataWrapper.JSONReader(c.userphoto)
  18141. if err != nil {
  18142. return nil, err
  18143. }
  18144. reqHeaders.Set("Content-Type", "application/json")
  18145. c.urlParams_.Set("alt", alt)
  18146. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  18147. urls += "?" + c.urlParams_.Encode()
  18148. req, _ := http.NewRequest("PATCH", urls, body)
  18149. req.Header = reqHeaders
  18150. googleapi.Expand(req.URL, map[string]string{
  18151. "userKey": c.userKey,
  18152. })
  18153. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18154. }
  18155. // Do executes the "directory.users.photos.patch" call.
  18156. // Exactly one of *UserPhoto or error will be non-nil. Any non-2xx
  18157. // status code is an error. Response headers are in either
  18158. // *UserPhoto.ServerResponse.Header or (if a response was returned at
  18159. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  18160. // to check whether the returned error was because
  18161. // http.StatusNotModified was returned.
  18162. func (c *UsersPhotosPatchCall) Do(opts ...googleapi.CallOption) (*UserPhoto, error) {
  18163. gensupport.SetOptions(c.urlParams_, opts...)
  18164. res, err := c.doRequest("json")
  18165. if res != nil && res.StatusCode == http.StatusNotModified {
  18166. if res.Body != nil {
  18167. res.Body.Close()
  18168. }
  18169. return nil, &googleapi.Error{
  18170. Code: res.StatusCode,
  18171. Header: res.Header,
  18172. }
  18173. }
  18174. if err != nil {
  18175. return nil, err
  18176. }
  18177. defer googleapi.CloseBody(res)
  18178. if err := googleapi.CheckResponse(res); err != nil {
  18179. return nil, err
  18180. }
  18181. ret := &UserPhoto{
  18182. ServerResponse: googleapi.ServerResponse{
  18183. Header: res.Header,
  18184. HTTPStatusCode: res.StatusCode,
  18185. },
  18186. }
  18187. target := &ret
  18188. if err := gensupport.DecodeResponse(target, res); err != nil {
  18189. return nil, err
  18190. }
  18191. return ret, nil
  18192. // {
  18193. // "description": "Add a photo for the user. This method supports patch semantics.",
  18194. // "httpMethod": "PATCH",
  18195. // "id": "directory.users.photos.patch",
  18196. // "parameterOrder": [
  18197. // "userKey"
  18198. // ],
  18199. // "parameters": {
  18200. // "userKey": {
  18201. // "description": "Email or immutable ID of the user",
  18202. // "location": "path",
  18203. // "required": true,
  18204. // "type": "string"
  18205. // }
  18206. // },
  18207. // "path": "users/{userKey}/photos/thumbnail",
  18208. // "request": {
  18209. // "$ref": "UserPhoto"
  18210. // },
  18211. // "response": {
  18212. // "$ref": "UserPhoto"
  18213. // },
  18214. // "scopes": [
  18215. // "https://www.googleapis.com/auth/admin.directory.user"
  18216. // ]
  18217. // }
  18218. }
  18219. // method id "directory.users.photos.update":
  18220. type UsersPhotosUpdateCall struct {
  18221. s *Service
  18222. userKey string
  18223. userphoto *UserPhoto
  18224. urlParams_ gensupport.URLParams
  18225. ctx_ context.Context
  18226. header_ http.Header
  18227. }
  18228. // Update: Add a photo for the user
  18229. func (r *UsersPhotosService) Update(userKey string, userphoto *UserPhoto) *UsersPhotosUpdateCall {
  18230. c := &UsersPhotosUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18231. c.userKey = userKey
  18232. c.userphoto = userphoto
  18233. return c
  18234. }
  18235. // Fields allows partial responses to be retrieved. See
  18236. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18237. // for more information.
  18238. func (c *UsersPhotosUpdateCall) Fields(s ...googleapi.Field) *UsersPhotosUpdateCall {
  18239. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18240. return c
  18241. }
  18242. // Context sets the context to be used in this call's Do method. Any
  18243. // pending HTTP request will be aborted if the provided context is
  18244. // canceled.
  18245. func (c *UsersPhotosUpdateCall) Context(ctx context.Context) *UsersPhotosUpdateCall {
  18246. c.ctx_ = ctx
  18247. return c
  18248. }
  18249. // Header returns an http.Header that can be modified by the caller to
  18250. // add HTTP headers to the request.
  18251. func (c *UsersPhotosUpdateCall) Header() http.Header {
  18252. if c.header_ == nil {
  18253. c.header_ = make(http.Header)
  18254. }
  18255. return c.header_
  18256. }
  18257. func (c *UsersPhotosUpdateCall) doRequest(alt string) (*http.Response, error) {
  18258. reqHeaders := make(http.Header)
  18259. for k, v := range c.header_ {
  18260. reqHeaders[k] = v
  18261. }
  18262. reqHeaders.Set("User-Agent", c.s.userAgent())
  18263. var body io.Reader = nil
  18264. body, err := googleapi.WithoutDataWrapper.JSONReader(c.userphoto)
  18265. if err != nil {
  18266. return nil, err
  18267. }
  18268. reqHeaders.Set("Content-Type", "application/json")
  18269. c.urlParams_.Set("alt", alt)
  18270. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/photos/thumbnail")
  18271. urls += "?" + c.urlParams_.Encode()
  18272. req, _ := http.NewRequest("PUT", urls, body)
  18273. req.Header = reqHeaders
  18274. googleapi.Expand(req.URL, map[string]string{
  18275. "userKey": c.userKey,
  18276. })
  18277. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18278. }
  18279. // Do executes the "directory.users.photos.update" call.
  18280. // Exactly one of *UserPhoto or error will be non-nil. Any non-2xx
  18281. // status code is an error. Response headers are in either
  18282. // *UserPhoto.ServerResponse.Header or (if a response was returned at
  18283. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  18284. // to check whether the returned error was because
  18285. // http.StatusNotModified was returned.
  18286. func (c *UsersPhotosUpdateCall) Do(opts ...googleapi.CallOption) (*UserPhoto, error) {
  18287. gensupport.SetOptions(c.urlParams_, opts...)
  18288. res, err := c.doRequest("json")
  18289. if res != nil && res.StatusCode == http.StatusNotModified {
  18290. if res.Body != nil {
  18291. res.Body.Close()
  18292. }
  18293. return nil, &googleapi.Error{
  18294. Code: res.StatusCode,
  18295. Header: res.Header,
  18296. }
  18297. }
  18298. if err != nil {
  18299. return nil, err
  18300. }
  18301. defer googleapi.CloseBody(res)
  18302. if err := googleapi.CheckResponse(res); err != nil {
  18303. return nil, err
  18304. }
  18305. ret := &UserPhoto{
  18306. ServerResponse: googleapi.ServerResponse{
  18307. Header: res.Header,
  18308. HTTPStatusCode: res.StatusCode,
  18309. },
  18310. }
  18311. target := &ret
  18312. if err := gensupport.DecodeResponse(target, res); err != nil {
  18313. return nil, err
  18314. }
  18315. return ret, nil
  18316. // {
  18317. // "description": "Add a photo for the user",
  18318. // "httpMethod": "PUT",
  18319. // "id": "directory.users.photos.update",
  18320. // "parameterOrder": [
  18321. // "userKey"
  18322. // ],
  18323. // "parameters": {
  18324. // "userKey": {
  18325. // "description": "Email or immutable ID of the user",
  18326. // "location": "path",
  18327. // "required": true,
  18328. // "type": "string"
  18329. // }
  18330. // },
  18331. // "path": "users/{userKey}/photos/thumbnail",
  18332. // "request": {
  18333. // "$ref": "UserPhoto"
  18334. // },
  18335. // "response": {
  18336. // "$ref": "UserPhoto"
  18337. // },
  18338. // "scopes": [
  18339. // "https://www.googleapis.com/auth/admin.directory.user"
  18340. // ]
  18341. // }
  18342. }
  18343. // method id "directory.verificationCodes.generate":
  18344. type VerificationCodesGenerateCall struct {
  18345. s *Service
  18346. userKey string
  18347. urlParams_ gensupport.URLParams
  18348. ctx_ context.Context
  18349. header_ http.Header
  18350. }
  18351. // Generate: Generate new backup verification codes for the user.
  18352. func (r *VerificationCodesService) Generate(userKey string) *VerificationCodesGenerateCall {
  18353. c := &VerificationCodesGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18354. c.userKey = userKey
  18355. return c
  18356. }
  18357. // Fields allows partial responses to be retrieved. See
  18358. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18359. // for more information.
  18360. func (c *VerificationCodesGenerateCall) Fields(s ...googleapi.Field) *VerificationCodesGenerateCall {
  18361. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18362. return c
  18363. }
  18364. // Context sets the context to be used in this call's Do method. Any
  18365. // pending HTTP request will be aborted if the provided context is
  18366. // canceled.
  18367. func (c *VerificationCodesGenerateCall) Context(ctx context.Context) *VerificationCodesGenerateCall {
  18368. c.ctx_ = ctx
  18369. return c
  18370. }
  18371. // Header returns an http.Header that can be modified by the caller to
  18372. // add HTTP headers to the request.
  18373. func (c *VerificationCodesGenerateCall) Header() http.Header {
  18374. if c.header_ == nil {
  18375. c.header_ = make(http.Header)
  18376. }
  18377. return c.header_
  18378. }
  18379. func (c *VerificationCodesGenerateCall) doRequest(alt string) (*http.Response, error) {
  18380. reqHeaders := make(http.Header)
  18381. for k, v := range c.header_ {
  18382. reqHeaders[k] = v
  18383. }
  18384. reqHeaders.Set("User-Agent", c.s.userAgent())
  18385. var body io.Reader = nil
  18386. c.urlParams_.Set("alt", alt)
  18387. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/verificationCodes/generate")
  18388. urls += "?" + c.urlParams_.Encode()
  18389. req, _ := http.NewRequest("POST", urls, body)
  18390. req.Header = reqHeaders
  18391. googleapi.Expand(req.URL, map[string]string{
  18392. "userKey": c.userKey,
  18393. })
  18394. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18395. }
  18396. // Do executes the "directory.verificationCodes.generate" call.
  18397. func (c *VerificationCodesGenerateCall) Do(opts ...googleapi.CallOption) error {
  18398. gensupport.SetOptions(c.urlParams_, opts...)
  18399. res, err := c.doRequest("json")
  18400. if err != nil {
  18401. return err
  18402. }
  18403. defer googleapi.CloseBody(res)
  18404. if err := googleapi.CheckResponse(res); err != nil {
  18405. return err
  18406. }
  18407. return nil
  18408. // {
  18409. // "description": "Generate new backup verification codes for the user.",
  18410. // "httpMethod": "POST",
  18411. // "id": "directory.verificationCodes.generate",
  18412. // "parameterOrder": [
  18413. // "userKey"
  18414. // ],
  18415. // "parameters": {
  18416. // "userKey": {
  18417. // "description": "Email or immutable ID of the user",
  18418. // "location": "path",
  18419. // "required": true,
  18420. // "type": "string"
  18421. // }
  18422. // },
  18423. // "path": "users/{userKey}/verificationCodes/generate",
  18424. // "scopes": [
  18425. // "https://www.googleapis.com/auth/admin.directory.user.security"
  18426. // ]
  18427. // }
  18428. }
  18429. // method id "directory.verificationCodes.invalidate":
  18430. type VerificationCodesInvalidateCall struct {
  18431. s *Service
  18432. userKey string
  18433. urlParams_ gensupport.URLParams
  18434. ctx_ context.Context
  18435. header_ http.Header
  18436. }
  18437. // Invalidate: Invalidate the current backup verification codes for the
  18438. // user.
  18439. func (r *VerificationCodesService) Invalidate(userKey string) *VerificationCodesInvalidateCall {
  18440. c := &VerificationCodesInvalidateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18441. c.userKey = userKey
  18442. return c
  18443. }
  18444. // Fields allows partial responses to be retrieved. See
  18445. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18446. // for more information.
  18447. func (c *VerificationCodesInvalidateCall) Fields(s ...googleapi.Field) *VerificationCodesInvalidateCall {
  18448. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18449. return c
  18450. }
  18451. // Context sets the context to be used in this call's Do method. Any
  18452. // pending HTTP request will be aborted if the provided context is
  18453. // canceled.
  18454. func (c *VerificationCodesInvalidateCall) Context(ctx context.Context) *VerificationCodesInvalidateCall {
  18455. c.ctx_ = ctx
  18456. return c
  18457. }
  18458. // Header returns an http.Header that can be modified by the caller to
  18459. // add HTTP headers to the request.
  18460. func (c *VerificationCodesInvalidateCall) Header() http.Header {
  18461. if c.header_ == nil {
  18462. c.header_ = make(http.Header)
  18463. }
  18464. return c.header_
  18465. }
  18466. func (c *VerificationCodesInvalidateCall) doRequest(alt string) (*http.Response, error) {
  18467. reqHeaders := make(http.Header)
  18468. for k, v := range c.header_ {
  18469. reqHeaders[k] = v
  18470. }
  18471. reqHeaders.Set("User-Agent", c.s.userAgent())
  18472. var body io.Reader = nil
  18473. c.urlParams_.Set("alt", alt)
  18474. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/verificationCodes/invalidate")
  18475. urls += "?" + c.urlParams_.Encode()
  18476. req, _ := http.NewRequest("POST", urls, body)
  18477. req.Header = reqHeaders
  18478. googleapi.Expand(req.URL, map[string]string{
  18479. "userKey": c.userKey,
  18480. })
  18481. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18482. }
  18483. // Do executes the "directory.verificationCodes.invalidate" call.
  18484. func (c *VerificationCodesInvalidateCall) Do(opts ...googleapi.CallOption) error {
  18485. gensupport.SetOptions(c.urlParams_, opts...)
  18486. res, err := c.doRequest("json")
  18487. if err != nil {
  18488. return err
  18489. }
  18490. defer googleapi.CloseBody(res)
  18491. if err := googleapi.CheckResponse(res); err != nil {
  18492. return err
  18493. }
  18494. return nil
  18495. // {
  18496. // "description": "Invalidate the current backup verification codes for the user.",
  18497. // "httpMethod": "POST",
  18498. // "id": "directory.verificationCodes.invalidate",
  18499. // "parameterOrder": [
  18500. // "userKey"
  18501. // ],
  18502. // "parameters": {
  18503. // "userKey": {
  18504. // "description": "Email or immutable ID of the user",
  18505. // "location": "path",
  18506. // "required": true,
  18507. // "type": "string"
  18508. // }
  18509. // },
  18510. // "path": "users/{userKey}/verificationCodes/invalidate",
  18511. // "scopes": [
  18512. // "https://www.googleapis.com/auth/admin.directory.user.security"
  18513. // ]
  18514. // }
  18515. }
  18516. // method id "directory.verificationCodes.list":
  18517. type VerificationCodesListCall struct {
  18518. s *Service
  18519. userKey string
  18520. urlParams_ gensupport.URLParams
  18521. ifNoneMatch_ string
  18522. ctx_ context.Context
  18523. header_ http.Header
  18524. }
  18525. // List: Returns the current set of valid backup verification codes for
  18526. // the specified user.
  18527. func (r *VerificationCodesService) List(userKey string) *VerificationCodesListCall {
  18528. c := &VerificationCodesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  18529. c.userKey = userKey
  18530. return c
  18531. }
  18532. // Fields allows partial responses to be retrieved. See
  18533. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  18534. // for more information.
  18535. func (c *VerificationCodesListCall) Fields(s ...googleapi.Field) *VerificationCodesListCall {
  18536. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  18537. return c
  18538. }
  18539. // IfNoneMatch sets the optional parameter which makes the operation
  18540. // fail if the object's ETag matches the given value. This is useful for
  18541. // getting updates only after the object has changed since the last
  18542. // request. Use googleapi.IsNotModified to check whether the response
  18543. // error from Do is the result of In-None-Match.
  18544. func (c *VerificationCodesListCall) IfNoneMatch(entityTag string) *VerificationCodesListCall {
  18545. c.ifNoneMatch_ = entityTag
  18546. return c
  18547. }
  18548. // Context sets the context to be used in this call's Do method. Any
  18549. // pending HTTP request will be aborted if the provided context is
  18550. // canceled.
  18551. func (c *VerificationCodesListCall) Context(ctx context.Context) *VerificationCodesListCall {
  18552. c.ctx_ = ctx
  18553. return c
  18554. }
  18555. // Header returns an http.Header that can be modified by the caller to
  18556. // add HTTP headers to the request.
  18557. func (c *VerificationCodesListCall) Header() http.Header {
  18558. if c.header_ == nil {
  18559. c.header_ = make(http.Header)
  18560. }
  18561. return c.header_
  18562. }
  18563. func (c *VerificationCodesListCall) doRequest(alt string) (*http.Response, error) {
  18564. reqHeaders := make(http.Header)
  18565. for k, v := range c.header_ {
  18566. reqHeaders[k] = v
  18567. }
  18568. reqHeaders.Set("User-Agent", c.s.userAgent())
  18569. if c.ifNoneMatch_ != "" {
  18570. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  18571. }
  18572. var body io.Reader = nil
  18573. c.urlParams_.Set("alt", alt)
  18574. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userKey}/verificationCodes")
  18575. urls += "?" + c.urlParams_.Encode()
  18576. req, _ := http.NewRequest("GET", urls, body)
  18577. req.Header = reqHeaders
  18578. googleapi.Expand(req.URL, map[string]string{
  18579. "userKey": c.userKey,
  18580. })
  18581. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  18582. }
  18583. // Do executes the "directory.verificationCodes.list" call.
  18584. // Exactly one of *VerificationCodes or error will be non-nil. Any
  18585. // non-2xx status code is an error. Response headers are in either
  18586. // *VerificationCodes.ServerResponse.Header or (if a response was
  18587. // returned at all) in error.(*googleapi.Error).Header. Use
  18588. // googleapi.IsNotModified to check whether the returned error was
  18589. // because http.StatusNotModified was returned.
  18590. func (c *VerificationCodesListCall) Do(opts ...googleapi.CallOption) (*VerificationCodes, error) {
  18591. gensupport.SetOptions(c.urlParams_, opts...)
  18592. res, err := c.doRequest("json")
  18593. if res != nil && res.StatusCode == http.StatusNotModified {
  18594. if res.Body != nil {
  18595. res.Body.Close()
  18596. }
  18597. return nil, &googleapi.Error{
  18598. Code: res.StatusCode,
  18599. Header: res.Header,
  18600. }
  18601. }
  18602. if err != nil {
  18603. return nil, err
  18604. }
  18605. defer googleapi.CloseBody(res)
  18606. if err := googleapi.CheckResponse(res); err != nil {
  18607. return nil, err
  18608. }
  18609. ret := &VerificationCodes{
  18610. ServerResponse: googleapi.ServerResponse{
  18611. Header: res.Header,
  18612. HTTPStatusCode: res.StatusCode,
  18613. },
  18614. }
  18615. target := &ret
  18616. if err := gensupport.DecodeResponse(target, res); err != nil {
  18617. return nil, err
  18618. }
  18619. return ret, nil
  18620. // {
  18621. // "description": "Returns the current set of valid backup verification codes for the specified user.",
  18622. // "httpMethod": "GET",
  18623. // "id": "directory.verificationCodes.list",
  18624. // "parameterOrder": [
  18625. // "userKey"
  18626. // ],
  18627. // "parameters": {
  18628. // "userKey": {
  18629. // "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.",
  18630. // "location": "path",
  18631. // "required": true,
  18632. // "type": "string"
  18633. // }
  18634. // },
  18635. // "path": "users/{userKey}/verificationCodes",
  18636. // "response": {
  18637. // "$ref": "VerificationCodes"
  18638. // },
  18639. // "scopes": [
  18640. // "https://www.googleapis.com/auth/admin.directory.user.security"
  18641. // ]
  18642. // }
  18643. }