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.
 
 
 

2269 lines
89 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 analyticsreporting provides access to the Analytics Reporting API.
  6. //
  7. // For product documentation, see: https://developers.google.com/analytics/devguides/reporting/core/v4/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/analyticsreporting/v4"
  14. // ...
  15. // ctx := context.Background()
  16. // analyticsreportingService, err := analyticsreporting.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. // analyticsreportingService, err := analyticsreporting.NewService(ctx, option.WithScopes(analyticsreporting.AnalyticsReadonlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // analyticsreportingService, err := analyticsreporting.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. // analyticsreportingService, err := analyticsreporting.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 analyticsreporting // import "google.golang.org/api/analyticsreporting/v4"
  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 = "analyticsreporting:v4"
  71. const apiName = "analyticsreporting"
  72. const apiVersion = "v4"
  73. const basePath = "https://analyticsreporting.googleapis.com/"
  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.Reports = NewReportsService(s)
  113. return s, nil
  114. }
  115. type Service struct {
  116. client *http.Client
  117. BasePath string // API endpoint base URL
  118. UserAgent string // optional additional User-Agent fragment
  119. Reports *ReportsService
  120. }
  121. func (s *Service) userAgent() string {
  122. if s.UserAgent == "" {
  123. return googleapi.UserAgent
  124. }
  125. return googleapi.UserAgent + " " + s.UserAgent
  126. }
  127. func NewReportsService(s *Service) *ReportsService {
  128. rs := &ReportsService{s: s}
  129. return rs
  130. }
  131. type ReportsService struct {
  132. s *Service
  133. }
  134. // Cohort: Defines a cohort. A cohort is a group of users who share a
  135. // common
  136. // characteristic. For example, all users with the same acquisition
  137. // date
  138. // belong to the same cohort.
  139. type Cohort struct {
  140. // DateRange: This is used for `FIRST_VISIT_DATE` cohort, the cohort
  141. // selects users
  142. // whose first visit date is between start date and end date defined in
  143. // the
  144. // DateRange. The date ranges should be aligned for cohort requests. If
  145. // the
  146. // request contains `ga:cohortNthDay` it should be exactly one day
  147. // long,
  148. // if `ga:cohortNthWeek` it should be aligned to the week boundary
  149. // (starting
  150. // at Sunday and ending Saturday), and for `ga:cohortNthMonth` the date
  151. // range
  152. // should be aligned to the month (starting at the first and ending on
  153. // the
  154. // last day of the month).
  155. // For LTV requests there are no such restrictions.
  156. // You do not need to supply a date range for
  157. // the
  158. // `reportsRequest.dateRanges` field.
  159. DateRange *DateRange `json:"dateRange,omitempty"`
  160. // Name: A unique name for the cohort. If not defined name will be
  161. // auto-generated
  162. // with values cohort_[1234...].
  163. Name string `json:"name,omitempty"`
  164. // Type: Type of the cohort. The only supported type as of now
  165. // is
  166. // `FIRST_VISIT_DATE`. If this field is unspecified the cohort is
  167. // treated
  168. // as `FIRST_VISIT_DATE` type cohort.
  169. //
  170. // Possible values:
  171. // "UNSPECIFIED_COHORT_TYPE" - If unspecified it's treated as
  172. // `FIRST_VISIT_DATE`.
  173. // "FIRST_VISIT_DATE" - Cohorts that are selected based on first visit
  174. // date.
  175. Type string `json:"type,omitempty"`
  176. // ForceSendFields is a list of field names (e.g. "DateRange") to
  177. // unconditionally include in API requests. By default, fields with
  178. // empty values are omitted from API requests. However, any non-pointer,
  179. // non-interface field appearing in ForceSendFields will be sent to the
  180. // server regardless of whether the field is empty or not. This may be
  181. // used to include empty fields in Patch requests.
  182. ForceSendFields []string `json:"-"`
  183. // NullFields is a list of field names (e.g. "DateRange") to include in
  184. // API requests with the JSON null value. By default, fields with empty
  185. // values are omitted from API requests. However, any field with an
  186. // empty value appearing in NullFields will be sent to the server as
  187. // null. It is an error if a field in this list has a non-empty value.
  188. // This may be used to include null fields in Patch requests.
  189. NullFields []string `json:"-"`
  190. }
  191. func (s *Cohort) MarshalJSON() ([]byte, error) {
  192. type NoMethod Cohort
  193. raw := NoMethod(*s)
  194. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  195. }
  196. // CohortGroup: Defines a cohort group.
  197. // For example:
  198. //
  199. // "cohortGroup": {
  200. // "cohorts": [{
  201. // "name": "cohort 1",
  202. // "type": "FIRST_VISIT_DATE",
  203. // "dateRange": { "startDate": "2015-08-01", "endDate":
  204. // "2015-08-01" }
  205. // },{
  206. // "name": "cohort 2"
  207. // "type": "FIRST_VISIT_DATE"
  208. // "dateRange": { "startDate": "2015-07-01", "endDate":
  209. // "2015-07-01" }
  210. // }]
  211. // }
  212. type CohortGroup struct {
  213. // Cohorts: The definition for the cohort.
  214. Cohorts []*Cohort `json:"cohorts,omitempty"`
  215. // LifetimeValue: Enable Life Time Value (LTV). LTV measures lifetime
  216. // value for users
  217. // acquired through different channels.
  218. // Please see:
  219. // [Cohort
  220. // Analysis](https://support.google.com/analytics/answer/6074676)
  221. // and
  222. // [Lifetime
  223. // Value](https://support.google.com/analytics/answer/6182550)
  224. // If the value of lifetimeValue is false:
  225. //
  226. // - The metric values are similar to the values in the web interface
  227. // cohort
  228. // report.
  229. // - The cohort definition date ranges must be aligned to the calendar
  230. // week
  231. // and month. i.e. while requesting `ga:cohortNthWeek` the `startDate`
  232. // in
  233. // the cohort definition should be a Sunday and the `endDate` should
  234. // be the
  235. // following Saturday, and for `ga:cohortNthMonth`, the `startDate`
  236. // should be the 1st of the month and `endDate` should be the last
  237. // day
  238. // of the month.
  239. //
  240. // When the lifetimeValue is true:
  241. //
  242. // - The metric values will correspond to the values in the web
  243. // interface
  244. // LifeTime value report.
  245. // - The Lifetime Value report shows you how user value (Revenue) and
  246. // engagement (Appviews, Goal Completions, Sessions, and Session
  247. // Duration)
  248. // grow during the 90 days after a user is acquired.
  249. // - The metrics are calculated as a cumulative average per user per the
  250. // time
  251. // increment.
  252. // - The cohort definition date ranges need not be aligned to the
  253. // calendar
  254. // week and month boundaries.
  255. // - The `viewId` must be an
  256. // [app view
  257. // ID](https://support.google.com/analytics/answer/2649553#WebVersusAppVi
  258. // ews)
  259. LifetimeValue bool `json:"lifetimeValue,omitempty"`
  260. // ForceSendFields is a list of field names (e.g. "Cohorts") to
  261. // unconditionally include in API requests. By default, fields with
  262. // empty values are omitted from API requests. However, any non-pointer,
  263. // non-interface field appearing in ForceSendFields will be sent to the
  264. // server regardless of whether the field is empty or not. This may be
  265. // used to include empty fields in Patch requests.
  266. ForceSendFields []string `json:"-"`
  267. // NullFields is a list of field names (e.g. "Cohorts") to include in
  268. // API requests with the JSON null value. By default, fields with empty
  269. // values are omitted from API requests. However, any field with an
  270. // empty value appearing in NullFields will be sent to the server as
  271. // null. It is an error if a field in this list has a non-empty value.
  272. // This may be used to include null fields in Patch requests.
  273. NullFields []string `json:"-"`
  274. }
  275. func (s *CohortGroup) MarshalJSON() ([]byte, error) {
  276. type NoMethod CohortGroup
  277. raw := NoMethod(*s)
  278. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  279. }
  280. // ColumnHeader: Column headers.
  281. type ColumnHeader struct {
  282. // Dimensions: The dimension names in the response.
  283. Dimensions []string `json:"dimensions,omitempty"`
  284. // MetricHeader: Metric headers for the metrics in the response.
  285. MetricHeader *MetricHeader `json:"metricHeader,omitempty"`
  286. // ForceSendFields is a list of field names (e.g. "Dimensions") to
  287. // unconditionally include in API requests. By default, fields with
  288. // empty values are omitted from API requests. However, any non-pointer,
  289. // non-interface field appearing in ForceSendFields will be sent to the
  290. // server regardless of whether the field is empty or not. This may be
  291. // used to include empty fields in Patch requests.
  292. ForceSendFields []string `json:"-"`
  293. // NullFields is a list of field names (e.g. "Dimensions") to include in
  294. // API requests with the JSON null value. By default, fields with empty
  295. // values are omitted from API requests. However, any field with an
  296. // empty value appearing in NullFields will be sent to the server as
  297. // null. It is an error if a field in this list has a non-empty value.
  298. // This may be used to include null fields in Patch requests.
  299. NullFields []string `json:"-"`
  300. }
  301. func (s *ColumnHeader) MarshalJSON() ([]byte, error) {
  302. type NoMethod ColumnHeader
  303. raw := NoMethod(*s)
  304. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  305. }
  306. // DateRange: A contiguous set of days: startDate, startDate + 1 day,
  307. // ..., endDate.
  308. // The start and end dates are specified
  309. // in
  310. // [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) date format
  311. // `YYYY-MM-DD`.
  312. type DateRange struct {
  313. // EndDate: The end date for the query in the format `YYYY-MM-DD`.
  314. EndDate string `json:"endDate,omitempty"`
  315. // StartDate: The start date for the query in the format `YYYY-MM-DD`.
  316. StartDate string `json:"startDate,omitempty"`
  317. // ForceSendFields is a list of field names (e.g. "EndDate") to
  318. // unconditionally include in API requests. By default, fields with
  319. // empty values are omitted from API requests. However, any non-pointer,
  320. // non-interface field appearing in ForceSendFields will be sent to the
  321. // server regardless of whether the field is empty or not. This may be
  322. // used to include empty fields in Patch requests.
  323. ForceSendFields []string `json:"-"`
  324. // NullFields is a list of field names (e.g. "EndDate") to include in
  325. // API requests with the JSON null value. By default, fields with empty
  326. // values are omitted from API requests. However, any field with an
  327. // empty value appearing in NullFields will be sent to the server as
  328. // null. It is an error if a field in this list has a non-empty value.
  329. // This may be used to include null fields in Patch requests.
  330. NullFields []string `json:"-"`
  331. }
  332. func (s *DateRange) MarshalJSON() ([]byte, error) {
  333. type NoMethod DateRange
  334. raw := NoMethod(*s)
  335. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  336. }
  337. // DateRangeValues: Used to return a list of metrics for a single
  338. // DateRange / dimension
  339. // combination
  340. type DateRangeValues struct {
  341. // PivotValueRegions: The values of each pivot region.
  342. PivotValueRegions []*PivotValueRegion `json:"pivotValueRegions,omitempty"`
  343. // Values: Each value corresponds to each Metric in the request.
  344. Values []string `json:"values,omitempty"`
  345. // ForceSendFields is a list of field names (e.g. "PivotValueRegions")
  346. // to unconditionally include in API requests. By default, fields with
  347. // empty values are omitted from API requests. However, any non-pointer,
  348. // non-interface field appearing in ForceSendFields will be sent to the
  349. // server regardless of whether the field is empty or not. This may be
  350. // used to include empty fields in Patch requests.
  351. ForceSendFields []string `json:"-"`
  352. // NullFields is a list of field names (e.g. "PivotValueRegions") to
  353. // include in API requests with the JSON null value. By default, fields
  354. // with empty values are omitted from API requests. However, any field
  355. // with an empty value appearing in NullFields will be sent to the
  356. // server as null. It is an error if a field in this list has a
  357. // non-empty value. This may be used to include null fields in Patch
  358. // requests.
  359. NullFields []string `json:"-"`
  360. }
  361. func (s *DateRangeValues) MarshalJSON() ([]byte, error) {
  362. type NoMethod DateRangeValues
  363. raw := NoMethod(*s)
  364. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  365. }
  366. // Dimension:
  367. // [Dimensions](https://support.google.com/analytics/answer/1033861)
  368. // are attributes of your data. For example, the dimension
  369. // `ga:city`
  370. // indicates the city, for example, "Paris" or "New York", from which
  371. // a session originates.
  372. type Dimension struct {
  373. // HistogramBuckets: If non-empty, we place dimension values into
  374. // buckets after string to
  375. // int64. Dimension values that are not the string representation of
  376. // an
  377. // integral value will be converted to zero. The bucket values have to
  378. // be in
  379. // increasing order. Each bucket is closed on the lower end, and open
  380. // on the
  381. // upper end. The "first" bucket includes all values less than the
  382. // first
  383. // boundary, the "last" bucket includes all values up to infinity.
  384. // Dimension
  385. // values that fall in a bucket get transformed to a new dimension
  386. // value. For
  387. // example, if one gives a list of "0, 1, 3, 4, 7", then we return
  388. // the
  389. // following buckets:
  390. //
  391. // - bucket #1: values < 0, dimension value "<0"
  392. // - bucket #2: values in [0,1), dimension value "0"
  393. // - bucket #3: values in [1,3), dimension value "1-2"
  394. // - bucket #4: values in [3,4), dimension value "3"
  395. // - bucket #5: values in [4,7), dimension value "4-6"
  396. // - bucket #6: values >= 7, dimension value "7+"
  397. //
  398. // NOTE: If you are applying histogram mutation on any dimension, and
  399. // using
  400. // that dimension in sort, you will want to use the sort
  401. // type
  402. // `HISTOGRAM_BUCKET` for that purpose. Without that the dimension
  403. // values
  404. // will be sorted according to dictionary
  405. // (lexicographic) order. For example the ascending dictionary order
  406. // is:
  407. //
  408. // "<50", "1001+", "121-1000", "50-120"
  409. //
  410. // And the ascending `HISTOGRAM_BUCKET` order is:
  411. //
  412. // "<50", "50-120", "121-1000", "1001+"
  413. //
  414. // The client has to explicitly request "orderType":
  415. // "HISTOGRAM_BUCKET"
  416. // for a histogram-mutated dimension.
  417. HistogramBuckets googleapi.Int64s `json:"histogramBuckets,omitempty"`
  418. // Name: Name of the dimension to fetch, for example `ga:browser`.
  419. Name string `json:"name,omitempty"`
  420. // ForceSendFields is a list of field names (e.g. "HistogramBuckets") to
  421. // unconditionally include in API requests. By default, fields with
  422. // empty values are omitted from API requests. However, any non-pointer,
  423. // non-interface field appearing in ForceSendFields will be sent to the
  424. // server regardless of whether the field is empty or not. This may be
  425. // used to include empty fields in Patch requests.
  426. ForceSendFields []string `json:"-"`
  427. // NullFields is a list of field names (e.g. "HistogramBuckets") to
  428. // include in API requests with the JSON null value. By default, fields
  429. // with empty values are omitted from API requests. However, any field
  430. // with an empty value appearing in NullFields will be sent to the
  431. // server as null. It is an error if a field in this list has a
  432. // non-empty value. This may be used to include null fields in Patch
  433. // requests.
  434. NullFields []string `json:"-"`
  435. }
  436. func (s *Dimension) MarshalJSON() ([]byte, error) {
  437. type NoMethod Dimension
  438. raw := NoMethod(*s)
  439. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  440. }
  441. // DimensionFilter: Dimension filter specifies the filtering options on
  442. // a dimension.
  443. type DimensionFilter struct {
  444. // CaseSensitive: Should the match be case sensitive? Default is false.
  445. CaseSensitive bool `json:"caseSensitive,omitempty"`
  446. // DimensionName: The dimension to filter on. A DimensionFilter must
  447. // contain a dimension.
  448. DimensionName string `json:"dimensionName,omitempty"`
  449. // Expressions: Strings or regular expression to match against. Only the
  450. // first value of
  451. // the list is used for comparison unless the operator is `IN_LIST`.
  452. // If `IN_LIST` operator, then the entire list is used to filter
  453. // the
  454. // dimensions as explained in the description of the `IN_LIST` operator.
  455. Expressions []string `json:"expressions,omitempty"`
  456. // Not: Logical `NOT` operator. If this boolean is set to true, then the
  457. // matching
  458. // dimension values will be excluded in the report. The default is
  459. // false.
  460. Not bool `json:"not,omitempty"`
  461. // Operator: How to match the dimension to the expression. The default
  462. // is REGEXP.
  463. //
  464. // Possible values:
  465. // "OPERATOR_UNSPECIFIED" - If the match type is unspecified, it is
  466. // treated as a `REGEXP`.
  467. // "REGEXP" - The match expression is treated as a regular expression.
  468. // All match types
  469. // are not treated as regular expressions.
  470. // "BEGINS_WITH" - Matches the value which begin with the match
  471. // expression provided.
  472. // "ENDS_WITH" - Matches the values which end with the match
  473. // expression provided.
  474. // "PARTIAL" - Substring match.
  475. // "EXACT" - The value should match the match expression entirely.
  476. // "NUMERIC_EQUAL" - Integer comparison filters.
  477. // case sensitivity is ignored for these and the expression
  478. // is assumed to be a string representing an integer.
  479. // Failure conditions:
  480. //
  481. // - If expression is not a valid int64, the client should expect
  482. // an error.
  483. // - Input dimensions that are not valid int64 values will never match
  484. // the
  485. // filter.
  486. // "NUMERIC_GREATER_THAN" - Checks if the dimension is numerically
  487. // greater than the match
  488. // expression. Read the description for `NUMERIC_EQUALS` for
  489. // restrictions.
  490. // "NUMERIC_LESS_THAN" - Checks if the dimension is numerically less
  491. // than the match expression.
  492. // Read the description for `NUMERIC_EQUALS` for restrictions.
  493. // "IN_LIST" - This option is used to specify a dimension filter whose
  494. // expression can
  495. // take any value from a selected list of values. This helps
  496. // avoiding
  497. // evaluating multiple exact match dimension filters which are OR'ed
  498. // for
  499. // every single response row. For example:
  500. //
  501. // expressions: ["A", "B", "C"]
  502. //
  503. // Any response row whose dimension has it is value as A, B or C,
  504. // matches
  505. // this DimensionFilter.
  506. Operator string `json:"operator,omitempty"`
  507. // ForceSendFields is a list of field names (e.g. "CaseSensitive") to
  508. // unconditionally include in API requests. By default, fields with
  509. // empty values are omitted from API requests. However, any non-pointer,
  510. // non-interface field appearing in ForceSendFields will be sent to the
  511. // server regardless of whether the field is empty or not. This may be
  512. // used to include empty fields in Patch requests.
  513. ForceSendFields []string `json:"-"`
  514. // NullFields is a list of field names (e.g. "CaseSensitive") to include
  515. // in API requests with the JSON null value. By default, fields with
  516. // empty values are omitted from API requests. However, any field with
  517. // an empty value appearing in NullFields will be sent to the server as
  518. // null. It is an error if a field in this list has a non-empty value.
  519. // This may be used to include null fields in Patch requests.
  520. NullFields []string `json:"-"`
  521. }
  522. func (s *DimensionFilter) MarshalJSON() ([]byte, error) {
  523. type NoMethod DimensionFilter
  524. raw := NoMethod(*s)
  525. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  526. }
  527. // DimensionFilterClause: A group of dimension filters. Set the operator
  528. // value to specify how
  529. // the filters are logically combined.
  530. type DimensionFilterClause struct {
  531. // Filters: The repeated set of filters. They are logically combined
  532. // based on the
  533. // operator specified.
  534. Filters []*DimensionFilter `json:"filters,omitempty"`
  535. // Operator: The operator for combining multiple dimension filters. If
  536. // unspecified, it
  537. // is treated as an `OR`.
  538. //
  539. // Possible values:
  540. // "OPERATOR_UNSPECIFIED" - Unspecified operator. It is treated as an
  541. // `OR`.
  542. // "OR" - The logical `OR` operator.
  543. // "AND" - The logical `AND` operator.
  544. Operator string `json:"operator,omitempty"`
  545. // ForceSendFields is a list of field names (e.g. "Filters") to
  546. // unconditionally include in API requests. By default, fields with
  547. // empty values are omitted from API requests. However, any non-pointer,
  548. // non-interface field appearing in ForceSendFields will be sent to the
  549. // server regardless of whether the field is empty or not. This may be
  550. // used to include empty fields in Patch requests.
  551. ForceSendFields []string `json:"-"`
  552. // NullFields is a list of field names (e.g. "Filters") to include in
  553. // API requests with the JSON null value. By default, fields with empty
  554. // values are omitted from API requests. However, any field with an
  555. // empty value appearing in NullFields will be sent to the server as
  556. // null. It is an error if a field in this list has a non-empty value.
  557. // This may be used to include null fields in Patch requests.
  558. NullFields []string `json:"-"`
  559. }
  560. func (s *DimensionFilterClause) MarshalJSON() ([]byte, error) {
  561. type NoMethod DimensionFilterClause
  562. raw := NoMethod(*s)
  563. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  564. }
  565. // DynamicSegment: Dynamic segment definition for defining the segment
  566. // within the request.
  567. // A segment can select users, sessions or both.
  568. type DynamicSegment struct {
  569. // Name: The name of the dynamic segment.
  570. Name string `json:"name,omitempty"`
  571. // SessionSegment: Session Segment to select sessions to include in the
  572. // segment.
  573. SessionSegment *SegmentDefinition `json:"sessionSegment,omitempty"`
  574. // UserSegment: User Segment to select users to include in the segment.
  575. UserSegment *SegmentDefinition `json:"userSegment,omitempty"`
  576. // ForceSendFields is a list of field names (e.g. "Name") to
  577. // unconditionally include in API requests. By default, fields with
  578. // empty values are omitted from API requests. However, any non-pointer,
  579. // non-interface field appearing in ForceSendFields will be sent to the
  580. // server regardless of whether the field is empty or not. This may be
  581. // used to include empty fields in Patch requests.
  582. ForceSendFields []string `json:"-"`
  583. // NullFields is a list of field names (e.g. "Name") to include in API
  584. // requests with the JSON null value. By default, fields with empty
  585. // values are omitted from API requests. However, any field with an
  586. // empty value appearing in NullFields will be sent to the server as
  587. // null. It is an error if a field in this list has a non-empty value.
  588. // This may be used to include null fields in Patch requests.
  589. NullFields []string `json:"-"`
  590. }
  591. func (s *DynamicSegment) MarshalJSON() ([]byte, error) {
  592. type NoMethod DynamicSegment
  593. raw := NoMethod(*s)
  594. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  595. }
  596. // GetReportsRequest: The batch request containing multiple report
  597. // request.
  598. type GetReportsRequest struct {
  599. // ReportRequests: Requests, each request will have a separate
  600. // response.
  601. // There can be a maximum of 5 requests. All requests should have the
  602. // same
  603. // `dateRanges`, `viewId`, `segments`, `samplingLevel`, and
  604. // `cohortGroup`.
  605. ReportRequests []*ReportRequest `json:"reportRequests,omitempty"`
  606. // UseResourceQuotas: Enables
  607. // [resource based
  608. // quotas](/analytics/devguides/reporting/core/v4/limits-quotas#analytics
  609. // _reporting_api_v4),
  610. // (defaults to `False`). If this field is set to `True` the
  611. // per view (profile) quotas are governed by the computational
  612. // cost of the request. Note that using cost based quotas will
  613. // higher enable sampling rates. (10 Million for `SMALL`,
  614. // 100M for `LARGE`. See the
  615. // [limits and quotas
  616. // documentation](/analytics/devguides/reporting/core/v4/limits-quotas#an
  617. // alytics_reporting_api_v4) for details.
  618. UseResourceQuotas bool `json:"useResourceQuotas,omitempty"`
  619. // ForceSendFields is a list of field names (e.g. "ReportRequests") to
  620. // unconditionally include in API requests. By default, fields with
  621. // empty values are omitted from API requests. However, any non-pointer,
  622. // non-interface field appearing in ForceSendFields will be sent to the
  623. // server regardless of whether the field is empty or not. This may be
  624. // used to include empty fields in Patch requests.
  625. ForceSendFields []string `json:"-"`
  626. // NullFields is a list of field names (e.g. "ReportRequests") to
  627. // include in API requests with the JSON null value. By default, fields
  628. // with empty values are omitted from API requests. However, any field
  629. // with an empty value appearing in NullFields will be sent to the
  630. // server as null. It is an error if a field in this list has a
  631. // non-empty value. This may be used to include null fields in Patch
  632. // requests.
  633. NullFields []string `json:"-"`
  634. }
  635. func (s *GetReportsRequest) MarshalJSON() ([]byte, error) {
  636. type NoMethod GetReportsRequest
  637. raw := NoMethod(*s)
  638. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  639. }
  640. // GetReportsResponse: The main response class which holds the reports
  641. // from the Reporting API
  642. // `batchGet` call.
  643. type GetReportsResponse struct {
  644. // QueryCost: The amount of resource quota tokens deducted to execute
  645. // the query. Includes
  646. // all responses.
  647. QueryCost int64 `json:"queryCost,omitempty"`
  648. // Reports: Responses corresponding to each of the request.
  649. Reports []*Report `json:"reports,omitempty"`
  650. // ResourceQuotasRemaining: The amount of resource quota remaining for
  651. // the property.
  652. ResourceQuotasRemaining *ResourceQuotasRemaining `json:"resourceQuotasRemaining,omitempty"`
  653. // ServerResponse contains the HTTP response code and headers from the
  654. // server.
  655. googleapi.ServerResponse `json:"-"`
  656. // ForceSendFields is a list of field names (e.g. "QueryCost") to
  657. // unconditionally include in API requests. By default, fields with
  658. // empty values are omitted from API requests. However, any non-pointer,
  659. // non-interface field appearing in ForceSendFields will be sent to the
  660. // server regardless of whether the field is empty or not. This may be
  661. // used to include empty fields in Patch requests.
  662. ForceSendFields []string `json:"-"`
  663. // NullFields is a list of field names (e.g. "QueryCost") to include in
  664. // API requests with the JSON null value. By default, fields with empty
  665. // values are omitted from API requests. However, any field with an
  666. // empty value appearing in NullFields will be sent to the server as
  667. // null. It is an error if a field in this list has a non-empty value.
  668. // This may be used to include null fields in Patch requests.
  669. NullFields []string `json:"-"`
  670. }
  671. func (s *GetReportsResponse) MarshalJSON() ([]byte, error) {
  672. type NoMethod GetReportsResponse
  673. raw := NoMethod(*s)
  674. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  675. }
  676. // Metric:
  677. // [Metrics](https://support.google.com/analytics/answer/1033861)
  678. // are the quantitative measurements. For example, the metric
  679. // `ga:users`
  680. // indicates the total number of users for the requested time period.
  681. type Metric struct {
  682. // Alias: An alias for the metric expression is an alternate name for
  683. // the
  684. // expression. The alias can be used for filtering and sorting. This
  685. // field
  686. // is optional and is useful if the expression is not a single metric
  687. // but
  688. // a complex expression which cannot be used in filtering and
  689. // sorting.
  690. // The alias is also used in the response column header.
  691. Alias string `json:"alias,omitempty"`
  692. // Expression: A metric expression in the request. An expression is
  693. // constructed from one
  694. // or more metrics and numbers. Accepted operators include: Plus (+),
  695. // Minus
  696. // (-), Negation (Unary -), Divided by (/), Multiplied by (*),
  697. // Parenthesis,
  698. // Positive cardinal numbers (0-9), can include decimals and is limited
  699. // to
  700. // 1024 characters. Example `ga:totalRefunds/ga:users`, in most cases
  701. // the
  702. // metric expression is just a single metric name like
  703. // `ga:users`.
  704. // Adding mixed `MetricType` (E.g., `CURRENCY` + `PERCENTAGE`)
  705. // metrics
  706. // will result in unexpected results.
  707. Expression string `json:"expression,omitempty"`
  708. // FormattingType: Specifies how the metric expression should be
  709. // formatted, for example
  710. // `INTEGER`.
  711. //
  712. // Possible values:
  713. // "METRIC_TYPE_UNSPECIFIED" - Metric type is unspecified.
  714. // "INTEGER" - Integer metric.
  715. // "FLOAT" - Float metric.
  716. // "CURRENCY" - Currency metric.
  717. // "PERCENT" - Percentage metric.
  718. // "TIME" - Time metric in `HH:MM:SS` format.
  719. FormattingType string `json:"formattingType,omitempty"`
  720. // ForceSendFields is a list of field names (e.g. "Alias") to
  721. // unconditionally include in API requests. By default, fields with
  722. // empty values are omitted from API requests. However, any non-pointer,
  723. // non-interface field appearing in ForceSendFields will be sent to the
  724. // server regardless of whether the field is empty or not. This may be
  725. // used to include empty fields in Patch requests.
  726. ForceSendFields []string `json:"-"`
  727. // NullFields is a list of field names (e.g. "Alias") to include in API
  728. // requests with the JSON null value. By default, fields with empty
  729. // values are omitted from API requests. However, any field with an
  730. // empty value appearing in NullFields will be sent to the server as
  731. // null. It is an error if a field in this list has a non-empty value.
  732. // This may be used to include null fields in Patch requests.
  733. NullFields []string `json:"-"`
  734. }
  735. func (s *Metric) MarshalJSON() ([]byte, error) {
  736. type NoMethod Metric
  737. raw := NoMethod(*s)
  738. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  739. }
  740. // MetricFilter: MetricFilter specifies the filter on a metric.
  741. type MetricFilter struct {
  742. // ComparisonValue: The value to compare against.
  743. ComparisonValue string `json:"comparisonValue,omitempty"`
  744. // MetricName: The metric that will be filtered on. A metricFilter must
  745. // contain a metric
  746. // name. A metric name can be an alias earlier defined as a metric or it
  747. // can
  748. // also be a metric expression.
  749. MetricName string `json:"metricName,omitempty"`
  750. // Not: Logical `NOT` operator. If this boolean is set to true, then the
  751. // matching
  752. // metric values will be excluded in the report. The default is false.
  753. Not bool `json:"not,omitempty"`
  754. // Operator: Is the metric `EQUAL`, `LESS_THAN` or `GREATER_THAN`
  755. // the
  756. // comparisonValue, the default is `EQUAL`. If the operator
  757. // is
  758. // `IS_MISSING`, checks if the metric is missing and would ignore
  759. // the
  760. // comparisonValue.
  761. //
  762. // Possible values:
  763. // "OPERATOR_UNSPECIFIED" - If the operator is not specified, it is
  764. // treated as `EQUAL`.
  765. // "EQUAL" - Should the value of the metric be exactly equal to the
  766. // comparison value.
  767. // "LESS_THAN" - Should the value of the metric be less than to the
  768. // comparison value.
  769. // "GREATER_THAN" - Should the value of the metric be greater than to
  770. // the comparison value.
  771. // "IS_MISSING" - Validates if the metric is missing.
  772. // Doesn't take comparisonValue into account.
  773. Operator string `json:"operator,omitempty"`
  774. // ForceSendFields is a list of field names (e.g. "ComparisonValue") to
  775. // unconditionally include in API requests. By default, fields with
  776. // empty values are omitted from API requests. However, any non-pointer,
  777. // non-interface field appearing in ForceSendFields will be sent to the
  778. // server regardless of whether the field is empty or not. This may be
  779. // used to include empty fields in Patch requests.
  780. ForceSendFields []string `json:"-"`
  781. // NullFields is a list of field names (e.g. "ComparisonValue") to
  782. // include in API requests with the JSON null value. By default, fields
  783. // with empty values are omitted from API requests. However, any field
  784. // with an empty value appearing in NullFields will be sent to the
  785. // server as null. It is an error if a field in this list has a
  786. // non-empty value. This may be used to include null fields in Patch
  787. // requests.
  788. NullFields []string `json:"-"`
  789. }
  790. func (s *MetricFilter) MarshalJSON() ([]byte, error) {
  791. type NoMethod MetricFilter
  792. raw := NoMethod(*s)
  793. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  794. }
  795. // MetricFilterClause: Represents a group of metric filters.
  796. // Set the operator value to specify how the filters are logically
  797. // combined.
  798. type MetricFilterClause struct {
  799. // Filters: The repeated set of filters. They are logically combined
  800. // based on the
  801. // operator specified.
  802. Filters []*MetricFilter `json:"filters,omitempty"`
  803. // Operator: The operator for combining multiple metric filters. If
  804. // unspecified, it is
  805. // treated as an `OR`.
  806. //
  807. // Possible values:
  808. // "OPERATOR_UNSPECIFIED" - Unspecified operator. It is treated as an
  809. // `OR`.
  810. // "OR" - The logical `OR` operator.
  811. // "AND" - The logical `AND` operator.
  812. Operator string `json:"operator,omitempty"`
  813. // ForceSendFields is a list of field names (e.g. "Filters") to
  814. // unconditionally include in API requests. By default, fields with
  815. // empty values are omitted from API requests. However, any non-pointer,
  816. // non-interface field appearing in ForceSendFields will be sent to the
  817. // server regardless of whether the field is empty or not. This may be
  818. // used to include empty fields in Patch requests.
  819. ForceSendFields []string `json:"-"`
  820. // NullFields is a list of field names (e.g. "Filters") to include in
  821. // API requests with the JSON null value. By default, fields with empty
  822. // values are omitted from API requests. However, any field with an
  823. // empty value appearing in NullFields will be sent to the server as
  824. // null. It is an error if a field in this list has a non-empty value.
  825. // This may be used to include null fields in Patch requests.
  826. NullFields []string `json:"-"`
  827. }
  828. func (s *MetricFilterClause) MarshalJSON() ([]byte, error) {
  829. type NoMethod MetricFilterClause
  830. raw := NoMethod(*s)
  831. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  832. }
  833. // MetricHeader: The headers for the metrics.
  834. type MetricHeader struct {
  835. // MetricHeaderEntries: Headers for the metrics in the response.
  836. MetricHeaderEntries []*MetricHeaderEntry `json:"metricHeaderEntries,omitempty"`
  837. // PivotHeaders: Headers for the pivots in the response.
  838. PivotHeaders []*PivotHeader `json:"pivotHeaders,omitempty"`
  839. // ForceSendFields is a list of field names (e.g. "MetricHeaderEntries")
  840. // to unconditionally include in API requests. By default, fields with
  841. // empty values are omitted from API requests. However, any non-pointer,
  842. // non-interface field appearing in ForceSendFields will be sent to the
  843. // server regardless of whether the field is empty or not. This may be
  844. // used to include empty fields in Patch requests.
  845. ForceSendFields []string `json:"-"`
  846. // NullFields is a list of field names (e.g. "MetricHeaderEntries") to
  847. // include in API requests with the JSON null value. By default, fields
  848. // with empty values are omitted from API requests. However, any field
  849. // with an empty value appearing in NullFields will be sent to the
  850. // server as null. It is an error if a field in this list has a
  851. // non-empty value. This may be used to include null fields in Patch
  852. // requests.
  853. NullFields []string `json:"-"`
  854. }
  855. func (s *MetricHeader) MarshalJSON() ([]byte, error) {
  856. type NoMethod MetricHeader
  857. raw := NoMethod(*s)
  858. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  859. }
  860. // MetricHeaderEntry: Header for the metrics.
  861. type MetricHeaderEntry struct {
  862. // Name: The name of the header.
  863. Name string `json:"name,omitempty"`
  864. // Type: The type of the metric, for example `INTEGER`.
  865. //
  866. // Possible values:
  867. // "METRIC_TYPE_UNSPECIFIED" - Metric type is unspecified.
  868. // "INTEGER" - Integer metric.
  869. // "FLOAT" - Float metric.
  870. // "CURRENCY" - Currency metric.
  871. // "PERCENT" - Percentage metric.
  872. // "TIME" - Time metric in `HH:MM:SS` format.
  873. Type string `json:"type,omitempty"`
  874. // ForceSendFields is a list of field names (e.g. "Name") to
  875. // unconditionally include in API requests. By default, fields with
  876. // empty values are omitted from API requests. However, any non-pointer,
  877. // non-interface field appearing in ForceSendFields will be sent to the
  878. // server regardless of whether the field is empty or not. This may be
  879. // used to include empty fields in Patch requests.
  880. ForceSendFields []string `json:"-"`
  881. // NullFields is a list of field names (e.g. "Name") to include in API
  882. // requests with the JSON null value. By default, fields with empty
  883. // values are omitted from API requests. However, any field with an
  884. // empty value appearing in NullFields will be sent to the server as
  885. // null. It is an error if a field in this list has a non-empty value.
  886. // This may be used to include null fields in Patch requests.
  887. NullFields []string `json:"-"`
  888. }
  889. func (s *MetricHeaderEntry) MarshalJSON() ([]byte, error) {
  890. type NoMethod MetricHeaderEntry
  891. raw := NoMethod(*s)
  892. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  893. }
  894. // OrFiltersForSegment: A list of segment filters in the `OR` group are
  895. // combined with the logical OR
  896. // operator.
  897. type OrFiltersForSegment struct {
  898. // SegmentFilterClauses: List of segment filters to be combined with a
  899. // `OR` operator.
  900. SegmentFilterClauses []*SegmentFilterClause `json:"segmentFilterClauses,omitempty"`
  901. // ForceSendFields is a list of field names (e.g.
  902. // "SegmentFilterClauses") to unconditionally include in API requests.
  903. // By default, fields with empty values are omitted from API requests.
  904. // However, any non-pointer, non-interface field appearing in
  905. // ForceSendFields will be sent to the server regardless of whether the
  906. // field is empty or not. This may be used to include empty fields in
  907. // Patch requests.
  908. ForceSendFields []string `json:"-"`
  909. // NullFields is a list of field names (e.g. "SegmentFilterClauses") to
  910. // include in API requests with the JSON null value. By default, fields
  911. // with empty values are omitted from API requests. However, any field
  912. // with an empty value appearing in NullFields will be sent to the
  913. // server as null. It is an error if a field in this list has a
  914. // non-empty value. This may be used to include null fields in Patch
  915. // requests.
  916. NullFields []string `json:"-"`
  917. }
  918. func (s *OrFiltersForSegment) MarshalJSON() ([]byte, error) {
  919. type NoMethod OrFiltersForSegment
  920. raw := NoMethod(*s)
  921. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  922. }
  923. // OrderBy: Specifies the sorting options.
  924. type OrderBy struct {
  925. // FieldName: The field which to sort by. The default sort order is
  926. // ascending. Example:
  927. // `ga:browser`.
  928. // Note, that you can only specify one field for sort here. For
  929. // example,
  930. // `ga:browser, ga:city` is not valid.
  931. FieldName string `json:"fieldName,omitempty"`
  932. // OrderType: The order type. The default orderType is `VALUE`.
  933. //
  934. // Possible values:
  935. // "ORDER_TYPE_UNSPECIFIED" - Unspecified order type will be treated
  936. // as sort based on value.
  937. // "VALUE" - The sort order is based on the value of the chosen
  938. // column; looks only at
  939. // the first date range.
  940. // "DELTA" - The sort order is based on the difference of the values
  941. // of the chosen
  942. // column between the first two date ranges. Usable only if there
  943. // are
  944. // exactly two date ranges.
  945. // "SMART" - The sort order is based on weighted value of the chosen
  946. // column. If
  947. // column has n/d format, then weighted value of this ratio will
  948. // be `(n + totals.n)/(d + totals.d)` Usable only for metrics
  949. // that
  950. // represent ratios.
  951. // "HISTOGRAM_BUCKET" - Histogram order type is applicable only to
  952. // dimension columns with
  953. // non-empty histogram-buckets.
  954. // "DIMENSION_AS_INTEGER" - If the dimensions are fixed length
  955. // numbers, ordinary sort would just
  956. // work fine. `DIMENSION_AS_INTEGER` can be used if the dimensions
  957. // are
  958. // variable length numbers.
  959. OrderType string `json:"orderType,omitempty"`
  960. // SortOrder: The sorting order for the field.
  961. //
  962. // Possible values:
  963. // "SORT_ORDER_UNSPECIFIED" - If the sort order is unspecified, the
  964. // default is ascending.
  965. // "ASCENDING" - Ascending sort. The field will be sorted in an
  966. // ascending manner.
  967. // "DESCENDING" - Descending sort. The field will be sorted in a
  968. // descending manner.
  969. SortOrder string `json:"sortOrder,omitempty"`
  970. // ForceSendFields is a list of field names (e.g. "FieldName") to
  971. // unconditionally include in API requests. By default, fields with
  972. // empty values are omitted from API requests. However, any non-pointer,
  973. // non-interface field appearing in ForceSendFields will be sent to the
  974. // server regardless of whether the field is empty or not. This may be
  975. // used to include empty fields in Patch requests.
  976. ForceSendFields []string `json:"-"`
  977. // NullFields is a list of field names (e.g. "FieldName") to include in
  978. // API requests with the JSON null value. By default, fields with empty
  979. // values are omitted from API requests. However, any field with an
  980. // empty value appearing in NullFields will be sent to the server as
  981. // null. It is an error if a field in this list has a non-empty value.
  982. // This may be used to include null fields in Patch requests.
  983. NullFields []string `json:"-"`
  984. }
  985. func (s *OrderBy) MarshalJSON() ([]byte, error) {
  986. type NoMethod OrderBy
  987. raw := NoMethod(*s)
  988. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  989. }
  990. // Pivot: The Pivot describes the pivot section in the request.
  991. // The Pivot helps rearrange the information in the table for certain
  992. // reports
  993. // by pivoting your data on a second dimension.
  994. type Pivot struct {
  995. // DimensionFilterClauses: DimensionFilterClauses are logically combined
  996. // with an `AND` operator: only
  997. // data that is included by all these DimensionFilterClauses contributes
  998. // to
  999. // the values in this pivot region. Dimension filters can be used to
  1000. // restrict
  1001. // the columns shown in the pivot region. For example if you
  1002. // have
  1003. // `ga:browser` as the requested dimension in the pivot region, and
  1004. // you
  1005. // specify key filters to restrict `ga:browser` to only "IE" or
  1006. // "Firefox",
  1007. // then only those two browsers would show up as columns.
  1008. DimensionFilterClauses []*DimensionFilterClause `json:"dimensionFilterClauses,omitempty"`
  1009. // Dimensions: A list of dimensions to show as pivot columns. A Pivot
  1010. // can have a maximum
  1011. // of 4 dimensions. Pivot dimensions are part of the restriction on
  1012. // the
  1013. // total number of dimensions allowed in the request.
  1014. Dimensions []*Dimension `json:"dimensions,omitempty"`
  1015. // MaxGroupCount: Specifies the maximum number of groups to return.
  1016. // The default value is 10, also the maximum value is 1,000.
  1017. MaxGroupCount int64 `json:"maxGroupCount,omitempty"`
  1018. // Metrics: The pivot metrics. Pivot metrics are part of the
  1019. // restriction on total number of metrics allowed in the request.
  1020. Metrics []*Metric `json:"metrics,omitempty"`
  1021. // StartGroup: If k metrics were requested, then the response will
  1022. // contain some
  1023. // data-dependent multiple of k columns in the report. E.g., if you
  1024. // pivoted
  1025. // on the dimension `ga:browser` then you'd get k columns for "Firefox",
  1026. // k
  1027. // columns for "IE", k columns for "Chrome", etc. The ordering of the
  1028. // groups
  1029. // of columns is determined by descending order of "total" for the first
  1030. // of
  1031. // the k values. Ties are broken by lexicographic ordering of the
  1032. // first
  1033. // pivot dimension, then lexicographic ordering of the second
  1034. // pivot
  1035. // dimension, and so on. E.g., if the totals for the first value
  1036. // for
  1037. // Firefox, IE, and Chrome were 8, 2, 8, respectively, the order of
  1038. // columns
  1039. // would be Chrome, Firefox, IE.
  1040. //
  1041. // The following let you choose which of the groups of k columns
  1042. // are
  1043. // included in the response.
  1044. StartGroup int64 `json:"startGroup,omitempty"`
  1045. // ForceSendFields is a list of field names (e.g.
  1046. // "DimensionFilterClauses") to unconditionally include in API requests.
  1047. // By default, fields with empty values are omitted from API requests.
  1048. // However, any non-pointer, non-interface field appearing in
  1049. // ForceSendFields will be sent to the server regardless of whether the
  1050. // field is empty or not. This may be used to include empty fields in
  1051. // Patch requests.
  1052. ForceSendFields []string `json:"-"`
  1053. // NullFields is a list of field names (e.g. "DimensionFilterClauses")
  1054. // to include in API requests with the JSON null value. By default,
  1055. // fields with empty values are omitted from API requests. However, any
  1056. // field with an empty value appearing in NullFields will be sent to the
  1057. // server as null. It is an error if a field in this list has a
  1058. // non-empty value. This may be used to include null fields in Patch
  1059. // requests.
  1060. NullFields []string `json:"-"`
  1061. }
  1062. func (s *Pivot) MarshalJSON() ([]byte, error) {
  1063. type NoMethod Pivot
  1064. raw := NoMethod(*s)
  1065. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1066. }
  1067. // PivotHeader: The headers for each of the pivot sections defined in
  1068. // the request.
  1069. type PivotHeader struct {
  1070. // PivotHeaderEntries: A single pivot section header.
  1071. PivotHeaderEntries []*PivotHeaderEntry `json:"pivotHeaderEntries,omitempty"`
  1072. // TotalPivotGroupsCount: The total number of groups for this pivot.
  1073. TotalPivotGroupsCount int64 `json:"totalPivotGroupsCount,omitempty"`
  1074. // ForceSendFields is a list of field names (e.g. "PivotHeaderEntries")
  1075. // to unconditionally include in API requests. By default, fields with
  1076. // empty values are omitted from API requests. However, any non-pointer,
  1077. // non-interface field appearing in ForceSendFields will be sent to the
  1078. // server regardless of whether the field is empty or not. This may be
  1079. // used to include empty fields in Patch requests.
  1080. ForceSendFields []string `json:"-"`
  1081. // NullFields is a list of field names (e.g. "PivotHeaderEntries") to
  1082. // include in API requests with the JSON null value. By default, fields
  1083. // with empty values are omitted from API requests. However, any field
  1084. // with an empty value appearing in NullFields will be sent to the
  1085. // server as null. It is an error if a field in this list has a
  1086. // non-empty value. This may be used to include null fields in Patch
  1087. // requests.
  1088. NullFields []string `json:"-"`
  1089. }
  1090. func (s *PivotHeader) MarshalJSON() ([]byte, error) {
  1091. type NoMethod PivotHeader
  1092. raw := NoMethod(*s)
  1093. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1094. }
  1095. // PivotHeaderEntry: The headers for the each of the metric column
  1096. // corresponding to the metrics
  1097. // requested in the pivots section of the response.
  1098. type PivotHeaderEntry struct {
  1099. // DimensionNames: The name of the dimensions in the pivot response.
  1100. DimensionNames []string `json:"dimensionNames,omitempty"`
  1101. // DimensionValues: The values for the dimensions in the pivot.
  1102. DimensionValues []string `json:"dimensionValues,omitempty"`
  1103. // Metric: The metric header for the metric in the pivot.
  1104. Metric *MetricHeaderEntry `json:"metric,omitempty"`
  1105. // ForceSendFields is a list of field names (e.g. "DimensionNames") to
  1106. // unconditionally include in API requests. By default, fields with
  1107. // empty values are omitted from API requests. However, any non-pointer,
  1108. // non-interface field appearing in ForceSendFields will be sent to the
  1109. // server regardless of whether the field is empty or not. This may be
  1110. // used to include empty fields in Patch requests.
  1111. ForceSendFields []string `json:"-"`
  1112. // NullFields is a list of field names (e.g. "DimensionNames") to
  1113. // include in API requests with the JSON null value. By default, fields
  1114. // with empty values are omitted from API requests. However, any field
  1115. // with an empty value appearing in NullFields will be sent to the
  1116. // server as null. It is an error if a field in this list has a
  1117. // non-empty value. This may be used to include null fields in Patch
  1118. // requests.
  1119. NullFields []string `json:"-"`
  1120. }
  1121. func (s *PivotHeaderEntry) MarshalJSON() ([]byte, error) {
  1122. type NoMethod PivotHeaderEntry
  1123. raw := NoMethod(*s)
  1124. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1125. }
  1126. // PivotValueRegion: The metric values in the pivot region.
  1127. type PivotValueRegion struct {
  1128. // Values: The values of the metrics in each of the pivot regions.
  1129. Values []string `json:"values,omitempty"`
  1130. // ForceSendFields is a list of field names (e.g. "Values") to
  1131. // unconditionally include in API requests. By default, fields with
  1132. // empty values are omitted from API requests. However, any non-pointer,
  1133. // non-interface field appearing in ForceSendFields will be sent to the
  1134. // server regardless of whether the field is empty or not. This may be
  1135. // used to include empty fields in Patch requests.
  1136. ForceSendFields []string `json:"-"`
  1137. // NullFields is a list of field names (e.g. "Values") to include in API
  1138. // requests with the JSON null value. By default, fields with empty
  1139. // values are omitted from API requests. However, any field with an
  1140. // empty value appearing in NullFields will be sent to the server as
  1141. // null. It is an error if a field in this list has a non-empty value.
  1142. // This may be used to include null fields in Patch requests.
  1143. NullFields []string `json:"-"`
  1144. }
  1145. func (s *PivotValueRegion) MarshalJSON() ([]byte, error) {
  1146. type NoMethod PivotValueRegion
  1147. raw := NoMethod(*s)
  1148. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1149. }
  1150. // Report: The data response corresponding to the request.
  1151. type Report struct {
  1152. // ColumnHeader: The column headers.
  1153. ColumnHeader *ColumnHeader `json:"columnHeader,omitempty"`
  1154. // Data: Response data.
  1155. Data *ReportData `json:"data,omitempty"`
  1156. // NextPageToken: Page token to retrieve the next page of results in the
  1157. // list.
  1158. NextPageToken string `json:"nextPageToken,omitempty"`
  1159. // ForceSendFields is a list of field names (e.g. "ColumnHeader") to
  1160. // unconditionally include in API requests. By default, fields with
  1161. // empty values are omitted from API requests. However, any non-pointer,
  1162. // non-interface field appearing in ForceSendFields will be sent to the
  1163. // server regardless of whether the field is empty or not. This may be
  1164. // used to include empty fields in Patch requests.
  1165. ForceSendFields []string `json:"-"`
  1166. // NullFields is a list of field names (e.g. "ColumnHeader") to include
  1167. // in API requests with the JSON null value. By default, fields with
  1168. // empty values are omitted from API requests. However, any field with
  1169. // an empty value appearing in NullFields will be sent to the server as
  1170. // null. It is an error if a field in this list has a non-empty value.
  1171. // This may be used to include null fields in Patch requests.
  1172. NullFields []string `json:"-"`
  1173. }
  1174. func (s *Report) MarshalJSON() ([]byte, error) {
  1175. type NoMethod Report
  1176. raw := NoMethod(*s)
  1177. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1178. }
  1179. // ReportData: The data part of the report.
  1180. type ReportData struct {
  1181. // DataLastRefreshed: The last time the data in the report was
  1182. // refreshed. All the hits received
  1183. // before this timestamp are included in the calculation of the report.
  1184. DataLastRefreshed string `json:"dataLastRefreshed,omitempty"`
  1185. // IsDataGolden: Indicates if response to this request is golden or not.
  1186. // Data is
  1187. // golden when the exact same request will not produce any new results
  1188. // if
  1189. // asked at a later point in time.
  1190. IsDataGolden bool `json:"isDataGolden,omitempty"`
  1191. // Maximums: Minimum and maximum values seen over all matching rows.
  1192. // These are both
  1193. // empty when `hideValueRanges` in the request is false, or
  1194. // when
  1195. // rowCount is zero.
  1196. Maximums []*DateRangeValues `json:"maximums,omitempty"`
  1197. // Minimums: Minimum and maximum values seen over all matching rows.
  1198. // These are both
  1199. // empty when `hideValueRanges` in the request is false, or
  1200. // when
  1201. // rowCount is zero.
  1202. Minimums []*DateRangeValues `json:"minimums,omitempty"`
  1203. // RowCount: Total number of matching rows for this query.
  1204. RowCount int64 `json:"rowCount,omitempty"`
  1205. // Rows: There's one ReportRow for every unique combination of
  1206. // dimensions.
  1207. Rows []*ReportRow `json:"rows,omitempty"`
  1208. // SamplesReadCounts: If the results
  1209. // are
  1210. // [sampled](https://support.google.com/analytics/answer/2637192),
  1211. // th
  1212. // is returns the total number of samples read, one entry per date
  1213. // range.
  1214. // If the results are not sampled this field will not be defined.
  1215. // See
  1216. // [developer
  1217. // guide](/analytics/devguides/reporting/core/v4/basics#sampling)
  1218. // for details.
  1219. SamplesReadCounts googleapi.Int64s `json:"samplesReadCounts,omitempty"`
  1220. // SamplingSpaceSizes: If the results
  1221. // are
  1222. // [sampled](https://support.google.com/analytics/answer/2637192),
  1223. // th
  1224. // is returns the total number of
  1225. // samples present, one entry per date range. If the results are not
  1226. // sampled
  1227. // this field will not be defined. See
  1228. // [developer
  1229. // guide](/analytics/devguides/reporting/core/v4/basics#sampling)
  1230. // for details.
  1231. SamplingSpaceSizes googleapi.Int64s `json:"samplingSpaceSizes,omitempty"`
  1232. // Totals: For each requested date range, for the set of all rows that
  1233. // match
  1234. // the query, every requested value format gets a total. The total
  1235. // for a value format is computed by first totaling the
  1236. // metrics
  1237. // mentioned in the value format and then evaluating the value
  1238. // format as a scalar expression. E.g., The "totals" for
  1239. // `3 / (ga:sessions + 2)` we compute
  1240. // `3 / ((sum of all relevant ga:sessions) + 2)`.
  1241. // Totals are computed before pagination.
  1242. Totals []*DateRangeValues `json:"totals,omitempty"`
  1243. // ForceSendFields is a list of field names (e.g. "DataLastRefreshed")
  1244. // to unconditionally include in API requests. By default, fields with
  1245. // empty values are omitted from API requests. However, any non-pointer,
  1246. // non-interface field appearing in ForceSendFields will be sent to the
  1247. // server regardless of whether the field is empty or not. This may be
  1248. // used to include empty fields in Patch requests.
  1249. ForceSendFields []string `json:"-"`
  1250. // NullFields is a list of field names (e.g. "DataLastRefreshed") to
  1251. // include in API requests with the JSON null value. By default, fields
  1252. // with empty values are omitted from API requests. However, any field
  1253. // with an empty value appearing in NullFields will be sent to the
  1254. // server as null. It is an error if a field in this list has a
  1255. // non-empty value. This may be used to include null fields in Patch
  1256. // requests.
  1257. NullFields []string `json:"-"`
  1258. }
  1259. func (s *ReportData) MarshalJSON() ([]byte, error) {
  1260. type NoMethod ReportData
  1261. raw := NoMethod(*s)
  1262. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1263. }
  1264. // ReportRequest: The main request class which specifies the Reporting
  1265. // API request.
  1266. type ReportRequest struct {
  1267. // CohortGroup: Cohort group associated with this request. If there is a
  1268. // cohort group
  1269. // in the request the `ga:cohort` dimension must be present.
  1270. // Every [ReportRequest](#ReportRequest) within a `batchGet` method
  1271. // must
  1272. // contain the same `cohortGroup` definition.
  1273. CohortGroup *CohortGroup `json:"cohortGroup,omitempty"`
  1274. // DateRanges: Date ranges in the request. The request can have a
  1275. // maximum of 2 date
  1276. // ranges. The response will contain a set of metric values for
  1277. // each
  1278. // combination of the dimensions for each date range in the request. So,
  1279. // if
  1280. // there are two date ranges, there will be two set of metric values,
  1281. // one for
  1282. // the original date range and one for the second date range.
  1283. // The `reportRequest.dateRanges` field should not be specified for
  1284. // cohorts
  1285. // or Lifetime value requests.
  1286. // If a date range is not provided, the default date range is
  1287. // (startDate:
  1288. // current date - 7 days, endDate: current date - 1 day).
  1289. // Every
  1290. // [ReportRequest](#ReportRequest) within a `batchGet` method
  1291. // must
  1292. // contain the same `dateRanges` definition.
  1293. DateRanges []*DateRange `json:"dateRanges,omitempty"`
  1294. // DimensionFilterClauses: The dimension filter clauses for filtering
  1295. // Dimension Values. They are
  1296. // logically combined with the `AND` operator. Note that filtering
  1297. // occurs
  1298. // before any dimensions are aggregated, so that the returned
  1299. // metrics
  1300. // represent the total for only the relevant dimensions.
  1301. DimensionFilterClauses []*DimensionFilterClause `json:"dimensionFilterClauses,omitempty"`
  1302. // Dimensions: The dimensions requested.
  1303. // Requests can have a total of 7 dimensions.
  1304. Dimensions []*Dimension `json:"dimensions,omitempty"`
  1305. // FiltersExpression: Dimension or metric filters that restrict the data
  1306. // returned for your
  1307. // request. To use the `filtersExpression`, supply a dimension or metric
  1308. // on
  1309. // which to filter, followed by the filter expression. For example,
  1310. // the
  1311. // following expression selects `ga:browser` dimension which starts
  1312. // with
  1313. // Firefox; `ga:browser=~^Firefox`. For more information on
  1314. // dimensions
  1315. // and metric filters, see
  1316. // [Filters
  1317. // reference](https://developers.google.com/analytics/devguides/reporting
  1318. // /core/v3/reference#filters).
  1319. FiltersExpression string `json:"filtersExpression,omitempty"`
  1320. // HideTotals: If set to true, hides the total of all metrics for all
  1321. // the matching rows,
  1322. // for every date range. The default false and will return the totals.
  1323. HideTotals bool `json:"hideTotals,omitempty"`
  1324. // HideValueRanges: If set to true, hides the minimum and maximum across
  1325. // all matching rows.
  1326. // The default is false and the value ranges are returned.
  1327. HideValueRanges bool `json:"hideValueRanges,omitempty"`
  1328. // IncludeEmptyRows: If set to false, the response does not include rows
  1329. // if all the retrieved
  1330. // metrics are equal to zero. The default is false which will exclude
  1331. // these
  1332. // rows.
  1333. IncludeEmptyRows bool `json:"includeEmptyRows,omitempty"`
  1334. // MetricFilterClauses: The metric filter clauses. They are logically
  1335. // combined with the `AND`
  1336. // operator. Metric filters look at only the first date range and not
  1337. // the
  1338. // comparing date range. Note that filtering on metrics occurs after
  1339. // the
  1340. // metrics are aggregated.
  1341. MetricFilterClauses []*MetricFilterClause `json:"metricFilterClauses,omitempty"`
  1342. // Metrics: The metrics requested.
  1343. // Requests must specify at least one metric. Requests can have a
  1344. // total of 10 metrics.
  1345. Metrics []*Metric `json:"metrics,omitempty"`
  1346. // OrderBys: Sort order on output rows. To compare two rows, the
  1347. // elements of the
  1348. // following are applied in order until a difference is found. All
  1349. // date
  1350. // ranges in the output get the same row order.
  1351. OrderBys []*OrderBy `json:"orderBys,omitempty"`
  1352. // PageSize: Page size is for paging and specifies the maximum number of
  1353. // returned rows.
  1354. // Page size should be >= 0. A query returns the default of 1,000
  1355. // rows.
  1356. // The Analytics Core Reporting API returns a maximum of 100,000 rows
  1357. // per
  1358. // request, no matter how many you ask for. It can also return fewer
  1359. // rows
  1360. // than requested, if there aren't as many dimension segments as you
  1361. // expect.
  1362. // For instance, there are fewer than 300 possible values for
  1363. // `ga:country`,
  1364. // so when segmenting only by country, you can't get more than 300
  1365. // rows,
  1366. // even if you set `pageSize` to a higher value.
  1367. PageSize int64 `json:"pageSize,omitempty"`
  1368. // PageToken: A continuation token to get the next page of the results.
  1369. // Adding this to
  1370. // the request will return the rows after the pageToken. The pageToken
  1371. // should
  1372. // be the value returned in the nextPageToken parameter in the response
  1373. // to
  1374. // the GetReports request.
  1375. PageToken string `json:"pageToken,omitempty"`
  1376. // Pivots: The pivot definitions. Requests can have a maximum of 2
  1377. // pivots.
  1378. Pivots []*Pivot `json:"pivots,omitempty"`
  1379. // SamplingLevel: The desired
  1380. // report
  1381. // [sample](https://support.google.com/analytics/answer/2637192)
  1382. // size.
  1383. // If the the `samplingLevel` field is unspecified the `DEFAULT`
  1384. // sampling
  1385. // level is used. Every [ReportRequest](#ReportRequest) within
  1386. // a
  1387. // `batchGet` method must contain the same `samplingLevel` definition.
  1388. // See
  1389. // [developer
  1390. // guide](/analytics/devguides/reporting/core/v4/basics#sampling)
  1391. // for details.
  1392. //
  1393. // Possible values:
  1394. // "SAMPLING_UNSPECIFIED" - If the `samplingLevel` field is
  1395. // unspecified the `DEFAULT` sampling level
  1396. // is used.
  1397. // "DEFAULT" - Returns response with a sample size that balances speed
  1398. // and
  1399. // accuracy.
  1400. // "SMALL" - It returns a fast response with a smaller sampling size.
  1401. // "LARGE" - Returns a more accurate response using a large sampling
  1402. // size. But this
  1403. // may result in response being slower.
  1404. SamplingLevel string `json:"samplingLevel,omitempty"`
  1405. // Segments: Segment the data returned for the request. A segment
  1406. // definition helps look
  1407. // at a subset of the segment request. A request can contain up to
  1408. // four
  1409. // segments. Every [ReportRequest](#ReportRequest) within a
  1410. // `batchGet` method must contain the same `segments` definition.
  1411. // Requests
  1412. // with segments must have the `ga:segment` dimension.
  1413. Segments []*Segment `json:"segments,omitempty"`
  1414. // ViewId: The Analytics
  1415. // [view ID](https://support.google.com/analytics/answer/1009618)
  1416. // from which to retrieve data. Every
  1417. // [ReportRequest](#ReportRequest)
  1418. // within a `batchGet` method must contain the same `viewId`.
  1419. ViewId string `json:"viewId,omitempty"`
  1420. // ForceSendFields is a list of field names (e.g. "CohortGroup") to
  1421. // unconditionally include in API requests. By default, fields with
  1422. // empty values are omitted from API requests. However, any non-pointer,
  1423. // non-interface field appearing in ForceSendFields will be sent to the
  1424. // server regardless of whether the field is empty or not. This may be
  1425. // used to include empty fields in Patch requests.
  1426. ForceSendFields []string `json:"-"`
  1427. // NullFields is a list of field names (e.g. "CohortGroup") to include
  1428. // in API requests with the JSON null value. By default, fields with
  1429. // empty values are omitted from API requests. However, any field with
  1430. // an empty value appearing in NullFields will be sent to the server as
  1431. // null. It is an error if a field in this list has a non-empty value.
  1432. // This may be used to include null fields in Patch requests.
  1433. NullFields []string `json:"-"`
  1434. }
  1435. func (s *ReportRequest) MarshalJSON() ([]byte, error) {
  1436. type NoMethod ReportRequest
  1437. raw := NoMethod(*s)
  1438. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1439. }
  1440. // ReportRow: A row in the report.
  1441. type ReportRow struct {
  1442. // Dimensions: List of requested dimensions.
  1443. Dimensions []string `json:"dimensions,omitempty"`
  1444. // Metrics: List of metrics for each requested DateRange.
  1445. Metrics []*DateRangeValues `json:"metrics,omitempty"`
  1446. // ForceSendFields is a list of field names (e.g. "Dimensions") to
  1447. // unconditionally include in API requests. By default, fields with
  1448. // empty values are omitted from API requests. However, any non-pointer,
  1449. // non-interface field appearing in ForceSendFields will be sent to the
  1450. // server regardless of whether the field is empty or not. This may be
  1451. // used to include empty fields in Patch requests.
  1452. ForceSendFields []string `json:"-"`
  1453. // NullFields is a list of field names (e.g. "Dimensions") to include in
  1454. // API requests with the JSON null value. By default, fields with empty
  1455. // values are omitted from API requests. However, any field with an
  1456. // empty value appearing in NullFields will be sent to the server as
  1457. // null. It is an error if a field in this list has a non-empty value.
  1458. // This may be used to include null fields in Patch requests.
  1459. NullFields []string `json:"-"`
  1460. }
  1461. func (s *ReportRow) MarshalJSON() ([]byte, error) {
  1462. type NoMethod ReportRow
  1463. raw := NoMethod(*s)
  1464. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1465. }
  1466. // ResourceQuotasRemaining: The resource quota tokens remaining for the
  1467. // property after the request is
  1468. // completed.
  1469. type ResourceQuotasRemaining struct {
  1470. // DailyQuotaTokensRemaining: Daily resource quota remaining remaining.
  1471. DailyQuotaTokensRemaining int64 `json:"dailyQuotaTokensRemaining,omitempty"`
  1472. // HourlyQuotaTokensRemaining: Hourly resource quota tokens remaining.
  1473. HourlyQuotaTokensRemaining int64 `json:"hourlyQuotaTokensRemaining,omitempty"`
  1474. // ForceSendFields is a list of field names (e.g.
  1475. // "DailyQuotaTokensRemaining") to unconditionally include in API
  1476. // requests. By default, fields with empty values are omitted from API
  1477. // requests. However, any non-pointer, non-interface field appearing in
  1478. // ForceSendFields will be sent to the server regardless of whether the
  1479. // field is empty or not. This may be used to include empty fields in
  1480. // Patch requests.
  1481. ForceSendFields []string `json:"-"`
  1482. // NullFields is a list of field names (e.g.
  1483. // "DailyQuotaTokensRemaining") to include in API requests with the JSON
  1484. // null value. By default, fields with empty values are omitted from API
  1485. // requests. However, any field with an empty value appearing in
  1486. // NullFields will be sent to the server as null. It is an error if a
  1487. // field in this list has a non-empty value. This may be used to include
  1488. // null fields in Patch requests.
  1489. NullFields []string `json:"-"`
  1490. }
  1491. func (s *ResourceQuotasRemaining) MarshalJSON() ([]byte, error) {
  1492. type NoMethod ResourceQuotasRemaining
  1493. raw := NoMethod(*s)
  1494. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1495. }
  1496. // Segment: The segment definition, if the report needs to be
  1497. // segmented.
  1498. // A Segment is a subset of the Analytics data. For example, of the
  1499. // entire
  1500. // set of users, one Segment might be users from a particular country or
  1501. // city.
  1502. type Segment struct {
  1503. // DynamicSegment: A dynamic segment definition in the request.
  1504. DynamicSegment *DynamicSegment `json:"dynamicSegment,omitempty"`
  1505. // SegmentId: The segment ID of a built-in or custom segment, for
  1506. // example `gaid::-3`.
  1507. SegmentId string `json:"segmentId,omitempty"`
  1508. // ForceSendFields is a list of field names (e.g. "DynamicSegment") to
  1509. // unconditionally include in API requests. By default, fields with
  1510. // empty values are omitted from API requests. However, any non-pointer,
  1511. // non-interface field appearing in ForceSendFields will be sent to the
  1512. // server regardless of whether the field is empty or not. This may be
  1513. // used to include empty fields in Patch requests.
  1514. ForceSendFields []string `json:"-"`
  1515. // NullFields is a list of field names (e.g. "DynamicSegment") to
  1516. // include in API requests with the JSON null value. By default, fields
  1517. // with empty values are omitted from API requests. However, any field
  1518. // with an empty value appearing in NullFields will be sent to the
  1519. // server as null. It is an error if a field in this list has a
  1520. // non-empty value. This may be used to include null fields in Patch
  1521. // requests.
  1522. NullFields []string `json:"-"`
  1523. }
  1524. func (s *Segment) MarshalJSON() ([]byte, error) {
  1525. type NoMethod Segment
  1526. raw := NoMethod(*s)
  1527. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1528. }
  1529. // SegmentDefinition: SegmentDefinition defines the segment to be a set
  1530. // of SegmentFilters which
  1531. // are combined together with a logical `AND` operation.
  1532. type SegmentDefinition struct {
  1533. // SegmentFilters: A segment is defined by a set of segment filters
  1534. // which are combined
  1535. // together with a logical `AND` operation.
  1536. SegmentFilters []*SegmentFilter `json:"segmentFilters,omitempty"`
  1537. // ForceSendFields is a list of field names (e.g. "SegmentFilters") to
  1538. // unconditionally include in API requests. By default, fields with
  1539. // empty values are omitted from API requests. However, any non-pointer,
  1540. // non-interface field appearing in ForceSendFields will be sent to the
  1541. // server regardless of whether the field is empty or not. This may be
  1542. // used to include empty fields in Patch requests.
  1543. ForceSendFields []string `json:"-"`
  1544. // NullFields is a list of field names (e.g. "SegmentFilters") to
  1545. // include in API requests with the JSON null value. By default, fields
  1546. // with empty values are omitted from API requests. However, any field
  1547. // with an empty value appearing in NullFields will be sent to the
  1548. // server as null. It is an error if a field in this list has a
  1549. // non-empty value. This may be used to include null fields in Patch
  1550. // requests.
  1551. NullFields []string `json:"-"`
  1552. }
  1553. func (s *SegmentDefinition) MarshalJSON() ([]byte, error) {
  1554. type NoMethod SegmentDefinition
  1555. raw := NoMethod(*s)
  1556. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1557. }
  1558. // SegmentDimensionFilter: Dimension filter specifies the filtering
  1559. // options on a dimension.
  1560. type SegmentDimensionFilter struct {
  1561. // CaseSensitive: Should the match be case sensitive, ignored for
  1562. // `IN_LIST` operator.
  1563. CaseSensitive bool `json:"caseSensitive,omitempty"`
  1564. // DimensionName: Name of the dimension for which the filter is being
  1565. // applied.
  1566. DimensionName string `json:"dimensionName,omitempty"`
  1567. // Expressions: The list of expressions, only the first element is used
  1568. // for all operators
  1569. Expressions []string `json:"expressions,omitempty"`
  1570. // MaxComparisonValue: Maximum comparison values for `BETWEEN` match
  1571. // type.
  1572. MaxComparisonValue string `json:"maxComparisonValue,omitempty"`
  1573. // MinComparisonValue: Minimum comparison values for `BETWEEN` match
  1574. // type.
  1575. MinComparisonValue string `json:"minComparisonValue,omitempty"`
  1576. // Operator: The operator to use to match the dimension with the
  1577. // expressions.
  1578. //
  1579. // Possible values:
  1580. // "OPERATOR_UNSPECIFIED" - If the match type is unspecified, it is
  1581. // treated as a REGEXP.
  1582. // "REGEXP" - The match expression is treated as a regular expression.
  1583. // All other match
  1584. // types are not treated as regular expressions.
  1585. // "BEGINS_WITH" - Matches the values which begin with the match
  1586. // expression provided.
  1587. // "ENDS_WITH" - Matches the values which end with the match
  1588. // expression provided.
  1589. // "PARTIAL" - Substring match.
  1590. // "EXACT" - The value should match the match expression entirely.
  1591. // "IN_LIST" - This option is used to specify a dimension filter whose
  1592. // expression can
  1593. // take any value from a selected list of values. This helps
  1594. // avoiding
  1595. // evaluating multiple exact match dimension filters which are OR'ed
  1596. // for
  1597. // every single response row. For example:
  1598. //
  1599. // expressions: ["A", "B", "C"]
  1600. //
  1601. // Any response row whose dimension has it is value as A, B or C,
  1602. // matches
  1603. // this DimensionFilter.
  1604. // "NUMERIC_LESS_THAN" - Integer comparison filters.
  1605. // case sensitivity is ignored for these and the expression
  1606. // is assumed to be a string representing an integer.
  1607. // Failure conditions:
  1608. //
  1609. // - if expression is not a valid int64, the client should expect
  1610. // an error.
  1611. // - input dimensions that are not valid int64 values will never match
  1612. // the
  1613. // filter.
  1614. //
  1615. // Checks if the dimension is numerically less than the match
  1616. // expression.
  1617. // "NUMERIC_GREATER_THAN" - Checks if the dimension is numerically
  1618. // greater than the match
  1619. // expression.
  1620. // "NUMERIC_BETWEEN" - Checks if the dimension is numerically between
  1621. // the minimum and maximum
  1622. // of the match expression, boundaries excluded.
  1623. Operator string `json:"operator,omitempty"`
  1624. // ForceSendFields is a list of field names (e.g. "CaseSensitive") to
  1625. // unconditionally include in API requests. By default, fields with
  1626. // empty values are omitted from API requests. However, any non-pointer,
  1627. // non-interface field appearing in ForceSendFields will be sent to the
  1628. // server regardless of whether the field is empty or not. This may be
  1629. // used to include empty fields in Patch requests.
  1630. ForceSendFields []string `json:"-"`
  1631. // NullFields is a list of field names (e.g. "CaseSensitive") to include
  1632. // in API requests with the JSON null value. By default, fields with
  1633. // empty values are omitted from API requests. However, any field with
  1634. // an empty value appearing in NullFields will be sent to the server as
  1635. // null. It is an error if a field in this list has a non-empty value.
  1636. // This may be used to include null fields in Patch requests.
  1637. NullFields []string `json:"-"`
  1638. }
  1639. func (s *SegmentDimensionFilter) MarshalJSON() ([]byte, error) {
  1640. type NoMethod SegmentDimensionFilter
  1641. raw := NoMethod(*s)
  1642. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1643. }
  1644. // SegmentFilter: SegmentFilter defines the segment to be either a
  1645. // simple or a sequence
  1646. // segment. A simple segment condition contains dimension and metric
  1647. // conditions
  1648. // to select the sessions or users. A sequence segment condition can be
  1649. // used to
  1650. // select users or sessions based on sequential conditions.
  1651. type SegmentFilter struct {
  1652. // Not: If true, match the complement of simple or sequence segment.
  1653. // For example, to match all visits not from "New York", we can define
  1654. // the
  1655. // segment as follows:
  1656. //
  1657. // "sessionSegment": {
  1658. // "segmentFilters": [{
  1659. // "simpleSegment" :{
  1660. // "orFiltersForSegment": [{
  1661. // "segmentFilterClauses":[{
  1662. // "dimensionFilter": {
  1663. // "dimensionName": "ga:city",
  1664. // "expressions": ["New York"]
  1665. // }
  1666. // }]
  1667. // }]
  1668. // },
  1669. // "not": "True"
  1670. // }]
  1671. // },
  1672. Not bool `json:"not,omitempty"`
  1673. // SequenceSegment: Sequence conditions consist of one or more steps,
  1674. // where each step is
  1675. // defined by one or more dimension/metric conditions. Multiple steps
  1676. // can
  1677. // be combined with special sequence operators.
  1678. SequenceSegment *SequenceSegment `json:"sequenceSegment,omitempty"`
  1679. // SimpleSegment: A Simple segment conditions consist of one or more
  1680. // dimension/metric
  1681. // conditions that can be combined
  1682. SimpleSegment *SimpleSegment `json:"simpleSegment,omitempty"`
  1683. // ForceSendFields is a list of field names (e.g. "Not") to
  1684. // unconditionally include in API requests. By default, fields with
  1685. // empty values are omitted from API requests. However, any non-pointer,
  1686. // non-interface field appearing in ForceSendFields will be sent to the
  1687. // server regardless of whether the field is empty or not. This may be
  1688. // used to include empty fields in Patch requests.
  1689. ForceSendFields []string `json:"-"`
  1690. // NullFields is a list of field names (e.g. "Not") to include in API
  1691. // requests with the JSON null value. By default, fields with empty
  1692. // values are omitted from API requests. However, any field with an
  1693. // empty value appearing in NullFields will be sent to the server as
  1694. // null. It is an error if a field in this list has a non-empty value.
  1695. // This may be used to include null fields in Patch requests.
  1696. NullFields []string `json:"-"`
  1697. }
  1698. func (s *SegmentFilter) MarshalJSON() ([]byte, error) {
  1699. type NoMethod SegmentFilter
  1700. raw := NoMethod(*s)
  1701. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1702. }
  1703. // SegmentFilterClause: Filter Clause to be used in a segment
  1704. // definition, can be wither a metric or
  1705. // a dimension filter.
  1706. type SegmentFilterClause struct {
  1707. // DimensionFilter: Dimension Filter for the segment definition.
  1708. DimensionFilter *SegmentDimensionFilter `json:"dimensionFilter,omitempty"`
  1709. // MetricFilter: Metric Filter for the segment definition.
  1710. MetricFilter *SegmentMetricFilter `json:"metricFilter,omitempty"`
  1711. // Not: Matches the complement (`!`) of the filter.
  1712. Not bool `json:"not,omitempty"`
  1713. // ForceSendFields is a list of field names (e.g. "DimensionFilter") to
  1714. // unconditionally include in API requests. By default, fields with
  1715. // empty values are omitted from API requests. However, any non-pointer,
  1716. // non-interface field appearing in ForceSendFields will be sent to the
  1717. // server regardless of whether the field is empty or not. This may be
  1718. // used to include empty fields in Patch requests.
  1719. ForceSendFields []string `json:"-"`
  1720. // NullFields is a list of field names (e.g. "DimensionFilter") to
  1721. // include in API requests with the JSON null value. By default, fields
  1722. // with empty values are omitted from API requests. However, any field
  1723. // with an empty value appearing in NullFields will be sent to the
  1724. // server as null. It is an error if a field in this list has a
  1725. // non-empty value. This may be used to include null fields in Patch
  1726. // requests.
  1727. NullFields []string `json:"-"`
  1728. }
  1729. func (s *SegmentFilterClause) MarshalJSON() ([]byte, error) {
  1730. type NoMethod SegmentFilterClause
  1731. raw := NoMethod(*s)
  1732. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1733. }
  1734. // SegmentMetricFilter: Metric filter to be used in a segment filter
  1735. // clause.
  1736. type SegmentMetricFilter struct {
  1737. // ComparisonValue: The value to compare against. If the operator is
  1738. // `BETWEEN`, this value is
  1739. // treated as minimum comparison value.
  1740. ComparisonValue string `json:"comparisonValue,omitempty"`
  1741. // MaxComparisonValue: Max comparison value is only used for `BETWEEN`
  1742. // operator.
  1743. MaxComparisonValue string `json:"maxComparisonValue,omitempty"`
  1744. // MetricName: The metric that will be filtered on. A `metricFilter`
  1745. // must contain a
  1746. // metric name.
  1747. MetricName string `json:"metricName,omitempty"`
  1748. // Operator: Specifies is the operation to perform to compare the
  1749. // metric. The default
  1750. // is `EQUAL`.
  1751. //
  1752. // Possible values:
  1753. // "UNSPECIFIED_OPERATOR" - Unspecified operator is treated as
  1754. // `LESS_THAN` operator.
  1755. // "LESS_THAN" - Checks if the metric value is less than comparison
  1756. // value.
  1757. // "GREATER_THAN" - Checks if the metric value is greater than
  1758. // comparison value.
  1759. // "EQUAL" - Equals operator.
  1760. // "BETWEEN" - For between operator, both the minimum and maximum are
  1761. // exclusive.
  1762. // We will use `LT` and `GT` for comparison.
  1763. Operator string `json:"operator,omitempty"`
  1764. // Scope: Scope for a metric defines the level at which that metric is
  1765. // defined. The
  1766. // specified metric scope must be equal to or greater than its primary
  1767. // scope
  1768. // as defined in the data model. The primary scope is defined by if
  1769. // the
  1770. // segment is selecting users or sessions.
  1771. //
  1772. // Possible values:
  1773. // "UNSPECIFIED_SCOPE" - If the scope is unspecified, it defaults to
  1774. // the condition scope,
  1775. // `USER` or `SESSION` depending on if the segment is trying to
  1776. // choose
  1777. // users or sessions.
  1778. // "PRODUCT" - Product scope.
  1779. // "HIT" - Hit scope.
  1780. // "SESSION" - Session scope.
  1781. // "USER" - User scope.
  1782. Scope string `json:"scope,omitempty"`
  1783. // ForceSendFields is a list of field names (e.g. "ComparisonValue") to
  1784. // unconditionally include in API requests. By default, fields with
  1785. // empty values are omitted from API requests. However, any non-pointer,
  1786. // non-interface field appearing in ForceSendFields will be sent to the
  1787. // server regardless of whether the field is empty or not. This may be
  1788. // used to include empty fields in Patch requests.
  1789. ForceSendFields []string `json:"-"`
  1790. // NullFields is a list of field names (e.g. "ComparisonValue") to
  1791. // include in API requests with the JSON null value. By default, fields
  1792. // with empty values are omitted from API requests. However, any field
  1793. // with an empty value appearing in NullFields will be sent to the
  1794. // server as null. It is an error if a field in this list has a
  1795. // non-empty value. This may be used to include null fields in Patch
  1796. // requests.
  1797. NullFields []string `json:"-"`
  1798. }
  1799. func (s *SegmentMetricFilter) MarshalJSON() ([]byte, error) {
  1800. type NoMethod SegmentMetricFilter
  1801. raw := NoMethod(*s)
  1802. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1803. }
  1804. // SegmentSequenceStep: A segment sequence definition.
  1805. type SegmentSequenceStep struct {
  1806. // MatchType: Specifies if the step immediately precedes or can be any
  1807. // time before the
  1808. // next step.
  1809. //
  1810. // Possible values:
  1811. // "UNSPECIFIED_MATCH_TYPE" - Unspecified match type is treated as
  1812. // precedes.
  1813. // "PRECEDES" - Operator indicates that the previous step precedes the
  1814. // next step.
  1815. // "IMMEDIATELY_PRECEDES" - Operator indicates that the previous step
  1816. // immediately precedes the next
  1817. // step.
  1818. MatchType string `json:"matchType,omitempty"`
  1819. // OrFiltersForSegment: A sequence is specified with a list of Or
  1820. // grouped filters which are
  1821. // combined with `AND` operator.
  1822. OrFiltersForSegment []*OrFiltersForSegment `json:"orFiltersForSegment,omitempty"`
  1823. // ForceSendFields is a list of field names (e.g. "MatchType") to
  1824. // unconditionally include in API requests. By default, fields with
  1825. // empty values are omitted from API requests. However, any non-pointer,
  1826. // non-interface field appearing in ForceSendFields will be sent to the
  1827. // server regardless of whether the field is empty or not. This may be
  1828. // used to include empty fields in Patch requests.
  1829. ForceSendFields []string `json:"-"`
  1830. // NullFields is a list of field names (e.g. "MatchType") to include in
  1831. // API requests with the JSON null value. By default, fields with empty
  1832. // values are omitted from API requests. However, any field with an
  1833. // empty value appearing in NullFields will be sent to the server as
  1834. // null. It is an error if a field in this list has a non-empty value.
  1835. // This may be used to include null fields in Patch requests.
  1836. NullFields []string `json:"-"`
  1837. }
  1838. func (s *SegmentSequenceStep) MarshalJSON() ([]byte, error) {
  1839. type NoMethod SegmentSequenceStep
  1840. raw := NoMethod(*s)
  1841. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1842. }
  1843. // SequenceSegment: Sequence conditions consist of one or more steps,
  1844. // where each step is defined
  1845. // by one or more dimension/metric conditions. Multiple steps can be
  1846. // combined
  1847. // with special sequence operators.
  1848. type SequenceSegment struct {
  1849. // FirstStepShouldMatchFirstHit: If set, first step condition must match
  1850. // the first hit of the visitor (in
  1851. // the date range).
  1852. FirstStepShouldMatchFirstHit bool `json:"firstStepShouldMatchFirstHit,omitempty"`
  1853. // SegmentSequenceSteps: The list of steps in the sequence.
  1854. SegmentSequenceSteps []*SegmentSequenceStep `json:"segmentSequenceSteps,omitempty"`
  1855. // ForceSendFields is a list of field names (e.g.
  1856. // "FirstStepShouldMatchFirstHit") to unconditionally include in API
  1857. // requests. By default, fields with empty values are omitted from API
  1858. // requests. However, any non-pointer, non-interface field appearing in
  1859. // ForceSendFields will be sent to the server regardless of whether the
  1860. // field is empty or not. This may be used to include empty fields in
  1861. // Patch requests.
  1862. ForceSendFields []string `json:"-"`
  1863. // NullFields is a list of field names (e.g.
  1864. // "FirstStepShouldMatchFirstHit") to include in API requests with the
  1865. // JSON null value. By default, fields with empty values are omitted
  1866. // from API requests. However, any field with an empty value appearing
  1867. // in NullFields will be sent to the server as null. It is an error if a
  1868. // field in this list has a non-empty value. This may be used to include
  1869. // null fields in Patch requests.
  1870. NullFields []string `json:"-"`
  1871. }
  1872. func (s *SequenceSegment) MarshalJSON() ([]byte, error) {
  1873. type NoMethod SequenceSegment
  1874. raw := NoMethod(*s)
  1875. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1876. }
  1877. // SimpleSegment: A Simple segment conditions consist of one or more
  1878. // dimension/metric
  1879. // conditions that can be combined.
  1880. type SimpleSegment struct {
  1881. // OrFiltersForSegment: A list of segment filters groups which are
  1882. // combined with logical `AND`
  1883. // operator.
  1884. OrFiltersForSegment []*OrFiltersForSegment `json:"orFiltersForSegment,omitempty"`
  1885. // ForceSendFields is a list of field names (e.g. "OrFiltersForSegment")
  1886. // to unconditionally include in API requests. By default, fields with
  1887. // empty values are omitted from API requests. However, any non-pointer,
  1888. // non-interface field appearing in ForceSendFields will be sent to the
  1889. // server regardless of whether the field is empty or not. This may be
  1890. // used to include empty fields in Patch requests.
  1891. ForceSendFields []string `json:"-"`
  1892. // NullFields is a list of field names (e.g. "OrFiltersForSegment") to
  1893. // include in API requests with the JSON null value. By default, fields
  1894. // with empty values are omitted from API requests. However, any field
  1895. // with an empty value appearing in NullFields will be sent to the
  1896. // server as null. It is an error if a field in this list has a
  1897. // non-empty value. This may be used to include null fields in Patch
  1898. // requests.
  1899. NullFields []string `json:"-"`
  1900. }
  1901. func (s *SimpleSegment) MarshalJSON() ([]byte, error) {
  1902. type NoMethod SimpleSegment
  1903. raw := NoMethod(*s)
  1904. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1905. }
  1906. // method id "analyticsreporting.reports.batchGet":
  1907. type ReportsBatchGetCall struct {
  1908. s *Service
  1909. getreportsrequest *GetReportsRequest
  1910. urlParams_ gensupport.URLParams
  1911. ctx_ context.Context
  1912. header_ http.Header
  1913. }
  1914. // BatchGet: Returns the Analytics data.
  1915. func (r *ReportsService) BatchGet(getreportsrequest *GetReportsRequest) *ReportsBatchGetCall {
  1916. c := &ReportsBatchGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1917. c.getreportsrequest = getreportsrequest
  1918. return c
  1919. }
  1920. // Fields allows partial responses to be retrieved. See
  1921. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1922. // for more information.
  1923. func (c *ReportsBatchGetCall) Fields(s ...googleapi.Field) *ReportsBatchGetCall {
  1924. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1925. return c
  1926. }
  1927. // Context sets the context to be used in this call's Do method. Any
  1928. // pending HTTP request will be aborted if the provided context is
  1929. // canceled.
  1930. func (c *ReportsBatchGetCall) Context(ctx context.Context) *ReportsBatchGetCall {
  1931. c.ctx_ = ctx
  1932. return c
  1933. }
  1934. // Header returns an http.Header that can be modified by the caller to
  1935. // add HTTP headers to the request.
  1936. func (c *ReportsBatchGetCall) Header() http.Header {
  1937. if c.header_ == nil {
  1938. c.header_ = make(http.Header)
  1939. }
  1940. return c.header_
  1941. }
  1942. func (c *ReportsBatchGetCall) doRequest(alt string) (*http.Response, error) {
  1943. reqHeaders := make(http.Header)
  1944. for k, v := range c.header_ {
  1945. reqHeaders[k] = v
  1946. }
  1947. reqHeaders.Set("User-Agent", c.s.userAgent())
  1948. var body io.Reader = nil
  1949. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getreportsrequest)
  1950. if err != nil {
  1951. return nil, err
  1952. }
  1953. reqHeaders.Set("Content-Type", "application/json")
  1954. c.urlParams_.Set("alt", alt)
  1955. c.urlParams_.Set("prettyPrint", "false")
  1956. urls := googleapi.ResolveRelative(c.s.BasePath, "v4/reports:batchGet")
  1957. urls += "?" + c.urlParams_.Encode()
  1958. req, err := http.NewRequest("POST", urls, body)
  1959. if err != nil {
  1960. return nil, err
  1961. }
  1962. req.Header = reqHeaders
  1963. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1964. }
  1965. // Do executes the "analyticsreporting.reports.batchGet" call.
  1966. // Exactly one of *GetReportsResponse or error will be non-nil. Any
  1967. // non-2xx status code is an error. Response headers are in either
  1968. // *GetReportsResponse.ServerResponse.Header or (if a response was
  1969. // returned at all) in error.(*googleapi.Error).Header. Use
  1970. // googleapi.IsNotModified to check whether the returned error was
  1971. // because http.StatusNotModified was returned.
  1972. func (c *ReportsBatchGetCall) Do(opts ...googleapi.CallOption) (*GetReportsResponse, error) {
  1973. gensupport.SetOptions(c.urlParams_, opts...)
  1974. res, err := c.doRequest("json")
  1975. if res != nil && res.StatusCode == http.StatusNotModified {
  1976. if res.Body != nil {
  1977. res.Body.Close()
  1978. }
  1979. return nil, &googleapi.Error{
  1980. Code: res.StatusCode,
  1981. Header: res.Header,
  1982. }
  1983. }
  1984. if err != nil {
  1985. return nil, err
  1986. }
  1987. defer googleapi.CloseBody(res)
  1988. if err := googleapi.CheckResponse(res); err != nil {
  1989. return nil, err
  1990. }
  1991. ret := &GetReportsResponse{
  1992. ServerResponse: googleapi.ServerResponse{
  1993. Header: res.Header,
  1994. HTTPStatusCode: res.StatusCode,
  1995. },
  1996. }
  1997. target := &ret
  1998. if err := gensupport.DecodeResponse(target, res); err != nil {
  1999. return nil, err
  2000. }
  2001. return ret, nil
  2002. // {
  2003. // "description": "Returns the Analytics data.",
  2004. // "flatPath": "v4/reports:batchGet",
  2005. // "httpMethod": "POST",
  2006. // "id": "analyticsreporting.reports.batchGet",
  2007. // "parameterOrder": [],
  2008. // "parameters": {},
  2009. // "path": "v4/reports:batchGet",
  2010. // "request": {
  2011. // "$ref": "GetReportsRequest"
  2012. // },
  2013. // "response": {
  2014. // "$ref": "GetReportsResponse"
  2015. // },
  2016. // "scopes": [
  2017. // "https://www.googleapis.com/auth/analytics",
  2018. // "https://www.googleapis.com/auth/analytics.readonly"
  2019. // ]
  2020. // }
  2021. }