1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
#pike __REAL_VERSION__ 
 
//! Instantiates the default Analytics API. 
//! See @[Web.Api.Api()] for further information. 
//! 
//! @param client_id 
//!  Your application key/id 
//! @param client_secret 
//!  Your application secret 
//! @param redirect_uri 
//!  The redirect URI after an authentication 
//! @param scope 
//!  The application scopes to grant access to 
protected this_program `()(string client_id, string client_secret, 
                           void|string redirect_uri, 
                           void|string|array(string)|multiset(string) scope) 
{ 
  return V3(client_id, client_secret, redirect_uri, scope); 
} 
 
class V3 
{ 
  inherit Web.Api.Google.Api : parent; 
 
  protected constant AuthClass = Web.Auth.Google.Analytics; 
 
  //! API base URI. 
  protected constant API_URI = "https://www.googleapis.com/analytics/v3"; 
 
  //! Getter for the @[Core] API 
  Core `core() 
  { 
    return _core || (_core = Core()); 
  } 
 
  //! Getter for the @[RealTime] API 
  RealTime `realtime() 
  { 
    return _realtime || (_realtime = RealTime()); 
  } 
 
  //! Getter for the @[Management] API 
  Management `management() 
  { 
    return _management || (_management = Management()); 
  } 
 
  //! Interface to the Google Analytics core API 
  class Core 
  { 
    inherit Method; 
 
    protected constant METHOD_PATH = "/data/ga"; 
 
    //! Get data from the core api 
    //! 
    //! @param params 
    //! 
    //! @param cb 
    mixed get(mapping params, void|Callback cb) 
    { 
      return _get("", params, cb); 
    } 
  } 
 
  //! Interface to the Google Analytics realtime API 
  class RealTime 
  { 
    inherit Method; 
 
    protected constant METHOD_PATH = "/data/realtime"; 
 
    //! Get data from the realtime api 
    //! 
    //! @param params 
    //! 
    //! @param cb 
    mixed get(mapping params, void|Callback cb) 
    { 
      return _get("", params, cb); 
    } 
  } 
 
  //! Interface to the Google Analytics managment API 
  class Management 
  { 
    inherit Method; 
 
    protected constant METHOD_PATH = "/management"; 
 
    //! Get account summaries 
    //! 
    //! @param params 
    //! 
    //! @param cb 
    mixed account_summaries(void|ParamsArg params, void|Callback cb) 
    { 
      return _get("/accountSummaries", params, cb); 
    } 
  } 
 
  //! Internal singleton objects. Retrieve an instance via @[core], 
  //! @[realtime] and @[management]. 
  protected Core _core; 
  protected RealTime _realtime; 
  protected Management _management; 
}