Documentation ¶
Overview ¶
Package chartmogul is a simple Go API library for Chartmogul public API.
HTTP 2 ChartMogul's current stable version of nginx is incompatible with HTTP 2 implementation of Go. For this reason the application must run with the following (or otherwise prohibit HTTP 2): export GODEBUG=http2client=0
Uses the library gorequest, which allows simple struct->query, body->struct, struct->body.
Index ¶
- Constants
- Variables
- func SetURL(specialURL string)
- func Setup(timeoutConf time.Duration)
- type API
- func (api API) AddCustomAttributesToCustomer(customerUUID string, customAttributes []*CustomAttribute) (*CustomAttributes, error)
- func (api API) AddCustomAttributesWithEmail(email string, customAttributes []*CustomAttribute) (*Customers, error)
- func (api API) AddTagsToCustomer(customerUUID string, tags []string) (*TagsResult, error)
- func (api API) AddTagsToCustomersWithEmail(email string, tags []string) (*Customers, error)
- func (api API) CancelSubscription(subscriptionUUID string, cancelSubscriptionParams *CancelSubscriptionParams) (*Subscription, error)
- func (api API) ConnectSubscriptions(customerUUID string, subscriptions []Subscription) error
- func (api API) CreateContact(newContact *NewContact) (*Contact, error)
- func (api API) CreateCustomer(newCustomer *NewCustomer) (*Customer, error)
- func (api API) CreateCustomersContact(newContact *NewContact, customerUUID string) (*Contact, error)
- func (api API) CreateDataSource(name string) (*DataSource, error)
- func (api API) CreateDataSourceWithSystem(dataSource *DataSource) (*DataSource, error)
- func (api API) CreateInvoices(invoices []*Invoice, customerUUID string) (*Invoices, error)
- func (api API) CreatePlan(plan *Plan) (result *Plan, err error)
- func (api API) CreatePlanGroup(planGroup *PlanGroup) (result *PlanGroup, err error)
- func (api API) CreateSubscriptionEvent(newSubscriptionEvent *SubscriptionEvent) (*SubscriptionEvent, error)
- func (api API) CreateTransaction(transaction *Transaction, invoiceUUID string) (*Transaction, error)
- func (api API) DeleteContact(contactUUID string) error
- func (api API) DeleteCustomer(customerUUID string) error
- func (api API) DeleteCustomerInvoices(dataSourceUUID, customerUUID string) error
- func (api API) DeleteCustomerInvoicesV2(dataSourceUUID, customerUUID string, ...) error
- func (api API) DeleteDataSource(uuid string) error
- func (api API) DeleteInvoice(invoiceUUID string) error
- func (api API) DeletePlan(planUUID string) error
- func (api API) DeletePlanGroup(planGroupUUID string) error
- func (api API) DeleteSubscriptionEvent(deleteParams *DeleteSubscriptionEvent) error
- func (api API) EmptyDataSource(dataSourceUUID string) error
- func (api API) ListAllInvoices(listAllInvoicesParams *ListAllInvoicesParams) (*Invoices, error)
- func (api API) ListContacts(listContactsParams *ListContactsParams) (*Contacts, error)
- func (api API) ListCustomers(listCustomersParams *ListCustomersParams) (*Customers, error)
- func (api API) ListCustomersContacts(listContactsParams *ListContactsParams, customerUUID string) (*Contacts, error)
- func (api API) ListDataSources() (*DataSources, error)
- func (api API) ListDataSourcesWithFilters(listDataSourcesParams *ListDataSourcesParams) (*DataSources, error)
- func (api API) ListInvoices(cursor *Cursor, customerUUID string) (*Invoices, error)
- func (api API) ListPlanGroupPlans(cursor *Cursor, planGroupUUID string) (*PlanGroupPlans, error)
- func (api API) ListPlanGroups(cursor *Cursor) (*PlanGroups, error)
- func (api API) ListPlans(listPlansParams *ListPlansParams) (*Plans, error)
- func (api API) ListSubscriptionEvents(filters *FilterSubscriptionEvents, cursor *MetaCursor) (*SubscriptionEvents, error)
- func (api API) ListSubscriptions(cursor *Cursor, customerUUID string) (*Subscriptions, error)
- func (api API) MergeContacts(intoContactUUID string, fromContactUUID string) (*Contact, error)
- func (api API) MergeCustomers(mergeCustomersParams *MergeCustomersParams) error
- func (api API) MetricsCreateActivitiesExport(CreateMetricsActivitiesExportParam *CreateMetricsActivitiesExportParam) (*MetricsActivitiesExport, error)
- func (api API) MetricsListActivities(listActivitiesParams *MetricsListActivitiesParams) (*MetricsActivities, error)
- func (api API) MetricsListCustomerActivities(cursor *Cursor, customerUUID string) (*MetricsCustomerActivities, error)
- func (api API) MetricsListCustomerSubscriptions(cursor *Cursor, customerUUID string) (*MetricsCustomerSubscriptions, error)
- func (api API) MetricsRetrieveARPA(metricsFilter *MetricsFilter) (*ARPAResult, error)
- func (api API) MetricsRetrieveARR(metricsFilter *MetricsFilter) (*ARRResult, error)
- func (api API) MetricsRetrieveASP(metricsFilter *MetricsFilter) (*ASPResult, error)
- func (api API) MetricsRetrieveActivitiesExport(activitiesExportUUID string) (*MetricsActivitiesExport, error)
- func (api API) MetricsRetrieveAll(metricsFilter *MetricsFilter) (*MetricsResult, error)
- func (api API) MetricsRetrieveCustomerChurnRate(metricsFilter *MetricsFilter) (*CustomerChurnRateResult, error)
- func (api API) MetricsRetrieveCustomerCount(metricsFilter *MetricsFilter) (*CustomerCountResult, error)
- func (api API) MetricsRetrieveLTV(metricsFilter *MetricsFilter) (*LTVResult, error)
- func (api API) MetricsRetrieveMRR(metricsFilter *MetricsFilter) (*MRRResult, error)
- func (api API) MetricsRetrieveMRRChurnRate(metricsFilter *MetricsFilter) (*MRRChurnRateResult, error)
- func (api API) Ping() (bool, error)
- func (api API) PurgeDataSource(dataSourceUUID string) error
- func (api API) RemoveCustomAttributes(customerUUID string, customAttributes []string) (*CustomAttributes, error)
- func (api API) RemoveTagsFromCustomer(customerUUID string, tags []string) (*TagsResult, error)
- func (api API) RetrieveAccount() (*Account, error)
- func (api API) RetrieveContact(contactUUID string) (*Contact, error)
- func (api API) RetrieveCustomer(customerUUID string) (*Customer, error)
- func (api API) RetrieveCustomersAttributes(customerUUID string) (*Attributes, error)
- func (api API) RetrieveDataSource(dataSourceUUID string) (*DataSource, error)
- func (api API) RetrieveInvoice(invoiceUUID string) (*Invoice, error)
- func (api API) RetrievePlan(planUUID string) (*Plan, error)
- func (api API) RetrievePlanGroup(planGroupUUID string) (*PlanGroup, error)
- func (api API) SearchCustomers(searchCustomersParams *SearchCustomersParams) (*Customers, error)
- func (api *API) SetClient(newClient *http.Client)
- func (api API) UpdateContact(input *UpdateContact, contactUUID string) (*Contact, error)
- func (api API) UpdateCustomAttributesOfCustomer(customerUUID string, customAttributes map[string]interface{}) (*CustomAttributes, error)
- func (api API) UpdateCustomer(customer *Customer, customerUUID string) (*Customer, error)
- func (api API) UpdateCustomerV2(input *UpdateCustomer, customerUUID string) (*Customer, error)
- func (api API) UpdatePlan(plan *Plan, planUUID string) (*Plan, error)
- func (api API) UpdatePlanGroup(planGroup *PlanGroup, planGroupUUID string) (*PlanGroup, error)
- func (api API) UpdateSubscriptionEvent(subscriptionEvent *SubscriptionEvent) (*SubscriptionEvent, error)
- type ARPAMetrics
- type ARPAResult
- type ARRMetrics
- type ARRResult
- type ASPMetrics
- type ASPResult
- type Account
- type Address
- type AllMetrics
- type AllSummary
- type AnchorCursor
- type AttributeWithSource
- type Attributes
- type CancelSubscriptionParams
- type Contact
- type Contacts
- type CreateMetricsActivitiesExportParam
- type Cursor
- type CustID
- type Custom
- type CustomAttribute
- type CustomAttributes
- type Customer
- type CustomerChurnRateMetrics
- type CustomerChurnRateResult
- type CustomerCountMetrics
- type CustomerCountResult
- type Customers
- type DataSource
- type DataSources
- type DeleteCustomerInvoicesParams
- type DeleteSubscriptionEvent
- type DeleteSubscriptionEventParams
- type Errors
- type FilterSubscriptionEvents
- type HTTPError
- type IApi
- type Invoice
- type Invoices
- type LTVMetrics
- type LTVResult
- type LineItem
- type ListAllInvoicesParams
- type ListContactsParams
- type ListCustomersParams
- type ListDataSourcesParams
- type ListPlansParams
- type MRRChurnRateMetrics
- type MRRChurnRateResult
- type MRRMetrics
- type MRRResult
- type MergeCustomersParams
- type MetaCursor
- type MetricsActivities
- type MetricsActivitiesExport
- type MetricsActivity
- type MetricsCustomerActivities
- type MetricsCustomerActivity
- type MetricsCustomerSubscription
- type MetricsCustomerSubscriptions
- type MetricsFilter
- type MetricsListActivitiesParams
- type MetricsResult
- type NestedParams
- type NewAttributes
- type NewContact
- type NewCustomer
- type PaginationWithCursor
- type Params
- type Ping
- type Plan
- type PlanGroup
- type PlanGroupPlans
- type PlanGroups
- type Plans
- type RequestErrors
- type SearchCustomersParams
- type Subscription
- type SubscriptionEvent
- type SubscriptionEventParams
- type SubscriptionEvents
- type Subscriptions
- type Summary
- type TagsByEmail
- type TagsResult
- type Transaction
- type UpdateContact
- type UpdateCustomer
Constants ¶
const ( // AttrTypeString is one of the possible data types for custom attributes. AttrTypeString = "String" // AttrTypeInteger is one of the possible data types for custom attributes. AttrTypeInteger = "Integer" // AttrTypeTimestamp is one of the possible data types for custom attributes. AttrTypeTimestamp = "Timestamp" // AttrTypeBoolean is one of the possible data types for custom attributes. AttrTypeBoolean = "Boolean" )
const ( // ErrKeyExternalID is key in Errors map indicating there's a problem with External ID of the resource. ErrKeyExternalID = "external_id" // ErrKeyTransactionExternalID is key in Errors map indicating there's a problem with External ID of the transaction. ErrKeyTransactionExternalID = "transactions.external_id" // ErrKeyLineItemsExternalID indicates problem with one/any of line items' external IDs ErrKeyLineItemsExternalID = "line_items.external_id" // ErrKeyName - data source name ErrKeyName = "name" // ErrValCustomerExternalIDExists = can't import new customer with the same external ID ErrValCustomerExternalIDExists = "The external ID for this customer already exists in our system." // ErrValLineItemExternalIDExists = can't import invoice, b'c line item external ID exists ErrValLineItemExternalIDExists = "The external ID for this line item already exists in our system." // ErrValExternalIDExists = can't save Transaction, because it exists already. ErrValExternalIDExists = "has already been taken" // ErrValInvoiceExternalIDExists = invoice already exists ErrValInvoiceExternalIDExists = "The external ID for this invoice already exists in our system." // ErrValPlanExternalIDExists = plan already exists ErrValPlanExternalIDExists = "A plan with this identifier already exists in our system." // ErrValHasAlreadyBeenTaken = data source name taken ErrValHasAlreadyBeenTaken = "Has already been taken." )
Variables ¶
var Version = "v3"
Version of the package
Functions ¶
Types ¶
type API ¶
API is the handle for communicating with Chartmogul.
func (API) AddCustomAttributesToCustomer ¶
func (api API) AddCustomAttributesToCustomer(customerUUID string, customAttributes []*CustomAttribute) (*CustomAttributes, error)
AddCustomAttributesToCustomer adds custom attributes to specific customer.
See https://dev.chartmogul.com/v1.0/reference#customer-attributes
func (API) AddCustomAttributesWithEmail ¶
func (api API) AddCustomAttributesWithEmail(email string, customAttributes []*CustomAttribute) (*Customers, error)
AddCustomAttributesWithEmail adds custom attributes to customers with specific email.
See https://dev.chartmogul.com/v1.0/reference#customer-attributes
func (API) AddTagsToCustomer ¶
func (api API) AddTagsToCustomer(customerUUID string, tags []string) (*TagsResult, error)
AddTagsToCustomer gives customer new tags.
func (API) AddTagsToCustomersWithEmail ¶
AddTagsToCustomersWithEmail gives new tags to (multiple) customers identified by e-mail only.
func (API) CancelSubscription ¶
func (api API) CancelSubscription(subscriptionUUID string, cancelSubscriptionParams *CancelSubscriptionParams) (*Subscription, error)
CancelSubscription creates an Import API Data Source in ChartMogul.
func (API) ConnectSubscriptions ¶
func (api API) ConnectSubscriptions(customerUUID string, subscriptions []Subscription) error
ConnectSubscriptions connects two subscription objects
See https://dev.chartmogul.com/reference#connect-subscriptions
func (API) CreateContact ¶ added in v3.1.0
func (api API) CreateContact(newContact *NewContact) (*Contact, error)
CreateContact loads the contact to Chartmogul
See https://dev.chartmogul.com/reference/create-a-contact-contacts
func (API) CreateCustomer ¶
func (api API) CreateCustomer(newCustomer *NewCustomer) (*Customer, error)
CreateCustomer loads the customer to Chartmogul. New endpoint - with attributes.
func (API) CreateCustomersContact ¶ added in v3.1.0
func (api API) CreateCustomersContact(newContact *NewContact, customerUUID string) (*Contact, error)
CreateCustomersContacts
func (API) CreateDataSource ¶
func (api API) CreateDataSource(name string) (*DataSource, error)
CreateDataSource creates an API Data Source in ChartMogul.
func (API) CreateDataSourceWithSystem ¶
func (api API) CreateDataSourceWithSystem(dataSource *DataSource) (*DataSource, error)
CreateDataSourceWithSystem creates an API Data Source in ChartMogul. * Allows other parameters than just the name.
func (API) CreateInvoices ¶
CreateInvoices loads an invoice to a customer in Chartmogul. Customer must have a valid UUID! (use return value of API)
func (API) CreatePlan ¶
CreatePlan creates plan under given Data Source.
func (API) CreatePlanGroup ¶
CreatePlanGroup creates plan group with given name and plans.
func (API) CreateSubscriptionEvent ¶ added in v3.1.0
func (api API) CreateSubscriptionEvent(newSubscriptionEvent *SubscriptionEvent) (*SubscriptionEvent, error)
func (API) CreateTransaction ¶
func (api API) CreateTransaction(transaction *Transaction, invoiceUUID string) (*Transaction, error)
CreateTransaction loads an transaction to a customer in Chartmogul. Customer must have a valid UUID! (use return value of API)
func (API) DeleteContact ¶ added in v3.1.0
DeleteContact deletes one contact by UUID.
func (API) DeleteCustomer ¶
DeleteCustomer deletes one customer by UUID.
func (API) DeleteCustomerInvoices ¶
DeleteCustomerInvoices deletes all customer's invoices by UUID for given data source UUID.
func (API) DeleteCustomerInvoicesV2 ¶
func (api API) DeleteCustomerInvoicesV2(dataSourceUUID, customerUUID string, deleteCustomerInvoicesParams *DeleteCustomerInvoicesParams) error
DeleteCustomerInvoicesV2 deletes all customer's invoices by UUID & ExternalID for given data source UUID.
func (API) DeleteDataSource ¶
DeleteDataSource deletes the data source identified by its UUID.
func (API) DeleteInvoice ¶
DeleteInvoice deletes one invoice by UUID.
func (API) DeletePlan ¶
DeletePlan deletes one plan by UUID.
func (API) DeletePlanGroup ¶
DeletePlanGroup deletes one plan group by UUID.
func (API) DeleteSubscriptionEvent ¶ added in v3.1.0
func (api API) DeleteSubscriptionEvent(deleteParams *DeleteSubscriptionEvent) error
func (API) EmptyDataSource ¶
EmptyDataSource deletes all the data in the data source, but keeps the UUID.
func (API) ListAllInvoices ¶
func (api API) ListAllInvoices(listAllInvoicesParams *ListAllInvoicesParams) (*Invoices, error)
ListAllInvoices lists all imported invoices. Use parameters to narrow down the search/for paging. listAllInvoicesParams can be nil, in which case default values on API are used.
func (API) ListContacts ¶ added in v3.1.0
func (api API) ListContacts(listContactsParams *ListContactsParams) (*Contacts, error)
ListContacts lists all Contacts
func (API) ListCustomers ¶
func (api API) ListCustomers(listCustomersParams *ListCustomersParams) (*Customers, error)
ListCustomers lists all Customers for cutomer of given UUID.
func (API) ListCustomersContacts ¶ added in v3.1.0
func (api API) ListCustomersContacts(listContactsParams *ListContactsParams, customerUUID string) (*Contacts, error)
ListCustomersContacts
See https://dev.chartmogul.com/reference/list-customers-contacts
func (API) ListDataSources ¶
func (api API) ListDataSources() (*DataSources, error)
ListDataSources lists all available Data Sources (no paging).
func (API) ListDataSourcesWithFilters ¶
func (api API) ListDataSourcesWithFilters(listDataSourcesParams *ListDataSourcesParams) (*DataSources, error)
ListDataSourcesWithFilters lists all available Data Sources (no paging). * Allows filtering.
func (API) ListInvoices ¶
ListInvoices lists all imported invoices for a customer.
func (API) ListPlanGroupPlans ¶
func (api API) ListPlanGroupPlans(cursor *Cursor, planGroupUUID string) (*PlanGroupPlans, error)
ListPlanGroupPlans returns list of plans in with a plan group given the plan group uuid.
func (API) ListPlanGroups ¶
func (api API) ListPlanGroups(cursor *Cursor) (*PlanGroups, error)
ListPlanGroups returns list of plan groups.
func (API) ListPlans ¶
func (api API) ListPlans(listPlansParams *ListPlansParams) (*Plans, error)
ListPlans returns list of plans.
func (API) ListSubscriptionEvents ¶ added in v3.1.0
func (api API) ListSubscriptionEvents(filters *FilterSubscriptionEvents, cursor *MetaCursor) (*SubscriptionEvents, error)
func (API) ListSubscriptions ¶
func (api API) ListSubscriptions(cursor *Cursor, customerUUID string) (*Subscriptions, error)
ListSubscriptions lists all subscriptions for cutomer of given UUID.
func (API) MergeContacts ¶ added in v3.1.0
MergeContact merges two contacts.
func (API) MergeCustomers ¶
func (api API) MergeCustomers(mergeCustomersParams *MergeCustomersParams) error
MergeCustomers merges two cutomers.
func (API) MetricsCreateActivitiesExport ¶
func (api API) MetricsCreateActivitiesExport(CreateMetricsActivitiesExportParam *CreateMetricsActivitiesExportParam) (*MetricsActivitiesExport, error)
MetricsCreateActivitiesExport requests creation of an activities export in Chartmogul.
See https://dev.chartmogul.com/v1.0/reference#activities_export
func (API) MetricsListActivities ¶
func (api API) MetricsListActivities(listActivitiesParams *MetricsListActivitiesParams) (*MetricsActivities, error)
MetricsListActivities lists all activities for an account
func (API) MetricsListCustomerActivities ¶
func (api API) MetricsListCustomerActivities(cursor *Cursor, customerUUID string) (*MetricsCustomerActivities, error)
MetricsListCustomerActivities lists all activities for cutomer of a given UUID.
See https://dev.chartmogul.com/v1.0/reference#list-customer-activities
func (API) MetricsListCustomerSubscriptions ¶
func (api API) MetricsListCustomerSubscriptions(cursor *Cursor, customerUUID string) (*MetricsCustomerSubscriptions, error)
MetricsListCustomerSubscriptions lists all subscriptions for cutomer of a given UUID.
See https://dev.chartmogul.com/v1.0/reference#list-customer-subscriptions
func (API) MetricsRetrieveARPA ¶
func (api API) MetricsRetrieveARPA(metricsFilter *MetricsFilter) (*ARPAResult, error)
MetricsRetrieveARPA retrieves the ARPA metrics, for the specified time period.
func (API) MetricsRetrieveARR ¶
func (api API) MetricsRetrieveARR(metricsFilter *MetricsFilter) (*ARRResult, error)
MetricsRetrieveARR retrieves the ARR metrics, for the specified time period.
func (API) MetricsRetrieveASP ¶
func (api API) MetricsRetrieveASP(metricsFilter *MetricsFilter) (*ASPResult, error)
MetricsRetrieveASP retrieves the ASP metrics, for the specified time period.
func (API) MetricsRetrieveActivitiesExport ¶
func (api API) MetricsRetrieveActivitiesExport(activitiesExportUUID string) (*MetricsActivitiesExport, error)
MetricsRetrieveActivitiesExport returns one activities export as in API.
See https://dev.chartmogul.com/v1.0/reference#activities_export
func (API) MetricsRetrieveAll ¶
func (api API) MetricsRetrieveAll(metricsFilter *MetricsFilter) (*MetricsResult, error)
MetricsRetrieveAll retrieves all key metrics, for the specified time period.
See https://dev.chartmogul.com/v1.0/reference#retrieve-all-key-metrics
func (API) MetricsRetrieveCustomerChurnRate ¶
func (api API) MetricsRetrieveCustomerChurnRate(metricsFilter *MetricsFilter) (*CustomerChurnRateResult, error)
MetricsRetrieveCustomerChurnRate retrieves customer churn rate, for the specified time period.
See https://dev.chartmogul.com/v1.0/reference#retrieve-customer-churn-rate
func (API) MetricsRetrieveCustomerCount ¶
func (api API) MetricsRetrieveCustomerCount(metricsFilter *MetricsFilter) (*CustomerCountResult, error)
MetricsRetrieveCustomerCount retrieves customer count, for the specified time period.
See https://dev.chartmogul.com/v1.0/reference#retrieve-customer-count
func (API) MetricsRetrieveLTV ¶
func (api API) MetricsRetrieveLTV(metricsFilter *MetricsFilter) (*LTVResult, error)
MetricsRetrieveLTV retrieves LTV metrics, for the specified time period.
func (API) MetricsRetrieveMRR ¶
func (api API) MetricsRetrieveMRR(metricsFilter *MetricsFilter) (*MRRResult, error)
MetricsRetrieveMRR retrieves the MRR metrics, for the specified time period.
func (API) MetricsRetrieveMRRChurnRate ¶
func (api API) MetricsRetrieveMRRChurnRate(metricsFilter *MetricsFilter) (*MRRChurnRateResult, error)
MetricsRetrieveMRRChurnRate retrieves all key metrics, for the specified time period.
See https://dev.chartmogul.com/v1.0/reference#retrieve-mrr-churn-rate
func (API) PurgeDataSource ¶
PurgeDataSource deletes all the data except the data source itself and the customers
func (API) RemoveCustomAttributes ¶
func (api API) RemoveCustomAttributes(customerUUID string, customAttributes []string) (*CustomAttributes, error)
RemoveCustomAttributes removes a list of custom attributes from a specific customer.
See https://dev.chartmogul.com/v1.0/reference#customer-attributes
func (API) RemoveTagsFromCustomer ¶
func (api API) RemoveTagsFromCustomer(customerUUID string, tags []string) (*TagsResult, error)
RemoveTagsFromCustomer deletes passed tags from customer of given UUID.
func (API) RetrieveAccount ¶
RetrieveAccount returns details of current account.
func (API) RetrieveContact ¶ added in v3.1.0
RetrieveContact returns one contact as in API.
func (API) RetrieveCustomer ¶
RetrieveCustomer returns one customer as in API.
func (API) RetrieveCustomersAttributes ¶
func (api API) RetrieveCustomersAttributes(customerUUID string) (*Attributes, error)
RetrieveCustomersAttributes returns attributes for given customer UUID.
See https://dev.chartmogul.com/v1.0/reference#customer-attributes
func (API) RetrieveDataSource ¶
func (api API) RetrieveDataSource(dataSourceUUID string) (*DataSource, error)
RetrieveDataSource returns one Data Source by UUID.
func (API) RetrieveInvoice ¶
RetrieveInvoice returns one Invoice by UUID.
func (API) RetrievePlan ¶
RetrievePlan returns one plan by UUID.
func (API) RetrievePlanGroup ¶
RetrievePlanGroup returns one plan group by UUID.
func (API) SearchCustomers ¶
func (api API) SearchCustomers(searchCustomersParams *SearchCustomersParams) (*Customers, error)
SearchCustomers lists all Customers for cutomer of given UUID.
func (API) UpdateContact ¶ added in v3.1.0
func (api API) UpdateContact(input *UpdateContact, contactUUID string) (*Contact, error)
UpdateContact updates one contact in API.
func (API) UpdateCustomAttributesOfCustomer ¶
func (api API) UpdateCustomAttributesOfCustomer(customerUUID string, customAttributes map[string]interface{}) (*CustomAttributes, error)
UpdateCustomAttributesOfCustomer updates custom attributes of a specific customer.
See https://dev.chartmogul.com/v1.0/reference#customer-attributes
func (API) UpdateCustomer ¶
UpdateCustomer updates one customer in API.
func (API) UpdateCustomerV2 ¶
func (api API) UpdateCustomerV2(input *UpdateCustomer, customerUUID string) (*Customer, error)
UpdateCustomerV2 updates one customer in API.
See https://dev.chartmogul.com/v1.0/reference#update-a-customer
func (API) UpdatePlan ¶
UpdatePlan returns list of plans.
func (API) UpdatePlanGroup ¶
UpdatePlanGroup updates a name or plans.
func (API) UpdateSubscriptionEvent ¶ added in v3.1.0
func (api API) UpdateSubscriptionEvent(subscriptionEvent *SubscriptionEvent) (*SubscriptionEvent, error)
type ARPAMetrics ¶
type ARPAMetrics struct { Date string `json:"date"` ARPA float64 `json:"arpa"` PercentageChange float64 `json:"percentage-change"` }
ARPAMetrics represents results of Metrics API.
type ARPAResult ¶
type ARPAResult struct { Entries []*ARPAMetrics `json:"entries,omitempty"` Summary *Summary `json:"summary"` }
ARPAResult represents results of Metrics API.
type ARRMetrics ¶
type ARRMetrics struct { Date string `json:"date"` ARR float64 `json:"arr"` PercentageChange float64 `json:"percentage-change"` }
ARRMetrics represents results of Metrics API.
type ARRResult ¶
type ARRResult struct { Entries []*ARRMetrics `json:"entries,omitempty"` Summary *Summary `json:"summary"` }
ARRResult represents results of Metrics API.
type ASPMetrics ¶
type ASPMetrics struct { Date string `json:"date"` ASP float64 `json:"asp"` PercentageChange float64 `json:"percentage-change"` }
ASPMetrics represents results of Metrics API.
type ASPResult ¶
type ASPResult struct { Entries []*ASPMetrics `json:"entries,omitempty"` Summary *Summary `json:"summary"` }
ASPResult represents results of Metrics API.
type Account ¶
type Account struct { Name string `json:"name"` Currency string `json:"currency"` TimeZone string `json:"time_zone"` WeekStartOn string `json:"week_start_on"` }
Account details in ChartMogul
type Address ¶
type Address struct { AddressZIP string `json:"address_zip,omitempty"` City string `json:"city,omitempty"` State string `json:"state,omitempty"` Country string `json:"country,omitempty"` }
Address is subdocument of Customer.
type AllMetrics ¶
type AllMetrics struct { Date string `json:"date"` CustomerChurnRate float64 `json:"customer-churn-rate"` MrrChurnRate float64 `json:"mrr-churn-rate"` Ltv float64 `json:"ltv"` Customers uint32 `json:"customers"` Asp float64 `json:"asp"` Arpa float64 `json:"arpa"` Arr float64 `json:"arr"` Mrr float64 `json:"mrr"` CustomerChurnRatePercentageChange float64 `json:"customer-churn-rate-percentage-change"` MrrChurnRatePercentageChange float64 `json:"mrr-churn-rate-percentage-change"` LtvPercentageChange float64 `json:"ltv-percentage-change"` CustomersPercentageChange float64 `json:"customers-percentage-change"` AspPercentageChange float64 `json:"asp-percentage-change"` ArpaPercentageChange float64 `json:"arpa-percentage-change"` ArrPercentageChange float64 `json:"arr-percentage-change"` MrrPercentageChange float64 `json:"mrr-percentage-change"` }
AllMetrics represents results of Metrics API.
type AllSummary ¶ added in v3.1.0
type AllSummary struct { CurrentCustomerChurnRate float64 `json:"current-customer-churn-rate"` PreviousCustomerChurnRate float64 `json:"previous-customer-churn-rate"` CustomerChurnRatePercentageChange float64 `json:"customer-churn-rate-percentage-change"` CurrentMrrChurnRate float64 `json:"current-mrr-churn-rate"` PreviousMrrChurnRate float64 `json:"previous-mrr-churn-rate"` MrrChurnRatePercentageChange float64 `json:"mrr-churn-rate-percentage-change"` CurrentLtv float64 `json:"current-ltv"` PreviousLtv float64 `json:"previous-ltv"` LtvPercentageChange float64 `json:"ltv-percentage-change"` CurrentCustomers uint32 `json:"current-customers"` PreviousCustomers uint32 `json:"previous-customers"` CustomersPercentageChange float64 `json:"customers-percentage-change"` CurrentAsp float64 `json:"current-asp"` PreviousAsp float64 `json:"previous-asp"` AspPercentageChange float64 `json:"asp-percentage-change"` CurrentArpa float64 `json:"current-arpa"` PreviousArpa float64 `json:"previous-arpa"` ArpaPercentageChange float64 `json:"arpa-percentage-change"` CurrentArr float64 `json:"current-arr"` PreviousArr float64 `json:"previous-arr"` ArrPercentageChange float64 `json:"arr-percentage-change"` CurrentMrr float64 `json:"current-mrr"` PreviousMrr float64 `json:"previous-mrr"` MrrPercentageChange float64 `json:"mrr-percentage-change"` }
Summary represents results of Metrics API.
type AnchorCursor ¶
type AnchorCursor struct { PerPage uint32 `json:"per-page,omitempty"` //StartAfter is used to get the next set of Entries and its value should be the UUID of last Entry from previous response. StartAfter string `json:"start-after,omitempty"` }
AnchorCursor contains query parameters for anchor based pagination used for some APIs in ChartMogul.
type AttributeWithSource ¶
type AttributeWithSource struct { Value interface{} `json:"value"` Source string `json:"source"` }
AttributeWithSource covers the special case when you need to update customer's attribute and chage the source which shows in the ChartMogul UI.
type Attributes ¶
type Attributes struct { Tags []string `json:"tags,omitempty"` Stripe map[string]interface{} `json:"stripe,omitempty"` Clearbit map[string]interface{} `json:"clearbit,omitempty"` Custom map[string]interface{} `json:"custom,omitempty"` }
Attributes is subdocument of Customer.
type CancelSubscriptionParams ¶
type CancelSubscriptionParams struct { CancelledAt string `json:"cancelled_at,omitempty"` CancellationDates *[]string `json:"cancellation_dates,omitempty"` }
CancelSubscriptionParams represents arguments to be marshalled into JSON.
type Contact ¶ added in v3.1.0
type Contact struct { UUID string `json:"uuid,omitempty"` // Basic info CustomerExternalID string `json:"customer_external_id,omitempty"` CustomerUUID string `json:"customer_uuid,omitempty"` DataSourceUUID string `json:"data_source_uuid,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` LinkedIn string `json:"linked_in,omitempty"` Notes string `json:"notes,omitempty"` Phone string `json:"phone,omitempty"` Position uint32 `json:"position,omitempty"` Title string `json:"title,omitempty"` Twitter string `json:"twitter,omitempty"` Custom map[string]interface{} `json:"custom,omitempty"` }
Contact is the contact as represented in the API.
type Contacts ¶ added in v3.1.0
type Contacts struct { Entries []*Contact `json:"entries,omitempty"` Cursor string `json:"cursor,omitempty"` HasMore bool `json:"has_more,omitempty"` }
Contacts is result of listing contacts in API.
type CreateMetricsActivitiesExportParam ¶
type CreateMetricsActivitiesExportParam struct { Type string `json:"type,omitempty"` StartDate string `json:"start-date,omitempty"` EndDate string `json:"end-date,omitempty"` }
CreateMetricsActivitiesExportParam to create a MetricsActivitiesExport.
type Cursor ¶
type Cursor struct { Page uint32 `json:"page,omitempty"` PerPage uint32 `json:"per_page,omitempty"` }
Cursor contains query parameters for paging in CM. Attributes for query must be string, because gorequest library cannot convert anything else.
type CustID ¶
type CustID struct { DataSourceUUID string `json:"data_source_uuid,omitempty"` ExternalID string `json:"external_id,omitempty"` CustomerUUID string `json:"customer_uuid,omitempty"` }
CustID - use either DataSourceUUID & ExternalID or CustomerUUID
type CustomAttribute ¶
type CustomAttribute struct { Type string `json:"type"` Key string `json:"key"` Value interface{} `json:"value"` Source string `json:"source,omitempty"` }
CustomAttribute = typed custom attribute.
type CustomAttributes ¶
type CustomAttributes struct {
Custom map[string]interface{} `json:"custom"`
}
CustomAttributes contains updated custom attributes.
type Customer ¶
type Customer struct { ID uint32 `json:"id,omitempty"` // Basic info DataSourceUUID string `json:"data_source_uuid,omitempty"` DataSourceUUIDs []string `json:"data_source_uuids,omitempty"` UUID string `json:"uuid,omitempty"` ExternalID string `json:"external_id,omitempty"` ExternalIDs []string `json:"external_ids,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` Status string `json:"status,omitempty"` CustomerSince string `json:"customer-since,omitempty"` Attributes *Attributes `json:"attributes,omitempty"` Address *Address `json:"address,omitempty"` // Other info Mrr float64 `json:"mrr,omitempty"` Arr float64 `json:"arr,omitempty"` BillingSystemURL string `json:"billing-system-url,omitempty"` ChartmogulURL string `json:"chartmogul-url,omitempty"` BillingSystemType string `json:"billing-system-type,omitempty"` Currency string `json:"currency,omitempty"` CurrencySign string `json:"currency-sign,omitempty"` // For update Company string `json:"company,omitempty"` Country string `json:"country,omitempty"` State string `json:"state,omitempty"` City string `json:"city,omitempty"` Zip string `json:"zip,omitempty"` LeadCreatedAt string `json:"lead_created_at,omitempty"` FreeTrialStartedAt string `json:"free_trial_started_at,omitempty"` Errors Errors `json:"errors,omitempty"` }
Customer is the customer as represented in the API.
type CustomerChurnRateMetrics ¶
type CustomerChurnRateMetrics struct { Date string `json:"date"` CustomerChurnRate float64 `json:"customer-churn-rate"` PercentageChange float64 `json:"percentage-change"` }
CustomerChurnRateMetrics represents results of Metrics API.
type CustomerChurnRateResult ¶
type CustomerChurnRateResult struct { Entries []*CustomerChurnRateMetrics `json:"entries,omitempty"` Summary *Summary `json:"summary"` }
CustomerChurnRateResult represents results of Metrics API.
type CustomerCountMetrics ¶
type CustomerCountMetrics struct { Date string `json:"date"` Customers uint32 `json:"customers"` PercentageChange float64 `json:"percentage-change"` }
CustomerCountMetrics represents results of Metrics API.
type CustomerCountResult ¶
type CustomerCountResult struct { Entries []*CustomerCountMetrics `json:"entries,omitempty"` Summary *Summary `json:"summary"` }
CustomerCountResult represents results of Metrics API.
type Customers ¶
type Customers struct { Entries []*Customer `json:"entries,omitempty"` Page uint32 `json:"page"` PerPage uint32 `json:"per_page"` HasMore bool `json:"has_more,omitempty"` CurrentPage int32 `json:"current_page,omitempty"` TotalPages int32 `json:"total_pages,omitempty"` }
Customers is result of listing customers in API.
type DataSource ¶
type DataSource struct { UUID string `json:"uuid"` Name string `json:"name"` CreatedAt string `json:"created_at"` Status string `json:"status"` System string `json:"system"` Errors Errors `json:"errors,omitempty"` }
DataSource represents API data source in ChartMogul. See https://dev.chartmogul.com/v1.0/reference#list-data-sources
type DataSources ¶
type DataSources struct {
DataSources []*DataSource `json:"data_sources"`
}
DataSources is the result of listing data sources, but doesn't contain any paging.
type DeleteCustomerInvoicesParams ¶
type DeleteCustomerInvoicesParams struct {
CustomerExternalID string
}
DeleteCustomerInvoicesParams - optional param for deleting all customer invoices.
type DeleteSubscriptionEvent ¶ added in v3.1.0
type DeleteSubscriptionEventParams ¶ added in v3.1.0
type DeleteSubscriptionEventParams struct {
Params *DeleteSubscriptionEvent `json:"subscription_event"`
}
type Errors ¶
Errors contains error feedback from ChartMogul
func (Errors) IsAlreadyExists ¶
IsAlreadyExists is helper that returns true, if there's only one error and it means the uploaded resource of the same external_id already exists.
func (Errors) IsInvoiceAndItsEntitiesAlreadyExist ¶
IsInvoiceAndItsEntitiesAlreadyExist returns true if: * invoice already exists AND * ANY other entities (line items, transactions) already exist AND * no other error
So, eg. if the invoice doesn't exist, but the transaction does, you have a different problem (duplicating txns) and this returns false.
func (Errors) IsInvoiceAndTransactionAlreadyExist ¶
IsInvoiceAndTransactionAlreadyExist occurs when both invoice and tx exist already. Use `IsInvoiceAndItsEntitiesAlreadyExist` if you'd like to catch line items as well.
type FilterSubscriptionEvents ¶ added in v3.1.0
type FilterSubscriptionEvents struct { CustomerExternalID string `json:"customer_external_id,omitempty"` DataSourceUUID string `json:"data_source_uuid,omitempty"` EffectiveDate string `json:"effective_date,omitempty"` EventDate string `json:"event_date,omitempty"` EventType string `json:"event_type,omitempty"` ExternalID string `json:"external_id,omitempty"` PlanExternalID string `json:"plan_external_id,omitempty"` SubscriptionExternalID string `json:"subscription_external_id,omitempty"` }
type IApi ¶
type IApi interface { Ping() (res bool, err error) // Data sources CreateDataSource(name string) (*DataSource, error) CreateDataSourceWithSystem(dataSource *DataSource) (*DataSource, error) RetrieveDataSource(dataSourceUUID string) (*DataSource, error) ListDataSources() (*DataSources, error) ListDataSourcesWithFilters(listDataSourcesParams *ListDataSourcesParams) (*DataSources, error) PurgeDataSource(dataSourceUUID string) error EmptyDataSource(dataSourceUUID string) error DeleteDataSource(dataSourceUUID string) error // Invoices CreateInvoices(invoices []*Invoice, customerUUID string) (*Invoices, error) ListInvoices(cursor *Cursor, customerUUID string) (*Invoices, error) ListAllInvoices(listAllInvoicesParams *ListAllInvoicesParams) (*Invoices, error) RetrieveInvoice(invoiceUUID string) (*Invoice, error) DeleteInvoice(invoiceUUID string) error // Plans CreatePlan(plan *Plan) (result *Plan, err error) RetrievePlan(planUUID string) (*Plan, error) ListPlans(listPlansParams *ListPlansParams) (*Plans, error) UpdatePlan(plan *Plan, planUUID string) (*Plan, error) DeletePlan(planUUID string) error // Plan Groups CreatePlanGroup(planGroup *PlanGroup) (result *PlanGroup, err error) RetrievePlanGroup(planGroupUUID string) (*PlanGroup, error) ListPlanGroups(cursor *Cursor) (*PlanGroups, error) UpdatePlanGroup(plan *PlanGroup, planGroupUUID string) (*PlanGroup, error) DeletePlanGroup(planGroupUUID string) error ListPlanGroupPlans(cursor *Cursor, planGroupUUID string) (*PlanGroupPlans, error) // Subscriptions CancelSubscription(subscriptionUUID string, cancelSubscriptionParams *CancelSubscriptionParams) (*Subscription, error) ListSubscriptions(cursor *Cursor, customerUUID string) (*Subscriptions, error) // Transactions CreateTransaction(transaction *Transaction, invoiceUUID string) (*Transaction, error) // Customers CreateCustomer(newCustomer *NewCustomer) (*Customer, error) RetrieveCustomer(customerUUID string) (*Customer, error) UpdateCustomer(Customer *Customer, customerUUID string) (*Customer, error) UpdateCustomerV2(Customer *UpdateCustomer, customerUUID string) (*Customer, error) ListCustomers(ListCustomersParams *ListCustomersParams) (*Customers, error) SearchCustomers(SearchCustomersParams *SearchCustomersParams) (*Customers, error) MergeCustomers(MergeCustomersParams *MergeCustomersParams) error DeleteCustomer(customerUUID string) error DeleteCustomerInvoices(dataSourceUUID, customerUUID string) error DeleteCustomerInvoicesV2(dataSourceUUID, customerUUID string, DeleteCustomerInvoicesParams *DeleteCustomerInvoicesParams) error ListCustomersContacts(ListContactsParams *ListContactsParams, customerUUID string) (*Contacts, error) CreateCustomersContact(newContact *NewContact, customerUUID string) (*Contact, error) // Contacts CreateContact(newContact *NewContact) (*Contact, error) RetrieveContact(contactUUID string) (*Contact, error) UpdateContact(Contact *UpdateContact, contactUUID string) (*Contact, error) ListContacts(ListContactsParams *ListContactsParams) (*Contacts, error) DeleteContact(contactUUID string) error MergeContacts(intoContactUUID string, fromContactUUID string) (*Contact, error) // - Cusomer Attributes RetrieveCustomersAttributes(customerUUID string) (*Attributes, error) // Tags AddTagsToCustomer(customerUUID string, tags []string) (*TagsResult, error) AddTagsToCustomersWithEmail(email string, tags []string) (*Customers, error) RemoveTagsFromCustomer(customerUUID string, tags []string) (*TagsResult, error) // Custom Attributes AddCustomAttributesToCustomer(customerUUID string, customAttributes []*CustomAttribute) (*CustomAttributes, error) AddCustomAttributesWithEmail(email string, customAttributes []*CustomAttribute) (*Customers, error) UpdateCustomAttributesOfCustomer(customerUUID string, customAttributes map[string]interface{}) (*CustomAttributes, error) RemoveCustomAttributes(customerUUID string, customAttributes []string) (*CustomAttributes, error) // Metrics MetricsRetrieveAll(metricsFilter *MetricsFilter) (*MetricsResult, error) MetricsRetrieveMRR(metricsFilter *MetricsFilter) (*MRRResult, error) MetricsRetrieveARR(metricsFilter *MetricsFilter) (*ARRResult, error) MetricsRetrieveARPA(metricsFilter *MetricsFilter) (*ARPAResult, error) MetricsRetrieveASP(metricsFilter *MetricsFilter) (*ASPResult, error) MetricsRetrieveCustomerCount(metricsFilter *MetricsFilter) (*CustomerCountResult, error) MetricsRetrieveCustomerChurnRate(metricsFilter *MetricsFilter) (*CustomerChurnRateResult, error) MetricsRetrieveMRRChurnRate(metricsFilter *MetricsFilter) (*MRRChurnRateResult, error) MetricsRetrieveLTV(metricsFilter *MetricsFilter) (*LTVResult, error) // Metrics - Subscriptions & Activities MetricsListCustomerSubscriptions(cursor *Cursor, customerUUID string) (*MetricsCustomerSubscriptions, error) MetricsListCustomerActivities(cursor *Cursor, customerUUID string) (*MetricsCustomerActivities, error) MetricsListActivities(MetricsListActivitiesParams *MetricsListActivitiesParams) (*MetricsActivities, error) MetricsCreateActivitiesExport(CreateMetricsActivitiesExportParam *CreateMetricsActivitiesExportParam) (*MetricsActivitiesExport, error) MetricsRetrieveActivitiesExport(activitiesExportUUID string) (*MetricsActivitiesExport, error) // Account RetrieveAccount() (*Account, error) // Subscription Events ListSubscriptionEvents(filters *FilterSubscriptionEvents, cursor *MetaCursor) (*SubscriptionEvents, error) CreateSubscriptionEvent(newSubscriptionEvent *SubscriptionEvent) (*SubscriptionEvent, error) UpdateSubscriptionEvent(subscriptionEvent *SubscriptionEvent) (*SubscriptionEvent, error) DeleteSubscriptionEvent(deleteParams *DeleteSubscriptionEvent) error }
IApi defines the interface of the library. Necessary eg. for mocks in testing.
type Invoice ¶
type Invoice struct { UUID string `json:"uuid,omitempty"` CustomerUUID string `json:"customer_uuid,omitempty"` CustomerExternalID string `json:"customer_external_id,omitempty"` Currency string `json:"currency"` DataSourceUUID string `json:"data_source_uuid,omitempty"` Date string `json:"date"` DueDate string `json:"due_date,omitempty"` ExternalID string `json:"external_id"` LineItems []*LineItem `json:"line_items"` Transactions []*Transaction `json:"transactions,omitempty"` Errors *Errors `json:"errors,omitempty"` }
Invoice is the data for ChartMogul to auto-generate subscriptions.
type Invoices ¶
type Invoices struct { CustomerUUID string `json:"customer_uuid,omitempty"` CurrentPage uint32 `json:"current_page,omitempty"` TotalPages uint32 `json:"total_pages,omitempty"` Error string `json:"error,omitempty"` Invoices []*Invoice `json:"invoices"` }
Invoices is wrapper for bulk importing invoices In case of /v1/invoices endpoint, the customer_uuid is on individual invoices and here it's empty.
type LTVMetrics ¶
type LTVMetrics struct { Date string `json:"date"` LTV float64 `json:"ltv"` PercentageChange float64 `json:"percentage-change"` }
LTVMetrics represents results of Metrics API.
type LTVResult ¶
type LTVResult struct { Entries []*LTVMetrics `json:"entries,omitempty"` Summary *Summary `json:"summary"` }
LTVResult represents results of Metrics API.
type LineItem ¶
type LineItem struct { UUID string `json:"uuid,omitempty"` AccountCode string `json:"account_code,omitempty"` AmountInCents int `json:"amount_in_cents"` CancelledAt string `json:"cancelled_at,omitempty"` Description string `json:"description,omitempty"` DiscountAmountInCents int `json:"discount_amount_in_cents,omitempty"` DiscountCode string `json:"discount_code,omitempty"` ExternalID string `json:"external_id,omitempty"` PlanUUID string `json:"plan_uuid,omitempty"` Prorated bool `json:"prorated,omitempty"` Quantity int `json:"quantity,omitempty"` ServicePeriodEnd string `json:"service_period_end,omitempty"` ServicePeriodStart string `json:"service_period_start,omitempty"` SubscriptionExternalID string `json:"subscription_external_id,omitempty"` SubscriptionSetExternalID string `json:"subscription_set_external_id,omitempty"` SubscriptionUUID string `json:"subscription_uuid,omitempty"` TaxAmountInCents int `json:"tax_amount_in_cents,omitempty"` TransactionFeesInCents int `json:"transaction_fees_in_cents,omitempty"` TransactionFeesCurrency string `json:"transaction_fees_currency,omitempty"` DiscountDescription string `json:"discount_description,omitempty"` EventOrder int `json:"event_order,omitempty"` Type string `json:"type"` }
LineItem represents a singular items of the invoices
type ListAllInvoicesParams ¶
type ListAllInvoicesParams struct { CustomerUUID string `json:"customer_uuid,omitempty"` DataSourceUUID string `json:"data_source_uuid,omitempty"` ExternalID string `json:"external_id,omitempty"` Cursor }
ListAllInvoicesParams optional parameters for ListAllInvoices
type ListContactsParams ¶ added in v3.1.0
type ListContactsParams struct { CustomerUUID string `json:"customer_uuid,omitempty"` DataSourceUUID string `json:"data_source_uuid,omitempty"` PaginationWithCursor }
ListContactsParams = parameters for listing contacts in API.
type ListCustomersParams ¶
type ListCustomersParams struct { DataSourceUUID string `json:"data_source_uuid,omitempty"` Status string `json:"status,omitempty"` System string `json:"system,omitempty"` ExternalID string `json:"external_id,omitempty"` Cursor }
ListCustomersParams = parameters for listing customers in API.
type ListDataSourcesParams ¶
type ListDataSourcesParams struct { Name string `json:"name,omitempty"` System string `json:"system,omitempty"` }
ListDataSourcesParams are optional parameters for listing data sources.
type ListPlansParams ¶
type ListPlansParams struct { DataSourceUUID string `json:"data_source_uuid"` ExternalID string `json:"external_id,omitempty"` System string `json:"system,omitempty"` Cursor }
ListPlansParams = optional parameters for listing plans.
type MRRChurnRateMetrics ¶
type MRRChurnRateMetrics struct { Date string `json:"date"` MRRChurnRate float64 `json:"mrr-churn-rate"` PercentageChange float64 `json:"percentage-change"` }
MRRChurnRateMetrics represents results of Metrics API.
type MRRChurnRateResult ¶
type MRRChurnRateResult struct { Entries []*MRRChurnRateMetrics `json:"entries,omitempty"` Summary *Summary `json:"summary"` }
MRRChurnRateResult represents results of Metrics API.
type MRRMetrics ¶
type MRRMetrics struct { Date string `json:"date"` MRR float64 `json:"mrr"` MRRNewBusiness float64 `json:"mrr-new-business"` MRRExpansion float64 `json:"mrr-expansion"` MRRContraction float64 `json:"mrr-contraction"` MRRChurn float64 `json:"mrr-churn"` MRRReactivation float64 `json:"mrr-reactivation"` PercentageChange float64 `json:"percentage-change"` }
MRRMetrics represents results of Metrics API.
type MRRResult ¶
type MRRResult struct { Entries []*MRRMetrics `json:"entries,omitempty"` Summary *Summary `json:"summary"` }
MRRResult represents results of Metrics API.
type MergeCustomersParams ¶
MergeCustomersParams - identify source and target for merging.
type MetaCursor ¶ added in v3.1.0
type MetricsActivities ¶
type MetricsActivities struct { Entries []*MetricsActivity `json:"entries"` HasMore bool `json:"has_more"` PerPage uint32 `json:"per_page"` }
MetricsActivities is the result of listing activities in Metrics API.
type MetricsActivitiesExport ¶
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"` }
MetricsActivitiesExport represents Metrics API activity export in ChartMogul.
type MetricsActivity ¶
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"` }
MetricsActivity represents Metrics API activity in ChartMogul.
type MetricsCustomerActivities ¶
type MetricsCustomerActivities struct { Entries []*MetricsCustomerActivity `json:"entries"` HasMore bool `json:"has_more"` PerPage uint32 `json:"per_page"` Page uint32 `json:"page"` }
MetricsCustomerActivities is the result of listing activities in Metrics API.
type MetricsCustomerActivity ¶
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"` }
MetricsCustomerActivity represents Metrics API activity in ChartMogul.
type MetricsCustomerSubscription ¶
type MetricsCustomerSubscription struct { ID uint64 `json:"id"` ExternalID string `json:"external_id"` Plan string `json:"plan"` Quantity uint32 `json:"quantity"` BillingCycleCount uint32 `json:"billing-cycle-count"` MRR float64 `json:"mrr"` ARR float64 `json:"arr"` Status string `json:"status"` BillingCycle string `json:"billing-cycle"` StartDate string `json:"start-date"` EndDate string `json:"end-date"` Currency string `json:"currency"` CurrencySign string `json:"currency-sign"` }
MetricsCustomerSubscription represents Metrics API subscription in ChartMogul.
type MetricsCustomerSubscriptions ¶
type MetricsCustomerSubscriptions struct { Entries []*MetricsCustomerSubscription `json:"entries"` HasMore bool `json:"has_more"` PerPage uint32 `json:"per_page"` Page uint32 `json:"page"` }
MetricsCustomerSubscriptions is the result of listing subscriptions in Metrics API.
type MetricsFilter ¶
type MetricsFilter struct { StartDate string `json:"start-date,omitempty"` EndDate string `json:"end-date,omitempty"` Interval string `json:"interval,omitempty"` Geo string `json:"geo,omitempty"` Plans string `json:"plans,omitempty"` }
MetricsFilter convenient object to hold all filtering parameters.
type MetricsListActivitiesParams ¶
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 }
type MetricsResult ¶
type MetricsResult struct { Entries []*AllMetrics `json:"entries,omitempty"` Summary *AllSummary `json:"summary"` }
MetricsResult represents results of Metrics API.
type NestedParams ¶
type NestedParams struct { ActivityType string `json:"activity_type,omitempty"` StartDate string `json:"start_date,omitempty"` EndDate string `json:"end_date,omitempty"` }
NestedParams represents the params of the requested type of export.
type NewAttributes ¶
type NewAttributes struct { Tags []string `json:"tags,omitempty"` Custom []*CustomAttribute `json:"custom,omitempty"` }
NewAttributes is subdocument of NewCustomer.
type NewContact ¶ added in v3.1.0
type NewContact struct { // Obligatory CustomerUUID string `json:"customer_uuid,omitempty"` DataSourceUUID string `json:"data_source_uuid,omitempty"` //Optional FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` LinkedIn string `json:"linked_in,omitempty"` Notes string `json:"notes,omitempty"` Phone string `json:"phone,omitempty"` Position uint32 `json:"position,omitempty"` Title string `json:"title,omitempty"` Twitter string `json:"twitter,omitempty"` Custom []Custom `json:"custom,omitempty"` }
NewContact allows creating contact on a new endpoint.
type NewCustomer ¶
type NewCustomer struct { // Obligatory DataSourceUUID string `json:"data_source_uuid"` ExternalID string `json:"external_id,omitempty"` Name string `json:"name,omitempty"` //Optional Email string `json:"email,omitempty"` Attributes *NewAttributes `json:"attributes,omitempty"` // Address Company string `json:"company,omitempty"` Country string `json:"country,omitempty"` State string `json:"state,omitempty"` City string `json:"city,omitempty"` Zip string `json:"zip,omitempty"` // Lead/Trial LeadCreatedAt string `json:"lead_created_at,omitempty"` FreeTrialStartedAt string `json:"free_trial_started_at,omitempty"` }
NewCustomer allows creating customer on a new endpoint.
type PaginationWithCursor ¶ added in v3.1.0
type PaginationWithCursor struct { PerPage uint32 `json:"per_page,omitempty"` // Cursor is a reference to get the next set of entries. Cursor string `json:"cursor,omitempty"` }
PaginationWithCursor is the new standard for cursor with pagination.
type Params ¶
type Params struct { Kind string `json:"kind"` Params NestedParams `json:"params,omitempty"` }
Params provides information on the requested export.
type Ping ¶
type Ping struct {
Data string
}
Ping is simple struct for the authentication test endpoint.
type Plan ¶
type Plan struct { UUID string `json:"uuid,omitempty"` DataSourceUUID string `json:"data_source_uuid,omitempty"` ExternalID string `json:"external_id,omitempty"` Name string `json:"name,omitempty"` IntervalCount uint32 `json:"interval_count,omitempty"` IntervalUnit string `json:"interval_unit,omitempty"` Errors Errors `json:"errors,omitempty"` }
Plan represents ChartMogul categorization of subscriptions.
type PlanGroup ¶
type PlanGroup struct { UUID string `json:"uuid,omitempty"` Name string `json:"name,omitempty"` Plans []*string `json:"plans,omitempty"` PlansCount int `json:"plans_count,omitempty"` Errors Errors `json:"errors,omitempty"` }
PlanGroup represents groups of plans in ChartMogul
type PlanGroupPlans ¶
type PlanGroupPlans struct { Plans []*Plan `json:"plans"` TotalPages uint32 `json:"total_pages"` CurrentPage uint32 `json:"current_page"` }
PlanGroupPlans is result of listing: plans + paging for a plan group.
type PlanGroups ¶
type PlanGroups struct { PlanGroups []*PlanGroup `json:"plan_groups"` TotalPages uint32 `json:"total_pages"` CurrentPage uint32 `json:"current_page"` }
PlanGroups is result of listing: plan_groups + page.
type Plans ¶
type Plans struct { Plans []*Plan `json:"plans"` TotalPages uint32 `json:"total_pages"` CurrentPage uint32 `json:"current_page"` }
Plans is result of listing: plans + paging.
type RequestErrors ¶
type RequestErrors interface {
Errors() []error
}
RequestErrors wraps multiple request errors to normal 1 error struct.
type SearchCustomersParams ¶
SearchCustomersParams - just email now.
type Subscription ¶
type Subscription struct { UUID string `json:"uuid,omitempty"` ExternalID string `json:"external_id"` SubscriptionSetExternalID string `json:"subscription_set_external_id,omitempty"` PlanUUID string `json:"plan_uuid,omitempty"` CustomerUUID string `json:"customer_uuid,omitempty"` DataSourceUUID string `json:"data_source_uuid"` CancellationDates []string `json:"cancellation_dates,omitempty"` }
Subscription represents Import API subscription in ChartMogul.
type SubscriptionEvent ¶ added in v3.1.0
type SubscriptionEvent struct { ID uint64 `json:"id,omitempty"` DataSourceUUID string `json:"data_source_uuid,omitempty"` CustomerExternalID string `json:"customer_external_id,omitempty"` SubscriptionSetExternalID string `json:"subscription_set_external_id,omitempty"` SubscriptionExternalID string `json:"subscription_external_id,omitempty"` PlanExternalID string `json:"plan_external_id,omitempty"` EventDate string `json:"event_date,omitempty"` EffectiveDate string `json:"effective_date,omitempty"` EventType string `json:"event_type,omitempty"` ExternalID string `json:"external_id,omitempty"` Errors interface{} `json:"errors,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` Quantity int32 `json:"quantity,omitempty"` Currency string `json:"currency,omitempty"` AmountInCents int32 `json:"amount_in_cents,omitempty"` TaxAmountInCents int32 `json:"tax_amount_in_cents,omitempty"` RetractedEventId string `json:"retracted_event_id,omitempty"` }
type SubscriptionEventParams ¶ added in v3.1.0
type SubscriptionEventParams struct {
Params *SubscriptionEvent `json:"subscription_event"`
}
type SubscriptionEvents ¶ added in v3.1.0
type SubscriptionEvents struct { SubscriptionEvents []*SubscriptionEvent `json:"subscription_events"` Meta MetaCursor `json:"meta"` }
type Subscriptions ¶
type Subscriptions struct { Subscriptions []Subscription `json:"subscriptions"` CustomerUUID string `json:"customer_uuid,omitempty"` TotalPages uint32 `json:"total_pages,omitempty"` CurrentPage uint32 `json:"current_page,omitempty"` }
Subscriptions is the result of listing subscriptions with paging.
type Summary ¶
type Summary struct { Current float64 `json:"current"` Previous float64 `json:"previous"` PercentageChange float64 `json:"percentage-change"` }
Summary represents results of Metrics API.
type TagsByEmail ¶
TagsByEmail = input for AddTagsToCustomersWithEmail
type TagsResult ¶
type TagsResult struct {
Tags []string `json:"tags"`
}
TagsResult is necessary for the the result of AddTags.
type Transaction ¶
type Transaction struct { UUID string `json:"uuid,omitempty"` Date string `json:"date"` ExternalID string `json:"external_id,omitempty"` Result string `json:"result"` Type string `json:"type"` AmountInCents *int `json:"amount_in_cents,omitempty"` Errors Errors `json:"errors,omitempty"` }
Transaction is either payment/refund on an invoice, for its full value.
type UpdateContact ¶ added in v3.1.0
type UpdateContact struct { CustomerExternalID string `json:"customer_external_id,omitempty"` DataSourceUUID string `json:"data_source_uuid,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` LinkedIn string `json:"linked_in,omitempty"` Notes string `json:"notes,omitempty"` Phone string `json:"phone,omitempty"` Position uint32 `json:"position,omitempty"` Title string `json:"title,omitempty"` Twitter string `json:"twitter,omitempty"` Custom []Custom `json:"custom,omitempty"` }
UpdateContact allows updating contact on the update endpoint.
type UpdateCustomer ¶
type UpdateCustomer struct { Name *string `json:"name,omitempty"` Email *string `json:"email,omitempty"` Company *string `json:"company,omitempty"` Country *string `json:"country,omitempty"` State *string `json:"state,omitempty"` City *string `json:"city,omitempty"` Zip *string `json:"zip,omitempty"` LeadCreatedAt *string `json:"lead_created_at,omitempty"` FreeTrialStartedAt *string `json:"free_trial_started_at,omitempty"` Attributes *Attributes `json:"attributes,omitempty"` }
UpdateCustomer allows updating customer on the update endpoint.
Source Files ¶
- account.go
- attributes.go
- chartmogul.go
- contacts.go
- customers.go
- datasources.go
- errors.go
- generic.go
- invoices.go
- metrics.go
- metrics_activities.go
- metrics_activities_exports.go
- metrics_customer_activities.go
- metrics_customer_subscriptions.go
- ping.go
- plan_group_plans.go
- plan_groups.go
- plans.go
- subscription_events.go
- subscriptions.go
- tags.go
- transactions.go
- version.go
Directories ¶
Path | Synopsis |
---|---|
Package mock_v3 is a generated GoMock package.
|
Package mock_v3 is a generated GoMock package. |