-
Notifications
You must be signed in to change notification settings - Fork 3
/
metrics_activities_exports.go
52 lines (45 loc) · 1.98 KB
/
metrics_activities_exports.go
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
package chartmogul
// MetricsActivitiesExport represents Metrics API activity export in ChartMogul.
type MetricsActivitiesExport struct {
ID string `json:"id"`
Status string `json:"status"`
FileURL string `json:"file_url"`
Params Params `json:"params"`
ExpiresAt string `json:"expires_at"`
CreatedAt string `json:"created_at"`
}
// Params provides information on the requested export.
type Params struct {
Kind string `json:"kind"`
Params NestedParams `json:"params,omitempty"`
}
// NestedParams represents the params of the requested type of export.
type NestedParams struct {
ActivityType string `json:"activity_type,omitempty"`
StartDate string `json:"start_date,omitempty"`
EndDate string `json:"end_date,omitempty"`
}
// CreateMetricsActivitiesExportParam to create a MetricsActivitiesExport.
type CreateMetricsActivitiesExportParam struct {
Type string `json:"type,omitempty"`
StartDate string `json:"start-date,omitempty"`
EndDate string `json:"end-date,omitempty"`
}
const (
metricsActivitiesExportEndpoint = "activities_export"
singleMetricsActivitiesExportEndpoint = "activities_export/:uuid"
)
// MetricsCreateActivitiesExport requests creation of an activities export in Chartmogul.
//
// See https://dev.chartmogul.com/v1.0/reference#activities_export
func (api API) MetricsCreateActivitiesExport(CreateMetricsActivitiesExportParam *CreateMetricsActivitiesExportParam) (*MetricsActivitiesExport, error) {
result := &MetricsActivitiesExport{}
return result, api.create(metricsActivitiesExportEndpoint, CreateMetricsActivitiesExportParam, result)
}
// MetricsRetrieveActivitiesExport returns one activities export as in API.
//
// See https://dev.chartmogul.com/v1.0/reference#activities_export
func (api API) MetricsRetrieveActivitiesExport(activitiesExportUUID string) (*MetricsActivitiesExport, error) {
result := &MetricsActivitiesExport{}
return result, api.retrieve(singleMetricsActivitiesExportEndpoint, activitiesExportUUID, result)
}