analytics-gen.go 33 KB

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