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

158 lines
5.1 KiB

  1. // Copyright YEAR Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package adexchangebuyer provides access to the Ad Exchange Buyer API.
  6. //
  7. // For product documentation, see: https://developers.google.com/ad-exchange/buyer-rest
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/adexchangebuyer/v1.1"
  14. // ...
  15. // ctx := context.Background()
  16. // adexchangebuyerService, err := adexchangebuyer.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // adexchangebuyerService, err := adexchangebuyer.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // adexchangebuyerService, err := adexchangebuyer.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package adexchangebuyer // import "google.golang.org/api/adexchangebuyer/v1.1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "adexchangebuyer:v1.1"
  67. const apiName = "adexchangebuyer"
  68. const apiVersion = "v1.1"
  69. const basePath = "https://www.googleapis.com/adexchangebuyer/v1.1/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // Manage your Ad Exchange buyer account configuration
  73. AdexchangeBuyerScope = "https://www.googleapis.com/auth/adexchange.buyer"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/adexchange.buyer",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. return s, nil
  106. }
  107. type Service struct {
  108. client *http.Client
  109. BasePath string // API endpoint base URL
  110. UserAgent string // optional additional User-Agent fragment
  111. }
  112. func (s *Service) userAgent() string {
  113. if s.UserAgent == "" {
  114. return googleapi.UserAgent
  115. }
  116. return googleapi.UserAgent + " " + s.UserAgent
  117. }
  118. // Creative: A creative and its classification data.
  119. type Creative struct {
  120. // AdvertiserId: Detected advertiser id, if any. Read-only. This field
  121. // should not be set in requests.
  122. AdvertiserId googleapi.Int64s `json:"advertiserId,omitempty"`
  123. // ForceSendFields is a list of field names (e.g. "AdvertiserId") to
  124. // unconditionally include in API requests. By default, fields with
  125. // empty values are omitted from API requests. However, any non-pointer,
  126. // non-interface field appearing in ForceSendFields will be sent to the
  127. // server regardless of whether the field is empty or not. This may be
  128. // used to include empty fields in Patch requests.
  129. ForceSendFields []string `json:"-"`
  130. // NullFields is a list of field names (e.g. "AdvertiserId") to include
  131. // in API requests with the JSON null value. By default, fields with
  132. // empty values are omitted from API requests. However, any field with
  133. // an empty value appearing in NullFields will be sent to the server as
  134. // null. It is an error if a field in this list has a non-empty value.
  135. // This may be used to include null fields in Patch requests.
  136. NullFields []string `json:"-"`
  137. }
  138. func (s *Creative) MarshalJSON() ([]byte, error) {
  139. type NoMethod Creative
  140. raw := NoMethod(*s)
  141. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  142. }