Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

2579 linhas
87 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 chat provides access to the Hangouts Chat API.
  6. //
  7. // For product documentation, see: https://developers.google.com/hangouts/chat
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/chat/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // chatService, err := chat.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. // chatService, err := chat.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. // chatService, err := chat.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 chat // import "google.golang.org/api/chat/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 = "chat:v1"
  67. const apiName = "chat"
  68. const apiVersion = "v1"
  69. const basePath = "https://chat.googleapis.com/"
  70. // NewService creates a new Service.
  71. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  72. client, endpoint, err := htransport.NewClient(ctx, opts...)
  73. if err != nil {
  74. return nil, err
  75. }
  76. s, err := New(client)
  77. if err != nil {
  78. return nil, err
  79. }
  80. if endpoint != "" {
  81. s.BasePath = endpoint
  82. }
  83. return s, nil
  84. }
  85. // New creates a new Service. It uses the provided http.Client for requests.
  86. //
  87. // Deprecated: please use NewService instead.
  88. // To provide a custom HTTP client, use option.WithHTTPClient.
  89. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  90. func New(client *http.Client) (*Service, error) {
  91. if client == nil {
  92. return nil, errors.New("client is nil")
  93. }
  94. s := &Service{client: client, BasePath: basePath}
  95. s.Spaces = NewSpacesService(s)
  96. return s, nil
  97. }
  98. type Service struct {
  99. client *http.Client
  100. BasePath string // API endpoint base URL
  101. UserAgent string // optional additional User-Agent fragment
  102. Spaces *SpacesService
  103. }
  104. func (s *Service) userAgent() string {
  105. if s.UserAgent == "" {
  106. return googleapi.UserAgent
  107. }
  108. return googleapi.UserAgent + " " + s.UserAgent
  109. }
  110. func NewSpacesService(s *Service) *SpacesService {
  111. rs := &SpacesService{s: s}
  112. rs.Members = NewSpacesMembersService(s)
  113. rs.Messages = NewSpacesMessagesService(s)
  114. return rs
  115. }
  116. type SpacesService struct {
  117. s *Service
  118. Members *SpacesMembersService
  119. Messages *SpacesMessagesService
  120. }
  121. func NewSpacesMembersService(s *Service) *SpacesMembersService {
  122. rs := &SpacesMembersService{s: s}
  123. return rs
  124. }
  125. type SpacesMembersService struct {
  126. s *Service
  127. }
  128. func NewSpacesMessagesService(s *Service) *SpacesMessagesService {
  129. rs := &SpacesMessagesService{s: s}
  130. return rs
  131. }
  132. type SpacesMessagesService struct {
  133. s *Service
  134. }
  135. // ActionParameter: List of string parameters to supply when the action
  136. // method is invoked.
  137. // For example, consider three snooze buttons: snooze now, snooze 1
  138. // day,
  139. // snooze next week. You might use action method = snooze(), passing
  140. // the
  141. // snooze type and snooze time in the list of string parameters.
  142. type ActionParameter struct {
  143. // Key: The name of the parameter for the action script.
  144. Key string `json:"key,omitempty"`
  145. // Value: The value of the parameter.
  146. Value string `json:"value,omitempty"`
  147. // ForceSendFields is a list of field names (e.g. "Key") to
  148. // unconditionally include in API requests. By default, fields with
  149. // empty values are omitted from API requests. However, any non-pointer,
  150. // non-interface field appearing in ForceSendFields will be sent to the
  151. // server regardless of whether the field is empty or not. This may be
  152. // used to include empty fields in Patch requests.
  153. ForceSendFields []string `json:"-"`
  154. // NullFields is a list of field names (e.g. "Key") to include in API
  155. // requests with the JSON null value. By default, fields with empty
  156. // values are omitted from API requests. However, any field with an
  157. // empty value appearing in NullFields will be sent to the server as
  158. // null. It is an error if a field in this list has a non-empty value.
  159. // This may be used to include null fields in Patch requests.
  160. NullFields []string `json:"-"`
  161. }
  162. func (s *ActionParameter) MarshalJSON() ([]byte, error) {
  163. type NoMethod ActionParameter
  164. raw := NoMethod(*s)
  165. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  166. }
  167. // ActionResponse: Parameters that a bot can use to configure how it's
  168. // response is posted.
  169. type ActionResponse struct {
  170. // Type: The type of bot response.
  171. //
  172. // Possible values:
  173. // "TYPE_UNSPECIFIED" - Default type; will be handled as NEW_MESSAGE.
  174. // "NEW_MESSAGE" - Post as a new message in the topic.
  175. // "UPDATE_MESSAGE" - Update the bot's own message. (Only after
  176. // CARD_CLICKED events.)
  177. // "REQUEST_CONFIG" - Privately ask the user for additional auth or
  178. // config.
  179. Type string `json:"type,omitempty"`
  180. // Url: URL for users to auth or config. (Only for REQUEST_CONFIG
  181. // response types.)
  182. Url string `json:"url,omitempty"`
  183. // ForceSendFields is a list of field names (e.g. "Type") to
  184. // unconditionally include in API requests. By default, fields with
  185. // empty values are omitted from API requests. However, any non-pointer,
  186. // non-interface field appearing in ForceSendFields will be sent to the
  187. // server regardless of whether the field is empty or not. This may be
  188. // used to include empty fields in Patch requests.
  189. ForceSendFields []string `json:"-"`
  190. // NullFields is a list of field names (e.g. "Type") to include in API
  191. // requests with the JSON null value. By default, fields with empty
  192. // values are omitted from API requests. However, any field with an
  193. // empty value appearing in NullFields will be sent to the server as
  194. // null. It is an error if a field in this list has a non-empty value.
  195. // This may be used to include null fields in Patch requests.
  196. NullFields []string `json:"-"`
  197. }
  198. func (s *ActionResponse) MarshalJSON() ([]byte, error) {
  199. type NoMethod ActionResponse
  200. raw := NoMethod(*s)
  201. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  202. }
  203. // Annotation: Annotations associated with the plain-text body of the
  204. // message.
  205. //
  206. // Example plain-text message body:
  207. // ```
  208. // Hello @FooBot how are you!"
  209. // ```
  210. //
  211. // The corresponding annotations metadata:
  212. // ```
  213. // "annotations":[{
  214. // "type":"USER_MENTION",
  215. // "startIndex":6,
  216. // "length":7,
  217. // "userMention": {
  218. // "user": {
  219. // "name":"users/107946847022116401880",
  220. // "displayName":"FooBot",
  221. // "avatarUrl":"https://goo.gl/aeDtrS",
  222. // "type":"BOT"
  223. // },
  224. // "type":"MENTION"
  225. // }
  226. // }]
  227. // ```
  228. type Annotation struct {
  229. // Length: Length of the substring in the plain-text message body this
  230. // annotation
  231. // corresponds to.
  232. Length int64 `json:"length,omitempty"`
  233. // StartIndex: Start index (0-based, inclusive) in the plain-text
  234. // message body this
  235. // annotation corresponds to.
  236. StartIndex int64 `json:"startIndex,omitempty"`
  237. // Type: The type of this annotation.
  238. //
  239. // Possible values:
  240. // "ANNOTATION_TYPE_UNSPECIFIED" - Default value for the enum. DO NOT
  241. // USE.
  242. // "USER_MENTION" - A user is mentioned.
  243. Type string `json:"type,omitempty"`
  244. // UserMention: The metadata of user mention.
  245. UserMention *UserMentionMetadata `json:"userMention,omitempty"`
  246. // ForceSendFields is a list of field names (e.g. "Length") to
  247. // unconditionally include in API requests. By default, fields with
  248. // empty values are omitted from API requests. However, any non-pointer,
  249. // non-interface field appearing in ForceSendFields will be sent to the
  250. // server regardless of whether the field is empty or not. This may be
  251. // used to include empty fields in Patch requests.
  252. ForceSendFields []string `json:"-"`
  253. // NullFields is a list of field names (e.g. "Length") to include in API
  254. // requests with the JSON null value. By default, fields with empty
  255. // values are omitted from API requests. However, any field with an
  256. // empty value appearing in NullFields will be sent to the server as
  257. // null. It is an error if a field in this list has a non-empty value.
  258. // This may be used to include null fields in Patch requests.
  259. NullFields []string `json:"-"`
  260. }
  261. func (s *Annotation) MarshalJSON() ([]byte, error) {
  262. type NoMethod Annotation
  263. raw := NoMethod(*s)
  264. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  265. }
  266. // Button: A button. Can be a text button or an image button.
  267. type Button struct {
  268. // ImageButton: A button with image and onclick action.
  269. ImageButton *ImageButton `json:"imageButton,omitempty"`
  270. // TextButton: A button with text and onclick action.
  271. TextButton *TextButton `json:"textButton,omitempty"`
  272. // ForceSendFields is a list of field names (e.g. "ImageButton") to
  273. // unconditionally include in API requests. By default, fields with
  274. // empty values are omitted from API requests. However, any non-pointer,
  275. // non-interface field appearing in ForceSendFields will be sent to the
  276. // server regardless of whether the field is empty or not. This may be
  277. // used to include empty fields in Patch requests.
  278. ForceSendFields []string `json:"-"`
  279. // NullFields is a list of field names (e.g. "ImageButton") to include
  280. // in API requests with the JSON null value. By default, fields with
  281. // empty values are omitted from API requests. However, any field with
  282. // an empty value appearing in NullFields will be sent to the server as
  283. // null. It is an error if a field in this list has a non-empty value.
  284. // This may be used to include null fields in Patch requests.
  285. NullFields []string `json:"-"`
  286. }
  287. func (s *Button) MarshalJSON() ([]byte, error) {
  288. type NoMethod Button
  289. raw := NoMethod(*s)
  290. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  291. }
  292. // Card: A card is a UI element that can contain UI widgets such as
  293. // texts, images.
  294. type Card struct {
  295. // CardActions: The actions of this card.
  296. CardActions []*CardAction `json:"cardActions,omitempty"`
  297. // Header: The header of the card. A header usually contains a title and
  298. // an image.
  299. Header *CardHeader `json:"header,omitempty"`
  300. // Name: Name of the card.
  301. Name string `json:"name,omitempty"`
  302. // Sections: Sections are separated by a line divider.
  303. Sections []*Section `json:"sections,omitempty"`
  304. // ForceSendFields is a list of field names (e.g. "CardActions") to
  305. // unconditionally include in API requests. By default, fields with
  306. // empty values are omitted from API requests. However, any non-pointer,
  307. // non-interface field appearing in ForceSendFields will be sent to the
  308. // server regardless of whether the field is empty or not. This may be
  309. // used to include empty fields in Patch requests.
  310. ForceSendFields []string `json:"-"`
  311. // NullFields is a list of field names (e.g. "CardActions") to include
  312. // in API requests with the JSON null value. By default, fields with
  313. // empty values are omitted from API requests. However, any field with
  314. // an empty value appearing in NullFields will be sent to the server as
  315. // null. It is an error if a field in this list has a non-empty value.
  316. // This may be used to include null fields in Patch requests.
  317. NullFields []string `json:"-"`
  318. }
  319. func (s *Card) MarshalJSON() ([]byte, error) {
  320. type NoMethod Card
  321. raw := NoMethod(*s)
  322. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  323. }
  324. // CardAction: A card action is
  325. // the action associated with the card. For an invoice card, a
  326. // typical action would be: delete invoice, email invoice or open
  327. // the
  328. // invoice in browser.
  329. type CardAction struct {
  330. // ActionLabel: The label used to be displayed in the action menu item.
  331. ActionLabel string `json:"actionLabel,omitempty"`
  332. // OnClick: The onclick action for this action item.
  333. OnClick *OnClick `json:"onClick,omitempty"`
  334. // ForceSendFields is a list of field names (e.g. "ActionLabel") to
  335. // unconditionally include in API requests. By default, fields with
  336. // empty values are omitted from API requests. However, any non-pointer,
  337. // non-interface field appearing in ForceSendFields will be sent to the
  338. // server regardless of whether the field is empty or not. This may be
  339. // used to include empty fields in Patch requests.
  340. ForceSendFields []string `json:"-"`
  341. // NullFields is a list of field names (e.g. "ActionLabel") to include
  342. // in API requests with the JSON null value. By default, fields with
  343. // empty values are omitted from API requests. However, any field with
  344. // an empty value appearing in NullFields will be sent to the server as
  345. // null. It is an error if a field in this list has a non-empty value.
  346. // This may be used to include null fields in Patch requests.
  347. NullFields []string `json:"-"`
  348. }
  349. func (s *CardAction) MarshalJSON() ([]byte, error) {
  350. type NoMethod CardAction
  351. raw := NoMethod(*s)
  352. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  353. }
  354. type CardHeader struct {
  355. // ImageStyle: The image's type (e.g. square border or circular border).
  356. //
  357. // Possible values:
  358. // "IMAGE_STYLE_UNSPECIFIED"
  359. // "IMAGE" - Square border.
  360. // "AVATAR" - Circular border.
  361. ImageStyle string `json:"imageStyle,omitempty"`
  362. // ImageUrl: The URL of the image in the card header.
  363. ImageUrl string `json:"imageUrl,omitempty"`
  364. // Subtitle: The subtitle of the card header.
  365. Subtitle string `json:"subtitle,omitempty"`
  366. // Title: The title must be specified. The header has a fixed height: if
  367. // both a
  368. // title and subtitle is specified, each will take up 1 line. If only
  369. // the
  370. // title is specified, it will take up both lines.
  371. Title string `json:"title,omitempty"`
  372. // ForceSendFields is a list of field names (e.g. "ImageStyle") to
  373. // unconditionally include in API requests. By default, fields with
  374. // empty values are omitted from API requests. However, any non-pointer,
  375. // non-interface field appearing in ForceSendFields will be sent to the
  376. // server regardless of whether the field is empty or not. This may be
  377. // used to include empty fields in Patch requests.
  378. ForceSendFields []string `json:"-"`
  379. // NullFields is a list of field names (e.g. "ImageStyle") to include in
  380. // API requests with the JSON null value. By default, fields with empty
  381. // values are omitted from API requests. However, any field with an
  382. // empty value appearing in NullFields will be sent to the server as
  383. // null. It is an error if a field in this list has a non-empty value.
  384. // This may be used to include null fields in Patch requests.
  385. NullFields []string `json:"-"`
  386. }
  387. func (s *CardHeader) MarshalJSON() ([]byte, error) {
  388. type NoMethod CardHeader
  389. raw := NoMethod(*s)
  390. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  391. }
  392. // DeprecatedEvent: Hangouts Chat events.
  393. type DeprecatedEvent struct {
  394. // Action: The form action data associated with an interactive card that
  395. // was clicked.
  396. // Only populated for
  397. // CARD_CLICKED events.
  398. // See the [Interactive Cards
  399. // guide](/hangouts/chat/how-tos/cards-onclick) for
  400. // more information.
  401. Action *FormAction `json:"action,omitempty"`
  402. // ConfigCompleteRedirectUrl: The URL the bot should redirect the user
  403. // to after they have completed an
  404. // authorization or configuration flow outside of Hangouts Chat. See
  405. // the
  406. // [Authorizing access to 3p services
  407. // guide](/hangouts/chat/how-tos/auth-3p)
  408. // for more information.
  409. ConfigCompleteRedirectUrl string `json:"configCompleteRedirectUrl,omitempty"`
  410. // EventTime: The timestamp indicating when the event was dispatched.
  411. EventTime string `json:"eventTime,omitempty"`
  412. // Message: The message that triggered the event, if applicable.
  413. Message *Message `json:"message,omitempty"`
  414. // Space: The room or DM in which the event occurred.
  415. Space *Space `json:"space,omitempty"`
  416. // ThreadKey: The bot-defined key for the thread related to the event.
  417. // See the
  418. // thread_key field of the
  419. // `spaces.message.create` request for more information.
  420. ThreadKey string `json:"threadKey,omitempty"`
  421. // Token: A secret value that bots can use to verify if a request is
  422. // from Google. The
  423. // token is randomly generated by Google, remains static, and can be
  424. // obtained
  425. // from the Hangouts Chat API configuration page in the Cloud
  426. // Console.
  427. // Developers can revoke/regenerate it if needed from the same page.
  428. Token string `json:"token,omitempty"`
  429. // Type: The type of the event.
  430. //
  431. // Possible values:
  432. // "UNSPECIFIED" - Default value for the enum. DO NOT USE.
  433. // "MESSAGE" - A message was sent in a room or direct message.
  434. // "ADDED_TO_SPACE" - The bot was added to a room or DM.
  435. // "REMOVED_FROM_SPACE" - The bot was removed from a room or DM.
  436. // "CARD_CLICKED" - The bot's interactive card was clicked.
  437. Type string `json:"type,omitempty"`
  438. // User: The user that triggered the event.
  439. User *User `json:"user,omitempty"`
  440. // ForceSendFields is a list of field names (e.g. "Action") to
  441. // unconditionally include in API requests. By default, fields with
  442. // empty values are omitted from API requests. However, any non-pointer,
  443. // non-interface field appearing in ForceSendFields will be sent to the
  444. // server regardless of whether the field is empty or not. This may be
  445. // used to include empty fields in Patch requests.
  446. ForceSendFields []string `json:"-"`
  447. // NullFields is a list of field names (e.g. "Action") to include in API
  448. // requests with the JSON null value. By default, fields with empty
  449. // values are omitted from API requests. However, any field with an
  450. // empty value appearing in NullFields will be sent to the server as
  451. // null. It is an error if a field in this list has a non-empty value.
  452. // This may be used to include null fields in Patch requests.
  453. NullFields []string `json:"-"`
  454. }
  455. func (s *DeprecatedEvent) MarshalJSON() ([]byte, error) {
  456. type NoMethod DeprecatedEvent
  457. raw := NoMethod(*s)
  458. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  459. }
  460. // Empty: A generic empty message that you can re-use to avoid defining
  461. // duplicated
  462. // empty messages in your APIs. A typical example is to use it as the
  463. // request
  464. // or the response type of an API method. For instance:
  465. //
  466. // service Foo {
  467. // rpc Bar(google.protobuf.Empty) returns
  468. // (google.protobuf.Empty);
  469. // }
  470. //
  471. // The JSON representation for `Empty` is empty JSON object `{}`.
  472. type Empty struct {
  473. // ServerResponse contains the HTTP response code and headers from the
  474. // server.
  475. googleapi.ServerResponse `json:"-"`
  476. }
  477. // FormAction: A form action describes the behavior when the form is
  478. // submitted.
  479. // For example, an Apps Script can be invoked to handle the form.
  480. type FormAction struct {
  481. // ActionMethodName: Apps Script function to invoke when the containing
  482. // element is
  483. // clicked/activated.
  484. ActionMethodName string `json:"actionMethodName,omitempty"`
  485. // Parameters: List of action parameters.
  486. Parameters []*ActionParameter `json:"parameters,omitempty"`
  487. // ForceSendFields is a list of field names (e.g. "ActionMethodName") to
  488. // unconditionally include in API requests. By default, fields with
  489. // empty values are omitted from API requests. However, any non-pointer,
  490. // non-interface field appearing in ForceSendFields will be sent to the
  491. // server regardless of whether the field is empty or not. This may be
  492. // used to include empty fields in Patch requests.
  493. ForceSendFields []string `json:"-"`
  494. // NullFields is a list of field names (e.g. "ActionMethodName") to
  495. // include in API requests with the JSON null value. By default, fields
  496. // with empty values are omitted from API requests. However, any field
  497. // with an empty value appearing in NullFields will be sent to the
  498. // server as null. It is an error if a field in this list has a
  499. // non-empty value. This may be used to include null fields in Patch
  500. // requests.
  501. NullFields []string `json:"-"`
  502. }
  503. func (s *FormAction) MarshalJSON() ([]byte, error) {
  504. type NoMethod FormAction
  505. raw := NoMethod(*s)
  506. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  507. }
  508. // Image: An image that is specified by a URL and can have an onclick
  509. // action.
  510. type Image struct {
  511. // AspectRatio: The aspect ratio of this image (width/height).
  512. AspectRatio float64 `json:"aspectRatio,omitempty"`
  513. // ImageUrl: The URL of the image.
  514. ImageUrl string `json:"imageUrl,omitempty"`
  515. // OnClick: The onclick action.
  516. OnClick *OnClick `json:"onClick,omitempty"`
  517. // ForceSendFields is a list of field names (e.g. "AspectRatio") to
  518. // unconditionally include in API requests. By default, fields with
  519. // empty values are omitted from API requests. However, any non-pointer,
  520. // non-interface field appearing in ForceSendFields will be sent to the
  521. // server regardless of whether the field is empty or not. This may be
  522. // used to include empty fields in Patch requests.
  523. ForceSendFields []string `json:"-"`
  524. // NullFields is a list of field names (e.g. "AspectRatio") to include
  525. // in API requests with the JSON null value. By default, fields with
  526. // empty values are omitted from API requests. However, any field with
  527. // an empty value appearing in NullFields will be sent to the server as
  528. // null. It is an error if a field in this list has a non-empty value.
  529. // This may be used to include null fields in Patch requests.
  530. NullFields []string `json:"-"`
  531. }
  532. func (s *Image) MarshalJSON() ([]byte, error) {
  533. type NoMethod Image
  534. raw := NoMethod(*s)
  535. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  536. }
  537. func (s *Image) UnmarshalJSON(data []byte) error {
  538. type NoMethod Image
  539. var s1 struct {
  540. AspectRatio gensupport.JSONFloat64 `json:"aspectRatio"`
  541. *NoMethod
  542. }
  543. s1.NoMethod = (*NoMethod)(s)
  544. if err := json.Unmarshal(data, &s1); err != nil {
  545. return err
  546. }
  547. s.AspectRatio = float64(s1.AspectRatio)
  548. return nil
  549. }
  550. // ImageButton: An image button with an onclick action.
  551. type ImageButton struct {
  552. // Icon: The icon specified by an enum that indices to an icon provided
  553. // by Chat
  554. // API.
  555. //
  556. // Possible values:
  557. // "ICON_UNSPECIFIED"
  558. // "AIRPLANE"
  559. // "BOOKMARK"
  560. // "BUS"
  561. // "CAR"
  562. // "CLOCK"
  563. // "CONFIRMATION_NUMBER_ICON"
  564. // "DOLLAR"
  565. // "DESCRIPTION"
  566. // "EMAIL"
  567. // "EVENT_PERFORMER"
  568. // "EVENT_SEAT"
  569. // "FLIGHT_ARRIVAL"
  570. // "FLIGHT_DEPARTURE"
  571. // "HOTEL"
  572. // "HOTEL_ROOM_TYPE"
  573. // "INVITE"
  574. // "MAP_PIN"
  575. // "MEMBERSHIP"
  576. // "MULTIPLE_PEOPLE"
  577. // "OFFER"
  578. // "PERSON"
  579. // "PHONE"
  580. // "RESTAURANT_ICON"
  581. // "SHOPPING_CART"
  582. // "STAR"
  583. // "STORE"
  584. // "TICKET"
  585. // "TRAIN"
  586. // "VIDEO_CAMERA"
  587. // "VIDEO_PLAY"
  588. Icon string `json:"icon,omitempty"`
  589. // IconUrl: The icon specified by a URL.
  590. IconUrl string `json:"iconUrl,omitempty"`
  591. // Name: The name of this image_button which will be used for
  592. // accessibility.
  593. // Default value will be provided if developers don't specify.
  594. Name string `json:"name,omitempty"`
  595. // OnClick: The onclick action.
  596. OnClick *OnClick `json:"onClick,omitempty"`
  597. // ForceSendFields is a list of field names (e.g. "Icon") to
  598. // unconditionally include in API requests. By default, fields with
  599. // empty values are omitted from API requests. However, any non-pointer,
  600. // non-interface field appearing in ForceSendFields will be sent to the
  601. // server regardless of whether the field is empty or not. This may be
  602. // used to include empty fields in Patch requests.
  603. ForceSendFields []string `json:"-"`
  604. // NullFields is a list of field names (e.g. "Icon") to include in API
  605. // requests with the JSON null value. By default, fields with empty
  606. // values are omitted from API requests. However, any field with an
  607. // empty value appearing in NullFields will be sent to the server as
  608. // null. It is an error if a field in this list has a non-empty value.
  609. // This may be used to include null fields in Patch requests.
  610. NullFields []string `json:"-"`
  611. }
  612. func (s *ImageButton) MarshalJSON() ([]byte, error) {
  613. type NoMethod ImageButton
  614. raw := NoMethod(*s)
  615. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  616. }
  617. // KeyValue: A UI element contains a key (label) and a value (content).
  618. // And this
  619. // element may also contain some actions such as onclick button.
  620. type KeyValue struct {
  621. // BottomLabel: The text of the bottom label. Formatted text supported.
  622. BottomLabel string `json:"bottomLabel,omitempty"`
  623. // Button: A button that can be clicked to trigger an action.
  624. Button *Button `json:"button,omitempty"`
  625. // Content: The text of the content. Formatted text supported and always
  626. // required.
  627. Content string `json:"content,omitempty"`
  628. // ContentMultiline: If the content should be multiline.
  629. ContentMultiline bool `json:"contentMultiline,omitempty"`
  630. // Icon: An enum value that will be replaced by the Chat API with
  631. // the
  632. // corresponding icon image.
  633. //
  634. // Possible values:
  635. // "ICON_UNSPECIFIED"
  636. // "AIRPLANE"
  637. // "BOOKMARK"
  638. // "BUS"
  639. // "CAR"
  640. // "CLOCK"
  641. // "CONFIRMATION_NUMBER_ICON"
  642. // "DOLLAR"
  643. // "DESCRIPTION"
  644. // "EMAIL"
  645. // "EVENT_PERFORMER"
  646. // "EVENT_SEAT"
  647. // "FLIGHT_ARRIVAL"
  648. // "FLIGHT_DEPARTURE"
  649. // "HOTEL"
  650. // "HOTEL_ROOM_TYPE"
  651. // "INVITE"
  652. // "MAP_PIN"
  653. // "MEMBERSHIP"
  654. // "MULTIPLE_PEOPLE"
  655. // "OFFER"
  656. // "PERSON"
  657. // "PHONE"
  658. // "RESTAURANT_ICON"
  659. // "SHOPPING_CART"
  660. // "STAR"
  661. // "STORE"
  662. // "TICKET"
  663. // "TRAIN"
  664. // "VIDEO_CAMERA"
  665. // "VIDEO_PLAY"
  666. Icon string `json:"icon,omitempty"`
  667. // IconUrl: The icon specified by a URL.
  668. IconUrl string `json:"iconUrl,omitempty"`
  669. // OnClick: The onclick action. Only the top label, bottom label and
  670. // content region
  671. // are clickable.
  672. OnClick *OnClick `json:"onClick,omitempty"`
  673. // TopLabel: The text of the top label. Formatted text supported.
  674. TopLabel string `json:"topLabel,omitempty"`
  675. // ForceSendFields is a list of field names (e.g. "BottomLabel") to
  676. // unconditionally include in API requests. By default, fields with
  677. // empty values are omitted from API requests. However, any non-pointer,
  678. // non-interface field appearing in ForceSendFields will be sent to the
  679. // server regardless of whether the field is empty or not. This may be
  680. // used to include empty fields in Patch requests.
  681. ForceSendFields []string `json:"-"`
  682. // NullFields is a list of field names (e.g. "BottomLabel") to include
  683. // in API requests with the JSON null value. By default, fields with
  684. // empty values are omitted from API requests. However, any field with
  685. // an empty value appearing in NullFields will be sent to the server as
  686. // null. It is an error if a field in this list has a non-empty value.
  687. // This may be used to include null fields in Patch requests.
  688. NullFields []string `json:"-"`
  689. }
  690. func (s *KeyValue) MarshalJSON() ([]byte, error) {
  691. type NoMethod KeyValue
  692. raw := NoMethod(*s)
  693. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  694. }
  695. type ListMembershipsResponse struct {
  696. // Memberships: List of memberships in the requested (or first) page.
  697. Memberships []*Membership `json:"memberships,omitempty"`
  698. // NextPageToken: Continuation token to retrieve the next page of
  699. // results. It will be empty
  700. // for the last page of results.
  701. NextPageToken string `json:"nextPageToken,omitempty"`
  702. // ServerResponse contains the HTTP response code and headers from the
  703. // server.
  704. googleapi.ServerResponse `json:"-"`
  705. // ForceSendFields is a list of field names (e.g. "Memberships") to
  706. // unconditionally include in API requests. By default, fields with
  707. // empty values are omitted from API requests. However, any non-pointer,
  708. // non-interface field appearing in ForceSendFields will be sent to the
  709. // server regardless of whether the field is empty or not. This may be
  710. // used to include empty fields in Patch requests.
  711. ForceSendFields []string `json:"-"`
  712. // NullFields is a list of field names (e.g. "Memberships") to include
  713. // in API requests with the JSON null value. By default, fields with
  714. // empty values are omitted from API requests. However, any field with
  715. // an empty value appearing in NullFields will be sent to the server as
  716. // null. It is an error if a field in this list has a non-empty value.
  717. // This may be used to include null fields in Patch requests.
  718. NullFields []string `json:"-"`
  719. }
  720. func (s *ListMembershipsResponse) MarshalJSON() ([]byte, error) {
  721. type NoMethod ListMembershipsResponse
  722. raw := NoMethod(*s)
  723. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  724. }
  725. type ListSpacesResponse struct {
  726. // NextPageToken: Continuation token to retrieve the next page of
  727. // results. It will be empty
  728. // for the last page of results. Tokens expire in an hour. An error is
  729. // thrown
  730. // if an expired token is passed.
  731. NextPageToken string `json:"nextPageToken,omitempty"`
  732. // Spaces: List of spaces in the requested (or first) page.
  733. Spaces []*Space `json:"spaces,omitempty"`
  734. // ServerResponse contains the HTTP response code and headers from the
  735. // server.
  736. googleapi.ServerResponse `json:"-"`
  737. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  738. // unconditionally include in API requests. By default, fields with
  739. // empty values are omitted from API requests. However, any non-pointer,
  740. // non-interface field appearing in ForceSendFields will be sent to the
  741. // server regardless of whether the field is empty or not. This may be
  742. // used to include empty fields in Patch requests.
  743. ForceSendFields []string `json:"-"`
  744. // NullFields is a list of field names (e.g. "NextPageToken") to include
  745. // in API requests with the JSON null value. By default, fields with
  746. // empty values are omitted from API requests. However, any field with
  747. // an empty value appearing in NullFields will be sent to the server as
  748. // null. It is an error if a field in this list has a non-empty value.
  749. // This may be used to include null fields in Patch requests.
  750. NullFields []string `json:"-"`
  751. }
  752. func (s *ListSpacesResponse) MarshalJSON() ([]byte, error) {
  753. type NoMethod ListSpacesResponse
  754. raw := NoMethod(*s)
  755. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  756. }
  757. // Membership: Represents a membership relation in Hangouts Chat.
  758. type Membership struct {
  759. // CreateTime: The creation time of the membership a.k.a the time at
  760. // which the member
  761. // joined the space, if applicable.
  762. CreateTime string `json:"createTime,omitempty"`
  763. // Member: Member details.
  764. Member *User `json:"member,omitempty"`
  765. // Name: Resource name of the membership, in the form
  766. // "spaces/*/members/*".
  767. //
  768. // Example: spaces/AAAAMpdlehY/members/105115627578887013105
  769. Name string `json:"name,omitempty"`
  770. // State: State of the membership.
  771. //
  772. // Possible values:
  773. // "MEMBERSHIP_STATE_UNSPECIFIED" - Default, do not use.
  774. // "JOINED" - The user has joined the space.
  775. // "INVITED" - The user has been invited, is able to join the space,
  776. // but currently has
  777. // not joined.
  778. // "NOT_A_MEMBER" - The user is not a member of the space, has not
  779. // been invited and is not
  780. // able to join the space.
  781. State string `json:"state,omitempty"`
  782. // ServerResponse contains the HTTP response code and headers from the
  783. // server.
  784. googleapi.ServerResponse `json:"-"`
  785. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  786. // unconditionally include in API requests. By default, fields with
  787. // empty values are omitted from API requests. However, any non-pointer,
  788. // non-interface field appearing in ForceSendFields will be sent to the
  789. // server regardless of whether the field is empty or not. This may be
  790. // used to include empty fields in Patch requests.
  791. ForceSendFields []string `json:"-"`
  792. // NullFields is a list of field names (e.g. "CreateTime") to include in
  793. // API requests with the JSON null value. By default, fields with empty
  794. // values are omitted from API requests. However, any field with an
  795. // empty value appearing in NullFields will be sent to the server as
  796. // null. It is an error if a field in this list has a non-empty value.
  797. // This may be used to include null fields in Patch requests.
  798. NullFields []string `json:"-"`
  799. }
  800. func (s *Membership) MarshalJSON() ([]byte, error) {
  801. type NoMethod Membership
  802. raw := NoMethod(*s)
  803. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  804. }
  805. // Message: A message in Hangouts Chat.
  806. type Message struct {
  807. // ActionResponse: Input only. Parameters that a bot can use to
  808. // configure how its response is
  809. // posted.
  810. ActionResponse *ActionResponse `json:"actionResponse,omitempty"`
  811. // Annotations: Output only. Annotations associated with the text in
  812. // this message.
  813. Annotations []*Annotation `json:"annotations,omitempty"`
  814. // ArgumentText: Plain-text body of the message with all bot mentions
  815. // stripped out.
  816. ArgumentText string `json:"argumentText,omitempty"`
  817. // Cards: Rich, formatted and interactive cards that can be used to
  818. // display UI
  819. // elements such as: formatted texts, buttons, clickable images. Cards
  820. // are
  821. // normally displayed below the plain-text body of the message.
  822. Cards []*Card `json:"cards,omitempty"`
  823. // CreateTime: Output only. The time at which the message was created in
  824. // Hangouts Chat
  825. // server.
  826. CreateTime string `json:"createTime,omitempty"`
  827. // FallbackText: A plain-text description of the message's cards, used
  828. // when the actual cards
  829. // cannot be displayed (e.g. mobile notifications).
  830. FallbackText string `json:"fallbackText,omitempty"`
  831. // Name: Resource name, in the form "spaces/*/messages/*".
  832. //
  833. // Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4
  834. Name string `json:"name,omitempty"`
  835. // PreviewText: Text for generating preview chips. This text will not be
  836. // displayed to the
  837. // user, but any links to images, web pages, videos, etc. included here
  838. // will
  839. // generate preview chips.
  840. PreviewText string `json:"previewText,omitempty"`
  841. // Sender: The user who created the message.
  842. Sender *User `json:"sender,omitempty"`
  843. // Space: The space the message belongs to.
  844. Space *Space `json:"space,omitempty"`
  845. // Text: Plain-text body of the message.
  846. Text string `json:"text,omitempty"`
  847. // Thread: The thread the message belongs to.
  848. Thread *Thread `json:"thread,omitempty"`
  849. // ServerResponse contains the HTTP response code and headers from the
  850. // server.
  851. googleapi.ServerResponse `json:"-"`
  852. // ForceSendFields is a list of field names (e.g. "ActionResponse") to
  853. // unconditionally include in API requests. By default, fields with
  854. // empty values are omitted from API requests. However, any non-pointer,
  855. // non-interface field appearing in ForceSendFields will be sent to the
  856. // server regardless of whether the field is empty or not. This may be
  857. // used to include empty fields in Patch requests.
  858. ForceSendFields []string `json:"-"`
  859. // NullFields is a list of field names (e.g. "ActionResponse") to
  860. // include in API requests with the JSON null value. By default, fields
  861. // with empty values are omitted from API requests. However, any field
  862. // with an empty value appearing in NullFields will be sent to the
  863. // server as null. It is an error if a field in this list has a
  864. // non-empty value. This may be used to include null fields in Patch
  865. // requests.
  866. NullFields []string `json:"-"`
  867. }
  868. func (s *Message) MarshalJSON() ([]byte, error) {
  869. type NoMethod Message
  870. raw := NoMethod(*s)
  871. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  872. }
  873. // OnClick: An onclick action (e.g. open a link).
  874. type OnClick struct {
  875. // Action: A form action will be trigger by this onclick if specified.
  876. Action *FormAction `json:"action,omitempty"`
  877. // OpenLink: This onclick triggers an open link action if specified.
  878. OpenLink *OpenLink `json:"openLink,omitempty"`
  879. // ForceSendFields is a list of field names (e.g. "Action") to
  880. // unconditionally include in API requests. By default, fields with
  881. // empty values are omitted from API requests. However, any non-pointer,
  882. // non-interface field appearing in ForceSendFields will be sent to the
  883. // server regardless of whether the field is empty or not. This may be
  884. // used to include empty fields in Patch requests.
  885. ForceSendFields []string `json:"-"`
  886. // NullFields is a list of field names (e.g. "Action") to include in API
  887. // requests with the JSON null value. By default, fields with empty
  888. // values are omitted from API requests. However, any field with an
  889. // empty value appearing in NullFields will be sent to the server as
  890. // null. It is an error if a field in this list has a non-empty value.
  891. // This may be used to include null fields in Patch requests.
  892. NullFields []string `json:"-"`
  893. }
  894. func (s *OnClick) MarshalJSON() ([]byte, error) {
  895. type NoMethod OnClick
  896. raw := NoMethod(*s)
  897. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  898. }
  899. // OpenLink: A link that opens a new window.
  900. type OpenLink struct {
  901. // Url: The URL to open.
  902. Url string `json:"url,omitempty"`
  903. // ForceSendFields is a list of field names (e.g. "Url") to
  904. // unconditionally include in API requests. By default, fields with
  905. // empty values are omitted from API requests. However, any non-pointer,
  906. // non-interface field appearing in ForceSendFields will be sent to the
  907. // server regardless of whether the field is empty or not. This may be
  908. // used to include empty fields in Patch requests.
  909. ForceSendFields []string `json:"-"`
  910. // NullFields is a list of field names (e.g. "Url") to include in API
  911. // requests with the JSON null value. By default, fields with empty
  912. // values are omitted from API requests. However, any field with an
  913. // empty value appearing in NullFields will be sent to the server as
  914. // null. It is an error if a field in this list has a non-empty value.
  915. // This may be used to include null fields in Patch requests.
  916. NullFields []string `json:"-"`
  917. }
  918. func (s *OpenLink) MarshalJSON() ([]byte, error) {
  919. type NoMethod OpenLink
  920. raw := NoMethod(*s)
  921. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  922. }
  923. // Section: A section contains a collection of widgets that are
  924. // rendered
  925. // (vertically) in the order that they are specified. Across all
  926. // platforms,
  927. // cards have a narrow fixed width, so
  928. // there is currently no need for layout properties (e.g. float).
  929. type Section struct {
  930. // Header: The header of the section, text formatted supported.
  931. Header string `json:"header,omitempty"`
  932. // Widgets: A section must contain at least 1 widget.
  933. Widgets []*WidgetMarkup `json:"widgets,omitempty"`
  934. // ForceSendFields is a list of field names (e.g. "Header") to
  935. // unconditionally include in API requests. By default, fields with
  936. // empty values are omitted from API requests. However, any non-pointer,
  937. // non-interface field appearing in ForceSendFields will be sent to the
  938. // server regardless of whether the field is empty or not. This may be
  939. // used to include empty fields in Patch requests.
  940. ForceSendFields []string `json:"-"`
  941. // NullFields is a list of field names (e.g. "Header") to include in API
  942. // requests with the JSON null value. By default, fields with empty
  943. // values are omitted from API requests. However, any field with an
  944. // empty value appearing in NullFields will be sent to the server as
  945. // null. It is an error if a field in this list has a non-empty value.
  946. // This may be used to include null fields in Patch requests.
  947. NullFields []string `json:"-"`
  948. }
  949. func (s *Section) MarshalJSON() ([]byte, error) {
  950. type NoMethod Section
  951. raw := NoMethod(*s)
  952. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  953. }
  954. // Space: A room or DM in Hangouts Chat.
  955. type Space struct {
  956. // DisplayName: Output only. The display name (only if the space is a
  957. // room).
  958. DisplayName string `json:"displayName,omitempty"`
  959. // Name: Resource name of the space, in the form "spaces/*".
  960. //
  961. // Example: spaces/AAAAMpdlehYs
  962. Name string `json:"name,omitempty"`
  963. // Type: Output only. The type of a space.
  964. //
  965. // Possible values:
  966. // "TYPE_UNSPECIFIED"
  967. // "ROOM" - A chat space where memberships are free to change.
  968. // Messages in rooms are
  969. // threaded.
  970. // "DM" - 1:1 Direct Message between a human and a bot, where all
  971. // messages are
  972. // flat.
  973. Type string `json:"type,omitempty"`
  974. // ServerResponse contains the HTTP response code and headers from the
  975. // server.
  976. googleapi.ServerResponse `json:"-"`
  977. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  978. // unconditionally include in API requests. By default, fields with
  979. // empty values are omitted from API requests. However, any non-pointer,
  980. // non-interface field appearing in ForceSendFields will be sent to the
  981. // server regardless of whether the field is empty or not. This may be
  982. // used to include empty fields in Patch requests.
  983. ForceSendFields []string `json:"-"`
  984. // NullFields is a list of field names (e.g. "DisplayName") to include
  985. // in API requests with the JSON null value. By default, fields with
  986. // empty values are omitted from API requests. However, any field with
  987. // an empty value appearing in NullFields will be sent to the server as
  988. // null. It is an error if a field in this list has a non-empty value.
  989. // This may be used to include null fields in Patch requests.
  990. NullFields []string `json:"-"`
  991. }
  992. func (s *Space) MarshalJSON() ([]byte, error) {
  993. type NoMethod Space
  994. raw := NoMethod(*s)
  995. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  996. }
  997. // TextButton: A button with text and onclick action.
  998. type TextButton struct {
  999. // OnClick: The onclick action of the button.
  1000. OnClick *OnClick `json:"onClick,omitempty"`
  1001. // Text: The text of the button.
  1002. Text string `json:"text,omitempty"`
  1003. // ForceSendFields is a list of field names (e.g. "OnClick") to
  1004. // unconditionally include in API requests. By default, fields with
  1005. // empty values are omitted from API requests. However, any non-pointer,
  1006. // non-interface field appearing in ForceSendFields will be sent to the
  1007. // server regardless of whether the field is empty or not. This may be
  1008. // used to include empty fields in Patch requests.
  1009. ForceSendFields []string `json:"-"`
  1010. // NullFields is a list of field names (e.g. "OnClick") to include in
  1011. // API requests with the JSON null value. By default, fields with empty
  1012. // values are omitted from API requests. However, any field with an
  1013. // empty value appearing in NullFields will be sent to the server as
  1014. // null. It is an error if a field in this list has a non-empty value.
  1015. // This may be used to include null fields in Patch requests.
  1016. NullFields []string `json:"-"`
  1017. }
  1018. func (s *TextButton) MarshalJSON() ([]byte, error) {
  1019. type NoMethod TextButton
  1020. raw := NoMethod(*s)
  1021. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1022. }
  1023. // TextParagraph: A paragraph of text. Formatted text supported.
  1024. type TextParagraph struct {
  1025. Text string `json:"text,omitempty"`
  1026. // ForceSendFields is a list of field names (e.g. "Text") to
  1027. // unconditionally include in API requests. By default, fields with
  1028. // empty values are omitted from API requests. However, any non-pointer,
  1029. // non-interface field appearing in ForceSendFields will be sent to the
  1030. // server regardless of whether the field is empty or not. This may be
  1031. // used to include empty fields in Patch requests.
  1032. ForceSendFields []string `json:"-"`
  1033. // NullFields is a list of field names (e.g. "Text") to include in API
  1034. // requests with the JSON null value. By default, fields with empty
  1035. // values are omitted from API requests. However, any field with an
  1036. // empty value appearing in NullFields will be sent to the server as
  1037. // null. It is an error if a field in this list has a non-empty value.
  1038. // This may be used to include null fields in Patch requests.
  1039. NullFields []string `json:"-"`
  1040. }
  1041. func (s *TextParagraph) MarshalJSON() ([]byte, error) {
  1042. type NoMethod TextParagraph
  1043. raw := NoMethod(*s)
  1044. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1045. }
  1046. // Thread: A thread in Hangouts Chat.
  1047. type Thread struct {
  1048. // Name: Resource name, in the form "spaces/*/threads/*".
  1049. //
  1050. // Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4
  1051. Name string `json:"name,omitempty"`
  1052. // ForceSendFields is a list of field names (e.g. "Name") to
  1053. // unconditionally include in API requests. By default, fields with
  1054. // empty values are omitted from API requests. However, any non-pointer,
  1055. // non-interface field appearing in ForceSendFields will be sent to the
  1056. // server regardless of whether the field is empty or not. This may be
  1057. // used to include empty fields in Patch requests.
  1058. ForceSendFields []string `json:"-"`
  1059. // NullFields is a list of field names (e.g. "Name") to include in API
  1060. // requests with the JSON null value. By default, fields with empty
  1061. // values are omitted from API requests. However, any field with an
  1062. // empty value appearing in NullFields will be sent to the server as
  1063. // null. It is an error if a field in this list has a non-empty value.
  1064. // This may be used to include null fields in Patch requests.
  1065. NullFields []string `json:"-"`
  1066. }
  1067. func (s *Thread) MarshalJSON() ([]byte, error) {
  1068. type NoMethod Thread
  1069. raw := NoMethod(*s)
  1070. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1071. }
  1072. // User: A user in Hangouts Chat.
  1073. type User struct {
  1074. // DisplayName: The user's display name.
  1075. DisplayName string `json:"displayName,omitempty"`
  1076. // Name: Resource name, in the format "users/*".
  1077. Name string `json:"name,omitempty"`
  1078. // Type: User type.
  1079. //
  1080. // Possible values:
  1081. // "TYPE_UNSPECIFIED" - Default value for the enum. DO NOT USE.
  1082. // "HUMAN" - Human user.
  1083. // "BOT" - Bot user.
  1084. Type string `json:"type,omitempty"`
  1085. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1086. // unconditionally include in API requests. By default, fields with
  1087. // empty values are omitted from API requests. However, any non-pointer,
  1088. // non-interface field appearing in ForceSendFields will be sent to the
  1089. // server regardless of whether the field is empty or not. This may be
  1090. // used to include empty fields in Patch requests.
  1091. ForceSendFields []string `json:"-"`
  1092. // NullFields is a list of field names (e.g. "DisplayName") to include
  1093. // in API requests with the JSON null value. By default, fields with
  1094. // empty values are omitted from API requests. However, any field with
  1095. // an empty value appearing in NullFields will be sent to the server as
  1096. // null. It is an error if a field in this list has a non-empty value.
  1097. // This may be used to include null fields in Patch requests.
  1098. NullFields []string `json:"-"`
  1099. }
  1100. func (s *User) MarshalJSON() ([]byte, error) {
  1101. type NoMethod User
  1102. raw := NoMethod(*s)
  1103. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1104. }
  1105. // UserMentionMetadata: Annotation metadata for user mentions (@).
  1106. type UserMentionMetadata struct {
  1107. // Type: The type of user mention.
  1108. //
  1109. // Possible values:
  1110. // "TYPE_UNSPECIFIED" - Default value for the enum. DO NOT USE.
  1111. // "ADD" - Add user to space.
  1112. // "MENTION" - Mention user in space.
  1113. Type string `json:"type,omitempty"`
  1114. // User: The user mentioned.
  1115. User *User `json:"user,omitempty"`
  1116. // ForceSendFields is a list of field names (e.g. "Type") to
  1117. // unconditionally include in API requests. By default, fields with
  1118. // empty values are omitted from API requests. However, any non-pointer,
  1119. // non-interface field appearing in ForceSendFields will be sent to the
  1120. // server regardless of whether the field is empty or not. This may be
  1121. // used to include empty fields in Patch requests.
  1122. ForceSendFields []string `json:"-"`
  1123. // NullFields is a list of field names (e.g. "Type") to include in API
  1124. // requests with the JSON null value. By default, fields with empty
  1125. // values are omitted from API requests. However, any field with an
  1126. // empty value appearing in NullFields will be sent to the server as
  1127. // null. It is an error if a field in this list has a non-empty value.
  1128. // This may be used to include null fields in Patch requests.
  1129. NullFields []string `json:"-"`
  1130. }
  1131. func (s *UserMentionMetadata) MarshalJSON() ([]byte, error) {
  1132. type NoMethod UserMentionMetadata
  1133. raw := NoMethod(*s)
  1134. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1135. }
  1136. // WidgetMarkup: A widget is a UI element that presents texts, images,
  1137. // etc.
  1138. type WidgetMarkup struct {
  1139. // Buttons: A list of buttons. Buttons is also oneof data and only one
  1140. // of these
  1141. // fields should be set.
  1142. Buttons []*Button `json:"buttons,omitempty"`
  1143. // Image: Display an image in this widget.
  1144. Image *Image `json:"image,omitempty"`
  1145. // KeyValue: Display a key value item in this widget.
  1146. KeyValue *KeyValue `json:"keyValue,omitempty"`
  1147. // TextParagraph: Display a text paragraph in this widget.
  1148. TextParagraph *TextParagraph `json:"textParagraph,omitempty"`
  1149. // ForceSendFields is a list of field names (e.g. "Buttons") to
  1150. // unconditionally include in API requests. By default, fields with
  1151. // empty values are omitted from API requests. However, any non-pointer,
  1152. // non-interface field appearing in ForceSendFields will be sent to the
  1153. // server regardless of whether the field is empty or not. This may be
  1154. // used to include empty fields in Patch requests.
  1155. ForceSendFields []string `json:"-"`
  1156. // NullFields is a list of field names (e.g. "Buttons") to include in
  1157. // API requests with the JSON null value. By default, fields with empty
  1158. // values are omitted from API requests. However, any field with an
  1159. // empty value appearing in NullFields will be sent to the server as
  1160. // null. It is an error if a field in this list has a non-empty value.
  1161. // This may be used to include null fields in Patch requests.
  1162. NullFields []string `json:"-"`
  1163. }
  1164. func (s *WidgetMarkup) MarshalJSON() ([]byte, error) {
  1165. type NoMethod WidgetMarkup
  1166. raw := NoMethod(*s)
  1167. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1168. }
  1169. // method id "chat.spaces.get":
  1170. type SpacesGetCall struct {
  1171. s *Service
  1172. name string
  1173. urlParams_ gensupport.URLParams
  1174. ifNoneMatch_ string
  1175. ctx_ context.Context
  1176. header_ http.Header
  1177. }
  1178. // Get: Returns a space.
  1179. func (r *SpacesService) Get(name string) *SpacesGetCall {
  1180. c := &SpacesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1181. c.name = name
  1182. return c
  1183. }
  1184. // Fields allows partial responses to be retrieved. See
  1185. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1186. // for more information.
  1187. func (c *SpacesGetCall) Fields(s ...googleapi.Field) *SpacesGetCall {
  1188. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1189. return c
  1190. }
  1191. // IfNoneMatch sets the optional parameter which makes the operation
  1192. // fail if the object's ETag matches the given value. This is useful for
  1193. // getting updates only after the object has changed since the last
  1194. // request. Use googleapi.IsNotModified to check whether the response
  1195. // error from Do is the result of In-None-Match.
  1196. func (c *SpacesGetCall) IfNoneMatch(entityTag string) *SpacesGetCall {
  1197. c.ifNoneMatch_ = entityTag
  1198. return c
  1199. }
  1200. // Context sets the context to be used in this call's Do method. Any
  1201. // pending HTTP request will be aborted if the provided context is
  1202. // canceled.
  1203. func (c *SpacesGetCall) Context(ctx context.Context) *SpacesGetCall {
  1204. c.ctx_ = ctx
  1205. return c
  1206. }
  1207. // Header returns an http.Header that can be modified by the caller to
  1208. // add HTTP headers to the request.
  1209. func (c *SpacesGetCall) Header() http.Header {
  1210. if c.header_ == nil {
  1211. c.header_ = make(http.Header)
  1212. }
  1213. return c.header_
  1214. }
  1215. func (c *SpacesGetCall) doRequest(alt string) (*http.Response, error) {
  1216. reqHeaders := make(http.Header)
  1217. for k, v := range c.header_ {
  1218. reqHeaders[k] = v
  1219. }
  1220. reqHeaders.Set("User-Agent", c.s.userAgent())
  1221. if c.ifNoneMatch_ != "" {
  1222. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1223. }
  1224. var body io.Reader = nil
  1225. c.urlParams_.Set("alt", alt)
  1226. c.urlParams_.Set("prettyPrint", "false")
  1227. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1228. urls += "?" + c.urlParams_.Encode()
  1229. req, err := http.NewRequest("GET", urls, body)
  1230. if err != nil {
  1231. return nil, err
  1232. }
  1233. req.Header = reqHeaders
  1234. googleapi.Expand(req.URL, map[string]string{
  1235. "name": c.name,
  1236. })
  1237. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1238. }
  1239. // Do executes the "chat.spaces.get" call.
  1240. // Exactly one of *Space or error will be non-nil. Any non-2xx status
  1241. // code is an error. Response headers are in either
  1242. // *Space.ServerResponse.Header or (if a response was returned at all)
  1243. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1244. // check whether the returned error was because http.StatusNotModified
  1245. // was returned.
  1246. func (c *SpacesGetCall) Do(opts ...googleapi.CallOption) (*Space, error) {
  1247. gensupport.SetOptions(c.urlParams_, opts...)
  1248. res, err := c.doRequest("json")
  1249. if res != nil && res.StatusCode == http.StatusNotModified {
  1250. if res.Body != nil {
  1251. res.Body.Close()
  1252. }
  1253. return nil, &googleapi.Error{
  1254. Code: res.StatusCode,
  1255. Header: res.Header,
  1256. }
  1257. }
  1258. if err != nil {
  1259. return nil, err
  1260. }
  1261. defer googleapi.CloseBody(res)
  1262. if err := googleapi.CheckResponse(res); err != nil {
  1263. return nil, err
  1264. }
  1265. ret := &Space{
  1266. ServerResponse: googleapi.ServerResponse{
  1267. Header: res.Header,
  1268. HTTPStatusCode: res.StatusCode,
  1269. },
  1270. }
  1271. target := &ret
  1272. if err := gensupport.DecodeResponse(target, res); err != nil {
  1273. return nil, err
  1274. }
  1275. return ret, nil
  1276. // {
  1277. // "description": "Returns a space.",
  1278. // "flatPath": "v1/spaces/{spacesId}",
  1279. // "httpMethod": "GET",
  1280. // "id": "chat.spaces.get",
  1281. // "parameterOrder": [
  1282. // "name"
  1283. // ],
  1284. // "parameters": {
  1285. // "name": {
  1286. // "description": "Required. Resource name of the space, in the form \"spaces/*\".\n\nExample: spaces/AAAAMpdlehY",
  1287. // "location": "path",
  1288. // "pattern": "^spaces/[^/]+$",
  1289. // "required": true,
  1290. // "type": "string"
  1291. // }
  1292. // },
  1293. // "path": "v1/{+name}",
  1294. // "response": {
  1295. // "$ref": "Space"
  1296. // }
  1297. // }
  1298. }
  1299. // method id "chat.spaces.list":
  1300. type SpacesListCall struct {
  1301. s *Service
  1302. urlParams_ gensupport.URLParams
  1303. ifNoneMatch_ string
  1304. ctx_ context.Context
  1305. header_ http.Header
  1306. }
  1307. // List: Lists spaces the caller is a member of.
  1308. func (r *SpacesService) List() *SpacesListCall {
  1309. c := &SpacesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1310. return c
  1311. }
  1312. // PageSize sets the optional parameter "pageSize": Requested page size.
  1313. // The value is capped at 1000.
  1314. // Server may return fewer results than requested.
  1315. // If unspecified, server will default to 100.
  1316. func (c *SpacesListCall) PageSize(pageSize int64) *SpacesListCall {
  1317. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1318. return c
  1319. }
  1320. // PageToken sets the optional parameter "pageToken": A token
  1321. // identifying a page of results the server should return.
  1322. func (c *SpacesListCall) PageToken(pageToken string) *SpacesListCall {
  1323. c.urlParams_.Set("pageToken", pageToken)
  1324. return c
  1325. }
  1326. // Fields allows partial responses to be retrieved. See
  1327. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1328. // for more information.
  1329. func (c *SpacesListCall) Fields(s ...googleapi.Field) *SpacesListCall {
  1330. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1331. return c
  1332. }
  1333. // IfNoneMatch sets the optional parameter which makes the operation
  1334. // fail if the object's ETag matches the given value. This is useful for
  1335. // getting updates only after the object has changed since the last
  1336. // request. Use googleapi.IsNotModified to check whether the response
  1337. // error from Do is the result of In-None-Match.
  1338. func (c *SpacesListCall) IfNoneMatch(entityTag string) *SpacesListCall {
  1339. c.ifNoneMatch_ = entityTag
  1340. return c
  1341. }
  1342. // Context sets the context to be used in this call's Do method. Any
  1343. // pending HTTP request will be aborted if the provided context is
  1344. // canceled.
  1345. func (c *SpacesListCall) Context(ctx context.Context) *SpacesListCall {
  1346. c.ctx_ = ctx
  1347. return c
  1348. }
  1349. // Header returns an http.Header that can be modified by the caller to
  1350. // add HTTP headers to the request.
  1351. func (c *SpacesListCall) Header() http.Header {
  1352. if c.header_ == nil {
  1353. c.header_ = make(http.Header)
  1354. }
  1355. return c.header_
  1356. }
  1357. func (c *SpacesListCall) doRequest(alt string) (*http.Response, error) {
  1358. reqHeaders := make(http.Header)
  1359. for k, v := range c.header_ {
  1360. reqHeaders[k] = v
  1361. }
  1362. reqHeaders.Set("User-Agent", c.s.userAgent())
  1363. if c.ifNoneMatch_ != "" {
  1364. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1365. }
  1366. var body io.Reader = nil
  1367. c.urlParams_.Set("alt", alt)
  1368. c.urlParams_.Set("prettyPrint", "false")
  1369. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/spaces")
  1370. urls += "?" + c.urlParams_.Encode()
  1371. req, err := http.NewRequest("GET", urls, body)
  1372. if err != nil {
  1373. return nil, err
  1374. }
  1375. req.Header = reqHeaders
  1376. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1377. }
  1378. // Do executes the "chat.spaces.list" call.
  1379. // Exactly one of *ListSpacesResponse or error will be non-nil. Any
  1380. // non-2xx status code is an error. Response headers are in either
  1381. // *ListSpacesResponse.ServerResponse.Header or (if a response was
  1382. // returned at all) in error.(*googleapi.Error).Header. Use
  1383. // googleapi.IsNotModified to check whether the returned error was
  1384. // because http.StatusNotModified was returned.
  1385. func (c *SpacesListCall) Do(opts ...googleapi.CallOption) (*ListSpacesResponse, error) {
  1386. gensupport.SetOptions(c.urlParams_, opts...)
  1387. res, err := c.doRequest("json")
  1388. if res != nil && res.StatusCode == http.StatusNotModified {
  1389. if res.Body != nil {
  1390. res.Body.Close()
  1391. }
  1392. return nil, &googleapi.Error{
  1393. Code: res.StatusCode,
  1394. Header: res.Header,
  1395. }
  1396. }
  1397. if err != nil {
  1398. return nil, err
  1399. }
  1400. defer googleapi.CloseBody(res)
  1401. if err := googleapi.CheckResponse(res); err != nil {
  1402. return nil, err
  1403. }
  1404. ret := &ListSpacesResponse{
  1405. ServerResponse: googleapi.ServerResponse{
  1406. Header: res.Header,
  1407. HTTPStatusCode: res.StatusCode,
  1408. },
  1409. }
  1410. target := &ret
  1411. if err := gensupport.DecodeResponse(target, res); err != nil {
  1412. return nil, err
  1413. }
  1414. return ret, nil
  1415. // {
  1416. // "description": "Lists spaces the caller is a member of.",
  1417. // "flatPath": "v1/spaces",
  1418. // "httpMethod": "GET",
  1419. // "id": "chat.spaces.list",
  1420. // "parameterOrder": [],
  1421. // "parameters": {
  1422. // "pageSize": {
  1423. // "description": "Requested page size. The value is capped at 1000.\nServer may return fewer results than requested.\nIf unspecified, server will default to 100.",
  1424. // "format": "int32",
  1425. // "location": "query",
  1426. // "type": "integer"
  1427. // },
  1428. // "pageToken": {
  1429. // "description": "A token identifying a page of results the server should return.",
  1430. // "location": "query",
  1431. // "type": "string"
  1432. // }
  1433. // },
  1434. // "path": "v1/spaces",
  1435. // "response": {
  1436. // "$ref": "ListSpacesResponse"
  1437. // }
  1438. // }
  1439. }
  1440. // Pages invokes f for each page of results.
  1441. // A non-nil error returned from f will halt the iteration.
  1442. // The provided context supersedes any context provided to the Context method.
  1443. func (c *SpacesListCall) Pages(ctx context.Context, f func(*ListSpacesResponse) error) error {
  1444. c.ctx_ = ctx
  1445. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1446. for {
  1447. x, err := c.Do()
  1448. if err != nil {
  1449. return err
  1450. }
  1451. if err := f(x); err != nil {
  1452. return err
  1453. }
  1454. if x.NextPageToken == "" {
  1455. return nil
  1456. }
  1457. c.PageToken(x.NextPageToken)
  1458. }
  1459. }
  1460. // method id "chat.spaces.members.get":
  1461. type SpacesMembersGetCall struct {
  1462. s *Service
  1463. name string
  1464. urlParams_ gensupport.URLParams
  1465. ifNoneMatch_ string
  1466. ctx_ context.Context
  1467. header_ http.Header
  1468. }
  1469. // Get: Returns a membership.
  1470. func (r *SpacesMembersService) Get(name string) *SpacesMembersGetCall {
  1471. c := &SpacesMembersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1472. c.name = name
  1473. return c
  1474. }
  1475. // Fields allows partial responses to be retrieved. See
  1476. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1477. // for more information.
  1478. func (c *SpacesMembersGetCall) Fields(s ...googleapi.Field) *SpacesMembersGetCall {
  1479. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1480. return c
  1481. }
  1482. // IfNoneMatch sets the optional parameter which makes the operation
  1483. // fail if the object's ETag matches the given value. This is useful for
  1484. // getting updates only after the object has changed since the last
  1485. // request. Use googleapi.IsNotModified to check whether the response
  1486. // error from Do is the result of In-None-Match.
  1487. func (c *SpacesMembersGetCall) IfNoneMatch(entityTag string) *SpacesMembersGetCall {
  1488. c.ifNoneMatch_ = entityTag
  1489. return c
  1490. }
  1491. // Context sets the context to be used in this call's Do method. Any
  1492. // pending HTTP request will be aborted if the provided context is
  1493. // canceled.
  1494. func (c *SpacesMembersGetCall) Context(ctx context.Context) *SpacesMembersGetCall {
  1495. c.ctx_ = ctx
  1496. return c
  1497. }
  1498. // Header returns an http.Header that can be modified by the caller to
  1499. // add HTTP headers to the request.
  1500. func (c *SpacesMembersGetCall) Header() http.Header {
  1501. if c.header_ == nil {
  1502. c.header_ = make(http.Header)
  1503. }
  1504. return c.header_
  1505. }
  1506. func (c *SpacesMembersGetCall) doRequest(alt string) (*http.Response, error) {
  1507. reqHeaders := make(http.Header)
  1508. for k, v := range c.header_ {
  1509. reqHeaders[k] = v
  1510. }
  1511. reqHeaders.Set("User-Agent", c.s.userAgent())
  1512. if c.ifNoneMatch_ != "" {
  1513. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1514. }
  1515. var body io.Reader = nil
  1516. c.urlParams_.Set("alt", alt)
  1517. c.urlParams_.Set("prettyPrint", "false")
  1518. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1519. urls += "?" + c.urlParams_.Encode()
  1520. req, err := http.NewRequest("GET", urls, body)
  1521. if err != nil {
  1522. return nil, err
  1523. }
  1524. req.Header = reqHeaders
  1525. googleapi.Expand(req.URL, map[string]string{
  1526. "name": c.name,
  1527. })
  1528. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1529. }
  1530. // Do executes the "chat.spaces.members.get" call.
  1531. // Exactly one of *Membership or error will be non-nil. Any non-2xx
  1532. // status code is an error. Response headers are in either
  1533. // *Membership.ServerResponse.Header or (if a response was returned at
  1534. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1535. // to check whether the returned error was because
  1536. // http.StatusNotModified was returned.
  1537. func (c *SpacesMembersGetCall) Do(opts ...googleapi.CallOption) (*Membership, error) {
  1538. gensupport.SetOptions(c.urlParams_, opts...)
  1539. res, err := c.doRequest("json")
  1540. if res != nil && res.StatusCode == http.StatusNotModified {
  1541. if res.Body != nil {
  1542. res.Body.Close()
  1543. }
  1544. return nil, &googleapi.Error{
  1545. Code: res.StatusCode,
  1546. Header: res.Header,
  1547. }
  1548. }
  1549. if err != nil {
  1550. return nil, err
  1551. }
  1552. defer googleapi.CloseBody(res)
  1553. if err := googleapi.CheckResponse(res); err != nil {
  1554. return nil, err
  1555. }
  1556. ret := &Membership{
  1557. ServerResponse: googleapi.ServerResponse{
  1558. Header: res.Header,
  1559. HTTPStatusCode: res.StatusCode,
  1560. },
  1561. }
  1562. target := &ret
  1563. if err := gensupport.DecodeResponse(target, res); err != nil {
  1564. return nil, err
  1565. }
  1566. return ret, nil
  1567. // {
  1568. // "description": "Returns a membership.",
  1569. // "flatPath": "v1/spaces/{spacesId}/members/{membersId}",
  1570. // "httpMethod": "GET",
  1571. // "id": "chat.spaces.members.get",
  1572. // "parameterOrder": [
  1573. // "name"
  1574. // ],
  1575. // "parameters": {
  1576. // "name": {
  1577. // "description": "Required. Resource name of the membership to be retrieved, in the form\n\"spaces/*/members/*\".\n\nExample: spaces/AAAAMpdlehY/members/105115627578887013105",
  1578. // "location": "path",
  1579. // "pattern": "^spaces/[^/]+/members/[^/]+$",
  1580. // "required": true,
  1581. // "type": "string"
  1582. // }
  1583. // },
  1584. // "path": "v1/{+name}",
  1585. // "response": {
  1586. // "$ref": "Membership"
  1587. // }
  1588. // }
  1589. }
  1590. // method id "chat.spaces.members.list":
  1591. type SpacesMembersListCall struct {
  1592. s *Service
  1593. parent string
  1594. urlParams_ gensupport.URLParams
  1595. ifNoneMatch_ string
  1596. ctx_ context.Context
  1597. header_ http.Header
  1598. }
  1599. // List: Lists human memberships in a space.
  1600. func (r *SpacesMembersService) List(parent string) *SpacesMembersListCall {
  1601. c := &SpacesMembersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1602. c.parent = parent
  1603. return c
  1604. }
  1605. // PageSize sets the optional parameter "pageSize": Requested page size.
  1606. // The value is capped at 1000.
  1607. // Server may return fewer results than requested.
  1608. // If unspecified, server will default to 100.
  1609. func (c *SpacesMembersListCall) PageSize(pageSize int64) *SpacesMembersListCall {
  1610. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1611. return c
  1612. }
  1613. // PageToken sets the optional parameter "pageToken": A token
  1614. // identifying a page of results the server should return.
  1615. func (c *SpacesMembersListCall) PageToken(pageToken string) *SpacesMembersListCall {
  1616. c.urlParams_.Set("pageToken", pageToken)
  1617. return c
  1618. }
  1619. // Fields allows partial responses to be retrieved. See
  1620. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1621. // for more information.
  1622. func (c *SpacesMembersListCall) Fields(s ...googleapi.Field) *SpacesMembersListCall {
  1623. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1624. return c
  1625. }
  1626. // IfNoneMatch sets the optional parameter which makes the operation
  1627. // fail if the object's ETag matches the given value. This is useful for
  1628. // getting updates only after the object has changed since the last
  1629. // request. Use googleapi.IsNotModified to check whether the response
  1630. // error from Do is the result of In-None-Match.
  1631. func (c *SpacesMembersListCall) IfNoneMatch(entityTag string) *SpacesMembersListCall {
  1632. c.ifNoneMatch_ = entityTag
  1633. return c
  1634. }
  1635. // Context sets the context to be used in this call's Do method. Any
  1636. // pending HTTP request will be aborted if the provided context is
  1637. // canceled.
  1638. func (c *SpacesMembersListCall) Context(ctx context.Context) *SpacesMembersListCall {
  1639. c.ctx_ = ctx
  1640. return c
  1641. }
  1642. // Header returns an http.Header that can be modified by the caller to
  1643. // add HTTP headers to the request.
  1644. func (c *SpacesMembersListCall) Header() http.Header {
  1645. if c.header_ == nil {
  1646. c.header_ = make(http.Header)
  1647. }
  1648. return c.header_
  1649. }
  1650. func (c *SpacesMembersListCall) doRequest(alt string) (*http.Response, error) {
  1651. reqHeaders := make(http.Header)
  1652. for k, v := range c.header_ {
  1653. reqHeaders[k] = v
  1654. }
  1655. reqHeaders.Set("User-Agent", c.s.userAgent())
  1656. if c.ifNoneMatch_ != "" {
  1657. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1658. }
  1659. var body io.Reader = nil
  1660. c.urlParams_.Set("alt", alt)
  1661. c.urlParams_.Set("prettyPrint", "false")
  1662. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/members")
  1663. urls += "?" + c.urlParams_.Encode()
  1664. req, err := http.NewRequest("GET", urls, body)
  1665. if err != nil {
  1666. return nil, err
  1667. }
  1668. req.Header = reqHeaders
  1669. googleapi.Expand(req.URL, map[string]string{
  1670. "parent": c.parent,
  1671. })
  1672. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1673. }
  1674. // Do executes the "chat.spaces.members.list" call.
  1675. // Exactly one of *ListMembershipsResponse or error will be non-nil. Any
  1676. // non-2xx status code is an error. Response headers are in either
  1677. // *ListMembershipsResponse.ServerResponse.Header or (if a response was
  1678. // returned at all) in error.(*googleapi.Error).Header. Use
  1679. // googleapi.IsNotModified to check whether the returned error was
  1680. // because http.StatusNotModified was returned.
  1681. func (c *SpacesMembersListCall) Do(opts ...googleapi.CallOption) (*ListMembershipsResponse, error) {
  1682. gensupport.SetOptions(c.urlParams_, opts...)
  1683. res, err := c.doRequest("json")
  1684. if res != nil && res.StatusCode == http.StatusNotModified {
  1685. if res.Body != nil {
  1686. res.Body.Close()
  1687. }
  1688. return nil, &googleapi.Error{
  1689. Code: res.StatusCode,
  1690. Header: res.Header,
  1691. }
  1692. }
  1693. if err != nil {
  1694. return nil, err
  1695. }
  1696. defer googleapi.CloseBody(res)
  1697. if err := googleapi.CheckResponse(res); err != nil {
  1698. return nil, err
  1699. }
  1700. ret := &ListMembershipsResponse{
  1701. ServerResponse: googleapi.ServerResponse{
  1702. Header: res.Header,
  1703. HTTPStatusCode: res.StatusCode,
  1704. },
  1705. }
  1706. target := &ret
  1707. if err := gensupport.DecodeResponse(target, res); err != nil {
  1708. return nil, err
  1709. }
  1710. return ret, nil
  1711. // {
  1712. // "description": "Lists human memberships in a space.",
  1713. // "flatPath": "v1/spaces/{spacesId}/members",
  1714. // "httpMethod": "GET",
  1715. // "id": "chat.spaces.members.list",
  1716. // "parameterOrder": [
  1717. // "parent"
  1718. // ],
  1719. // "parameters": {
  1720. // "pageSize": {
  1721. // "description": "Requested page size. The value is capped at 1000.\nServer may return fewer results than requested.\nIf unspecified, server will default to 100.",
  1722. // "format": "int32",
  1723. // "location": "query",
  1724. // "type": "integer"
  1725. // },
  1726. // "pageToken": {
  1727. // "description": "A token identifying a page of results the server should return.",
  1728. // "location": "query",
  1729. // "type": "string"
  1730. // },
  1731. // "parent": {
  1732. // "description": "Required. The resource name of the space for which membership list is to be\nfetched, in the form \"spaces/*\".\n\nExample: spaces/AAAAMpdlehY",
  1733. // "location": "path",
  1734. // "pattern": "^spaces/[^/]+$",
  1735. // "required": true,
  1736. // "type": "string"
  1737. // }
  1738. // },
  1739. // "path": "v1/{+parent}/members",
  1740. // "response": {
  1741. // "$ref": "ListMembershipsResponse"
  1742. // }
  1743. // }
  1744. }
  1745. // Pages invokes f for each page of results.
  1746. // A non-nil error returned from f will halt the iteration.
  1747. // The provided context supersedes any context provided to the Context method.
  1748. func (c *SpacesMembersListCall) Pages(ctx context.Context, f func(*ListMembershipsResponse) error) error {
  1749. c.ctx_ = ctx
  1750. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1751. for {
  1752. x, err := c.Do()
  1753. if err != nil {
  1754. return err
  1755. }
  1756. if err := f(x); err != nil {
  1757. return err
  1758. }
  1759. if x.NextPageToken == "" {
  1760. return nil
  1761. }
  1762. c.PageToken(x.NextPageToken)
  1763. }
  1764. }
  1765. // method id "chat.spaces.messages.create":
  1766. type SpacesMessagesCreateCall struct {
  1767. s *Service
  1768. parent string
  1769. message *Message
  1770. urlParams_ gensupport.URLParams
  1771. ctx_ context.Context
  1772. header_ http.Header
  1773. }
  1774. // Create: Creates a message.
  1775. func (r *SpacesMessagesService) Create(parent string, message *Message) *SpacesMessagesCreateCall {
  1776. c := &SpacesMessagesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1777. c.parent = parent
  1778. c.message = message
  1779. return c
  1780. }
  1781. // ThreadKey sets the optional parameter "threadKey": Opaque thread
  1782. // identifier string that can be specified to group messages
  1783. // into a single thread. If this is the first message with a given
  1784. // thread
  1785. // identifier, a new thread is created. Subsequent messages with the
  1786. // same
  1787. // thread identifier will be posted into the same thread. This relieves
  1788. // bots
  1789. // and webhooks from having to store the Hangouts Chat thread ID of a
  1790. // thread (created earlier by them) to post
  1791. // further updates to it.
  1792. //
  1793. // Has no effect if thread field,
  1794. // corresponding to an existing thread, is set in message.
  1795. func (c *SpacesMessagesCreateCall) ThreadKey(threadKey string) *SpacesMessagesCreateCall {
  1796. c.urlParams_.Set("threadKey", threadKey)
  1797. return c
  1798. }
  1799. // Fields allows partial responses to be retrieved. See
  1800. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1801. // for more information.
  1802. func (c *SpacesMessagesCreateCall) Fields(s ...googleapi.Field) *SpacesMessagesCreateCall {
  1803. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1804. return c
  1805. }
  1806. // Context sets the context to be used in this call's Do method. Any
  1807. // pending HTTP request will be aborted if the provided context is
  1808. // canceled.
  1809. func (c *SpacesMessagesCreateCall) Context(ctx context.Context) *SpacesMessagesCreateCall {
  1810. c.ctx_ = ctx
  1811. return c
  1812. }
  1813. // Header returns an http.Header that can be modified by the caller to
  1814. // add HTTP headers to the request.
  1815. func (c *SpacesMessagesCreateCall) Header() http.Header {
  1816. if c.header_ == nil {
  1817. c.header_ = make(http.Header)
  1818. }
  1819. return c.header_
  1820. }
  1821. func (c *SpacesMessagesCreateCall) doRequest(alt string) (*http.Response, error) {
  1822. reqHeaders := make(http.Header)
  1823. for k, v := range c.header_ {
  1824. reqHeaders[k] = v
  1825. }
  1826. reqHeaders.Set("User-Agent", c.s.userAgent())
  1827. var body io.Reader = nil
  1828. body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
  1829. if err != nil {
  1830. return nil, err
  1831. }
  1832. reqHeaders.Set("Content-Type", "application/json")
  1833. c.urlParams_.Set("alt", alt)
  1834. c.urlParams_.Set("prettyPrint", "false")
  1835. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/messages")
  1836. urls += "?" + c.urlParams_.Encode()
  1837. req, err := http.NewRequest("POST", urls, body)
  1838. if err != nil {
  1839. return nil, err
  1840. }
  1841. req.Header = reqHeaders
  1842. googleapi.Expand(req.URL, map[string]string{
  1843. "parent": c.parent,
  1844. })
  1845. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1846. }
  1847. // Do executes the "chat.spaces.messages.create" call.
  1848. // Exactly one of *Message or error will be non-nil. Any non-2xx status
  1849. // code is an error. Response headers are in either
  1850. // *Message.ServerResponse.Header or (if a response was returned at all)
  1851. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1852. // check whether the returned error was because http.StatusNotModified
  1853. // was returned.
  1854. func (c *SpacesMessagesCreateCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  1855. gensupport.SetOptions(c.urlParams_, opts...)
  1856. res, err := c.doRequest("json")
  1857. if res != nil && res.StatusCode == http.StatusNotModified {
  1858. if res.Body != nil {
  1859. res.Body.Close()
  1860. }
  1861. return nil, &googleapi.Error{
  1862. Code: res.StatusCode,
  1863. Header: res.Header,
  1864. }
  1865. }
  1866. if err != nil {
  1867. return nil, err
  1868. }
  1869. defer googleapi.CloseBody(res)
  1870. if err := googleapi.CheckResponse(res); err != nil {
  1871. return nil, err
  1872. }
  1873. ret := &Message{
  1874. ServerResponse: googleapi.ServerResponse{
  1875. Header: res.Header,
  1876. HTTPStatusCode: res.StatusCode,
  1877. },
  1878. }
  1879. target := &ret
  1880. if err := gensupport.DecodeResponse(target, res); err != nil {
  1881. return nil, err
  1882. }
  1883. return ret, nil
  1884. // {
  1885. // "description": "Creates a message.",
  1886. // "flatPath": "v1/spaces/{spacesId}/messages",
  1887. // "httpMethod": "POST",
  1888. // "id": "chat.spaces.messages.create",
  1889. // "parameterOrder": [
  1890. // "parent"
  1891. // ],
  1892. // "parameters": {
  1893. // "parent": {
  1894. // "description": "Required. Space resource name, in the form \"spaces/*\".\nExample: spaces/AAAAMpdlehY",
  1895. // "location": "path",
  1896. // "pattern": "^spaces/[^/]+$",
  1897. // "required": true,
  1898. // "type": "string"
  1899. // },
  1900. // "threadKey": {
  1901. // "description": "Opaque thread identifier string that can be specified to group messages\ninto a single thread. If this is the first message with a given thread\nidentifier, a new thread is created. Subsequent messages with the same\nthread identifier will be posted into the same thread. This relieves bots\nand webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post\nfurther updates to it.\n\nHas no effect if thread field,\ncorresponding to an existing thread, is set in message.",
  1902. // "location": "query",
  1903. // "type": "string"
  1904. // }
  1905. // },
  1906. // "path": "v1/{+parent}/messages",
  1907. // "request": {
  1908. // "$ref": "Message"
  1909. // },
  1910. // "response": {
  1911. // "$ref": "Message"
  1912. // }
  1913. // }
  1914. }
  1915. // method id "chat.spaces.messages.delete":
  1916. type SpacesMessagesDeleteCall struct {
  1917. s *Service
  1918. name string
  1919. urlParams_ gensupport.URLParams
  1920. ctx_ context.Context
  1921. header_ http.Header
  1922. }
  1923. // Delete: Deletes a message.
  1924. func (r *SpacesMessagesService) Delete(name string) *SpacesMessagesDeleteCall {
  1925. c := &SpacesMessagesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1926. c.name = name
  1927. return c
  1928. }
  1929. // Fields allows partial responses to be retrieved. See
  1930. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1931. // for more information.
  1932. func (c *SpacesMessagesDeleteCall) Fields(s ...googleapi.Field) *SpacesMessagesDeleteCall {
  1933. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1934. return c
  1935. }
  1936. // Context sets the context to be used in this call's Do method. Any
  1937. // pending HTTP request will be aborted if the provided context is
  1938. // canceled.
  1939. func (c *SpacesMessagesDeleteCall) Context(ctx context.Context) *SpacesMessagesDeleteCall {
  1940. c.ctx_ = ctx
  1941. return c
  1942. }
  1943. // Header returns an http.Header that can be modified by the caller to
  1944. // add HTTP headers to the request.
  1945. func (c *SpacesMessagesDeleteCall) Header() http.Header {
  1946. if c.header_ == nil {
  1947. c.header_ = make(http.Header)
  1948. }
  1949. return c.header_
  1950. }
  1951. func (c *SpacesMessagesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1952. reqHeaders := make(http.Header)
  1953. for k, v := range c.header_ {
  1954. reqHeaders[k] = v
  1955. }
  1956. reqHeaders.Set("User-Agent", c.s.userAgent())
  1957. var body io.Reader = nil
  1958. c.urlParams_.Set("alt", alt)
  1959. c.urlParams_.Set("prettyPrint", "false")
  1960. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1961. urls += "?" + c.urlParams_.Encode()
  1962. req, err := http.NewRequest("DELETE", urls, body)
  1963. if err != nil {
  1964. return nil, err
  1965. }
  1966. req.Header = reqHeaders
  1967. googleapi.Expand(req.URL, map[string]string{
  1968. "name": c.name,
  1969. })
  1970. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1971. }
  1972. // Do executes the "chat.spaces.messages.delete" call.
  1973. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1974. // code is an error. Response headers are in either
  1975. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1976. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1977. // check whether the returned error was because http.StatusNotModified
  1978. // was returned.
  1979. func (c *SpacesMessagesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1980. gensupport.SetOptions(c.urlParams_, opts...)
  1981. res, err := c.doRequest("json")
  1982. if res != nil && res.StatusCode == http.StatusNotModified {
  1983. if res.Body != nil {
  1984. res.Body.Close()
  1985. }
  1986. return nil, &googleapi.Error{
  1987. Code: res.StatusCode,
  1988. Header: res.Header,
  1989. }
  1990. }
  1991. if err != nil {
  1992. return nil, err
  1993. }
  1994. defer googleapi.CloseBody(res)
  1995. if err := googleapi.CheckResponse(res); err != nil {
  1996. return nil, err
  1997. }
  1998. ret := &Empty{
  1999. ServerResponse: googleapi.ServerResponse{
  2000. Header: res.Header,
  2001. HTTPStatusCode: res.StatusCode,
  2002. },
  2003. }
  2004. target := &ret
  2005. if err := gensupport.DecodeResponse(target, res); err != nil {
  2006. return nil, err
  2007. }
  2008. return ret, nil
  2009. // {
  2010. // "description": "Deletes a message.",
  2011. // "flatPath": "v1/spaces/{spacesId}/messages/{messagesId}",
  2012. // "httpMethod": "DELETE",
  2013. // "id": "chat.spaces.messages.delete",
  2014. // "parameterOrder": [
  2015. // "name"
  2016. // ],
  2017. // "parameters": {
  2018. // "name": {
  2019. // "description": "Required. Resource name of the message to be deleted, in the form\n\"spaces/*/messages/*\"\n\nExample: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4",
  2020. // "location": "path",
  2021. // "pattern": "^spaces/[^/]+/messages/[^/]+$",
  2022. // "required": true,
  2023. // "type": "string"
  2024. // }
  2025. // },
  2026. // "path": "v1/{+name}",
  2027. // "response": {
  2028. // "$ref": "Empty"
  2029. // }
  2030. // }
  2031. }
  2032. // method id "chat.spaces.messages.get":
  2033. type SpacesMessagesGetCall struct {
  2034. s *Service
  2035. name string
  2036. urlParams_ gensupport.URLParams
  2037. ifNoneMatch_ string
  2038. ctx_ context.Context
  2039. header_ http.Header
  2040. }
  2041. // Get: Returns a message.
  2042. func (r *SpacesMessagesService) Get(name string) *SpacesMessagesGetCall {
  2043. c := &SpacesMessagesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2044. c.name = name
  2045. return c
  2046. }
  2047. // Fields allows partial responses to be retrieved. See
  2048. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2049. // for more information.
  2050. func (c *SpacesMessagesGetCall) Fields(s ...googleapi.Field) *SpacesMessagesGetCall {
  2051. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2052. return c
  2053. }
  2054. // IfNoneMatch sets the optional parameter which makes the operation
  2055. // fail if the object's ETag matches the given value. This is useful for
  2056. // getting updates only after the object has changed since the last
  2057. // request. Use googleapi.IsNotModified to check whether the response
  2058. // error from Do is the result of In-None-Match.
  2059. func (c *SpacesMessagesGetCall) IfNoneMatch(entityTag string) *SpacesMessagesGetCall {
  2060. c.ifNoneMatch_ = entityTag
  2061. return c
  2062. }
  2063. // Context sets the context to be used in this call's Do method. Any
  2064. // pending HTTP request will be aborted if the provided context is
  2065. // canceled.
  2066. func (c *SpacesMessagesGetCall) Context(ctx context.Context) *SpacesMessagesGetCall {
  2067. c.ctx_ = ctx
  2068. return c
  2069. }
  2070. // Header returns an http.Header that can be modified by the caller to
  2071. // add HTTP headers to the request.
  2072. func (c *SpacesMessagesGetCall) Header() http.Header {
  2073. if c.header_ == nil {
  2074. c.header_ = make(http.Header)
  2075. }
  2076. return c.header_
  2077. }
  2078. func (c *SpacesMessagesGetCall) doRequest(alt string) (*http.Response, error) {
  2079. reqHeaders := make(http.Header)
  2080. for k, v := range c.header_ {
  2081. reqHeaders[k] = v
  2082. }
  2083. reqHeaders.Set("User-Agent", c.s.userAgent())
  2084. if c.ifNoneMatch_ != "" {
  2085. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2086. }
  2087. var body io.Reader = nil
  2088. c.urlParams_.Set("alt", alt)
  2089. c.urlParams_.Set("prettyPrint", "false")
  2090. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2091. urls += "?" + c.urlParams_.Encode()
  2092. req, err := http.NewRequest("GET", urls, body)
  2093. if err != nil {
  2094. return nil, err
  2095. }
  2096. req.Header = reqHeaders
  2097. googleapi.Expand(req.URL, map[string]string{
  2098. "name": c.name,
  2099. })
  2100. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2101. }
  2102. // Do executes the "chat.spaces.messages.get" call.
  2103. // Exactly one of *Message or error will be non-nil. Any non-2xx status
  2104. // code is an error. Response headers are in either
  2105. // *Message.ServerResponse.Header or (if a response was returned at all)
  2106. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2107. // check whether the returned error was because http.StatusNotModified
  2108. // was returned.
  2109. func (c *SpacesMessagesGetCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  2110. gensupport.SetOptions(c.urlParams_, opts...)
  2111. res, err := c.doRequest("json")
  2112. if res != nil && res.StatusCode == http.StatusNotModified {
  2113. if res.Body != nil {
  2114. res.Body.Close()
  2115. }
  2116. return nil, &googleapi.Error{
  2117. Code: res.StatusCode,
  2118. Header: res.Header,
  2119. }
  2120. }
  2121. if err != nil {
  2122. return nil, err
  2123. }
  2124. defer googleapi.CloseBody(res)
  2125. if err := googleapi.CheckResponse(res); err != nil {
  2126. return nil, err
  2127. }
  2128. ret := &Message{
  2129. ServerResponse: googleapi.ServerResponse{
  2130. Header: res.Header,
  2131. HTTPStatusCode: res.StatusCode,
  2132. },
  2133. }
  2134. target := &ret
  2135. if err := gensupport.DecodeResponse(target, res); err != nil {
  2136. return nil, err
  2137. }
  2138. return ret, nil
  2139. // {
  2140. // "description": "Returns a message.",
  2141. // "flatPath": "v1/spaces/{spacesId}/messages/{messagesId}",
  2142. // "httpMethod": "GET",
  2143. // "id": "chat.spaces.messages.get",
  2144. // "parameterOrder": [
  2145. // "name"
  2146. // ],
  2147. // "parameters": {
  2148. // "name": {
  2149. // "description": "Required. Resource name of the message to be retrieved, in the form\n\"spaces/*/messages/*\".\n\nExample: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4",
  2150. // "location": "path",
  2151. // "pattern": "^spaces/[^/]+/messages/[^/]+$",
  2152. // "required": true,
  2153. // "type": "string"
  2154. // }
  2155. // },
  2156. // "path": "v1/{+name}",
  2157. // "response": {
  2158. // "$ref": "Message"
  2159. // }
  2160. // }
  2161. }
  2162. // method id "chat.spaces.messages.update":
  2163. type SpacesMessagesUpdateCall struct {
  2164. s *Service
  2165. name string
  2166. message *Message
  2167. urlParams_ gensupport.URLParams
  2168. ctx_ context.Context
  2169. header_ http.Header
  2170. }
  2171. // Update: Updates a message.
  2172. func (r *SpacesMessagesService) Update(name string, message *Message) *SpacesMessagesUpdateCall {
  2173. c := &SpacesMessagesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2174. c.name = name
  2175. c.message = message
  2176. return c
  2177. }
  2178. // UpdateMask sets the optional parameter "updateMask": Required. The
  2179. // field paths to be updated.
  2180. //
  2181. // Currently supported field paths: "text", "cards".
  2182. func (c *SpacesMessagesUpdateCall) UpdateMask(updateMask string) *SpacesMessagesUpdateCall {
  2183. c.urlParams_.Set("updateMask", updateMask)
  2184. return c
  2185. }
  2186. // Fields allows partial responses to be retrieved. See
  2187. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2188. // for more information.
  2189. func (c *SpacesMessagesUpdateCall) Fields(s ...googleapi.Field) *SpacesMessagesUpdateCall {
  2190. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2191. return c
  2192. }
  2193. // Context sets the context to be used in this call's Do method. Any
  2194. // pending HTTP request will be aborted if the provided context is
  2195. // canceled.
  2196. func (c *SpacesMessagesUpdateCall) Context(ctx context.Context) *SpacesMessagesUpdateCall {
  2197. c.ctx_ = ctx
  2198. return c
  2199. }
  2200. // Header returns an http.Header that can be modified by the caller to
  2201. // add HTTP headers to the request.
  2202. func (c *SpacesMessagesUpdateCall) Header() http.Header {
  2203. if c.header_ == nil {
  2204. c.header_ = make(http.Header)
  2205. }
  2206. return c.header_
  2207. }
  2208. func (c *SpacesMessagesUpdateCall) doRequest(alt string) (*http.Response, error) {
  2209. reqHeaders := make(http.Header)
  2210. for k, v := range c.header_ {
  2211. reqHeaders[k] = v
  2212. }
  2213. reqHeaders.Set("User-Agent", c.s.userAgent())
  2214. var body io.Reader = nil
  2215. body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
  2216. if err != nil {
  2217. return nil, err
  2218. }
  2219. reqHeaders.Set("Content-Type", "application/json")
  2220. c.urlParams_.Set("alt", alt)
  2221. c.urlParams_.Set("prettyPrint", "false")
  2222. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2223. urls += "?" + c.urlParams_.Encode()
  2224. req, err := http.NewRequest("PUT", urls, body)
  2225. if err != nil {
  2226. return nil, err
  2227. }
  2228. req.Header = reqHeaders
  2229. googleapi.Expand(req.URL, map[string]string{
  2230. "name": c.name,
  2231. })
  2232. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2233. }
  2234. // Do executes the "chat.spaces.messages.update" call.
  2235. // Exactly one of *Message or error will be non-nil. Any non-2xx status
  2236. // code is an error. Response headers are in either
  2237. // *Message.ServerResponse.Header or (if a response was returned at all)
  2238. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2239. // check whether the returned error was because http.StatusNotModified
  2240. // was returned.
  2241. func (c *SpacesMessagesUpdateCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  2242. gensupport.SetOptions(c.urlParams_, opts...)
  2243. res, err := c.doRequest("json")
  2244. if res != nil && res.StatusCode == http.StatusNotModified {
  2245. if res.Body != nil {
  2246. res.Body.Close()
  2247. }
  2248. return nil, &googleapi.Error{
  2249. Code: res.StatusCode,
  2250. Header: res.Header,
  2251. }
  2252. }
  2253. if err != nil {
  2254. return nil, err
  2255. }
  2256. defer googleapi.CloseBody(res)
  2257. if err := googleapi.CheckResponse(res); err != nil {
  2258. return nil, err
  2259. }
  2260. ret := &Message{
  2261. ServerResponse: googleapi.ServerResponse{
  2262. Header: res.Header,
  2263. HTTPStatusCode: res.StatusCode,
  2264. },
  2265. }
  2266. target := &ret
  2267. if err := gensupport.DecodeResponse(target, res); err != nil {
  2268. return nil, err
  2269. }
  2270. return ret, nil
  2271. // {
  2272. // "description": "Updates a message.",
  2273. // "flatPath": "v1/spaces/{spacesId}/messages/{messagesId}",
  2274. // "httpMethod": "PUT",
  2275. // "id": "chat.spaces.messages.update",
  2276. // "parameterOrder": [
  2277. // "name"
  2278. // ],
  2279. // "parameters": {
  2280. // "name": {
  2281. // "description": "Resource name, in the form \"spaces/*/messages/*\".\n\nExample: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4",
  2282. // "location": "path",
  2283. // "pattern": "^spaces/[^/]+/messages/[^/]+$",
  2284. // "required": true,
  2285. // "type": "string"
  2286. // },
  2287. // "updateMask": {
  2288. // "description": "Required. The field paths to be updated.\n\nCurrently supported field paths: \"text\", \"cards\".",
  2289. // "format": "google-fieldmask",
  2290. // "location": "query",
  2291. // "type": "string"
  2292. // }
  2293. // },
  2294. // "path": "v1/{+name}",
  2295. // "request": {
  2296. // "$ref": "Message"
  2297. // },
  2298. // "response": {
  2299. // "$ref": "Message"
  2300. // }
  2301. // }
  2302. }