...

Source file src/google.golang.org/api/displayvideo/v1beta2/displayvideo-gen.go

Documentation: google.golang.org/api/displayvideo/v1beta2

     1  // Copyright 2020 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 displayvideo provides access to the Display & Video 360 API.
     8  //
     9  // For product documentation, see: https://developers.google.com/display-video/
    10  //
    11  // # Creating a client
    12  //
    13  // Usage example:
    14  //
    15  //	import "google.golang.org/api/displayvideo/v1beta2"
    16  //	...
    17  //	ctx := context.Background()
    18  //	displayvideoService, err := displayvideo.NewService(ctx)
    19  //
    20  // In this example, Google Application Default Credentials are used for authentication.
    21  //
    22  // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    23  //
    24  // # Other authentication options
    25  //
    26  // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
    27  //
    28  //	displayvideoService, err := displayvideo.NewService(ctx, option.WithScopes(displayvideo.DoubleclickbidmanagerScope))
    29  //
    30  // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
    31  //
    32  //	displayvideoService, err := displayvideo.NewService(ctx, option.WithAPIKey("AIza..."))
    33  //
    34  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
    35  //
    36  //	config := &oauth2.Config{...}
    37  //	// ...
    38  //	token, err := config.Exchange(ctx, ...)
    39  //	displayvideoService, err := displayvideo.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    40  //
    41  // See https://godoc.org/google.golang.org/api/option/ for details on options.
    42  package displayvideo // import "google.golang.org/api/displayvideo/v1beta2"
    43  
    44  import (
    45  	"bytes"
    46  	"context"
    47  	"encoding/json"
    48  	"errors"
    49  	"fmt"
    50  	"io"
    51  	"net/http"
    52  	"net/url"
    53  	"strconv"
    54  	"strings"
    55  
    56  	googleapi "google.golang.org/api/googleapi"
    57  	gensupport "google.golang.org/api/internal/gensupport"
    58  	option "google.golang.org/api/option"
    59  	internaloption "google.golang.org/api/option/internaloption"
    60  	htransport "google.golang.org/api/transport/http"
    61  )
    62  
    63  // Always reference these packages, just in case the auto-generated code
    64  // below doesn't.
    65  var _ = bytes.NewBuffer
    66  var _ = strconv.Itoa
    67  var _ = fmt.Sprintf
    68  var _ = json.NewDecoder
    69  var _ = io.Copy
    70  var _ = url.Parse
    71  var _ = gensupport.MarshalJSON
    72  var _ = googleapi.Version
    73  var _ = errors.New
    74  var _ = strings.Replace
    75  var _ = context.Canceled
    76  var _ = internaloption.WithDefaultEndpoint
    77  
    78  const apiId = "displayvideo:v1beta2"
    79  const apiName = "displayvideo"
    80  const apiVersion = "v1beta2"
    81  const basePath = "https://displayvideo.googleapis.com/"
    82  const mtlsBasePath = "https://displayvideo.mtls.googleapis.com/"
    83  
    84  // OAuth2 scopes used by this API.
    85  const (
    86  	// Create, see, edit, and permanently delete your Display & Video 360
    87  	// entities and reports
    88  	DisplayVideoScope = "https://www.googleapis.com/auth/display-video"
    89  
    90  	// View and manage your reports in DoubleClick Bid Manager
    91  	DoubleclickbidmanagerScope = "https://www.googleapis.com/auth/doubleclickbidmanager"
    92  )
    93  
    94  // NewService creates a new Service.
    95  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
    96  	scopesOption := option.WithScopes(
    97  		"https://www.googleapis.com/auth/display-video",
    98  		"https://www.googleapis.com/auth/doubleclickbidmanager",
    99  	)
   100  	// NOTE: prepend, so we don't override user-specified scopes.
   101  	opts = append([]option.ClientOption{scopesOption}, opts...)
   102  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   103  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   104  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   105  	if err != nil {
   106  		return nil, err
   107  	}
   108  	s, err := New(client)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	if endpoint != "" {
   113  		s.BasePath = endpoint
   114  	}
   115  	return s, nil
   116  }
   117  
   118  // New creates a new Service. It uses the provided http.Client for requests.
   119  //
   120  // Deprecated: please use NewService instead.
   121  // To provide a custom HTTP client, use option.WithHTTPClient.
   122  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   123  func New(client *http.Client) (*Service, error) {
   124  	if client == nil {
   125  		return nil, errors.New("client is nil")
   126  	}
   127  	s := &Service{client: client, BasePath: basePath}
   128  	s.Media = NewMediaService(s)
   129  	s.Sdfdownloadtasks = NewSdfdownloadtasksService(s)
   130  	return s, nil
   131  }
   132  
   133  type Service struct {
   134  	client    *http.Client
   135  	BasePath  string // API endpoint base URL
   136  	UserAgent string // optional additional User-Agent fragment
   137  
   138  	Media *MediaService
   139  
   140  	Sdfdownloadtasks *SdfdownloadtasksService
   141  }
   142  
   143  func (s *Service) userAgent() string {
   144  	if s.UserAgent == "" {
   145  		return googleapi.UserAgent
   146  	}
   147  	return googleapi.UserAgent + " " + s.UserAgent
   148  }
   149  
   150  func NewMediaService(s *Service) *MediaService {
   151  	rs := &MediaService{s: s}
   152  	return rs
   153  }
   154  
   155  type MediaService struct {
   156  	s *Service
   157  }
   158  
   159  func NewSdfdownloadtasksService(s *Service) *SdfdownloadtasksService {
   160  	rs := &SdfdownloadtasksService{s: s}
   161  	rs.Operations = NewSdfdownloadtasksOperationsService(s)
   162  	return rs
   163  }
   164  
   165  type SdfdownloadtasksService struct {
   166  	s *Service
   167  
   168  	Operations *SdfdownloadtasksOperationsService
   169  }
   170  
   171  func NewSdfdownloadtasksOperationsService(s *Service) *SdfdownloadtasksOperationsService {
   172  	rs := &SdfdownloadtasksOperationsService{s: s}
   173  	return rs
   174  }
   175  
   176  type SdfdownloadtasksOperationsService struct {
   177  	s *Service
   178  }
   179  
   180  // GoogleBytestreamMedia: Media resource.
   181  type GoogleBytestreamMedia struct {
   182  	// ResourceName: Name of the media resource.
   183  	ResourceName string `json:"resourceName,omitempty"`
   184  
   185  	// ServerResponse contains the HTTP response code and headers from the
   186  	// server.
   187  	googleapi.ServerResponse `json:"-"`
   188  
   189  	// ForceSendFields is a list of field names (e.g. "ResourceName") to
   190  	// unconditionally include in API requests. By default, fields with
   191  	// empty values are omitted from API requests. However, any non-pointer,
   192  	// non-interface field appearing in ForceSendFields will be sent to the
   193  	// server regardless of whether the field is empty or not. This may be
   194  	// used to include empty fields in Patch requests.
   195  	ForceSendFields []string `json:"-"`
   196  
   197  	// NullFields is a list of field names (e.g. "ResourceName") to include
   198  	// in API requests with the JSON null value. By default, fields with
   199  	// empty values are omitted from API requests. However, any field with
   200  	// an empty value appearing in NullFields will be sent to the server as
   201  	// null. It is an error if a field in this list has a non-empty value.
   202  	// This may be used to include null fields in Patch requests.
   203  	NullFields []string `json:"-"`
   204  }
   205  
   206  func (s *GoogleBytestreamMedia) MarshalJSON() ([]byte, error) {
   207  	type NoMethod GoogleBytestreamMedia
   208  	raw := NoMethod(*s)
   209  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   210  }
   211  
   212  // Operation: This resource represents a long-running operation that is
   213  // the result of a network API call.
   214  type Operation struct {
   215  	// Done: If the value is `false`, it means the operation is still in
   216  	// progress. If `true`, the operation is completed, and either `error`
   217  	// or `response` is available.
   218  	Done bool `json:"done,omitempty"`
   219  
   220  	// Error: The error result of the operation in case of failure or
   221  	// cancellation.
   222  	Error *Status `json:"error,omitempty"`
   223  
   224  	// Metadata: Service-specific metadata associated with the operation. It
   225  	// typically contains progress information and common metadata such as
   226  	// create time. Some services might not provide such metadata. Any
   227  	// method that returns a long-running operation should document the
   228  	// metadata type, if any.
   229  	Metadata googleapi.RawMessage `json:"metadata,omitempty"`
   230  
   231  	// Name: The server-assigned name, which is only unique within the same
   232  	// service that originally returns it. If you use the default HTTP
   233  	// mapping, the `name` should be a resource name ending with
   234  	// `operations/{unique_id}`.
   235  	Name string `json:"name,omitempty"`
   236  
   237  	// Response: The normal response of the operation in case of success. If
   238  	// the original method returns no data on success, such as `Delete`, the
   239  	// response is `google.protobuf.Empty`. If the original method is
   240  	// standard `Get`/`Create`/`Update`, the response should be the
   241  	// resource. For other methods, the response should have the type
   242  	// `XxxResponse`, where `Xxx` is the original method name. For example,
   243  	// if the original method name is `TakeSnapshot()`, the inferred
   244  	// response type is `TakeSnapshotResponse`.
   245  	Response googleapi.RawMessage `json:"response,omitempty"`
   246  
   247  	// ServerResponse contains the HTTP response code and headers from the
   248  	// server.
   249  	googleapi.ServerResponse `json:"-"`
   250  
   251  	// ForceSendFields is a list of field names (e.g. "Done") to
   252  	// unconditionally include in API requests. By default, fields with
   253  	// empty values are omitted from API requests. However, any non-pointer,
   254  	// non-interface field appearing in ForceSendFields will be sent to the
   255  	// server regardless of whether the field is empty or not. This may be
   256  	// used to include empty fields in Patch requests.
   257  	ForceSendFields []string `json:"-"`
   258  
   259  	// NullFields is a list of field names (e.g. "Done") to include in API
   260  	// requests with the JSON null value. By default, fields with empty
   261  	// values are omitted from API requests. However, any field with an
   262  	// empty value appearing in NullFields will be sent to the server as
   263  	// null. It is an error if a field in this list has a non-empty value.
   264  	// This may be used to include null fields in Patch requests.
   265  	NullFields []string `json:"-"`
   266  }
   267  
   268  func (s *Operation) MarshalJSON() ([]byte, error) {
   269  	type NoMethod Operation
   270  	raw := NoMethod(*s)
   271  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   272  }
   273  
   274  // Status: The `Status` type defines a logical error model that is
   275  // suitable for different programming environments, including REST APIs
   276  // and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each
   277  // `Status` message contains three pieces of data: error code, error
   278  // message, and error details. You can find out more about this error
   279  // model and how to work with it in the [API Design
   280  // Guide](https://cloud.google.com/apis/design/errors).
   281  type Status struct {
   282  	// Code: The status code, which should be an enum value of
   283  	// google.rpc.Code.
   284  	Code int64 `json:"code,omitempty"`
   285  
   286  	// Details: A list of messages that carry the error details. There is a
   287  	// common set of message types for APIs to use.
   288  	Details []googleapi.RawMessage `json:"details,omitempty"`
   289  
   290  	// Message: A developer-facing error message, which should be in
   291  	// English. Any user-facing error message should be localized and sent
   292  	// in the google.rpc.Status.details field, or localized by the client.
   293  	Message string `json:"message,omitempty"`
   294  
   295  	// ForceSendFields is a list of field names (e.g. "Code") to
   296  	// unconditionally include in API requests. By default, fields with
   297  	// empty values are omitted from API requests. However, any non-pointer,
   298  	// non-interface field appearing in ForceSendFields will be sent to the
   299  	// server regardless of whether the field is empty or not. This may be
   300  	// used to include empty fields in Patch requests.
   301  	ForceSendFields []string `json:"-"`
   302  
   303  	// NullFields is a list of field names (e.g. "Code") to include in API
   304  	// requests with the JSON null value. By default, fields with empty
   305  	// values are omitted from API requests. However, any field with an
   306  	// empty value appearing in NullFields will be sent to the server as
   307  	// null. It is an error if a field in this list has a non-empty value.
   308  	// This may be used to include null fields in Patch requests.
   309  	NullFields []string `json:"-"`
   310  }
   311  
   312  func (s *Status) MarshalJSON() ([]byte, error) {
   313  	type NoMethod Status
   314  	raw := NoMethod(*s)
   315  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   316  }
   317  
   318  // method id "displayvideo.media.download":
   319  
   320  type MediaDownloadCall struct {
   321  	s            *Service
   322  	resourceName string
   323  	urlParams_   gensupport.URLParams
   324  	ifNoneMatch_ string
   325  	ctx_         context.Context
   326  	header_      http.Header
   327  }
   328  
   329  // Download: Downloads media. Download is supported on the URI
   330  // `/download/{resource_name=**}?alt=media.` **Note**: Download requests
   331  // will not be successful without including `alt=media` query string.
   332  func (r *MediaService) Download(resourceName string) *MediaDownloadCall {
   333  	c := &MediaDownloadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   334  	c.resourceName = resourceName
   335  	return c
   336  }
   337  
   338  // Fields allows partial responses to be retrieved. See
   339  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   340  // for more information.
   341  func (c *MediaDownloadCall) Fields(s ...googleapi.Field) *MediaDownloadCall {
   342  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   343  	return c
   344  }
   345  
   346  // IfNoneMatch sets the optional parameter which makes the operation
   347  // fail if the object's ETag matches the given value. This is useful for
   348  // getting updates only after the object has changed since the last
   349  // request. Use googleapi.IsNotModified to check whether the response
   350  // error from Do is the result of In-None-Match.
   351  func (c *MediaDownloadCall) IfNoneMatch(entityTag string) *MediaDownloadCall {
   352  	c.ifNoneMatch_ = entityTag
   353  	return c
   354  }
   355  
   356  // Context sets the context to be used in this call's Do and Download
   357  // methods. Any pending HTTP request will be aborted if the provided
   358  // context is canceled.
   359  func (c *MediaDownloadCall) Context(ctx context.Context) *MediaDownloadCall {
   360  	c.ctx_ = ctx
   361  	return c
   362  }
   363  
   364  // Header returns an http.Header that can be modified by the caller to
   365  // add HTTP headers to the request.
   366  func (c *MediaDownloadCall) Header() http.Header {
   367  	if c.header_ == nil {
   368  		c.header_ = make(http.Header)
   369  	}
   370  	return c.header_
   371  }
   372  
   373  func (c *MediaDownloadCall) doRequest(alt string) (*http.Response, error) {
   374  	reqHeaders := make(http.Header)
   375  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201104")
   376  	for k, v := range c.header_ {
   377  		reqHeaders[k] = v
   378  	}
   379  	reqHeaders.Set("User-Agent", c.s.userAgent())
   380  	if c.ifNoneMatch_ != "" {
   381  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   382  	}
   383  	var body io.Reader = nil
   384  	c.urlParams_.Set("alt", alt)
   385  	c.urlParams_.Set("prettyPrint", "false")
   386  	urls := googleapi.ResolveRelative(c.s.BasePath, "download/{+resourceName}")
   387  	urls += "?" + c.urlParams_.Encode()
   388  	req, err := http.NewRequest("GET", urls, body)
   389  	if err != nil {
   390  		return nil, err
   391  	}
   392  	req.Header = reqHeaders
   393  	googleapi.Expand(req.URL, map[string]string{
   394  		"resourceName": c.resourceName,
   395  	})
   396  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   397  }
   398  
   399  // Download fetches the API endpoint's "media" value, instead of the normal
   400  // API response value. If the returned error is nil, the Response is guaranteed to
   401  // have a 2xx status code. Callers must close the Response.Body as usual.
   402  func (c *MediaDownloadCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
   403  	gensupport.SetOptions(c.urlParams_, opts...)
   404  	res, err := c.doRequest("media")
   405  	if err != nil {
   406  		return nil, err
   407  	}
   408  	if err := googleapi.CheckMediaResponse(res); err != nil {
   409  		res.Body.Close()
   410  		return nil, err
   411  	}
   412  	return res, nil
   413  }
   414  
   415  // Do executes the "displayvideo.media.download" call.
   416  // Exactly one of *GoogleBytestreamMedia or error will be non-nil. Any
   417  // non-2xx status code is an error. Response headers are in either
   418  // *GoogleBytestreamMedia.ServerResponse.Header or (if a response was
   419  // returned at all) in error.(*googleapi.Error).Header. Use
   420  // googleapi.IsNotModified to check whether the returned error was
   421  // because http.StatusNotModified was returned.
   422  func (c *MediaDownloadCall) Do(opts ...googleapi.CallOption) (*GoogleBytestreamMedia, error) {
   423  	gensupport.SetOptions(c.urlParams_, opts...)
   424  	res, err := c.doRequest("json")
   425  	if res != nil && res.StatusCode == http.StatusNotModified {
   426  		if res.Body != nil {
   427  			res.Body.Close()
   428  		}
   429  		return nil, &googleapi.Error{
   430  			Code:   res.StatusCode,
   431  			Header: res.Header,
   432  		}
   433  	}
   434  	if err != nil {
   435  		return nil, err
   436  	}
   437  	defer googleapi.CloseBody(res)
   438  	if err := googleapi.CheckResponse(res); err != nil {
   439  		return nil, err
   440  	}
   441  	ret := &GoogleBytestreamMedia{
   442  		ServerResponse: googleapi.ServerResponse{
   443  			Header:         res.Header,
   444  			HTTPStatusCode: res.StatusCode,
   445  		},
   446  	}
   447  	target := &ret
   448  	if err := gensupport.DecodeResponse(target, res); err != nil {
   449  		return nil, err
   450  	}
   451  	return ret, nil
   452  	// {
   453  	//   "description": "Downloads media. Download is supported on the URI `/download/{resource_name=**}?alt=media.` **Note**: Download requests will not be successful without including `alt=media` query string.",
   454  	//   "flatPath": "download/{downloadId}",
   455  	//   "httpMethod": "GET",
   456  	//   "id": "displayvideo.media.download",
   457  	//   "parameterOrder": [
   458  	//     "resourceName"
   459  	//   ],
   460  	//   "parameters": {
   461  	//     "resourceName": {
   462  	//       "description": "Name of the media that is being downloaded. See ReadRequest.resource_name.",
   463  	//       "location": "path",
   464  	//       "pattern": "^.*$",
   465  	//       "required": true,
   466  	//       "type": "string"
   467  	//     }
   468  	//   },
   469  	//   "path": "download/{+resourceName}",
   470  	//   "response": {
   471  	//     "$ref": "GoogleBytestreamMedia"
   472  	//   },
   473  	//   "scopes": [
   474  	//     "https://www.googleapis.com/auth/display-video",
   475  	//     "https://www.googleapis.com/auth/doubleclickbidmanager"
   476  	//   ],
   477  	//   "supportsMediaDownload": true
   478  	// }
   479  
   480  }
   481  
   482  // method id "displayvideo.sdfdownloadtasks.operations.get":
   483  
   484  type SdfdownloadtasksOperationsGetCall struct {
   485  	s            *Service
   486  	name         string
   487  	urlParams_   gensupport.URLParams
   488  	ifNoneMatch_ string
   489  	ctx_         context.Context
   490  	header_      http.Header
   491  }
   492  
   493  // Get: Gets the latest state of an asynchronous SDF download task
   494  // operation. Clients should poll this method at intervals of 30
   495  // seconds.
   496  func (r *SdfdownloadtasksOperationsService) Get(name string) *SdfdownloadtasksOperationsGetCall {
   497  	c := &SdfdownloadtasksOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   498  	c.name = name
   499  	return c
   500  }
   501  
   502  // Fields allows partial responses to be retrieved. See
   503  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   504  // for more information.
   505  func (c *SdfdownloadtasksOperationsGetCall) Fields(s ...googleapi.Field) *SdfdownloadtasksOperationsGetCall {
   506  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   507  	return c
   508  }
   509  
   510  // IfNoneMatch sets the optional parameter which makes the operation
   511  // fail if the object's ETag matches the given value. This is useful for
   512  // getting updates only after the object has changed since the last
   513  // request. Use googleapi.IsNotModified to check whether the response
   514  // error from Do is the result of In-None-Match.
   515  func (c *SdfdownloadtasksOperationsGetCall) IfNoneMatch(entityTag string) *SdfdownloadtasksOperationsGetCall {
   516  	c.ifNoneMatch_ = entityTag
   517  	return c
   518  }
   519  
   520  // Context sets the context to be used in this call's Do method. Any
   521  // pending HTTP request will be aborted if the provided context is
   522  // canceled.
   523  func (c *SdfdownloadtasksOperationsGetCall) Context(ctx context.Context) *SdfdownloadtasksOperationsGetCall {
   524  	c.ctx_ = ctx
   525  	return c
   526  }
   527  
   528  // Header returns an http.Header that can be modified by the caller to
   529  // add HTTP headers to the request.
   530  func (c *SdfdownloadtasksOperationsGetCall) Header() http.Header {
   531  	if c.header_ == nil {
   532  		c.header_ = make(http.Header)
   533  	}
   534  	return c.header_
   535  }
   536  
   537  func (c *SdfdownloadtasksOperationsGetCall) doRequest(alt string) (*http.Response, error) {
   538  	reqHeaders := make(http.Header)
   539  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201104")
   540  	for k, v := range c.header_ {
   541  		reqHeaders[k] = v
   542  	}
   543  	reqHeaders.Set("User-Agent", c.s.userAgent())
   544  	if c.ifNoneMatch_ != "" {
   545  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   546  	}
   547  	var body io.Reader = nil
   548  	c.urlParams_.Set("alt", alt)
   549  	c.urlParams_.Set("prettyPrint", "false")
   550  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
   551  	urls += "?" + c.urlParams_.Encode()
   552  	req, err := http.NewRequest("GET", urls, body)
   553  	if err != nil {
   554  		return nil, err
   555  	}
   556  	req.Header = reqHeaders
   557  	googleapi.Expand(req.URL, map[string]string{
   558  		"name": c.name,
   559  	})
   560  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   561  }
   562  
   563  // Do executes the "displayvideo.sdfdownloadtasks.operations.get" call.
   564  // Exactly one of *Operation or error will be non-nil. Any non-2xx
   565  // status code is an error. Response headers are in either
   566  // *Operation.ServerResponse.Header or (if a response was returned at
   567  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
   568  // to check whether the returned error was because
   569  // http.StatusNotModified was returned.
   570  func (c *SdfdownloadtasksOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
   571  	gensupport.SetOptions(c.urlParams_, opts...)
   572  	res, err := c.doRequest("json")
   573  	if res != nil && res.StatusCode == http.StatusNotModified {
   574  		if res.Body != nil {
   575  			res.Body.Close()
   576  		}
   577  		return nil, &googleapi.Error{
   578  			Code:   res.StatusCode,
   579  			Header: res.Header,
   580  		}
   581  	}
   582  	if err != nil {
   583  		return nil, err
   584  	}
   585  	defer googleapi.CloseBody(res)
   586  	if err := googleapi.CheckResponse(res); err != nil {
   587  		return nil, err
   588  	}
   589  	ret := &Operation{
   590  		ServerResponse: googleapi.ServerResponse{
   591  			Header:         res.Header,
   592  			HTTPStatusCode: res.StatusCode,
   593  		},
   594  	}
   595  	target := &ret
   596  	if err := gensupport.DecodeResponse(target, res); err != nil {
   597  		return nil, err
   598  	}
   599  	return ret, nil
   600  	// {
   601  	//   "description": "Gets the latest state of an asynchronous SDF download task operation. Clients should poll this method at intervals of 30 seconds.",
   602  	//   "flatPath": "v1beta2/sdfdownloadtasks/operations/{operationsId}",
   603  	//   "httpMethod": "GET",
   604  	//   "id": "displayvideo.sdfdownloadtasks.operations.get",
   605  	//   "parameterOrder": [
   606  	//     "name"
   607  	//   ],
   608  	//   "parameters": {
   609  	//     "name": {
   610  	//       "description": "The name of the operation resource.",
   611  	//       "location": "path",
   612  	//       "pattern": "^sdfdownloadtasks/operations/[^/]+$",
   613  	//       "required": true,
   614  	//       "type": "string"
   615  	//     }
   616  	//   },
   617  	//   "path": "v1beta2/{+name}",
   618  	//   "response": {
   619  	//     "$ref": "Operation"
   620  	//   },
   621  	//   "scopes": [
   622  	//     "https://www.googleapis.com/auth/display-video",
   623  	//     "https://www.googleapis.com/auth/doubleclickbidmanager"
   624  	//   ]
   625  	// }
   626  
   627  }
   628  

View as plain text