-
Notifications
You must be signed in to change notification settings - Fork 3
/
metrics_customer_activities.go
37 lines (32 loc) · 1.37 KB
/
metrics_customer_activities.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
package chartmogul
import "strings"
// MetricsCustomerActivity represents Metrics API activity in ChartMogul.
type MetricsCustomerActivity struct {
ID uint64 `json:"id"`
Date string `json:"date"`
ActivityArr float64 `json:"activity-arr"`
ActivityMrr float64 `json:"activity-mrr"`
ActivityMrrMovement float64 `json:"activity-mrr-movement"`
Currency string `json:"currency"`
CurrencySign string `json:"currency-sign"`
Description string `json:"description"`
Type string `json:"type"`
}
// MetricsCustomerActivities is the result of listing activities in Metrics API.
type MetricsCustomerActivities struct {
Entries []*MetricsCustomerActivity `json:"entries"`
Pagination
}
const metricsCustomerActivitiesEndpoint = "customers/:uuid/activities"
// MetricsListCustomerActivities lists all activities for cutomer of a given UUID.
//
// See https://dev.chartmogul.com/v1.0/reference#list-customer-activities
func (api API) MetricsListCustomerActivities(cursor *Cursor, customerUUID string) (*MetricsCustomerActivities, error) {
result := &MetricsCustomerActivities{}
path := strings.Replace(metricsCustomerActivitiesEndpoint, ":uuid", customerUUID, 1)
query := make([]interface{}, 0, 1)
if cursor != nil {
query = append(query, *cursor)
}
return result, api.list(path, result, query...)
}