V2_MembershipAPI

new V2_MembershipAPI(rest)

This class is used to interact with Memberships in TidyHQ.
Parameters:
NameTypeDescription
restRestThe rest instance to use for requests.

Methods

(async) getMembership(membership_id, optionsopt) → {Promise.<TidyAPI_V2_Membership>}

Get a single membership from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
membership_idstringThe id of the membership to get.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The membership.
Type: 
Promise.<TidyAPI_V2_Membership>

(async) getMemberships(optionsopt) → {Promise.<TidyAPI_V2_Memberships>}

Get a list of memberships from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
updated_beforestring<optional>
ISO8601 formatted timestamp, only returns results last updated before the given time.
updated_sincestring<optional>
ISO8601 formatted timestamp, only returns results last updated since the given time.
limitnumber<optional>
The maximum number of memberships per page to return.
offsetnumber<optional>
The number of memberships to skip.
allboolean<optional>
When given, returns all (including inactive) - defaults to only returning visible / active.
activeboolean<optional>
When given, returns only users with active / inactive memberships (active is partial and activated status).
Returns:
- An array of memberships.
Type: 
Promise.<TidyAPI_V2_Memberships>

(async) getSubscriptions(optionsopt) → {Promise.<TidyAPI_V2_Subscriptions>}

Get a list of subscriptions from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
updated_beforestring<optional>
ISO8601 formatted timestamp, only returns results last updated before the given time.
updated_sincestring<optional>
ISO8601 formatted timestamp, only returns results last updated since the given time.
limitnumber<optional>
The maximum number of subscriptions per page to return.
offsetnumber<optional>
The number of subscriptions to skip.
activeboolean<optional>
When given, returns only users with active / inactive subscriptions (active is partial and activated status).
Returns:
- An array of subscriptions.
Type: 
Promise.<TidyAPI_V2_Subscriptions>

(async) renewSubscriptionForMembership(membership_id, subscription, optionsopt) → {Promise.<TidyAPI_V2_SubscriptionPost>}

Create/renew a subscription for a membership in TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
membership_idstringThe id of the membership to create a subscription for.
subscriptionTidy_V2_PostSubscriptionParamsThe subscription parameters.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The subscription, membership, payment url and invoice id.
Type: 
Promise.<TidyAPI_V2_SubscriptionPost>