...

Source file src/google.golang.org/api/pubsub/v1beta1a/pubsub-gen.go

Documentation: google.golang.org/api/pubsub/v1beta1a

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

View as plain text