123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998 |
- // Package analytics provides access to the Google Analytics API.
- //
- // See https://developers.google.com/analytics/
- //
- // Usage example:
- //
- // import "google.golang.org/api/analytics/v2.4"
- // ...
- // analyticsService, err := analytics.New(oauthHttpClient)
- package analytics // import "google.golang.org/api/analytics/v2.4"
- import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- context "golang.org/x/net/context"
- ctxhttp "golang.org/x/net/context/ctxhttp"
- gensupport "google.golang.org/api/gensupport"
- googleapi "google.golang.org/api/googleapi"
- "io"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- )
- // 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
- var _ = ctxhttp.Do
- 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"
- )
- 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
- }
- // 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
- }
- func (c *DataGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "data")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(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
- }
- // 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
- }
- func (c *ManagementAccountsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(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
- }
- // 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
- }
- func (c *ManagementGoalsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "accountId": c.accountId,
- "webPropertyId": c.webPropertyId,
- "profileId": c.profileId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(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
- }
- // 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
- }
- func (c *ManagementProfilesListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "accountId": c.accountId,
- "webPropertyId": c.webPropertyId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(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
- }
- // 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
- }
- func (c *ManagementSegmentsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "management/segments")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(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
- }
- // 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
- }
- func (c *ManagementWebpropertiesListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts/{accountId}/webproperties")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "accountId": c.accountId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(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"
- // ]
- // }
- }
|