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.
 
 
 

3027 lines
101 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package pubsub provides access to the Cloud Pub/Sub API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/pubsub instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/pubsub/docs
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/pubsub/v1beta1a"
  16. // ...
  17. // ctx := context.Background()
  18. // pubsubService, err := pubsub.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // pubsubService, err := pubsub.NewService(ctx, option.WithScopes(pubsub.PubsubScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // pubsubService, err := pubsub.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // pubsubService, err := pubsub.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package pubsub // import "google.golang.org/api/pubsub/v1beta1a"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "pubsub:v1beta1a"
  73. const apiName = "pubsub"
  74. const apiVersion = "v1beta1a"
  75. const basePath = "https://pubsub.googleapis.com/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data across Google Cloud Platform services
  79. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  80. // View and manage Pub/Sub topics and subscriptions
  81. PubsubScope = "https://www.googleapis.com/auth/pubsub"
  82. )
  83. // NewService creates a new Service.
  84. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  85. scopesOption := option.WithScopes(
  86. "https://www.googleapis.com/auth/cloud-platform",
  87. "https://www.googleapis.com/auth/pubsub",
  88. )
  89. // NOTE: prepend, so we don't override user-specified scopes.
  90. opts = append([]option.ClientOption{scopesOption}, opts...)
  91. client, endpoint, err := htransport.NewClient(ctx, opts...)
  92. if err != nil {
  93. return nil, err
  94. }
  95. s, err := New(client)
  96. if err != nil {
  97. return nil, err
  98. }
  99. if endpoint != "" {
  100. s.BasePath = endpoint
  101. }
  102. return s, nil
  103. }
  104. // New creates a new Service. It uses the provided http.Client for requests.
  105. //
  106. // Deprecated: please use NewService instead.
  107. // To provide a custom HTTP client, use option.WithHTTPClient.
  108. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  109. func New(client *http.Client) (*Service, error) {
  110. if client == nil {
  111. return nil, errors.New("client is nil")
  112. }
  113. s := &Service{client: client, BasePath: basePath}
  114. s.Subscriptions = NewSubscriptionsService(s)
  115. s.Topics = NewTopicsService(s)
  116. return s, nil
  117. }
  118. type Service struct {
  119. client *http.Client
  120. BasePath string // API endpoint base URL
  121. UserAgent string // optional additional User-Agent fragment
  122. Subscriptions *SubscriptionsService
  123. Topics *TopicsService
  124. }
  125. func (s *Service) userAgent() string {
  126. if s.UserAgent == "" {
  127. return googleapi.UserAgent
  128. }
  129. return googleapi.UserAgent + " " + s.UserAgent
  130. }
  131. func NewSubscriptionsService(s *Service) *SubscriptionsService {
  132. rs := &SubscriptionsService{s: s}
  133. return rs
  134. }
  135. type SubscriptionsService struct {
  136. s *Service
  137. }
  138. func NewTopicsService(s *Service) *TopicsService {
  139. rs := &TopicsService{s: s}
  140. return rs
  141. }
  142. type TopicsService struct {
  143. s *Service
  144. }
  145. // AcknowledgeRequest: Request for the Acknowledge method.
  146. type AcknowledgeRequest struct {
  147. // AckId: The acknowledgment ID for the message being acknowledged. This
  148. // was
  149. // returned by the Pub/Sub system in the Pull response.
  150. AckId []string `json:"ackId,omitempty"`
  151. // Subscription: The subscription whose message is being acknowledged.
  152. Subscription string `json:"subscription,omitempty"`
  153. // ForceSendFields is a list of field names (e.g. "AckId") to
  154. // unconditionally include in API requests. By default, fields with
  155. // empty values are omitted from API requests. However, any non-pointer,
  156. // non-interface field appearing in ForceSendFields will be sent to the
  157. // server regardless of whether the field is empty or not. This may be
  158. // used to include empty fields in Patch requests.
  159. ForceSendFields []string `json:"-"`
  160. // NullFields is a list of field names (e.g. "AckId") to include in API
  161. // requests with the JSON null value. By default, fields with empty
  162. // values are omitted from API requests. However, any field with an
  163. // empty value appearing in NullFields will be sent to the server as
  164. // null. It is an error if a field in this list has a non-empty value.
  165. // This may be used to include null fields in Patch requests.
  166. NullFields []string `json:"-"`
  167. }
  168. func (s *AcknowledgeRequest) MarshalJSON() ([]byte, error) {
  169. type NoMethod AcknowledgeRequest
  170. raw := NoMethod(*s)
  171. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  172. }
  173. // Empty: An empty message that you can re-use to avoid defining
  174. // duplicated empty
  175. // messages in your project. A typical example is to use it as argument
  176. // or the
  177. // return value of a service API. For instance:
  178. //
  179. // service Foo {
  180. // rpc Bar (proto2.Empty) returns (proto2.Empty) { };
  181. // };
  182. //
  183. // BEGIN GOOGLE-INTERNAL
  184. // The difference between this one and net/rpc/empty-message.proto is
  185. // that
  186. // 1) The generated message here is in proto2 C++ API.
  187. // 2) The proto2.Empty has minimum dependencies
  188. // (no message_set or net/rpc dependencies)
  189. // END GOOGLE-INTERNAL
  190. type Empty struct {
  191. // ServerResponse contains the HTTP response code and headers from the
  192. // server.
  193. googleapi.ServerResponse `json:"-"`
  194. }
  195. // Label: A key-value pair applied to a given object.
  196. type Label struct {
  197. // Key: The key of a label is a syntactically valid URL (as per RFC
  198. // 1738) with
  199. // the "scheme" and initial slashes omitted and with the
  200. // additional
  201. // restrictions noted below. Each key should be globally unique.
  202. // The
  203. // "host" portion is called the "namespace" and is not
  204. // necessarily
  205. // resolvable to a network endpoint. Instead, the namespace indicates
  206. // what
  207. // system or entity defines the semantics of the label. Namespaces do
  208. // not
  209. // restrict the set of objects to which a label may be associated.
  210. //
  211. // Keys are defined by the following grammar:
  212. //
  213. // key = hostname "/" kpath
  214. // kpath = ksegment *[ "/" ksegment ]
  215. // ksegment = alphadigit | *[ alphadigit | "-" | "_" | "."
  216. // ]
  217. //
  218. // where "hostname" and "alphadigit" are defined as in RFC
  219. // 1738.
  220. //
  221. // Example key:
  222. // spanner.google.com/universe
  223. Key string `json:"key,omitempty"`
  224. // NumValue: An integer value.
  225. NumValue int64 `json:"numValue,omitempty,string"`
  226. // StrValue: A string value.
  227. StrValue string `json:"strValue,omitempty"`
  228. // ForceSendFields is a list of field names (e.g. "Key") to
  229. // unconditionally include in API requests. By default, fields with
  230. // empty values are omitted from API requests. However, any non-pointer,
  231. // non-interface field appearing in ForceSendFields will be sent to the
  232. // server regardless of whether the field is empty or not. This may be
  233. // used to include empty fields in Patch requests.
  234. ForceSendFields []string `json:"-"`
  235. // NullFields is a list of field names (e.g. "Key") to include in API
  236. // requests with the JSON null value. By default, fields with empty
  237. // values are omitted from API requests. However, any field with an
  238. // empty value appearing in NullFields will be sent to the server as
  239. // null. It is an error if a field in this list has a non-empty value.
  240. // This may be used to include null fields in Patch requests.
  241. NullFields []string `json:"-"`
  242. }
  243. func (s *Label) MarshalJSON() ([]byte, error) {
  244. type NoMethod Label
  245. raw := NoMethod(*s)
  246. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  247. }
  248. // ListSubscriptionsResponse: Response for the ListSubscriptions method.
  249. type ListSubscriptionsResponse struct {
  250. // NextPageToken: If not empty, indicates that there are more
  251. // subscriptions that match the
  252. // request and this value should be passed to the
  253. // next
  254. // <code>ListSubscriptionsRequest</code> to continue.
  255. NextPageToken string `json:"nextPageToken,omitempty"`
  256. // Subscription: The subscriptions that match the request.
  257. Subscription []*Subscription `json:"subscription,omitempty"`
  258. // ServerResponse contains the HTTP response code and headers from the
  259. // server.
  260. googleapi.ServerResponse `json:"-"`
  261. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  262. // unconditionally include in API requests. By default, fields with
  263. // empty values are omitted from API requests. However, any non-pointer,
  264. // non-interface field appearing in ForceSendFields will be sent to the
  265. // server regardless of whether the field is empty or not. This may be
  266. // used to include empty fields in Patch requests.
  267. ForceSendFields []string `json:"-"`
  268. // NullFields is a list of field names (e.g. "NextPageToken") to include
  269. // in API requests with the JSON null value. By default, fields with
  270. // empty values are omitted from API requests. However, any field with
  271. // an empty value appearing in NullFields will be sent to the server as
  272. // null. It is an error if a field in this list has a non-empty value.
  273. // This may be used to include null fields in Patch requests.
  274. NullFields []string `json:"-"`
  275. }
  276. func (s *ListSubscriptionsResponse) MarshalJSON() ([]byte, error) {
  277. type NoMethod ListSubscriptionsResponse
  278. raw := NoMethod(*s)
  279. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  280. }
  281. // ListTopicsResponse: Response for the ListTopics method.
  282. type ListTopicsResponse struct {
  283. // NextPageToken: If not empty, indicates that there are more topics
  284. // that match the request,
  285. // and this value should be passed to the next
  286. // <code>ListTopicsRequest</code>
  287. // to continue.
  288. NextPageToken string `json:"nextPageToken,omitempty"`
  289. // Topic: The resulting topics.
  290. Topic []*Topic `json:"topic,omitempty"`
  291. // ServerResponse contains the HTTP response code and headers from the
  292. // server.
  293. googleapi.ServerResponse `json:"-"`
  294. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  295. // unconditionally include in API requests. By default, fields with
  296. // empty values are omitted from API requests. However, any non-pointer,
  297. // non-interface field appearing in ForceSendFields will be sent to the
  298. // server regardless of whether the field is empty or not. This may be
  299. // used to include empty fields in Patch requests.
  300. ForceSendFields []string `json:"-"`
  301. // NullFields is a list of field names (e.g. "NextPageToken") to include
  302. // in API requests with the JSON null value. By default, fields with
  303. // empty values are omitted from API requests. However, any field with
  304. // an empty value appearing in NullFields will be sent to the server as
  305. // null. It is an error if a field in this list has a non-empty value.
  306. // This may be used to include null fields in Patch requests.
  307. NullFields []string `json:"-"`
  308. }
  309. func (s *ListTopicsResponse) MarshalJSON() ([]byte, error) {
  310. type NoMethod ListTopicsResponse
  311. raw := NoMethod(*s)
  312. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  313. }
  314. // ModifyAckDeadlineRequest: Request for the ModifyAckDeadline method.
  315. type ModifyAckDeadlineRequest struct {
  316. // AckDeadlineSeconds: The new ack deadline with respect to the time
  317. // this request was sent to the
  318. // Pub/Sub system. Must be >= 0. For example, if the value is 10, the
  319. // new ack
  320. // deadline will expire 10 seconds after the ModifyAckDeadline call was
  321. // made.
  322. // Specifying zero may immediately make the message available for
  323. // another pull
  324. // request.
  325. AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
  326. // AckId: The acknowledgment ID. Either this or ack_ids must be
  327. // populated,
  328. // not both.
  329. AckId string `json:"ackId,omitempty"`
  330. // AckIds: List of acknowledgment IDs. Either this field or
  331. // ack_id
  332. // should be populated, not both.
  333. AckIds []string `json:"ackIds,omitempty"`
  334. // Subscription: Next Index: 5
  335. // The name of the subscription from which messages are being pulled.
  336. Subscription string `json:"subscription,omitempty"`
  337. // ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds")
  338. // to unconditionally include in API requests. By default, fields with
  339. // empty values are omitted from API requests. However, any non-pointer,
  340. // non-interface field appearing in ForceSendFields will be sent to the
  341. // server regardless of whether the field is empty or not. This may be
  342. // used to include empty fields in Patch requests.
  343. ForceSendFields []string `json:"-"`
  344. // NullFields is a list of field names (e.g. "AckDeadlineSeconds") to
  345. // include in API requests with the JSON null value. By default, fields
  346. // with empty values are omitted from API requests. However, any field
  347. // with an empty value appearing in NullFields will be sent to the
  348. // server as null. It is an error if a field in this list has a
  349. // non-empty value. This may be used to include null fields in Patch
  350. // requests.
  351. NullFields []string `json:"-"`
  352. }
  353. func (s *ModifyAckDeadlineRequest) MarshalJSON() ([]byte, error) {
  354. type NoMethod ModifyAckDeadlineRequest
  355. raw := NoMethod(*s)
  356. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  357. }
  358. // ModifyPushConfigRequest: Request for the ModifyPushConfig method.
  359. type ModifyPushConfigRequest struct {
  360. // PushConfig: An empty <code>push_config</code> indicates that the
  361. // Pub/Sub system should
  362. // pause pushing messages from the given subscription.
  363. PushConfig *PushConfig `json:"pushConfig,omitempty"`
  364. // Subscription: The name of the subscription.
  365. Subscription string `json:"subscription,omitempty"`
  366. // ForceSendFields is a list of field names (e.g. "PushConfig") to
  367. // unconditionally include in API requests. By default, fields with
  368. // empty values are omitted from API requests. However, any non-pointer,
  369. // non-interface field appearing in ForceSendFields will be sent to the
  370. // server regardless of whether the field is empty or not. This may be
  371. // used to include empty fields in Patch requests.
  372. ForceSendFields []string `json:"-"`
  373. // NullFields is a list of field names (e.g. "PushConfig") to include in
  374. // API requests with the JSON null value. By default, fields with empty
  375. // values are omitted from API requests. However, any field with an
  376. // empty value appearing in NullFields will be sent to the server as
  377. // null. It is an error if a field in this list has a non-empty value.
  378. // This may be used to include null fields in Patch requests.
  379. NullFields []string `json:"-"`
  380. }
  381. func (s *ModifyPushConfigRequest) MarshalJSON() ([]byte, error) {
  382. type NoMethod ModifyPushConfigRequest
  383. raw := NoMethod(*s)
  384. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  385. }
  386. // PublishBatchRequest: Request for the PublishBatch method.
  387. type PublishBatchRequest struct {
  388. // Messages: The messages to publish.
  389. Messages []*PubsubMessage `json:"messages,omitempty"`
  390. // Topic: The messages in the request will be published on this topic.
  391. Topic string `json:"topic,omitempty"`
  392. // ForceSendFields is a list of field names (e.g. "Messages") to
  393. // unconditionally include in API requests. By default, fields with
  394. // empty values are omitted from API requests. However, any non-pointer,
  395. // non-interface field appearing in ForceSendFields will be sent to the
  396. // server regardless of whether the field is empty or not. This may be
  397. // used to include empty fields in Patch requests.
  398. ForceSendFields []string `json:"-"`
  399. // NullFields is a list of field names (e.g. "Messages") to include in
  400. // API requests with the JSON null value. By default, fields with empty
  401. // values are omitted from API requests. However, any field with an
  402. // empty value appearing in NullFields will be sent to the server as
  403. // null. It is an error if a field in this list has a non-empty value.
  404. // This may be used to include null fields in Patch requests.
  405. NullFields []string `json:"-"`
  406. }
  407. func (s *PublishBatchRequest) MarshalJSON() ([]byte, error) {
  408. type NoMethod PublishBatchRequest
  409. raw := NoMethod(*s)
  410. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  411. }
  412. // PublishBatchResponse: Response for the PublishBatch method.
  413. type PublishBatchResponse struct {
  414. // MessageIds: The server-assigned ID of each published message, in the
  415. // same order as
  416. // the messages in the request. IDs are guaranteed to be unique
  417. // within
  418. // the topic.
  419. MessageIds []string `json:"messageIds,omitempty"`
  420. // ServerResponse contains the HTTP response code and headers from the
  421. // server.
  422. googleapi.ServerResponse `json:"-"`
  423. // ForceSendFields is a list of field names (e.g. "MessageIds") to
  424. // unconditionally include in API requests. By default, fields with
  425. // empty values are omitted from API requests. However, any non-pointer,
  426. // non-interface field appearing in ForceSendFields will be sent to the
  427. // server regardless of whether the field is empty or not. This may be
  428. // used to include empty fields in Patch requests.
  429. ForceSendFields []string `json:"-"`
  430. // NullFields is a list of field names (e.g. "MessageIds") to include in
  431. // API requests with the JSON null value. By default, fields with empty
  432. // values are omitted from API requests. However, any field with an
  433. // empty value appearing in NullFields will be sent to the server as
  434. // null. It is an error if a field in this list has a non-empty value.
  435. // This may be used to include null fields in Patch requests.
  436. NullFields []string `json:"-"`
  437. }
  438. func (s *PublishBatchResponse) MarshalJSON() ([]byte, error) {
  439. type NoMethod PublishBatchResponse
  440. raw := NoMethod(*s)
  441. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  442. }
  443. // PublishRequest: Request for the Publish method.
  444. type PublishRequest struct {
  445. // Message: The message to publish.
  446. Message *PubsubMessage `json:"message,omitempty"`
  447. // Topic: The message in the request will be published on this topic.
  448. Topic string `json:"topic,omitempty"`
  449. // ForceSendFields is a list of field names (e.g. "Message") to
  450. // unconditionally include in API requests. By default, fields with
  451. // empty values are omitted from API requests. However, any non-pointer,
  452. // non-interface field appearing in ForceSendFields will be sent to the
  453. // server regardless of whether the field is empty or not. This may be
  454. // used to include empty fields in Patch requests.
  455. ForceSendFields []string `json:"-"`
  456. // NullFields is a list of field names (e.g. "Message") to include in
  457. // API requests with the JSON null value. By default, fields with empty
  458. // values are omitted from API requests. However, any field with an
  459. // empty value appearing in NullFields will be sent to the server as
  460. // null. It is an error if a field in this list has a non-empty value.
  461. // This may be used to include null fields in Patch requests.
  462. NullFields []string `json:"-"`
  463. }
  464. func (s *PublishRequest) MarshalJSON() ([]byte, error) {
  465. type NoMethod PublishRequest
  466. raw := NoMethod(*s)
  467. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  468. }
  469. // PubsubEvent: An event indicating a received message or truncation
  470. // event.
  471. type PubsubEvent struct {
  472. // Deleted: Indicates that this subscription has been deleted. (Note
  473. // that pull
  474. // subscribers will always receive NOT_FOUND in response in their
  475. // pull
  476. // request on the subscription, rather than seeing this boolean.)
  477. Deleted bool `json:"deleted,omitempty"`
  478. // Message: A received message.
  479. Message *PubsubMessage `json:"message,omitempty"`
  480. // Subscription: The subscription that received the event.
  481. Subscription string `json:"subscription,omitempty"`
  482. // Truncated: Indicates that this subscription has been truncated.
  483. Truncated bool `json:"truncated,omitempty"`
  484. // ForceSendFields is a list of field names (e.g. "Deleted") to
  485. // unconditionally include in API requests. By default, fields with
  486. // empty values are omitted from API requests. However, any non-pointer,
  487. // non-interface field appearing in ForceSendFields will be sent to the
  488. // server regardless of whether the field is empty or not. This may be
  489. // used to include empty fields in Patch requests.
  490. ForceSendFields []string `json:"-"`
  491. // NullFields is a list of field names (e.g. "Deleted") to include in
  492. // API requests with the JSON null value. By default, fields with empty
  493. // values are omitted from API requests. However, any field with an
  494. // empty value appearing in NullFields will be sent to the server as
  495. // null. It is an error if a field in this list has a non-empty value.
  496. // This may be used to include null fields in Patch requests.
  497. NullFields []string `json:"-"`
  498. }
  499. func (s *PubsubEvent) MarshalJSON() ([]byte, error) {
  500. type NoMethod PubsubEvent
  501. raw := NoMethod(*s)
  502. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  503. }
  504. // PubsubMessage: A message data and its labels.
  505. type PubsubMessage struct {
  506. // Data: The message payload.
  507. Data string `json:"data,omitempty"`
  508. // Label: Optional list of labels for this message. Keys in this
  509. // collection must
  510. // be unique.
  511. Label []*Label `json:"label,omitempty"`
  512. // MessageId: ID of this message assigned by the server at publication
  513. // time. Guaranteed
  514. // to be unique within the topic. This value may be read by a
  515. // subscriber
  516. // that receives a PubsubMessage via a Pull call or a push delivery. It
  517. // must
  518. // not be populated by a publisher in a Publish call.
  519. MessageId string `json:"messageId,omitempty"`
  520. // PublishTime: The time at which the message was published.
  521. // The time is milliseconds since the UNIX epoch.
  522. PublishTime int64 `json:"publishTime,omitempty,string"`
  523. // ForceSendFields is a list of field names (e.g. "Data") to
  524. // unconditionally include in API requests. By default, fields with
  525. // empty values are omitted from API requests. However, any non-pointer,
  526. // non-interface field appearing in ForceSendFields will be sent to the
  527. // server regardless of whether the field is empty or not. This may be
  528. // used to include empty fields in Patch requests.
  529. ForceSendFields []string `json:"-"`
  530. // NullFields is a list of field names (e.g. "Data") to include in API
  531. // requests with the JSON null value. By default, fields with empty
  532. // values are omitted from API requests. However, any field with an
  533. // empty value appearing in NullFields will be sent to the server as
  534. // null. It is an error if a field in this list has a non-empty value.
  535. // This may be used to include null fields in Patch requests.
  536. NullFields []string `json:"-"`
  537. }
  538. func (s *PubsubMessage) MarshalJSON() ([]byte, error) {
  539. type NoMethod PubsubMessage
  540. raw := NoMethod(*s)
  541. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  542. }
  543. // PullBatchRequest: Request for the PullBatch method.
  544. type PullBatchRequest struct {
  545. // MaxEvents: The maximum number of PubsubEvents returned for this
  546. // request. The Pub/Sub
  547. // system may return fewer than the number of events specified.
  548. MaxEvents int64 `json:"maxEvents,omitempty"`
  549. // ReturnImmediately: If this is specified as true the system will
  550. // respond immediately even if
  551. // it is not able to return a message in the Pull response. Otherwise
  552. // the
  553. // system is allowed to wait until at least one message is available
  554. // rather
  555. // than returning no messages. The client may cancel the request if it
  556. // does
  557. // not wish to wait any longer for the response.
  558. ReturnImmediately bool `json:"returnImmediately,omitempty"`
  559. // Subscription: The subscription from which messages should be pulled.
  560. Subscription string `json:"subscription,omitempty"`
  561. // ForceSendFields is a list of field names (e.g. "MaxEvents") to
  562. // unconditionally include in API requests. By default, fields with
  563. // empty values are omitted from API requests. However, any non-pointer,
  564. // non-interface field appearing in ForceSendFields will be sent to the
  565. // server regardless of whether the field is empty or not. This may be
  566. // used to include empty fields in Patch requests.
  567. ForceSendFields []string `json:"-"`
  568. // NullFields is a list of field names (e.g. "MaxEvents") to include in
  569. // API requests with the JSON null value. By default, fields with empty
  570. // values are omitted from API requests. However, any field with an
  571. // empty value appearing in NullFields will be sent to the server as
  572. // null. It is an error if a field in this list has a non-empty value.
  573. // This may be used to include null fields in Patch requests.
  574. NullFields []string `json:"-"`
  575. }
  576. func (s *PullBatchRequest) MarshalJSON() ([]byte, error) {
  577. type NoMethod PullBatchRequest
  578. raw := NoMethod(*s)
  579. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  580. }
  581. // PullBatchResponse: Response for the PullBatch method.
  582. type PullBatchResponse struct {
  583. // PullResponses: Received Pub/Sub messages or status events. The
  584. // Pub/Sub system will return
  585. // zero messages if there are no more messages available in the backlog.
  586. // The
  587. // Pub/Sub system may return fewer than the max_events requested even
  588. // if
  589. // there are more messages available in the backlog.
  590. PullResponses []*PullResponse `json:"pullResponses,omitempty"`
  591. // ServerResponse contains the HTTP response code and headers from the
  592. // server.
  593. googleapi.ServerResponse `json:"-"`
  594. // ForceSendFields is a list of field names (e.g. "PullResponses") to
  595. // unconditionally include in API requests. By default, fields with
  596. // empty values are omitted from API requests. However, any non-pointer,
  597. // non-interface field appearing in ForceSendFields will be sent to the
  598. // server regardless of whether the field is empty or not. This may be
  599. // used to include empty fields in Patch requests.
  600. ForceSendFields []string `json:"-"`
  601. // NullFields is a list of field names (e.g. "PullResponses") to include
  602. // in API requests with the JSON null value. By default, fields with
  603. // empty values are omitted from API requests. However, any field with
  604. // an empty value appearing in NullFields will be sent to the server as
  605. // null. It is an error if a field in this list has a non-empty value.
  606. // This may be used to include null fields in Patch requests.
  607. NullFields []string `json:"-"`
  608. }
  609. func (s *PullBatchResponse) MarshalJSON() ([]byte, error) {
  610. type NoMethod PullBatchResponse
  611. raw := NoMethod(*s)
  612. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  613. }
  614. // PullRequest: Request for the Pull method.
  615. type PullRequest struct {
  616. // ReturnImmediately: If this is specified as true the system will
  617. // respond immediately even if
  618. // it is not able to return a message in the Pull response. Otherwise
  619. // the
  620. // system is allowed to wait until at least one message is available
  621. // rather
  622. // than returning FAILED_PRECONDITION. The client may cancel the request
  623. // if
  624. // it does not wish to wait any longer for the response.
  625. ReturnImmediately bool `json:"returnImmediately,omitempty"`
  626. // Subscription: The subscription from which a message should be pulled.
  627. Subscription string `json:"subscription,omitempty"`
  628. // ForceSendFields is a list of field names (e.g. "ReturnImmediately")
  629. // to unconditionally include in API requests. By default, fields with
  630. // empty values are omitted from API requests. However, any non-pointer,
  631. // non-interface field appearing in ForceSendFields will be sent to the
  632. // server regardless of whether the field is empty or not. This may be
  633. // used to include empty fields in Patch requests.
  634. ForceSendFields []string `json:"-"`
  635. // NullFields is a list of field names (e.g. "ReturnImmediately") to
  636. // include in API requests with the JSON null value. By default, fields
  637. // with empty values are omitted from API requests. However, any field
  638. // with an empty value appearing in NullFields will be sent to the
  639. // server as null. It is an error if a field in this list has a
  640. // non-empty value. This may be used to include null fields in Patch
  641. // requests.
  642. NullFields []string `json:"-"`
  643. }
  644. func (s *PullRequest) MarshalJSON() ([]byte, error) {
  645. type NoMethod PullRequest
  646. raw := NoMethod(*s)
  647. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  648. }
  649. // PullResponse: Either a <code>PubsubMessage</code> or a truncation
  650. // event. One of these two
  651. // must be populated.
  652. type PullResponse struct {
  653. // AckId: This ID must be used to acknowledge the received event or
  654. // message.
  655. AckId string `json:"ackId,omitempty"`
  656. // PubsubEvent: A pubsub message or truncation event.
  657. PubsubEvent *PubsubEvent `json:"pubsubEvent,omitempty"`
  658. // ServerResponse contains the HTTP response code and headers from the
  659. // server.
  660. googleapi.ServerResponse `json:"-"`
  661. // ForceSendFields is a list of field names (e.g. "AckId") to
  662. // unconditionally include in API requests. By default, fields with
  663. // empty values are omitted from API requests. However, any non-pointer,
  664. // non-interface field appearing in ForceSendFields will be sent to the
  665. // server regardless of whether the field is empty or not. This may be
  666. // used to include empty fields in Patch requests.
  667. ForceSendFields []string `json:"-"`
  668. // NullFields is a list of field names (e.g. "AckId") to include in API
  669. // requests with the JSON null value. By default, fields with empty
  670. // values are omitted from API requests. However, any field with an
  671. // empty value appearing in NullFields will be sent to the server as
  672. // null. It is an error if a field in this list has a non-empty value.
  673. // This may be used to include null fields in Patch requests.
  674. NullFields []string `json:"-"`
  675. }
  676. func (s *PullResponse) MarshalJSON() ([]byte, error) {
  677. type NoMethod PullResponse
  678. raw := NoMethod(*s)
  679. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  680. }
  681. // PushConfig: Configuration for a push delivery endpoint.
  682. type PushConfig struct {
  683. // PushEndpoint: A URL locating the endpoint to which messages should be
  684. // pushed.
  685. // For example, a Webhook endpoint might use "https://example.com/push".
  686. PushEndpoint string `json:"pushEndpoint,omitempty"`
  687. // ForceSendFields is a list of field names (e.g. "PushEndpoint") to
  688. // unconditionally include in API requests. By default, fields with
  689. // empty values are omitted from API requests. However, any non-pointer,
  690. // non-interface field appearing in ForceSendFields will be sent to the
  691. // server regardless of whether the field is empty or not. This may be
  692. // used to include empty fields in Patch requests.
  693. ForceSendFields []string `json:"-"`
  694. // NullFields is a list of field names (e.g. "PushEndpoint") to include
  695. // in API requests with the JSON null value. By default, fields with
  696. // empty values are omitted from API requests. However, any field with
  697. // an empty value appearing in NullFields will be sent to the server as
  698. // null. It is an error if a field in this list has a non-empty value.
  699. // This may be used to include null fields in Patch requests.
  700. NullFields []string `json:"-"`
  701. }
  702. func (s *PushConfig) MarshalJSON() ([]byte, error) {
  703. type NoMethod PushConfig
  704. raw := NoMethod(*s)
  705. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  706. }
  707. // Subscription: A subscription resource.
  708. type Subscription struct {
  709. // AckDeadlineSeconds: For either push or pull delivery, the value is
  710. // the maximum time after a
  711. // subscriber receives a message before the subscriber should
  712. // acknowledge or
  713. // Nack the message. If the Ack deadline for a message passes without
  714. // an
  715. // Ack or a Nack, the Pub/Sub system will eventually redeliver the
  716. // message.
  717. // If a subscriber acknowledges after the deadline, the Pub/Sub system
  718. // may
  719. // accept the Ack, but it is possible that the message has been
  720. // already
  721. // delivered again. Multiple Acks to the message are allowed and
  722. // will
  723. // succeed.
  724. //
  725. // For push delivery, this value is used to set the request timeout
  726. // for
  727. // the call to the push endpoint.
  728. //
  729. // For pull delivery, this value is used as the initial value for the
  730. // Ack
  731. // deadline. It may be overridden for each message using its
  732. // corresponding
  733. // ack_id with <code>ModifyAckDeadline</code>.
  734. // While a message is outstanding (i.e. it has been delivered to a
  735. // pull
  736. // subscriber and the subscriber has not yet Acked or Nacked), the
  737. // Pub/Sub
  738. // system will not deliver that message to another pull subscriber
  739. // (on a best-effort basis).
  740. AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
  741. // Name: Name of the subscription.
  742. Name string `json:"name,omitempty"`
  743. // PushConfig: If push delivery is used with this subscription, this
  744. // field is
  745. // used to configure it.
  746. PushConfig *PushConfig `json:"pushConfig,omitempty"`
  747. // Topic: The name of the topic from which this subscription is
  748. // receiving messages.
  749. Topic string `json:"topic,omitempty"`
  750. // ServerResponse contains the HTTP response code and headers from the
  751. // server.
  752. googleapi.ServerResponse `json:"-"`
  753. // ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds")
  754. // to unconditionally include in API requests. By default, fields with
  755. // empty values are omitted from API requests. However, any non-pointer,
  756. // non-interface field appearing in ForceSendFields will be sent to the
  757. // server regardless of whether the field is empty or not. This may be
  758. // used to include empty fields in Patch requests.
  759. ForceSendFields []string `json:"-"`
  760. // NullFields is a list of field names (e.g. "AckDeadlineSeconds") to
  761. // include in API requests with the JSON null value. By default, fields
  762. // with empty values are omitted from API requests. However, any field
  763. // with an empty value appearing in NullFields will be sent to the
  764. // server as null. It is an error if a field in this list has a
  765. // non-empty value. This may be used to include null fields in Patch
  766. // requests.
  767. NullFields []string `json:"-"`
  768. }
  769. func (s *Subscription) MarshalJSON() ([]byte, error) {
  770. type NoMethod Subscription
  771. raw := NoMethod(*s)
  772. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  773. }
  774. // Topic: A topic resource.
  775. type Topic struct {
  776. // Name: Name of the topic.
  777. Name string `json:"name,omitempty"`
  778. // ServerResponse contains the HTTP response code and headers from the
  779. // server.
  780. googleapi.ServerResponse `json:"-"`
  781. // ForceSendFields is a list of field names (e.g. "Name") to
  782. // unconditionally include in API requests. By default, fields with
  783. // empty values are omitted from API requests. However, any non-pointer,
  784. // non-interface field appearing in ForceSendFields will be sent to the
  785. // server regardless of whether the field is empty or not. This may be
  786. // used to include empty fields in Patch requests.
  787. ForceSendFields []string `json:"-"`
  788. // NullFields is a list of field names (e.g. "Name") to include in API
  789. // requests with the JSON null value. By default, fields with empty
  790. // values are omitted from API requests. However, any field with an
  791. // empty value appearing in NullFields will be sent to the server as
  792. // null. It is an error if a field in this list has a non-empty value.
  793. // This may be used to include null fields in Patch requests.
  794. NullFields []string `json:"-"`
  795. }
  796. func (s *Topic) MarshalJSON() ([]byte, error) {
  797. type NoMethod Topic
  798. raw := NoMethod(*s)
  799. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  800. }
  801. // method id "pubsub.subscriptions.acknowledge":
  802. type SubscriptionsAcknowledgeCall struct {
  803. s *Service
  804. acknowledgerequest *AcknowledgeRequest
  805. urlParams_ gensupport.URLParams
  806. ctx_ context.Context
  807. header_ http.Header
  808. }
  809. // Acknowledge: Acknowledges a particular received message: the Pub/Sub
  810. // system can remove
  811. // the given message from the subscription. Acknowledging a message
  812. // whose
  813. // Ack deadline has expired may succeed, but the message could have
  814. // been
  815. // already redelivered. Acknowledging a message more than once will
  816. // not
  817. // result in an error. This is only used for messages received via pull.
  818. func (r *SubscriptionsService) Acknowledge(acknowledgerequest *AcknowledgeRequest) *SubscriptionsAcknowledgeCall {
  819. c := &SubscriptionsAcknowledgeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  820. c.acknowledgerequest = acknowledgerequest
  821. return c
  822. }
  823. // Fields allows partial responses to be retrieved. See
  824. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  825. // for more information.
  826. func (c *SubscriptionsAcknowledgeCall) Fields(s ...googleapi.Field) *SubscriptionsAcknowledgeCall {
  827. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  828. return c
  829. }
  830. // Context sets the context to be used in this call's Do method. Any
  831. // pending HTTP request will be aborted if the provided context is
  832. // canceled.
  833. func (c *SubscriptionsAcknowledgeCall) Context(ctx context.Context) *SubscriptionsAcknowledgeCall {
  834. c.ctx_ = ctx
  835. return c
  836. }
  837. // Header returns an http.Header that can be modified by the caller to
  838. // add HTTP headers to the request.
  839. func (c *SubscriptionsAcknowledgeCall) Header() http.Header {
  840. if c.header_ == nil {
  841. c.header_ = make(http.Header)
  842. }
  843. return c.header_
  844. }
  845. func (c *SubscriptionsAcknowledgeCall) doRequest(alt string) (*http.Response, error) {
  846. reqHeaders := make(http.Header)
  847. for k, v := range c.header_ {
  848. reqHeaders[k] = v
  849. }
  850. reqHeaders.Set("User-Agent", c.s.userAgent())
  851. var body io.Reader = nil
  852. body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgerequest)
  853. if err != nil {
  854. return nil, err
  855. }
  856. reqHeaders.Set("Content-Type", "application/json")
  857. c.urlParams_.Set("alt", alt)
  858. c.urlParams_.Set("prettyPrint", "false")
  859. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/acknowledge")
  860. urls += "?" + c.urlParams_.Encode()
  861. req, err := http.NewRequest("POST", urls, body)
  862. if err != nil {
  863. return nil, err
  864. }
  865. req.Header = reqHeaders
  866. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  867. }
  868. // Do executes the "pubsub.subscriptions.acknowledge" call.
  869. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  870. // code is an error. Response headers are in either
  871. // *Empty.ServerResponse.Header or (if a response was returned at all)
  872. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  873. // check whether the returned error was because http.StatusNotModified
  874. // was returned.
  875. func (c *SubscriptionsAcknowledgeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  876. gensupport.SetOptions(c.urlParams_, opts...)
  877. res, err := c.doRequest("json")
  878. if res != nil && res.StatusCode == http.StatusNotModified {
  879. if res.Body != nil {
  880. res.Body.Close()
  881. }
  882. return nil, &googleapi.Error{
  883. Code: res.StatusCode,
  884. Header: res.Header,
  885. }
  886. }
  887. if err != nil {
  888. return nil, err
  889. }
  890. defer googleapi.CloseBody(res)
  891. if err := googleapi.CheckResponse(res); err != nil {
  892. return nil, err
  893. }
  894. ret := &Empty{
  895. ServerResponse: googleapi.ServerResponse{
  896. Header: res.Header,
  897. HTTPStatusCode: res.StatusCode,
  898. },
  899. }
  900. target := &ret
  901. if err := gensupport.DecodeResponse(target, res); err != nil {
  902. return nil, err
  903. }
  904. return ret, nil
  905. // {
  906. // "description": "Acknowledges a particular received message: the Pub/Sub system can remove\nthe given message from the subscription. Acknowledging a message whose\nAck deadline has expired may succeed, but the message could have been\nalready redelivered. Acknowledging a message more than once will not\nresult in an error. This is only used for messages received via pull.",
  907. // "flatPath": "v1beta1a/subscriptions/acknowledge",
  908. // "httpMethod": "POST",
  909. // "id": "pubsub.subscriptions.acknowledge",
  910. // "parameterOrder": [],
  911. // "parameters": {},
  912. // "path": "v1beta1a/subscriptions/acknowledge",
  913. // "request": {
  914. // "$ref": "AcknowledgeRequest"
  915. // },
  916. // "response": {
  917. // "$ref": "Empty"
  918. // },
  919. // "scopes": [
  920. // "https://www.googleapis.com/auth/cloud-platform",
  921. // "https://www.googleapis.com/auth/pubsub"
  922. // ]
  923. // }
  924. }
  925. // method id "pubsub.subscriptions.create":
  926. type SubscriptionsCreateCall struct {
  927. s *Service
  928. subscription *Subscription
  929. urlParams_ gensupport.URLParams
  930. ctx_ context.Context
  931. header_ http.Header
  932. }
  933. // Create: Creates a subscription on a given topic for a given
  934. // subscriber.
  935. // If the subscription already exists, returns ALREADY_EXISTS.
  936. // If the corresponding topic doesn't exist, returns NOT_FOUND.
  937. //
  938. // If the name is not provided in the request, the server will assign a
  939. // random
  940. // name for this subscription on the same project as the topic.
  941. func (r *SubscriptionsService) Create(subscription *Subscription) *SubscriptionsCreateCall {
  942. c := &SubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  943. c.subscription = subscription
  944. return c
  945. }
  946. // Fields allows partial responses to be retrieved. See
  947. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  948. // for more information.
  949. func (c *SubscriptionsCreateCall) Fields(s ...googleapi.Field) *SubscriptionsCreateCall {
  950. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  951. return c
  952. }
  953. // Context sets the context to be used in this call's Do method. Any
  954. // pending HTTP request will be aborted if the provided context is
  955. // canceled.
  956. func (c *SubscriptionsCreateCall) Context(ctx context.Context) *SubscriptionsCreateCall {
  957. c.ctx_ = ctx
  958. return c
  959. }
  960. // Header returns an http.Header that can be modified by the caller to
  961. // add HTTP headers to the request.
  962. func (c *SubscriptionsCreateCall) Header() http.Header {
  963. if c.header_ == nil {
  964. c.header_ = make(http.Header)
  965. }
  966. return c.header_
  967. }
  968. func (c *SubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) {
  969. reqHeaders := make(http.Header)
  970. for k, v := range c.header_ {
  971. reqHeaders[k] = v
  972. }
  973. reqHeaders.Set("User-Agent", c.s.userAgent())
  974. var body io.Reader = nil
  975. body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
  976. if err != nil {
  977. return nil, err
  978. }
  979. reqHeaders.Set("Content-Type", "application/json")
  980. c.urlParams_.Set("alt", alt)
  981. c.urlParams_.Set("prettyPrint", "false")
  982. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions")
  983. urls += "?" + c.urlParams_.Encode()
  984. req, err := http.NewRequest("POST", urls, body)
  985. if err != nil {
  986. return nil, err
  987. }
  988. req.Header = reqHeaders
  989. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  990. }
  991. // Do executes the "pubsub.subscriptions.create" call.
  992. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  993. // status code is an error. Response headers are in either
  994. // *Subscription.ServerResponse.Header or (if a response was returned at
  995. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  996. // to check whether the returned error was because
  997. // http.StatusNotModified was returned.
  998. func (c *SubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  999. gensupport.SetOptions(c.urlParams_, opts...)
  1000. res, err := c.doRequest("json")
  1001. if res != nil && res.StatusCode == http.StatusNotModified {
  1002. if res.Body != nil {
  1003. res.Body.Close()
  1004. }
  1005. return nil, &googleapi.Error{
  1006. Code: res.StatusCode,
  1007. Header: res.Header,
  1008. }
  1009. }
  1010. if err != nil {
  1011. return nil, err
  1012. }
  1013. defer googleapi.CloseBody(res)
  1014. if err := googleapi.CheckResponse(res); err != nil {
  1015. return nil, err
  1016. }
  1017. ret := &Subscription{
  1018. ServerResponse: googleapi.ServerResponse{
  1019. Header: res.Header,
  1020. HTTPStatusCode: res.StatusCode,
  1021. },
  1022. }
  1023. target := &ret
  1024. if err := gensupport.DecodeResponse(target, res); err != nil {
  1025. return nil, err
  1026. }
  1027. return ret, nil
  1028. // {
  1029. // "description": "Creates a subscription on a given topic for a given subscriber.\nIf the subscription already exists, returns ALREADY_EXISTS.\nIf the corresponding topic doesn't exist, returns NOT_FOUND.\n\nIf the name is not provided in the request, the server will assign a random\nname for this subscription on the same project as the topic.",
  1030. // "flatPath": "v1beta1a/subscriptions",
  1031. // "httpMethod": "POST",
  1032. // "id": "pubsub.subscriptions.create",
  1033. // "parameterOrder": [],
  1034. // "parameters": {},
  1035. // "path": "v1beta1a/subscriptions",
  1036. // "request": {
  1037. // "$ref": "Subscription"
  1038. // },
  1039. // "response": {
  1040. // "$ref": "Subscription"
  1041. // },
  1042. // "scopes": [
  1043. // "https://www.googleapis.com/auth/cloud-platform",
  1044. // "https://www.googleapis.com/auth/pubsub"
  1045. // ]
  1046. // }
  1047. }
  1048. // method id "pubsub.subscriptions.delete":
  1049. type SubscriptionsDeleteCall struct {
  1050. s *Service
  1051. subscription string
  1052. urlParams_ gensupport.URLParams
  1053. ctx_ context.Context
  1054. header_ http.Header
  1055. }
  1056. // Delete: Deletes an existing subscription. All pending messages in the
  1057. // subscription
  1058. // are immediately dropped. Calls to Pull after deletion will
  1059. // return
  1060. // NOT_FOUND.
  1061. func (r *SubscriptionsService) Delete(subscription string) *SubscriptionsDeleteCall {
  1062. c := &SubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1063. c.subscription = subscription
  1064. return c
  1065. }
  1066. // Fields allows partial responses to be retrieved. See
  1067. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1068. // for more information.
  1069. func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
  1070. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1071. return c
  1072. }
  1073. // Context sets the context to be used in this call's Do method. Any
  1074. // pending HTTP request will be aborted if the provided context is
  1075. // canceled.
  1076. func (c *SubscriptionsDeleteCall) Context(ctx context.Context) *SubscriptionsDeleteCall {
  1077. c.ctx_ = ctx
  1078. return c
  1079. }
  1080. // Header returns an http.Header that can be modified by the caller to
  1081. // add HTTP headers to the request.
  1082. func (c *SubscriptionsDeleteCall) Header() http.Header {
  1083. if c.header_ == nil {
  1084. c.header_ = make(http.Header)
  1085. }
  1086. return c.header_
  1087. }
  1088. func (c *SubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1089. reqHeaders := make(http.Header)
  1090. for k, v := range c.header_ {
  1091. reqHeaders[k] = v
  1092. }
  1093. reqHeaders.Set("User-Agent", c.s.userAgent())
  1094. var body io.Reader = nil
  1095. c.urlParams_.Set("alt", alt)
  1096. c.urlParams_.Set("prettyPrint", "false")
  1097. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/{+subscription}")
  1098. urls += "?" + c.urlParams_.Encode()
  1099. req, err := http.NewRequest("DELETE", urls, body)
  1100. if err != nil {
  1101. return nil, err
  1102. }
  1103. req.Header = reqHeaders
  1104. googleapi.Expand(req.URL, map[string]string{
  1105. "subscription": c.subscription,
  1106. })
  1107. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1108. }
  1109. // Do executes the "pubsub.subscriptions.delete" call.
  1110. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1111. // code is an error. Response headers are in either
  1112. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1113. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1114. // check whether the returned error was because http.StatusNotModified
  1115. // was returned.
  1116. func (c *SubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1117. gensupport.SetOptions(c.urlParams_, opts...)
  1118. res, err := c.doRequest("json")
  1119. if res != nil && res.StatusCode == http.StatusNotModified {
  1120. if res.Body != nil {
  1121. res.Body.Close()
  1122. }
  1123. return nil, &googleapi.Error{
  1124. Code: res.StatusCode,
  1125. Header: res.Header,
  1126. }
  1127. }
  1128. if err != nil {
  1129. return nil, err
  1130. }
  1131. defer googleapi.CloseBody(res)
  1132. if err := googleapi.CheckResponse(res); err != nil {
  1133. return nil, err
  1134. }
  1135. ret := &Empty{
  1136. ServerResponse: googleapi.ServerResponse{
  1137. Header: res.Header,
  1138. HTTPStatusCode: res.StatusCode,
  1139. },
  1140. }
  1141. target := &ret
  1142. if err := gensupport.DecodeResponse(target, res); err != nil {
  1143. return nil, err
  1144. }
  1145. return ret, nil
  1146. // {
  1147. // "description": "Deletes an existing subscription. All pending messages in the subscription\nare immediately dropped. Calls to Pull after deletion will return\nNOT_FOUND.",
  1148. // "flatPath": "v1beta1a/subscriptions/{subscriptionsId}",
  1149. // "httpMethod": "DELETE",
  1150. // "id": "pubsub.subscriptions.delete",
  1151. // "parameterOrder": [
  1152. // "subscription"
  1153. // ],
  1154. // "parameters": {
  1155. // "subscription": {
  1156. // "description": "The subscription to delete.",
  1157. // "location": "path",
  1158. // "pattern": "^.+$",
  1159. // "required": true,
  1160. // "type": "string"
  1161. // }
  1162. // },
  1163. // "path": "v1beta1a/subscriptions/{+subscription}",
  1164. // "response": {
  1165. // "$ref": "Empty"
  1166. // },
  1167. // "scopes": [
  1168. // "https://www.googleapis.com/auth/cloud-platform",
  1169. // "https://www.googleapis.com/auth/pubsub"
  1170. // ]
  1171. // }
  1172. }
  1173. // method id "pubsub.subscriptions.get":
  1174. type SubscriptionsGetCall struct {
  1175. s *Service
  1176. subscription string
  1177. urlParams_ gensupport.URLParams
  1178. ifNoneMatch_ string
  1179. ctx_ context.Context
  1180. header_ http.Header
  1181. }
  1182. // Get: Gets the configuration details of a subscription.
  1183. func (r *SubscriptionsService) Get(subscription string) *SubscriptionsGetCall {
  1184. c := &SubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1185. c.subscription = subscription
  1186. return c
  1187. }
  1188. // Fields allows partial responses to be retrieved. See
  1189. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1190. // for more information.
  1191. func (c *SubscriptionsGetCall) Fields(s ...googleapi.Field) *SubscriptionsGetCall {
  1192. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1193. return c
  1194. }
  1195. // IfNoneMatch sets the optional parameter which makes the operation
  1196. // fail if the object's ETag matches the given value. This is useful for
  1197. // getting updates only after the object has changed since the last
  1198. // request. Use googleapi.IsNotModified to check whether the response
  1199. // error from Do is the result of In-None-Match.
  1200. func (c *SubscriptionsGetCall) IfNoneMatch(entityTag string) *SubscriptionsGetCall {
  1201. c.ifNoneMatch_ = entityTag
  1202. return c
  1203. }
  1204. // Context sets the context to be used in this call's Do method. Any
  1205. // pending HTTP request will be aborted if the provided context is
  1206. // canceled.
  1207. func (c *SubscriptionsGetCall) Context(ctx context.Context) *SubscriptionsGetCall {
  1208. c.ctx_ = ctx
  1209. return c
  1210. }
  1211. // Header returns an http.Header that can be modified by the caller to
  1212. // add HTTP headers to the request.
  1213. func (c *SubscriptionsGetCall) Header() http.Header {
  1214. if c.header_ == nil {
  1215. c.header_ = make(http.Header)
  1216. }
  1217. return c.header_
  1218. }
  1219. func (c *SubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
  1220. reqHeaders := make(http.Header)
  1221. for k, v := range c.header_ {
  1222. reqHeaders[k] = v
  1223. }
  1224. reqHeaders.Set("User-Agent", c.s.userAgent())
  1225. if c.ifNoneMatch_ != "" {
  1226. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1227. }
  1228. var body io.Reader = nil
  1229. c.urlParams_.Set("alt", alt)
  1230. c.urlParams_.Set("prettyPrint", "false")
  1231. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/{+subscription}")
  1232. urls += "?" + c.urlParams_.Encode()
  1233. req, err := http.NewRequest("GET", urls, body)
  1234. if err != nil {
  1235. return nil, err
  1236. }
  1237. req.Header = reqHeaders
  1238. googleapi.Expand(req.URL, map[string]string{
  1239. "subscription": c.subscription,
  1240. })
  1241. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1242. }
  1243. // Do executes the "pubsub.subscriptions.get" call.
  1244. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  1245. // status code is an error. Response headers are in either
  1246. // *Subscription.ServerResponse.Header or (if a response was returned at
  1247. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1248. // to check whether the returned error was because
  1249. // http.StatusNotModified was returned.
  1250. func (c *SubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  1251. gensupport.SetOptions(c.urlParams_, opts...)
  1252. res, err := c.doRequest("json")
  1253. if res != nil && res.StatusCode == http.StatusNotModified {
  1254. if res.Body != nil {
  1255. res.Body.Close()
  1256. }
  1257. return nil, &googleapi.Error{
  1258. Code: res.StatusCode,
  1259. Header: res.Header,
  1260. }
  1261. }
  1262. if err != nil {
  1263. return nil, err
  1264. }
  1265. defer googleapi.CloseBody(res)
  1266. if err := googleapi.CheckResponse(res); err != nil {
  1267. return nil, err
  1268. }
  1269. ret := &Subscription{
  1270. ServerResponse: googleapi.ServerResponse{
  1271. Header: res.Header,
  1272. HTTPStatusCode: res.StatusCode,
  1273. },
  1274. }
  1275. target := &ret
  1276. if err := gensupport.DecodeResponse(target, res); err != nil {
  1277. return nil, err
  1278. }
  1279. return ret, nil
  1280. // {
  1281. // "description": "Gets the configuration details of a subscription.",
  1282. // "flatPath": "v1beta1a/subscriptions/{subscriptionsId}",
  1283. // "httpMethod": "GET",
  1284. // "id": "pubsub.subscriptions.get",
  1285. // "parameterOrder": [
  1286. // "subscription"
  1287. // ],
  1288. // "parameters": {
  1289. // "subscription": {
  1290. // "description": "The name of the subscription to get.",
  1291. // "location": "path",
  1292. // "pattern": "^.+$",
  1293. // "required": true,
  1294. // "type": "string"
  1295. // }
  1296. // },
  1297. // "path": "v1beta1a/subscriptions/{+subscription}",
  1298. // "response": {
  1299. // "$ref": "Subscription"
  1300. // },
  1301. // "scopes": [
  1302. // "https://www.googleapis.com/auth/cloud-platform",
  1303. // "https://www.googleapis.com/auth/pubsub"
  1304. // ]
  1305. // }
  1306. }
  1307. // method id "pubsub.subscriptions.list":
  1308. type SubscriptionsListCall struct {
  1309. s *Service
  1310. urlParams_ gensupport.URLParams
  1311. ifNoneMatch_ string
  1312. ctx_ context.Context
  1313. header_ http.Header
  1314. }
  1315. // List: Lists matching subscriptions.
  1316. func (r *SubscriptionsService) List() *SubscriptionsListCall {
  1317. c := &SubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1318. return c
  1319. }
  1320. // MaxResults sets the optional parameter "maxResults": Maximum number
  1321. // of subscriptions to return.
  1322. func (c *SubscriptionsListCall) MaxResults(maxResults int64) *SubscriptionsListCall {
  1323. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1324. return c
  1325. }
  1326. // PageToken sets the optional parameter "pageToken": The value obtained
  1327. // in the last <code>ListSubscriptionsResponse</code>
  1328. // for continuation.
  1329. func (c *SubscriptionsListCall) PageToken(pageToken string) *SubscriptionsListCall {
  1330. c.urlParams_.Set("pageToken", pageToken)
  1331. return c
  1332. }
  1333. // Query sets the optional parameter "query": A valid label query
  1334. // expression.
  1335. func (c *SubscriptionsListCall) Query(query string) *SubscriptionsListCall {
  1336. c.urlParams_.Set("query", query)
  1337. return c
  1338. }
  1339. // Fields allows partial responses to be retrieved. See
  1340. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1341. // for more information.
  1342. func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
  1343. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1344. return c
  1345. }
  1346. // IfNoneMatch sets the optional parameter which makes the operation
  1347. // fail if the object's ETag matches the given value. This is useful for
  1348. // getting updates only after the object has changed since the last
  1349. // request. Use googleapi.IsNotModified to check whether the response
  1350. // error from Do is the result of In-None-Match.
  1351. func (c *SubscriptionsListCall) IfNoneMatch(entityTag string) *SubscriptionsListCall {
  1352. c.ifNoneMatch_ = entityTag
  1353. return c
  1354. }
  1355. // Context sets the context to be used in this call's Do method. Any
  1356. // pending HTTP request will be aborted if the provided context is
  1357. // canceled.
  1358. func (c *SubscriptionsListCall) Context(ctx context.Context) *SubscriptionsListCall {
  1359. c.ctx_ = ctx
  1360. return c
  1361. }
  1362. // Header returns an http.Header that can be modified by the caller to
  1363. // add HTTP headers to the request.
  1364. func (c *SubscriptionsListCall) Header() http.Header {
  1365. if c.header_ == nil {
  1366. c.header_ = make(http.Header)
  1367. }
  1368. return c.header_
  1369. }
  1370. func (c *SubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
  1371. reqHeaders := make(http.Header)
  1372. for k, v := range c.header_ {
  1373. reqHeaders[k] = v
  1374. }
  1375. reqHeaders.Set("User-Agent", c.s.userAgent())
  1376. if c.ifNoneMatch_ != "" {
  1377. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1378. }
  1379. var body io.Reader = nil
  1380. c.urlParams_.Set("alt", alt)
  1381. c.urlParams_.Set("prettyPrint", "false")
  1382. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions")
  1383. urls += "?" + c.urlParams_.Encode()
  1384. req, err := http.NewRequest("GET", urls, body)
  1385. if err != nil {
  1386. return nil, err
  1387. }
  1388. req.Header = reqHeaders
  1389. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1390. }
  1391. // Do executes the "pubsub.subscriptions.list" call.
  1392. // Exactly one of *ListSubscriptionsResponse or error will be non-nil.
  1393. // Any non-2xx status code is an error. Response headers are in either
  1394. // *ListSubscriptionsResponse.ServerResponse.Header or (if a response
  1395. // was returned at all) in error.(*googleapi.Error).Header. Use
  1396. // googleapi.IsNotModified to check whether the returned error was
  1397. // because http.StatusNotModified was returned.
  1398. func (c *SubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListSubscriptionsResponse, error) {
  1399. gensupport.SetOptions(c.urlParams_, opts...)
  1400. res, err := c.doRequest("json")
  1401. if res != nil && res.StatusCode == http.StatusNotModified {
  1402. if res.Body != nil {
  1403. res.Body.Close()
  1404. }
  1405. return nil, &googleapi.Error{
  1406. Code: res.StatusCode,
  1407. Header: res.Header,
  1408. }
  1409. }
  1410. if err != nil {
  1411. return nil, err
  1412. }
  1413. defer googleapi.CloseBody(res)
  1414. if err := googleapi.CheckResponse(res); err != nil {
  1415. return nil, err
  1416. }
  1417. ret := &ListSubscriptionsResponse{
  1418. ServerResponse: googleapi.ServerResponse{
  1419. Header: res.Header,
  1420. HTTPStatusCode: res.StatusCode,
  1421. },
  1422. }
  1423. target := &ret
  1424. if err := gensupport.DecodeResponse(target, res); err != nil {
  1425. return nil, err
  1426. }
  1427. return ret, nil
  1428. // {
  1429. // "description": "Lists matching subscriptions.",
  1430. // "flatPath": "v1beta1a/subscriptions",
  1431. // "httpMethod": "GET",
  1432. // "id": "pubsub.subscriptions.list",
  1433. // "parameterOrder": [],
  1434. // "parameters": {
  1435. // "maxResults": {
  1436. // "description": "Maximum number of subscriptions to return.",
  1437. // "format": "int32",
  1438. // "location": "query",
  1439. // "type": "integer"
  1440. // },
  1441. // "pageToken": {
  1442. // "description": "The value obtained in the last \u003ccode\u003eListSubscriptionsResponse\u003c/code\u003e\nfor continuation.",
  1443. // "location": "query",
  1444. // "type": "string"
  1445. // },
  1446. // "query": {
  1447. // "description": "A valid label query expression.",
  1448. // "location": "query",
  1449. // "type": "string"
  1450. // }
  1451. // },
  1452. // "path": "v1beta1a/subscriptions",
  1453. // "response": {
  1454. // "$ref": "ListSubscriptionsResponse"
  1455. // },
  1456. // "scopes": [
  1457. // "https://www.googleapis.com/auth/cloud-platform",
  1458. // "https://www.googleapis.com/auth/pubsub"
  1459. // ]
  1460. // }
  1461. }
  1462. // Pages invokes f for each page of results.
  1463. // A non-nil error returned from f will halt the iteration.
  1464. // The provided context supersedes any context provided to the Context method.
  1465. func (c *SubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error {
  1466. c.ctx_ = ctx
  1467. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1468. for {
  1469. x, err := c.Do()
  1470. if err != nil {
  1471. return err
  1472. }
  1473. if err := f(x); err != nil {
  1474. return err
  1475. }
  1476. if x.NextPageToken == "" {
  1477. return nil
  1478. }
  1479. c.PageToken(x.NextPageToken)
  1480. }
  1481. }
  1482. // method id "pubsub.subscriptions.modifyAckDeadline":
  1483. type SubscriptionsModifyAckDeadlineCall struct {
  1484. s *Service
  1485. modifyackdeadlinerequest *ModifyAckDeadlineRequest
  1486. urlParams_ gensupport.URLParams
  1487. ctx_ context.Context
  1488. header_ http.Header
  1489. }
  1490. // ModifyAckDeadline: Modifies the Ack deadline for a message received
  1491. // from a pull request.
  1492. func (r *SubscriptionsService) ModifyAckDeadline(modifyackdeadlinerequest *ModifyAckDeadlineRequest) *SubscriptionsModifyAckDeadlineCall {
  1493. c := &SubscriptionsModifyAckDeadlineCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1494. c.modifyackdeadlinerequest = modifyackdeadlinerequest
  1495. return c
  1496. }
  1497. // Fields allows partial responses to be retrieved. See
  1498. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1499. // for more information.
  1500. func (c *SubscriptionsModifyAckDeadlineCall) Fields(s ...googleapi.Field) *SubscriptionsModifyAckDeadlineCall {
  1501. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1502. return c
  1503. }
  1504. // Context sets the context to be used in this call's Do method. Any
  1505. // pending HTTP request will be aborted if the provided context is
  1506. // canceled.
  1507. func (c *SubscriptionsModifyAckDeadlineCall) Context(ctx context.Context) *SubscriptionsModifyAckDeadlineCall {
  1508. c.ctx_ = ctx
  1509. return c
  1510. }
  1511. // Header returns an http.Header that can be modified by the caller to
  1512. // add HTTP headers to the request.
  1513. func (c *SubscriptionsModifyAckDeadlineCall) Header() http.Header {
  1514. if c.header_ == nil {
  1515. c.header_ = make(http.Header)
  1516. }
  1517. return c.header_
  1518. }
  1519. func (c *SubscriptionsModifyAckDeadlineCall) doRequest(alt string) (*http.Response, error) {
  1520. reqHeaders := make(http.Header)
  1521. for k, v := range c.header_ {
  1522. reqHeaders[k] = v
  1523. }
  1524. reqHeaders.Set("User-Agent", c.s.userAgent())
  1525. var body io.Reader = nil
  1526. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyackdeadlinerequest)
  1527. if err != nil {
  1528. return nil, err
  1529. }
  1530. reqHeaders.Set("Content-Type", "application/json")
  1531. c.urlParams_.Set("alt", alt)
  1532. c.urlParams_.Set("prettyPrint", "false")
  1533. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/modifyAckDeadline")
  1534. urls += "?" + c.urlParams_.Encode()
  1535. req, err := http.NewRequest("POST", urls, body)
  1536. if err != nil {
  1537. return nil, err
  1538. }
  1539. req.Header = reqHeaders
  1540. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1541. }
  1542. // Do executes the "pubsub.subscriptions.modifyAckDeadline" call.
  1543. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1544. // code is an error. Response headers are in either
  1545. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1546. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1547. // check whether the returned error was because http.StatusNotModified
  1548. // was returned.
  1549. func (c *SubscriptionsModifyAckDeadlineCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1550. gensupport.SetOptions(c.urlParams_, opts...)
  1551. res, err := c.doRequest("json")
  1552. if res != nil && res.StatusCode == http.StatusNotModified {
  1553. if res.Body != nil {
  1554. res.Body.Close()
  1555. }
  1556. return nil, &googleapi.Error{
  1557. Code: res.StatusCode,
  1558. Header: res.Header,
  1559. }
  1560. }
  1561. if err != nil {
  1562. return nil, err
  1563. }
  1564. defer googleapi.CloseBody(res)
  1565. if err := googleapi.CheckResponse(res); err != nil {
  1566. return nil, err
  1567. }
  1568. ret := &Empty{
  1569. ServerResponse: googleapi.ServerResponse{
  1570. Header: res.Header,
  1571. HTTPStatusCode: res.StatusCode,
  1572. },
  1573. }
  1574. target := &ret
  1575. if err := gensupport.DecodeResponse(target, res); err != nil {
  1576. return nil, err
  1577. }
  1578. return ret, nil
  1579. // {
  1580. // "description": "Modifies the Ack deadline for a message received from a pull request.",
  1581. // "flatPath": "v1beta1a/subscriptions/modifyAckDeadline",
  1582. // "httpMethod": "POST",
  1583. // "id": "pubsub.subscriptions.modifyAckDeadline",
  1584. // "parameterOrder": [],
  1585. // "parameters": {},
  1586. // "path": "v1beta1a/subscriptions/modifyAckDeadline",
  1587. // "request": {
  1588. // "$ref": "ModifyAckDeadlineRequest"
  1589. // },
  1590. // "response": {
  1591. // "$ref": "Empty"
  1592. // },
  1593. // "scopes": [
  1594. // "https://www.googleapis.com/auth/cloud-platform",
  1595. // "https://www.googleapis.com/auth/pubsub"
  1596. // ]
  1597. // }
  1598. }
  1599. // method id "pubsub.subscriptions.modifyPushConfig":
  1600. type SubscriptionsModifyPushConfigCall struct {
  1601. s *Service
  1602. modifypushconfigrequest *ModifyPushConfigRequest
  1603. urlParams_ gensupport.URLParams
  1604. ctx_ context.Context
  1605. header_ http.Header
  1606. }
  1607. // ModifyPushConfig: Modifies the <code>PushConfig</code> for a
  1608. // specified subscription.
  1609. // This method can be used to suspend the flow of messages to an
  1610. // endpoint
  1611. // by clearing the <code>PushConfig</code> field in the request.
  1612. // Messages
  1613. // will be accumulated for delivery even if no push configuration
  1614. // is
  1615. // defined or while the configuration is modified.
  1616. func (r *SubscriptionsService) ModifyPushConfig(modifypushconfigrequest *ModifyPushConfigRequest) *SubscriptionsModifyPushConfigCall {
  1617. c := &SubscriptionsModifyPushConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1618. c.modifypushconfigrequest = modifypushconfigrequest
  1619. return c
  1620. }
  1621. // Fields allows partial responses to be retrieved. See
  1622. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1623. // for more information.
  1624. func (c *SubscriptionsModifyPushConfigCall) Fields(s ...googleapi.Field) *SubscriptionsModifyPushConfigCall {
  1625. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1626. return c
  1627. }
  1628. // Context sets the context to be used in this call's Do method. Any
  1629. // pending HTTP request will be aborted if the provided context is
  1630. // canceled.
  1631. func (c *SubscriptionsModifyPushConfigCall) Context(ctx context.Context) *SubscriptionsModifyPushConfigCall {
  1632. c.ctx_ = ctx
  1633. return c
  1634. }
  1635. // Header returns an http.Header that can be modified by the caller to
  1636. // add HTTP headers to the request.
  1637. func (c *SubscriptionsModifyPushConfigCall) Header() http.Header {
  1638. if c.header_ == nil {
  1639. c.header_ = make(http.Header)
  1640. }
  1641. return c.header_
  1642. }
  1643. func (c *SubscriptionsModifyPushConfigCall) doRequest(alt string) (*http.Response, error) {
  1644. reqHeaders := make(http.Header)
  1645. for k, v := range c.header_ {
  1646. reqHeaders[k] = v
  1647. }
  1648. reqHeaders.Set("User-Agent", c.s.userAgent())
  1649. var body io.Reader = nil
  1650. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifypushconfigrequest)
  1651. if err != nil {
  1652. return nil, err
  1653. }
  1654. reqHeaders.Set("Content-Type", "application/json")
  1655. c.urlParams_.Set("alt", alt)
  1656. c.urlParams_.Set("prettyPrint", "false")
  1657. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/modifyPushConfig")
  1658. urls += "?" + c.urlParams_.Encode()
  1659. req, err := http.NewRequest("POST", urls, body)
  1660. if err != nil {
  1661. return nil, err
  1662. }
  1663. req.Header = reqHeaders
  1664. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1665. }
  1666. // Do executes the "pubsub.subscriptions.modifyPushConfig" call.
  1667. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1668. // code is an error. Response headers are in either
  1669. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1670. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1671. // check whether the returned error was because http.StatusNotModified
  1672. // was returned.
  1673. func (c *SubscriptionsModifyPushConfigCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1674. gensupport.SetOptions(c.urlParams_, opts...)
  1675. res, err := c.doRequest("json")
  1676. if res != nil && res.StatusCode == http.StatusNotModified {
  1677. if res.Body != nil {
  1678. res.Body.Close()
  1679. }
  1680. return nil, &googleapi.Error{
  1681. Code: res.StatusCode,
  1682. Header: res.Header,
  1683. }
  1684. }
  1685. if err != nil {
  1686. return nil, err
  1687. }
  1688. defer googleapi.CloseBody(res)
  1689. if err := googleapi.CheckResponse(res); err != nil {
  1690. return nil, err
  1691. }
  1692. ret := &Empty{
  1693. ServerResponse: googleapi.ServerResponse{
  1694. Header: res.Header,
  1695. HTTPStatusCode: res.StatusCode,
  1696. },
  1697. }
  1698. target := &ret
  1699. if err := gensupport.DecodeResponse(target, res); err != nil {
  1700. return nil, err
  1701. }
  1702. return ret, nil
  1703. // {
  1704. // "description": "Modifies the \u003ccode\u003ePushConfig\u003c/code\u003e for a specified subscription.\nThis method can be used to suspend the flow of messages to an endpoint\nby clearing the \u003ccode\u003ePushConfig\u003c/code\u003e field in the request. Messages\nwill be accumulated for delivery even if no push configuration is\ndefined or while the configuration is modified.",
  1705. // "flatPath": "v1beta1a/subscriptions/modifyPushConfig",
  1706. // "httpMethod": "POST",
  1707. // "id": "pubsub.subscriptions.modifyPushConfig",
  1708. // "parameterOrder": [],
  1709. // "parameters": {},
  1710. // "path": "v1beta1a/subscriptions/modifyPushConfig",
  1711. // "request": {
  1712. // "$ref": "ModifyPushConfigRequest"
  1713. // },
  1714. // "response": {
  1715. // "$ref": "Empty"
  1716. // },
  1717. // "scopes": [
  1718. // "https://www.googleapis.com/auth/cloud-platform",
  1719. // "https://www.googleapis.com/auth/pubsub"
  1720. // ]
  1721. // }
  1722. }
  1723. // method id "pubsub.subscriptions.pull":
  1724. type SubscriptionsPullCall struct {
  1725. s *Service
  1726. pullrequest *PullRequest
  1727. urlParams_ gensupport.URLParams
  1728. ctx_ context.Context
  1729. header_ http.Header
  1730. }
  1731. // Pull: Pulls a single message from the server.
  1732. // If return_immediately is true, and no messages are available in
  1733. // the
  1734. // subscription, this method returns FAILED_PRECONDITION. The system is
  1735. // free
  1736. // to return an UNAVAILABLE error if no messages are available in
  1737. // a
  1738. // reasonable amount of time (to reduce system load).
  1739. func (r *SubscriptionsService) Pull(pullrequest *PullRequest) *SubscriptionsPullCall {
  1740. c := &SubscriptionsPullCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1741. c.pullrequest = pullrequest
  1742. return c
  1743. }
  1744. // Fields allows partial responses to be retrieved. See
  1745. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1746. // for more information.
  1747. func (c *SubscriptionsPullCall) Fields(s ...googleapi.Field) *SubscriptionsPullCall {
  1748. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1749. return c
  1750. }
  1751. // Context sets the context to be used in this call's Do method. Any
  1752. // pending HTTP request will be aborted if the provided context is
  1753. // canceled.
  1754. func (c *SubscriptionsPullCall) Context(ctx context.Context) *SubscriptionsPullCall {
  1755. c.ctx_ = ctx
  1756. return c
  1757. }
  1758. // Header returns an http.Header that can be modified by the caller to
  1759. // add HTTP headers to the request.
  1760. func (c *SubscriptionsPullCall) Header() http.Header {
  1761. if c.header_ == nil {
  1762. c.header_ = make(http.Header)
  1763. }
  1764. return c.header_
  1765. }
  1766. func (c *SubscriptionsPullCall) doRequest(alt string) (*http.Response, error) {
  1767. reqHeaders := make(http.Header)
  1768. for k, v := range c.header_ {
  1769. reqHeaders[k] = v
  1770. }
  1771. reqHeaders.Set("User-Agent", c.s.userAgent())
  1772. var body io.Reader = nil
  1773. body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullrequest)
  1774. if err != nil {
  1775. return nil, err
  1776. }
  1777. reqHeaders.Set("Content-Type", "application/json")
  1778. c.urlParams_.Set("alt", alt)
  1779. c.urlParams_.Set("prettyPrint", "false")
  1780. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/pull")
  1781. urls += "?" + c.urlParams_.Encode()
  1782. req, err := http.NewRequest("POST", urls, body)
  1783. if err != nil {
  1784. return nil, err
  1785. }
  1786. req.Header = reqHeaders
  1787. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1788. }
  1789. // Do executes the "pubsub.subscriptions.pull" call.
  1790. // Exactly one of *PullResponse or error will be non-nil. Any non-2xx
  1791. // status code is an error. Response headers are in either
  1792. // *PullResponse.ServerResponse.Header or (if a response was returned at
  1793. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1794. // to check whether the returned error was because
  1795. // http.StatusNotModified was returned.
  1796. func (c *SubscriptionsPullCall) Do(opts ...googleapi.CallOption) (*PullResponse, error) {
  1797. gensupport.SetOptions(c.urlParams_, opts...)
  1798. res, err := c.doRequest("json")
  1799. if res != nil && res.StatusCode == http.StatusNotModified {
  1800. if res.Body != nil {
  1801. res.Body.Close()
  1802. }
  1803. return nil, &googleapi.Error{
  1804. Code: res.StatusCode,
  1805. Header: res.Header,
  1806. }
  1807. }
  1808. if err != nil {
  1809. return nil, err
  1810. }
  1811. defer googleapi.CloseBody(res)
  1812. if err := googleapi.CheckResponse(res); err != nil {
  1813. return nil, err
  1814. }
  1815. ret := &PullResponse{
  1816. ServerResponse: googleapi.ServerResponse{
  1817. Header: res.Header,
  1818. HTTPStatusCode: res.StatusCode,
  1819. },
  1820. }
  1821. target := &ret
  1822. if err := gensupport.DecodeResponse(target, res); err != nil {
  1823. return nil, err
  1824. }
  1825. return ret, nil
  1826. // {
  1827. // "description": "Pulls a single message from the server.\nIf return_immediately is true, and no messages are available in the\nsubscription, this method returns FAILED_PRECONDITION. The system is free\nto return an UNAVAILABLE error if no messages are available in a\nreasonable amount of time (to reduce system load).",
  1828. // "flatPath": "v1beta1a/subscriptions/pull",
  1829. // "httpMethod": "POST",
  1830. // "id": "pubsub.subscriptions.pull",
  1831. // "parameterOrder": [],
  1832. // "parameters": {},
  1833. // "path": "v1beta1a/subscriptions/pull",
  1834. // "request": {
  1835. // "$ref": "PullRequest"
  1836. // },
  1837. // "response": {
  1838. // "$ref": "PullResponse"
  1839. // },
  1840. // "scopes": [
  1841. // "https://www.googleapis.com/auth/cloud-platform",
  1842. // "https://www.googleapis.com/auth/pubsub"
  1843. // ]
  1844. // }
  1845. }
  1846. // method id "pubsub.subscriptions.pullBatch":
  1847. type SubscriptionsPullBatchCall struct {
  1848. s *Service
  1849. pullbatchrequest *PullBatchRequest
  1850. urlParams_ gensupport.URLParams
  1851. ctx_ context.Context
  1852. header_ http.Header
  1853. }
  1854. // PullBatch: Pulls messages from the server. Returns an empty list if
  1855. // there are no
  1856. // messages available in the backlog. The system is free to return
  1857. // UNAVAILABLE
  1858. // if there are too many pull requests outstanding for the given
  1859. // subscription.
  1860. func (r *SubscriptionsService) PullBatch(pullbatchrequest *PullBatchRequest) *SubscriptionsPullBatchCall {
  1861. c := &SubscriptionsPullBatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1862. c.pullbatchrequest = pullbatchrequest
  1863. return c
  1864. }
  1865. // Fields allows partial responses to be retrieved. See
  1866. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1867. // for more information.
  1868. func (c *SubscriptionsPullBatchCall) Fields(s ...googleapi.Field) *SubscriptionsPullBatchCall {
  1869. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1870. return c
  1871. }
  1872. // Context sets the context to be used in this call's Do method. Any
  1873. // pending HTTP request will be aborted if the provided context is
  1874. // canceled.
  1875. func (c *SubscriptionsPullBatchCall) Context(ctx context.Context) *SubscriptionsPullBatchCall {
  1876. c.ctx_ = ctx
  1877. return c
  1878. }
  1879. // Header returns an http.Header that can be modified by the caller to
  1880. // add HTTP headers to the request.
  1881. func (c *SubscriptionsPullBatchCall) Header() http.Header {
  1882. if c.header_ == nil {
  1883. c.header_ = make(http.Header)
  1884. }
  1885. return c.header_
  1886. }
  1887. func (c *SubscriptionsPullBatchCall) doRequest(alt string) (*http.Response, error) {
  1888. reqHeaders := make(http.Header)
  1889. for k, v := range c.header_ {
  1890. reqHeaders[k] = v
  1891. }
  1892. reqHeaders.Set("User-Agent", c.s.userAgent())
  1893. var body io.Reader = nil
  1894. body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullbatchrequest)
  1895. if err != nil {
  1896. return nil, err
  1897. }
  1898. reqHeaders.Set("Content-Type", "application/json")
  1899. c.urlParams_.Set("alt", alt)
  1900. c.urlParams_.Set("prettyPrint", "false")
  1901. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/pullBatch")
  1902. urls += "?" + c.urlParams_.Encode()
  1903. req, err := http.NewRequest("POST", urls, body)
  1904. if err != nil {
  1905. return nil, err
  1906. }
  1907. req.Header = reqHeaders
  1908. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1909. }
  1910. // Do executes the "pubsub.subscriptions.pullBatch" call.
  1911. // Exactly one of *PullBatchResponse or error will be non-nil. Any
  1912. // non-2xx status code is an error. Response headers are in either
  1913. // *PullBatchResponse.ServerResponse.Header or (if a response was
  1914. // returned at all) in error.(*googleapi.Error).Header. Use
  1915. // googleapi.IsNotModified to check whether the returned error was
  1916. // because http.StatusNotModified was returned.
  1917. func (c *SubscriptionsPullBatchCall) Do(opts ...googleapi.CallOption) (*PullBatchResponse, error) {
  1918. gensupport.SetOptions(c.urlParams_, opts...)
  1919. res, err := c.doRequest("json")
  1920. if res != nil && res.StatusCode == http.StatusNotModified {
  1921. if res.Body != nil {
  1922. res.Body.Close()
  1923. }
  1924. return nil, &googleapi.Error{
  1925. Code: res.StatusCode,
  1926. Header: res.Header,
  1927. }
  1928. }
  1929. if err != nil {
  1930. return nil, err
  1931. }
  1932. defer googleapi.CloseBody(res)
  1933. if err := googleapi.CheckResponse(res); err != nil {
  1934. return nil, err
  1935. }
  1936. ret := &PullBatchResponse{
  1937. ServerResponse: googleapi.ServerResponse{
  1938. Header: res.Header,
  1939. HTTPStatusCode: res.StatusCode,
  1940. },
  1941. }
  1942. target := &ret
  1943. if err := gensupport.DecodeResponse(target, res); err != nil {
  1944. return nil, err
  1945. }
  1946. return ret, nil
  1947. // {
  1948. // "description": "Pulls messages from the server. Returns an empty list if there are no\nmessages available in the backlog. The system is free to return UNAVAILABLE\nif there are too many pull requests outstanding for the given subscription.",
  1949. // "flatPath": "v1beta1a/subscriptions/pullBatch",
  1950. // "httpMethod": "POST",
  1951. // "id": "pubsub.subscriptions.pullBatch",
  1952. // "parameterOrder": [],
  1953. // "parameters": {},
  1954. // "path": "v1beta1a/subscriptions/pullBatch",
  1955. // "request": {
  1956. // "$ref": "PullBatchRequest"
  1957. // },
  1958. // "response": {
  1959. // "$ref": "PullBatchResponse"
  1960. // },
  1961. // "scopes": [
  1962. // "https://www.googleapis.com/auth/cloud-platform",
  1963. // "https://www.googleapis.com/auth/pubsub"
  1964. // ]
  1965. // }
  1966. }
  1967. // method id "pubsub.topics.create":
  1968. type TopicsCreateCall struct {
  1969. s *Service
  1970. topic *Topic
  1971. urlParams_ gensupport.URLParams
  1972. ctx_ context.Context
  1973. header_ http.Header
  1974. }
  1975. // Create: Creates the given topic with the given name.
  1976. func (r *TopicsService) Create(topic *Topic) *TopicsCreateCall {
  1977. c := &TopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1978. c.topic = topic
  1979. return c
  1980. }
  1981. // Fields allows partial responses to be retrieved. See
  1982. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1983. // for more information.
  1984. func (c *TopicsCreateCall) Fields(s ...googleapi.Field) *TopicsCreateCall {
  1985. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1986. return c
  1987. }
  1988. // Context sets the context to be used in this call's Do method. Any
  1989. // pending HTTP request will be aborted if the provided context is
  1990. // canceled.
  1991. func (c *TopicsCreateCall) Context(ctx context.Context) *TopicsCreateCall {
  1992. c.ctx_ = ctx
  1993. return c
  1994. }
  1995. // Header returns an http.Header that can be modified by the caller to
  1996. // add HTTP headers to the request.
  1997. func (c *TopicsCreateCall) Header() http.Header {
  1998. if c.header_ == nil {
  1999. c.header_ = make(http.Header)
  2000. }
  2001. return c.header_
  2002. }
  2003. func (c *TopicsCreateCall) doRequest(alt string) (*http.Response, error) {
  2004. reqHeaders := make(http.Header)
  2005. for k, v := range c.header_ {
  2006. reqHeaders[k] = v
  2007. }
  2008. reqHeaders.Set("User-Agent", c.s.userAgent())
  2009. var body io.Reader = nil
  2010. body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic)
  2011. if err != nil {
  2012. return nil, err
  2013. }
  2014. reqHeaders.Set("Content-Type", "application/json")
  2015. c.urlParams_.Set("alt", alt)
  2016. c.urlParams_.Set("prettyPrint", "false")
  2017. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics")
  2018. urls += "?" + c.urlParams_.Encode()
  2019. req, err := http.NewRequest("POST", urls, body)
  2020. if err != nil {
  2021. return nil, err
  2022. }
  2023. req.Header = reqHeaders
  2024. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2025. }
  2026. // Do executes the "pubsub.topics.create" call.
  2027. // Exactly one of *Topic or error will be non-nil. Any non-2xx status
  2028. // code is an error. Response headers are in either
  2029. // *Topic.ServerResponse.Header or (if a response was returned at all)
  2030. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2031. // check whether the returned error was because http.StatusNotModified
  2032. // was returned.
  2033. func (c *TopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
  2034. gensupport.SetOptions(c.urlParams_, opts...)
  2035. res, err := c.doRequest("json")
  2036. if res != nil && res.StatusCode == http.StatusNotModified {
  2037. if res.Body != nil {
  2038. res.Body.Close()
  2039. }
  2040. return nil, &googleapi.Error{
  2041. Code: res.StatusCode,
  2042. Header: res.Header,
  2043. }
  2044. }
  2045. if err != nil {
  2046. return nil, err
  2047. }
  2048. defer googleapi.CloseBody(res)
  2049. if err := googleapi.CheckResponse(res); err != nil {
  2050. return nil, err
  2051. }
  2052. ret := &Topic{
  2053. ServerResponse: googleapi.ServerResponse{
  2054. Header: res.Header,
  2055. HTTPStatusCode: res.StatusCode,
  2056. },
  2057. }
  2058. target := &ret
  2059. if err := gensupport.DecodeResponse(target, res); err != nil {
  2060. return nil, err
  2061. }
  2062. return ret, nil
  2063. // {
  2064. // "description": "Creates the given topic with the given name.",
  2065. // "flatPath": "v1beta1a/topics",
  2066. // "httpMethod": "POST",
  2067. // "id": "pubsub.topics.create",
  2068. // "parameterOrder": [],
  2069. // "parameters": {},
  2070. // "path": "v1beta1a/topics",
  2071. // "request": {
  2072. // "$ref": "Topic"
  2073. // },
  2074. // "response": {
  2075. // "$ref": "Topic"
  2076. // },
  2077. // "scopes": [
  2078. // "https://www.googleapis.com/auth/cloud-platform",
  2079. // "https://www.googleapis.com/auth/pubsub"
  2080. // ]
  2081. // }
  2082. }
  2083. // method id "pubsub.topics.delete":
  2084. type TopicsDeleteCall struct {
  2085. s *Service
  2086. topic string
  2087. urlParams_ gensupport.URLParams
  2088. ctx_ context.Context
  2089. header_ http.Header
  2090. }
  2091. // Delete: Deletes the topic with the given name. Returns NOT_FOUND if
  2092. // the topic does
  2093. // not exist. After a topic is deleted, a new topic may be created with
  2094. // the
  2095. // same name.
  2096. func (r *TopicsService) Delete(topic string) *TopicsDeleteCall {
  2097. c := &TopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2098. c.topic = topic
  2099. return c
  2100. }
  2101. // Fields allows partial responses to be retrieved. See
  2102. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2103. // for more information.
  2104. func (c *TopicsDeleteCall) Fields(s ...googleapi.Field) *TopicsDeleteCall {
  2105. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2106. return c
  2107. }
  2108. // Context sets the context to be used in this call's Do method. Any
  2109. // pending HTTP request will be aborted if the provided context is
  2110. // canceled.
  2111. func (c *TopicsDeleteCall) Context(ctx context.Context) *TopicsDeleteCall {
  2112. c.ctx_ = ctx
  2113. return c
  2114. }
  2115. // Header returns an http.Header that can be modified by the caller to
  2116. // add HTTP headers to the request.
  2117. func (c *TopicsDeleteCall) Header() http.Header {
  2118. if c.header_ == nil {
  2119. c.header_ = make(http.Header)
  2120. }
  2121. return c.header_
  2122. }
  2123. func (c *TopicsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2124. reqHeaders := make(http.Header)
  2125. for k, v := range c.header_ {
  2126. reqHeaders[k] = v
  2127. }
  2128. reqHeaders.Set("User-Agent", c.s.userAgent())
  2129. var body io.Reader = nil
  2130. c.urlParams_.Set("alt", alt)
  2131. c.urlParams_.Set("prettyPrint", "false")
  2132. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics/{+topic}")
  2133. urls += "?" + c.urlParams_.Encode()
  2134. req, err := http.NewRequest("DELETE", urls, body)
  2135. if err != nil {
  2136. return nil, err
  2137. }
  2138. req.Header = reqHeaders
  2139. googleapi.Expand(req.URL, map[string]string{
  2140. "topic": c.topic,
  2141. })
  2142. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2143. }
  2144. // Do executes the "pubsub.topics.delete" call.
  2145. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2146. // code is an error. Response headers are in either
  2147. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2148. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2149. // check whether the returned error was because http.StatusNotModified
  2150. // was returned.
  2151. func (c *TopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2152. gensupport.SetOptions(c.urlParams_, opts...)
  2153. res, err := c.doRequest("json")
  2154. if res != nil && res.StatusCode == http.StatusNotModified {
  2155. if res.Body != nil {
  2156. res.Body.Close()
  2157. }
  2158. return nil, &googleapi.Error{
  2159. Code: res.StatusCode,
  2160. Header: res.Header,
  2161. }
  2162. }
  2163. if err != nil {
  2164. return nil, err
  2165. }
  2166. defer googleapi.CloseBody(res)
  2167. if err := googleapi.CheckResponse(res); err != nil {
  2168. return nil, err
  2169. }
  2170. ret := &Empty{
  2171. ServerResponse: googleapi.ServerResponse{
  2172. Header: res.Header,
  2173. HTTPStatusCode: res.StatusCode,
  2174. },
  2175. }
  2176. target := &ret
  2177. if err := gensupport.DecodeResponse(target, res); err != nil {
  2178. return nil, err
  2179. }
  2180. return ret, nil
  2181. // {
  2182. // "description": "Deletes the topic with the given name. Returns NOT_FOUND if the topic does\nnot exist. After a topic is deleted, a new topic may be created with the\nsame name.",
  2183. // "flatPath": "v1beta1a/topics/{topicsId}",
  2184. // "httpMethod": "DELETE",
  2185. // "id": "pubsub.topics.delete",
  2186. // "parameterOrder": [
  2187. // "topic"
  2188. // ],
  2189. // "parameters": {
  2190. // "topic": {
  2191. // "description": "Name of the topic to delete.",
  2192. // "location": "path",
  2193. // "pattern": "^.+$",
  2194. // "required": true,
  2195. // "type": "string"
  2196. // }
  2197. // },
  2198. // "path": "v1beta1a/topics/{+topic}",
  2199. // "response": {
  2200. // "$ref": "Empty"
  2201. // },
  2202. // "scopes": [
  2203. // "https://www.googleapis.com/auth/cloud-platform",
  2204. // "https://www.googleapis.com/auth/pubsub"
  2205. // ]
  2206. // }
  2207. }
  2208. // method id "pubsub.topics.get":
  2209. type TopicsGetCall struct {
  2210. s *Service
  2211. topic string
  2212. urlParams_ gensupport.URLParams
  2213. ifNoneMatch_ string
  2214. ctx_ context.Context
  2215. header_ http.Header
  2216. }
  2217. // Get: Gets the configuration of a topic. Since the topic only has the
  2218. // name
  2219. // attribute, this method is only useful to check the existence of a
  2220. // topic.
  2221. // If other attributes are added in the future, they will be returned
  2222. // here.
  2223. func (r *TopicsService) Get(topic string) *TopicsGetCall {
  2224. c := &TopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2225. c.topic = topic
  2226. return c
  2227. }
  2228. // Fields allows partial responses to be retrieved. See
  2229. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2230. // for more information.
  2231. func (c *TopicsGetCall) Fields(s ...googleapi.Field) *TopicsGetCall {
  2232. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2233. return c
  2234. }
  2235. // IfNoneMatch sets the optional parameter which makes the operation
  2236. // fail if the object's ETag matches the given value. This is useful for
  2237. // getting updates only after the object has changed since the last
  2238. // request. Use googleapi.IsNotModified to check whether the response
  2239. // error from Do is the result of In-None-Match.
  2240. func (c *TopicsGetCall) IfNoneMatch(entityTag string) *TopicsGetCall {
  2241. c.ifNoneMatch_ = entityTag
  2242. return c
  2243. }
  2244. // Context sets the context to be used in this call's Do method. Any
  2245. // pending HTTP request will be aborted if the provided context is
  2246. // canceled.
  2247. func (c *TopicsGetCall) Context(ctx context.Context) *TopicsGetCall {
  2248. c.ctx_ = ctx
  2249. return c
  2250. }
  2251. // Header returns an http.Header that can be modified by the caller to
  2252. // add HTTP headers to the request.
  2253. func (c *TopicsGetCall) Header() http.Header {
  2254. if c.header_ == nil {
  2255. c.header_ = make(http.Header)
  2256. }
  2257. return c.header_
  2258. }
  2259. func (c *TopicsGetCall) doRequest(alt string) (*http.Response, error) {
  2260. reqHeaders := make(http.Header)
  2261. for k, v := range c.header_ {
  2262. reqHeaders[k] = v
  2263. }
  2264. reqHeaders.Set("User-Agent", c.s.userAgent())
  2265. if c.ifNoneMatch_ != "" {
  2266. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2267. }
  2268. var body io.Reader = nil
  2269. c.urlParams_.Set("alt", alt)
  2270. c.urlParams_.Set("prettyPrint", "false")
  2271. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics/{+topic}")
  2272. urls += "?" + c.urlParams_.Encode()
  2273. req, err := http.NewRequest("GET", urls, body)
  2274. if err != nil {
  2275. return nil, err
  2276. }
  2277. req.Header = reqHeaders
  2278. googleapi.Expand(req.URL, map[string]string{
  2279. "topic": c.topic,
  2280. })
  2281. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2282. }
  2283. // Do executes the "pubsub.topics.get" call.
  2284. // Exactly one of *Topic or error will be non-nil. Any non-2xx status
  2285. // code is an error. Response headers are in either
  2286. // *Topic.ServerResponse.Header or (if a response was returned at all)
  2287. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2288. // check whether the returned error was because http.StatusNotModified
  2289. // was returned.
  2290. func (c *TopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
  2291. gensupport.SetOptions(c.urlParams_, opts...)
  2292. res, err := c.doRequest("json")
  2293. if res != nil && res.StatusCode == http.StatusNotModified {
  2294. if res.Body != nil {
  2295. res.Body.Close()
  2296. }
  2297. return nil, &googleapi.Error{
  2298. Code: res.StatusCode,
  2299. Header: res.Header,
  2300. }
  2301. }
  2302. if err != nil {
  2303. return nil, err
  2304. }
  2305. defer googleapi.CloseBody(res)
  2306. if err := googleapi.CheckResponse(res); err != nil {
  2307. return nil, err
  2308. }
  2309. ret := &Topic{
  2310. ServerResponse: googleapi.ServerResponse{
  2311. Header: res.Header,
  2312. HTTPStatusCode: res.StatusCode,
  2313. },
  2314. }
  2315. target := &ret
  2316. if err := gensupport.DecodeResponse(target, res); err != nil {
  2317. return nil, err
  2318. }
  2319. return ret, nil
  2320. // {
  2321. // "description": "Gets the configuration of a topic. Since the topic only has the name\nattribute, this method is only useful to check the existence of a topic.\nIf other attributes are added in the future, they will be returned here.",
  2322. // "flatPath": "v1beta1a/topics/{topicsId}",
  2323. // "httpMethod": "GET",
  2324. // "id": "pubsub.topics.get",
  2325. // "parameterOrder": [
  2326. // "topic"
  2327. // ],
  2328. // "parameters": {
  2329. // "topic": {
  2330. // "description": "The name of the topic to get.",
  2331. // "location": "path",
  2332. // "pattern": "^.+$",
  2333. // "required": true,
  2334. // "type": "string"
  2335. // }
  2336. // },
  2337. // "path": "v1beta1a/topics/{+topic}",
  2338. // "response": {
  2339. // "$ref": "Topic"
  2340. // },
  2341. // "scopes": [
  2342. // "https://www.googleapis.com/auth/cloud-platform",
  2343. // "https://www.googleapis.com/auth/pubsub"
  2344. // ]
  2345. // }
  2346. }
  2347. // method id "pubsub.topics.list":
  2348. type TopicsListCall struct {
  2349. s *Service
  2350. urlParams_ gensupport.URLParams
  2351. ifNoneMatch_ string
  2352. ctx_ context.Context
  2353. header_ http.Header
  2354. }
  2355. // List: Lists matching topics.
  2356. func (r *TopicsService) List() *TopicsListCall {
  2357. c := &TopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2358. return c
  2359. }
  2360. // MaxResults sets the optional parameter "maxResults": Maximum number
  2361. // of topics to return.
  2362. func (c *TopicsListCall) MaxResults(maxResults int64) *TopicsListCall {
  2363. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2364. return c
  2365. }
  2366. // PageToken sets the optional parameter "pageToken": The value obtained
  2367. // in the last <code>ListTopicsResponse</code>
  2368. // for continuation.
  2369. func (c *TopicsListCall) PageToken(pageToken string) *TopicsListCall {
  2370. c.urlParams_.Set("pageToken", pageToken)
  2371. return c
  2372. }
  2373. // Query sets the optional parameter "query": A valid label query
  2374. // expression.
  2375. func (c *TopicsListCall) Query(query string) *TopicsListCall {
  2376. c.urlParams_.Set("query", query)
  2377. return c
  2378. }
  2379. // Fields allows partial responses to be retrieved. See
  2380. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2381. // for more information.
  2382. func (c *TopicsListCall) Fields(s ...googleapi.Field) *TopicsListCall {
  2383. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2384. return c
  2385. }
  2386. // IfNoneMatch sets the optional parameter which makes the operation
  2387. // fail if the object's ETag matches the given value. This is useful for
  2388. // getting updates only after the object has changed since the last
  2389. // request. Use googleapi.IsNotModified to check whether the response
  2390. // error from Do is the result of In-None-Match.
  2391. func (c *TopicsListCall) IfNoneMatch(entityTag string) *TopicsListCall {
  2392. c.ifNoneMatch_ = entityTag
  2393. return c
  2394. }
  2395. // Context sets the context to be used in this call's Do method. Any
  2396. // pending HTTP request will be aborted if the provided context is
  2397. // canceled.
  2398. func (c *TopicsListCall) Context(ctx context.Context) *TopicsListCall {
  2399. c.ctx_ = ctx
  2400. return c
  2401. }
  2402. // Header returns an http.Header that can be modified by the caller to
  2403. // add HTTP headers to the request.
  2404. func (c *TopicsListCall) Header() http.Header {
  2405. if c.header_ == nil {
  2406. c.header_ = make(http.Header)
  2407. }
  2408. return c.header_
  2409. }
  2410. func (c *TopicsListCall) doRequest(alt string) (*http.Response, error) {
  2411. reqHeaders := make(http.Header)
  2412. for k, v := range c.header_ {
  2413. reqHeaders[k] = v
  2414. }
  2415. reqHeaders.Set("User-Agent", c.s.userAgent())
  2416. if c.ifNoneMatch_ != "" {
  2417. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2418. }
  2419. var body io.Reader = nil
  2420. c.urlParams_.Set("alt", alt)
  2421. c.urlParams_.Set("prettyPrint", "false")
  2422. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics")
  2423. urls += "?" + c.urlParams_.Encode()
  2424. req, err := http.NewRequest("GET", urls, body)
  2425. if err != nil {
  2426. return nil, err
  2427. }
  2428. req.Header = reqHeaders
  2429. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2430. }
  2431. // Do executes the "pubsub.topics.list" call.
  2432. // Exactly one of *ListTopicsResponse or error will be non-nil. Any
  2433. // non-2xx status code is an error. Response headers are in either
  2434. // *ListTopicsResponse.ServerResponse.Header or (if a response was
  2435. // returned at all) in error.(*googleapi.Error).Header. Use
  2436. // googleapi.IsNotModified to check whether the returned error was
  2437. // because http.StatusNotModified was returned.
  2438. func (c *TopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsResponse, error) {
  2439. gensupport.SetOptions(c.urlParams_, opts...)
  2440. res, err := c.doRequest("json")
  2441. if res != nil && res.StatusCode == http.StatusNotModified {
  2442. if res.Body != nil {
  2443. res.Body.Close()
  2444. }
  2445. return nil, &googleapi.Error{
  2446. Code: res.StatusCode,
  2447. Header: res.Header,
  2448. }
  2449. }
  2450. if err != nil {
  2451. return nil, err
  2452. }
  2453. defer googleapi.CloseBody(res)
  2454. if err := googleapi.CheckResponse(res); err != nil {
  2455. return nil, err
  2456. }
  2457. ret := &ListTopicsResponse{
  2458. ServerResponse: googleapi.ServerResponse{
  2459. Header: res.Header,
  2460. HTTPStatusCode: res.StatusCode,
  2461. },
  2462. }
  2463. target := &ret
  2464. if err := gensupport.DecodeResponse(target, res); err != nil {
  2465. return nil, err
  2466. }
  2467. return ret, nil
  2468. // {
  2469. // "description": "Lists matching topics.",
  2470. // "flatPath": "v1beta1a/topics",
  2471. // "httpMethod": "GET",
  2472. // "id": "pubsub.topics.list",
  2473. // "parameterOrder": [],
  2474. // "parameters": {
  2475. // "maxResults": {
  2476. // "description": "Maximum number of topics to return.",
  2477. // "format": "int32",
  2478. // "location": "query",
  2479. // "type": "integer"
  2480. // },
  2481. // "pageToken": {
  2482. // "description": "The value obtained in the last \u003ccode\u003eListTopicsResponse\u003c/code\u003e\nfor continuation.",
  2483. // "location": "query",
  2484. // "type": "string"
  2485. // },
  2486. // "query": {
  2487. // "description": "A valid label query expression.",
  2488. // "location": "query",
  2489. // "type": "string"
  2490. // }
  2491. // },
  2492. // "path": "v1beta1a/topics",
  2493. // "response": {
  2494. // "$ref": "ListTopicsResponse"
  2495. // },
  2496. // "scopes": [
  2497. // "https://www.googleapis.com/auth/cloud-platform",
  2498. // "https://www.googleapis.com/auth/pubsub"
  2499. // ]
  2500. // }
  2501. }
  2502. // Pages invokes f for each page of results.
  2503. // A non-nil error returned from f will halt the iteration.
  2504. // The provided context supersedes any context provided to the Context method.
  2505. func (c *TopicsListCall) Pages(ctx context.Context, f func(*ListTopicsResponse) error) error {
  2506. c.ctx_ = ctx
  2507. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2508. for {
  2509. x, err := c.Do()
  2510. if err != nil {
  2511. return err
  2512. }
  2513. if err := f(x); err != nil {
  2514. return err
  2515. }
  2516. if x.NextPageToken == "" {
  2517. return nil
  2518. }
  2519. c.PageToken(x.NextPageToken)
  2520. }
  2521. }
  2522. // method id "pubsub.topics.publish":
  2523. type TopicsPublishCall struct {
  2524. s *Service
  2525. publishrequest *PublishRequest
  2526. urlParams_ gensupport.URLParams
  2527. ctx_ context.Context
  2528. header_ http.Header
  2529. }
  2530. // Publish: Adds a message to the topic. Returns NOT_FOUND if the topic
  2531. // does not
  2532. // exist.
  2533. func (r *TopicsService) Publish(publishrequest *PublishRequest) *TopicsPublishCall {
  2534. c := &TopicsPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2535. c.publishrequest = publishrequest
  2536. return c
  2537. }
  2538. // Fields allows partial responses to be retrieved. See
  2539. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2540. // for more information.
  2541. func (c *TopicsPublishCall) Fields(s ...googleapi.Field) *TopicsPublishCall {
  2542. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2543. return c
  2544. }
  2545. // Context sets the context to be used in this call's Do method. Any
  2546. // pending HTTP request will be aborted if the provided context is
  2547. // canceled.
  2548. func (c *TopicsPublishCall) Context(ctx context.Context) *TopicsPublishCall {
  2549. c.ctx_ = ctx
  2550. return c
  2551. }
  2552. // Header returns an http.Header that can be modified by the caller to
  2553. // add HTTP headers to the request.
  2554. func (c *TopicsPublishCall) Header() http.Header {
  2555. if c.header_ == nil {
  2556. c.header_ = make(http.Header)
  2557. }
  2558. return c.header_
  2559. }
  2560. func (c *TopicsPublishCall) doRequest(alt string) (*http.Response, error) {
  2561. reqHeaders := make(http.Header)
  2562. for k, v := range c.header_ {
  2563. reqHeaders[k] = v
  2564. }
  2565. reqHeaders.Set("User-Agent", c.s.userAgent())
  2566. var body io.Reader = nil
  2567. body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishrequest)
  2568. if err != nil {
  2569. return nil, err
  2570. }
  2571. reqHeaders.Set("Content-Type", "application/json")
  2572. c.urlParams_.Set("alt", alt)
  2573. c.urlParams_.Set("prettyPrint", "false")
  2574. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics/publish")
  2575. urls += "?" + c.urlParams_.Encode()
  2576. req, err := http.NewRequest("POST", urls, body)
  2577. if err != nil {
  2578. return nil, err
  2579. }
  2580. req.Header = reqHeaders
  2581. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2582. }
  2583. // Do executes the "pubsub.topics.publish" call.
  2584. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2585. // code is an error. Response headers are in either
  2586. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2587. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2588. // check whether the returned error was because http.StatusNotModified
  2589. // was returned.
  2590. func (c *TopicsPublishCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2591. gensupport.SetOptions(c.urlParams_, opts...)
  2592. res, err := c.doRequest("json")
  2593. if res != nil && res.StatusCode == http.StatusNotModified {
  2594. if res.Body != nil {
  2595. res.Body.Close()
  2596. }
  2597. return nil, &googleapi.Error{
  2598. Code: res.StatusCode,
  2599. Header: res.Header,
  2600. }
  2601. }
  2602. if err != nil {
  2603. return nil, err
  2604. }
  2605. defer googleapi.CloseBody(res)
  2606. if err := googleapi.CheckResponse(res); err != nil {
  2607. return nil, err
  2608. }
  2609. ret := &Empty{
  2610. ServerResponse: googleapi.ServerResponse{
  2611. Header: res.Header,
  2612. HTTPStatusCode: res.StatusCode,
  2613. },
  2614. }
  2615. target := &ret
  2616. if err := gensupport.DecodeResponse(target, res); err != nil {
  2617. return nil, err
  2618. }
  2619. return ret, nil
  2620. // {
  2621. // "description": "Adds a message to the topic. Returns NOT_FOUND if the topic does not\nexist.",
  2622. // "flatPath": "v1beta1a/topics/publish",
  2623. // "httpMethod": "POST",
  2624. // "id": "pubsub.topics.publish",
  2625. // "parameterOrder": [],
  2626. // "parameters": {},
  2627. // "path": "v1beta1a/topics/publish",
  2628. // "request": {
  2629. // "$ref": "PublishRequest"
  2630. // },
  2631. // "response": {
  2632. // "$ref": "Empty"
  2633. // },
  2634. // "scopes": [
  2635. // "https://www.googleapis.com/auth/cloud-platform",
  2636. // "https://www.googleapis.com/auth/pubsub"
  2637. // ]
  2638. // }
  2639. }
  2640. // method id "pubsub.topics.publishBatch":
  2641. type TopicsPublishBatchCall struct {
  2642. s *Service
  2643. publishbatchrequest *PublishBatchRequest
  2644. urlParams_ gensupport.URLParams
  2645. ctx_ context.Context
  2646. header_ http.Header
  2647. }
  2648. // PublishBatch: Adds one or more messages to the topic. Returns
  2649. // NOT_FOUND if the topic does
  2650. // not exist.
  2651. func (r *TopicsService) PublishBatch(publishbatchrequest *PublishBatchRequest) *TopicsPublishBatchCall {
  2652. c := &TopicsPublishBatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2653. c.publishbatchrequest = publishbatchrequest
  2654. return c
  2655. }
  2656. // Fields allows partial responses to be retrieved. See
  2657. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2658. // for more information.
  2659. func (c *TopicsPublishBatchCall) Fields(s ...googleapi.Field) *TopicsPublishBatchCall {
  2660. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2661. return c
  2662. }
  2663. // Context sets the context to be used in this call's Do method. Any
  2664. // pending HTTP request will be aborted if the provided context is
  2665. // canceled.
  2666. func (c *TopicsPublishBatchCall) Context(ctx context.Context) *TopicsPublishBatchCall {
  2667. c.ctx_ = ctx
  2668. return c
  2669. }
  2670. // Header returns an http.Header that can be modified by the caller to
  2671. // add HTTP headers to the request.
  2672. func (c *TopicsPublishBatchCall) Header() http.Header {
  2673. if c.header_ == nil {
  2674. c.header_ = make(http.Header)
  2675. }
  2676. return c.header_
  2677. }
  2678. func (c *TopicsPublishBatchCall) doRequest(alt string) (*http.Response, error) {
  2679. reqHeaders := make(http.Header)
  2680. for k, v := range c.header_ {
  2681. reqHeaders[k] = v
  2682. }
  2683. reqHeaders.Set("User-Agent", c.s.userAgent())
  2684. var body io.Reader = nil
  2685. body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishbatchrequest)
  2686. if err != nil {
  2687. return nil, err
  2688. }
  2689. reqHeaders.Set("Content-Type", "application/json")
  2690. c.urlParams_.Set("alt", alt)
  2691. c.urlParams_.Set("prettyPrint", "false")
  2692. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics/publishBatch")
  2693. urls += "?" + c.urlParams_.Encode()
  2694. req, err := http.NewRequest("POST", urls, body)
  2695. if err != nil {
  2696. return nil, err
  2697. }
  2698. req.Header = reqHeaders
  2699. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2700. }
  2701. // Do executes the "pubsub.topics.publishBatch" call.
  2702. // Exactly one of *PublishBatchResponse or error will be non-nil. Any
  2703. // non-2xx status code is an error. Response headers are in either
  2704. // *PublishBatchResponse.ServerResponse.Header or (if a response was
  2705. // returned at all) in error.(*googleapi.Error).Header. Use
  2706. // googleapi.IsNotModified to check whether the returned error was
  2707. // because http.StatusNotModified was returned.
  2708. func (c *TopicsPublishBatchCall) Do(opts ...googleapi.CallOption) (*PublishBatchResponse, error) {
  2709. gensupport.SetOptions(c.urlParams_, opts...)
  2710. res, err := c.doRequest("json")
  2711. if res != nil && res.StatusCode == http.StatusNotModified {
  2712. if res.Body != nil {
  2713. res.Body.Close()
  2714. }
  2715. return nil, &googleapi.Error{
  2716. Code: res.StatusCode,
  2717. Header: res.Header,
  2718. }
  2719. }
  2720. if err != nil {
  2721. return nil, err
  2722. }
  2723. defer googleapi.CloseBody(res)
  2724. if err := googleapi.CheckResponse(res); err != nil {
  2725. return nil, err
  2726. }
  2727. ret := &PublishBatchResponse{
  2728. ServerResponse: googleapi.ServerResponse{
  2729. Header: res.Header,
  2730. HTTPStatusCode: res.StatusCode,
  2731. },
  2732. }
  2733. target := &ret
  2734. if err := gensupport.DecodeResponse(target, res); err != nil {
  2735. return nil, err
  2736. }
  2737. return ret, nil
  2738. // {
  2739. // "description": "Adds one or more messages to the topic. Returns NOT_FOUND if the topic does\nnot exist.",
  2740. // "flatPath": "v1beta1a/topics/publishBatch",
  2741. // "httpMethod": "POST",
  2742. // "id": "pubsub.topics.publishBatch",
  2743. // "parameterOrder": [],
  2744. // "parameters": {},
  2745. // "path": "v1beta1a/topics/publishBatch",
  2746. // "request": {
  2747. // "$ref": "PublishBatchRequest"
  2748. // },
  2749. // "response": {
  2750. // "$ref": "PublishBatchResponse"
  2751. // },
  2752. // "scopes": [
  2753. // "https://www.googleapis.com/auth/cloud-platform",
  2754. // "https://www.googleapis.com/auth/pubsub"
  2755. // ]
  2756. // }
  2757. }