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.
 
 
 

767 lines
25 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package groupssettings provides access to the Groups Settings API.
  6. //
  7. // For product documentation, see: https://developers.google.com/google-apps/groups-settings/get_started
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/groupssettings/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // groupssettingsService, err := groupssettings.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // groupssettingsService, err := groupssettings.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // groupssettingsService, err := groupssettings.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package groupssettings // import "google.golang.org/api/groupssettings/v1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "groupssettings:v1"
  67. const apiName = "groupssettings"
  68. const apiVersion = "v1"
  69. const basePath = "https://www.googleapis.com/groups/v1/groups/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage the settings of a G Suite group
  73. AppsGroupsSettingsScope = "https://www.googleapis.com/auth/apps.groups.settings"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/apps.groups.settings",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Groups = NewGroupsService(s)
  106. return s, nil
  107. }
  108. type Service struct {
  109. client *http.Client
  110. BasePath string // API endpoint base URL
  111. UserAgent string // optional additional User-Agent fragment
  112. Groups *GroupsService
  113. }
  114. func (s *Service) userAgent() string {
  115. if s.UserAgent == "" {
  116. return googleapi.UserAgent
  117. }
  118. return googleapi.UserAgent + " " + s.UserAgent
  119. }
  120. func NewGroupsService(s *Service) *GroupsService {
  121. rs := &GroupsService{s: s}
  122. return rs
  123. }
  124. type GroupsService struct {
  125. s *Service
  126. }
  127. // Groups: JSON template for Group resource
  128. type Groups struct {
  129. // AllowExternalMembers: Are external members allowed to join the group.
  130. AllowExternalMembers string `json:"allowExternalMembers,omitempty"`
  131. // AllowGoogleCommunication: Is google allowed to contact admins.
  132. AllowGoogleCommunication string `json:"allowGoogleCommunication,omitempty"`
  133. // AllowWebPosting: If posting from web is allowed.
  134. AllowWebPosting string `json:"allowWebPosting,omitempty"`
  135. // ArchiveOnly: If the group is archive only
  136. ArchiveOnly string `json:"archiveOnly,omitempty"`
  137. // CustomFooterText: Custom footer text.
  138. CustomFooterText string `json:"customFooterText,omitempty"`
  139. // CustomReplyTo: Default email to which reply to any message should go.
  140. CustomReplyTo string `json:"customReplyTo,omitempty"`
  141. // DefaultMessageDenyNotificationText: Default message deny notification
  142. // message
  143. DefaultMessageDenyNotificationText string `json:"defaultMessageDenyNotificationText,omitempty"`
  144. // Description: Description of the group
  145. Description string `json:"description,omitempty"`
  146. // Email: Email id of the group
  147. Email string `json:"email,omitempty"`
  148. // FavoriteRepliesOnTop: If favorite replies should be displayed above
  149. // other replies.
  150. FavoriteRepliesOnTop string `json:"favoriteRepliesOnTop,omitempty"`
  151. // IncludeCustomFooter: Whether to include custom footer.
  152. IncludeCustomFooter string `json:"includeCustomFooter,omitempty"`
  153. // IncludeInGlobalAddressList: If this groups should be included in
  154. // global address list or not.
  155. IncludeInGlobalAddressList string `json:"includeInGlobalAddressList,omitempty"`
  156. // IsArchived: If the contents of the group are archived.
  157. IsArchived string `json:"isArchived,omitempty"`
  158. // Kind: The type of the resource.
  159. Kind string `json:"kind,omitempty"`
  160. // MaxMessageBytes: Maximum message size allowed.
  161. MaxMessageBytes int64 `json:"maxMessageBytes,omitempty"`
  162. // MembersCanPostAsTheGroup: Can members post using the group email
  163. // address.
  164. MembersCanPostAsTheGroup string `json:"membersCanPostAsTheGroup,omitempty"`
  165. // MessageDisplayFont: Default message display font. Possible values
  166. // are: DEFAULT_FONT FIXED_WIDTH_FONT
  167. MessageDisplayFont string `json:"messageDisplayFont,omitempty"`
  168. // MessageModerationLevel: Moderation level for messages. Possible
  169. // values are: MODERATE_ALL_MESSAGES MODERATE_NON_MEMBERS
  170. // MODERATE_NEW_MEMBERS MODERATE_NONE
  171. MessageModerationLevel string `json:"messageModerationLevel,omitempty"`
  172. // Name: Name of the Group
  173. Name string `json:"name,omitempty"`
  174. // PrimaryLanguage: Primary language for the group.
  175. PrimaryLanguage string `json:"primaryLanguage,omitempty"`
  176. // ReplyTo: Whome should the default reply to a message go to. Possible
  177. // values are: REPLY_TO_CUSTOM REPLY_TO_SENDER REPLY_TO_LIST
  178. // REPLY_TO_OWNER REPLY_TO_IGNORE REPLY_TO_MANAGERS
  179. ReplyTo string `json:"replyTo,omitempty"`
  180. // SendMessageDenyNotification: Should the member be notified if his
  181. // message is denied by owner.
  182. SendMessageDenyNotification string `json:"sendMessageDenyNotification,omitempty"`
  183. // ShowInGroupDirectory: Is the group listed in groups directory
  184. ShowInGroupDirectory string `json:"showInGroupDirectory,omitempty"`
  185. // SpamModerationLevel: Moderation level for messages detected as spam.
  186. // Possible values are: ALLOW MODERATE SILENTLY_MODERATE REJECT
  187. SpamModerationLevel string `json:"spamModerationLevel,omitempty"`
  188. // WhoCanAdd: Permissions to add members. Possible values are:
  189. // ALL_MANAGERS_CAN_ADD ALL_OWNERS_CAN_ADD ALL_MEMBERS_CAN_ADD
  190. // NONE_CAN_ADD
  191. WhoCanAdd string `json:"whoCanAdd,omitempty"`
  192. // WhoCanAddReferences: Permission to add references to a topic.
  193. // Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY
  194. // OWNERS_AND_MANAGERS ALL_MEMBERS
  195. WhoCanAddReferences string `json:"whoCanAddReferences,omitempty"`
  196. // WhoCanAssignTopics: Permission to assign topics in a forum to another
  197. // user. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY
  198. // OWNERS_AND_MANAGERS ALL_MEMBERS
  199. WhoCanAssignTopics string `json:"whoCanAssignTopics,omitempty"`
  200. // WhoCanContactOwner: Permission to contact owner of the group via web
  201. // UI. Possible values are: ANYONE_CAN_CONTACT ALL_IN_DOMAIN_CAN_CONTACT
  202. // ALL_MEMBERS_CAN_CONTACT ALL_MANAGERS_CAN_CONTACT
  203. WhoCanContactOwner string `json:"whoCanContactOwner,omitempty"`
  204. // WhoCanEnterFreeFormTags: Permission to enter free form tags for
  205. // topics in a forum. Possible values are: NONE OWNERS_ONLY
  206. // MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS
  207. WhoCanEnterFreeFormTags string `json:"whoCanEnterFreeFormTags,omitempty"`
  208. // WhoCanInvite: Permissions to invite members. Possible values are:
  209. // ALL_MEMBERS_CAN_INVITE ALL_MANAGERS_CAN_INVITE ALL_OWNERS_CAN_INVITE
  210. // NONE_CAN_INVITE
  211. WhoCanInvite string `json:"whoCanInvite,omitempty"`
  212. // WhoCanJoin: Permissions to join the group. Possible values are:
  213. // ANYONE_CAN_JOIN ALL_IN_DOMAIN_CAN_JOIN INVITED_CAN_JOIN
  214. // CAN_REQUEST_TO_JOIN
  215. WhoCanJoin string `json:"whoCanJoin,omitempty"`
  216. // WhoCanLeaveGroup: Permission to leave the group. Possible values are:
  217. // ALL_MANAGERS_CAN_LEAVE ALL_OWNERS_CAN_LEAVE ALL_MEMBERS_CAN_LEAVE
  218. // NONE_CAN_LEAVE
  219. WhoCanLeaveGroup string `json:"whoCanLeaveGroup,omitempty"`
  220. // WhoCanMarkDuplicate: Permission to mark a topic as a duplicate of
  221. // another topic. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY
  222. // OWNERS_AND_MANAGERS ALL_MEMBERS
  223. WhoCanMarkDuplicate string `json:"whoCanMarkDuplicate,omitempty"`
  224. // WhoCanMarkFavoriteReplyOnAnyTopic: Permission to mark any other
  225. // user's post as a favorite reply. Possible values are: NONE
  226. // OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS
  227. WhoCanMarkFavoriteReplyOnAnyTopic string `json:"whoCanMarkFavoriteReplyOnAnyTopic,omitempty"`
  228. // WhoCanMarkFavoriteReplyOnOwnTopic: Permission to mark a post for a
  229. // topic they started as a favorite reply. Possible values are: NONE
  230. // OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS
  231. WhoCanMarkFavoriteReplyOnOwnTopic string `json:"whoCanMarkFavoriteReplyOnOwnTopic,omitempty"`
  232. // WhoCanMarkNoResponseNeeded: Permission to mark a topic as not needing
  233. // a response. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY
  234. // OWNERS_AND_MANAGERS ALL_MEMBERS
  235. WhoCanMarkNoResponseNeeded string `json:"whoCanMarkNoResponseNeeded,omitempty"`
  236. // WhoCanModifyTagsAndCategories: Permission to change tags and
  237. // categories. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY
  238. // OWNERS_AND_MANAGERS ALL_MEMBERS
  239. WhoCanModifyTagsAndCategories string `json:"whoCanModifyTagsAndCategories,omitempty"`
  240. // WhoCanPostMessage: Permissions to post messages to the group.
  241. // Possible values are: NONE_CAN_POST ALL_MANAGERS_CAN_POST
  242. // ALL_MEMBERS_CAN_POST ALL_OWNERS_CAN_POST ALL_IN_DOMAIN_CAN_POST
  243. // ANYONE_CAN_POST
  244. WhoCanPostMessage string `json:"whoCanPostMessage,omitempty"`
  245. // WhoCanTakeTopics: Permission to take topics in a forum. Possible
  246. // values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS
  247. // ALL_MEMBERS
  248. WhoCanTakeTopics string `json:"whoCanTakeTopics,omitempty"`
  249. // WhoCanUnassignTopic: Permission to unassign any topic in a forum.
  250. // Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY
  251. // OWNERS_AND_MANAGERS ALL_MEMBERS
  252. WhoCanUnassignTopic string `json:"whoCanUnassignTopic,omitempty"`
  253. // WhoCanUnmarkFavoriteReplyOnAnyTopic: Permission to unmark any post
  254. // from a favorite reply. Possible values are: NONE OWNERS_ONLY
  255. // MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS
  256. WhoCanUnmarkFavoriteReplyOnAnyTopic string `json:"whoCanUnmarkFavoriteReplyOnAnyTopic,omitempty"`
  257. // WhoCanViewGroup: Permissions to view group. Possible values are:
  258. // ANYONE_CAN_VIEW ALL_IN_DOMAIN_CAN_VIEW ALL_MEMBERS_CAN_VIEW
  259. // ALL_MANAGERS_CAN_VIEW ALL_OWNERS_CAN_VIEW
  260. WhoCanViewGroup string `json:"whoCanViewGroup,omitempty"`
  261. // WhoCanViewMembership: Permissions to view membership. Possible values
  262. // are: ALL_IN_DOMAIN_CAN_VIEW ALL_MEMBERS_CAN_VIEW
  263. // ALL_MANAGERS_CAN_VIEW
  264. WhoCanViewMembership string `json:"whoCanViewMembership,omitempty"`
  265. // ServerResponse contains the HTTP response code and headers from the
  266. // server.
  267. googleapi.ServerResponse `json:"-"`
  268. // ForceSendFields is a list of field names (e.g.
  269. // "AllowExternalMembers") to unconditionally include in API requests.
  270. // By default, fields with empty values are omitted from API requests.
  271. // However, any non-pointer, non-interface field appearing in
  272. // ForceSendFields will be sent to the server regardless of whether the
  273. // field is empty or not. This may be used to include empty fields in
  274. // Patch requests.
  275. ForceSendFields []string `json:"-"`
  276. // NullFields is a list of field names (e.g. "AllowExternalMembers") to
  277. // include in API requests with the JSON null value. By default, fields
  278. // with empty values are omitted from API requests. However, any field
  279. // with an empty value appearing in NullFields will be sent to the
  280. // server as null. It is an error if a field in this list has a
  281. // non-empty value. This may be used to include null fields in Patch
  282. // requests.
  283. NullFields []string `json:"-"`
  284. }
  285. func (s *Groups) MarshalJSON() ([]byte, error) {
  286. type NoMethod Groups
  287. raw := NoMethod(*s)
  288. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  289. }
  290. // method id "groupsSettings.groups.get":
  291. type GroupsGetCall struct {
  292. s *Service
  293. groupUniqueId string
  294. urlParams_ gensupport.URLParams
  295. ifNoneMatch_ string
  296. ctx_ context.Context
  297. header_ http.Header
  298. }
  299. // Get: Gets one resource by id.
  300. func (r *GroupsService) Get(groupUniqueId string) *GroupsGetCall {
  301. c := &GroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  302. c.groupUniqueId = groupUniqueId
  303. return c
  304. }
  305. // Fields allows partial responses to be retrieved. See
  306. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  307. // for more information.
  308. func (c *GroupsGetCall) Fields(s ...googleapi.Field) *GroupsGetCall {
  309. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  310. return c
  311. }
  312. // IfNoneMatch sets the optional parameter which makes the operation
  313. // fail if the object's ETag matches the given value. This is useful for
  314. // getting updates only after the object has changed since the last
  315. // request. Use googleapi.IsNotModified to check whether the response
  316. // error from Do is the result of In-None-Match.
  317. func (c *GroupsGetCall) IfNoneMatch(entityTag string) *GroupsGetCall {
  318. c.ifNoneMatch_ = entityTag
  319. return c
  320. }
  321. // Context sets the context to be used in this call's Do method. Any
  322. // pending HTTP request will be aborted if the provided context is
  323. // canceled.
  324. func (c *GroupsGetCall) Context(ctx context.Context) *GroupsGetCall {
  325. c.ctx_ = ctx
  326. return c
  327. }
  328. // Header returns an http.Header that can be modified by the caller to
  329. // add HTTP headers to the request.
  330. func (c *GroupsGetCall) Header() http.Header {
  331. if c.header_ == nil {
  332. c.header_ = make(http.Header)
  333. }
  334. return c.header_
  335. }
  336. func (c *GroupsGetCall) doRequest(alt string) (*http.Response, error) {
  337. reqHeaders := make(http.Header)
  338. for k, v := range c.header_ {
  339. reqHeaders[k] = v
  340. }
  341. reqHeaders.Set("User-Agent", c.s.userAgent())
  342. if c.ifNoneMatch_ != "" {
  343. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  344. }
  345. var body io.Reader = nil
  346. c.urlParams_.Set("alt", alt)
  347. c.urlParams_.Set("prettyPrint", "false")
  348. urls := googleapi.ResolveRelative(c.s.BasePath, "{groupUniqueId}")
  349. urls += "?" + c.urlParams_.Encode()
  350. req, err := http.NewRequest("GET", urls, body)
  351. if err != nil {
  352. return nil, err
  353. }
  354. req.Header = reqHeaders
  355. googleapi.Expand(req.URL, map[string]string{
  356. "groupUniqueId": c.groupUniqueId,
  357. })
  358. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  359. }
  360. // Do executes the "groupsSettings.groups.get" call.
  361. // Exactly one of *Groups or error will be non-nil. Any non-2xx status
  362. // code is an error. Response headers are in either
  363. // *Groups.ServerResponse.Header or (if a response was returned at all)
  364. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  365. // check whether the returned error was because http.StatusNotModified
  366. // was returned.
  367. func (c *GroupsGetCall) Do(opts ...googleapi.CallOption) (*Groups, error) {
  368. gensupport.SetOptions(c.urlParams_, opts...)
  369. res, err := c.doRequest("json")
  370. if res != nil && res.StatusCode == http.StatusNotModified {
  371. if res.Body != nil {
  372. res.Body.Close()
  373. }
  374. return nil, &googleapi.Error{
  375. Code: res.StatusCode,
  376. Header: res.Header,
  377. }
  378. }
  379. if err != nil {
  380. return nil, err
  381. }
  382. defer googleapi.CloseBody(res)
  383. if err := googleapi.CheckResponse(res); err != nil {
  384. return nil, err
  385. }
  386. ret := &Groups{
  387. ServerResponse: googleapi.ServerResponse{
  388. Header: res.Header,
  389. HTTPStatusCode: res.StatusCode,
  390. },
  391. }
  392. target := &ret
  393. if err := gensupport.DecodeResponse(target, res); err != nil {
  394. return nil, err
  395. }
  396. return ret, nil
  397. // {
  398. // "description": "Gets one resource by id.",
  399. // "httpMethod": "GET",
  400. // "id": "groupsSettings.groups.get",
  401. // "parameterOrder": [
  402. // "groupUniqueId"
  403. // ],
  404. // "parameters": {
  405. // "groupUniqueId": {
  406. // "description": "The resource ID",
  407. // "location": "path",
  408. // "required": true,
  409. // "type": "string"
  410. // }
  411. // },
  412. // "path": "{groupUniqueId}",
  413. // "response": {
  414. // "$ref": "Groups"
  415. // },
  416. // "scopes": [
  417. // "https://www.googleapis.com/auth/apps.groups.settings"
  418. // ]
  419. // }
  420. }
  421. // method id "groupsSettings.groups.patch":
  422. type GroupsPatchCall struct {
  423. s *Service
  424. groupUniqueId string
  425. groups *Groups
  426. urlParams_ gensupport.URLParams
  427. ctx_ context.Context
  428. header_ http.Header
  429. }
  430. // Patch: Updates an existing resource. This method supports patch
  431. // semantics.
  432. func (r *GroupsService) Patch(groupUniqueId string, groups *Groups) *GroupsPatchCall {
  433. c := &GroupsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  434. c.groupUniqueId = groupUniqueId
  435. c.groups = groups
  436. return c
  437. }
  438. // Fields allows partial responses to be retrieved. See
  439. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  440. // for more information.
  441. func (c *GroupsPatchCall) Fields(s ...googleapi.Field) *GroupsPatchCall {
  442. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  443. return c
  444. }
  445. // Context sets the context to be used in this call's Do method. Any
  446. // pending HTTP request will be aborted if the provided context is
  447. // canceled.
  448. func (c *GroupsPatchCall) Context(ctx context.Context) *GroupsPatchCall {
  449. c.ctx_ = ctx
  450. return c
  451. }
  452. // Header returns an http.Header that can be modified by the caller to
  453. // add HTTP headers to the request.
  454. func (c *GroupsPatchCall) Header() http.Header {
  455. if c.header_ == nil {
  456. c.header_ = make(http.Header)
  457. }
  458. return c.header_
  459. }
  460. func (c *GroupsPatchCall) doRequest(alt string) (*http.Response, error) {
  461. reqHeaders := make(http.Header)
  462. for k, v := range c.header_ {
  463. reqHeaders[k] = v
  464. }
  465. reqHeaders.Set("User-Agent", c.s.userAgent())
  466. var body io.Reader = nil
  467. body, err := googleapi.WithoutDataWrapper.JSONReader(c.groups)
  468. if err != nil {
  469. return nil, err
  470. }
  471. reqHeaders.Set("Content-Type", "application/json")
  472. c.urlParams_.Set("alt", alt)
  473. c.urlParams_.Set("prettyPrint", "false")
  474. urls := googleapi.ResolveRelative(c.s.BasePath, "{groupUniqueId}")
  475. urls += "?" + c.urlParams_.Encode()
  476. req, err := http.NewRequest("PATCH", urls, body)
  477. if err != nil {
  478. return nil, err
  479. }
  480. req.Header = reqHeaders
  481. googleapi.Expand(req.URL, map[string]string{
  482. "groupUniqueId": c.groupUniqueId,
  483. })
  484. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  485. }
  486. // Do executes the "groupsSettings.groups.patch" call.
  487. // Exactly one of *Groups or error will be non-nil. Any non-2xx status
  488. // code is an error. Response headers are in either
  489. // *Groups.ServerResponse.Header or (if a response was returned at all)
  490. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  491. // check whether the returned error was because http.StatusNotModified
  492. // was returned.
  493. func (c *GroupsPatchCall) Do(opts ...googleapi.CallOption) (*Groups, error) {
  494. gensupport.SetOptions(c.urlParams_, opts...)
  495. res, err := c.doRequest("json")
  496. if res != nil && res.StatusCode == http.StatusNotModified {
  497. if res.Body != nil {
  498. res.Body.Close()
  499. }
  500. return nil, &googleapi.Error{
  501. Code: res.StatusCode,
  502. Header: res.Header,
  503. }
  504. }
  505. if err != nil {
  506. return nil, err
  507. }
  508. defer googleapi.CloseBody(res)
  509. if err := googleapi.CheckResponse(res); err != nil {
  510. return nil, err
  511. }
  512. ret := &Groups{
  513. ServerResponse: googleapi.ServerResponse{
  514. Header: res.Header,
  515. HTTPStatusCode: res.StatusCode,
  516. },
  517. }
  518. target := &ret
  519. if err := gensupport.DecodeResponse(target, res); err != nil {
  520. return nil, err
  521. }
  522. return ret, nil
  523. // {
  524. // "description": "Updates an existing resource. This method supports patch semantics.",
  525. // "httpMethod": "PATCH",
  526. // "id": "groupsSettings.groups.patch",
  527. // "parameterOrder": [
  528. // "groupUniqueId"
  529. // ],
  530. // "parameters": {
  531. // "groupUniqueId": {
  532. // "description": "The resource ID",
  533. // "location": "path",
  534. // "required": true,
  535. // "type": "string"
  536. // }
  537. // },
  538. // "path": "{groupUniqueId}",
  539. // "request": {
  540. // "$ref": "Groups"
  541. // },
  542. // "response": {
  543. // "$ref": "Groups"
  544. // },
  545. // "scopes": [
  546. // "https://www.googleapis.com/auth/apps.groups.settings"
  547. // ]
  548. // }
  549. }
  550. // method id "groupsSettings.groups.update":
  551. type GroupsUpdateCall struct {
  552. s *Service
  553. groupUniqueId string
  554. groups *Groups
  555. urlParams_ gensupport.URLParams
  556. ctx_ context.Context
  557. header_ http.Header
  558. }
  559. // Update: Updates an existing resource.
  560. func (r *GroupsService) Update(groupUniqueId string, groups *Groups) *GroupsUpdateCall {
  561. c := &GroupsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  562. c.groupUniqueId = groupUniqueId
  563. c.groups = groups
  564. return c
  565. }
  566. // Fields allows partial responses to be retrieved. See
  567. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  568. // for more information.
  569. func (c *GroupsUpdateCall) Fields(s ...googleapi.Field) *GroupsUpdateCall {
  570. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  571. return c
  572. }
  573. // Context sets the context to be used in this call's Do method. Any
  574. // pending HTTP request will be aborted if the provided context is
  575. // canceled.
  576. func (c *GroupsUpdateCall) Context(ctx context.Context) *GroupsUpdateCall {
  577. c.ctx_ = ctx
  578. return c
  579. }
  580. // Header returns an http.Header that can be modified by the caller to
  581. // add HTTP headers to the request.
  582. func (c *GroupsUpdateCall) Header() http.Header {
  583. if c.header_ == nil {
  584. c.header_ = make(http.Header)
  585. }
  586. return c.header_
  587. }
  588. func (c *GroupsUpdateCall) doRequest(alt string) (*http.Response, error) {
  589. reqHeaders := make(http.Header)
  590. for k, v := range c.header_ {
  591. reqHeaders[k] = v
  592. }
  593. reqHeaders.Set("User-Agent", c.s.userAgent())
  594. var body io.Reader = nil
  595. body, err := googleapi.WithoutDataWrapper.JSONReader(c.groups)
  596. if err != nil {
  597. return nil, err
  598. }
  599. reqHeaders.Set("Content-Type", "application/json")
  600. c.urlParams_.Set("alt", alt)
  601. c.urlParams_.Set("prettyPrint", "false")
  602. urls := googleapi.ResolveRelative(c.s.BasePath, "{groupUniqueId}")
  603. urls += "?" + c.urlParams_.Encode()
  604. req, err := http.NewRequest("PUT", urls, body)
  605. if err != nil {
  606. return nil, err
  607. }
  608. req.Header = reqHeaders
  609. googleapi.Expand(req.URL, map[string]string{
  610. "groupUniqueId": c.groupUniqueId,
  611. })
  612. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  613. }
  614. // Do executes the "groupsSettings.groups.update" call.
  615. // Exactly one of *Groups or error will be non-nil. Any non-2xx status
  616. // code is an error. Response headers are in either
  617. // *Groups.ServerResponse.Header or (if a response was returned at all)
  618. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  619. // check whether the returned error was because http.StatusNotModified
  620. // was returned.
  621. func (c *GroupsUpdateCall) Do(opts ...googleapi.CallOption) (*Groups, error) {
  622. gensupport.SetOptions(c.urlParams_, opts...)
  623. res, err := c.doRequest("json")
  624. if res != nil && res.StatusCode == http.StatusNotModified {
  625. if res.Body != nil {
  626. res.Body.Close()
  627. }
  628. return nil, &googleapi.Error{
  629. Code: res.StatusCode,
  630. Header: res.Header,
  631. }
  632. }
  633. if err != nil {
  634. return nil, err
  635. }
  636. defer googleapi.CloseBody(res)
  637. if err := googleapi.CheckResponse(res); err != nil {
  638. return nil, err
  639. }
  640. ret := &Groups{
  641. ServerResponse: googleapi.ServerResponse{
  642. Header: res.Header,
  643. HTTPStatusCode: res.StatusCode,
  644. },
  645. }
  646. target := &ret
  647. if err := gensupport.DecodeResponse(target, res); err != nil {
  648. return nil, err
  649. }
  650. return ret, nil
  651. // {
  652. // "description": "Updates an existing resource.",
  653. // "httpMethod": "PUT",
  654. // "id": "groupsSettings.groups.update",
  655. // "parameterOrder": [
  656. // "groupUniqueId"
  657. // ],
  658. // "parameters": {
  659. // "groupUniqueId": {
  660. // "description": "The resource ID",
  661. // "location": "path",
  662. // "required": true,
  663. // "type": "string"
  664. // }
  665. // },
  666. // "path": "{groupUniqueId}",
  667. // "request": {
  668. // "$ref": "Groups"
  669. // },
  670. // "response": {
  671. // "$ref": "Groups"
  672. // },
  673. // "scopes": [
  674. // "https://www.googleapis.com/auth/apps.groups.settings"
  675. // ]
  676. // }
  677. }