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.
 
 
 

2205 lines
86 KiB

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