...

Text file src/google.golang.org/api/google-api-go-generator/testdata/quotednum.want

Documentation: google.golang.org/api/google-api-go-generator/testdata

     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
     5// Code generated file. DO NOT EDIT.
     6
     7// Package adexchangebuyer provides access to the Ad Exchange Buyer API.
     8//
     9// For product documentation, see: https://developers.google.com/ad-exchange/buyer-rest
    10//
    11// # Library status
    12//
    13// These client libraries are officially supported by Google. However, this
    14// library is considered complete and is in maintenance mode. This means
    15// that we will address critical bugs and security issues but will not add
    16// any new features.
    17//
    18// When possible, we recommend using our newer
    19// [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    20// that are still actively being worked and iterated on.
    21//
    22// # Creating a client
    23//
    24// Usage example:
    25//
    26//	import "google.golang.org/api/adexchangebuyer/v1.1"
    27//	...
    28//	ctx := context.Background()
    29//	adexchangebuyerService, err := adexchangebuyer.NewService(ctx)
    30//
    31// In this example, Google Application Default Credentials are used for
    32// authentication. For information on how to create and obtain Application
    33// Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    34//
    35// # Other authentication options
    36//
    37// To use an API key for authentication (note: some APIs do not support API
    38// keys), use [google.golang.org/api/option.WithAPIKey]:
    39//
    40//	adexchangebuyerService, err := adexchangebuyer.NewService(ctx, option.WithAPIKey("AIza..."))
    41//
    42// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    43// flow, use [google.golang.org/api/option.WithTokenSource]:
    44//
    45//	config := &oauth2.Config{...}
    46//	// ...
    47//	token, err := config.Exchange(ctx, ...)
    48//	adexchangebuyerService, err := adexchangebuyer.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    49//
    50// See [google.golang.org/api/option.ClientOption] for details on options.
    51package adexchangebuyer // import "google.golang.org/api/adexchangebuyer/v1.1"
    52
    53import (
    54	"bytes"
    55	"context"
    56	"encoding/json"
    57	"errors"
    58	"fmt"
    59	"io"
    60	"net/http"
    61	"net/url"
    62	"strconv"
    63	"strings"
    64
    65	googleapi "google.golang.org/api/googleapi"
    66	internal "google.golang.org/api/internal"
    67	gensupport "google.golang.org/api/internal/gensupport"
    68	option "google.golang.org/api/option"
    69	internaloption "google.golang.org/api/option/internaloption"
    70	htransport "google.golang.org/api/transport/http"
    71)
    72
    73// Always reference these packages, just in case the auto-generated code
    74// below doesn't.
    75var _ = bytes.NewBuffer
    76var _ = strconv.Itoa
    77var _ = fmt.Sprintf
    78var _ = json.NewDecoder
    79var _ = io.Copy
    80var _ = url.Parse
    81var _ = gensupport.MarshalJSON
    82var _ = googleapi.Version
    83var _ = errors.New
    84var _ = strings.Replace
    85var _ = context.Canceled
    86var _ = internaloption.WithDefaultEndpoint
    87var _ = internal.Version
    88
    89const apiId = "adexchangebuyer:v1.1"
    90const apiName = "adexchangebuyer"
    91const apiVersion = "v1.1"
    92const basePath = "https://www.googleapis.com/adexchangebuyer/v1.1/"
    93const basePathTemplate = "https://www.UNIVERSE_DOMAIN/adexchangebuyer/v1.1/"
    94const mtlsBasePath = "https://www.mtls.googleapis.com/adexchangebuyer/v1.1/"
    95
    96// OAuth2 scopes used by this API.
    97const (
    98	// Manage your Ad Exchange buyer account configuration
    99	AdexchangeBuyerScope = "https://www.googleapis.com/auth/adexchange.buyer"
   100)
   101
   102// NewService creates a new Service.
   103func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   104	scopesOption := internaloption.WithDefaultScopes(
   105		"https://www.googleapis.com/auth/adexchange.buyer",
   106	)
   107	// NOTE: prepend, so we don't override user-specified scopes.
   108	opts = append([]option.ClientOption{scopesOption}, opts...)
   109	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   110	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   111	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   112	opts = append(opts, internaloption.EnableNewAuthLibrary())
   113	client, endpoint, err := htransport.NewClient(ctx, opts...)
   114	if err != nil {
   115		return nil, err
   116	}
   117	s, err := New(client)
   118	if err != nil {
   119		return nil, err
   120	}
   121	if endpoint != "" {
   122		s.BasePath = endpoint
   123	}
   124	return s, nil
   125}
   126
   127// New creates a new Service. It uses the provided http.Client for requests.
   128//
   129// Deprecated: please use NewService instead.
   130// To provide a custom HTTP client, use option.WithHTTPClient.
   131// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   132func New(client *http.Client) (*Service, error) {
   133	if client == nil {
   134		return nil, errors.New("client is nil")
   135	}
   136	s := &Service{client: client, BasePath: basePath}
   137	return s, nil
   138}
   139
   140type Service struct {
   141	client    *http.Client
   142	BasePath  string // API endpoint base URL
   143	UserAgent string // optional additional User-Agent fragment
   144}
   145
   146func (s *Service) userAgent() string {
   147	if s.UserAgent == "" {
   148		return googleapi.UserAgent
   149	}
   150	return googleapi.UserAgent + " " + s.UserAgent
   151}
   152
   153// Creative: A creative and its classification data.
   154type Creative struct {
   155	// AdvertiserId: Detected advertiser id, if any. Read-only. This field should
   156	// not be set in requests.
   157	AdvertiserId googleapi.Int64s `json:"advertiserId,omitempty"`
   158	// ForceSendFields is a list of field names (e.g. "AdvertiserId") to
   159	// unconditionally include in API requests. By default, fields with empty or
   160	// default values are omitted from API requests. See
   161	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   162	// details.
   163	ForceSendFields []string `json:"-"`
   164	// NullFields is a list of field names (e.g. "AdvertiserId") to include in API
   165	// requests with the JSON null value. By default, fields with empty values are
   166	// omitted from API requests. See
   167	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   168	NullFields []string `json:"-"`
   169}
   170
   171func (s *Creative) MarshalJSON() ([]byte, error) {
   172	type NoMethod Creative
   173	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   174}

View as plain text