...

Source file src/google.golang.org/api/doubleclickbidmanager/v2/doubleclickbidmanager-gen.go

Documentation: google.golang.org/api/doubleclickbidmanager/v2

     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 doubleclickbidmanager provides access to the DoubleClick Bid Manager API.
     8  //
     9  // For product documentation, see: https://developers.google.com/bid-manager/
    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/doubleclickbidmanager/v2"
    27  //	...
    28  //	ctx := context.Background()
    29  //	doubleclickbidmanagerService, err := doubleclickbidmanager.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  //	doubleclickbidmanagerService, err := doubleclickbidmanager.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  //	doubleclickbidmanagerService, err := doubleclickbidmanager.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    49  //
    50  // See [google.golang.org/api/option.ClientOption] for details on options.
    51  package doubleclickbidmanager // import "google.golang.org/api/doubleclickbidmanager/v2"
    52  
    53  import (
    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.
    75  var _ = bytes.NewBuffer
    76  var _ = strconv.Itoa
    77  var _ = fmt.Sprintf
    78  var _ = json.NewDecoder
    79  var _ = io.Copy
    80  var _ = url.Parse
    81  var _ = gensupport.MarshalJSON
    82  var _ = googleapi.Version
    83  var _ = errors.New
    84  var _ = strings.Replace
    85  var _ = context.Canceled
    86  var _ = internaloption.WithDefaultEndpoint
    87  var _ = internal.Version
    88  
    89  const apiId = "doubleclickbidmanager:v2"
    90  const apiName = "doubleclickbidmanager"
    91  const apiVersion = "v2"
    92  const basePath = "https://doubleclickbidmanager.googleapis.com/v2/"
    93  const basePathTemplate = "https://doubleclickbidmanager.UNIVERSE_DOMAIN/v2/"
    94  const mtlsBasePath = "https://doubleclickbidmanager.mtls.googleapis.com/v2/"
    95  
    96  // OAuth2 scopes used by this API.
    97  const (
    98  	// View and manage your reports in DoubleClick Bid Manager
    99  	DoubleclickbidmanagerScope = "https://www.googleapis.com/auth/doubleclickbidmanager"
   100  )
   101  
   102  // NewService creates a new Service.
   103  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   104  	scopesOption := internaloption.WithDefaultScopes(
   105  		"https://www.googleapis.com/auth/doubleclickbidmanager",
   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.
   132  func 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  	s.Queries = NewQueriesService(s)
   138  	return s, nil
   139  }
   140  
   141  type Service struct {
   142  	client    *http.Client
   143  	BasePath  string // API endpoint base URL
   144  	UserAgent string // optional additional User-Agent fragment
   145  
   146  	Queries *QueriesService
   147  }
   148  
   149  func (s *Service) userAgent() string {
   150  	if s.UserAgent == "" {
   151  		return googleapi.UserAgent
   152  	}
   153  	return googleapi.UserAgent + " " + s.UserAgent
   154  }
   155  
   156  func NewQueriesService(s *Service) *QueriesService {
   157  	rs := &QueriesService{s: s}
   158  	rs.Reports = NewQueriesReportsService(s)
   159  	return rs
   160  }
   161  
   162  type QueriesService struct {
   163  	s *Service
   164  
   165  	Reports *QueriesReportsService
   166  }
   167  
   168  func NewQueriesReportsService(s *Service) *QueriesReportsService {
   169  	rs := &QueriesReportsService{s: s}
   170  	return rs
   171  }
   172  
   173  type QueriesReportsService struct {
   174  	s *Service
   175  }
   176  
   177  // DataRange: Report data range.
   178  type DataRange struct {
   179  	// CustomEndDate: The ending date for the data that is shown in the report.
   180  	// Note, `customEndDate` is required if `range` is `CUSTOM_DATES` and ignored
   181  	// otherwise.
   182  	CustomEndDate *Date `json:"customEndDate,omitempty"`
   183  	// CustomStartDate: The starting data for the data that is shown in the report.
   184  	// Note, `customStartDate` is required if `range` is `CUSTOM_DATES` and ignored
   185  	// otherwise.
   186  	CustomStartDate *Date `json:"customStartDate,omitempty"`
   187  	// Range: Report data range used to generate the report.
   188  	//
   189  	// Possible values:
   190  	//   "RANGE_UNSPECIFIED" - Default value when range is not specified or is
   191  	// unknown in this version.
   192  	//   "CUSTOM_DATES" - Custom range specified by custom_start_date and
   193  	// custom_end_date fields.
   194  	//   "CURRENT_DAY" - Current day.
   195  	//   "PREVIOUS_DAY" - Previous day.
   196  	//   "WEEK_TO_DATE" - All days, including the current day, since the most
   197  	// recent Sunday.
   198  	//   "MONTH_TO_DATE" - All days, including the current day, since the start of
   199  	// the current month.
   200  	//   "QUARTER_TO_DATE" - All days, including the current day, since the start
   201  	// of the current quarter.
   202  	//   "YEAR_TO_DATE" - All days, including the current day, since the start of
   203  	// the current calendar year.
   204  	//   "PREVIOUS_WEEK" - The previous completed week, beginning from Sunday.
   205  	//   "PREVIOUS_MONTH" - The previous completed calendar month.
   206  	//   "PREVIOUS_QUARTER" - The previous completed quarter.
   207  	//   "PREVIOUS_YEAR" - The previous completed calendar year.
   208  	//   "LAST_7_DAYS" - The previous 7 days, excluding the current day.
   209  	//   "LAST_30_DAYS" - The previous 30 days, excluding the current day.
   210  	//   "LAST_90_DAYS" - The previous 90 days, excluding the current day.
   211  	//   "LAST_365_DAYS" - The previous 365 days, excluding the current day.
   212  	//   "ALL_TIME" - All time for which data is available, excluding the current
   213  	// day.
   214  	//   "LAST_14_DAYS" - The previous 14 days, excluding the current day.
   215  	//   "LAST_60_DAYS" - The previous 60 days, excluding the current day.
   216  	Range string `json:"range,omitempty"`
   217  	// ForceSendFields is a list of field names (e.g. "CustomEndDate") to
   218  	// unconditionally include in API requests. By default, fields with empty or
   219  	// default values are omitted from API requests. See
   220  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   221  	// details.
   222  	ForceSendFields []string `json:"-"`
   223  	// NullFields is a list of field names (e.g. "CustomEndDate") to include in API
   224  	// requests with the JSON null value. By default, fields with empty values are
   225  	// omitted from API requests. See
   226  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   227  	NullFields []string `json:"-"`
   228  }
   229  
   230  func (s *DataRange) MarshalJSON() ([]byte, error) {
   231  	type NoMethod DataRange
   232  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   233  }
   234  
   235  // Date: Represents a whole or partial calendar date, such as a birthday. The
   236  // time of day and time zone are either specified elsewhere or are
   237  // insignificant. The date is relative to the Gregorian Calendar. This can
   238  // represent one of the following: * A full date, with non-zero year, month,
   239  // and day values. * A month and day, with a zero year (for example, an
   240  // anniversary). * A year on its own, with a zero month and a zero day. * A
   241  // year and month, with a zero day (for example, a credit card expiration
   242  // date). Related types: * google.type.TimeOfDay * google.type.DateTime *
   243  // google.protobuf.Timestamp
   244  type Date struct {
   245  	// Day: Day of a month. Must be from 1 to 31 and valid for the year and month,
   246  	// or 0 to specify a year by itself or a year and month where the day isn't
   247  	// significant.
   248  	Day int64 `json:"day,omitempty"`
   249  	// Month: Month of a year. Must be from 1 to 12, or 0 to specify a year without
   250  	// a month and day.
   251  	Month int64 `json:"month,omitempty"`
   252  	// Year: Year of the date. Must be from 1 to 9999, or 0 to specify a date
   253  	// without a year.
   254  	Year int64 `json:"year,omitempty"`
   255  	// ForceSendFields is a list of field names (e.g. "Day") to unconditionally
   256  	// include in API requests. By default, fields with empty or default values are
   257  	// omitted from API requests. See
   258  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   259  	// details.
   260  	ForceSendFields []string `json:"-"`
   261  	// NullFields is a list of field names (e.g. "Day") to include in API requests
   262  	// with the JSON null value. By default, fields with empty values are omitted
   263  	// from API requests. See
   264  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   265  	NullFields []string `json:"-"`
   266  }
   267  
   268  func (s *Date) MarshalJSON() ([]byte, error) {
   269  	type NoMethod Date
   270  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   271  }
   272  
   273  // FilterPair: Filter used to match traffic data in your report.
   274  type FilterPair struct {
   275  	// Type: Filter type.
   276  	Type string `json:"type,omitempty"`
   277  	// Value: Filter value.
   278  	Value string `json:"value,omitempty"`
   279  	// ForceSendFields is a list of field names (e.g. "Type") to unconditionally
   280  	// include in API requests. By default, fields with empty or default values are
   281  	// omitted from API requests. See
   282  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   283  	// details.
   284  	ForceSendFields []string `json:"-"`
   285  	// NullFields is a list of field names (e.g. "Type") to include in API requests
   286  	// with the JSON null value. By default, fields with empty values are omitted
   287  	// from API requests. See
   288  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   289  	NullFields []string `json:"-"`
   290  }
   291  
   292  func (s *FilterPair) MarshalJSON() ([]byte, error) {
   293  	type NoMethod FilterPair
   294  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   295  }
   296  
   297  type ListQueriesResponse struct {
   298  	// NextPageToken: A token, which can be sent as page_token to retrieve the next
   299  	// page of queries. If this field is omitted, there are no subsequent pages.
   300  	NextPageToken string `json:"nextPageToken,omitempty"`
   301  	// Queries: The list of queries.
   302  	Queries []*Query `json:"queries,omitempty"`
   303  
   304  	// ServerResponse contains the HTTP response code and headers from the server.
   305  	googleapi.ServerResponse `json:"-"`
   306  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   307  	// unconditionally include in API requests. By default, fields with empty or
   308  	// default values are omitted from API requests. See
   309  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   310  	// details.
   311  	ForceSendFields []string `json:"-"`
   312  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   313  	// requests with the JSON null value. By default, fields with empty values are
   314  	// omitted from API requests. See
   315  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   316  	NullFields []string `json:"-"`
   317  }
   318  
   319  func (s *ListQueriesResponse) MarshalJSON() ([]byte, error) {
   320  	type NoMethod ListQueriesResponse
   321  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   322  }
   323  
   324  type ListReportsResponse struct {
   325  	// NextPageToken: A token, which can be sent as page_token to retrieve the next
   326  	// page of reports. If this field is omitted, there are no subsequent pages.
   327  	NextPageToken string `json:"nextPageToken,omitempty"`
   328  	// Reports: Retrieved reports.
   329  	Reports []*Report `json:"reports,omitempty"`
   330  
   331  	// ServerResponse contains the HTTP response code and headers from the server.
   332  	googleapi.ServerResponse `json:"-"`
   333  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   334  	// unconditionally include in API requests. By default, fields with empty or
   335  	// default values are omitted from API requests. See
   336  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   337  	// details.
   338  	ForceSendFields []string `json:"-"`
   339  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   340  	// requests with the JSON null value. By default, fields with empty values are
   341  	// omitted from API requests. See
   342  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   343  	NullFields []string `json:"-"`
   344  }
   345  
   346  func (s *ListReportsResponse) MarshalJSON() ([]byte, error) {
   347  	type NoMethod ListReportsResponse
   348  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   349  }
   350  
   351  // Options: Additional query options.
   352  type Options struct {
   353  	// IncludeOnlyTargetedUserLists: Set to true and filter your report by
   354  	// `FILTER_INSERTION_ORDER` or `FILTER_LINE_ITEM` to include data for audience
   355  	// lists specifically targeted by those items.
   356  	IncludeOnlyTargetedUserLists bool `json:"includeOnlyTargetedUserLists,omitempty"`
   357  	// ForceSendFields is a list of field names (e.g.
   358  	// "IncludeOnlyTargetedUserLists") to unconditionally include in API requests.
   359  	// By default, fields with empty or default values are omitted from API
   360  	// requests. See https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields
   361  	// for more details.
   362  	ForceSendFields []string `json:"-"`
   363  	// NullFields is a list of field names (e.g. "IncludeOnlyTargetedUserLists") to
   364  	// include in API requests with the JSON null value. By default, fields with
   365  	// empty values are omitted from API requests. See
   366  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   367  	NullFields []string `json:"-"`
   368  }
   369  
   370  func (s *Options) MarshalJSON() ([]byte, error) {
   371  	type NoMethod Options
   372  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   373  }
   374  
   375  // Parameters: Parameters of a query or report.
   376  type Parameters struct {
   377  	// Filters: Filters used to match traffic data in your report.
   378  	Filters []*FilterPair `json:"filters,omitempty"`
   379  	// GroupBys: Data is grouped by the filters listed in this field.
   380  	GroupBys []string `json:"groupBys,omitempty"`
   381  	// Metrics: Metrics to include as columns in your report.
   382  	Metrics []string `json:"metrics,omitempty"`
   383  	// Options: Additional query options.
   384  	Options *Options `json:"options,omitempty"`
   385  	// Type: The type of the report. The type of the report will dictate what
   386  	// dimesions, filters, and metrics can be used.
   387  	//
   388  	// Possible values:
   389  	//   "REPORT_TYPE_UNSPECIFIED" - Default value when report type is not
   390  	// specified or is unknown in this version.
   391  	//   "STANDARD" - Standard report.
   392  	//   "INVENTORY_AVAILABILITY" - Inventory Availability report.
   393  	//   "AUDIENCE_COMPOSITION" - Audience Composition report.
   394  	//   "FLOODLIGHT" - Floodlight report.
   395  	//   "YOUTUBE" - YouTube report.
   396  	//   "GRP" - GRP report.
   397  	//   "YOUTUBE_PROGRAMMATIC_GUARANTEED" - YouTube Programmatic Guaranteed
   398  	// report.
   399  	//   "REACH" - Reach report.
   400  	//   "UNIQUE_REACH_AUDIENCE" - Unique Reach Audience report.
   401  	Type string `json:"type,omitempty"`
   402  	// ForceSendFields is a list of field names (e.g. "Filters") to unconditionally
   403  	// include in API requests. By default, fields with empty or default values are
   404  	// omitted from API requests. See
   405  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   406  	// details.
   407  	ForceSendFields []string `json:"-"`
   408  	// NullFields is a list of field names (e.g. "Filters") to include in API
   409  	// requests with the JSON null value. By default, fields with empty values are
   410  	// omitted from API requests. See
   411  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   412  	NullFields []string `json:"-"`
   413  }
   414  
   415  func (s *Parameters) MarshalJSON() ([]byte, error) {
   416  	type NoMethod Parameters
   417  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   418  }
   419  
   420  // Query: Represents a query.
   421  type Query struct {
   422  	// Metadata: Query metadata.
   423  	Metadata *QueryMetadata `json:"metadata,omitempty"`
   424  	// Params: Query parameters.
   425  	Params *Parameters `json:"params,omitempty"`
   426  	// QueryId: Output only. Query ID.
   427  	QueryId int64 `json:"queryId,omitempty,string"`
   428  	// Schedule: Information on how often and when to run a query. If `ONE_TIME` is
   429  	// set to the frequency field, the query will only be run at the time of
   430  	// creation.
   431  	Schedule *QuerySchedule `json:"schedule,omitempty"`
   432  
   433  	// ServerResponse contains the HTTP response code and headers from the server.
   434  	googleapi.ServerResponse `json:"-"`
   435  	// ForceSendFields is a list of field names (e.g. "Metadata") to
   436  	// unconditionally include in API requests. By default, fields with empty or
   437  	// default values are omitted from API requests. See
   438  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   439  	// details.
   440  	ForceSendFields []string `json:"-"`
   441  	// NullFields is a list of field names (e.g. "Metadata") to include in API
   442  	// requests with the JSON null value. By default, fields with empty values are
   443  	// omitted from API requests. See
   444  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   445  	NullFields []string `json:"-"`
   446  }
   447  
   448  func (s *Query) MarshalJSON() ([]byte, error) {
   449  	type NoMethod Query
   450  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   451  }
   452  
   453  // QueryMetadata: Query metadata.
   454  type QueryMetadata struct {
   455  	// DataRange: Range of report data. All reports will be based on the same time
   456  	// zone as used by the advertiser.
   457  	DataRange *DataRange `json:"dataRange,omitempty"`
   458  	// Format: Format of the generated report.
   459  	//
   460  	// Possible values:
   461  	//   "FORMAT_UNSPECIFIED" - Default value when format is not specified or is
   462  	// unknown in this version.
   463  	//   "CSV" - CSV.
   464  	//   "XLSX" - Excel.
   465  	Format string `json:"format,omitempty"`
   466  	// SendNotification: Whether to send an email notification when a report is
   467  	// ready. Defaults to false.
   468  	SendNotification bool `json:"sendNotification,omitempty"`
   469  	// ShareEmailAddress: List of email addresses which are sent email
   470  	// notifications when the report is finished. Separate from send_notification.
   471  	ShareEmailAddress []string `json:"shareEmailAddress,omitempty"`
   472  	// Title: Query title. It is used to name the reports generated from this
   473  	// query.
   474  	Title string `json:"title,omitempty"`
   475  	// ForceSendFields is a list of field names (e.g. "DataRange") to
   476  	// unconditionally include in API requests. By default, fields with empty or
   477  	// default values are omitted from API requests. See
   478  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   479  	// details.
   480  	ForceSendFields []string `json:"-"`
   481  	// NullFields is a list of field names (e.g. "DataRange") to include in API
   482  	// requests with the JSON null value. By default, fields with empty values are
   483  	// omitted from API requests. See
   484  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   485  	NullFields []string `json:"-"`
   486  }
   487  
   488  func (s *QueryMetadata) MarshalJSON() ([]byte, error) {
   489  	type NoMethod QueryMetadata
   490  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   491  }
   492  
   493  // QuerySchedule: Information on when and how frequently to run a query.
   494  type QuerySchedule struct {
   495  	// EndDate: Date to periodically run the query until. Not applicable to
   496  	// `ONE_TIME` frequency.
   497  	EndDate *Date `json:"endDate,omitempty"`
   498  	// Frequency: How often the query is run.
   499  	//
   500  	// Possible values:
   501  	//   "FREQUENCY_UNSPECIFIED" - Default value when frequency is not specified or
   502  	// is unknown in this version.
   503  	//   "ONE_TIME" - Only once.
   504  	//   "DAILY" - Once a day.
   505  	//   "WEEKLY" - Once a week.
   506  	//   "SEMI_MONTHLY" - Twice a month.
   507  	//   "MONTHLY" - Once a month.
   508  	//   "QUARTERLY" - Once a quarter
   509  	//   "YEARLY" - Once a year.
   510  	Frequency string `json:"frequency,omitempty"`
   511  	// NextRunTimezoneCode: Canonical timezone code for report generation time.
   512  	// Defaults to `America/New_York`.
   513  	NextRunTimezoneCode string `json:"nextRunTimezoneCode,omitempty"`
   514  	// StartDate: When to start running the query. Not applicable to `ONE_TIME`
   515  	// frequency.
   516  	StartDate *Date `json:"startDate,omitempty"`
   517  	// ForceSendFields is a list of field names (e.g. "EndDate") to unconditionally
   518  	// include in API requests. By default, fields with empty or default values are
   519  	// omitted from API requests. See
   520  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   521  	// details.
   522  	ForceSendFields []string `json:"-"`
   523  	// NullFields is a list of field names (e.g. "EndDate") to include in API
   524  	// requests with the JSON null value. By default, fields with empty values are
   525  	// omitted from API requests. See
   526  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   527  	NullFields []string `json:"-"`
   528  }
   529  
   530  func (s *QuerySchedule) MarshalJSON() ([]byte, error) {
   531  	type NoMethod QuerySchedule
   532  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   533  }
   534  
   535  // Report: Represents a report.
   536  type Report struct {
   537  	// Key: Key used to identify a report.
   538  	Key *ReportKey `json:"key,omitempty"`
   539  	// Metadata: Report metadata.
   540  	Metadata *ReportMetadata `json:"metadata,omitempty"`
   541  	// Params: Report parameters.
   542  	Params *Parameters `json:"params,omitempty"`
   543  
   544  	// ServerResponse contains the HTTP response code and headers from the server.
   545  	googleapi.ServerResponse `json:"-"`
   546  	// ForceSendFields is a list of field names (e.g. "Key") to unconditionally
   547  	// include in API requests. By default, fields with empty or default values are
   548  	// omitted from API requests. See
   549  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   550  	// details.
   551  	ForceSendFields []string `json:"-"`
   552  	// NullFields is a list of field names (e.g. "Key") to include in API requests
   553  	// with the JSON null value. By default, fields with empty values are omitted
   554  	// from API requests. See
   555  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   556  	NullFields []string `json:"-"`
   557  }
   558  
   559  func (s *Report) MarshalJSON() ([]byte, error) {
   560  	type NoMethod Report
   561  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   562  }
   563  
   564  // ReportKey: Key used to identify a report.
   565  type ReportKey struct {
   566  	// QueryId: Output only. Query ID.
   567  	QueryId int64 `json:"queryId,omitempty,string"`
   568  	// ReportId: Output only. Report ID.
   569  	ReportId int64 `json:"reportId,omitempty,string"`
   570  	// ForceSendFields is a list of field names (e.g. "QueryId") to unconditionally
   571  	// include in API requests. By default, fields with empty or default values are
   572  	// omitted from API requests. See
   573  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   574  	// details.
   575  	ForceSendFields []string `json:"-"`
   576  	// NullFields is a list of field names (e.g. "QueryId") to include in API
   577  	// requests with the JSON null value. By default, fields with empty values are
   578  	// omitted from API requests. See
   579  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   580  	NullFields []string `json:"-"`
   581  }
   582  
   583  func (s *ReportKey) MarshalJSON() ([]byte, error) {
   584  	type NoMethod ReportKey
   585  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   586  }
   587  
   588  // ReportMetadata: Report metadata.
   589  type ReportMetadata struct {
   590  	// GoogleCloudStoragePath: Output only. The path to the location in Google
   591  	// Cloud Storage where the report is stored.
   592  	GoogleCloudStoragePath string `json:"googleCloudStoragePath,omitempty"`
   593  	// ReportDataEndDate: The ending time for the data that is shown in the report.
   594  	ReportDataEndDate *Date `json:"reportDataEndDate,omitempty"`
   595  	// ReportDataStartDate: The starting time for the data that is shown in the
   596  	// report.
   597  	ReportDataStartDate *Date `json:"reportDataStartDate,omitempty"`
   598  	// Status: Report status.
   599  	Status *ReportStatus `json:"status,omitempty"`
   600  	// ForceSendFields is a list of field names (e.g. "GoogleCloudStoragePath") to
   601  	// unconditionally include in API requests. By default, fields with empty or
   602  	// default values are omitted from API requests. See
   603  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   604  	// details.
   605  	ForceSendFields []string `json:"-"`
   606  	// NullFields is a list of field names (e.g. "GoogleCloudStoragePath") to
   607  	// include in API requests with the JSON null value. By default, fields with
   608  	// empty values are omitted from API requests. See
   609  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   610  	NullFields []string `json:"-"`
   611  }
   612  
   613  func (s *ReportMetadata) MarshalJSON() ([]byte, error) {
   614  	type NoMethod ReportMetadata
   615  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   616  }
   617  
   618  // ReportStatus: Report status.
   619  type ReportStatus struct {
   620  	// FinishTime: Output only. The time when this report either completed
   621  	// successfully or failed.
   622  	FinishTime string `json:"finishTime,omitempty"`
   623  	// Format: The file type of the report.
   624  	//
   625  	// Possible values:
   626  	//   "FORMAT_UNSPECIFIED" - Default value when format is not specified or is
   627  	// unknown in this version.
   628  	//   "CSV" - CSV.
   629  	//   "XLSX" - Excel.
   630  	Format string `json:"format,omitempty"`
   631  	// State: Output only. The state of the report.
   632  	//
   633  	// Possible values:
   634  	//   "STATE_UNSPECIFIED" - Default value when state is not specified or is
   635  	// unknown in this version.
   636  	//   "QUEUED" - The report is queued to run.
   637  	//   "RUNNING" - The report is currently running.
   638  	//   "DONE" - The report has finished running successfully.
   639  	//   "FAILED" - The report has finished running in failure.
   640  	State string `json:"state,omitempty"`
   641  	// ForceSendFields is a list of field names (e.g. "FinishTime") to
   642  	// unconditionally include in API requests. By default, fields with empty or
   643  	// default values are omitted from API requests. See
   644  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   645  	// details.
   646  	ForceSendFields []string `json:"-"`
   647  	// NullFields is a list of field names (e.g. "FinishTime") to include in API
   648  	// requests with the JSON null value. By default, fields with empty values are
   649  	// omitted from API requests. See
   650  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   651  	NullFields []string `json:"-"`
   652  }
   653  
   654  func (s *ReportStatus) MarshalJSON() ([]byte, error) {
   655  	type NoMethod ReportStatus
   656  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   657  }
   658  
   659  // RunQueryRequest: Request to run a stored query to generate a report.
   660  type RunQueryRequest struct {
   661  	// DataRange: Report data range used to generate the report. If unspecified,
   662  	// the original parent query's data range is used.
   663  	DataRange *DataRange `json:"dataRange,omitempty"`
   664  	// ForceSendFields is a list of field names (e.g. "DataRange") to
   665  	// unconditionally include in API requests. By default, fields with empty or
   666  	// default values are omitted from API requests. See
   667  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   668  	// details.
   669  	ForceSendFields []string `json:"-"`
   670  	// NullFields is a list of field names (e.g. "DataRange") to include in API
   671  	// requests with the JSON null value. By default, fields with empty values are
   672  	// omitted from API requests. See
   673  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   674  	NullFields []string `json:"-"`
   675  }
   676  
   677  func (s *RunQueryRequest) MarshalJSON() ([]byte, error) {
   678  	type NoMethod RunQueryRequest
   679  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   680  }
   681  
   682  type QueriesCreateCall struct {
   683  	s          *Service
   684  	query      *Query
   685  	urlParams_ gensupport.URLParams
   686  	ctx_       context.Context
   687  	header_    http.Header
   688  }
   689  
   690  // Create: Creates a query.
   691  func (r *QueriesService) Create(query *Query) *QueriesCreateCall {
   692  	c := &QueriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   693  	c.query = query
   694  	return c
   695  }
   696  
   697  // Fields allows partial responses to be retrieved. See
   698  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   699  // details.
   700  func (c *QueriesCreateCall) Fields(s ...googleapi.Field) *QueriesCreateCall {
   701  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   702  	return c
   703  }
   704  
   705  // Context sets the context to be used in this call's Do method.
   706  func (c *QueriesCreateCall) Context(ctx context.Context) *QueriesCreateCall {
   707  	c.ctx_ = ctx
   708  	return c
   709  }
   710  
   711  // Header returns a http.Header that can be modified by the caller to add
   712  // headers to the request.
   713  func (c *QueriesCreateCall) Header() http.Header {
   714  	if c.header_ == nil {
   715  		c.header_ = make(http.Header)
   716  	}
   717  	return c.header_
   718  }
   719  
   720  func (c *QueriesCreateCall) doRequest(alt string) (*http.Response, error) {
   721  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   722  	var body io.Reader = nil
   723  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.query)
   724  	if err != nil {
   725  		return nil, err
   726  	}
   727  	c.urlParams_.Set("alt", alt)
   728  	c.urlParams_.Set("prettyPrint", "false")
   729  	urls := googleapi.ResolveRelative(c.s.BasePath, "queries")
   730  	urls += "?" + c.urlParams_.Encode()
   731  	req, err := http.NewRequest("POST", urls, body)
   732  	if err != nil {
   733  		return nil, err
   734  	}
   735  	req.Header = reqHeaders
   736  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   737  }
   738  
   739  // Do executes the "doubleclickbidmanager.queries.create" call.
   740  // Any non-2xx status code is an error. Response headers are in either
   741  // *Query.ServerResponse.Header or (if a response was returned at all) in
   742  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   743  // whether the returned error was because http.StatusNotModified was returned.
   744  func (c *QueriesCreateCall) Do(opts ...googleapi.CallOption) (*Query, error) {
   745  	gensupport.SetOptions(c.urlParams_, opts...)
   746  	res, err := c.doRequest("json")
   747  	if res != nil && res.StatusCode == http.StatusNotModified {
   748  		if res.Body != nil {
   749  			res.Body.Close()
   750  		}
   751  		return nil, gensupport.WrapError(&googleapi.Error{
   752  			Code:   res.StatusCode,
   753  			Header: res.Header,
   754  		})
   755  	}
   756  	if err != nil {
   757  		return nil, err
   758  	}
   759  	defer googleapi.CloseBody(res)
   760  	if err := googleapi.CheckResponse(res); err != nil {
   761  		return nil, gensupport.WrapError(err)
   762  	}
   763  	ret := &Query{
   764  		ServerResponse: googleapi.ServerResponse{
   765  			Header:         res.Header,
   766  			HTTPStatusCode: res.StatusCode,
   767  		},
   768  	}
   769  	target := &ret
   770  	if err := gensupport.DecodeResponse(target, res); err != nil {
   771  		return nil, err
   772  	}
   773  	return ret, nil
   774  }
   775  
   776  type QueriesDeleteCall struct {
   777  	s          *Service
   778  	queryId    int64
   779  	urlParams_ gensupport.URLParams
   780  	ctx_       context.Context
   781  	header_    http.Header
   782  }
   783  
   784  // Delete: Deletes a query as well as the associated reports.
   785  //
   786  // - queryId: ID of query to delete.
   787  func (r *QueriesService) Delete(queryId int64) *QueriesDeleteCall {
   788  	c := &QueriesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   789  	c.queryId = queryId
   790  	return c
   791  }
   792  
   793  // Fields allows partial responses to be retrieved. See
   794  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   795  // details.
   796  func (c *QueriesDeleteCall) Fields(s ...googleapi.Field) *QueriesDeleteCall {
   797  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   798  	return c
   799  }
   800  
   801  // Context sets the context to be used in this call's Do method.
   802  func (c *QueriesDeleteCall) Context(ctx context.Context) *QueriesDeleteCall {
   803  	c.ctx_ = ctx
   804  	return c
   805  }
   806  
   807  // Header returns a http.Header that can be modified by the caller to add
   808  // headers to the request.
   809  func (c *QueriesDeleteCall) Header() http.Header {
   810  	if c.header_ == nil {
   811  		c.header_ = make(http.Header)
   812  	}
   813  	return c.header_
   814  }
   815  
   816  func (c *QueriesDeleteCall) doRequest(alt string) (*http.Response, error) {
   817  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   818  	var body io.Reader = nil
   819  	c.urlParams_.Set("alt", alt)
   820  	c.urlParams_.Set("prettyPrint", "false")
   821  	urls := googleapi.ResolveRelative(c.s.BasePath, "queries/{queryId}")
   822  	urls += "?" + c.urlParams_.Encode()
   823  	req, err := http.NewRequest("DELETE", urls, body)
   824  	if err != nil {
   825  		return nil, err
   826  	}
   827  	req.Header = reqHeaders
   828  	googleapi.Expand(req.URL, map[string]string{
   829  		"queryId": strconv.FormatInt(c.queryId, 10),
   830  	})
   831  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   832  }
   833  
   834  // Do executes the "doubleclickbidmanager.queries.delete" call.
   835  func (c *QueriesDeleteCall) Do(opts ...googleapi.CallOption) error {
   836  	gensupport.SetOptions(c.urlParams_, opts...)
   837  	res, err := c.doRequest("json")
   838  	if err != nil {
   839  		return err
   840  	}
   841  	defer googleapi.CloseBody(res)
   842  	if err := googleapi.CheckResponse(res); err != nil {
   843  		return gensupport.WrapError(err)
   844  	}
   845  	return nil
   846  }
   847  
   848  type QueriesGetCall struct {
   849  	s            *Service
   850  	queryId      int64
   851  	urlParams_   gensupport.URLParams
   852  	ifNoneMatch_ string
   853  	ctx_         context.Context
   854  	header_      http.Header
   855  }
   856  
   857  // Get: Retrieves a query.
   858  //
   859  // - queryId: ID of query to retrieve.
   860  func (r *QueriesService) Get(queryId int64) *QueriesGetCall {
   861  	c := &QueriesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   862  	c.queryId = queryId
   863  	return c
   864  }
   865  
   866  // Fields allows partial responses to be retrieved. See
   867  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   868  // details.
   869  func (c *QueriesGetCall) Fields(s ...googleapi.Field) *QueriesGetCall {
   870  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   871  	return c
   872  }
   873  
   874  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   875  // object's ETag matches the given value. This is useful for getting updates
   876  // only after the object has changed since the last request.
   877  func (c *QueriesGetCall) IfNoneMatch(entityTag string) *QueriesGetCall {
   878  	c.ifNoneMatch_ = entityTag
   879  	return c
   880  }
   881  
   882  // Context sets the context to be used in this call's Do method.
   883  func (c *QueriesGetCall) Context(ctx context.Context) *QueriesGetCall {
   884  	c.ctx_ = ctx
   885  	return c
   886  }
   887  
   888  // Header returns a http.Header that can be modified by the caller to add
   889  // headers to the request.
   890  func (c *QueriesGetCall) Header() http.Header {
   891  	if c.header_ == nil {
   892  		c.header_ = make(http.Header)
   893  	}
   894  	return c.header_
   895  }
   896  
   897  func (c *QueriesGetCall) doRequest(alt string) (*http.Response, error) {
   898  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   899  	if c.ifNoneMatch_ != "" {
   900  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   901  	}
   902  	var body io.Reader = nil
   903  	c.urlParams_.Set("alt", alt)
   904  	c.urlParams_.Set("prettyPrint", "false")
   905  	urls := googleapi.ResolveRelative(c.s.BasePath, "queries/{queryId}")
   906  	urls += "?" + c.urlParams_.Encode()
   907  	req, err := http.NewRequest("GET", urls, body)
   908  	if err != nil {
   909  		return nil, err
   910  	}
   911  	req.Header = reqHeaders
   912  	googleapi.Expand(req.URL, map[string]string{
   913  		"queryId": strconv.FormatInt(c.queryId, 10),
   914  	})
   915  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   916  }
   917  
   918  // Do executes the "doubleclickbidmanager.queries.get" call.
   919  // Any non-2xx status code is an error. Response headers are in either
   920  // *Query.ServerResponse.Header or (if a response was returned at all) in
   921  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   922  // whether the returned error was because http.StatusNotModified was returned.
   923  func (c *QueriesGetCall) Do(opts ...googleapi.CallOption) (*Query, error) {
   924  	gensupport.SetOptions(c.urlParams_, opts...)
   925  	res, err := c.doRequest("json")
   926  	if res != nil && res.StatusCode == http.StatusNotModified {
   927  		if res.Body != nil {
   928  			res.Body.Close()
   929  		}
   930  		return nil, gensupport.WrapError(&googleapi.Error{
   931  			Code:   res.StatusCode,
   932  			Header: res.Header,
   933  		})
   934  	}
   935  	if err != nil {
   936  		return nil, err
   937  	}
   938  	defer googleapi.CloseBody(res)
   939  	if err := googleapi.CheckResponse(res); err != nil {
   940  		return nil, gensupport.WrapError(err)
   941  	}
   942  	ret := &Query{
   943  		ServerResponse: googleapi.ServerResponse{
   944  			Header:         res.Header,
   945  			HTTPStatusCode: res.StatusCode,
   946  		},
   947  	}
   948  	target := &ret
   949  	if err := gensupport.DecodeResponse(target, res); err != nil {
   950  		return nil, err
   951  	}
   952  	return ret, nil
   953  }
   954  
   955  type QueriesListCall struct {
   956  	s            *Service
   957  	urlParams_   gensupport.URLParams
   958  	ifNoneMatch_ string
   959  	ctx_         context.Context
   960  	header_      http.Header
   961  }
   962  
   963  // List: Lists queries created by the current user.
   964  func (r *QueriesService) List() *QueriesListCall {
   965  	c := &QueriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   966  	return c
   967  }
   968  
   969  // OrderBy sets the optional parameter "orderBy": Name of a field used to order
   970  // results. The default sorting order is ascending. To specify descending order
   971  // for a field, append a " desc" suffix. For example "metadata.title desc".
   972  // Sorting is only supported for the following fields: * `queryId` *
   973  // `metadata.title`
   974  func (c *QueriesListCall) OrderBy(orderBy string) *QueriesListCall {
   975  	c.urlParams_.Set("orderBy", orderBy)
   976  	return c
   977  }
   978  
   979  // PageSize sets the optional parameter "pageSize": Maximum number of results
   980  // per page. Must be between `1` and `100`. Defaults to `100` if unspecified.
   981  func (c *QueriesListCall) PageSize(pageSize int64) *QueriesListCall {
   982  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
   983  	return c
   984  }
   985  
   986  // PageToken sets the optional parameter "pageToken": A page token, received
   987  // from a previous list call. Provide this to retrieve the subsequent page of
   988  // queries.
   989  func (c *QueriesListCall) PageToken(pageToken string) *QueriesListCall {
   990  	c.urlParams_.Set("pageToken", pageToken)
   991  	return c
   992  }
   993  
   994  // Fields allows partial responses to be retrieved. See
   995  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   996  // details.
   997  func (c *QueriesListCall) Fields(s ...googleapi.Field) *QueriesListCall {
   998  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   999  	return c
  1000  }
  1001  
  1002  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1003  // object's ETag matches the given value. This is useful for getting updates
  1004  // only after the object has changed since the last request.
  1005  func (c *QueriesListCall) IfNoneMatch(entityTag string) *QueriesListCall {
  1006  	c.ifNoneMatch_ = entityTag
  1007  	return c
  1008  }
  1009  
  1010  // Context sets the context to be used in this call's Do method.
  1011  func (c *QueriesListCall) Context(ctx context.Context) *QueriesListCall {
  1012  	c.ctx_ = ctx
  1013  	return c
  1014  }
  1015  
  1016  // Header returns a http.Header that can be modified by the caller to add
  1017  // headers to the request.
  1018  func (c *QueriesListCall) Header() http.Header {
  1019  	if c.header_ == nil {
  1020  		c.header_ = make(http.Header)
  1021  	}
  1022  	return c.header_
  1023  }
  1024  
  1025  func (c *QueriesListCall) doRequest(alt string) (*http.Response, error) {
  1026  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1027  	if c.ifNoneMatch_ != "" {
  1028  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1029  	}
  1030  	var body io.Reader = nil
  1031  	c.urlParams_.Set("alt", alt)
  1032  	c.urlParams_.Set("prettyPrint", "false")
  1033  	urls := googleapi.ResolveRelative(c.s.BasePath, "queries")
  1034  	urls += "?" + c.urlParams_.Encode()
  1035  	req, err := http.NewRequest("GET", urls, body)
  1036  	if err != nil {
  1037  		return nil, err
  1038  	}
  1039  	req.Header = reqHeaders
  1040  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1041  }
  1042  
  1043  // Do executes the "doubleclickbidmanager.queries.list" call.
  1044  // Any non-2xx status code is an error. Response headers are in either
  1045  // *ListQueriesResponse.ServerResponse.Header or (if a response was returned at
  1046  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1047  // check whether the returned error was because http.StatusNotModified was
  1048  // returned.
  1049  func (c *QueriesListCall) Do(opts ...googleapi.CallOption) (*ListQueriesResponse, error) {
  1050  	gensupport.SetOptions(c.urlParams_, opts...)
  1051  	res, err := c.doRequest("json")
  1052  	if res != nil && res.StatusCode == http.StatusNotModified {
  1053  		if res.Body != nil {
  1054  			res.Body.Close()
  1055  		}
  1056  		return nil, gensupport.WrapError(&googleapi.Error{
  1057  			Code:   res.StatusCode,
  1058  			Header: res.Header,
  1059  		})
  1060  	}
  1061  	if err != nil {
  1062  		return nil, err
  1063  	}
  1064  	defer googleapi.CloseBody(res)
  1065  	if err := googleapi.CheckResponse(res); err != nil {
  1066  		return nil, gensupport.WrapError(err)
  1067  	}
  1068  	ret := &ListQueriesResponse{
  1069  		ServerResponse: googleapi.ServerResponse{
  1070  			Header:         res.Header,
  1071  			HTTPStatusCode: res.StatusCode,
  1072  		},
  1073  	}
  1074  	target := &ret
  1075  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1076  		return nil, err
  1077  	}
  1078  	return ret, nil
  1079  }
  1080  
  1081  // Pages invokes f for each page of results.
  1082  // A non-nil error returned from f will halt the iteration.
  1083  // The provided context supersedes any context provided to the Context method.
  1084  func (c *QueriesListCall) Pages(ctx context.Context, f func(*ListQueriesResponse) error) error {
  1085  	c.ctx_ = ctx
  1086  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1087  	for {
  1088  		x, err := c.Do()
  1089  		if err != nil {
  1090  			return err
  1091  		}
  1092  		if err := f(x); err != nil {
  1093  			return err
  1094  		}
  1095  		if x.NextPageToken == "" {
  1096  			return nil
  1097  		}
  1098  		c.PageToken(x.NextPageToken)
  1099  	}
  1100  }
  1101  
  1102  type QueriesRunCall struct {
  1103  	s               *Service
  1104  	queryId         int64
  1105  	runqueryrequest *RunQueryRequest
  1106  	urlParams_      gensupport.URLParams
  1107  	ctx_            context.Context
  1108  	header_         http.Header
  1109  }
  1110  
  1111  // Run: Runs a stored query to generate a report.
  1112  //
  1113  // - queryId: ID of query to run.
  1114  func (r *QueriesService) Run(queryId int64, runqueryrequest *RunQueryRequest) *QueriesRunCall {
  1115  	c := &QueriesRunCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1116  	c.queryId = queryId
  1117  	c.runqueryrequest = runqueryrequest
  1118  	return c
  1119  }
  1120  
  1121  // Synchronous sets the optional parameter "synchronous": Whether the query
  1122  // should be run synchronously. When true, this method will not return until
  1123  // the query has finished running. When false or not specified, this method
  1124  // will return immediately.
  1125  func (c *QueriesRunCall) Synchronous(synchronous bool) *QueriesRunCall {
  1126  	c.urlParams_.Set("synchronous", fmt.Sprint(synchronous))
  1127  	return c
  1128  }
  1129  
  1130  // Fields allows partial responses to be retrieved. See
  1131  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1132  // details.
  1133  func (c *QueriesRunCall) Fields(s ...googleapi.Field) *QueriesRunCall {
  1134  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1135  	return c
  1136  }
  1137  
  1138  // Context sets the context to be used in this call's Do method.
  1139  func (c *QueriesRunCall) Context(ctx context.Context) *QueriesRunCall {
  1140  	c.ctx_ = ctx
  1141  	return c
  1142  }
  1143  
  1144  // Header returns a http.Header that can be modified by the caller to add
  1145  // headers to the request.
  1146  func (c *QueriesRunCall) Header() http.Header {
  1147  	if c.header_ == nil {
  1148  		c.header_ = make(http.Header)
  1149  	}
  1150  	return c.header_
  1151  }
  1152  
  1153  func (c *QueriesRunCall) doRequest(alt string) (*http.Response, error) {
  1154  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1155  	var body io.Reader = nil
  1156  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.runqueryrequest)
  1157  	if err != nil {
  1158  		return nil, err
  1159  	}
  1160  	c.urlParams_.Set("alt", alt)
  1161  	c.urlParams_.Set("prettyPrint", "false")
  1162  	urls := googleapi.ResolveRelative(c.s.BasePath, "queries/{queryId}:run")
  1163  	urls += "?" + c.urlParams_.Encode()
  1164  	req, err := http.NewRequest("POST", urls, body)
  1165  	if err != nil {
  1166  		return nil, err
  1167  	}
  1168  	req.Header = reqHeaders
  1169  	googleapi.Expand(req.URL, map[string]string{
  1170  		"queryId": strconv.FormatInt(c.queryId, 10),
  1171  	})
  1172  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1173  }
  1174  
  1175  // Do executes the "doubleclickbidmanager.queries.run" call.
  1176  // Any non-2xx status code is an error. Response headers are in either
  1177  // *Report.ServerResponse.Header or (if a response was returned at all) in
  1178  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1179  // whether the returned error was because http.StatusNotModified was returned.
  1180  func (c *QueriesRunCall) Do(opts ...googleapi.CallOption) (*Report, error) {
  1181  	gensupport.SetOptions(c.urlParams_, opts...)
  1182  	res, err := c.doRequest("json")
  1183  	if res != nil && res.StatusCode == http.StatusNotModified {
  1184  		if res.Body != nil {
  1185  			res.Body.Close()
  1186  		}
  1187  		return nil, gensupport.WrapError(&googleapi.Error{
  1188  			Code:   res.StatusCode,
  1189  			Header: res.Header,
  1190  		})
  1191  	}
  1192  	if err != nil {
  1193  		return nil, err
  1194  	}
  1195  	defer googleapi.CloseBody(res)
  1196  	if err := googleapi.CheckResponse(res); err != nil {
  1197  		return nil, gensupport.WrapError(err)
  1198  	}
  1199  	ret := &Report{
  1200  		ServerResponse: googleapi.ServerResponse{
  1201  			Header:         res.Header,
  1202  			HTTPStatusCode: res.StatusCode,
  1203  		},
  1204  	}
  1205  	target := &ret
  1206  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1207  		return nil, err
  1208  	}
  1209  	return ret, nil
  1210  }
  1211  
  1212  type QueriesReportsGetCall struct {
  1213  	s            *Service
  1214  	queryId      int64
  1215  	reportId     int64
  1216  	urlParams_   gensupport.URLParams
  1217  	ifNoneMatch_ string
  1218  	ctx_         context.Context
  1219  	header_      http.Header
  1220  }
  1221  
  1222  // Get: Retrieves a report.
  1223  //
  1224  // - queryId: ID of the query the report is associated with.
  1225  // - reportId: ID of the report to retrieve.
  1226  func (r *QueriesReportsService) Get(queryId int64, reportId int64) *QueriesReportsGetCall {
  1227  	c := &QueriesReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1228  	c.queryId = queryId
  1229  	c.reportId = reportId
  1230  	return c
  1231  }
  1232  
  1233  // Fields allows partial responses to be retrieved. See
  1234  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1235  // details.
  1236  func (c *QueriesReportsGetCall) Fields(s ...googleapi.Field) *QueriesReportsGetCall {
  1237  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1238  	return c
  1239  }
  1240  
  1241  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1242  // object's ETag matches the given value. This is useful for getting updates
  1243  // only after the object has changed since the last request.
  1244  func (c *QueriesReportsGetCall) IfNoneMatch(entityTag string) *QueriesReportsGetCall {
  1245  	c.ifNoneMatch_ = entityTag
  1246  	return c
  1247  }
  1248  
  1249  // Context sets the context to be used in this call's Do method.
  1250  func (c *QueriesReportsGetCall) Context(ctx context.Context) *QueriesReportsGetCall {
  1251  	c.ctx_ = ctx
  1252  	return c
  1253  }
  1254  
  1255  // Header returns a http.Header that can be modified by the caller to add
  1256  // headers to the request.
  1257  func (c *QueriesReportsGetCall) Header() http.Header {
  1258  	if c.header_ == nil {
  1259  		c.header_ = make(http.Header)
  1260  	}
  1261  	return c.header_
  1262  }
  1263  
  1264  func (c *QueriesReportsGetCall) doRequest(alt string) (*http.Response, error) {
  1265  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1266  	if c.ifNoneMatch_ != "" {
  1267  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1268  	}
  1269  	var body io.Reader = nil
  1270  	c.urlParams_.Set("alt", alt)
  1271  	c.urlParams_.Set("prettyPrint", "false")
  1272  	urls := googleapi.ResolveRelative(c.s.BasePath, "queries/{queryId}/reports/{reportId}")
  1273  	urls += "?" + c.urlParams_.Encode()
  1274  	req, err := http.NewRequest("GET", urls, body)
  1275  	if err != nil {
  1276  		return nil, err
  1277  	}
  1278  	req.Header = reqHeaders
  1279  	googleapi.Expand(req.URL, map[string]string{
  1280  		"queryId":  strconv.FormatInt(c.queryId, 10),
  1281  		"reportId": strconv.FormatInt(c.reportId, 10),
  1282  	})
  1283  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1284  }
  1285  
  1286  // Do executes the "doubleclickbidmanager.queries.reports.get" call.
  1287  // Any non-2xx status code is an error. Response headers are in either
  1288  // *Report.ServerResponse.Header or (if a response was returned at all) in
  1289  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1290  // whether the returned error was because http.StatusNotModified was returned.
  1291  func (c *QueriesReportsGetCall) Do(opts ...googleapi.CallOption) (*Report, error) {
  1292  	gensupport.SetOptions(c.urlParams_, opts...)
  1293  	res, err := c.doRequest("json")
  1294  	if res != nil && res.StatusCode == http.StatusNotModified {
  1295  		if res.Body != nil {
  1296  			res.Body.Close()
  1297  		}
  1298  		return nil, gensupport.WrapError(&googleapi.Error{
  1299  			Code:   res.StatusCode,
  1300  			Header: res.Header,
  1301  		})
  1302  	}
  1303  	if err != nil {
  1304  		return nil, err
  1305  	}
  1306  	defer googleapi.CloseBody(res)
  1307  	if err := googleapi.CheckResponse(res); err != nil {
  1308  		return nil, gensupport.WrapError(err)
  1309  	}
  1310  	ret := &Report{
  1311  		ServerResponse: googleapi.ServerResponse{
  1312  			Header:         res.Header,
  1313  			HTTPStatusCode: res.StatusCode,
  1314  		},
  1315  	}
  1316  	target := &ret
  1317  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1318  		return nil, err
  1319  	}
  1320  	return ret, nil
  1321  }
  1322  
  1323  type QueriesReportsListCall struct {
  1324  	s            *Service
  1325  	queryId      int64
  1326  	urlParams_   gensupport.URLParams
  1327  	ifNoneMatch_ string
  1328  	ctx_         context.Context
  1329  	header_      http.Header
  1330  }
  1331  
  1332  // List: Lists reports associated with a query.
  1333  //
  1334  // - queryId: ID of the query with which the reports are associated.
  1335  func (r *QueriesReportsService) List(queryId int64) *QueriesReportsListCall {
  1336  	c := &QueriesReportsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1337  	c.queryId = queryId
  1338  	return c
  1339  }
  1340  
  1341  // OrderBy sets the optional parameter "orderBy": Name of a field used to order
  1342  // results. The default sorting order is ascending. To specify descending order
  1343  // for a field, append a " desc" suffix. For example "key.reportId desc".
  1344  // Sorting is only supported for the following fields: * `key.reportId`
  1345  func (c *QueriesReportsListCall) OrderBy(orderBy string) *QueriesReportsListCall {
  1346  	c.urlParams_.Set("orderBy", orderBy)
  1347  	return c
  1348  }
  1349  
  1350  // PageSize sets the optional parameter "pageSize": Maximum number of results
  1351  // per page. Must be between `1` and `100`. Defaults to `100` if unspecified.
  1352  func (c *QueriesReportsListCall) PageSize(pageSize int64) *QueriesReportsListCall {
  1353  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1354  	return c
  1355  }
  1356  
  1357  // PageToken sets the optional parameter "pageToken": A page token, received
  1358  // from a previous list call. Provide this to retrieve the subsequent page of
  1359  // reports.
  1360  func (c *QueriesReportsListCall) PageToken(pageToken string) *QueriesReportsListCall {
  1361  	c.urlParams_.Set("pageToken", pageToken)
  1362  	return c
  1363  }
  1364  
  1365  // Fields allows partial responses to be retrieved. See
  1366  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1367  // details.
  1368  func (c *QueriesReportsListCall) Fields(s ...googleapi.Field) *QueriesReportsListCall {
  1369  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1370  	return c
  1371  }
  1372  
  1373  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1374  // object's ETag matches the given value. This is useful for getting updates
  1375  // only after the object has changed since the last request.
  1376  func (c *QueriesReportsListCall) IfNoneMatch(entityTag string) *QueriesReportsListCall {
  1377  	c.ifNoneMatch_ = entityTag
  1378  	return c
  1379  }
  1380  
  1381  // Context sets the context to be used in this call's Do method.
  1382  func (c *QueriesReportsListCall) Context(ctx context.Context) *QueriesReportsListCall {
  1383  	c.ctx_ = ctx
  1384  	return c
  1385  }
  1386  
  1387  // Header returns a http.Header that can be modified by the caller to add
  1388  // headers to the request.
  1389  func (c *QueriesReportsListCall) Header() http.Header {
  1390  	if c.header_ == nil {
  1391  		c.header_ = make(http.Header)
  1392  	}
  1393  	return c.header_
  1394  }
  1395  
  1396  func (c *QueriesReportsListCall) doRequest(alt string) (*http.Response, error) {
  1397  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1398  	if c.ifNoneMatch_ != "" {
  1399  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1400  	}
  1401  	var body io.Reader = nil
  1402  	c.urlParams_.Set("alt", alt)
  1403  	c.urlParams_.Set("prettyPrint", "false")
  1404  	urls := googleapi.ResolveRelative(c.s.BasePath, "queries/{queryId}/reports")
  1405  	urls += "?" + c.urlParams_.Encode()
  1406  	req, err := http.NewRequest("GET", urls, body)
  1407  	if err != nil {
  1408  		return nil, err
  1409  	}
  1410  	req.Header = reqHeaders
  1411  	googleapi.Expand(req.URL, map[string]string{
  1412  		"queryId": strconv.FormatInt(c.queryId, 10),
  1413  	})
  1414  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1415  }
  1416  
  1417  // Do executes the "doubleclickbidmanager.queries.reports.list" call.
  1418  // Any non-2xx status code is an error. Response headers are in either
  1419  // *ListReportsResponse.ServerResponse.Header or (if a response was returned at
  1420  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1421  // check whether the returned error was because http.StatusNotModified was
  1422  // returned.
  1423  func (c *QueriesReportsListCall) Do(opts ...googleapi.CallOption) (*ListReportsResponse, error) {
  1424  	gensupport.SetOptions(c.urlParams_, opts...)
  1425  	res, err := c.doRequest("json")
  1426  	if res != nil && res.StatusCode == http.StatusNotModified {
  1427  		if res.Body != nil {
  1428  			res.Body.Close()
  1429  		}
  1430  		return nil, gensupport.WrapError(&googleapi.Error{
  1431  			Code:   res.StatusCode,
  1432  			Header: res.Header,
  1433  		})
  1434  	}
  1435  	if err != nil {
  1436  		return nil, err
  1437  	}
  1438  	defer googleapi.CloseBody(res)
  1439  	if err := googleapi.CheckResponse(res); err != nil {
  1440  		return nil, gensupport.WrapError(err)
  1441  	}
  1442  	ret := &ListReportsResponse{
  1443  		ServerResponse: googleapi.ServerResponse{
  1444  			Header:         res.Header,
  1445  			HTTPStatusCode: res.StatusCode,
  1446  		},
  1447  	}
  1448  	target := &ret
  1449  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1450  		return nil, err
  1451  	}
  1452  	return ret, nil
  1453  }
  1454  
  1455  // Pages invokes f for each page of results.
  1456  // A non-nil error returned from f will halt the iteration.
  1457  // The provided context supersedes any context provided to the Context method.
  1458  func (c *QueriesReportsListCall) Pages(ctx context.Context, f func(*ListReportsResponse) error) error {
  1459  	c.ctx_ = ctx
  1460  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1461  	for {
  1462  		x, err := c.Do()
  1463  		if err != nil {
  1464  			return err
  1465  		}
  1466  		if err := f(x); err != nil {
  1467  			return err
  1468  		}
  1469  		if x.NextPageToken == "" {
  1470  			return nil
  1471  		}
  1472  		c.PageToken(x.NextPageToken)
  1473  	}
  1474  }
  1475  

View as plain text