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

2493 rivejä
84 KiB

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