-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Support customer scoped Activities and unscoped Activities [c… (
#45) * Revert "Support customer scoped Activities and unscoped Activities [ch30595] (#42)" This reverts commit e06a2f7. * Added go 1.6 in build matrix
- Loading branch information
Showing
13 changed files
with
106 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,39 @@ | ||
package chartmogul | ||
|
||
import "strings" | ||
|
||
// MetricsActivity represents Metrics API activity in ChartMogul. | ||
type MetricsActivity struct { | ||
Date string `json:"date"` | ||
ActivityArr float64 `json:"activity-arr"` | ||
ActivityMrr float64 `json:"activity-mrr"` | ||
ActivityMrrMovement float64 `json:"activity-mrr-movement"` | ||
Currency string `json:"currency"` | ||
Description string `json:"description"` | ||
Type string `json:"type"` | ||
SubscriptionExternalID string `json:"subscription-external-id"` | ||
PlanExternalID string `json:"plan-external-id"` | ||
CustomerName string `json:"customer-name"` | ||
CustomerUUID string `json:"customer-uuid"` | ||
CustomerExternalID string `json:"customer-external-id"` | ||
BillingConnectorUUID string `json:"billing-connector-uuid"` | ||
UUID string `json:"uuid"` | ||
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"` | ||
} | ||
|
||
// MetricsActivities is the result of listing activities in Metrics API. | ||
type MetricsActivities struct { | ||
Entries []*MetricsActivity `json:"entries"` | ||
HasMore bool `json:"has_more"` | ||
PerPage uint32 `json:"per_page"` | ||
Page uint32 `json:"page"` | ||
} | ||
|
||
type MetricsListActivitiesParams struct { | ||
Type string `json:"type,omitempty"` | ||
StartDate string `json:"start-date,omitempty"` | ||
EndDate string `json:"end-date,omitempty"` | ||
Order string `json:"order,omitempty"` | ||
AnchorCursor | ||
} | ||
|
||
const metricsActivitiesEndpoint = "activities" | ||
const metricsActivitiesEndpoint = "customers/:uuid/activities" | ||
|
||
// MetricsListActivities lists all activities for an account | ||
func (api API) MetricsListActivities(listActivitiesParams *MetricsListActivitiesParams) (*MetricsActivities, error) { | ||
// MetricsListActivities lists all activities for cutomer of a given UUID. | ||
// | ||
// See https://dev.chartmogul.com/v1.0/reference#list-customer-activities | ||
func (api API) MetricsListActivities(cursor *Cursor, customerUUID string) (*MetricsActivities, error) { | ||
result := &MetricsActivities{} | ||
path := strings.Replace(metricsActivitiesEndpoint, ":uuid", customerUUID, 1) | ||
query := make([]interface{}, 0, 1) | ||
if listActivitiesParams != nil { | ||
query = append(query, *listActivitiesParams) | ||
if cursor != nil { | ||
query = append(query, *cursor) | ||
} | ||
return result, api.list(metricsActivitiesEndpoint, result, query...) | ||
return result, api.list(path, result, query...) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.