...

Source file src/google.golang.org/api/adsensehost/v4.1/adsensehost-gen.go

Documentation: google.golang.org/api/adsensehost/v4.1

     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 adsensehost provides access to the AdSense Host API.
     8  //
     9  // For product documentation, see: https://developers.google.com/adsense/host/
    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/adsensehost/v4.1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	adsensehostService, err := adsensehost.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  //	adsensehostService, err := adsensehost.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  //	adsensehostService, err := adsensehost.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    49  //
    50  // See [google.golang.org/api/option.ClientOption] for details on options.
    51  package adsensehost // import "google.golang.org/api/adsensehost/v4.1"
    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 = "adsensehost:v4.1"
    90  const apiName = "adsensehost"
    91  const apiVersion = "v4.1"
    92  const basePath = "https://www.googleapis.com/adsensehost/v4.1/"
    93  const basePathTemplate = "https://www.UNIVERSE_DOMAIN/adsensehost/v4.1/"
    94  
    95  // OAuth2 scopes used by this API.
    96  const (
    97  	// View and manage your AdSense host data and associated accounts
    98  	AdsensehostScope = "https://www.googleapis.com/auth/adsensehost"
    99  )
   100  
   101  // NewService creates a new Service.
   102  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   103  	scopesOption := internaloption.WithDefaultScopes(
   104  		"https://www.googleapis.com/auth/adsensehost",
   105  	)
   106  	// NOTE: prepend, so we don't override user-specified scopes.
   107  	opts = append([]option.ClientOption{scopesOption}, opts...)
   108  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   109  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   110  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   111  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   112  	if err != nil {
   113  		return nil, err
   114  	}
   115  	s, err := New(client)
   116  	if err != nil {
   117  		return nil, err
   118  	}
   119  	if endpoint != "" {
   120  		s.BasePath = endpoint
   121  	}
   122  	return s, nil
   123  }
   124  
   125  // New creates a new Service. It uses the provided http.Client for requests.
   126  //
   127  // Deprecated: please use NewService instead.
   128  // To provide a custom HTTP client, use option.WithHTTPClient.
   129  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   130  func New(client *http.Client) (*Service, error) {
   131  	if client == nil {
   132  		return nil, errors.New("client is nil")
   133  	}
   134  	s := &Service{client: client, BasePath: basePath}
   135  	s.Accounts = NewAccountsService(s)
   136  	s.Adclients = NewAdclientsService(s)
   137  	s.Associationsessions = NewAssociationsessionsService(s)
   138  	s.Customchannels = NewCustomchannelsService(s)
   139  	s.Reports = NewReportsService(s)
   140  	s.Urlchannels = NewUrlchannelsService(s)
   141  	return s, nil
   142  }
   143  
   144  type Service struct {
   145  	client    *http.Client
   146  	BasePath  string // API endpoint base URL
   147  	UserAgent string // optional additional User-Agent fragment
   148  
   149  	Accounts *AccountsService
   150  
   151  	Adclients *AdclientsService
   152  
   153  	Associationsessions *AssociationsessionsService
   154  
   155  	Customchannels *CustomchannelsService
   156  
   157  	Reports *ReportsService
   158  
   159  	Urlchannels *UrlchannelsService
   160  }
   161  
   162  func (s *Service) userAgent() string {
   163  	if s.UserAgent == "" {
   164  		return googleapi.UserAgent
   165  	}
   166  	return googleapi.UserAgent + " " + s.UserAgent
   167  }
   168  
   169  func NewAccountsService(s *Service) *AccountsService {
   170  	rs := &AccountsService{s: s}
   171  	rs.Adclients = NewAccountsAdclientsService(s)
   172  	rs.Adunits = NewAccountsAdunitsService(s)
   173  	rs.Reports = NewAccountsReportsService(s)
   174  	return rs
   175  }
   176  
   177  type AccountsService struct {
   178  	s *Service
   179  
   180  	Adclients *AccountsAdclientsService
   181  
   182  	Adunits *AccountsAdunitsService
   183  
   184  	Reports *AccountsReportsService
   185  }
   186  
   187  func NewAccountsAdclientsService(s *Service) *AccountsAdclientsService {
   188  	rs := &AccountsAdclientsService{s: s}
   189  	return rs
   190  }
   191  
   192  type AccountsAdclientsService struct {
   193  	s *Service
   194  }
   195  
   196  func NewAccountsAdunitsService(s *Service) *AccountsAdunitsService {
   197  	rs := &AccountsAdunitsService{s: s}
   198  	return rs
   199  }
   200  
   201  type AccountsAdunitsService struct {
   202  	s *Service
   203  }
   204  
   205  func NewAccountsReportsService(s *Service) *AccountsReportsService {
   206  	rs := &AccountsReportsService{s: s}
   207  	return rs
   208  }
   209  
   210  type AccountsReportsService struct {
   211  	s *Service
   212  }
   213  
   214  func NewAdclientsService(s *Service) *AdclientsService {
   215  	rs := &AdclientsService{s: s}
   216  	return rs
   217  }
   218  
   219  type AdclientsService struct {
   220  	s *Service
   221  }
   222  
   223  func NewAssociationsessionsService(s *Service) *AssociationsessionsService {
   224  	rs := &AssociationsessionsService{s: s}
   225  	return rs
   226  }
   227  
   228  type AssociationsessionsService struct {
   229  	s *Service
   230  }
   231  
   232  func NewCustomchannelsService(s *Service) *CustomchannelsService {
   233  	rs := &CustomchannelsService{s: s}
   234  	return rs
   235  }
   236  
   237  type CustomchannelsService struct {
   238  	s *Service
   239  }
   240  
   241  func NewReportsService(s *Service) *ReportsService {
   242  	rs := &ReportsService{s: s}
   243  	return rs
   244  }
   245  
   246  type ReportsService struct {
   247  	s *Service
   248  }
   249  
   250  func NewUrlchannelsService(s *Service) *UrlchannelsService {
   251  	rs := &UrlchannelsService{s: s}
   252  	return rs
   253  }
   254  
   255  type UrlchannelsService struct {
   256  	s *Service
   257  }
   258  
   259  type Account struct {
   260  	// Id: Unique identifier of this account.
   261  	Id string `json:"id,omitempty"`
   262  	// Kind: Kind of resource this is, in this case adsensehost#account.
   263  	Kind string `json:"kind,omitempty"`
   264  	// Name: Name of this account.
   265  	Name string `json:"name,omitempty"`
   266  	// Status: Approval status of this account. One of: PENDING, APPROVED,
   267  	// DISABLED.
   268  	Status string `json:"status,omitempty"`
   269  
   270  	// ServerResponse contains the HTTP response code and headers from the server.
   271  	googleapi.ServerResponse `json:"-"`
   272  	// ForceSendFields is a list of field names (e.g. "Id") to unconditionally
   273  	// include in API requests. By default, fields with empty or default values are
   274  	// omitted from API requests. See
   275  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   276  	// details.
   277  	ForceSendFields []string `json:"-"`
   278  	// NullFields is a list of field names (e.g. "Id") to include in API requests
   279  	// with the JSON null value. By default, fields with empty values are omitted
   280  	// from API requests. See
   281  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   282  	NullFields []string `json:"-"`
   283  }
   284  
   285  func (s *Account) MarshalJSON() ([]byte, error) {
   286  	type NoMethod Account
   287  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   288  }
   289  
   290  type Accounts struct {
   291  	// Etag: ETag of this response for caching purposes.
   292  	Etag string `json:"etag,omitempty"`
   293  	// Items: The accounts returned in this list response.
   294  	Items []*Account `json:"items,omitempty"`
   295  	// Kind: Kind of list this is, in this case adsensehost#accounts.
   296  	Kind string `json:"kind,omitempty"`
   297  
   298  	// ServerResponse contains the HTTP response code and headers from the server.
   299  	googleapi.ServerResponse `json:"-"`
   300  	// ForceSendFields is a list of field names (e.g. "Etag") to unconditionally
   301  	// include in API requests. By default, fields with empty or default values are
   302  	// omitted from API requests. See
   303  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   304  	// details.
   305  	ForceSendFields []string `json:"-"`
   306  	// NullFields is a list of field names (e.g. "Etag") to include in API requests
   307  	// with the JSON null value. By default, fields with empty values are omitted
   308  	// from API requests. See
   309  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   310  	NullFields []string `json:"-"`
   311  }
   312  
   313  func (s *Accounts) MarshalJSON() ([]byte, error) {
   314  	type NoMethod Accounts
   315  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   316  }
   317  
   318  type AdClient struct {
   319  	// ArcOptIn: Whether this ad client is opted in to ARC.
   320  	ArcOptIn bool `json:"arcOptIn,omitempty"`
   321  	// Id: Unique identifier of this ad client.
   322  	Id string `json:"id,omitempty"`
   323  	// Kind: Kind of resource this is, in this case adsensehost#adClient.
   324  	Kind string `json:"kind,omitempty"`
   325  	// ProductCode: This ad client's product code, which corresponds to the
   326  	// PRODUCT_CODE report dimension.
   327  	ProductCode string `json:"productCode,omitempty"`
   328  	// SupportsReporting: Whether this ad client supports being reported on.
   329  	SupportsReporting bool `json:"supportsReporting,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. "ArcOptIn") 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. "ArcOptIn") 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 *AdClient) MarshalJSON() ([]byte, error) {
   347  	type NoMethod AdClient
   348  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   349  }
   350  
   351  type AdClients struct {
   352  	// Etag: ETag of this response for caching purposes.
   353  	Etag string `json:"etag,omitempty"`
   354  	// Items: The ad clients returned in this list response.
   355  	Items []*AdClient `json:"items,omitempty"`
   356  	// Kind: Kind of list this is, in this case adsensehost#adClients.
   357  	Kind string `json:"kind,omitempty"`
   358  	// NextPageToken: Continuation token used to page through ad clients. To
   359  	// retrieve the next page of results, set the next request's "pageToken" value
   360  	// to this.
   361  	NextPageToken string `json:"nextPageToken,omitempty"`
   362  
   363  	// ServerResponse contains the HTTP response code and headers from the server.
   364  	googleapi.ServerResponse `json:"-"`
   365  	// ForceSendFields is a list of field names (e.g. "Etag") to unconditionally
   366  	// include in API requests. By default, fields with empty or default values are
   367  	// omitted from API requests. See
   368  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   369  	// details.
   370  	ForceSendFields []string `json:"-"`
   371  	// NullFields is a list of field names (e.g. "Etag") to include in API requests
   372  	// with the JSON null value. By default, fields with empty values are omitted
   373  	// from API requests. See
   374  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   375  	NullFields []string `json:"-"`
   376  }
   377  
   378  func (s *AdClients) MarshalJSON() ([]byte, error) {
   379  	type NoMethod AdClients
   380  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   381  }
   382  
   383  type AdCode struct {
   384  	// AdCode: The ad code snippet.
   385  	AdCode string `json:"adCode,omitempty"`
   386  	// Kind: Kind this is, in this case adsensehost#adCode.
   387  	Kind string `json:"kind,omitempty"`
   388  
   389  	// ServerResponse contains the HTTP response code and headers from the server.
   390  	googleapi.ServerResponse `json:"-"`
   391  	// ForceSendFields is a list of field names (e.g. "AdCode") to unconditionally
   392  	// include in API requests. By default, fields with empty or default values are
   393  	// omitted from API requests. See
   394  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   395  	// details.
   396  	ForceSendFields []string `json:"-"`
   397  	// NullFields is a list of field names (e.g. "AdCode") to include in API
   398  	// requests with the JSON null value. By default, fields with empty values are
   399  	// omitted from API requests. See
   400  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   401  	NullFields []string `json:"-"`
   402  }
   403  
   404  func (s *AdCode) MarshalJSON() ([]byte, error) {
   405  	type NoMethod AdCode
   406  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   407  }
   408  
   409  type AdStyle struct {
   410  	// Colors: The colors included in the style. These are represented as six
   411  	// hexadecimal characters, similar to HTML color codes, but without the leading
   412  	// hash.
   413  	Colors *AdStyleColors `json:"colors,omitempty"`
   414  	// Corners: The style of the corners in the ad (deprecated: never populated,
   415  	// ignored).
   416  	Corners string `json:"corners,omitempty"`
   417  	// Font: The font which is included in the style.
   418  	Font *AdStyleFont `json:"font,omitempty"`
   419  	// Kind: Kind this is, in this case adsensehost#adStyle.
   420  	Kind string `json:"kind,omitempty"`
   421  	// ForceSendFields is a list of field names (e.g. "Colors") to unconditionally
   422  	// include in API requests. By default, fields with empty or default values are
   423  	// omitted from API requests. See
   424  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   425  	// details.
   426  	ForceSendFields []string `json:"-"`
   427  	// NullFields is a list of field names (e.g. "Colors") to include in API
   428  	// requests with the JSON null value. By default, fields with empty values are
   429  	// omitted from API requests. See
   430  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   431  	NullFields []string `json:"-"`
   432  }
   433  
   434  func (s *AdStyle) MarshalJSON() ([]byte, error) {
   435  	type NoMethod AdStyle
   436  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   437  }
   438  
   439  // AdStyleColors: The colors included in the style. These are represented as
   440  // six hexadecimal characters, similar to HTML color codes, but without the
   441  // leading hash.
   442  type AdStyleColors struct {
   443  	// Background: The color of the ad background.
   444  	Background string `json:"background,omitempty"`
   445  	// Border: The color of the ad border.
   446  	Border string `json:"border,omitempty"`
   447  	// Text: The color of the ad text.
   448  	Text string `json:"text,omitempty"`
   449  	// Title: The color of the ad title.
   450  	Title string `json:"title,omitempty"`
   451  	// Url: The color of the ad url.
   452  	Url string `json:"url,omitempty"`
   453  	// ForceSendFields is a list of field names (e.g. "Background") to
   454  	// unconditionally include in API requests. By default, fields with empty or
   455  	// default values are omitted from API requests. See
   456  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   457  	// details.
   458  	ForceSendFields []string `json:"-"`
   459  	// NullFields is a list of field names (e.g. "Background") to include in API
   460  	// requests with the JSON null value. By default, fields with empty values are
   461  	// omitted from API requests. See
   462  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   463  	NullFields []string `json:"-"`
   464  }
   465  
   466  func (s *AdStyleColors) MarshalJSON() ([]byte, error) {
   467  	type NoMethod AdStyleColors
   468  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   469  }
   470  
   471  // AdStyleFont: The font which is included in the style.
   472  type AdStyleFont struct {
   473  	// Family: The family of the font. Possible values are: ACCOUNT_DEFAULT_FAMILY,
   474  	// ADSENSE_DEFAULT_FAMILY, ARIAL, TIMES and VERDANA.
   475  	Family string `json:"family,omitempty"`
   476  	// Size: The size of the font. Possible values are: ACCOUNT_DEFAULT_SIZE,
   477  	// ADSENSE_DEFAULT_SIZE, SMALL, MEDIUM and LARGE.
   478  	Size string `json:"size,omitempty"`
   479  	// ForceSendFields is a list of field names (e.g. "Family") to unconditionally
   480  	// include in API requests. By default, fields with empty or default values are
   481  	// omitted from API requests. See
   482  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   483  	// details.
   484  	ForceSendFields []string `json:"-"`
   485  	// NullFields is a list of field names (e.g. "Family") to include in API
   486  	// requests with the JSON null value. By default, fields with empty values are
   487  	// omitted from API requests. See
   488  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   489  	NullFields []string `json:"-"`
   490  }
   491  
   492  func (s *AdStyleFont) MarshalJSON() ([]byte, error) {
   493  	type NoMethod AdStyleFont
   494  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   495  }
   496  
   497  type AdUnit struct {
   498  	// Code: Identity code of this ad unit, not necessarily unique across ad
   499  	// clients.
   500  	Code string `json:"code,omitempty"`
   501  	// ContentAdsSettings: Settings specific to content ads (AFC) and highend
   502  	// mobile content ads (AFMC - deprecated).
   503  	ContentAdsSettings *AdUnitContentAdsSettings `json:"contentAdsSettings,omitempty"`
   504  	// CustomStyle: Custom style information specific to this ad unit.
   505  	CustomStyle *AdStyle `json:"customStyle,omitempty"`
   506  	// Id: Unique identifier of this ad unit. This should be considered an opaque
   507  	// identifier; it is not safe to rely on it being in any particular format.
   508  	Id string `json:"id,omitempty"`
   509  	// Kind: Kind of resource this is, in this case adsensehost#adUnit.
   510  	Kind string `json:"kind,omitempty"`
   511  	// MobileContentAdsSettings: Settings specific to WAP mobile content ads (AFMC
   512  	// - deprecated).
   513  	MobileContentAdsSettings *AdUnitMobileContentAdsSettings `json:"mobileContentAdsSettings,omitempty"`
   514  	// Name: Name of this ad unit.
   515  	Name string `json:"name,omitempty"`
   516  	// Status: Status of this ad unit. Possible values are:
   517  	// NEW: Indicates that the ad unit was created within the last seven days and
   518  	// does not yet have any activity associated with it.
   519  	//
   520  	// ACTIVE: Indicates that there has been activity on this ad unit in the last
   521  	// seven days.
   522  	//
   523  	// INACTIVE: Indicates that there has been no activity on this ad unit in the
   524  	// last seven days.
   525  	Status string `json:"status,omitempty"`
   526  
   527  	// ServerResponse contains the HTTP response code and headers from the server.
   528  	googleapi.ServerResponse `json:"-"`
   529  	// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
   530  	// include in API requests. By default, fields with empty or default values are
   531  	// omitted from API requests. See
   532  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   533  	// details.
   534  	ForceSendFields []string `json:"-"`
   535  	// NullFields is a list of field names (e.g. "Code") to include in API requests
   536  	// with the JSON null value. By default, fields with empty values are omitted
   537  	// from API requests. See
   538  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   539  	NullFields []string `json:"-"`
   540  }
   541  
   542  func (s *AdUnit) MarshalJSON() ([]byte, error) {
   543  	type NoMethod AdUnit
   544  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   545  }
   546  
   547  // AdUnitContentAdsSettings: Settings specific to content ads (AFC) and highend
   548  // mobile content ads (AFMC - deprecated).
   549  type AdUnitContentAdsSettings struct {
   550  	// BackupOption: The backup option to be used in instances where no ad is
   551  	// available.
   552  	BackupOption *AdUnitContentAdsSettingsBackupOption `json:"backupOption,omitempty"`
   553  	// Size: Size of this ad unit. Size values are in the form
   554  	// SIZE_{width}_{height}.
   555  	Size string `json:"size,omitempty"`
   556  	// Type: Type of this ad unit. Possible values are TEXT, TEXT_IMAGE, IMAGE and
   557  	// LINK.
   558  	Type string `json:"type,omitempty"`
   559  	// ForceSendFields is a list of field names (e.g. "BackupOption") to
   560  	// unconditionally include in API requests. By default, fields with empty or
   561  	// default values are omitted from API requests. See
   562  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   563  	// details.
   564  	ForceSendFields []string `json:"-"`
   565  	// NullFields is a list of field names (e.g. "BackupOption") to include in API
   566  	// requests with the JSON null value. By default, fields with empty values are
   567  	// omitted from API requests. See
   568  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   569  	NullFields []string `json:"-"`
   570  }
   571  
   572  func (s *AdUnitContentAdsSettings) MarshalJSON() ([]byte, error) {
   573  	type NoMethod AdUnitContentAdsSettings
   574  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   575  }
   576  
   577  // AdUnitContentAdsSettingsBackupOption: The backup option to be used in
   578  // instances where no ad is available.
   579  type AdUnitContentAdsSettingsBackupOption struct {
   580  	// Color: Color to use when type is set to COLOR. These are represented as six
   581  	// hexadecimal characters, similar to HTML color codes, but without the leading
   582  	// hash.
   583  	Color string `json:"color,omitempty"`
   584  	// Type: Type of the backup option. Possible values are BLANK, COLOR and URL.
   585  	Type string `json:"type,omitempty"`
   586  	// Url: URL to use when type is set to URL.
   587  	Url string `json:"url,omitempty"`
   588  	// ForceSendFields is a list of field names (e.g. "Color") to unconditionally
   589  	// include in API requests. By default, fields with empty or default values are
   590  	// omitted from API requests. See
   591  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   592  	// details.
   593  	ForceSendFields []string `json:"-"`
   594  	// NullFields is a list of field names (e.g. "Color") to include in API
   595  	// requests with the JSON null value. By default, fields with empty values are
   596  	// omitted from API requests. See
   597  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   598  	NullFields []string `json:"-"`
   599  }
   600  
   601  func (s *AdUnitContentAdsSettingsBackupOption) MarshalJSON() ([]byte, error) {
   602  	type NoMethod AdUnitContentAdsSettingsBackupOption
   603  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   604  }
   605  
   606  // AdUnitMobileContentAdsSettings: Settings specific to WAP mobile content ads
   607  // (AFMC - deprecated).
   608  type AdUnitMobileContentAdsSettings struct {
   609  	// MarkupLanguage: The markup language to use for this ad unit.
   610  	MarkupLanguage string `json:"markupLanguage,omitempty"`
   611  	// ScriptingLanguage: The scripting language to use for this ad unit.
   612  	ScriptingLanguage string `json:"scriptingLanguage,omitempty"`
   613  	// Size: Size of this ad unit.
   614  	Size string `json:"size,omitempty"`
   615  	// Type: Type of this ad unit.
   616  	Type string `json:"type,omitempty"`
   617  	// ForceSendFields is a list of field names (e.g. "MarkupLanguage") to
   618  	// unconditionally include in API requests. By default, fields with empty or
   619  	// default values are omitted from API requests. See
   620  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   621  	// details.
   622  	ForceSendFields []string `json:"-"`
   623  	// NullFields is a list of field names (e.g. "MarkupLanguage") to include in
   624  	// API requests with the JSON null value. By default, fields with empty values
   625  	// are omitted from API requests. See
   626  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   627  	NullFields []string `json:"-"`
   628  }
   629  
   630  func (s *AdUnitMobileContentAdsSettings) MarshalJSON() ([]byte, error) {
   631  	type NoMethod AdUnitMobileContentAdsSettings
   632  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   633  }
   634  
   635  type AdUnits struct {
   636  	// Etag: ETag of this response for caching purposes.
   637  	Etag string `json:"etag,omitempty"`
   638  	// Items: The ad units returned in this list response.
   639  	Items []*AdUnit `json:"items,omitempty"`
   640  	// Kind: Kind of list this is, in this case adsensehost#adUnits.
   641  	Kind string `json:"kind,omitempty"`
   642  	// NextPageToken: Continuation token used to page through ad units. To retrieve
   643  	// the next page of results, set the next request's "pageToken" value to this.
   644  	NextPageToken string `json:"nextPageToken,omitempty"`
   645  
   646  	// ServerResponse contains the HTTP response code and headers from the server.
   647  	googleapi.ServerResponse `json:"-"`
   648  	// ForceSendFields is a list of field names (e.g. "Etag") to unconditionally
   649  	// include in API requests. By default, fields with empty or default values are
   650  	// omitted from API requests. See
   651  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   652  	// details.
   653  	ForceSendFields []string `json:"-"`
   654  	// NullFields is a list of field names (e.g. "Etag") to include in API requests
   655  	// with the JSON null value. By default, fields with empty values are omitted
   656  	// from API requests. See
   657  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   658  	NullFields []string `json:"-"`
   659  }
   660  
   661  func (s *AdUnits) MarshalJSON() ([]byte, error) {
   662  	type NoMethod AdUnits
   663  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   664  }
   665  
   666  type AssociationSession struct {
   667  	// AccountId: Hosted account id of the associated publisher after association.
   668  	// Present if status is ACCEPTED.
   669  	AccountId string `json:"accountId,omitempty"`
   670  	// Id: Unique identifier of this association session.
   671  	Id string `json:"id,omitempty"`
   672  	// Kind: Kind of resource this is, in this case adsensehost#associationSession.
   673  	Kind string `json:"kind,omitempty"`
   674  	// ProductCodes: The products to associate with the user. Options: AFC, AFG,
   675  	// AFV, AFS (deprecated), AFMC (deprecated)
   676  	ProductCodes []string `json:"productCodes,omitempty"`
   677  	// RedirectUrl: Redirect URL of this association session. Used to redirect
   678  	// users into the AdSense association flow.
   679  	RedirectUrl string `json:"redirectUrl,omitempty"`
   680  	// Status: Status of the completed association, available once the association
   681  	// callback token has been verified. One of ACCEPTED, REJECTED, or ERROR.
   682  	Status string `json:"status,omitempty"`
   683  	// UserLocale: The preferred locale of the user themselves when going through
   684  	// the AdSense association flow.
   685  	UserLocale string `json:"userLocale,omitempty"`
   686  	// WebsiteLocale: The locale of the user's hosted website.
   687  	WebsiteLocale string `json:"websiteLocale,omitempty"`
   688  	// WebsiteUrl: The URL of the user's hosted website.
   689  	WebsiteUrl string `json:"websiteUrl,omitempty"`
   690  
   691  	// ServerResponse contains the HTTP response code and headers from the server.
   692  	googleapi.ServerResponse `json:"-"`
   693  	// ForceSendFields is a list of field names (e.g. "AccountId") to
   694  	// unconditionally include in API requests. By default, fields with empty or
   695  	// default values are omitted from API requests. See
   696  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   697  	// details.
   698  	ForceSendFields []string `json:"-"`
   699  	// NullFields is a list of field names (e.g. "AccountId") to include in API
   700  	// requests with the JSON null value. By default, fields with empty values are
   701  	// omitted from API requests. See
   702  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   703  	NullFields []string `json:"-"`
   704  }
   705  
   706  func (s *AssociationSession) MarshalJSON() ([]byte, error) {
   707  	type NoMethod AssociationSession
   708  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   709  }
   710  
   711  type CustomChannel struct {
   712  	// Code: Code of this custom channel, not necessarily unique across ad clients.
   713  	Code string `json:"code,omitempty"`
   714  	// Id: Unique identifier of this custom channel. This should be considered an
   715  	// opaque identifier; it is not safe to rely on it being in any particular
   716  	// format.
   717  	Id string `json:"id,omitempty"`
   718  	// Kind: Kind of resource this is, in this case adsensehost#customChannel.
   719  	Kind string `json:"kind,omitempty"`
   720  	// Name: Name of this custom channel.
   721  	Name string `json:"name,omitempty"`
   722  
   723  	// ServerResponse contains the HTTP response code and headers from the server.
   724  	googleapi.ServerResponse `json:"-"`
   725  	// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
   726  	// include in API requests. By default, fields with empty or default values are
   727  	// omitted from API requests. See
   728  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   729  	// details.
   730  	ForceSendFields []string `json:"-"`
   731  	// NullFields is a list of field names (e.g. "Code") to include in API requests
   732  	// with the JSON null value. By default, fields with empty values are omitted
   733  	// from API requests. See
   734  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   735  	NullFields []string `json:"-"`
   736  }
   737  
   738  func (s *CustomChannel) MarshalJSON() ([]byte, error) {
   739  	type NoMethod CustomChannel
   740  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   741  }
   742  
   743  type CustomChannels struct {
   744  	// Etag: ETag of this response for caching purposes.
   745  	Etag string `json:"etag,omitempty"`
   746  	// Items: The custom channels returned in this list response.
   747  	Items []*CustomChannel `json:"items,omitempty"`
   748  	// Kind: Kind of list this is, in this case adsensehost#customChannels.
   749  	Kind string `json:"kind,omitempty"`
   750  	// NextPageToken: Continuation token used to page through custom channels. To
   751  	// retrieve the next page of results, set the next request's "pageToken" value
   752  	// to this.
   753  	NextPageToken string `json:"nextPageToken,omitempty"`
   754  
   755  	// ServerResponse contains the HTTP response code and headers from the server.
   756  	googleapi.ServerResponse `json:"-"`
   757  	// ForceSendFields is a list of field names (e.g. "Etag") to unconditionally
   758  	// include in API requests. By default, fields with empty or default values are
   759  	// omitted from API requests. See
   760  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   761  	// details.
   762  	ForceSendFields []string `json:"-"`
   763  	// NullFields is a list of field names (e.g. "Etag") to include in API requests
   764  	// with the JSON null value. By default, fields with empty values are omitted
   765  	// from API requests. See
   766  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   767  	NullFields []string `json:"-"`
   768  }
   769  
   770  func (s *CustomChannels) MarshalJSON() ([]byte, error) {
   771  	type NoMethod CustomChannels
   772  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   773  }
   774  
   775  type Report struct {
   776  	// Averages: The averages of the report. This is the same length as any other
   777  	// row in the report; cells corresponding to dimension columns are empty.
   778  	Averages []string `json:"averages,omitempty"`
   779  	// Headers: The header information of the columns requested in the report. This
   780  	// is a list of headers; one for each dimension in the request, followed by one
   781  	// for each metric in the request.
   782  	Headers []*ReportHeaders `json:"headers,omitempty"`
   783  	// Kind: Kind this is, in this case adsensehost#report.
   784  	Kind string `json:"kind,omitempty"`
   785  	// Rows: The output rows of the report. Each row is a list of cells; one for
   786  	// each dimension in the request, followed by one for each metric in the
   787  	// request. The dimension cells contain strings, and the metric cells contain
   788  	// numbers.
   789  	Rows [][]string `json:"rows,omitempty"`
   790  	// TotalMatchedRows: The total number of rows matched by the report request.
   791  	// Fewer rows may be returned in the response due to being limited by the row
   792  	// count requested or the report row limit.
   793  	TotalMatchedRows int64 `json:"totalMatchedRows,omitempty,string"`
   794  	// Totals: The totals of the report. This is the same length as any other row
   795  	// in the report; cells corresponding to dimension columns are empty.
   796  	Totals []string `json:"totals,omitempty"`
   797  	// Warnings: Any warnings associated with generation of the report.
   798  	Warnings []string `json:"warnings,omitempty"`
   799  
   800  	// ServerResponse contains the HTTP response code and headers from the server.
   801  	googleapi.ServerResponse `json:"-"`
   802  	// ForceSendFields is a list of field names (e.g. "Averages") to
   803  	// unconditionally include in API requests. By default, fields with empty or
   804  	// default values are omitted from API requests. See
   805  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   806  	// details.
   807  	ForceSendFields []string `json:"-"`
   808  	// NullFields is a list of field names (e.g. "Averages") to include in API
   809  	// requests with the JSON null value. By default, fields with empty values are
   810  	// omitted from API requests. See
   811  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   812  	NullFields []string `json:"-"`
   813  }
   814  
   815  func (s *Report) MarshalJSON() ([]byte, error) {
   816  	type NoMethod Report
   817  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   818  }
   819  
   820  type ReportHeaders struct {
   821  	// Currency: The currency of this column. Only present if the header type is
   822  	// METRIC_CURRENCY.
   823  	Currency string `json:"currency,omitempty"`
   824  	// Name: The name of the header.
   825  	Name string `json:"name,omitempty"`
   826  	// Type: The type of the header; one of DIMENSION, METRIC_TALLY, METRIC_RATIO,
   827  	// or METRIC_CURRENCY.
   828  	Type string `json:"type,omitempty"`
   829  	// ForceSendFields is a list of field names (e.g. "Currency") to
   830  	// unconditionally include in API requests. By default, fields with empty or
   831  	// default values are omitted from API requests. See
   832  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   833  	// details.
   834  	ForceSendFields []string `json:"-"`
   835  	// NullFields is a list of field names (e.g. "Currency") to include in API
   836  	// requests with the JSON null value. By default, fields with empty values are
   837  	// omitted from API requests. See
   838  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   839  	NullFields []string `json:"-"`
   840  }
   841  
   842  func (s *ReportHeaders) MarshalJSON() ([]byte, error) {
   843  	type NoMethod ReportHeaders
   844  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   845  }
   846  
   847  type UrlChannel struct {
   848  	// Id: Unique identifier of this URL channel. This should be considered an
   849  	// opaque identifier; it is not safe to rely on it being in any particular
   850  	// format.
   851  	Id string `json:"id,omitempty"`
   852  	// Kind: Kind of resource this is, in this case adsensehost#urlChannel.
   853  	Kind string `json:"kind,omitempty"`
   854  	// UrlPattern: URL Pattern of this URL channel. Does not include "http://" or
   855  	// "https://". Example: www.example.com/home
   856  	UrlPattern string `json:"urlPattern,omitempty"`
   857  
   858  	// ServerResponse contains the HTTP response code and headers from the server.
   859  	googleapi.ServerResponse `json:"-"`
   860  	// ForceSendFields is a list of field names (e.g. "Id") to unconditionally
   861  	// include in API requests. By default, fields with empty or default values are
   862  	// omitted from API requests. See
   863  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   864  	// details.
   865  	ForceSendFields []string `json:"-"`
   866  	// NullFields is a list of field names (e.g. "Id") to include in API requests
   867  	// with the JSON null value. By default, fields with empty values are omitted
   868  	// from API requests. See
   869  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   870  	NullFields []string `json:"-"`
   871  }
   872  
   873  func (s *UrlChannel) MarshalJSON() ([]byte, error) {
   874  	type NoMethod UrlChannel
   875  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   876  }
   877  
   878  type UrlChannels struct {
   879  	// Etag: ETag of this response for caching purposes.
   880  	Etag string `json:"etag,omitempty"`
   881  	// Items: The URL channels returned in this list response.
   882  	Items []*UrlChannel `json:"items,omitempty"`
   883  	// Kind: Kind of list this is, in this case adsensehost#urlChannels.
   884  	Kind string `json:"kind,omitempty"`
   885  	// NextPageToken: Continuation token used to page through URL channels. To
   886  	// retrieve the next page of results, set the next request's "pageToken" value
   887  	// to this.
   888  	NextPageToken string `json:"nextPageToken,omitempty"`
   889  
   890  	// ServerResponse contains the HTTP response code and headers from the server.
   891  	googleapi.ServerResponse `json:"-"`
   892  	// ForceSendFields is a list of field names (e.g. "Etag") to unconditionally
   893  	// include in API requests. By default, fields with empty or default values are
   894  	// omitted from API requests. See
   895  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   896  	// details.
   897  	ForceSendFields []string `json:"-"`
   898  	// NullFields is a list of field names (e.g. "Etag") to include in API requests
   899  	// with the JSON null value. By default, fields with empty values are omitted
   900  	// from API requests. See
   901  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   902  	NullFields []string `json:"-"`
   903  }
   904  
   905  func (s *UrlChannels) MarshalJSON() ([]byte, error) {
   906  	type NoMethod UrlChannels
   907  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   908  }
   909  
   910  type AccountsGetCall struct {
   911  	s            *Service
   912  	accountId    string
   913  	urlParams_   gensupport.URLParams
   914  	ifNoneMatch_ string
   915  	ctx_         context.Context
   916  	header_      http.Header
   917  }
   918  
   919  // Get: Get information about the selected associated AdSense account.
   920  //
   921  // - accountId: Account to get information about.
   922  func (r *AccountsService) Get(accountId string) *AccountsGetCall {
   923  	c := &AccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   924  	c.accountId = accountId
   925  	return c
   926  }
   927  
   928  // Fields allows partial responses to be retrieved. See
   929  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   930  // details.
   931  func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall {
   932  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   933  	return c
   934  }
   935  
   936  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   937  // object's ETag matches the given value. This is useful for getting updates
   938  // only after the object has changed since the last request.
   939  func (c *AccountsGetCall) IfNoneMatch(entityTag string) *AccountsGetCall {
   940  	c.ifNoneMatch_ = entityTag
   941  	return c
   942  }
   943  
   944  // Context sets the context to be used in this call's Do method.
   945  func (c *AccountsGetCall) Context(ctx context.Context) *AccountsGetCall {
   946  	c.ctx_ = ctx
   947  	return c
   948  }
   949  
   950  // Header returns a http.Header that can be modified by the caller to add
   951  // headers to the request.
   952  func (c *AccountsGetCall) Header() http.Header {
   953  	if c.header_ == nil {
   954  		c.header_ = make(http.Header)
   955  	}
   956  	return c.header_
   957  }
   958  
   959  func (c *AccountsGetCall) doRequest(alt string) (*http.Response, error) {
   960  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   961  	if c.ifNoneMatch_ != "" {
   962  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   963  	}
   964  	var body io.Reader = nil
   965  	c.urlParams_.Set("alt", alt)
   966  	c.urlParams_.Set("prettyPrint", "false")
   967  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}")
   968  	urls += "?" + c.urlParams_.Encode()
   969  	req, err := http.NewRequest("GET", urls, body)
   970  	if err != nil {
   971  		return nil, err
   972  	}
   973  	req.Header = reqHeaders
   974  	googleapi.Expand(req.URL, map[string]string{
   975  		"accountId": c.accountId,
   976  	})
   977  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   978  }
   979  
   980  // Do executes the "adsensehost.accounts.get" call.
   981  // Any non-2xx status code is an error. Response headers are in either
   982  // *Account.ServerResponse.Header or (if a response was returned at all) in
   983  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   984  // whether the returned error was because http.StatusNotModified was returned.
   985  func (c *AccountsGetCall) Do(opts ...googleapi.CallOption) (*Account, error) {
   986  	gensupport.SetOptions(c.urlParams_, opts...)
   987  	res, err := c.doRequest("json")
   988  	if res != nil && res.StatusCode == http.StatusNotModified {
   989  		if res.Body != nil {
   990  			res.Body.Close()
   991  		}
   992  		return nil, gensupport.WrapError(&googleapi.Error{
   993  			Code:   res.StatusCode,
   994  			Header: res.Header,
   995  		})
   996  	}
   997  	if err != nil {
   998  		return nil, err
   999  	}
  1000  	defer googleapi.CloseBody(res)
  1001  	if err := googleapi.CheckResponse(res); err != nil {
  1002  		return nil, gensupport.WrapError(err)
  1003  	}
  1004  	ret := &Account{
  1005  		ServerResponse: googleapi.ServerResponse{
  1006  			Header:         res.Header,
  1007  			HTTPStatusCode: res.StatusCode,
  1008  		},
  1009  	}
  1010  	target := &ret
  1011  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1012  		return nil, err
  1013  	}
  1014  	return ret, nil
  1015  }
  1016  
  1017  type AccountsListCall struct {
  1018  	s            *Service
  1019  	urlParams_   gensupport.URLParams
  1020  	ifNoneMatch_ string
  1021  	ctx_         context.Context
  1022  	header_      http.Header
  1023  }
  1024  
  1025  // List: List hosted accounts associated with this AdSense account by ad client
  1026  // id.
  1027  //
  1028  // - filterAdClientId: Ad clients to list accounts for.
  1029  func (r *AccountsService) List(filterAdClientId []string) *AccountsListCall {
  1030  	c := &AccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1031  	c.urlParams_.SetMulti("filterAdClientId", append([]string{}, filterAdClientId...))
  1032  	return c
  1033  }
  1034  
  1035  // Fields allows partial responses to be retrieved. See
  1036  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1037  // details.
  1038  func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall {
  1039  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1040  	return c
  1041  }
  1042  
  1043  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1044  // object's ETag matches the given value. This is useful for getting updates
  1045  // only after the object has changed since the last request.
  1046  func (c *AccountsListCall) IfNoneMatch(entityTag string) *AccountsListCall {
  1047  	c.ifNoneMatch_ = entityTag
  1048  	return c
  1049  }
  1050  
  1051  // Context sets the context to be used in this call's Do method.
  1052  func (c *AccountsListCall) Context(ctx context.Context) *AccountsListCall {
  1053  	c.ctx_ = ctx
  1054  	return c
  1055  }
  1056  
  1057  // Header returns a http.Header that can be modified by the caller to add
  1058  // headers to the request.
  1059  func (c *AccountsListCall) Header() http.Header {
  1060  	if c.header_ == nil {
  1061  		c.header_ = make(http.Header)
  1062  	}
  1063  	return c.header_
  1064  }
  1065  
  1066  func (c *AccountsListCall) doRequest(alt string) (*http.Response, error) {
  1067  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1068  	if c.ifNoneMatch_ != "" {
  1069  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1070  	}
  1071  	var body io.Reader = nil
  1072  	c.urlParams_.Set("alt", alt)
  1073  	c.urlParams_.Set("prettyPrint", "false")
  1074  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts")
  1075  	urls += "?" + c.urlParams_.Encode()
  1076  	req, err := http.NewRequest("GET", urls, body)
  1077  	if err != nil {
  1078  		return nil, err
  1079  	}
  1080  	req.Header = reqHeaders
  1081  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1082  }
  1083  
  1084  // Do executes the "adsensehost.accounts.list" call.
  1085  // Any non-2xx status code is an error. Response headers are in either
  1086  // *Accounts.ServerResponse.Header or (if a response was returned at all) in
  1087  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1088  // whether the returned error was because http.StatusNotModified was returned.
  1089  func (c *AccountsListCall) Do(opts ...googleapi.CallOption) (*Accounts, error) {
  1090  	gensupport.SetOptions(c.urlParams_, opts...)
  1091  	res, err := c.doRequest("json")
  1092  	if res != nil && res.StatusCode == http.StatusNotModified {
  1093  		if res.Body != nil {
  1094  			res.Body.Close()
  1095  		}
  1096  		return nil, gensupport.WrapError(&googleapi.Error{
  1097  			Code:   res.StatusCode,
  1098  			Header: res.Header,
  1099  		})
  1100  	}
  1101  	if err != nil {
  1102  		return nil, err
  1103  	}
  1104  	defer googleapi.CloseBody(res)
  1105  	if err := googleapi.CheckResponse(res); err != nil {
  1106  		return nil, gensupport.WrapError(err)
  1107  	}
  1108  	ret := &Accounts{
  1109  		ServerResponse: googleapi.ServerResponse{
  1110  			Header:         res.Header,
  1111  			HTTPStatusCode: res.StatusCode,
  1112  		},
  1113  	}
  1114  	target := &ret
  1115  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1116  		return nil, err
  1117  	}
  1118  	return ret, nil
  1119  }
  1120  
  1121  type AccountsAdclientsGetCall struct {
  1122  	s            *Service
  1123  	accountId    string
  1124  	adClientId   string
  1125  	urlParams_   gensupport.URLParams
  1126  	ifNoneMatch_ string
  1127  	ctx_         context.Context
  1128  	header_      http.Header
  1129  }
  1130  
  1131  // Get: Get information about one of the ad clients in the specified
  1132  // publisher's AdSense account.
  1133  //
  1134  // - accountId: Account which contains the ad client.
  1135  // - adClientId: Ad client to get.
  1136  func (r *AccountsAdclientsService) Get(accountId string, adClientId string) *AccountsAdclientsGetCall {
  1137  	c := &AccountsAdclientsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1138  	c.accountId = accountId
  1139  	c.adClientId = adClientId
  1140  	return c
  1141  }
  1142  
  1143  // Fields allows partial responses to be retrieved. See
  1144  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1145  // details.
  1146  func (c *AccountsAdclientsGetCall) Fields(s ...googleapi.Field) *AccountsAdclientsGetCall {
  1147  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1148  	return c
  1149  }
  1150  
  1151  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1152  // object's ETag matches the given value. This is useful for getting updates
  1153  // only after the object has changed since the last request.
  1154  func (c *AccountsAdclientsGetCall) IfNoneMatch(entityTag string) *AccountsAdclientsGetCall {
  1155  	c.ifNoneMatch_ = entityTag
  1156  	return c
  1157  }
  1158  
  1159  // Context sets the context to be used in this call's Do method.
  1160  func (c *AccountsAdclientsGetCall) Context(ctx context.Context) *AccountsAdclientsGetCall {
  1161  	c.ctx_ = ctx
  1162  	return c
  1163  }
  1164  
  1165  // Header returns a http.Header that can be modified by the caller to add
  1166  // headers to the request.
  1167  func (c *AccountsAdclientsGetCall) Header() http.Header {
  1168  	if c.header_ == nil {
  1169  		c.header_ = make(http.Header)
  1170  	}
  1171  	return c.header_
  1172  }
  1173  
  1174  func (c *AccountsAdclientsGetCall) doRequest(alt string) (*http.Response, error) {
  1175  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1176  	if c.ifNoneMatch_ != "" {
  1177  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1178  	}
  1179  	var body io.Reader = nil
  1180  	c.urlParams_.Set("alt", alt)
  1181  	c.urlParams_.Set("prettyPrint", "false")
  1182  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}")
  1183  	urls += "?" + c.urlParams_.Encode()
  1184  	req, err := http.NewRequest("GET", urls, body)
  1185  	if err != nil {
  1186  		return nil, err
  1187  	}
  1188  	req.Header = reqHeaders
  1189  	googleapi.Expand(req.URL, map[string]string{
  1190  		"accountId":  c.accountId,
  1191  		"adClientId": c.adClientId,
  1192  	})
  1193  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1194  }
  1195  
  1196  // Do executes the "adsensehost.accounts.adclients.get" call.
  1197  // Any non-2xx status code is an error. Response headers are in either
  1198  // *AdClient.ServerResponse.Header or (if a response was returned at all) in
  1199  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1200  // whether the returned error was because http.StatusNotModified was returned.
  1201  func (c *AccountsAdclientsGetCall) Do(opts ...googleapi.CallOption) (*AdClient, error) {
  1202  	gensupport.SetOptions(c.urlParams_, opts...)
  1203  	res, err := c.doRequest("json")
  1204  	if res != nil && res.StatusCode == http.StatusNotModified {
  1205  		if res.Body != nil {
  1206  			res.Body.Close()
  1207  		}
  1208  		return nil, gensupport.WrapError(&googleapi.Error{
  1209  			Code:   res.StatusCode,
  1210  			Header: res.Header,
  1211  		})
  1212  	}
  1213  	if err != nil {
  1214  		return nil, err
  1215  	}
  1216  	defer googleapi.CloseBody(res)
  1217  	if err := googleapi.CheckResponse(res); err != nil {
  1218  		return nil, gensupport.WrapError(err)
  1219  	}
  1220  	ret := &AdClient{
  1221  		ServerResponse: googleapi.ServerResponse{
  1222  			Header:         res.Header,
  1223  			HTTPStatusCode: res.StatusCode,
  1224  		},
  1225  	}
  1226  	target := &ret
  1227  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1228  		return nil, err
  1229  	}
  1230  	return ret, nil
  1231  }
  1232  
  1233  type AccountsAdclientsListCall struct {
  1234  	s            *Service
  1235  	accountId    string
  1236  	urlParams_   gensupport.URLParams
  1237  	ifNoneMatch_ string
  1238  	ctx_         context.Context
  1239  	header_      http.Header
  1240  }
  1241  
  1242  // List: List all hosted ad clients in the specified hosted account.
  1243  //
  1244  // - accountId: Account for which to list ad clients.
  1245  func (r *AccountsAdclientsService) List(accountId string) *AccountsAdclientsListCall {
  1246  	c := &AccountsAdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1247  	c.accountId = accountId
  1248  	return c
  1249  }
  1250  
  1251  // MaxResults sets the optional parameter "maxResults": The maximum number of
  1252  // ad clients to include in the response, used for paging.
  1253  func (c *AccountsAdclientsListCall) MaxResults(maxResults int64) *AccountsAdclientsListCall {
  1254  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1255  	return c
  1256  }
  1257  
  1258  // PageToken sets the optional parameter "pageToken": A continuation token,
  1259  // used to page through ad clients. To retrieve the next page, set this
  1260  // parameter to the value of "nextPageToken" from the previous response.
  1261  func (c *AccountsAdclientsListCall) PageToken(pageToken string) *AccountsAdclientsListCall {
  1262  	c.urlParams_.Set("pageToken", pageToken)
  1263  	return c
  1264  }
  1265  
  1266  // Fields allows partial responses to be retrieved. See
  1267  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1268  // details.
  1269  func (c *AccountsAdclientsListCall) Fields(s ...googleapi.Field) *AccountsAdclientsListCall {
  1270  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1271  	return c
  1272  }
  1273  
  1274  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1275  // object's ETag matches the given value. This is useful for getting updates
  1276  // only after the object has changed since the last request.
  1277  func (c *AccountsAdclientsListCall) IfNoneMatch(entityTag string) *AccountsAdclientsListCall {
  1278  	c.ifNoneMatch_ = entityTag
  1279  	return c
  1280  }
  1281  
  1282  // Context sets the context to be used in this call's Do method.
  1283  func (c *AccountsAdclientsListCall) Context(ctx context.Context) *AccountsAdclientsListCall {
  1284  	c.ctx_ = ctx
  1285  	return c
  1286  }
  1287  
  1288  // Header returns a http.Header that can be modified by the caller to add
  1289  // headers to the request.
  1290  func (c *AccountsAdclientsListCall) Header() http.Header {
  1291  	if c.header_ == nil {
  1292  		c.header_ = make(http.Header)
  1293  	}
  1294  	return c.header_
  1295  }
  1296  
  1297  func (c *AccountsAdclientsListCall) doRequest(alt string) (*http.Response, error) {
  1298  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1299  	if c.ifNoneMatch_ != "" {
  1300  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1301  	}
  1302  	var body io.Reader = nil
  1303  	c.urlParams_.Set("alt", alt)
  1304  	c.urlParams_.Set("prettyPrint", "false")
  1305  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients")
  1306  	urls += "?" + c.urlParams_.Encode()
  1307  	req, err := http.NewRequest("GET", urls, body)
  1308  	if err != nil {
  1309  		return nil, err
  1310  	}
  1311  	req.Header = reqHeaders
  1312  	googleapi.Expand(req.URL, map[string]string{
  1313  		"accountId": c.accountId,
  1314  	})
  1315  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1316  }
  1317  
  1318  // Do executes the "adsensehost.accounts.adclients.list" call.
  1319  // Any non-2xx status code is an error. Response headers are in either
  1320  // *AdClients.ServerResponse.Header or (if a response was returned at all) in
  1321  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1322  // whether the returned error was because http.StatusNotModified was returned.
  1323  func (c *AccountsAdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
  1324  	gensupport.SetOptions(c.urlParams_, opts...)
  1325  	res, err := c.doRequest("json")
  1326  	if res != nil && res.StatusCode == http.StatusNotModified {
  1327  		if res.Body != nil {
  1328  			res.Body.Close()
  1329  		}
  1330  		return nil, gensupport.WrapError(&googleapi.Error{
  1331  			Code:   res.StatusCode,
  1332  			Header: res.Header,
  1333  		})
  1334  	}
  1335  	if err != nil {
  1336  		return nil, err
  1337  	}
  1338  	defer googleapi.CloseBody(res)
  1339  	if err := googleapi.CheckResponse(res); err != nil {
  1340  		return nil, gensupport.WrapError(err)
  1341  	}
  1342  	ret := &AdClients{
  1343  		ServerResponse: googleapi.ServerResponse{
  1344  			Header:         res.Header,
  1345  			HTTPStatusCode: res.StatusCode,
  1346  		},
  1347  	}
  1348  	target := &ret
  1349  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1350  		return nil, err
  1351  	}
  1352  	return ret, nil
  1353  }
  1354  
  1355  // Pages invokes f for each page of results.
  1356  // A non-nil error returned from f will halt the iteration.
  1357  // The provided context supersedes any context provided to the Context method.
  1358  func (c *AccountsAdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
  1359  	c.ctx_ = ctx
  1360  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1361  	for {
  1362  		x, err := c.Do()
  1363  		if err != nil {
  1364  			return err
  1365  		}
  1366  		if err := f(x); err != nil {
  1367  			return err
  1368  		}
  1369  		if x.NextPageToken == "" {
  1370  			return nil
  1371  		}
  1372  		c.PageToken(x.NextPageToken)
  1373  	}
  1374  }
  1375  
  1376  type AccountsAdunitsDeleteCall struct {
  1377  	s          *Service
  1378  	accountId  string
  1379  	adClientId string
  1380  	adUnitId   string
  1381  	urlParams_ gensupport.URLParams
  1382  	ctx_       context.Context
  1383  	header_    http.Header
  1384  }
  1385  
  1386  // Delete: Delete the specified ad unit from the specified publisher AdSense
  1387  // account.
  1388  //
  1389  // - accountId: Account which contains the ad unit.
  1390  // - adClientId: Ad client for which to get ad unit.
  1391  // - adUnitId: Ad unit to delete.
  1392  func (r *AccountsAdunitsService) Delete(accountId string, adClientId string, adUnitId string) *AccountsAdunitsDeleteCall {
  1393  	c := &AccountsAdunitsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1394  	c.accountId = accountId
  1395  	c.adClientId = adClientId
  1396  	c.adUnitId = adUnitId
  1397  	return c
  1398  }
  1399  
  1400  // Fields allows partial responses to be retrieved. See
  1401  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1402  // details.
  1403  func (c *AccountsAdunitsDeleteCall) Fields(s ...googleapi.Field) *AccountsAdunitsDeleteCall {
  1404  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1405  	return c
  1406  }
  1407  
  1408  // Context sets the context to be used in this call's Do method.
  1409  func (c *AccountsAdunitsDeleteCall) Context(ctx context.Context) *AccountsAdunitsDeleteCall {
  1410  	c.ctx_ = ctx
  1411  	return c
  1412  }
  1413  
  1414  // Header returns a http.Header that can be modified by the caller to add
  1415  // headers to the request.
  1416  func (c *AccountsAdunitsDeleteCall) Header() http.Header {
  1417  	if c.header_ == nil {
  1418  		c.header_ = make(http.Header)
  1419  	}
  1420  	return c.header_
  1421  }
  1422  
  1423  func (c *AccountsAdunitsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1424  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1425  	var body io.Reader = nil
  1426  	c.urlParams_.Set("alt", alt)
  1427  	c.urlParams_.Set("prettyPrint", "false")
  1428  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}")
  1429  	urls += "?" + c.urlParams_.Encode()
  1430  	req, err := http.NewRequest("DELETE", urls, body)
  1431  	if err != nil {
  1432  		return nil, err
  1433  	}
  1434  	req.Header = reqHeaders
  1435  	googleapi.Expand(req.URL, map[string]string{
  1436  		"accountId":  c.accountId,
  1437  		"adClientId": c.adClientId,
  1438  		"adUnitId":   c.adUnitId,
  1439  	})
  1440  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1441  }
  1442  
  1443  // Do executes the "adsensehost.accounts.adunits.delete" call.
  1444  // Any non-2xx status code is an error. Response headers are in either
  1445  // *AdUnit.ServerResponse.Header or (if a response was returned at all) in
  1446  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1447  // whether the returned error was because http.StatusNotModified was returned.
  1448  func (c *AccountsAdunitsDeleteCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  1449  	gensupport.SetOptions(c.urlParams_, opts...)
  1450  	res, err := c.doRequest("json")
  1451  	if res != nil && res.StatusCode == http.StatusNotModified {
  1452  		if res.Body != nil {
  1453  			res.Body.Close()
  1454  		}
  1455  		return nil, gensupport.WrapError(&googleapi.Error{
  1456  			Code:   res.StatusCode,
  1457  			Header: res.Header,
  1458  		})
  1459  	}
  1460  	if err != nil {
  1461  		return nil, err
  1462  	}
  1463  	defer googleapi.CloseBody(res)
  1464  	if err := googleapi.CheckResponse(res); err != nil {
  1465  		return nil, gensupport.WrapError(err)
  1466  	}
  1467  	ret := &AdUnit{
  1468  		ServerResponse: googleapi.ServerResponse{
  1469  			Header:         res.Header,
  1470  			HTTPStatusCode: res.StatusCode,
  1471  		},
  1472  	}
  1473  	target := &ret
  1474  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1475  		return nil, err
  1476  	}
  1477  	return ret, nil
  1478  }
  1479  
  1480  type AccountsAdunitsGetCall struct {
  1481  	s            *Service
  1482  	accountId    string
  1483  	adClientId   string
  1484  	adUnitId     string
  1485  	urlParams_   gensupport.URLParams
  1486  	ifNoneMatch_ string
  1487  	ctx_         context.Context
  1488  	header_      http.Header
  1489  }
  1490  
  1491  // Get: Get the specified host ad unit in this AdSense account.
  1492  //
  1493  // - accountId: Account which contains the ad unit.
  1494  // - adClientId: Ad client for which to get ad unit.
  1495  // - adUnitId: Ad unit to get.
  1496  func (r *AccountsAdunitsService) Get(accountId string, adClientId string, adUnitId string) *AccountsAdunitsGetCall {
  1497  	c := &AccountsAdunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1498  	c.accountId = accountId
  1499  	c.adClientId = adClientId
  1500  	c.adUnitId = adUnitId
  1501  	return c
  1502  }
  1503  
  1504  // Fields allows partial responses to be retrieved. See
  1505  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1506  // details.
  1507  func (c *AccountsAdunitsGetCall) Fields(s ...googleapi.Field) *AccountsAdunitsGetCall {
  1508  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1509  	return c
  1510  }
  1511  
  1512  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1513  // object's ETag matches the given value. This is useful for getting updates
  1514  // only after the object has changed since the last request.
  1515  func (c *AccountsAdunitsGetCall) IfNoneMatch(entityTag string) *AccountsAdunitsGetCall {
  1516  	c.ifNoneMatch_ = entityTag
  1517  	return c
  1518  }
  1519  
  1520  // Context sets the context to be used in this call's Do method.
  1521  func (c *AccountsAdunitsGetCall) Context(ctx context.Context) *AccountsAdunitsGetCall {
  1522  	c.ctx_ = ctx
  1523  	return c
  1524  }
  1525  
  1526  // Header returns a http.Header that can be modified by the caller to add
  1527  // headers to the request.
  1528  func (c *AccountsAdunitsGetCall) Header() http.Header {
  1529  	if c.header_ == nil {
  1530  		c.header_ = make(http.Header)
  1531  	}
  1532  	return c.header_
  1533  }
  1534  
  1535  func (c *AccountsAdunitsGetCall) doRequest(alt string) (*http.Response, error) {
  1536  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1537  	if c.ifNoneMatch_ != "" {
  1538  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1539  	}
  1540  	var body io.Reader = nil
  1541  	c.urlParams_.Set("alt", alt)
  1542  	c.urlParams_.Set("prettyPrint", "false")
  1543  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}")
  1544  	urls += "?" + c.urlParams_.Encode()
  1545  	req, err := http.NewRequest("GET", urls, body)
  1546  	if err != nil {
  1547  		return nil, err
  1548  	}
  1549  	req.Header = reqHeaders
  1550  	googleapi.Expand(req.URL, map[string]string{
  1551  		"accountId":  c.accountId,
  1552  		"adClientId": c.adClientId,
  1553  		"adUnitId":   c.adUnitId,
  1554  	})
  1555  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1556  }
  1557  
  1558  // Do executes the "adsensehost.accounts.adunits.get" call.
  1559  // Any non-2xx status code is an error. Response headers are in either
  1560  // *AdUnit.ServerResponse.Header or (if a response was returned at all) in
  1561  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1562  // whether the returned error was because http.StatusNotModified was returned.
  1563  func (c *AccountsAdunitsGetCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  1564  	gensupport.SetOptions(c.urlParams_, opts...)
  1565  	res, err := c.doRequest("json")
  1566  	if res != nil && res.StatusCode == http.StatusNotModified {
  1567  		if res.Body != nil {
  1568  			res.Body.Close()
  1569  		}
  1570  		return nil, gensupport.WrapError(&googleapi.Error{
  1571  			Code:   res.StatusCode,
  1572  			Header: res.Header,
  1573  		})
  1574  	}
  1575  	if err != nil {
  1576  		return nil, err
  1577  	}
  1578  	defer googleapi.CloseBody(res)
  1579  	if err := googleapi.CheckResponse(res); err != nil {
  1580  		return nil, gensupport.WrapError(err)
  1581  	}
  1582  	ret := &AdUnit{
  1583  		ServerResponse: googleapi.ServerResponse{
  1584  			Header:         res.Header,
  1585  			HTTPStatusCode: res.StatusCode,
  1586  		},
  1587  	}
  1588  	target := &ret
  1589  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1590  		return nil, err
  1591  	}
  1592  	return ret, nil
  1593  }
  1594  
  1595  type AccountsAdunitsGetAdCodeCall struct {
  1596  	s            *Service
  1597  	accountId    string
  1598  	adClientId   string
  1599  	adUnitId     string
  1600  	urlParams_   gensupport.URLParams
  1601  	ifNoneMatch_ string
  1602  	ctx_         context.Context
  1603  	header_      http.Header
  1604  }
  1605  
  1606  // GetAdCode: Get ad code for the specified ad unit, attaching the specified
  1607  // host custom channels.
  1608  //
  1609  // - accountId: Account which contains the ad client.
  1610  // - adClientId: Ad client with contains the ad unit.
  1611  // - adUnitId: Ad unit to get the code for.
  1612  func (r *AccountsAdunitsService) GetAdCode(accountId string, adClientId string, adUnitId string) *AccountsAdunitsGetAdCodeCall {
  1613  	c := &AccountsAdunitsGetAdCodeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1614  	c.accountId = accountId
  1615  	c.adClientId = adClientId
  1616  	c.adUnitId = adUnitId
  1617  	return c
  1618  }
  1619  
  1620  // HostCustomChannelId sets the optional parameter "hostCustomChannelId": Host
  1621  // custom channel to attach to the ad code.
  1622  func (c *AccountsAdunitsGetAdCodeCall) HostCustomChannelId(hostCustomChannelId ...string) *AccountsAdunitsGetAdCodeCall {
  1623  	c.urlParams_.SetMulti("hostCustomChannelId", append([]string{}, hostCustomChannelId...))
  1624  	return c
  1625  }
  1626  
  1627  // Fields allows partial responses to be retrieved. See
  1628  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1629  // details.
  1630  func (c *AccountsAdunitsGetAdCodeCall) Fields(s ...googleapi.Field) *AccountsAdunitsGetAdCodeCall {
  1631  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1632  	return c
  1633  }
  1634  
  1635  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1636  // object's ETag matches the given value. This is useful for getting updates
  1637  // only after the object has changed since the last request.
  1638  func (c *AccountsAdunitsGetAdCodeCall) IfNoneMatch(entityTag string) *AccountsAdunitsGetAdCodeCall {
  1639  	c.ifNoneMatch_ = entityTag
  1640  	return c
  1641  }
  1642  
  1643  // Context sets the context to be used in this call's Do method.
  1644  func (c *AccountsAdunitsGetAdCodeCall) Context(ctx context.Context) *AccountsAdunitsGetAdCodeCall {
  1645  	c.ctx_ = ctx
  1646  	return c
  1647  }
  1648  
  1649  // Header returns a http.Header that can be modified by the caller to add
  1650  // headers to the request.
  1651  func (c *AccountsAdunitsGetAdCodeCall) Header() http.Header {
  1652  	if c.header_ == nil {
  1653  		c.header_ = make(http.Header)
  1654  	}
  1655  	return c.header_
  1656  }
  1657  
  1658  func (c *AccountsAdunitsGetAdCodeCall) doRequest(alt string) (*http.Response, error) {
  1659  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1660  	if c.ifNoneMatch_ != "" {
  1661  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1662  	}
  1663  	var body io.Reader = nil
  1664  	c.urlParams_.Set("alt", alt)
  1665  	c.urlParams_.Set("prettyPrint", "false")
  1666  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode")
  1667  	urls += "?" + c.urlParams_.Encode()
  1668  	req, err := http.NewRequest("GET", urls, body)
  1669  	if err != nil {
  1670  		return nil, err
  1671  	}
  1672  	req.Header = reqHeaders
  1673  	googleapi.Expand(req.URL, map[string]string{
  1674  		"accountId":  c.accountId,
  1675  		"adClientId": c.adClientId,
  1676  		"adUnitId":   c.adUnitId,
  1677  	})
  1678  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1679  }
  1680  
  1681  // Do executes the "adsensehost.accounts.adunits.getAdCode" call.
  1682  // Any non-2xx status code is an error. Response headers are in either
  1683  // *AdCode.ServerResponse.Header or (if a response was returned at all) in
  1684  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1685  // whether the returned error was because http.StatusNotModified was returned.
  1686  func (c *AccountsAdunitsGetAdCodeCall) Do(opts ...googleapi.CallOption) (*AdCode, error) {
  1687  	gensupport.SetOptions(c.urlParams_, opts...)
  1688  	res, err := c.doRequest("json")
  1689  	if res != nil && res.StatusCode == http.StatusNotModified {
  1690  		if res.Body != nil {
  1691  			res.Body.Close()
  1692  		}
  1693  		return nil, gensupport.WrapError(&googleapi.Error{
  1694  			Code:   res.StatusCode,
  1695  			Header: res.Header,
  1696  		})
  1697  	}
  1698  	if err != nil {
  1699  		return nil, err
  1700  	}
  1701  	defer googleapi.CloseBody(res)
  1702  	if err := googleapi.CheckResponse(res); err != nil {
  1703  		return nil, gensupport.WrapError(err)
  1704  	}
  1705  	ret := &AdCode{
  1706  		ServerResponse: googleapi.ServerResponse{
  1707  			Header:         res.Header,
  1708  			HTTPStatusCode: res.StatusCode,
  1709  		},
  1710  	}
  1711  	target := &ret
  1712  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1713  		return nil, err
  1714  	}
  1715  	return ret, nil
  1716  }
  1717  
  1718  type AccountsAdunitsInsertCall struct {
  1719  	s          *Service
  1720  	accountId  string
  1721  	adClientId string
  1722  	adunit     *AdUnit
  1723  	urlParams_ gensupport.URLParams
  1724  	ctx_       context.Context
  1725  	header_    http.Header
  1726  }
  1727  
  1728  // Insert: Insert the supplied ad unit into the specified publisher AdSense
  1729  // account.
  1730  //
  1731  // - accountId: Account which will contain the ad unit.
  1732  // - adClientId: Ad client into which to insert the ad unit.
  1733  func (r *AccountsAdunitsService) Insert(accountId string, adClientId string, adunit *AdUnit) *AccountsAdunitsInsertCall {
  1734  	c := &AccountsAdunitsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1735  	c.accountId = accountId
  1736  	c.adClientId = adClientId
  1737  	c.adunit = adunit
  1738  	return c
  1739  }
  1740  
  1741  // Fields allows partial responses to be retrieved. See
  1742  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1743  // details.
  1744  func (c *AccountsAdunitsInsertCall) Fields(s ...googleapi.Field) *AccountsAdunitsInsertCall {
  1745  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1746  	return c
  1747  }
  1748  
  1749  // Context sets the context to be used in this call's Do method.
  1750  func (c *AccountsAdunitsInsertCall) Context(ctx context.Context) *AccountsAdunitsInsertCall {
  1751  	c.ctx_ = ctx
  1752  	return c
  1753  }
  1754  
  1755  // Header returns a http.Header that can be modified by the caller to add
  1756  // headers to the request.
  1757  func (c *AccountsAdunitsInsertCall) Header() http.Header {
  1758  	if c.header_ == nil {
  1759  		c.header_ = make(http.Header)
  1760  	}
  1761  	return c.header_
  1762  }
  1763  
  1764  func (c *AccountsAdunitsInsertCall) doRequest(alt string) (*http.Response, error) {
  1765  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1766  	var body io.Reader = nil
  1767  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.adunit)
  1768  	if err != nil {
  1769  		return nil, err
  1770  	}
  1771  	c.urlParams_.Set("alt", alt)
  1772  	c.urlParams_.Set("prettyPrint", "false")
  1773  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
  1774  	urls += "?" + c.urlParams_.Encode()
  1775  	req, err := http.NewRequest("POST", urls, body)
  1776  	if err != nil {
  1777  		return nil, err
  1778  	}
  1779  	req.Header = reqHeaders
  1780  	googleapi.Expand(req.URL, map[string]string{
  1781  		"accountId":  c.accountId,
  1782  		"adClientId": c.adClientId,
  1783  	})
  1784  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1785  }
  1786  
  1787  // Do executes the "adsensehost.accounts.adunits.insert" call.
  1788  // Any non-2xx status code is an error. Response headers are in either
  1789  // *AdUnit.ServerResponse.Header or (if a response was returned at all) in
  1790  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1791  // whether the returned error was because http.StatusNotModified was returned.
  1792  func (c *AccountsAdunitsInsertCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  1793  	gensupport.SetOptions(c.urlParams_, opts...)
  1794  	res, err := c.doRequest("json")
  1795  	if res != nil && res.StatusCode == http.StatusNotModified {
  1796  		if res.Body != nil {
  1797  			res.Body.Close()
  1798  		}
  1799  		return nil, gensupport.WrapError(&googleapi.Error{
  1800  			Code:   res.StatusCode,
  1801  			Header: res.Header,
  1802  		})
  1803  	}
  1804  	if err != nil {
  1805  		return nil, err
  1806  	}
  1807  	defer googleapi.CloseBody(res)
  1808  	if err := googleapi.CheckResponse(res); err != nil {
  1809  		return nil, gensupport.WrapError(err)
  1810  	}
  1811  	ret := &AdUnit{
  1812  		ServerResponse: googleapi.ServerResponse{
  1813  			Header:         res.Header,
  1814  			HTTPStatusCode: res.StatusCode,
  1815  		},
  1816  	}
  1817  	target := &ret
  1818  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1819  		return nil, err
  1820  	}
  1821  	return ret, nil
  1822  }
  1823  
  1824  type AccountsAdunitsListCall struct {
  1825  	s            *Service
  1826  	accountId    string
  1827  	adClientId   string
  1828  	urlParams_   gensupport.URLParams
  1829  	ifNoneMatch_ string
  1830  	ctx_         context.Context
  1831  	header_      http.Header
  1832  }
  1833  
  1834  // List: List all ad units in the specified publisher's AdSense account.
  1835  //
  1836  // - accountId: Account which contains the ad client.
  1837  // - adClientId: Ad client for which to list ad units.
  1838  func (r *AccountsAdunitsService) List(accountId string, adClientId string) *AccountsAdunitsListCall {
  1839  	c := &AccountsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1840  	c.accountId = accountId
  1841  	c.adClientId = adClientId
  1842  	return c
  1843  }
  1844  
  1845  // IncludeInactive sets the optional parameter "includeInactive": Whether to
  1846  // include inactive ad units. Default: true.
  1847  func (c *AccountsAdunitsListCall) IncludeInactive(includeInactive bool) *AccountsAdunitsListCall {
  1848  	c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  1849  	return c
  1850  }
  1851  
  1852  // MaxResults sets the optional parameter "maxResults": The maximum number of
  1853  // ad units to include in the response, used for paging.
  1854  func (c *AccountsAdunitsListCall) MaxResults(maxResults int64) *AccountsAdunitsListCall {
  1855  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1856  	return c
  1857  }
  1858  
  1859  // PageToken sets the optional parameter "pageToken": A continuation token,
  1860  // used to page through ad units. To retrieve the next page, set this parameter
  1861  // to the value of "nextPageToken" from the previous response.
  1862  func (c *AccountsAdunitsListCall) PageToken(pageToken string) *AccountsAdunitsListCall {
  1863  	c.urlParams_.Set("pageToken", pageToken)
  1864  	return c
  1865  }
  1866  
  1867  // Fields allows partial responses to be retrieved. See
  1868  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1869  // details.
  1870  func (c *AccountsAdunitsListCall) Fields(s ...googleapi.Field) *AccountsAdunitsListCall {
  1871  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1872  	return c
  1873  }
  1874  
  1875  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1876  // object's ETag matches the given value. This is useful for getting updates
  1877  // only after the object has changed since the last request.
  1878  func (c *AccountsAdunitsListCall) IfNoneMatch(entityTag string) *AccountsAdunitsListCall {
  1879  	c.ifNoneMatch_ = entityTag
  1880  	return c
  1881  }
  1882  
  1883  // Context sets the context to be used in this call's Do method.
  1884  func (c *AccountsAdunitsListCall) Context(ctx context.Context) *AccountsAdunitsListCall {
  1885  	c.ctx_ = ctx
  1886  	return c
  1887  }
  1888  
  1889  // Header returns a http.Header that can be modified by the caller to add
  1890  // headers to the request.
  1891  func (c *AccountsAdunitsListCall) Header() http.Header {
  1892  	if c.header_ == nil {
  1893  		c.header_ = make(http.Header)
  1894  	}
  1895  	return c.header_
  1896  }
  1897  
  1898  func (c *AccountsAdunitsListCall) doRequest(alt string) (*http.Response, error) {
  1899  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1900  	if c.ifNoneMatch_ != "" {
  1901  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1902  	}
  1903  	var body io.Reader = nil
  1904  	c.urlParams_.Set("alt", alt)
  1905  	c.urlParams_.Set("prettyPrint", "false")
  1906  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
  1907  	urls += "?" + c.urlParams_.Encode()
  1908  	req, err := http.NewRequest("GET", urls, body)
  1909  	if err != nil {
  1910  		return nil, err
  1911  	}
  1912  	req.Header = reqHeaders
  1913  	googleapi.Expand(req.URL, map[string]string{
  1914  		"accountId":  c.accountId,
  1915  		"adClientId": c.adClientId,
  1916  	})
  1917  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1918  }
  1919  
  1920  // Do executes the "adsensehost.accounts.adunits.list" call.
  1921  // Any non-2xx status code is an error. Response headers are in either
  1922  // *AdUnits.ServerResponse.Header or (if a response was returned at all) in
  1923  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1924  // whether the returned error was because http.StatusNotModified was returned.
  1925  func (c *AccountsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  1926  	gensupport.SetOptions(c.urlParams_, opts...)
  1927  	res, err := c.doRequest("json")
  1928  	if res != nil && res.StatusCode == http.StatusNotModified {
  1929  		if res.Body != nil {
  1930  			res.Body.Close()
  1931  		}
  1932  		return nil, gensupport.WrapError(&googleapi.Error{
  1933  			Code:   res.StatusCode,
  1934  			Header: res.Header,
  1935  		})
  1936  	}
  1937  	if err != nil {
  1938  		return nil, err
  1939  	}
  1940  	defer googleapi.CloseBody(res)
  1941  	if err := googleapi.CheckResponse(res); err != nil {
  1942  		return nil, gensupport.WrapError(err)
  1943  	}
  1944  	ret := &AdUnits{
  1945  		ServerResponse: googleapi.ServerResponse{
  1946  			Header:         res.Header,
  1947  			HTTPStatusCode: res.StatusCode,
  1948  		},
  1949  	}
  1950  	target := &ret
  1951  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1952  		return nil, err
  1953  	}
  1954  	return ret, nil
  1955  }
  1956  
  1957  // Pages invokes f for each page of results.
  1958  // A non-nil error returned from f will halt the iteration.
  1959  // The provided context supersedes any context provided to the Context method.
  1960  func (c *AccountsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  1961  	c.ctx_ = ctx
  1962  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1963  	for {
  1964  		x, err := c.Do()
  1965  		if err != nil {
  1966  			return err
  1967  		}
  1968  		if err := f(x); err != nil {
  1969  			return err
  1970  		}
  1971  		if x.NextPageToken == "" {
  1972  			return nil
  1973  		}
  1974  		c.PageToken(x.NextPageToken)
  1975  	}
  1976  }
  1977  
  1978  type AccountsAdunitsPatchCall struct {
  1979  	s          *Service
  1980  	accountId  string
  1981  	adClientId string
  1982  	adunit     *AdUnit
  1983  	urlParams_ gensupport.URLParams
  1984  	ctx_       context.Context
  1985  	header_    http.Header
  1986  }
  1987  
  1988  // Patch: Update the supplied ad unit in the specified publisher AdSense
  1989  // account. This method supports patch semantics.
  1990  //
  1991  // - accountId: Account which contains the ad client.
  1992  // - adClientId: Ad client which contains the ad unit.
  1993  // - adUnitId: Ad unit to get.
  1994  func (r *AccountsAdunitsService) Patch(accountId string, adClientId string, adUnitId string, adunit *AdUnit) *AccountsAdunitsPatchCall {
  1995  	c := &AccountsAdunitsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1996  	c.accountId = accountId
  1997  	c.adClientId = adClientId
  1998  	c.urlParams_.Set("adUnitId", adUnitId)
  1999  	c.adunit = adunit
  2000  	return c
  2001  }
  2002  
  2003  // Fields allows partial responses to be retrieved. See
  2004  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2005  // details.
  2006  func (c *AccountsAdunitsPatchCall) Fields(s ...googleapi.Field) *AccountsAdunitsPatchCall {
  2007  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2008  	return c
  2009  }
  2010  
  2011  // Context sets the context to be used in this call's Do method.
  2012  func (c *AccountsAdunitsPatchCall) Context(ctx context.Context) *AccountsAdunitsPatchCall {
  2013  	c.ctx_ = ctx
  2014  	return c
  2015  }
  2016  
  2017  // Header returns a http.Header that can be modified by the caller to add
  2018  // headers to the request.
  2019  func (c *AccountsAdunitsPatchCall) Header() http.Header {
  2020  	if c.header_ == nil {
  2021  		c.header_ = make(http.Header)
  2022  	}
  2023  	return c.header_
  2024  }
  2025  
  2026  func (c *AccountsAdunitsPatchCall) doRequest(alt string) (*http.Response, error) {
  2027  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2028  	var body io.Reader = nil
  2029  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.adunit)
  2030  	if err != nil {
  2031  		return nil, err
  2032  	}
  2033  	c.urlParams_.Set("alt", alt)
  2034  	c.urlParams_.Set("prettyPrint", "false")
  2035  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
  2036  	urls += "?" + c.urlParams_.Encode()
  2037  	req, err := http.NewRequest("PATCH", urls, body)
  2038  	if err != nil {
  2039  		return nil, err
  2040  	}
  2041  	req.Header = reqHeaders
  2042  	googleapi.Expand(req.URL, map[string]string{
  2043  		"accountId":  c.accountId,
  2044  		"adClientId": c.adClientId,
  2045  	})
  2046  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2047  }
  2048  
  2049  // Do executes the "adsensehost.accounts.adunits.patch" call.
  2050  // Any non-2xx status code is an error. Response headers are in either
  2051  // *AdUnit.ServerResponse.Header or (if a response was returned at all) in
  2052  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2053  // whether the returned error was because http.StatusNotModified was returned.
  2054  func (c *AccountsAdunitsPatchCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  2055  	gensupport.SetOptions(c.urlParams_, opts...)
  2056  	res, err := c.doRequest("json")
  2057  	if res != nil && res.StatusCode == http.StatusNotModified {
  2058  		if res.Body != nil {
  2059  			res.Body.Close()
  2060  		}
  2061  		return nil, gensupport.WrapError(&googleapi.Error{
  2062  			Code:   res.StatusCode,
  2063  			Header: res.Header,
  2064  		})
  2065  	}
  2066  	if err != nil {
  2067  		return nil, err
  2068  	}
  2069  	defer googleapi.CloseBody(res)
  2070  	if err := googleapi.CheckResponse(res); err != nil {
  2071  		return nil, gensupport.WrapError(err)
  2072  	}
  2073  	ret := &AdUnit{
  2074  		ServerResponse: googleapi.ServerResponse{
  2075  			Header:         res.Header,
  2076  			HTTPStatusCode: res.StatusCode,
  2077  		},
  2078  	}
  2079  	target := &ret
  2080  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2081  		return nil, err
  2082  	}
  2083  	return ret, nil
  2084  }
  2085  
  2086  type AccountsAdunitsUpdateCall struct {
  2087  	s          *Service
  2088  	accountId  string
  2089  	adClientId string
  2090  	adunit     *AdUnit
  2091  	urlParams_ gensupport.URLParams
  2092  	ctx_       context.Context
  2093  	header_    http.Header
  2094  }
  2095  
  2096  // Update: Update the supplied ad unit in the specified publisher AdSense
  2097  // account.
  2098  //
  2099  // - accountId: Account which contains the ad client.
  2100  // - adClientId: Ad client which contains the ad unit.
  2101  func (r *AccountsAdunitsService) Update(accountId string, adClientId string, adunit *AdUnit) *AccountsAdunitsUpdateCall {
  2102  	c := &AccountsAdunitsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2103  	c.accountId = accountId
  2104  	c.adClientId = adClientId
  2105  	c.adunit = adunit
  2106  	return c
  2107  }
  2108  
  2109  // Fields allows partial responses to be retrieved. See
  2110  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2111  // details.
  2112  func (c *AccountsAdunitsUpdateCall) Fields(s ...googleapi.Field) *AccountsAdunitsUpdateCall {
  2113  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2114  	return c
  2115  }
  2116  
  2117  // Context sets the context to be used in this call's Do method.
  2118  func (c *AccountsAdunitsUpdateCall) Context(ctx context.Context) *AccountsAdunitsUpdateCall {
  2119  	c.ctx_ = ctx
  2120  	return c
  2121  }
  2122  
  2123  // Header returns a http.Header that can be modified by the caller to add
  2124  // headers to the request.
  2125  func (c *AccountsAdunitsUpdateCall) Header() http.Header {
  2126  	if c.header_ == nil {
  2127  		c.header_ = make(http.Header)
  2128  	}
  2129  	return c.header_
  2130  }
  2131  
  2132  func (c *AccountsAdunitsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2133  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2134  	var body io.Reader = nil
  2135  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.adunit)
  2136  	if err != nil {
  2137  		return nil, err
  2138  	}
  2139  	c.urlParams_.Set("alt", alt)
  2140  	c.urlParams_.Set("prettyPrint", "false")
  2141  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
  2142  	urls += "?" + c.urlParams_.Encode()
  2143  	req, err := http.NewRequest("PUT", urls, body)
  2144  	if err != nil {
  2145  		return nil, err
  2146  	}
  2147  	req.Header = reqHeaders
  2148  	googleapi.Expand(req.URL, map[string]string{
  2149  		"accountId":  c.accountId,
  2150  		"adClientId": c.adClientId,
  2151  	})
  2152  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2153  }
  2154  
  2155  // Do executes the "adsensehost.accounts.adunits.update" call.
  2156  // Any non-2xx status code is an error. Response headers are in either
  2157  // *AdUnit.ServerResponse.Header or (if a response was returned at all) in
  2158  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2159  // whether the returned error was because http.StatusNotModified was returned.
  2160  func (c *AccountsAdunitsUpdateCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  2161  	gensupport.SetOptions(c.urlParams_, opts...)
  2162  	res, err := c.doRequest("json")
  2163  	if res != nil && res.StatusCode == http.StatusNotModified {
  2164  		if res.Body != nil {
  2165  			res.Body.Close()
  2166  		}
  2167  		return nil, gensupport.WrapError(&googleapi.Error{
  2168  			Code:   res.StatusCode,
  2169  			Header: res.Header,
  2170  		})
  2171  	}
  2172  	if err != nil {
  2173  		return nil, err
  2174  	}
  2175  	defer googleapi.CloseBody(res)
  2176  	if err := googleapi.CheckResponse(res); err != nil {
  2177  		return nil, gensupport.WrapError(err)
  2178  	}
  2179  	ret := &AdUnit{
  2180  		ServerResponse: googleapi.ServerResponse{
  2181  			Header:         res.Header,
  2182  			HTTPStatusCode: res.StatusCode,
  2183  		},
  2184  	}
  2185  	target := &ret
  2186  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2187  		return nil, err
  2188  	}
  2189  	return ret, nil
  2190  }
  2191  
  2192  type AccountsReportsGenerateCall struct {
  2193  	s            *Service
  2194  	accountId    string
  2195  	urlParams_   gensupport.URLParams
  2196  	ifNoneMatch_ string
  2197  	ctx_         context.Context
  2198  	header_      http.Header
  2199  }
  2200  
  2201  // Generate: Generate an AdSense report based on the report request sent in the
  2202  // query parameters. Returns the result as JSON; to retrieve output in CSV
  2203  // format specify "alt=csv" as a query parameter.
  2204  //
  2205  //   - accountId: Hosted account upon which to report.
  2206  //   - endDate: End of the date range to report on in "YYYY-MM-DD" format,
  2207  //     inclusive.
  2208  //   - startDate: Start of the date range to report on in "YYYY-MM-DD" format,
  2209  //     inclusive.
  2210  func (r *AccountsReportsService) Generate(accountId string, startDate string, endDate string) *AccountsReportsGenerateCall {
  2211  	c := &AccountsReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2212  	c.accountId = accountId
  2213  	c.urlParams_.Set("startDate", startDate)
  2214  	c.urlParams_.Set("endDate", endDate)
  2215  	return c
  2216  }
  2217  
  2218  // Dimension sets the optional parameter "dimension": Dimensions to base the
  2219  // report on.
  2220  func (c *AccountsReportsGenerateCall) Dimension(dimension ...string) *AccountsReportsGenerateCall {
  2221  	c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
  2222  	return c
  2223  }
  2224  
  2225  // Filter sets the optional parameter "filter": Filters to be run on the
  2226  // report.
  2227  func (c *AccountsReportsGenerateCall) Filter(filter ...string) *AccountsReportsGenerateCall {
  2228  	c.urlParams_.SetMulti("filter", append([]string{}, filter...))
  2229  	return c
  2230  }
  2231  
  2232  // Locale sets the optional parameter "locale": Optional locale to use for
  2233  // translating report output to a local language. Defaults to "en_US" if not
  2234  // specified.
  2235  func (c *AccountsReportsGenerateCall) Locale(locale string) *AccountsReportsGenerateCall {
  2236  	c.urlParams_.Set("locale", locale)
  2237  	return c
  2238  }
  2239  
  2240  // MaxResults sets the optional parameter "maxResults": The maximum number of
  2241  // rows of report data to return.
  2242  func (c *AccountsReportsGenerateCall) MaxResults(maxResults int64) *AccountsReportsGenerateCall {
  2243  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2244  	return c
  2245  }
  2246  
  2247  // Metric sets the optional parameter "metric": Numeric columns to include in
  2248  // the report.
  2249  func (c *AccountsReportsGenerateCall) Metric(metric ...string) *AccountsReportsGenerateCall {
  2250  	c.urlParams_.SetMulti("metric", append([]string{}, metric...))
  2251  	return c
  2252  }
  2253  
  2254  // Sort sets the optional parameter "sort": The name of a dimension or metric
  2255  // to sort the resulting report on, optionally prefixed with "+" to sort
  2256  // ascending or "-" to sort descending. If no prefix is specified, the column
  2257  // is sorted ascending.
  2258  func (c *AccountsReportsGenerateCall) Sort(sort ...string) *AccountsReportsGenerateCall {
  2259  	c.urlParams_.SetMulti("sort", append([]string{}, sort...))
  2260  	return c
  2261  }
  2262  
  2263  // StartIndex sets the optional parameter "startIndex": Index of the first row
  2264  // of report data to return.
  2265  func (c *AccountsReportsGenerateCall) StartIndex(startIndex int64) *AccountsReportsGenerateCall {
  2266  	c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  2267  	return c
  2268  }
  2269  
  2270  // Fields allows partial responses to be retrieved. See
  2271  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2272  // details.
  2273  func (c *AccountsReportsGenerateCall) Fields(s ...googleapi.Field) *AccountsReportsGenerateCall {
  2274  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2275  	return c
  2276  }
  2277  
  2278  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2279  // object's ETag matches the given value. This is useful for getting updates
  2280  // only after the object has changed since the last request.
  2281  func (c *AccountsReportsGenerateCall) IfNoneMatch(entityTag string) *AccountsReportsGenerateCall {
  2282  	c.ifNoneMatch_ = entityTag
  2283  	return c
  2284  }
  2285  
  2286  // Context sets the context to be used in this call's Do method.
  2287  func (c *AccountsReportsGenerateCall) Context(ctx context.Context) *AccountsReportsGenerateCall {
  2288  	c.ctx_ = ctx
  2289  	return c
  2290  }
  2291  
  2292  // Header returns a http.Header that can be modified by the caller to add
  2293  // headers to the request.
  2294  func (c *AccountsReportsGenerateCall) Header() http.Header {
  2295  	if c.header_ == nil {
  2296  		c.header_ = make(http.Header)
  2297  	}
  2298  	return c.header_
  2299  }
  2300  
  2301  func (c *AccountsReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
  2302  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2303  	if c.ifNoneMatch_ != "" {
  2304  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2305  	}
  2306  	var body io.Reader = nil
  2307  	c.urlParams_.Set("alt", alt)
  2308  	c.urlParams_.Set("prettyPrint", "false")
  2309  	urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/reports")
  2310  	urls += "?" + c.urlParams_.Encode()
  2311  	req, err := http.NewRequest("GET", urls, body)
  2312  	if err != nil {
  2313  		return nil, err
  2314  	}
  2315  	req.Header = reqHeaders
  2316  	googleapi.Expand(req.URL, map[string]string{
  2317  		"accountId": c.accountId,
  2318  	})
  2319  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2320  }
  2321  
  2322  // Do executes the "adsensehost.accounts.reports.generate" call.
  2323  // Any non-2xx status code is an error. Response headers are in either
  2324  // *Report.ServerResponse.Header or (if a response was returned at all) in
  2325  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2326  // whether the returned error was because http.StatusNotModified was returned.
  2327  func (c *AccountsReportsGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) {
  2328  	gensupport.SetOptions(c.urlParams_, opts...)
  2329  	res, err := c.doRequest("json")
  2330  	if res != nil && res.StatusCode == http.StatusNotModified {
  2331  		if res.Body != nil {
  2332  			res.Body.Close()
  2333  		}
  2334  		return nil, gensupport.WrapError(&googleapi.Error{
  2335  			Code:   res.StatusCode,
  2336  			Header: res.Header,
  2337  		})
  2338  	}
  2339  	if err != nil {
  2340  		return nil, err
  2341  	}
  2342  	defer googleapi.CloseBody(res)
  2343  	if err := googleapi.CheckResponse(res); err != nil {
  2344  		return nil, gensupport.WrapError(err)
  2345  	}
  2346  	ret := &Report{
  2347  		ServerResponse: googleapi.ServerResponse{
  2348  			Header:         res.Header,
  2349  			HTTPStatusCode: res.StatusCode,
  2350  		},
  2351  	}
  2352  	target := &ret
  2353  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2354  		return nil, err
  2355  	}
  2356  	return ret, nil
  2357  }
  2358  
  2359  type AdclientsGetCall struct {
  2360  	s            *Service
  2361  	adClientId   string
  2362  	urlParams_   gensupport.URLParams
  2363  	ifNoneMatch_ string
  2364  	ctx_         context.Context
  2365  	header_      http.Header
  2366  }
  2367  
  2368  // Get: Get information about one of the ad clients in the Host AdSense
  2369  // account.
  2370  //
  2371  // - adClientId: Ad client to get.
  2372  func (r *AdclientsService) Get(adClientId string) *AdclientsGetCall {
  2373  	c := &AdclientsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2374  	c.adClientId = adClientId
  2375  	return c
  2376  }
  2377  
  2378  // Fields allows partial responses to be retrieved. See
  2379  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2380  // details.
  2381  func (c *AdclientsGetCall) Fields(s ...googleapi.Field) *AdclientsGetCall {
  2382  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2383  	return c
  2384  }
  2385  
  2386  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2387  // object's ETag matches the given value. This is useful for getting updates
  2388  // only after the object has changed since the last request.
  2389  func (c *AdclientsGetCall) IfNoneMatch(entityTag string) *AdclientsGetCall {
  2390  	c.ifNoneMatch_ = entityTag
  2391  	return c
  2392  }
  2393  
  2394  // Context sets the context to be used in this call's Do method.
  2395  func (c *AdclientsGetCall) Context(ctx context.Context) *AdclientsGetCall {
  2396  	c.ctx_ = ctx
  2397  	return c
  2398  }
  2399  
  2400  // Header returns a http.Header that can be modified by the caller to add
  2401  // headers to the request.
  2402  func (c *AdclientsGetCall) Header() http.Header {
  2403  	if c.header_ == nil {
  2404  		c.header_ = make(http.Header)
  2405  	}
  2406  	return c.header_
  2407  }
  2408  
  2409  func (c *AdclientsGetCall) doRequest(alt string) (*http.Response, error) {
  2410  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2411  	if c.ifNoneMatch_ != "" {
  2412  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2413  	}
  2414  	var body io.Reader = nil
  2415  	c.urlParams_.Set("alt", alt)
  2416  	c.urlParams_.Set("prettyPrint", "false")
  2417  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}")
  2418  	urls += "?" + c.urlParams_.Encode()
  2419  	req, err := http.NewRequest("GET", urls, body)
  2420  	if err != nil {
  2421  		return nil, err
  2422  	}
  2423  	req.Header = reqHeaders
  2424  	googleapi.Expand(req.URL, map[string]string{
  2425  		"adClientId": c.adClientId,
  2426  	})
  2427  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2428  }
  2429  
  2430  // Do executes the "adsensehost.adclients.get" call.
  2431  // Any non-2xx status code is an error. Response headers are in either
  2432  // *AdClient.ServerResponse.Header or (if a response was returned at all) in
  2433  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2434  // whether the returned error was because http.StatusNotModified was returned.
  2435  func (c *AdclientsGetCall) Do(opts ...googleapi.CallOption) (*AdClient, error) {
  2436  	gensupport.SetOptions(c.urlParams_, opts...)
  2437  	res, err := c.doRequest("json")
  2438  	if res != nil && res.StatusCode == http.StatusNotModified {
  2439  		if res.Body != nil {
  2440  			res.Body.Close()
  2441  		}
  2442  		return nil, gensupport.WrapError(&googleapi.Error{
  2443  			Code:   res.StatusCode,
  2444  			Header: res.Header,
  2445  		})
  2446  	}
  2447  	if err != nil {
  2448  		return nil, err
  2449  	}
  2450  	defer googleapi.CloseBody(res)
  2451  	if err := googleapi.CheckResponse(res); err != nil {
  2452  		return nil, gensupport.WrapError(err)
  2453  	}
  2454  	ret := &AdClient{
  2455  		ServerResponse: googleapi.ServerResponse{
  2456  			Header:         res.Header,
  2457  			HTTPStatusCode: res.StatusCode,
  2458  		},
  2459  	}
  2460  	target := &ret
  2461  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2462  		return nil, err
  2463  	}
  2464  	return ret, nil
  2465  }
  2466  
  2467  type AdclientsListCall struct {
  2468  	s            *Service
  2469  	urlParams_   gensupport.URLParams
  2470  	ifNoneMatch_ string
  2471  	ctx_         context.Context
  2472  	header_      http.Header
  2473  }
  2474  
  2475  // List: List all host ad clients in this AdSense account.
  2476  func (r *AdclientsService) List() *AdclientsListCall {
  2477  	c := &AdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2478  	return c
  2479  }
  2480  
  2481  // MaxResults sets the optional parameter "maxResults": The maximum number of
  2482  // ad clients to include in the response, used for paging.
  2483  func (c *AdclientsListCall) MaxResults(maxResults int64) *AdclientsListCall {
  2484  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2485  	return c
  2486  }
  2487  
  2488  // PageToken sets the optional parameter "pageToken": A continuation token,
  2489  // used to page through ad clients. To retrieve the next page, set this
  2490  // parameter to the value of "nextPageToken" from the previous response.
  2491  func (c *AdclientsListCall) PageToken(pageToken string) *AdclientsListCall {
  2492  	c.urlParams_.Set("pageToken", pageToken)
  2493  	return c
  2494  }
  2495  
  2496  // Fields allows partial responses to be retrieved. See
  2497  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2498  // details.
  2499  func (c *AdclientsListCall) Fields(s ...googleapi.Field) *AdclientsListCall {
  2500  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2501  	return c
  2502  }
  2503  
  2504  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2505  // object's ETag matches the given value. This is useful for getting updates
  2506  // only after the object has changed since the last request.
  2507  func (c *AdclientsListCall) IfNoneMatch(entityTag string) *AdclientsListCall {
  2508  	c.ifNoneMatch_ = entityTag
  2509  	return c
  2510  }
  2511  
  2512  // Context sets the context to be used in this call's Do method.
  2513  func (c *AdclientsListCall) Context(ctx context.Context) *AdclientsListCall {
  2514  	c.ctx_ = ctx
  2515  	return c
  2516  }
  2517  
  2518  // Header returns a http.Header that can be modified by the caller to add
  2519  // headers to the request.
  2520  func (c *AdclientsListCall) Header() http.Header {
  2521  	if c.header_ == nil {
  2522  		c.header_ = make(http.Header)
  2523  	}
  2524  	return c.header_
  2525  }
  2526  
  2527  func (c *AdclientsListCall) doRequest(alt string) (*http.Response, error) {
  2528  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2529  	if c.ifNoneMatch_ != "" {
  2530  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2531  	}
  2532  	var body io.Reader = nil
  2533  	c.urlParams_.Set("alt", alt)
  2534  	c.urlParams_.Set("prettyPrint", "false")
  2535  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients")
  2536  	urls += "?" + c.urlParams_.Encode()
  2537  	req, err := http.NewRequest("GET", urls, body)
  2538  	if err != nil {
  2539  		return nil, err
  2540  	}
  2541  	req.Header = reqHeaders
  2542  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2543  }
  2544  
  2545  // Do executes the "adsensehost.adclients.list" call.
  2546  // Any non-2xx status code is an error. Response headers are in either
  2547  // *AdClients.ServerResponse.Header or (if a response was returned at all) in
  2548  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2549  // whether the returned error was because http.StatusNotModified was returned.
  2550  func (c *AdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
  2551  	gensupport.SetOptions(c.urlParams_, opts...)
  2552  	res, err := c.doRequest("json")
  2553  	if res != nil && res.StatusCode == http.StatusNotModified {
  2554  		if res.Body != nil {
  2555  			res.Body.Close()
  2556  		}
  2557  		return nil, gensupport.WrapError(&googleapi.Error{
  2558  			Code:   res.StatusCode,
  2559  			Header: res.Header,
  2560  		})
  2561  	}
  2562  	if err != nil {
  2563  		return nil, err
  2564  	}
  2565  	defer googleapi.CloseBody(res)
  2566  	if err := googleapi.CheckResponse(res); err != nil {
  2567  		return nil, gensupport.WrapError(err)
  2568  	}
  2569  	ret := &AdClients{
  2570  		ServerResponse: googleapi.ServerResponse{
  2571  			Header:         res.Header,
  2572  			HTTPStatusCode: res.StatusCode,
  2573  		},
  2574  	}
  2575  	target := &ret
  2576  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2577  		return nil, err
  2578  	}
  2579  	return ret, nil
  2580  }
  2581  
  2582  // Pages invokes f for each page of results.
  2583  // A non-nil error returned from f will halt the iteration.
  2584  // The provided context supersedes any context provided to the Context method.
  2585  func (c *AdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
  2586  	c.ctx_ = ctx
  2587  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  2588  	for {
  2589  		x, err := c.Do()
  2590  		if err != nil {
  2591  			return err
  2592  		}
  2593  		if err := f(x); err != nil {
  2594  			return err
  2595  		}
  2596  		if x.NextPageToken == "" {
  2597  			return nil
  2598  		}
  2599  		c.PageToken(x.NextPageToken)
  2600  	}
  2601  }
  2602  
  2603  type AssociationsessionsStartCall struct {
  2604  	s            *Service
  2605  	urlParams_   gensupport.URLParams
  2606  	ifNoneMatch_ string
  2607  	ctx_         context.Context
  2608  	header_      http.Header
  2609  }
  2610  
  2611  // Start: Create an association session for initiating an association with an
  2612  // AdSense user.
  2613  //
  2614  // - productCode: Products to associate with the user.
  2615  // - websiteUrl: The URL of the user's hosted website.
  2616  func (r *AssociationsessionsService) Start(productCode []string, websiteUrl string) *AssociationsessionsStartCall {
  2617  	c := &AssociationsessionsStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2618  	c.urlParams_.SetMulti("productCode", append([]string{}, productCode...))
  2619  	c.urlParams_.Set("websiteUrl", websiteUrl)
  2620  	return c
  2621  }
  2622  
  2623  // CallbackUrl sets the optional parameter "callbackUrl": The URL to redirect
  2624  // the user to once association is completed. It receives a token parameter
  2625  // that can then be used to retrieve the associated account.
  2626  func (c *AssociationsessionsStartCall) CallbackUrl(callbackUrl string) *AssociationsessionsStartCall {
  2627  	c.urlParams_.Set("callbackUrl", callbackUrl)
  2628  	return c
  2629  }
  2630  
  2631  // UserLocale sets the optional parameter "userLocale": The preferred locale of
  2632  // the user.
  2633  func (c *AssociationsessionsStartCall) UserLocale(userLocale string) *AssociationsessionsStartCall {
  2634  	c.urlParams_.Set("userLocale", userLocale)
  2635  	return c
  2636  }
  2637  
  2638  // WebsiteLocale sets the optional parameter "websiteLocale": The locale of the
  2639  // user's hosted website.
  2640  func (c *AssociationsessionsStartCall) WebsiteLocale(websiteLocale string) *AssociationsessionsStartCall {
  2641  	c.urlParams_.Set("websiteLocale", websiteLocale)
  2642  	return c
  2643  }
  2644  
  2645  // Fields allows partial responses to be retrieved. See
  2646  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2647  // details.
  2648  func (c *AssociationsessionsStartCall) Fields(s ...googleapi.Field) *AssociationsessionsStartCall {
  2649  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2650  	return c
  2651  }
  2652  
  2653  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2654  // object's ETag matches the given value. This is useful for getting updates
  2655  // only after the object has changed since the last request.
  2656  func (c *AssociationsessionsStartCall) IfNoneMatch(entityTag string) *AssociationsessionsStartCall {
  2657  	c.ifNoneMatch_ = entityTag
  2658  	return c
  2659  }
  2660  
  2661  // Context sets the context to be used in this call's Do method.
  2662  func (c *AssociationsessionsStartCall) Context(ctx context.Context) *AssociationsessionsStartCall {
  2663  	c.ctx_ = ctx
  2664  	return c
  2665  }
  2666  
  2667  // Header returns a http.Header that can be modified by the caller to add
  2668  // headers to the request.
  2669  func (c *AssociationsessionsStartCall) Header() http.Header {
  2670  	if c.header_ == nil {
  2671  		c.header_ = make(http.Header)
  2672  	}
  2673  	return c.header_
  2674  }
  2675  
  2676  func (c *AssociationsessionsStartCall) doRequest(alt string) (*http.Response, error) {
  2677  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2678  	if c.ifNoneMatch_ != "" {
  2679  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2680  	}
  2681  	var body io.Reader = nil
  2682  	c.urlParams_.Set("alt", alt)
  2683  	c.urlParams_.Set("prettyPrint", "false")
  2684  	urls := googleapi.ResolveRelative(c.s.BasePath, "associationsessions/start")
  2685  	urls += "?" + c.urlParams_.Encode()
  2686  	req, err := http.NewRequest("GET", urls, body)
  2687  	if err != nil {
  2688  		return nil, err
  2689  	}
  2690  	req.Header = reqHeaders
  2691  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2692  }
  2693  
  2694  // Do executes the "adsensehost.associationsessions.start" call.
  2695  // Any non-2xx status code is an error. Response headers are in either
  2696  // *AssociationSession.ServerResponse.Header or (if a response was returned at
  2697  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2698  // check whether the returned error was because http.StatusNotModified was
  2699  // returned.
  2700  func (c *AssociationsessionsStartCall) Do(opts ...googleapi.CallOption) (*AssociationSession, error) {
  2701  	gensupport.SetOptions(c.urlParams_, opts...)
  2702  	res, err := c.doRequest("json")
  2703  	if res != nil && res.StatusCode == http.StatusNotModified {
  2704  		if res.Body != nil {
  2705  			res.Body.Close()
  2706  		}
  2707  		return nil, gensupport.WrapError(&googleapi.Error{
  2708  			Code:   res.StatusCode,
  2709  			Header: res.Header,
  2710  		})
  2711  	}
  2712  	if err != nil {
  2713  		return nil, err
  2714  	}
  2715  	defer googleapi.CloseBody(res)
  2716  	if err := googleapi.CheckResponse(res); err != nil {
  2717  		return nil, gensupport.WrapError(err)
  2718  	}
  2719  	ret := &AssociationSession{
  2720  		ServerResponse: googleapi.ServerResponse{
  2721  			Header:         res.Header,
  2722  			HTTPStatusCode: res.StatusCode,
  2723  		},
  2724  	}
  2725  	target := &ret
  2726  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2727  		return nil, err
  2728  	}
  2729  	return ret, nil
  2730  }
  2731  
  2732  type AssociationsessionsVerifyCall struct {
  2733  	s            *Service
  2734  	urlParams_   gensupport.URLParams
  2735  	ifNoneMatch_ string
  2736  	ctx_         context.Context
  2737  	header_      http.Header
  2738  }
  2739  
  2740  // Verify: Verify an association session after the association callback returns
  2741  // from AdSense signup.
  2742  //
  2743  // - token: The token returned to the association callback URL.
  2744  func (r *AssociationsessionsService) Verify(token string) *AssociationsessionsVerifyCall {
  2745  	c := &AssociationsessionsVerifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2746  	c.urlParams_.Set("token", token)
  2747  	return c
  2748  }
  2749  
  2750  // Fields allows partial responses to be retrieved. See
  2751  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2752  // details.
  2753  func (c *AssociationsessionsVerifyCall) Fields(s ...googleapi.Field) *AssociationsessionsVerifyCall {
  2754  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2755  	return c
  2756  }
  2757  
  2758  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2759  // object's ETag matches the given value. This is useful for getting updates
  2760  // only after the object has changed since the last request.
  2761  func (c *AssociationsessionsVerifyCall) IfNoneMatch(entityTag string) *AssociationsessionsVerifyCall {
  2762  	c.ifNoneMatch_ = entityTag
  2763  	return c
  2764  }
  2765  
  2766  // Context sets the context to be used in this call's Do method.
  2767  func (c *AssociationsessionsVerifyCall) Context(ctx context.Context) *AssociationsessionsVerifyCall {
  2768  	c.ctx_ = ctx
  2769  	return c
  2770  }
  2771  
  2772  // Header returns a http.Header that can be modified by the caller to add
  2773  // headers to the request.
  2774  func (c *AssociationsessionsVerifyCall) Header() http.Header {
  2775  	if c.header_ == nil {
  2776  		c.header_ = make(http.Header)
  2777  	}
  2778  	return c.header_
  2779  }
  2780  
  2781  func (c *AssociationsessionsVerifyCall) doRequest(alt string) (*http.Response, error) {
  2782  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2783  	if c.ifNoneMatch_ != "" {
  2784  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2785  	}
  2786  	var body io.Reader = nil
  2787  	c.urlParams_.Set("alt", alt)
  2788  	c.urlParams_.Set("prettyPrint", "false")
  2789  	urls := googleapi.ResolveRelative(c.s.BasePath, "associationsessions/verify")
  2790  	urls += "?" + c.urlParams_.Encode()
  2791  	req, err := http.NewRequest("GET", urls, body)
  2792  	if err != nil {
  2793  		return nil, err
  2794  	}
  2795  	req.Header = reqHeaders
  2796  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2797  }
  2798  
  2799  // Do executes the "adsensehost.associationsessions.verify" call.
  2800  // Any non-2xx status code is an error. Response headers are in either
  2801  // *AssociationSession.ServerResponse.Header or (if a response was returned at
  2802  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2803  // check whether the returned error was because http.StatusNotModified was
  2804  // returned.
  2805  func (c *AssociationsessionsVerifyCall) Do(opts ...googleapi.CallOption) (*AssociationSession, error) {
  2806  	gensupport.SetOptions(c.urlParams_, opts...)
  2807  	res, err := c.doRequest("json")
  2808  	if res != nil && res.StatusCode == http.StatusNotModified {
  2809  		if res.Body != nil {
  2810  			res.Body.Close()
  2811  		}
  2812  		return nil, gensupport.WrapError(&googleapi.Error{
  2813  			Code:   res.StatusCode,
  2814  			Header: res.Header,
  2815  		})
  2816  	}
  2817  	if err != nil {
  2818  		return nil, err
  2819  	}
  2820  	defer googleapi.CloseBody(res)
  2821  	if err := googleapi.CheckResponse(res); err != nil {
  2822  		return nil, gensupport.WrapError(err)
  2823  	}
  2824  	ret := &AssociationSession{
  2825  		ServerResponse: googleapi.ServerResponse{
  2826  			Header:         res.Header,
  2827  			HTTPStatusCode: res.StatusCode,
  2828  		},
  2829  	}
  2830  	target := &ret
  2831  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2832  		return nil, err
  2833  	}
  2834  	return ret, nil
  2835  }
  2836  
  2837  type CustomchannelsDeleteCall struct {
  2838  	s               *Service
  2839  	adClientId      string
  2840  	customChannelId string
  2841  	urlParams_      gensupport.URLParams
  2842  	ctx_            context.Context
  2843  	header_         http.Header
  2844  }
  2845  
  2846  // Delete: Delete a specific custom channel from the host AdSense account.
  2847  //
  2848  // - adClientId: Ad client from which to delete the custom channel.
  2849  // - customChannelId: Custom channel to delete.
  2850  func (r *CustomchannelsService) Delete(adClientId string, customChannelId string) *CustomchannelsDeleteCall {
  2851  	c := &CustomchannelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2852  	c.adClientId = adClientId
  2853  	c.customChannelId = customChannelId
  2854  	return c
  2855  }
  2856  
  2857  // Fields allows partial responses to be retrieved. See
  2858  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2859  // details.
  2860  func (c *CustomchannelsDeleteCall) Fields(s ...googleapi.Field) *CustomchannelsDeleteCall {
  2861  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2862  	return c
  2863  }
  2864  
  2865  // Context sets the context to be used in this call's Do method.
  2866  func (c *CustomchannelsDeleteCall) Context(ctx context.Context) *CustomchannelsDeleteCall {
  2867  	c.ctx_ = ctx
  2868  	return c
  2869  }
  2870  
  2871  // Header returns a http.Header that can be modified by the caller to add
  2872  // headers to the request.
  2873  func (c *CustomchannelsDeleteCall) Header() http.Header {
  2874  	if c.header_ == nil {
  2875  		c.header_ = make(http.Header)
  2876  	}
  2877  	return c.header_
  2878  }
  2879  
  2880  func (c *CustomchannelsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2881  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2882  	var body io.Reader = nil
  2883  	c.urlParams_.Set("alt", alt)
  2884  	c.urlParams_.Set("prettyPrint", "false")
  2885  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}")
  2886  	urls += "?" + c.urlParams_.Encode()
  2887  	req, err := http.NewRequest("DELETE", urls, body)
  2888  	if err != nil {
  2889  		return nil, err
  2890  	}
  2891  	req.Header = reqHeaders
  2892  	googleapi.Expand(req.URL, map[string]string{
  2893  		"adClientId":      c.adClientId,
  2894  		"customChannelId": c.customChannelId,
  2895  	})
  2896  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2897  }
  2898  
  2899  // Do executes the "adsensehost.customchannels.delete" call.
  2900  // Any non-2xx status code is an error. Response headers are in either
  2901  // *CustomChannel.ServerResponse.Header or (if a response was returned at all)
  2902  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2903  // whether the returned error was because http.StatusNotModified was returned.
  2904  func (c *CustomchannelsDeleteCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  2905  	gensupport.SetOptions(c.urlParams_, opts...)
  2906  	res, err := c.doRequest("json")
  2907  	if res != nil && res.StatusCode == http.StatusNotModified {
  2908  		if res.Body != nil {
  2909  			res.Body.Close()
  2910  		}
  2911  		return nil, gensupport.WrapError(&googleapi.Error{
  2912  			Code:   res.StatusCode,
  2913  			Header: res.Header,
  2914  		})
  2915  	}
  2916  	if err != nil {
  2917  		return nil, err
  2918  	}
  2919  	defer googleapi.CloseBody(res)
  2920  	if err := googleapi.CheckResponse(res); err != nil {
  2921  		return nil, gensupport.WrapError(err)
  2922  	}
  2923  	ret := &CustomChannel{
  2924  		ServerResponse: googleapi.ServerResponse{
  2925  			Header:         res.Header,
  2926  			HTTPStatusCode: res.StatusCode,
  2927  		},
  2928  	}
  2929  	target := &ret
  2930  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2931  		return nil, err
  2932  	}
  2933  	return ret, nil
  2934  }
  2935  
  2936  type CustomchannelsGetCall struct {
  2937  	s               *Service
  2938  	adClientId      string
  2939  	customChannelId string
  2940  	urlParams_      gensupport.URLParams
  2941  	ifNoneMatch_    string
  2942  	ctx_            context.Context
  2943  	header_         http.Header
  2944  }
  2945  
  2946  // Get: Get a specific custom channel from the host AdSense account.
  2947  //
  2948  // - adClientId: Ad client from which to get the custom channel.
  2949  // - customChannelId: Custom channel to get.
  2950  func (r *CustomchannelsService) Get(adClientId string, customChannelId string) *CustomchannelsGetCall {
  2951  	c := &CustomchannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2952  	c.adClientId = adClientId
  2953  	c.customChannelId = customChannelId
  2954  	return c
  2955  }
  2956  
  2957  // Fields allows partial responses to be retrieved. See
  2958  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2959  // details.
  2960  func (c *CustomchannelsGetCall) Fields(s ...googleapi.Field) *CustomchannelsGetCall {
  2961  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2962  	return c
  2963  }
  2964  
  2965  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2966  // object's ETag matches the given value. This is useful for getting updates
  2967  // only after the object has changed since the last request.
  2968  func (c *CustomchannelsGetCall) IfNoneMatch(entityTag string) *CustomchannelsGetCall {
  2969  	c.ifNoneMatch_ = entityTag
  2970  	return c
  2971  }
  2972  
  2973  // Context sets the context to be used in this call's Do method.
  2974  func (c *CustomchannelsGetCall) Context(ctx context.Context) *CustomchannelsGetCall {
  2975  	c.ctx_ = ctx
  2976  	return c
  2977  }
  2978  
  2979  // Header returns a http.Header that can be modified by the caller to add
  2980  // headers to the request.
  2981  func (c *CustomchannelsGetCall) Header() http.Header {
  2982  	if c.header_ == nil {
  2983  		c.header_ = make(http.Header)
  2984  	}
  2985  	return c.header_
  2986  }
  2987  
  2988  func (c *CustomchannelsGetCall) doRequest(alt string) (*http.Response, error) {
  2989  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2990  	if c.ifNoneMatch_ != "" {
  2991  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2992  	}
  2993  	var body io.Reader = nil
  2994  	c.urlParams_.Set("alt", alt)
  2995  	c.urlParams_.Set("prettyPrint", "false")
  2996  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}")
  2997  	urls += "?" + c.urlParams_.Encode()
  2998  	req, err := http.NewRequest("GET", urls, body)
  2999  	if err != nil {
  3000  		return nil, err
  3001  	}
  3002  	req.Header = reqHeaders
  3003  	googleapi.Expand(req.URL, map[string]string{
  3004  		"adClientId":      c.adClientId,
  3005  		"customChannelId": c.customChannelId,
  3006  	})
  3007  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3008  }
  3009  
  3010  // Do executes the "adsensehost.customchannels.get" call.
  3011  // Any non-2xx status code is an error. Response headers are in either
  3012  // *CustomChannel.ServerResponse.Header or (if a response was returned at all)
  3013  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3014  // whether the returned error was because http.StatusNotModified was returned.
  3015  func (c *CustomchannelsGetCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  3016  	gensupport.SetOptions(c.urlParams_, opts...)
  3017  	res, err := c.doRequest("json")
  3018  	if res != nil && res.StatusCode == http.StatusNotModified {
  3019  		if res.Body != nil {
  3020  			res.Body.Close()
  3021  		}
  3022  		return nil, gensupport.WrapError(&googleapi.Error{
  3023  			Code:   res.StatusCode,
  3024  			Header: res.Header,
  3025  		})
  3026  	}
  3027  	if err != nil {
  3028  		return nil, err
  3029  	}
  3030  	defer googleapi.CloseBody(res)
  3031  	if err := googleapi.CheckResponse(res); err != nil {
  3032  		return nil, gensupport.WrapError(err)
  3033  	}
  3034  	ret := &CustomChannel{
  3035  		ServerResponse: googleapi.ServerResponse{
  3036  			Header:         res.Header,
  3037  			HTTPStatusCode: res.StatusCode,
  3038  		},
  3039  	}
  3040  	target := &ret
  3041  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3042  		return nil, err
  3043  	}
  3044  	return ret, nil
  3045  }
  3046  
  3047  type CustomchannelsInsertCall struct {
  3048  	s             *Service
  3049  	adClientId    string
  3050  	customchannel *CustomChannel
  3051  	urlParams_    gensupport.URLParams
  3052  	ctx_          context.Context
  3053  	header_       http.Header
  3054  }
  3055  
  3056  // Insert: Add a new custom channel to the host AdSense account.
  3057  //
  3058  // - adClientId: Ad client to which the new custom channel will be added.
  3059  func (r *CustomchannelsService) Insert(adClientId string, customchannel *CustomChannel) *CustomchannelsInsertCall {
  3060  	c := &CustomchannelsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3061  	c.adClientId = adClientId
  3062  	c.customchannel = customchannel
  3063  	return c
  3064  }
  3065  
  3066  // Fields allows partial responses to be retrieved. See
  3067  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3068  // details.
  3069  func (c *CustomchannelsInsertCall) Fields(s ...googleapi.Field) *CustomchannelsInsertCall {
  3070  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3071  	return c
  3072  }
  3073  
  3074  // Context sets the context to be used in this call's Do method.
  3075  func (c *CustomchannelsInsertCall) Context(ctx context.Context) *CustomchannelsInsertCall {
  3076  	c.ctx_ = ctx
  3077  	return c
  3078  }
  3079  
  3080  // Header returns a http.Header that can be modified by the caller to add
  3081  // headers to the request.
  3082  func (c *CustomchannelsInsertCall) Header() http.Header {
  3083  	if c.header_ == nil {
  3084  		c.header_ = make(http.Header)
  3085  	}
  3086  	return c.header_
  3087  }
  3088  
  3089  func (c *CustomchannelsInsertCall) doRequest(alt string) (*http.Response, error) {
  3090  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3091  	var body io.Reader = nil
  3092  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.customchannel)
  3093  	if err != nil {
  3094  		return nil, err
  3095  	}
  3096  	c.urlParams_.Set("alt", alt)
  3097  	c.urlParams_.Set("prettyPrint", "false")
  3098  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  3099  	urls += "?" + c.urlParams_.Encode()
  3100  	req, err := http.NewRequest("POST", urls, body)
  3101  	if err != nil {
  3102  		return nil, err
  3103  	}
  3104  	req.Header = reqHeaders
  3105  	googleapi.Expand(req.URL, map[string]string{
  3106  		"adClientId": c.adClientId,
  3107  	})
  3108  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3109  }
  3110  
  3111  // Do executes the "adsensehost.customchannels.insert" call.
  3112  // Any non-2xx status code is an error. Response headers are in either
  3113  // *CustomChannel.ServerResponse.Header or (if a response was returned at all)
  3114  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3115  // whether the returned error was because http.StatusNotModified was returned.
  3116  func (c *CustomchannelsInsertCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  3117  	gensupport.SetOptions(c.urlParams_, opts...)
  3118  	res, err := c.doRequest("json")
  3119  	if res != nil && res.StatusCode == http.StatusNotModified {
  3120  		if res.Body != nil {
  3121  			res.Body.Close()
  3122  		}
  3123  		return nil, gensupport.WrapError(&googleapi.Error{
  3124  			Code:   res.StatusCode,
  3125  			Header: res.Header,
  3126  		})
  3127  	}
  3128  	if err != nil {
  3129  		return nil, err
  3130  	}
  3131  	defer googleapi.CloseBody(res)
  3132  	if err := googleapi.CheckResponse(res); err != nil {
  3133  		return nil, gensupport.WrapError(err)
  3134  	}
  3135  	ret := &CustomChannel{
  3136  		ServerResponse: googleapi.ServerResponse{
  3137  			Header:         res.Header,
  3138  			HTTPStatusCode: res.StatusCode,
  3139  		},
  3140  	}
  3141  	target := &ret
  3142  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3143  		return nil, err
  3144  	}
  3145  	return ret, nil
  3146  }
  3147  
  3148  type CustomchannelsListCall struct {
  3149  	s            *Service
  3150  	adClientId   string
  3151  	urlParams_   gensupport.URLParams
  3152  	ifNoneMatch_ string
  3153  	ctx_         context.Context
  3154  	header_      http.Header
  3155  }
  3156  
  3157  // List: List all host custom channels in this AdSense account.
  3158  //
  3159  // - adClientId: Ad client for which to list custom channels.
  3160  func (r *CustomchannelsService) List(adClientId string) *CustomchannelsListCall {
  3161  	c := &CustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3162  	c.adClientId = adClientId
  3163  	return c
  3164  }
  3165  
  3166  // MaxResults sets the optional parameter "maxResults": The maximum number of
  3167  // custom channels to include in the response, used for paging.
  3168  func (c *CustomchannelsListCall) MaxResults(maxResults int64) *CustomchannelsListCall {
  3169  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3170  	return c
  3171  }
  3172  
  3173  // PageToken sets the optional parameter "pageToken": A continuation token,
  3174  // used to page through custom channels. To retrieve the next page, set this
  3175  // parameter to the value of "nextPageToken" from the previous response.
  3176  func (c *CustomchannelsListCall) PageToken(pageToken string) *CustomchannelsListCall {
  3177  	c.urlParams_.Set("pageToken", pageToken)
  3178  	return c
  3179  }
  3180  
  3181  // Fields allows partial responses to be retrieved. See
  3182  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3183  // details.
  3184  func (c *CustomchannelsListCall) Fields(s ...googleapi.Field) *CustomchannelsListCall {
  3185  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3186  	return c
  3187  }
  3188  
  3189  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  3190  // object's ETag matches the given value. This is useful for getting updates
  3191  // only after the object has changed since the last request.
  3192  func (c *CustomchannelsListCall) IfNoneMatch(entityTag string) *CustomchannelsListCall {
  3193  	c.ifNoneMatch_ = entityTag
  3194  	return c
  3195  }
  3196  
  3197  // Context sets the context to be used in this call's Do method.
  3198  func (c *CustomchannelsListCall) Context(ctx context.Context) *CustomchannelsListCall {
  3199  	c.ctx_ = ctx
  3200  	return c
  3201  }
  3202  
  3203  // Header returns a http.Header that can be modified by the caller to add
  3204  // headers to the request.
  3205  func (c *CustomchannelsListCall) Header() http.Header {
  3206  	if c.header_ == nil {
  3207  		c.header_ = make(http.Header)
  3208  	}
  3209  	return c.header_
  3210  }
  3211  
  3212  func (c *CustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  3213  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3214  	if c.ifNoneMatch_ != "" {
  3215  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3216  	}
  3217  	var body io.Reader = nil
  3218  	c.urlParams_.Set("alt", alt)
  3219  	c.urlParams_.Set("prettyPrint", "false")
  3220  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  3221  	urls += "?" + c.urlParams_.Encode()
  3222  	req, err := http.NewRequest("GET", urls, body)
  3223  	if err != nil {
  3224  		return nil, err
  3225  	}
  3226  	req.Header = reqHeaders
  3227  	googleapi.Expand(req.URL, map[string]string{
  3228  		"adClientId": c.adClientId,
  3229  	})
  3230  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3231  }
  3232  
  3233  // Do executes the "adsensehost.customchannels.list" call.
  3234  // Any non-2xx status code is an error. Response headers are in either
  3235  // *CustomChannels.ServerResponse.Header or (if a response was returned at all)
  3236  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3237  // whether the returned error was because http.StatusNotModified was returned.
  3238  func (c *CustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  3239  	gensupport.SetOptions(c.urlParams_, opts...)
  3240  	res, err := c.doRequest("json")
  3241  	if res != nil && res.StatusCode == http.StatusNotModified {
  3242  		if res.Body != nil {
  3243  			res.Body.Close()
  3244  		}
  3245  		return nil, gensupport.WrapError(&googleapi.Error{
  3246  			Code:   res.StatusCode,
  3247  			Header: res.Header,
  3248  		})
  3249  	}
  3250  	if err != nil {
  3251  		return nil, err
  3252  	}
  3253  	defer googleapi.CloseBody(res)
  3254  	if err := googleapi.CheckResponse(res); err != nil {
  3255  		return nil, gensupport.WrapError(err)
  3256  	}
  3257  	ret := &CustomChannels{
  3258  		ServerResponse: googleapi.ServerResponse{
  3259  			Header:         res.Header,
  3260  			HTTPStatusCode: res.StatusCode,
  3261  		},
  3262  	}
  3263  	target := &ret
  3264  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3265  		return nil, err
  3266  	}
  3267  	return ret, nil
  3268  }
  3269  
  3270  // Pages invokes f for each page of results.
  3271  // A non-nil error returned from f will halt the iteration.
  3272  // The provided context supersedes any context provided to the Context method.
  3273  func (c *CustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  3274  	c.ctx_ = ctx
  3275  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  3276  	for {
  3277  		x, err := c.Do()
  3278  		if err != nil {
  3279  			return err
  3280  		}
  3281  		if err := f(x); err != nil {
  3282  			return err
  3283  		}
  3284  		if x.NextPageToken == "" {
  3285  			return nil
  3286  		}
  3287  		c.PageToken(x.NextPageToken)
  3288  	}
  3289  }
  3290  
  3291  type CustomchannelsPatchCall struct {
  3292  	s             *Service
  3293  	adClientId    string
  3294  	customchannel *CustomChannel
  3295  	urlParams_    gensupport.URLParams
  3296  	ctx_          context.Context
  3297  	header_       http.Header
  3298  }
  3299  
  3300  // Patch: Update a custom channel in the host AdSense account. This method
  3301  // supports patch semantics.
  3302  //
  3303  // - adClientId: Ad client in which the custom channel will be updated.
  3304  // - customChannelId: Custom channel to get.
  3305  func (r *CustomchannelsService) Patch(adClientId string, customChannelId string, customchannel *CustomChannel) *CustomchannelsPatchCall {
  3306  	c := &CustomchannelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3307  	c.adClientId = adClientId
  3308  	c.urlParams_.Set("customChannelId", customChannelId)
  3309  	c.customchannel = customchannel
  3310  	return c
  3311  }
  3312  
  3313  // Fields allows partial responses to be retrieved. See
  3314  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3315  // details.
  3316  func (c *CustomchannelsPatchCall) Fields(s ...googleapi.Field) *CustomchannelsPatchCall {
  3317  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3318  	return c
  3319  }
  3320  
  3321  // Context sets the context to be used in this call's Do method.
  3322  func (c *CustomchannelsPatchCall) Context(ctx context.Context) *CustomchannelsPatchCall {
  3323  	c.ctx_ = ctx
  3324  	return c
  3325  }
  3326  
  3327  // Header returns a http.Header that can be modified by the caller to add
  3328  // headers to the request.
  3329  func (c *CustomchannelsPatchCall) Header() http.Header {
  3330  	if c.header_ == nil {
  3331  		c.header_ = make(http.Header)
  3332  	}
  3333  	return c.header_
  3334  }
  3335  
  3336  func (c *CustomchannelsPatchCall) doRequest(alt string) (*http.Response, error) {
  3337  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3338  	var body io.Reader = nil
  3339  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.customchannel)
  3340  	if err != nil {
  3341  		return nil, err
  3342  	}
  3343  	c.urlParams_.Set("alt", alt)
  3344  	c.urlParams_.Set("prettyPrint", "false")
  3345  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  3346  	urls += "?" + c.urlParams_.Encode()
  3347  	req, err := http.NewRequest("PATCH", urls, body)
  3348  	if err != nil {
  3349  		return nil, err
  3350  	}
  3351  	req.Header = reqHeaders
  3352  	googleapi.Expand(req.URL, map[string]string{
  3353  		"adClientId": c.adClientId,
  3354  	})
  3355  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3356  }
  3357  
  3358  // Do executes the "adsensehost.customchannels.patch" call.
  3359  // Any non-2xx status code is an error. Response headers are in either
  3360  // *CustomChannel.ServerResponse.Header or (if a response was returned at all)
  3361  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3362  // whether the returned error was because http.StatusNotModified was returned.
  3363  func (c *CustomchannelsPatchCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  3364  	gensupport.SetOptions(c.urlParams_, opts...)
  3365  	res, err := c.doRequest("json")
  3366  	if res != nil && res.StatusCode == http.StatusNotModified {
  3367  		if res.Body != nil {
  3368  			res.Body.Close()
  3369  		}
  3370  		return nil, gensupport.WrapError(&googleapi.Error{
  3371  			Code:   res.StatusCode,
  3372  			Header: res.Header,
  3373  		})
  3374  	}
  3375  	if err != nil {
  3376  		return nil, err
  3377  	}
  3378  	defer googleapi.CloseBody(res)
  3379  	if err := googleapi.CheckResponse(res); err != nil {
  3380  		return nil, gensupport.WrapError(err)
  3381  	}
  3382  	ret := &CustomChannel{
  3383  		ServerResponse: googleapi.ServerResponse{
  3384  			Header:         res.Header,
  3385  			HTTPStatusCode: res.StatusCode,
  3386  		},
  3387  	}
  3388  	target := &ret
  3389  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3390  		return nil, err
  3391  	}
  3392  	return ret, nil
  3393  }
  3394  
  3395  type CustomchannelsUpdateCall struct {
  3396  	s             *Service
  3397  	adClientId    string
  3398  	customchannel *CustomChannel
  3399  	urlParams_    gensupport.URLParams
  3400  	ctx_          context.Context
  3401  	header_       http.Header
  3402  }
  3403  
  3404  // Update: Update a custom channel in the host AdSense account.
  3405  //
  3406  // - adClientId: Ad client in which the custom channel will be updated.
  3407  func (r *CustomchannelsService) Update(adClientId string, customchannel *CustomChannel) *CustomchannelsUpdateCall {
  3408  	c := &CustomchannelsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3409  	c.adClientId = adClientId
  3410  	c.customchannel = customchannel
  3411  	return c
  3412  }
  3413  
  3414  // Fields allows partial responses to be retrieved. See
  3415  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3416  // details.
  3417  func (c *CustomchannelsUpdateCall) Fields(s ...googleapi.Field) *CustomchannelsUpdateCall {
  3418  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3419  	return c
  3420  }
  3421  
  3422  // Context sets the context to be used in this call's Do method.
  3423  func (c *CustomchannelsUpdateCall) Context(ctx context.Context) *CustomchannelsUpdateCall {
  3424  	c.ctx_ = ctx
  3425  	return c
  3426  }
  3427  
  3428  // Header returns a http.Header that can be modified by the caller to add
  3429  // headers to the request.
  3430  func (c *CustomchannelsUpdateCall) Header() http.Header {
  3431  	if c.header_ == nil {
  3432  		c.header_ = make(http.Header)
  3433  	}
  3434  	return c.header_
  3435  }
  3436  
  3437  func (c *CustomchannelsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3438  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3439  	var body io.Reader = nil
  3440  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.customchannel)
  3441  	if err != nil {
  3442  		return nil, err
  3443  	}
  3444  	c.urlParams_.Set("alt", alt)
  3445  	c.urlParams_.Set("prettyPrint", "false")
  3446  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  3447  	urls += "?" + c.urlParams_.Encode()
  3448  	req, err := http.NewRequest("PUT", urls, body)
  3449  	if err != nil {
  3450  		return nil, err
  3451  	}
  3452  	req.Header = reqHeaders
  3453  	googleapi.Expand(req.URL, map[string]string{
  3454  		"adClientId": c.adClientId,
  3455  	})
  3456  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3457  }
  3458  
  3459  // Do executes the "adsensehost.customchannels.update" call.
  3460  // Any non-2xx status code is an error. Response headers are in either
  3461  // *CustomChannel.ServerResponse.Header or (if a response was returned at all)
  3462  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3463  // whether the returned error was because http.StatusNotModified was returned.
  3464  func (c *CustomchannelsUpdateCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  3465  	gensupport.SetOptions(c.urlParams_, opts...)
  3466  	res, err := c.doRequest("json")
  3467  	if res != nil && res.StatusCode == http.StatusNotModified {
  3468  		if res.Body != nil {
  3469  			res.Body.Close()
  3470  		}
  3471  		return nil, gensupport.WrapError(&googleapi.Error{
  3472  			Code:   res.StatusCode,
  3473  			Header: res.Header,
  3474  		})
  3475  	}
  3476  	if err != nil {
  3477  		return nil, err
  3478  	}
  3479  	defer googleapi.CloseBody(res)
  3480  	if err := googleapi.CheckResponse(res); err != nil {
  3481  		return nil, gensupport.WrapError(err)
  3482  	}
  3483  	ret := &CustomChannel{
  3484  		ServerResponse: googleapi.ServerResponse{
  3485  			Header:         res.Header,
  3486  			HTTPStatusCode: res.StatusCode,
  3487  		},
  3488  	}
  3489  	target := &ret
  3490  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3491  		return nil, err
  3492  	}
  3493  	return ret, nil
  3494  }
  3495  
  3496  type ReportsGenerateCall struct {
  3497  	s            *Service
  3498  	urlParams_   gensupport.URLParams
  3499  	ifNoneMatch_ string
  3500  	ctx_         context.Context
  3501  	header_      http.Header
  3502  }
  3503  
  3504  // Generate: Generate an AdSense report based on the report request sent in the
  3505  // query parameters. Returns the result as JSON; to retrieve output in CSV
  3506  // format specify "alt=csv" as a query parameter.
  3507  //
  3508  //   - endDate: End of the date range to report on in "YYYY-MM-DD" format,
  3509  //     inclusive.
  3510  //   - startDate: Start of the date range to report on in "YYYY-MM-DD" format,
  3511  //     inclusive.
  3512  func (r *ReportsService) Generate(startDate string, endDate string) *ReportsGenerateCall {
  3513  	c := &ReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3514  	c.urlParams_.Set("startDate", startDate)
  3515  	c.urlParams_.Set("endDate", endDate)
  3516  	return c
  3517  }
  3518  
  3519  // Dimension sets the optional parameter "dimension": Dimensions to base the
  3520  // report on.
  3521  func (c *ReportsGenerateCall) Dimension(dimension ...string) *ReportsGenerateCall {
  3522  	c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
  3523  	return c
  3524  }
  3525  
  3526  // Filter sets the optional parameter "filter": Filters to be run on the
  3527  // report.
  3528  func (c *ReportsGenerateCall) Filter(filter ...string) *ReportsGenerateCall {
  3529  	c.urlParams_.SetMulti("filter", append([]string{}, filter...))
  3530  	return c
  3531  }
  3532  
  3533  // Locale sets the optional parameter "locale": Optional locale to use for
  3534  // translating report output to a local language. Defaults to "en_US" if not
  3535  // specified.
  3536  func (c *ReportsGenerateCall) Locale(locale string) *ReportsGenerateCall {
  3537  	c.urlParams_.Set("locale", locale)
  3538  	return c
  3539  }
  3540  
  3541  // MaxResults sets the optional parameter "maxResults": The maximum number of
  3542  // rows of report data to return.
  3543  func (c *ReportsGenerateCall) MaxResults(maxResults int64) *ReportsGenerateCall {
  3544  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3545  	return c
  3546  }
  3547  
  3548  // Metric sets the optional parameter "metric": Numeric columns to include in
  3549  // the report.
  3550  func (c *ReportsGenerateCall) Metric(metric ...string) *ReportsGenerateCall {
  3551  	c.urlParams_.SetMulti("metric", append([]string{}, metric...))
  3552  	return c
  3553  }
  3554  
  3555  // Sort sets the optional parameter "sort": The name of a dimension or metric
  3556  // to sort the resulting report on, optionally prefixed with "+" to sort
  3557  // ascending or "-" to sort descending. If no prefix is specified, the column
  3558  // is sorted ascending.
  3559  func (c *ReportsGenerateCall) Sort(sort ...string) *ReportsGenerateCall {
  3560  	c.urlParams_.SetMulti("sort", append([]string{}, sort...))
  3561  	return c
  3562  }
  3563  
  3564  // StartIndex sets the optional parameter "startIndex": Index of the first row
  3565  // of report data to return.
  3566  func (c *ReportsGenerateCall) StartIndex(startIndex int64) *ReportsGenerateCall {
  3567  	c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  3568  	return c
  3569  }
  3570  
  3571  // Fields allows partial responses to be retrieved. See
  3572  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3573  // details.
  3574  func (c *ReportsGenerateCall) Fields(s ...googleapi.Field) *ReportsGenerateCall {
  3575  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3576  	return c
  3577  }
  3578  
  3579  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  3580  // object's ETag matches the given value. This is useful for getting updates
  3581  // only after the object has changed since the last request.
  3582  func (c *ReportsGenerateCall) IfNoneMatch(entityTag string) *ReportsGenerateCall {
  3583  	c.ifNoneMatch_ = entityTag
  3584  	return c
  3585  }
  3586  
  3587  // Context sets the context to be used in this call's Do method.
  3588  func (c *ReportsGenerateCall) Context(ctx context.Context) *ReportsGenerateCall {
  3589  	c.ctx_ = ctx
  3590  	return c
  3591  }
  3592  
  3593  // Header returns a http.Header that can be modified by the caller to add
  3594  // headers to the request.
  3595  func (c *ReportsGenerateCall) Header() http.Header {
  3596  	if c.header_ == nil {
  3597  		c.header_ = make(http.Header)
  3598  	}
  3599  	return c.header_
  3600  }
  3601  
  3602  func (c *ReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
  3603  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3604  	if c.ifNoneMatch_ != "" {
  3605  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3606  	}
  3607  	var body io.Reader = nil
  3608  	c.urlParams_.Set("alt", alt)
  3609  	c.urlParams_.Set("prettyPrint", "false")
  3610  	urls := googleapi.ResolveRelative(c.s.BasePath, "reports")
  3611  	urls += "?" + c.urlParams_.Encode()
  3612  	req, err := http.NewRequest("GET", urls, body)
  3613  	if err != nil {
  3614  		return nil, err
  3615  	}
  3616  	req.Header = reqHeaders
  3617  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3618  }
  3619  
  3620  // Do executes the "adsensehost.reports.generate" call.
  3621  // Any non-2xx status code is an error. Response headers are in either
  3622  // *Report.ServerResponse.Header or (if a response was returned at all) in
  3623  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3624  // whether the returned error was because http.StatusNotModified was returned.
  3625  func (c *ReportsGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) {
  3626  	gensupport.SetOptions(c.urlParams_, opts...)
  3627  	res, err := c.doRequest("json")
  3628  	if res != nil && res.StatusCode == http.StatusNotModified {
  3629  		if res.Body != nil {
  3630  			res.Body.Close()
  3631  		}
  3632  		return nil, gensupport.WrapError(&googleapi.Error{
  3633  			Code:   res.StatusCode,
  3634  			Header: res.Header,
  3635  		})
  3636  	}
  3637  	if err != nil {
  3638  		return nil, err
  3639  	}
  3640  	defer googleapi.CloseBody(res)
  3641  	if err := googleapi.CheckResponse(res); err != nil {
  3642  		return nil, gensupport.WrapError(err)
  3643  	}
  3644  	ret := &Report{
  3645  		ServerResponse: googleapi.ServerResponse{
  3646  			Header:         res.Header,
  3647  			HTTPStatusCode: res.StatusCode,
  3648  		},
  3649  	}
  3650  	target := &ret
  3651  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3652  		return nil, err
  3653  	}
  3654  	return ret, nil
  3655  }
  3656  
  3657  type UrlchannelsDeleteCall struct {
  3658  	s            *Service
  3659  	adClientId   string
  3660  	urlChannelId string
  3661  	urlParams_   gensupport.URLParams
  3662  	ctx_         context.Context
  3663  	header_      http.Header
  3664  }
  3665  
  3666  // Delete: Delete a URL channel from the host AdSense account.
  3667  //
  3668  // - adClientId: Ad client from which to delete the URL channel.
  3669  // - urlChannelId: URL channel to delete.
  3670  func (r *UrlchannelsService) Delete(adClientId string, urlChannelId string) *UrlchannelsDeleteCall {
  3671  	c := &UrlchannelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3672  	c.adClientId = adClientId
  3673  	c.urlChannelId = urlChannelId
  3674  	return c
  3675  }
  3676  
  3677  // Fields allows partial responses to be retrieved. See
  3678  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3679  // details.
  3680  func (c *UrlchannelsDeleteCall) Fields(s ...googleapi.Field) *UrlchannelsDeleteCall {
  3681  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3682  	return c
  3683  }
  3684  
  3685  // Context sets the context to be used in this call's Do method.
  3686  func (c *UrlchannelsDeleteCall) Context(ctx context.Context) *UrlchannelsDeleteCall {
  3687  	c.ctx_ = ctx
  3688  	return c
  3689  }
  3690  
  3691  // Header returns a http.Header that can be modified by the caller to add
  3692  // headers to the request.
  3693  func (c *UrlchannelsDeleteCall) Header() http.Header {
  3694  	if c.header_ == nil {
  3695  		c.header_ = make(http.Header)
  3696  	}
  3697  	return c.header_
  3698  }
  3699  
  3700  func (c *UrlchannelsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3701  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3702  	var body io.Reader = nil
  3703  	c.urlParams_.Set("alt", alt)
  3704  	c.urlParams_.Set("prettyPrint", "false")
  3705  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels/{urlChannelId}")
  3706  	urls += "?" + c.urlParams_.Encode()
  3707  	req, err := http.NewRequest("DELETE", urls, body)
  3708  	if err != nil {
  3709  		return nil, err
  3710  	}
  3711  	req.Header = reqHeaders
  3712  	googleapi.Expand(req.URL, map[string]string{
  3713  		"adClientId":   c.adClientId,
  3714  		"urlChannelId": c.urlChannelId,
  3715  	})
  3716  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3717  }
  3718  
  3719  // Do executes the "adsensehost.urlchannels.delete" call.
  3720  // Any non-2xx status code is an error. Response headers are in either
  3721  // *UrlChannel.ServerResponse.Header or (if a response was returned at all) in
  3722  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3723  // whether the returned error was because http.StatusNotModified was returned.
  3724  func (c *UrlchannelsDeleteCall) Do(opts ...googleapi.CallOption) (*UrlChannel, error) {
  3725  	gensupport.SetOptions(c.urlParams_, opts...)
  3726  	res, err := c.doRequest("json")
  3727  	if res != nil && res.StatusCode == http.StatusNotModified {
  3728  		if res.Body != nil {
  3729  			res.Body.Close()
  3730  		}
  3731  		return nil, gensupport.WrapError(&googleapi.Error{
  3732  			Code:   res.StatusCode,
  3733  			Header: res.Header,
  3734  		})
  3735  	}
  3736  	if err != nil {
  3737  		return nil, err
  3738  	}
  3739  	defer googleapi.CloseBody(res)
  3740  	if err := googleapi.CheckResponse(res); err != nil {
  3741  		return nil, gensupport.WrapError(err)
  3742  	}
  3743  	ret := &UrlChannel{
  3744  		ServerResponse: googleapi.ServerResponse{
  3745  			Header:         res.Header,
  3746  			HTTPStatusCode: res.StatusCode,
  3747  		},
  3748  	}
  3749  	target := &ret
  3750  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3751  		return nil, err
  3752  	}
  3753  	return ret, nil
  3754  }
  3755  
  3756  type UrlchannelsInsertCall struct {
  3757  	s          *Service
  3758  	adClientId string
  3759  	urlchannel *UrlChannel
  3760  	urlParams_ gensupport.URLParams
  3761  	ctx_       context.Context
  3762  	header_    http.Header
  3763  }
  3764  
  3765  // Insert: Add a new URL channel to the host AdSense account.
  3766  //
  3767  // - adClientId: Ad client to which the new URL channel will be added.
  3768  func (r *UrlchannelsService) Insert(adClientId string, urlchannel *UrlChannel) *UrlchannelsInsertCall {
  3769  	c := &UrlchannelsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3770  	c.adClientId = adClientId
  3771  	c.urlchannel = urlchannel
  3772  	return c
  3773  }
  3774  
  3775  // Fields allows partial responses to be retrieved. See
  3776  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3777  // details.
  3778  func (c *UrlchannelsInsertCall) Fields(s ...googleapi.Field) *UrlchannelsInsertCall {
  3779  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3780  	return c
  3781  }
  3782  
  3783  // Context sets the context to be used in this call's Do method.
  3784  func (c *UrlchannelsInsertCall) Context(ctx context.Context) *UrlchannelsInsertCall {
  3785  	c.ctx_ = ctx
  3786  	return c
  3787  }
  3788  
  3789  // Header returns a http.Header that can be modified by the caller to add
  3790  // headers to the request.
  3791  func (c *UrlchannelsInsertCall) Header() http.Header {
  3792  	if c.header_ == nil {
  3793  		c.header_ = make(http.Header)
  3794  	}
  3795  	return c.header_
  3796  }
  3797  
  3798  func (c *UrlchannelsInsertCall) doRequest(alt string) (*http.Response, error) {
  3799  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3800  	var body io.Reader = nil
  3801  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.urlchannel)
  3802  	if err != nil {
  3803  		return nil, err
  3804  	}
  3805  	c.urlParams_.Set("alt", alt)
  3806  	c.urlParams_.Set("prettyPrint", "false")
  3807  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels")
  3808  	urls += "?" + c.urlParams_.Encode()
  3809  	req, err := http.NewRequest("POST", urls, body)
  3810  	if err != nil {
  3811  		return nil, err
  3812  	}
  3813  	req.Header = reqHeaders
  3814  	googleapi.Expand(req.URL, map[string]string{
  3815  		"adClientId": c.adClientId,
  3816  	})
  3817  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3818  }
  3819  
  3820  // Do executes the "adsensehost.urlchannels.insert" call.
  3821  // Any non-2xx status code is an error. Response headers are in either
  3822  // *UrlChannel.ServerResponse.Header or (if a response was returned at all) in
  3823  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3824  // whether the returned error was because http.StatusNotModified was returned.
  3825  func (c *UrlchannelsInsertCall) Do(opts ...googleapi.CallOption) (*UrlChannel, error) {
  3826  	gensupport.SetOptions(c.urlParams_, opts...)
  3827  	res, err := c.doRequest("json")
  3828  	if res != nil && res.StatusCode == http.StatusNotModified {
  3829  		if res.Body != nil {
  3830  			res.Body.Close()
  3831  		}
  3832  		return nil, gensupport.WrapError(&googleapi.Error{
  3833  			Code:   res.StatusCode,
  3834  			Header: res.Header,
  3835  		})
  3836  	}
  3837  	if err != nil {
  3838  		return nil, err
  3839  	}
  3840  	defer googleapi.CloseBody(res)
  3841  	if err := googleapi.CheckResponse(res); err != nil {
  3842  		return nil, gensupport.WrapError(err)
  3843  	}
  3844  	ret := &UrlChannel{
  3845  		ServerResponse: googleapi.ServerResponse{
  3846  			Header:         res.Header,
  3847  			HTTPStatusCode: res.StatusCode,
  3848  		},
  3849  	}
  3850  	target := &ret
  3851  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3852  		return nil, err
  3853  	}
  3854  	return ret, nil
  3855  }
  3856  
  3857  type UrlchannelsListCall struct {
  3858  	s            *Service
  3859  	adClientId   string
  3860  	urlParams_   gensupport.URLParams
  3861  	ifNoneMatch_ string
  3862  	ctx_         context.Context
  3863  	header_      http.Header
  3864  }
  3865  
  3866  // List: List all host URL channels in the host AdSense account.
  3867  //
  3868  // - adClientId: Ad client for which to list URL channels.
  3869  func (r *UrlchannelsService) List(adClientId string) *UrlchannelsListCall {
  3870  	c := &UrlchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3871  	c.adClientId = adClientId
  3872  	return c
  3873  }
  3874  
  3875  // MaxResults sets the optional parameter "maxResults": The maximum number of
  3876  // URL channels to include in the response, used for paging.
  3877  func (c *UrlchannelsListCall) MaxResults(maxResults int64) *UrlchannelsListCall {
  3878  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3879  	return c
  3880  }
  3881  
  3882  // PageToken sets the optional parameter "pageToken": A continuation token,
  3883  // used to page through URL channels. To retrieve the next page, set this
  3884  // parameter to the value of "nextPageToken" from the previous response.
  3885  func (c *UrlchannelsListCall) PageToken(pageToken string) *UrlchannelsListCall {
  3886  	c.urlParams_.Set("pageToken", pageToken)
  3887  	return c
  3888  }
  3889  
  3890  // Fields allows partial responses to be retrieved. See
  3891  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3892  // details.
  3893  func (c *UrlchannelsListCall) Fields(s ...googleapi.Field) *UrlchannelsListCall {
  3894  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3895  	return c
  3896  }
  3897  
  3898  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  3899  // object's ETag matches the given value. This is useful for getting updates
  3900  // only after the object has changed since the last request.
  3901  func (c *UrlchannelsListCall) IfNoneMatch(entityTag string) *UrlchannelsListCall {
  3902  	c.ifNoneMatch_ = entityTag
  3903  	return c
  3904  }
  3905  
  3906  // Context sets the context to be used in this call's Do method.
  3907  func (c *UrlchannelsListCall) Context(ctx context.Context) *UrlchannelsListCall {
  3908  	c.ctx_ = ctx
  3909  	return c
  3910  }
  3911  
  3912  // Header returns a http.Header that can be modified by the caller to add
  3913  // headers to the request.
  3914  func (c *UrlchannelsListCall) Header() http.Header {
  3915  	if c.header_ == nil {
  3916  		c.header_ = make(http.Header)
  3917  	}
  3918  	return c.header_
  3919  }
  3920  
  3921  func (c *UrlchannelsListCall) doRequest(alt string) (*http.Response, error) {
  3922  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3923  	if c.ifNoneMatch_ != "" {
  3924  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3925  	}
  3926  	var body io.Reader = nil
  3927  	c.urlParams_.Set("alt", alt)
  3928  	c.urlParams_.Set("prettyPrint", "false")
  3929  	urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels")
  3930  	urls += "?" + c.urlParams_.Encode()
  3931  	req, err := http.NewRequest("GET", urls, body)
  3932  	if err != nil {
  3933  		return nil, err
  3934  	}
  3935  	req.Header = reqHeaders
  3936  	googleapi.Expand(req.URL, map[string]string{
  3937  		"adClientId": c.adClientId,
  3938  	})
  3939  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3940  }
  3941  
  3942  // Do executes the "adsensehost.urlchannels.list" call.
  3943  // Any non-2xx status code is an error. Response headers are in either
  3944  // *UrlChannels.ServerResponse.Header or (if a response was returned at all) in
  3945  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3946  // whether the returned error was because http.StatusNotModified was returned.
  3947  func (c *UrlchannelsListCall) Do(opts ...googleapi.CallOption) (*UrlChannels, error) {
  3948  	gensupport.SetOptions(c.urlParams_, opts...)
  3949  	res, err := c.doRequest("json")
  3950  	if res != nil && res.StatusCode == http.StatusNotModified {
  3951  		if res.Body != nil {
  3952  			res.Body.Close()
  3953  		}
  3954  		return nil, gensupport.WrapError(&googleapi.Error{
  3955  			Code:   res.StatusCode,
  3956  			Header: res.Header,
  3957  		})
  3958  	}
  3959  	if err != nil {
  3960  		return nil, err
  3961  	}
  3962  	defer googleapi.CloseBody(res)
  3963  	if err := googleapi.CheckResponse(res); err != nil {
  3964  		return nil, gensupport.WrapError(err)
  3965  	}
  3966  	ret := &UrlChannels{
  3967  		ServerResponse: googleapi.ServerResponse{
  3968  			Header:         res.Header,
  3969  			HTTPStatusCode: res.StatusCode,
  3970  		},
  3971  	}
  3972  	target := &ret
  3973  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3974  		return nil, err
  3975  	}
  3976  	return ret, nil
  3977  }
  3978  
  3979  // Pages invokes f for each page of results.
  3980  // A non-nil error returned from f will halt the iteration.
  3981  // The provided context supersedes any context provided to the Context method.
  3982  func (c *UrlchannelsListCall) Pages(ctx context.Context, f func(*UrlChannels) error) error {
  3983  	c.ctx_ = ctx
  3984  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  3985  	for {
  3986  		x, err := c.Do()
  3987  		if err != nil {
  3988  			return err
  3989  		}
  3990  		if err := f(x); err != nil {
  3991  			return err
  3992  		}
  3993  		if x.NextPageToken == "" {
  3994  			return nil
  3995  		}
  3996  		c.PageToken(x.NextPageToken)
  3997  	}
  3998  }
  3999  

View as plain text