npm package: @plasma-platform/service-memberships
Description: Memberships Service API
Author: Kyrylo Voronoi
Latest version: 1.3.0

![version](https://badgen.net/npm/v/@plasma-platform/service-memberships)
![nextVersion](https://badgen.net/npm/v/@plasma-platform/service-memberships/next)
![downloads](https://badgen.net/npm/dt/@plasma-platform/service-memberships)
![license](https://badgen.net/npm/license/@plasma-platform/service-memberships)
![dependency](https://badgen.net/npm/dependents/@plasma-platform/service-memberships)  

* * *

[Full documentation](https://templatemonster.gitlab.io/PlasmaPlatform/Frontend/plasma-platform/?path=/story/plasma-platform-sdk--service-memberships)  
install:  
`npm i @plasma-platform/service-memberships -S`  

# Short documentation

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [MembershipsService](#membershipsservice)
    -   [Parameters](#parameters)
    -   [messages](#messages)
    -   [getListOfMembershipGroups](#getlistofmembershipgroups)
        -   [Parameters](#parameters-1)
        -   [Examples](#examples)
    -   [getListOfAllMembershipPlans](#getlistofallmembershipplans)
        -   [Parameters](#parameters-2)
        -   [Examples](#examples-1)
    -   [getMembershipPlanInfoById](#getmembershipplaninfobyid)
        -   [Parameters](#parameters-3)
        -   [Examples](#examples-2)
    -   [getListOfSubscriptions](#getlistofsubscriptions)
        -   [Parameters](#parameters-4)
        -   [Examples](#examples-3)
    -   [getSubscription](#getsubscription)
        -   [Parameters](#parameters-5)
        -   [Examples](#examples-4)
    -   [reactivatePayments](#reactivatepayments)
        -   [Parameters](#parameters-6)
        -   [Examples](#examples-5)
    -   [suspendPayments](#suspendpayments)
        -   [Parameters](#parameters-7)
        -   [Examples](#examples-6)
    -   [getDownloadsByProductId](#getdownloadsbyproductid)
        -   [Parameters](#parameters-8)
        -   [Examples](#examples-7)

## MembershipsService

-   **See: <http://http://service-memberships.dev/doc/>**

Memberships Micro Service API

### Parameters

-   `url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** service url
-   `token` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null)** user access token if available (optional, default `null`)

### messages

Object with class service messages

Type: [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

### getListOfMembershipGroups

Groups - Get list of membership groups

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.propertyId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Use for filtering by TM property value id.
    -   `params.all` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Ignore membership group status on search, default value: 0, allowed values: 1, 0

#### Examples

Get list of membership groups


```javascript
(async () => {
  const service = new MembershipsService('//api.templatemonsterdev.com/memberships/v1/');
  const response = await service.getListOfMembershipGroups(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** Promise object represents info

### getListOfAllMembershipPlans

Memberships - Get list of all membership plans

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.groupId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Use for filtering by group ID
    -   `params.all` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Ignore membership group status on search, default value: 0, allowed values: 1, 0

#### Examples

Get membership plan info by ID


```javascript
(async () => {
  const service = new MembershipsService('//api.templatemonsterdev.com/memberships/v1/');
  const response = await service.getListOfAllMembershipPlans(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** Promise object represents info

### getMembershipPlanInfoById

Memberships - Get membership plan info by ID

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.membershipId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the membership plan (required)

#### Examples

Get membership plan info by ID


```javascript
(async () => {
  const service = new MembershipsService('//api.templatemonsterdev.com/memberships/v1/');
  const response = await service.getMembershipPlanInfoById(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** Promise object represents info

### getListOfSubscriptions

Subscriptions - Get list of subscriptions

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.status` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Use for filtering by status. Allowed values: pending, active, inactive
    -   `params.membershipId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Use for filtering by membership ID
    -   `params.groupId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Use for filtering by membership group ID

#### Examples

Get list of subscriptions


```javascript
(async () => {
  const service = new MembershipsService('//api.templatemonsterdev.com/memberships/v1/', token);
  const response = await service.getListOfSubscriptions(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** Promise object represents info

### getSubscription

Subscriptions - Get subscription

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.subscriptionId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the subscription (required)

#### Examples

Get list of subscriptions


```javascript
(async () => {
  const service = new MembershipsService('//api.templatemonsterdev.com/memberships/v1/', token);
  const response = await service.getSubscription(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** Promise object represents info

### reactivatePayments

Subscriptions - Reactivate payments. Reactivate recurrent payments for subscription, payment status will be changed to active

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.subscriptionId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the subscription (required)

#### Examples

Get list of subscriptions


```javascript
(async () => {
  const service = new MembershipsService('//api.templatemonsterdev.com/memberships/v1/', token);
  const response = await service.reactivatePayments(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** Promise object represents info

### suspendPayments

Subscriptions - Suspend payments. Suspend recurrent payments for subscription, payment status will be changed to inactive

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.subscriptionId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the subscription (required)

#### Examples

Get list of subscriptions


```javascript
(async () => {
  const service = new MembershipsService('//api.templatemonsterdev.com/memberships/v1/', token);
  const response = await service.suspendPayments(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** Promise object represents info

### getDownloadsByProductId

Subscription Downloads - Get downloads by product ID. Gets download by product ID from entire user downloads list.

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.productId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** product id (required)

#### Examples

Get list of subscriptions


```javascript
(async () => {
  const service = new MembershipsService('//api.templatemonsterdev.com/memberships/v1/', token);
  const response = await service.getDownloadsByProductId(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** Promise object represents info