| // Copyright 2019 Google LLC. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| // Code generated file. DO NOT EDIT. |
| |
| // Package analytics provides access to the Google Analytics API. |
| // |
| // For product documentation, see: https://developers.google.com/analytics/ |
| // |
| // Creating a client |
| // |
| // Usage example: |
| // |
| // import "google.golang.org/api/analytics/v2.4" |
| // ... |
| // ctx := context.Background() |
| // analyticsService, err := analytics.NewService(ctx) |
| // |
| // In this example, Google Application Default Credentials are used for authentication. |
| // |
| // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. |
| // |
| // Other authentication options |
| // |
| // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: |
| // |
| // analyticsService, err := analytics.NewService(ctx, option.WithScopes(analytics.AnalyticsReadonlyScope)) |
| // |
| // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: |
| // |
| // analyticsService, err := analytics.NewService(ctx, option.WithAPIKey("AIza...")) |
| // |
| // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: |
| // |
| // config := &oauth2.Config{...} |
| // // ... |
| // token, err := config.Exchange(ctx, ...) |
| // analyticsService, err := analytics.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) |
| // |
| // See https://godoc.org/google.golang.org/api/option/ for details on options. |
| package analytics // import "google.golang.org/api/analytics/v2.4" |
| |
| import ( |
| "bytes" |
| "context" |
| "encoding/json" |
| "errors" |
| "fmt" |
| "io" |
| "net/http" |
| "net/url" |
| "strconv" |
| "strings" |
| |
| googleapi "google.golang.org/api/googleapi" |
| gensupport "google.golang.org/api/internal/gensupport" |
| option "google.golang.org/api/option" |
| htransport "google.golang.org/api/transport/http" |
| ) |
| |
| // Always reference these packages, just in case the auto-generated code |
| // below doesn't. |
| var _ = bytes.NewBuffer |
| var _ = strconv.Itoa |
| var _ = fmt.Sprintf |
| var _ = json.NewDecoder |
| var _ = io.Copy |
| var _ = url.Parse |
| var _ = gensupport.MarshalJSON |
| var _ = googleapi.Version |
| var _ = errors.New |
| var _ = strings.Replace |
| var _ = context.Canceled |
| |
| const apiId = "analytics:v2.4" |
| const apiName = "analytics" |
| const apiVersion = "v2.4" |
| const basePath = "https://www.googleapis.com/analytics/v2.4/" |
| |
| // OAuth2 scopes used by this API. |
| const ( |
| // View and manage your Google Analytics data |
| AnalyticsScope = "https://www.googleapis.com/auth/analytics" |
| |
| // View your Google Analytics data |
| AnalyticsReadonlyScope = "https://www.googleapis.com/auth/analytics.readonly" |
| ) |
| |
| // NewService creates a new Service. |
| func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { |
| scopesOption := option.WithScopes( |
| "https://www.googleapis.com/auth/analytics", |
| "https://www.googleapis.com/auth/analytics.readonly", |
| ) |
| // NOTE: prepend, so we don't override user-specified scopes. |
| opts = append([]option.ClientOption{scopesOption}, opts...) |
| client, endpoint, err := htransport.NewClient(ctx, opts...) |
| if err != nil { |
| return nil, err |
| } |
| s, err := New(client) |
| if err != nil { |
| return nil, err |
| } |
| if endpoint != "" { |
| s.BasePath = endpoint |
| } |
| return s, nil |
| } |
| |
| // New creates a new Service. It uses the provided http.Client for requests. |
| // |
| // Deprecated: please use NewService instead. |
| // To provide a custom HTTP client, use option.WithHTTPClient. |
| // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. |
| func New(client *http.Client) (*Service, error) { |
| if client == nil { |
| return nil, errors.New("client is nil") |
| } |
| s := &Service{client: client, BasePath: basePath} |
| s.Data = NewDataService(s) |
| s.Management = NewManagementService(s) |
| return s, nil |
| } |
| |
| type Service struct { |
| client *http.Client |
| BasePath string // API endpoint base URL |
| UserAgent string // optional additional User-Agent fragment |
| |
| Data *DataService |
| |
| Management *ManagementService |
| } |
| |
| func (s *Service) userAgent() string { |
| if s.UserAgent == "" { |
| return googleapi.UserAgent |
| } |
| return googleapi.UserAgent + " " + s.UserAgent |
| } |
| |
| func NewDataService(s *Service) *DataService { |
| rs := &DataService{s: s} |
| return rs |
| } |
| |
| type DataService struct { |
| s *Service |
| } |
| |
| func NewManagementService(s *Service) *ManagementService { |
| rs := &ManagementService{s: s} |
| rs.Accounts = NewManagementAccountsService(s) |
| rs.Goals = NewManagementGoalsService(s) |
| rs.Profiles = NewManagementProfilesService(s) |
| rs.Segments = NewManagementSegmentsService(s) |
| rs.Webproperties = NewManagementWebpropertiesService(s) |
| return rs |
| } |
| |
| type ManagementService struct { |
| s *Service |
| |
| Accounts *ManagementAccountsService |
| |
| Goals *ManagementGoalsService |
| |
| Profiles *ManagementProfilesService |
| |
| Segments *ManagementSegmentsService |
| |
| Webproperties *ManagementWebpropertiesService |
| } |
| |
| func NewManagementAccountsService(s *Service) *ManagementAccountsService { |
| rs := &ManagementAccountsService{s: s} |
| return rs |
| } |
| |
| type ManagementAccountsService struct { |
| s *Service |
| } |
| |
| func NewManagementGoalsService(s *Service) *ManagementGoalsService { |
| rs := &ManagementGoalsService{s: s} |
| return rs |
| } |
| |
| type ManagementGoalsService struct { |
| s *Service |
| } |
| |
| func NewManagementProfilesService(s *Service) *ManagementProfilesService { |
| rs := &ManagementProfilesService{s: s} |
| return rs |
| } |
| |
| type ManagementProfilesService struct { |
| s *Service |
| } |
| |
| func NewManagementSegmentsService(s *Service) *ManagementSegmentsService { |
| rs := &ManagementSegmentsService{s: s} |
| return rs |
| } |
| |
| type ManagementSegmentsService struct { |
| s *Service |
| } |
| |
| func NewManagementWebpropertiesService(s *Service) *ManagementWebpropertiesService { |
| rs := &ManagementWebpropertiesService{s: s} |
| return rs |
| } |
| |
| type ManagementWebpropertiesService struct { |
| s *Service |
| } |
| |
| // method id "analytics.data.get": |
| |
| type DataGetCall struct { |
| s *Service |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Get: Returns Analytics report data for a view (profile). |
| func (r *DataService) Get(ids string, startDate string, endDate string, metrics string) *DataGetCall { |
| c := &DataGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.urlParams_.Set("ids", ids) |
| c.urlParams_.Set("start-date", startDate) |
| c.urlParams_.Set("end-date", endDate) |
| c.urlParams_.Set("metrics", metrics) |
| return c |
| } |
| |
| // Dimensions sets the optional parameter "dimensions": A |
| // comma-separated list of Analytics dimensions. E.g., |
| // 'ga:browser,ga:city'. |
| func (c *DataGetCall) Dimensions(dimensions string) *DataGetCall { |
| c.urlParams_.Set("dimensions", dimensions) |
| return c |
| } |
| |
| // Filters sets the optional parameter "filters": A comma-separated list |
| // of dimension or metric filters to be applied to the report data. |
| func (c *DataGetCall) Filters(filters string) *DataGetCall { |
| c.urlParams_.Set("filters", filters) |
| return c |
| } |
| |
| // MaxResults sets the optional parameter "max-results": The maximum |
| // number of entries to include in this feed. |
| func (c *DataGetCall) MaxResults(maxResults int64) *DataGetCall { |
| c.urlParams_.Set("max-results", fmt.Sprint(maxResults)) |
| return c |
| } |
| |
| // Segment sets the optional parameter "segment": An Analytics advanced |
| // segment to be applied to the report data. |
| func (c *DataGetCall) Segment(segment string) *DataGetCall { |
| c.urlParams_.Set("segment", segment) |
| return c |
| } |
| |
| // Sort sets the optional parameter "sort": A comma-separated list of |
| // dimensions or metrics that determine the sort order for the report |
| // data. |
| func (c *DataGetCall) Sort(sort string) *DataGetCall { |
| c.urlParams_.Set("sort", sort) |
| return c |
| } |
| |
| // StartIndex sets the optional parameter "start-index": An index of the |
| // first entity to retrieve. Use this parameter as a pagination |
| // mechanism along with the max-results parameter. |
| func (c *DataGetCall) StartIndex(startIndex int64) *DataGetCall { |
| c.urlParams_.Set("start-index", fmt.Sprint(startIndex)) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *DataGetCall) Fields(s ...googleapi.Field) *DataGetCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *DataGetCall) IfNoneMatch(entityTag string) *DataGetCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *DataGetCall) Context(ctx context.Context) *DataGetCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *DataGetCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *DataGetCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191117") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "data") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "analytics.data.get" call. |
| func (c *DataGetCall) Do(opts ...googleapi.CallOption) error { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if err != nil { |
| return err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return err |
| } |
| return nil |
| // { |
| // "description": "Returns Analytics report data for a view (profile).", |
| // "httpMethod": "GET", |
| // "id": "analytics.data.get", |
| // "parameterOrder": [ |
| // "ids", |
| // "start-date", |
| // "end-date", |
| // "metrics" |
| // ], |
| // "parameters": { |
| // "dimensions": { |
| // "description": "A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'.", |
| // "location": "query", |
| // "pattern": "(ga:.+)?", |
| // "type": "string" |
| // }, |
| // "end-date": { |
| // "description": "End date for fetching report data. All requests should specify an end date formatted as YYYY-MM-DD.", |
| // "location": "query", |
| // "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{2}", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "filters": { |
| // "description": "A comma-separated list of dimension or metric filters to be applied to the report data.", |
| // "location": "query", |
| // "pattern": "ga:.+", |
| // "type": "string" |
| // }, |
| // "ids": { |
| // "description": "Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.", |
| // "location": "query", |
| // "pattern": "ga:[0-9]+", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "max-results": { |
| // "description": "The maximum number of entries to include in this feed.", |
| // "format": "int32", |
| // "location": "query", |
| // "type": "integer" |
| // }, |
| // "metrics": { |
| // "description": "A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one metric must be specified to retrieve a valid Analytics report.", |
| // "location": "query", |
| // "pattern": "ga:.+", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "segment": { |
| // "description": "An Analytics advanced segment to be applied to the report data.", |
| // "location": "query", |
| // "type": "string" |
| // }, |
| // "sort": { |
| // "description": "A comma-separated list of dimensions or metrics that determine the sort order for the report data.", |
| // "location": "query", |
| // "pattern": "(-)?ga:.+", |
| // "type": "string" |
| // }, |
| // "start-date": { |
| // "description": "Start date for fetching report data. All requests should specify a start date formatted as YYYY-MM-DD.", |
| // "location": "query", |
| // "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{2}", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "start-index": { |
| // "description": "An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.", |
| // "format": "int32", |
| // "location": "query", |
| // "minimum": "1", |
| // "type": "integer" |
| // } |
| // }, |
| // "path": "data", |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/analytics", |
| // "https://www.googleapis.com/auth/analytics.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // method id "analytics.management.accounts.list": |
| |
| type ManagementAccountsListCall struct { |
| s *Service |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // List: Lists all accounts to which the user has access. |
| func (r *ManagementAccountsService) List() *ManagementAccountsListCall { |
| c := &ManagementAccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| return c |
| } |
| |
| // MaxResults sets the optional parameter "max-results": The maximum |
| // number of accounts to include in this response. |
| func (c *ManagementAccountsListCall) MaxResults(maxResults int64) *ManagementAccountsListCall { |
| c.urlParams_.Set("max-results", fmt.Sprint(maxResults)) |
| return c |
| } |
| |
| // StartIndex sets the optional parameter "start-index": An index of the |
| // first account to retrieve. Use this parameter as a pagination |
| // mechanism along with the max-results parameter. |
| func (c *ManagementAccountsListCall) StartIndex(startIndex int64) *ManagementAccountsListCall { |
| c.urlParams_.Set("start-index", fmt.Sprint(startIndex)) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ManagementAccountsListCall) Fields(s ...googleapi.Field) *ManagementAccountsListCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *ManagementAccountsListCall) IfNoneMatch(entityTag string) *ManagementAccountsListCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ManagementAccountsListCall) Context(ctx context.Context) *ManagementAccountsListCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ManagementAccountsListCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ManagementAccountsListCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191117") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "analytics.management.accounts.list" call. |
| func (c *ManagementAccountsListCall) Do(opts ...googleapi.CallOption) error { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if err != nil { |
| return err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return err |
| } |
| return nil |
| // { |
| // "description": "Lists all accounts to which the user has access.", |
| // "httpMethod": "GET", |
| // "id": "analytics.management.accounts.list", |
| // "parameters": { |
| // "max-results": { |
| // "description": "The maximum number of accounts to include in this response.", |
| // "format": "int32", |
| // "location": "query", |
| // "type": "integer" |
| // }, |
| // "start-index": { |
| // "description": "An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.", |
| // "format": "int32", |
| // "location": "query", |
| // "minimum": "1", |
| // "type": "integer" |
| // } |
| // }, |
| // "path": "management/accounts", |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/analytics", |
| // "https://www.googleapis.com/auth/analytics.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // method id "analytics.management.goals.list": |
| |
| type ManagementGoalsListCall struct { |
| s *Service |
| accountId string |
| webPropertyId string |
| profileId string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // List: Lists goals to which the user has access. |
| func (r *ManagementGoalsService) List(accountId string, webPropertyId string, profileId string) *ManagementGoalsListCall { |
| c := &ManagementGoalsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.accountId = accountId |
| c.webPropertyId = webPropertyId |
| c.profileId = profileId |
| return c |
| } |
| |
| // MaxResults sets the optional parameter "max-results": The maximum |
| // number of goals to include in this response. |
| func (c *ManagementGoalsListCall) MaxResults(maxResults int64) *ManagementGoalsListCall { |
| c.urlParams_.Set("max-results", fmt.Sprint(maxResults)) |
| return c |
| } |
| |
| // StartIndex sets the optional parameter "start-index": An index of the |
| // first goal to retrieve. Use this parameter as a pagination mechanism |
| // along with the max-results parameter. |
| func (c *ManagementGoalsListCall) StartIndex(startIndex int64) *ManagementGoalsListCall { |
| c.urlParams_.Set("start-index", fmt.Sprint(startIndex)) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ManagementGoalsListCall) Fields(s ...googleapi.Field) *ManagementGoalsListCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *ManagementGoalsListCall) IfNoneMatch(entityTag string) *ManagementGoalsListCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ManagementGoalsListCall) Context(ctx context.Context) *ManagementGoalsListCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ManagementGoalsListCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ManagementGoalsListCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191117") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "accountId": c.accountId, |
| "webPropertyId": c.webPropertyId, |
| "profileId": c.profileId, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "analytics.management.goals.list" call. |
| func (c *ManagementGoalsListCall) Do(opts ...googleapi.CallOption) error { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if err != nil { |
| return err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return err |
| } |
| return nil |
| // { |
| // "description": "Lists goals to which the user has access.", |
| // "httpMethod": "GET", |
| // "id": "analytics.management.goals.list", |
| // "parameterOrder": [ |
| // "accountId", |
| // "webPropertyId", |
| // "profileId" |
| // ], |
| // "parameters": { |
| // "accountId": { |
| // "description": "Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "max-results": { |
| // "description": "The maximum number of goals to include in this response.", |
| // "format": "int32", |
| // "location": "query", |
| // "type": "integer" |
| // }, |
| // "profileId": { |
| // "description": "View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or '~all', which refers to all the views (profiles) that user has access to.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "start-index": { |
| // "description": "An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.", |
| // "format": "int32", |
| // "location": "query", |
| // "minimum": "1", |
| // "type": "integer" |
| // }, |
| // "webPropertyId": { |
| // "description": "Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals", |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/analytics", |
| // "https://www.googleapis.com/auth/analytics.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // method id "analytics.management.profiles.list": |
| |
| type ManagementProfilesListCall struct { |
| s *Service |
| accountId string |
| webPropertyId string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // List: Lists views (profiles) to which the user has access. |
| func (r *ManagementProfilesService) List(accountId string, webPropertyId string) *ManagementProfilesListCall { |
| c := &ManagementProfilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.accountId = accountId |
| c.webPropertyId = webPropertyId |
| return c |
| } |
| |
| // MaxResults sets the optional parameter "max-results": The maximum |
| // number of views (profiles) to include in this response. |
| func (c *ManagementProfilesListCall) MaxResults(maxResults int64) *ManagementProfilesListCall { |
| c.urlParams_.Set("max-results", fmt.Sprint(maxResults)) |
| return c |
| } |
| |
| // StartIndex sets the optional parameter "start-index": An index of the |
| // first entity to retrieve. Use this parameter as a pagination |
| // mechanism along with the max-results parameter. |
| func (c *ManagementProfilesListCall) StartIndex(startIndex int64) *ManagementProfilesListCall { |
| c.urlParams_.Set("start-index", fmt.Sprint(startIndex)) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ManagementProfilesListCall) Fields(s ...googleapi.Field) *ManagementProfilesListCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *ManagementProfilesListCall) IfNoneMatch(entityTag string) *ManagementProfilesListCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ManagementProfilesListCall) Context(ctx context.Context) *ManagementProfilesListCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ManagementProfilesListCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ManagementProfilesListCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191117") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "accountId": c.accountId, |
| "webPropertyId": c.webPropertyId, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "analytics.management.profiles.list" call. |
| func (c *ManagementProfilesListCall) Do(opts ...googleapi.CallOption) error { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if err != nil { |
| return err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return err |
| } |
| return nil |
| // { |
| // "description": "Lists views (profiles) to which the user has access.", |
| // "httpMethod": "GET", |
| // "id": "analytics.management.profiles.list", |
| // "parameterOrder": [ |
| // "accountId", |
| // "webPropertyId" |
| // ], |
| // "parameters": { |
| // "accountId": { |
| // "description": "Account ID for the views (profiles) to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "max-results": { |
| // "description": "The maximum number of views (profiles) to include in this response.", |
| // "format": "int32", |
| // "location": "query", |
| // "type": "integer" |
| // }, |
| // "start-index": { |
| // "description": "An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.", |
| // "format": "int32", |
| // "location": "query", |
| // "minimum": "1", |
| // "type": "integer" |
| // }, |
| // "webPropertyId": { |
| // "description": "Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles", |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/analytics", |
| // "https://www.googleapis.com/auth/analytics.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // method id "analytics.management.segments.list": |
| |
| type ManagementSegmentsListCall struct { |
| s *Service |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // List: Lists advanced segments to which the user has access. |
| func (r *ManagementSegmentsService) List() *ManagementSegmentsListCall { |
| c := &ManagementSegmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| return c |
| } |
| |
| // MaxResults sets the optional parameter "max-results": The maximum |
| // number of advanced segments to include in this response. |
| func (c *ManagementSegmentsListCall) MaxResults(maxResults int64) *ManagementSegmentsListCall { |
| c.urlParams_.Set("max-results", fmt.Sprint(maxResults)) |
| return c |
| } |
| |
| // StartIndex sets the optional parameter "start-index": An index of the |
| // first advanced segment to retrieve. Use this parameter as a |
| // pagination mechanism along with the max-results parameter. |
| func (c *ManagementSegmentsListCall) StartIndex(startIndex int64) *ManagementSegmentsListCall { |
| c.urlParams_.Set("start-index", fmt.Sprint(startIndex)) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ManagementSegmentsListCall) Fields(s ...googleapi.Field) *ManagementSegmentsListCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *ManagementSegmentsListCall) IfNoneMatch(entityTag string) *ManagementSegmentsListCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ManagementSegmentsListCall) Context(ctx context.Context) *ManagementSegmentsListCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ManagementSegmentsListCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ManagementSegmentsListCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191117") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "management/segments") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "analytics.management.segments.list" call. |
| func (c *ManagementSegmentsListCall) Do(opts ...googleapi.CallOption) error { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if err != nil { |
| return err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return err |
| } |
| return nil |
| // { |
| // "description": "Lists advanced segments to which the user has access.", |
| // "httpMethod": "GET", |
| // "id": "analytics.management.segments.list", |
| // "parameters": { |
| // "max-results": { |
| // "description": "The maximum number of advanced segments to include in this response.", |
| // "format": "int32", |
| // "location": "query", |
| // "type": "integer" |
| // }, |
| // "start-index": { |
| // "description": "An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.", |
| // "format": "int32", |
| // "location": "query", |
| // "minimum": "1", |
| // "type": "integer" |
| // } |
| // }, |
| // "path": "management/segments", |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/analytics", |
| // "https://www.googleapis.com/auth/analytics.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // method id "analytics.management.webproperties.list": |
| |
| type ManagementWebpropertiesListCall struct { |
| s *Service |
| accountId string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // List: Lists web properties to which the user has access. |
| func (r *ManagementWebpropertiesService) List(accountId string) *ManagementWebpropertiesListCall { |
| c := &ManagementWebpropertiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.accountId = accountId |
| return c |
| } |
| |
| // MaxResults sets the optional parameter "max-results": The maximum |
| // number of web properties to include in this response. |
| func (c *ManagementWebpropertiesListCall) MaxResults(maxResults int64) *ManagementWebpropertiesListCall { |
| c.urlParams_.Set("max-results", fmt.Sprint(maxResults)) |
| return c |
| } |
| |
| // StartIndex sets the optional parameter "start-index": An index of the |
| // first entity to retrieve. Use this parameter as a pagination |
| // mechanism along with the max-results parameter. |
| func (c *ManagementWebpropertiesListCall) StartIndex(startIndex int64) *ManagementWebpropertiesListCall { |
| c.urlParams_.Set("start-index", fmt.Sprint(startIndex)) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ManagementWebpropertiesListCall) Fields(s ...googleapi.Field) *ManagementWebpropertiesListCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *ManagementWebpropertiesListCall) IfNoneMatch(entityTag string) *ManagementWebpropertiesListCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ManagementWebpropertiesListCall) Context(ctx context.Context) *ManagementWebpropertiesListCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ManagementWebpropertiesListCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ManagementWebpropertiesListCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191117") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts/{accountId}/webproperties") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "accountId": c.accountId, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "analytics.management.webproperties.list" call. |
| func (c *ManagementWebpropertiesListCall) Do(opts ...googleapi.CallOption) error { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if err != nil { |
| return err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return err |
| } |
| return nil |
| // { |
| // "description": "Lists web properties to which the user has access.", |
| // "httpMethod": "GET", |
| // "id": "analytics.management.webproperties.list", |
| // "parameterOrder": [ |
| // "accountId" |
| // ], |
| // "parameters": { |
| // "accountId": { |
| // "description": "Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "max-results": { |
| // "description": "The maximum number of web properties to include in this response.", |
| // "format": "int32", |
| // "location": "query", |
| // "type": "integer" |
| // }, |
| // "start-index": { |
| // "description": "An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.", |
| // "format": "int32", |
| // "location": "query", |
| // "minimum": "1", |
| // "type": "integer" |
| // } |
| // }, |
| // "path": "management/accounts/{accountId}/webproperties", |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/analytics", |
| // "https://www.googleapis.com/auth/analytics.readonly" |
| // ] |
| // } |
| |
| } |