...

Text file src/google.golang.org/api/google-api-go-generator/testdata/arrayofenum.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 arrayofenum provides access to the Example API.
     8//
     9// # Library status
    10//
    11// These client libraries are officially supported by Google. However, this
    12// library is considered complete and is in maintenance mode. This means
    13// that we will address critical bugs and security issues but will not add
    14// any new features.
    15//
    16// When possible, we recommend using our newer
    17// [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    18// that are still actively being worked and iterated on.
    19//
    20// # Creating a client
    21//
    22// Usage example:
    23//
    24//	import "google.golang.org/api/arrayofenum/v1"
    25//	...
    26//	ctx := context.Background()
    27//	arrayofenumService, err := arrayofenum.NewService(ctx)
    28//
    29// In this example, Google Application Default Credentials are used for
    30// authentication. For information on how to create and obtain Application
    31// Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    32//
    33// # Other authentication options
    34//
    35// To use an API key for authentication (note: some APIs do not support API
    36// keys), use [google.golang.org/api/option.WithAPIKey]:
    37//
    38//	arrayofenumService, err := arrayofenum.NewService(ctx, option.WithAPIKey("AIza..."))
    39//
    40// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    41// flow, use [google.golang.org/api/option.WithTokenSource]:
    42//
    43//	config := &oauth2.Config{...}
    44//	// ...
    45//	token, err := config.Exchange(ctx, ...)
    46//	arrayofenumService, err := arrayofenum.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    47//
    48// See [google.golang.org/api/option.ClientOption] for details on options.
    49package arrayofenum // import "google.golang.org/api/arrayofenum/v1"
    50
    51import (
    52	"bytes"
    53	"context"
    54	"encoding/json"
    55	"errors"
    56	"fmt"
    57	"io"
    58	"net/http"
    59	"net/url"
    60	"strconv"
    61	"strings"
    62
    63	googleapi "google.golang.org/api/googleapi"
    64	internal "google.golang.org/api/internal"
    65	gensupport "google.golang.org/api/internal/gensupport"
    66	option "google.golang.org/api/option"
    67	internaloption "google.golang.org/api/option/internaloption"
    68	htransport "google.golang.org/api/transport/http"
    69)
    70
    71// Always reference these packages, just in case the auto-generated code
    72// below doesn't.
    73var _ = bytes.NewBuffer
    74var _ = strconv.Itoa
    75var _ = fmt.Sprintf
    76var _ = json.NewDecoder
    77var _ = io.Copy
    78var _ = url.Parse
    79var _ = gensupport.MarshalJSON
    80var _ = googleapi.Version
    81var _ = errors.New
    82var _ = strings.Replace
    83var _ = context.Canceled
    84var _ = internaloption.WithDefaultEndpoint
    85var _ = internal.Version
    86
    87const apiId = "arrayofenum:v1"
    88const apiName = "arrayofenum"
    89const apiVersion = "v1"
    90const basePath = "https://www.googleapis.com/discovery/v1/apis"
    91const basePathTemplate = "https://www.UNIVERSE_DOMAIN/discovery/v1/apis"
    92
    93// NewService creates a new Service.
    94func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
    95	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
    96	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
    97	opts = append(opts, internaloption.EnableNewAuthLibrary())
    98	client, endpoint, err := htransport.NewClient(ctx, opts...)
    99	if err != nil {
   100		return nil, err
   101	}
   102	s, err := New(client)
   103	if err != nil {
   104		return nil, err
   105	}
   106	if endpoint != "" {
   107		s.BasePath = endpoint
   108	}
   109	return s, nil
   110}
   111
   112// New creates a new Service. It uses the provided http.Client for requests.
   113//
   114// Deprecated: please use NewService instead.
   115// To provide a custom HTTP client, use option.WithHTTPClient.
   116// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   117func New(client *http.Client) (*Service, error) {
   118	if client == nil {
   119		return nil, errors.New("client is nil")
   120	}
   121	s := &Service{client: client, BasePath: basePath}
   122	return s, nil
   123}
   124
   125type Service struct {
   126	client    *http.Client
   127	BasePath  string // API endpoint base URL
   128	UserAgent string // optional additional User-Agent fragment
   129}
   130
   131func (s *Service) userAgent() string {
   132	if s.UserAgent == "" {
   133		return googleapi.UserAgent
   134	}
   135	return googleapi.UserAgent + " " + s.UserAgent
   136}
   137
   138// Container: Represents a Google Tag Manager Container.
   139type Container struct {
   140	// AccountId: GTM Account ID.
   141	AccountId string `json:"accountId,omitempty"`
   142	// ContainerId: This is a long description that has URLs in it that shouldn't
   143	// break.
   144	// https://sites.google.com/a/google.com/adx-integration/Home/engineering/binary-releases/rtb-api-release
   145	// https://cs.corp.google.com/#piper///depot/google3/contentads/adx/tools/rtb_api/adxrtb.py
   146	ContainerId string `json:"containerId,omitempty"`
   147	// DomainName: Optional list of domain names associated with the Container.
   148	DomainName []string `json:"domainName,omitempty"`
   149	// EnabledBuiltInVariable: List of enabled built-in variables. Valid values
   150	// include: pageUrl, pageHostname, pagePath, referrer, event, clickElement,
   151	// clickClasses, clickId, clickTarget, clickUrl, clickText, formElement,
   152	// formClasses, formId, formTarget, formUrl, formText, errorMessage, errorUrl,
   153	// errorLine, newHistoryFragment, oldHistoryFragment, newHistoryState,
   154	// oldHistoryState, historySource, containerVersion, debugMode, randomNumber,
   155	// containerId.
   156	//
   157	// Possible values:
   158	//   "advertiserId"
   159	//   "advertisingTrackingEnabled"
   160	//   "appId"
   161	//   "appName"
   162	//   "appVersionCode"
   163	//   "appVersionName"
   164	//   "clickClasses"
   165	//   "clickElement"
   166	//   "clickId"
   167	//   "clickTarget"
   168	//   "clickText"
   169	//   "clickUrl"
   170	//   "containerId"
   171	//   "containerVersion"
   172	//   "debugMode"
   173	//   "deviceName"
   174	//   "errorLine"
   175	//   "errorMessage"
   176	//   "errorUrl"
   177	//   "event"
   178	//   "formClasses"
   179	//   "formElement"
   180	//   "formId"
   181	//   "formTarget"
   182	//   "formText"
   183	//   "formUrl"
   184	//   "historySource"
   185	//   "language"
   186	//   "newHistoryFragment"
   187	//   "newHistoryState"
   188	//   "oldHistoryFragment"
   189	//   "oldHistoryState"
   190	//   "osVersion"
   191	//   "pageHostname"
   192	//   "pagePath"
   193	//   "pageUrl"
   194	//   "platform"
   195	//   "randomNumber"
   196	//   "referrer"
   197	//   "resolution"
   198	//   "sdkVersion"
   199	EnabledBuiltInVariable []string `json:"enabledBuiltInVariable,omitempty"`
   200	// Fingerprint: The fingerprint of the GTM Container as computed at storage
   201	// time. This value is recomputed whenever the account is modified.
   202	Fingerprint string `json:"fingerprint,omitempty"`
   203	// Name: Container display name.
   204	Name string `json:"name,omitempty"`
   205	// Notes: Container Notes.
   206	Notes string `json:"notes,omitempty"`
   207	// PublicId: Container Public ID.
   208	PublicId string `json:"publicId,omitempty"`
   209	// TimeZoneCountryId: Container Country ID.
   210	TimeZoneCountryId string `json:"timeZoneCountryId,omitempty"`
   211	// TimeZoneId: Container Time Zone ID.
   212	TimeZoneId string `json:"timeZoneId,omitempty"`
   213	// UsageContext: List of Usage Contexts for the Container. Valid values
   214	// include: web, android, ios.
   215	//
   216	// Possible values:
   217	//   "android"
   218	//   "ios"
   219	//   "web"
   220	UsageContext []string `json:"usageContext,omitempty"`
   221	// ForceSendFields is a list of field names (e.g. "AccountId") to
   222	// unconditionally include in API requests. By default, fields with empty or
   223	// default values are omitted from API requests. See
   224	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   225	// details.
   226	ForceSendFields []string `json:"-"`
   227	// NullFields is a list of field names (e.g. "AccountId") to include in API
   228	// requests with the JSON null value. By default, fields with empty values are
   229	// omitted from API requests. See
   230	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   231	NullFields []string `json:"-"`
   232}
   233
   234func (s *Container) MarshalJSON() ([]byte, error) {
   235	type NoMethod Container
   236	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   237}

View as plain text