Skip to content

Commit

Permalink
Update generated modules
Browse files Browse the repository at this point in the history
  • Loading branch information
astrada committed Sep 24, 2013
1 parent 8994fc7 commit 54ca7a4
Show file tree
Hide file tree
Showing 16 changed files with 1,655 additions and 151 deletions.
645 changes: 645 additions & 0 deletions src/gapi/gapiAnalyticsV3Model.ml

Large diffs are not rendered by default.

207 changes: 204 additions & 3 deletions src/gapi/gapiAnalyticsV3Model.mli
Expand Up @@ -6,6 +6,68 @@
{{:https://developers.google.com/analytics/}API Documentation}. {{:https://developers.google.com/analytics/}API Documentation}.
*) *)


module Column :
sig
type t = {
attributes : (string * string) list;
(** Map of attribute name and value for this column. *)
id : string;
(** Column id. *)
kind : string;
(** Resource type for Analytics column. *)

}

val attributes : (t, (string * string) list) GapiLens.t
val id : (t, string) GapiLens.t
val kind : (t, string) GapiLens.t

val empty : t

val render : t -> GapiJson.json_data_model list

val parse : t -> GapiJson.json_data_model -> t

val to_data_model : t -> GapiJson.json_data_model

val of_data_model : GapiJson.json_data_model -> t

end

module Columns :
sig
type t = {
attributeNames : string list;
(** List of attributes names returned by columns. *)
etag : string;
(** Etag of collection. This etag can be compared with the last response etag to check if response has changed. *)
items : Column.t list;
(** List of columns for a report type. *)
kind : string;
(** Collection type. *)
totalResults : int;
(** Total number of columns returned in the response. *)

}

val attributeNames : (t, string list) GapiLens.t
val etag : (t, string) GapiLens.t
val items : (t, Column.t list) GapiLens.t
val kind : (t, string) GapiLens.t
val totalResults : (t, int) GapiLens.t

val empty : t

val render : t -> GapiJson.json_data_model list

val parse : t -> GapiJson.json_data_model -> t

val to_data_model : t -> GapiJson.json_data_model

val of_data_model : GapiJson.json_data_model -> t

end

module Segment : module Segment :
sig sig
type t = { type t = {
Expand Down Expand Up @@ -720,9 +782,9 @@ sig
sig sig
type t = { type t = {
href : string; href : string;
(** Link to the list of daily uploads for this custom data source. *) (** Link to the list of daily uploads for this custom data source. Link to the list of uploads for this custom data source. *)
_type : string; _type : string;
(** Value is "analytics#dailyUploads". *) (** Value is "analytics#dailyUploads". Value is "analytics#uploads". *)


} }


Expand All @@ -741,7 +803,7 @@ sig
accountId : string; accountId : string;
(** Account ID to which this custom data source belongs. *) (** Account ID to which this custom data source belongs. *)
childLink : ChildLink.t; childLink : ChildLink.t;
(** Child link for this custom data source. Points to the list of daily uploads for this custom data source. *) (** *)
created : GapiDate.t; created : GapiDate.t;
(** Time this custom data source was created. *) (** Time this custom data source was created. *)
description : string; description : string;
Expand All @@ -758,6 +820,8 @@ sig
(** IDs of views (profiles) linked to the custom data source. *) (** IDs of views (profiles) linked to the custom data source. *)
selfLink : string; selfLink : string;
(** Link for this Analytics custom data source. *) (** Link for this Analytics custom data source. *)
_type : string;
(** Type of the custom data source. *)
updated : GapiDate.t; updated : GapiDate.t;
(** Time this custom data source was last modified. *) (** Time this custom data source was last modified. *)
webPropertyId : string; webPropertyId : string;
Expand All @@ -775,6 +839,7 @@ sig
val parentLink : (t, ParentLink.t) GapiLens.t val parentLink : (t, ParentLink.t) GapiLens.t
val profilesLinked : (t, string list) GapiLens.t val profilesLinked : (t, string list) GapiLens.t
val selfLink : (t, string) GapiLens.t val selfLink : (t, string) GapiLens.t
val _type : (t, string) GapiLens.t
val updated : (t, GapiDate.t) GapiLens.t val updated : (t, GapiDate.t) GapiLens.t
val webPropertyId : (t, string) GapiLens.t val webPropertyId : (t, string) GapiLens.t


Expand Down Expand Up @@ -1380,6 +1445,142 @@ sig


end end


module RealtimeData :
sig
module Query :
sig
type t = {
dimensions : string;
(** List of real time dimensions. *)
filters : string;
(** Comma-separated list of dimension or metric filters. *)
ids : string;
(** Unique table ID. *)
max_results : int;
(** Maximum results per page. *)
metrics : string list;
(** List of real time metrics. *)
sort : string list;
(** List of dimensions or metrics based on which real time data is sorted. *)

}

val dimensions : (t, string) GapiLens.t
val filters : (t, string) GapiLens.t
val ids : (t, string) GapiLens.t
val max_results : (t, int) GapiLens.t
val metrics : (t, string list) GapiLens.t
val sort : (t, string list) GapiLens.t

val empty : t

val render : t -> GapiJson.json_data_model list

val parse : t -> GapiJson.json_data_model -> t

end

module ProfileInfo :
sig
type t = {
accountId : string;
(** Account ID to which this view (profile) belongs. *)
internalWebPropertyId : string;
(** Internal ID for the web property to which this view (profile) belongs. *)
profileId : string;
(** View (Profile) ID. *)
profileName : string;
(** View (Profile) name. *)
tableId : string;
(** Table ID for view (profile). *)
webPropertyId : string;
(** Web Property ID to which this view (profile) belongs. *)

}

val accountId : (t, string) GapiLens.t
val internalWebPropertyId : (t, string) GapiLens.t
val profileId : (t, string) GapiLens.t
val profileName : (t, string) GapiLens.t
val tableId : (t, string) GapiLens.t
val webPropertyId : (t, string) GapiLens.t

val empty : t

val render : t -> GapiJson.json_data_model list

val parse : t -> GapiJson.json_data_model -> t

end

module ColumnHeaders :
sig
type t = {
columnType : string;
(** Column Type. Either DIMENSION or METRIC. *)
dataType : string;
(** Data type. Dimension column headers have only STRING as the data type. Metric column headers have data types for metric values such as INTEGER, DOUBLE, CURRENCY etc. *)
name : string;
(** Column name. *)

}

val columnType : (t, string) GapiLens.t
val dataType : (t, string) GapiLens.t
val name : (t, string) GapiLens.t

val empty : t

val render : t -> GapiJson.json_data_model list

val parse : t -> GapiJson.json_data_model -> t

end

type t = {
columnHeaders : ColumnHeaders.t list;
(** Column headers that list dimension names followed by the metric names. The order of dimensions and metrics is same as specified in the request. *)
id : string;
(** Unique ID for this data response. *)
kind : string;
(** Resource type. *)
profileInfo : ProfileInfo.t;
(** Information for the view (profile), for which the real time data was requested. *)
query : Query.t;
(** Real time data request query parameters. *)
rows : string list list;
(** Real time data rows, where each row contains a list of dimension values followed by the metric values. The order of dimensions and metrics is same as specified in the request. *)
selfLink : string;
(** Link to this page. *)
totalResults : int;
(** The total number of rows for the query, regardless of the number of rows in the response. *)
totalsForAllResults : (string * string) list;
(** Total values for the requested metrics over all the results, not just the results returned in this response. The order of the metric totals is same as the metric order specified in the request. *)

}

val columnHeaders : (t, ColumnHeaders.t list) GapiLens.t
val id : (t, string) GapiLens.t
val kind : (t, string) GapiLens.t
val profileInfo : (t, ProfileInfo.t) GapiLens.t
val query : (t, Query.t) GapiLens.t
val rows : (t, string list list) GapiLens.t
val selfLink : (t, string) GapiLens.t
val totalResults : (t, int) GapiLens.t
val totalsForAllResults : (t, (string * string) list) GapiLens.t

val empty : t

val render : t -> GapiJson.json_data_model list

val parse : t -> GapiJson.json_data_model -> t

val to_data_model : t -> GapiJson.json_data_model

val of_data_model : GapiJson.json_data_model -> t

end

module GaData : module GaData :
sig sig
module Query : module Query :
Expand Down
128 changes: 128 additions & 0 deletions src/gapi/gapiAnalyticsV3Service.ml
Expand Up @@ -262,6 +262,110 @@ struct


end end


module Realtime =
struct
module RealtimeParameters =
struct
type t = {
(* Standard query parameters *)
fields : string;
prettyPrint : bool;
quotaUser : string;
userIp : string;
key : string;
(* realtime-specific query parameters *)
dimensions : string;
filters : string;
ids : string;
max_results : int;
metrics : string;
sort : string;

}

let default = {
fields = "";
prettyPrint = true;
quotaUser = "";
userIp = "";
key = "";
dimensions = "";
filters = "";
ids = "";
max_results = 0;
metrics = "";
sort = "";

}

let to_key_value_list qp =
let param get_value to_string name =
GapiService.build_param default qp get_value to_string name in [
param (fun p -> p.fields) (fun x -> x) "fields";
param (fun p -> p.prettyPrint) string_of_bool "prettyPrint";
param (fun p -> p.quotaUser) (fun x -> x) "quotaUser";
param (fun p -> p.userIp) (fun x -> x) "userIp";
param (fun p -> p.key) (fun x -> x) "key";
param (fun p -> p.dimensions) (fun x -> x) "dimensions";
param (fun p -> p.filters) (fun x -> x) "filters";
param (fun p -> p.ids) (fun x -> x) "ids";
param (fun p -> p.max_results) string_of_int "max-results";
param (fun p -> p.metrics) (fun x -> x) "metrics";
param (fun p -> p.sort) (fun x -> x) "sort";

] |> List.concat

let merge_parameters
?(standard_parameters = GapiService.StandardParameters.default)
?(dimensions = default.dimensions)
?(filters = default.filters)
?(ids = default.ids)
?(max_results = default.max_results)
?(metrics = default.metrics)
?(sort = default.sort)
() =
let parameters = {
fields = standard_parameters.GapiService.StandardParameters.fields;
prettyPrint = standard_parameters.GapiService.StandardParameters.prettyPrint;
quotaUser = standard_parameters.GapiService.StandardParameters.quotaUser;
userIp = standard_parameters.GapiService.StandardParameters.userIp;
key = standard_parameters.GapiService.StandardParameters.key;
dimensions;
filters;
ids;
max_results;
metrics;
sort;

} in
if parameters = default then None else Some parameters

end

let get
?(base_url = "https://www.googleapis.com/analytics/v3/")
?etag
?std_params
?dimensions
?filters
?max_results
?sort
~ids
~metrics
session =
let full_url = GapiUtils.add_path_to_url ["data"; "realtime"] base_url
in
let params = RealtimeParameters.merge_parameters
?standard_parameters:std_params ?dimensions ?filters ~ids
?max_results ~metrics ?sort () in
let query_parameters = Option.map RealtimeParameters.to_key_value_list
params in
GapiService.get ?query_parameters ?etag full_url
(GapiJson.parse_json_response RealtimeData.of_data_model) session


end



end end


Expand Down Expand Up @@ -1120,3 +1224,27 @@ struct


end end


module MetadataResource =
struct
module Columns =
struct
let list
?(base_url = "https://www.googleapis.com/analytics/v3/")
?std_params
~reportType
session =
let full_url = GapiUtils.add_path_to_url ["metadata";
((fun x -> x) reportType); "columns"] base_url in
let params = GapiService.StandardParameters.merge_parameters
?standard_parameters:std_params () in
let query_parameters = Option.map
GapiService.StandardParameters.to_key_value_list params in
GapiService.get ?query_parameters full_url
(GapiJson.parse_json_response Columns.of_data_model) session


end


end

0 comments on commit 54ca7a4

Please sign in to comment.