You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1152 lines
37 KiB

  1. // Copyright 2019 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. // Code generated file. DO NOT EDIT.
  5. // Package analytics provides access to the Google Analytics API.
  6. //
  7. // For product documentation, see: https://developers.google.com/analytics/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/analytics/v2.4"
  14. // ...
  15. // ctx := context.Background()
  16. // analyticsService, err := analytics.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // analyticsService, err := analytics.NewService(ctx, option.WithScopes(analytics.AnalyticsReadonlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // analyticsService, err := analytics.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // analyticsService, err := analytics.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package analytics // import "google.golang.org/api/analytics/v2.4"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "analytics:v2.4"
  71. const apiName = "analytics"
  72. const apiVersion = "v2.4"
  73. const basePath = "https://www.googleapis.com/analytics/v2.4/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage your Google Analytics data
  77. AnalyticsScope = "https://www.googleapis.com/auth/analytics"
  78. // View your Google Analytics data
  79. AnalyticsReadonlyScope = "https://www.googleapis.com/auth/analytics.readonly"
  80. )
  81. // NewService creates a new Service.
  82. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  83. scopesOption := option.WithScopes(
  84. "https://www.googleapis.com/auth/analytics",
  85. "https://www.googleapis.com/auth/analytics.readonly",
  86. )
  87. // NOTE: prepend, so we don't override user-specified scopes.
  88. opts = append([]option.ClientOption{scopesOption}, opts...)
  89. client, endpoint, err := htransport.NewClient(ctx, opts...)
  90. if err != nil {
  91. return nil, err
  92. }
  93. s, err := New(client)
  94. if err != nil {
  95. return nil, err
  96. }
  97. if endpoint != "" {
  98. s.BasePath = endpoint
  99. }
  100. return s, nil
  101. }
  102. // New creates a new Service. It uses the provided http.Client for requests.
  103. //
  104. // Deprecated: please use NewService instead.
  105. // To provide a custom HTTP client, use option.WithHTTPClient.
  106. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  107. func New(client *http.Client) (*Service, error) {
  108. if client == nil {
  109. return nil, errors.New("client is nil")
  110. }
  111. s := &Service{client: client, BasePath: basePath}
  112. s.Data = NewDataService(s)
  113. s.Management = NewManagementService(s)
  114. return s, nil
  115. }
  116. type Service struct {
  117. client *http.Client
  118. BasePath string // API endpoint base URL
  119. UserAgent string // optional additional User-Agent fragment
  120. Data *DataService
  121. Management *ManagementService
  122. }
  123. func (s *Service) userAgent() string {
  124. if s.UserAgent == "" {
  125. return googleapi.UserAgent
  126. }
  127. return googleapi.UserAgent + " " + s.UserAgent
  128. }
  129. func NewDataService(s *Service) *DataService {
  130. rs := &DataService{s: s}
  131. return rs
  132. }
  133. type DataService struct {
  134. s *Service
  135. }
  136. func NewManagementService(s *Service) *ManagementService {
  137. rs := &ManagementService{s: s}
  138. rs.Accounts = NewManagementAccountsService(s)
  139. rs.Goals = NewManagementGoalsService(s)
  140. rs.Profiles = NewManagementProfilesService(s)
  141. rs.Segments = NewManagementSegmentsService(s)
  142. rs.Webproperties = NewManagementWebpropertiesService(s)
  143. return rs
  144. }
  145. type ManagementService struct {
  146. s *Service
  147. Accounts *ManagementAccountsService
  148. Goals *ManagementGoalsService
  149. Profiles *ManagementProfilesService
  150. Segments *ManagementSegmentsService
  151. Webproperties *ManagementWebpropertiesService
  152. }
  153. func NewManagementAccountsService(s *Service) *ManagementAccountsService {
  154. rs := &ManagementAccountsService{s: s}
  155. return rs
  156. }
  157. type ManagementAccountsService struct {
  158. s *Service
  159. }
  160. func NewManagementGoalsService(s *Service) *ManagementGoalsService {
  161. rs := &ManagementGoalsService{s: s}
  162. return rs
  163. }
  164. type ManagementGoalsService struct {
  165. s *Service
  166. }
  167. func NewManagementProfilesService(s *Service) *ManagementProfilesService {
  168. rs := &ManagementProfilesService{s: s}
  169. return rs
  170. }
  171. type ManagementProfilesService struct {
  172. s *Service
  173. }
  174. func NewManagementSegmentsService(s *Service) *ManagementSegmentsService {
  175. rs := &ManagementSegmentsService{s: s}
  176. return rs
  177. }
  178. type ManagementSegmentsService struct {
  179. s *Service
  180. }
  181. func NewManagementWebpropertiesService(s *Service) *ManagementWebpropertiesService {
  182. rs := &ManagementWebpropertiesService{s: s}
  183. return rs
  184. }
  185. type ManagementWebpropertiesService struct {
  186. s *Service
  187. }
  188. // method id "analytics.data.get":
  189. type DataGetCall struct {
  190. s *Service
  191. urlParams_ gensupport.URLParams
  192. ifNoneMatch_ string
  193. ctx_ context.Context
  194. header_ http.Header
  195. }
  196. // Get: Returns Analytics report data for a view (profile).
  197. func (r *DataService) Get(ids string, startDate string, endDate string, metrics string) *DataGetCall {
  198. c := &DataGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  199. c.urlParams_.Set("ids", ids)
  200. c.urlParams_.Set("start-date", startDate)
  201. c.urlParams_.Set("end-date", endDate)
  202. c.urlParams_.Set("metrics", metrics)
  203. return c
  204. }
  205. // Dimensions sets the optional parameter "dimensions": A
  206. // comma-separated list of Analytics dimensions. E.g.,
  207. // 'ga:browser,ga:city'.
  208. func (c *DataGetCall) Dimensions(dimensions string) *DataGetCall {
  209. c.urlParams_.Set("dimensions", dimensions)
  210. return c
  211. }
  212. // Filters sets the optional parameter "filters": A comma-separated list
  213. // of dimension or metric filters to be applied to the report data.
  214. func (c *DataGetCall) Filters(filters string) *DataGetCall {
  215. c.urlParams_.Set("filters", filters)
  216. return c
  217. }
  218. // MaxResults sets the optional parameter "max-results": The maximum
  219. // number of entries to include in this feed.
  220. func (c *DataGetCall) MaxResults(maxResults int64) *DataGetCall {
  221. c.urlParams_.Set("max-results", fmt.Sprint(maxResults))
  222. return c
  223. }
  224. // Segment sets the optional parameter "segment": An Analytics advanced
  225. // segment to be applied to the report data.
  226. func (c *DataGetCall) Segment(segment string) *DataGetCall {
  227. c.urlParams_.Set("segment", segment)
  228. return c
  229. }
  230. // Sort sets the optional parameter "sort": A comma-separated list of
  231. // dimensions or metrics that determine the sort order for the report
  232. // data.
  233. func (c *DataGetCall) Sort(sort string) *DataGetCall {
  234. c.urlParams_.Set("sort", sort)
  235. return c
  236. }
  237. // StartIndex sets the optional parameter "start-index": An index of the
  238. // first entity to retrieve. Use this parameter as a pagination
  239. // mechanism along with the max-results parameter.
  240. func (c *DataGetCall) StartIndex(startIndex int64) *DataGetCall {
  241. c.urlParams_.Set("start-index", fmt.Sprint(startIndex))
  242. return c
  243. }
  244. // Fields allows partial responses to be retrieved. See
  245. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  246. // for more information.
  247. func (c *DataGetCall) Fields(s ...googleapi.Field) *DataGetCall {
  248. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  249. return c
  250. }
  251. // IfNoneMatch sets the optional parameter which makes the operation
  252. // fail if the object's ETag matches the given value. This is useful for
  253. // getting updates only after the object has changed since the last
  254. // request. Use googleapi.IsNotModified to check whether the response
  255. // error from Do is the result of In-None-Match.
  256. func (c *DataGetCall) IfNoneMatch(entityTag string) *DataGetCall {
  257. c.ifNoneMatch_ = entityTag
  258. return c
  259. }
  260. // Context sets the context to be used in this call's Do method. Any
  261. // pending HTTP request will be aborted if the provided context is
  262. // canceled.
  263. func (c *DataGetCall) Context(ctx context.Context) *DataGetCall {
  264. c.ctx_ = ctx
  265. return c
  266. }
  267. // Header returns an http.Header that can be modified by the caller to
  268. // add HTTP headers to the request.
  269. func (c *DataGetCall) Header() http.Header {
  270. if c.header_ == nil {
  271. c.header_ = make(http.Header)
  272. }
  273. return c.header_
  274. }
  275. func (c *DataGetCall) doRequest(alt string) (*http.Response, error) {
  276. reqHeaders := make(http.Header)
  277. for k, v := range c.header_ {
  278. reqHeaders[k] = v
  279. }
  280. reqHeaders.Set("User-Agent", c.s.userAgent())
  281. if c.ifNoneMatch_ != "" {
  282. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  283. }
  284. var body io.Reader = nil
  285. c.urlParams_.Set("alt", alt)
  286. c.urlParams_.Set("prettyPrint", "false")
  287. urls := googleapi.ResolveRelative(c.s.BasePath, "data")
  288. urls += "?" + c.urlParams_.Encode()
  289. req, err := http.NewRequest("GET", urls, body)
  290. if err != nil {
  291. return nil, err
  292. }
  293. req.Header = reqHeaders
  294. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  295. }
  296. // Do executes the "analytics.data.get" call.
  297. func (c *DataGetCall) Do(opts ...googleapi.CallOption) error {
  298. gensupport.SetOptions(c.urlParams_, opts...)
  299. res, err := c.doRequest("json")
  300. if err != nil {
  301. return err
  302. }
  303. defer googleapi.CloseBody(res)
  304. if err := googleapi.CheckResponse(res); err != nil {
  305. return err
  306. }
  307. return nil
  308. // {
  309. // "description": "Returns Analytics report data for a view (profile).",
  310. // "httpMethod": "GET",
  311. // "id": "analytics.data.get",
  312. // "parameterOrder": [
  313. // "ids",
  314. // "start-date",
  315. // "end-date",
  316. // "metrics"
  317. // ],
  318. // "parameters": {
  319. // "dimensions": {
  320. // "description": "A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'.",
  321. // "location": "query",
  322. // "pattern": "(ga:.+)?",
  323. // "type": "string"
  324. // },
  325. // "end-date": {
  326. // "description": "End date for fetching report data. All requests should specify an end date formatted as YYYY-MM-DD.",
  327. // "location": "query",
  328. // "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{2}",
  329. // "required": true,
  330. // "type": "string"
  331. // },
  332. // "filters": {
  333. // "description": "A comma-separated list of dimension or metric filters to be applied to the report data.",
  334. // "location": "query",
  335. // "pattern": "ga:.+",
  336. // "type": "string"
  337. // },
  338. // "ids": {
  339. // "description": "Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.",
  340. // "location": "query",
  341. // "pattern": "ga:[0-9]+",
  342. // "required": true,
  343. // "type": "string"
  344. // },
  345. // "max-results": {
  346. // "description": "The maximum number of entries to include in this feed.",
  347. // "format": "int32",
  348. // "location": "query",
  349. // "type": "integer"
  350. // },
  351. // "metrics": {
  352. // "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.",
  353. // "location": "query",
  354. // "pattern": "ga:.+",
  355. // "required": true,
  356. // "type": "string"
  357. // },
  358. // "segment": {
  359. // "description": "An Analytics advanced segment to be applied to the report data.",
  360. // "location": "query",
  361. // "type": "string"
  362. // },
  363. // "sort": {
  364. // "description": "A comma-separated list of dimensions or metrics that determine the sort order for the report data.",
  365. // "location": "query",
  366. // "pattern": "(-)?ga:.+",
  367. // "type": "string"
  368. // },
  369. // "start-date": {
  370. // "description": "Start date for fetching report data. All requests should specify a start date formatted as YYYY-MM-DD.",
  371. // "location": "query",
  372. // "pattern": "[0-9]{4}-[0-9]{2}-[0-9]{2}",
  373. // "required": true,
  374. // "type": "string"
  375. // },
  376. // "start-index": {
  377. // "description": "An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.",
  378. // "format": "int32",
  379. // "location": "query",
  380. // "minimum": "1",
  381. // "type": "integer"
  382. // }
  383. // },
  384. // "path": "data",
  385. // "scopes": [
  386. // "https://www.googleapis.com/auth/analytics",
  387. // "https://www.googleapis.com/auth/analytics.readonly"
  388. // ]
  389. // }
  390. }
  391. // method id "analytics.management.accounts.list":
  392. type ManagementAccountsListCall struct {
  393. s *Service
  394. urlParams_ gensupport.URLParams
  395. ifNoneMatch_ string
  396. ctx_ context.Context
  397. header_ http.Header
  398. }
  399. // List: Lists all accounts to which the user has access.
  400. func (r *ManagementAccountsService) List() *ManagementAccountsListCall {
  401. c := &ManagementAccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  402. return c
  403. }
  404. // MaxResults sets the optional parameter "max-results": The maximum
  405. // number of accounts to include in this response.
  406. func (c *ManagementAccountsListCall) MaxResults(maxResults int64) *ManagementAccountsListCall {
  407. c.urlParams_.Set("max-results", fmt.Sprint(maxResults))
  408. return c
  409. }
  410. // StartIndex sets the optional parameter "start-index": An index of the
  411. // first account to retrieve. Use this parameter as a pagination
  412. // mechanism along with the max-results parameter.
  413. func (c *ManagementAccountsListCall) StartIndex(startIndex int64) *ManagementAccountsListCall {
  414. c.urlParams_.Set("start-index", fmt.Sprint(startIndex))
  415. return c
  416. }
  417. // Fields allows partial responses to be retrieved. See
  418. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  419. // for more information.
  420. func (c *ManagementAccountsListCall) Fields(s ...googleapi.Field) *ManagementAccountsListCall {
  421. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  422. return c
  423. }
  424. // IfNoneMatch sets the optional parameter which makes the operation
  425. // fail if the object's ETag matches the given value. This is useful for
  426. // getting updates only after the object has changed since the last
  427. // request. Use googleapi.IsNotModified to check whether the response
  428. // error from Do is the result of In-None-Match.
  429. func (c *ManagementAccountsListCall) IfNoneMatch(entityTag string) *ManagementAccountsListCall {
  430. c.ifNoneMatch_ = entityTag
  431. return c
  432. }
  433. // Context sets the context to be used in this call's Do method. Any
  434. // pending HTTP request will be aborted if the provided context is
  435. // canceled.
  436. func (c *ManagementAccountsListCall) Context(ctx context.Context) *ManagementAccountsListCall {
  437. c.ctx_ = ctx
  438. return c
  439. }
  440. // Header returns an http.Header that can be modified by the caller to
  441. // add HTTP headers to the request.
  442. func (c *ManagementAccountsListCall) Header() http.Header {
  443. if c.header_ == nil {
  444. c.header_ = make(http.Header)
  445. }
  446. return c.header_
  447. }
  448. func (c *ManagementAccountsListCall) doRequest(alt string) (*http.Response, error) {
  449. reqHeaders := make(http.Header)
  450. for k, v := range c.header_ {
  451. reqHeaders[k] = v
  452. }
  453. reqHeaders.Set("User-Agent", c.s.userAgent())
  454. if c.ifNoneMatch_ != "" {
  455. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  456. }
  457. var body io.Reader = nil
  458. c.urlParams_.Set("alt", alt)
  459. c.urlParams_.Set("prettyPrint", "false")
  460. urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts")
  461. urls += "?" + c.urlParams_.Encode()
  462. req, err := http.NewRequest("GET", urls, body)
  463. if err != nil {
  464. return nil, err
  465. }
  466. req.Header = reqHeaders
  467. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  468. }
  469. // Do executes the "analytics.management.accounts.list" call.
  470. func (c *ManagementAccountsListCall) Do(opts ...googleapi.CallOption) error {
  471. gensupport.SetOptions(c.urlParams_, opts...)
  472. res, err := c.doRequest("json")
  473. if err != nil {
  474. return err
  475. }
  476. defer googleapi.CloseBody(res)
  477. if err := googleapi.CheckResponse(res); err != nil {
  478. return err
  479. }
  480. return nil
  481. // {
  482. // "description": "Lists all accounts to which the user has access.",
  483. // "httpMethod": "GET",
  484. // "id": "analytics.management.accounts.list",
  485. // "parameters": {
  486. // "max-results": {
  487. // "description": "The maximum number of accounts to include in this response.",
  488. // "format": "int32",
  489. // "location": "query",
  490. // "type": "integer"
  491. // },
  492. // "start-index": {
  493. // "description": "An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.",
  494. // "format": "int32",
  495. // "location": "query",
  496. // "minimum": "1",
  497. // "type": "integer"
  498. // }
  499. // },
  500. // "path": "management/accounts",
  501. // "scopes": [
  502. // "https://www.googleapis.com/auth/analytics",
  503. // "https://www.googleapis.com/auth/analytics.readonly"
  504. // ]
  505. // }
  506. }
  507. // method id "analytics.management.goals.list":
  508. type ManagementGoalsListCall struct {
  509. s *Service
  510. accountId string
  511. webPropertyId string
  512. profileId string
  513. urlParams_ gensupport.URLParams
  514. ifNoneMatch_ string
  515. ctx_ context.Context
  516. header_ http.Header
  517. }
  518. // List: Lists goals to which the user has access.
  519. func (r *ManagementGoalsService) List(accountId string, webPropertyId string, profileId string) *ManagementGoalsListCall {
  520. c := &ManagementGoalsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  521. c.accountId = accountId
  522. c.webPropertyId = webPropertyId
  523. c.profileId = profileId
  524. return c
  525. }
  526. // MaxResults sets the optional parameter "max-results": The maximum
  527. // number of goals to include in this response.
  528. func (c *ManagementGoalsListCall) MaxResults(maxResults int64) *ManagementGoalsListCall {
  529. c.urlParams_.Set("max-results", fmt.Sprint(maxResults))
  530. return c
  531. }
  532. // StartIndex sets the optional parameter "start-index": An index of the
  533. // first goal to retrieve. Use this parameter as a pagination mechanism
  534. // along with the max-results parameter.
  535. func (c *ManagementGoalsListCall) StartIndex(startIndex int64) *ManagementGoalsListCall {
  536. c.urlParams_.Set("start-index", fmt.Sprint(startIndex))
  537. return c
  538. }
  539. // Fields allows partial responses to be retrieved. See
  540. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  541. // for more information.
  542. func (c *ManagementGoalsListCall) Fields(s ...googleapi.Field) *ManagementGoalsListCall {
  543. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  544. return c
  545. }
  546. // IfNoneMatch sets the optional parameter which makes the operation
  547. // fail if the object's ETag matches the given value. This is useful for
  548. // getting updates only after the object has changed since the last
  549. // request. Use googleapi.IsNotModified to check whether the response
  550. // error from Do is the result of In-None-Match.
  551. func (c *ManagementGoalsListCall) IfNoneMatch(entityTag string) *ManagementGoalsListCall {
  552. c.ifNoneMatch_ = entityTag
  553. return c
  554. }
  555. // Context sets the context to be used in this call's Do method. Any
  556. // pending HTTP request will be aborted if the provided context is
  557. // canceled.
  558. func (c *ManagementGoalsListCall) Context(ctx context.Context) *ManagementGoalsListCall {
  559. c.ctx_ = ctx
  560. return c
  561. }
  562. // Header returns an http.Header that can be modified by the caller to
  563. // add HTTP headers to the request.
  564. func (c *ManagementGoalsListCall) Header() http.Header {
  565. if c.header_ == nil {
  566. c.header_ = make(http.Header)
  567. }
  568. return c.header_
  569. }
  570. func (c *ManagementGoalsListCall) doRequest(alt string) (*http.Response, error) {
  571. reqHeaders := make(http.Header)
  572. for k, v := range c.header_ {
  573. reqHeaders[k] = v
  574. }
  575. reqHeaders.Set("User-Agent", c.s.userAgent())
  576. if c.ifNoneMatch_ != "" {
  577. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  578. }
  579. var body io.Reader = nil
  580. c.urlParams_.Set("alt", alt)
  581. c.urlParams_.Set("prettyPrint", "false")
  582. urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals")
  583. urls += "?" + c.urlParams_.Encode()
  584. req, err := http.NewRequest("GET", urls, body)
  585. if err != nil {
  586. return nil, err
  587. }
  588. req.Header = reqHeaders
  589. googleapi.Expand(req.URL, map[string]string{
  590. "accountId": c.accountId,
  591. "webPropertyId": c.webPropertyId,
  592. "profileId": c.profileId,
  593. })
  594. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  595. }
  596. // Do executes the "analytics.management.goals.list" call.
  597. func (c *ManagementGoalsListCall) Do(opts ...googleapi.CallOption) error {
  598. gensupport.SetOptions(c.urlParams_, opts...)
  599. res, err := c.doRequest("json")
  600. if err != nil {
  601. return err
  602. }
  603. defer googleapi.CloseBody(res)
  604. if err := googleapi.CheckResponse(res); err != nil {
  605. return err
  606. }
  607. return nil
  608. // {
  609. // "description": "Lists goals to which the user has access.",
  610. // "httpMethod": "GET",
  611. // "id": "analytics.management.goals.list",
  612. // "parameterOrder": [
  613. // "accountId",
  614. // "webPropertyId",
  615. // "profileId"
  616. // ],
  617. // "parameters": {
  618. // "accountId": {
  619. // "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.",
  620. // "location": "path",
  621. // "required": true,
  622. // "type": "string"
  623. // },
  624. // "max-results": {
  625. // "description": "The maximum number of goals to include in this response.",
  626. // "format": "int32",
  627. // "location": "query",
  628. // "type": "integer"
  629. // },
  630. // "profileId": {
  631. // "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.",
  632. // "location": "path",
  633. // "required": true,
  634. // "type": "string"
  635. // },
  636. // "start-index": {
  637. // "description": "An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.",
  638. // "format": "int32",
  639. // "location": "query",
  640. // "minimum": "1",
  641. // "type": "integer"
  642. // },
  643. // "webPropertyId": {
  644. // "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.",
  645. // "location": "path",
  646. // "required": true,
  647. // "type": "string"
  648. // }
  649. // },
  650. // "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals",
  651. // "scopes": [
  652. // "https://www.googleapis.com/auth/analytics",
  653. // "https://www.googleapis.com/auth/analytics.readonly"
  654. // ]
  655. // }
  656. }
  657. // method id "analytics.management.profiles.list":
  658. type ManagementProfilesListCall struct {
  659. s *Service
  660. accountId string
  661. webPropertyId string
  662. urlParams_ gensupport.URLParams
  663. ifNoneMatch_ string
  664. ctx_ context.Context
  665. header_ http.Header
  666. }
  667. // List: Lists views (profiles) to which the user has access.
  668. func (r *ManagementProfilesService) List(accountId string, webPropertyId string) *ManagementProfilesListCall {
  669. c := &ManagementProfilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  670. c.accountId = accountId
  671. c.webPropertyId = webPropertyId
  672. return c
  673. }
  674. // MaxResults sets the optional parameter "max-results": The maximum
  675. // number of views (profiles) to include in this response.
  676. func (c *ManagementProfilesListCall) MaxResults(maxResults int64) *ManagementProfilesListCall {
  677. c.urlParams_.Set("max-results", fmt.Sprint(maxResults))
  678. return c
  679. }
  680. // StartIndex sets the optional parameter "start-index": An index of the
  681. // first entity to retrieve. Use this parameter as a pagination
  682. // mechanism along with the max-results parameter.
  683. func (c *ManagementProfilesListCall) StartIndex(startIndex int64) *ManagementProfilesListCall {
  684. c.urlParams_.Set("start-index", fmt.Sprint(startIndex))
  685. return c
  686. }
  687. // Fields allows partial responses to be retrieved. See
  688. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  689. // for more information.
  690. func (c *ManagementProfilesListCall) Fields(s ...googleapi.Field) *ManagementProfilesListCall {
  691. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  692. return c
  693. }
  694. // IfNoneMatch sets the optional parameter which makes the operation
  695. // fail if the object's ETag matches the given value. This is useful for
  696. // getting updates only after the object has changed since the last
  697. // request. Use googleapi.IsNotModified to check whether the response
  698. // error from Do is the result of In-None-Match.
  699. func (c *ManagementProfilesListCall) IfNoneMatch(entityTag string) *ManagementProfilesListCall {
  700. c.ifNoneMatch_ = entityTag
  701. return c
  702. }
  703. // Context sets the context to be used in this call's Do method. Any
  704. // pending HTTP request will be aborted if the provided context is
  705. // canceled.
  706. func (c *ManagementProfilesListCall) Context(ctx context.Context) *ManagementProfilesListCall {
  707. c.ctx_ = ctx
  708. return c
  709. }
  710. // Header returns an http.Header that can be modified by the caller to
  711. // add HTTP headers to the request.
  712. func (c *ManagementProfilesListCall) Header() http.Header {
  713. if c.header_ == nil {
  714. c.header_ = make(http.Header)
  715. }
  716. return c.header_
  717. }
  718. func (c *ManagementProfilesListCall) doRequest(alt string) (*http.Response, error) {
  719. reqHeaders := make(http.Header)
  720. for k, v := range c.header_ {
  721. reqHeaders[k] = v
  722. }
  723. reqHeaders.Set("User-Agent", c.s.userAgent())
  724. if c.ifNoneMatch_ != "" {
  725. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  726. }
  727. var body io.Reader = nil
  728. c.urlParams_.Set("alt", alt)
  729. c.urlParams_.Set("prettyPrint", "false")
  730. urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles")
  731. urls += "?" + c.urlParams_.Encode()
  732. req, err := http.NewRequest("GET", urls, body)
  733. if err != nil {
  734. return nil, err
  735. }
  736. req.Header = reqHeaders
  737. googleapi.Expand(req.URL, map[string]string{
  738. "accountId": c.accountId,
  739. "webPropertyId": c.webPropertyId,
  740. })
  741. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  742. }
  743. // Do executes the "analytics.management.profiles.list" call.
  744. func (c *ManagementProfilesListCall) Do(opts ...googleapi.CallOption) error {
  745. gensupport.SetOptions(c.urlParams_, opts...)
  746. res, err := c.doRequest("json")
  747. if err != nil {
  748. return err
  749. }
  750. defer googleapi.CloseBody(res)
  751. if err := googleapi.CheckResponse(res); err != nil {
  752. return err
  753. }
  754. return nil
  755. // {
  756. // "description": "Lists views (profiles) to which the user has access.",
  757. // "httpMethod": "GET",
  758. // "id": "analytics.management.profiles.list",
  759. // "parameterOrder": [
  760. // "accountId",
  761. // "webPropertyId"
  762. // ],
  763. // "parameters": {
  764. // "accountId": {
  765. // "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.",
  766. // "location": "path",
  767. // "required": true,
  768. // "type": "string"
  769. // },
  770. // "max-results": {
  771. // "description": "The maximum number of views (profiles) to include in this response.",
  772. // "format": "int32",
  773. // "location": "query",
  774. // "type": "integer"
  775. // },
  776. // "start-index": {
  777. // "description": "An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.",
  778. // "format": "int32",
  779. // "location": "query",
  780. // "minimum": "1",
  781. // "type": "integer"
  782. // },
  783. // "webPropertyId": {
  784. // "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.",
  785. // "location": "path",
  786. // "required": true,
  787. // "type": "string"
  788. // }
  789. // },
  790. // "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles",
  791. // "scopes": [
  792. // "https://www.googleapis.com/auth/analytics",
  793. // "https://www.googleapis.com/auth/analytics.readonly"
  794. // ]
  795. // }
  796. }
  797. // method id "analytics.management.segments.list":
  798. type ManagementSegmentsListCall struct {
  799. s *Service
  800. urlParams_ gensupport.URLParams
  801. ifNoneMatch_ string
  802. ctx_ context.Context
  803. header_ http.Header
  804. }
  805. // List: Lists advanced segments to which the user has access.
  806. func (r *ManagementSegmentsService) List() *ManagementSegmentsListCall {
  807. c := &ManagementSegmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  808. return c
  809. }
  810. // MaxResults sets the optional parameter "max-results": The maximum
  811. // number of advanced segments to include in this response.
  812. func (c *ManagementSegmentsListCall) MaxResults(maxResults int64) *ManagementSegmentsListCall {
  813. c.urlParams_.Set("max-results", fmt.Sprint(maxResults))
  814. return c
  815. }
  816. // StartIndex sets the optional parameter "start-index": An index of the
  817. // first advanced segment to retrieve. Use this parameter as a
  818. // pagination mechanism along with the max-results parameter.
  819. func (c *ManagementSegmentsListCall) StartIndex(startIndex int64) *ManagementSegmentsListCall {
  820. c.urlParams_.Set("start-index", fmt.Sprint(startIndex))
  821. return c
  822. }
  823. // Fields allows partial responses to be retrieved. See
  824. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  825. // for more information.
  826. func (c *ManagementSegmentsListCall) Fields(s ...googleapi.Field) *ManagementSegmentsListCall {
  827. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  828. return c
  829. }
  830. // IfNoneMatch sets the optional parameter which makes the operation
  831. // fail if the object's ETag matches the given value. This is useful for
  832. // getting updates only after the object has changed since the last
  833. // request. Use googleapi.IsNotModified to check whether the response
  834. // error from Do is the result of In-None-Match.
  835. func (c *ManagementSegmentsListCall) IfNoneMatch(entityTag string) *ManagementSegmentsListCall {
  836. c.ifNoneMatch_ = entityTag
  837. return c
  838. }
  839. // Context sets the context to be used in this call's Do method. Any
  840. // pending HTTP request will be aborted if the provided context is
  841. // canceled.
  842. func (c *ManagementSegmentsListCall) Context(ctx context.Context) *ManagementSegmentsListCall {
  843. c.ctx_ = ctx
  844. return c
  845. }
  846. // Header returns an http.Header that can be modified by the caller to
  847. // add HTTP headers to the request.
  848. func (c *ManagementSegmentsListCall) Header() http.Header {
  849. if c.header_ == nil {
  850. c.header_ = make(http.Header)
  851. }
  852. return c.header_
  853. }
  854. func (c *ManagementSegmentsListCall) doRequest(alt string) (*http.Response, error) {
  855. reqHeaders := make(http.Header)
  856. for k, v := range c.header_ {
  857. reqHeaders[k] = v
  858. }
  859. reqHeaders.Set("User-Agent", c.s.userAgent())
  860. if c.ifNoneMatch_ != "" {
  861. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  862. }
  863. var body io.Reader = nil
  864. c.urlParams_.Set("alt", alt)
  865. c.urlParams_.Set("prettyPrint", "false")
  866. urls := googleapi.ResolveRelative(c.s.BasePath, "management/segments")
  867. urls += "?" + c.urlParams_.Encode()
  868. req, err := http.NewRequest("GET", urls, body)
  869. if err != nil {
  870. return nil, err
  871. }
  872. req.Header = reqHeaders
  873. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  874. }
  875. // Do executes the "analytics.management.segments.list" call.
  876. func (c *ManagementSegmentsListCall) Do(opts ...googleapi.CallOption) error {
  877. gensupport.SetOptions(c.urlParams_, opts...)
  878. res, err := c.doRequest("json")
  879. if err != nil {
  880. return err
  881. }
  882. defer googleapi.CloseBody(res)
  883. if err := googleapi.CheckResponse(res); err != nil {
  884. return err
  885. }
  886. return nil
  887. // {
  888. // "description": "Lists advanced segments to which the user has access.",
  889. // "httpMethod": "GET",
  890. // "id": "analytics.management.segments.list",
  891. // "parameters": {
  892. // "max-results": {
  893. // "description": "The maximum number of advanced segments to include in this response.",
  894. // "format": "int32",
  895. // "location": "query",
  896. // "type": "integer"
  897. // },
  898. // "start-index": {
  899. // "description": "An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.",
  900. // "format": "int32",
  901. // "location": "query",
  902. // "minimum": "1",
  903. // "type": "integer"
  904. // }
  905. // },
  906. // "path": "management/segments",
  907. // "scopes": [
  908. // "https://www.googleapis.com/auth/analytics",
  909. // "https://www.googleapis.com/auth/analytics.readonly"
  910. // ]
  911. // }
  912. }
  913. // method id "analytics.management.webproperties.list":
  914. type ManagementWebpropertiesListCall struct {
  915. s *Service
  916. accountId string
  917. urlParams_ gensupport.URLParams
  918. ifNoneMatch_ string
  919. ctx_ context.Context
  920. header_ http.Header
  921. }
  922. // List: Lists web properties to which the user has access.
  923. func (r *ManagementWebpropertiesService) List(accountId string) *ManagementWebpropertiesListCall {
  924. c := &ManagementWebpropertiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  925. c.accountId = accountId
  926. return c
  927. }
  928. // MaxResults sets the optional parameter "max-results": The maximum
  929. // number of web properties to include in this response.
  930. func (c *ManagementWebpropertiesListCall) MaxResults(maxResults int64) *ManagementWebpropertiesListCall {
  931. c.urlParams_.Set("max-results", fmt.Sprint(maxResults))
  932. return c
  933. }
  934. // StartIndex sets the optional parameter "start-index": An index of the
  935. // first entity to retrieve. Use this parameter as a pagination
  936. // mechanism along with the max-results parameter.
  937. func (c *ManagementWebpropertiesListCall) StartIndex(startIndex int64) *ManagementWebpropertiesListCall {
  938. c.urlParams_.Set("start-index", fmt.Sprint(startIndex))
  939. return c
  940. }
  941. // Fields allows partial responses to be retrieved. See
  942. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  943. // for more information.
  944. func (c *ManagementWebpropertiesListCall) Fields(s ...googleapi.Field) *ManagementWebpropertiesListCall {
  945. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  946. return c
  947. }
  948. // IfNoneMatch sets the optional parameter which makes the operation
  949. // fail if the object's ETag matches the given value. This is useful for
  950. // getting updates only after the object has changed since the last
  951. // request. Use googleapi.IsNotModified to check whether the response
  952. // error from Do is the result of In-None-Match.
  953. func (c *ManagementWebpropertiesListCall) IfNoneMatch(entityTag string) *ManagementWebpropertiesListCall {
  954. c.ifNoneMatch_ = entityTag
  955. return c
  956. }
  957. // Context sets the context to be used in this call's Do method. Any
  958. // pending HTTP request will be aborted if the provided context is
  959. // canceled.
  960. func (c *ManagementWebpropertiesListCall) Context(ctx context.Context) *ManagementWebpropertiesListCall {
  961. c.ctx_ = ctx
  962. return c
  963. }
  964. // Header returns an http.Header that can be modified by the caller to
  965. // add HTTP headers to the request.
  966. func (c *ManagementWebpropertiesListCall) Header() http.Header {
  967. if c.header_ == nil {
  968. c.header_ = make(http.Header)
  969. }
  970. return c.header_
  971. }
  972. func (c *ManagementWebpropertiesListCall) doRequest(alt string) (*http.Response, error) {
  973. reqHeaders := make(http.Header)
  974. for k, v := range c.header_ {
  975. reqHeaders[k] = v
  976. }
  977. reqHeaders.Set("User-Agent", c.s.userAgent())
  978. if c.ifNoneMatch_ != "" {
  979. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  980. }
  981. var body io.Reader = nil
  982. c.urlParams_.Set("alt", alt)
  983. c.urlParams_.Set("prettyPrint", "false")
  984. urls := googleapi.ResolveRelative(c.s.BasePath, "management/accounts/{accountId}/webproperties")
  985. urls += "?" + c.urlParams_.Encode()
  986. req, err := http.NewRequest("GET", urls, body)
  987. if err != nil {
  988. return nil, err
  989. }
  990. req.Header = reqHeaders
  991. googleapi.Expand(req.URL, map[string]string{
  992. "accountId": c.accountId,
  993. })
  994. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  995. }
  996. // Do executes the "analytics.management.webproperties.list" call.
  997. func (c *ManagementWebpropertiesListCall) Do(opts ...googleapi.CallOption) error {
  998. gensupport.SetOptions(c.urlParams_, opts...)
  999. res, err := c.doRequest("json")
  1000. if err != nil {
  1001. return err
  1002. }
  1003. defer googleapi.CloseBody(res)
  1004. if err := googleapi.CheckResponse(res); err != nil {
  1005. return err
  1006. }
  1007. return nil
  1008. // {
  1009. // "description": "Lists web properties to which the user has access.",
  1010. // "httpMethod": "GET",
  1011. // "id": "analytics.management.webproperties.list",
  1012. // "parameterOrder": [
  1013. // "accountId"
  1014. // ],
  1015. // "parameters": {
  1016. // "accountId": {
  1017. // "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.",
  1018. // "location": "path",
  1019. // "required": true,
  1020. // "type": "string"
  1021. // },
  1022. // "max-results": {
  1023. // "description": "The maximum number of web properties to include in this response.",
  1024. // "format": "int32",
  1025. // "location": "query",
  1026. // "type": "integer"
  1027. // },
  1028. // "start-index": {
  1029. // "description": "An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.",
  1030. // "format": "int32",
  1031. // "location": "query",
  1032. // "minimum": "1",
  1033. // "type": "integer"
  1034. // }
  1035. // },
  1036. // "path": "management/accounts/{accountId}/webproperties",
  1037. // "scopes": [
  1038. // "https://www.googleapis.com/auth/analytics",
  1039. // "https://www.googleapis.com/auth/analytics.readonly"
  1040. // ]
  1041. // }
  1042. }