@selfcommunity/api-services 0.7.0-alpha.9 → 0.7.0-mui7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/client/index.d.ts +3 -3
- package/lib/cjs/client/index.js +3 -3
- package/lib/cjs/constants/Endpoints.js +2 -2
- package/lib/cjs/services/community/index.d.ts +28 -24
- package/lib/cjs/services/community/index.js +28 -24
- package/lib/cjs/services/payment/index.d.ts +5 -5
- package/lib/cjs/services/payment/index.js +2 -2
- package/lib/cjs/services/tag/index.d.ts +3 -3
- package/lib/cjs/services/tag/index.js +4 -4
- package/lib/esm/client/index.d.ts +3 -3
- package/lib/esm/client/index.js +3 -3
- package/lib/esm/constants/Endpoints.js +2 -2
- package/lib/esm/services/community/index.d.ts +28 -24
- package/lib/esm/services/community/index.js +28 -24
- package/lib/esm/services/payment/index.d.ts +5 -5
- package/lib/esm/services/payment/index.js +2 -2
- package/lib/esm/services/tag/index.d.ts +3 -3
- package/lib/esm/services/tag/index.js +4 -4
- package/lib/umd/194.js +2 -0
- package/lib/umd/{956.js.LICENSE.txt → 194.js.LICENSE.txt} +2 -0
- package/lib/umd/api-services.js +1 -1
- package/lib/umd/api-services.js.LICENSE.txt +1 -1
- package/package.json +7 -7
- package/lib/umd/956.js +0 -2
|
@@ -2,17 +2,17 @@ import { AxiosInstance, AxiosResponse } from 'axios';
|
|
|
2
2
|
/**
|
|
3
3
|
* List of all Http methods
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
6
6
|
/**
|
|
7
7
|
* AxiosResponseHeaders interface
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type AxiosResponseHeaders = Record<string, string> & {
|
|
10
10
|
'set-cookie'?: string[];
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* General HttpResponse
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type HttpResponse<T = unknown, D = any> = AxiosResponse<T, D>;
|
|
16
16
|
/**
|
|
17
17
|
* Interface for the ApiClient
|
|
18
18
|
*/
|
package/lib/cjs/client/index.js
CHANGED
|
@@ -10,6 +10,9 @@ const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
|
10
10
|
* should we choose to do so in the future, without it breaking our app.
|
|
11
11
|
*/
|
|
12
12
|
class ApiClient {
|
|
13
|
+
createClient(config) {
|
|
14
|
+
return axios_1.default.create(Object.assign(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), (config && config.responseType ? { responseType: config.responseType } : { responseType: 'json' })), { headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
|
|
15
|
+
}
|
|
13
16
|
constructor(config) {
|
|
14
17
|
/**
|
|
15
18
|
* Set default header
|
|
@@ -51,9 +54,6 @@ class ApiClient {
|
|
|
51
54
|
this.client = this.createClient(config);
|
|
52
55
|
this.setDefaultHeader({ name: 'Content-Type', value: 'application/json', methods: ['post'] });
|
|
53
56
|
}
|
|
54
|
-
createClient(config) {
|
|
55
|
-
return axios_1.default.create(Object.assign(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), (config && config.responseType ? { responseType: config.responseType } : { responseType: 'json' })), { headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
|
|
56
|
-
}
|
|
57
57
|
/**
|
|
58
58
|
* Get client instance
|
|
59
59
|
*/
|
|
@@ -306,8 +306,8 @@ const Endpoints = {
|
|
|
306
306
|
url: (0, utils_1.urlReplacer)('/api/v2/tag/'),
|
|
307
307
|
method: 'POST'
|
|
308
308
|
},
|
|
309
|
-
|
|
310
|
-
url: (0, utils_1.urlReplacer)('/api/v2/tag/'),
|
|
309
|
+
SearchUserTags: {
|
|
310
|
+
url: (0, utils_1.urlReplacer)('/api/v2/tag/user/search/'),
|
|
311
311
|
method: 'GET'
|
|
312
312
|
},
|
|
313
313
|
Tag: {
|
|
@@ -34,30 +34,34 @@ export declare class CommunityApiClient {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
*
|
|
37
|
-
:::tip Community service can be used in the following way:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
import {CommunityService} from "@selfcommunity/api-services";
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
2. Create a function and put the service inside it!
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
37
|
+
* :::tip Community service can be used in the following way:
|
|
38
|
+
*
|
|
39
|
+
* 1. Import the service from our library:
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* import {CommunityService} from "@selfcommunity/api-services";
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* 2. Create a function and put the service inside it! The async function `getCommunities`
|
|
46
|
+
* will return the events matching the search query.
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* async function getCommunities() {
|
|
50
|
+
* return await CommunityService.getCommunities({...});
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
55
|
+
*
|
|
56
|
+
* 1. Declare it (or declare multiple params):
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* const headers = { Authorization: `Bearer ${yourToken}` };
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
63
|
+
*
|
|
64
|
+
* :::
|
|
61
65
|
*/
|
|
62
66
|
export default class CommunityService {
|
|
63
67
|
static getCommunities(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCommunityType>>;
|
|
@@ -30,30 +30,34 @@ class CommunityApiClient {
|
|
|
30
30
|
exports.CommunityApiClient = CommunityApiClient;
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
33
|
-
:::tip Community service can be used in the following way:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
import {CommunityService} from "@selfcommunity/api-services";
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
2. Create a function and put the service inside it!
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
33
|
+
* :::tip Community service can be used in the following way:
|
|
34
|
+
*
|
|
35
|
+
* 1. Import the service from our library:
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* import {CommunityService} from "@selfcommunity/api-services";
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* 2. Create a function and put the service inside it! The async function `getCommunities`
|
|
42
|
+
* will return the events matching the search query.
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* async function getCommunities() {
|
|
46
|
+
* return await CommunityService.getCommunities({...});
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
51
|
+
*
|
|
52
|
+
* 1. Declare it (or declare multiple params):
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* const headers = { Authorization: `Bearer ${yourToken}` };
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
59
|
+
*
|
|
60
|
+
* :::
|
|
57
61
|
*/
|
|
58
62
|
class CommunityService {
|
|
59
63
|
static getCommunities(params, config) {
|
|
@@ -4,13 +4,13 @@ import { CheckoutCreateSessionParams, CheckoutSessionParams, PaymentProductsPara
|
|
|
4
4
|
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCPaywall } from '@selfcommunity/types';
|
|
5
5
|
export interface PaymentApiClientInterface {
|
|
6
6
|
/**
|
|
7
|
-
* Get payment products related to an object (aka paywalls) of type
|
|
7
|
+
* Get payment products related to an object (aka paywalls) of type <content_type> and id <content_id> and the current payment_order
|
|
8
8
|
* @param params
|
|
9
9
|
* @param config
|
|
10
10
|
*/
|
|
11
11
|
getPaymentContentStatus(params?: PaymentContentStatusParams, config?: AxiosRequestConfig): Promise<PaymentContentStatus>;
|
|
12
12
|
/**
|
|
13
|
-
* Get payment products related to an object (aka paywalls) of type
|
|
13
|
+
* Get payment products related to an object (aka paywalls) of type <content_type> and id <content_id>
|
|
14
14
|
* @param params
|
|
15
15
|
* @param config
|
|
16
16
|
*/
|
|
@@ -35,7 +35,7 @@ export interface PaymentApiClientInterface {
|
|
|
35
35
|
*/
|
|
36
36
|
getPaymentProductPrices(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
37
37
|
/**
|
|
38
|
-
* Create session checkout with price_id for an object of type
|
|
38
|
+
* Create session checkout with price_id for an object of type <content_type> and id <content_id>
|
|
39
39
|
* @param data
|
|
40
40
|
* @param config
|
|
41
41
|
*/
|
|
@@ -88,13 +88,13 @@ export interface PaymentApiClientInterface {
|
|
|
88
88
|
*/
|
|
89
89
|
export declare class PaymentApiClient {
|
|
90
90
|
/**
|
|
91
|
-
* This endpoint retrieves all the products related to an object of type
|
|
91
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id> and the current payment_order
|
|
92
92
|
* @param params
|
|
93
93
|
* @param config
|
|
94
94
|
*/
|
|
95
95
|
static getPaymentContentStatus(params?: PaymentContentStatusParams, config?: AxiosRequestConfig): Promise<PaymentContentStatus>;
|
|
96
96
|
/**
|
|
97
|
-
* This endpoint retrieves all the products related to an object of type
|
|
97
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id>
|
|
98
98
|
* @param params
|
|
99
99
|
* @param config
|
|
100
100
|
*/
|
|
@@ -10,7 +10,7 @@ const url_1 = require("../../utils/url");
|
|
|
10
10
|
*/
|
|
11
11
|
class PaymentApiClient {
|
|
12
12
|
/**
|
|
13
|
-
* This endpoint retrieves all the products related to an object of type
|
|
13
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id> and the current payment_order
|
|
14
14
|
* @param params
|
|
15
15
|
* @param config
|
|
16
16
|
*/
|
|
@@ -18,7 +18,7 @@ class PaymentApiClient {
|
|
|
18
18
|
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { params, url: `${Endpoints_1.default.GetPaymentContentStatus.url({})}`, method: Endpoints_1.default.GetPaymentContentStatus.method }));
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* This endpoint retrieves all the products related to an object of type
|
|
21
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id>
|
|
22
22
|
* @param params
|
|
23
23
|
* @param config
|
|
24
24
|
*/
|
|
@@ -4,7 +4,7 @@ import { AxiosRequestConfig } from 'axios';
|
|
|
4
4
|
export interface TagApiClientInterface {
|
|
5
5
|
getAllTags(params?: TagGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCTagType>>;
|
|
6
6
|
createTag(data: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
7
|
-
|
|
7
|
+
searchUserTags(params?: TagGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCTagType>>;
|
|
8
8
|
getSpecificTag(id: number | string, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
9
9
|
updateTag(id: number | string, data?: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
10
10
|
patchTag(id: number | string, data?: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
@@ -32,7 +32,7 @@ export declare class TagApiClient {
|
|
|
32
32
|
* @param params
|
|
33
33
|
* @param config
|
|
34
34
|
*/
|
|
35
|
-
static
|
|
35
|
+
static searchUserTags(params?: TagGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCTagType>>;
|
|
36
36
|
/**
|
|
37
37
|
* This endpoint retrieves a specific tag.
|
|
38
38
|
* @param id
|
|
@@ -101,7 +101,7 @@ export declare class TagApiClient {
|
|
|
101
101
|
export default class TagService {
|
|
102
102
|
static getAllTags(params?: TagGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCTagType>>;
|
|
103
103
|
static createTag(data: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
104
|
-
static
|
|
104
|
+
static searchUserTags(params?: TagGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCTagType>>;
|
|
105
105
|
static getSpecificTag(id: number | string, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
106
106
|
static updateTag(id: number | string, data?: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
107
107
|
static patchTag(id: number | string, data?: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
@@ -32,9 +32,9 @@ class TagApiClient {
|
|
|
32
32
|
* @param params
|
|
33
33
|
* @param config
|
|
34
34
|
*/
|
|
35
|
-
static
|
|
35
|
+
static searchUserTags(params, config) {
|
|
36
36
|
const p = (0, url_1.urlParams)(params);
|
|
37
|
-
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.
|
|
37
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.SearchUserTags.url({})}?${p.toString()}`, method: Endpoints_1.default.SearchUserTags.method }));
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* This endpoint retrieves a specific tag.
|
|
@@ -121,9 +121,9 @@ class TagService {
|
|
|
121
121
|
return TagApiClient.createTag(data, config);
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
static
|
|
124
|
+
static searchUserTags(params, config) {
|
|
125
125
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
return TagApiClient.
|
|
126
|
+
return TagApiClient.searchUserTags(params, config);
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
static getSpecificTag(id, config) {
|
|
@@ -2,17 +2,17 @@ import { AxiosInstance, AxiosResponse } from 'axios';
|
|
|
2
2
|
/**
|
|
3
3
|
* List of all Http methods
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
6
6
|
/**
|
|
7
7
|
* AxiosResponseHeaders interface
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type AxiosResponseHeaders = Record<string, string> & {
|
|
10
10
|
'set-cookie'?: string[];
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* General HttpResponse
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type HttpResponse<T = unknown, D = any> = AxiosResponse<T, D>;
|
|
16
16
|
/**
|
|
17
17
|
* Interface for the ApiClient
|
|
18
18
|
*/
|
package/lib/esm/client/index.js
CHANGED
|
@@ -6,6 +6,9 @@ import axios from 'axios';
|
|
|
6
6
|
* should we choose to do so in the future, without it breaking our app.
|
|
7
7
|
*/
|
|
8
8
|
export class ApiClient {
|
|
9
|
+
createClient(config) {
|
|
10
|
+
return axios.create(Object.assign(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), (config && config.responseType ? { responseType: config.responseType } : { responseType: 'json' })), { headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
|
|
11
|
+
}
|
|
9
12
|
constructor(config) {
|
|
10
13
|
/**
|
|
11
14
|
* Set default header
|
|
@@ -47,9 +50,6 @@ export class ApiClient {
|
|
|
47
50
|
this.client = this.createClient(config);
|
|
48
51
|
this.setDefaultHeader({ name: 'Content-Type', value: 'application/json', methods: ['post'] });
|
|
49
52
|
}
|
|
50
|
-
createClient(config) {
|
|
51
|
-
return axios.create(Object.assign(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), (config && config.responseType ? { responseType: config.responseType } : { responseType: 'json' })), { headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
|
|
52
|
-
}
|
|
53
53
|
/**
|
|
54
54
|
* Get client instance
|
|
55
55
|
*/
|
|
@@ -34,30 +34,34 @@ export declare class CommunityApiClient {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
*
|
|
37
|
-
:::tip Community service can be used in the following way:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
import {CommunityService} from "@selfcommunity/api-services";
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
2. Create a function and put the service inside it!
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
37
|
+
* :::tip Community service can be used in the following way:
|
|
38
|
+
*
|
|
39
|
+
* 1. Import the service from our library:
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* import {CommunityService} from "@selfcommunity/api-services";
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* 2. Create a function and put the service inside it! The async function `getCommunities`
|
|
46
|
+
* will return the events matching the search query.
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* async function getCommunities() {
|
|
50
|
+
* return await CommunityService.getCommunities({...});
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
55
|
+
*
|
|
56
|
+
* 1. Declare it (or declare multiple params):
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* const headers = { Authorization: `Bearer ${yourToken}` };
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
63
|
+
*
|
|
64
|
+
* :::
|
|
61
65
|
*/
|
|
62
66
|
export default class CommunityService {
|
|
63
67
|
static getCommunities(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCommunityType>>;
|
|
@@ -26,30 +26,34 @@ export class CommunityApiClient {
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
*
|
|
29
|
-
:::tip Community service can be used in the following way:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
import {CommunityService} from "@selfcommunity/api-services";
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
2. Create a function and put the service inside it!
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
29
|
+
* :::tip Community service can be used in the following way:
|
|
30
|
+
*
|
|
31
|
+
* 1. Import the service from our library:
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* import {CommunityService} from "@selfcommunity/api-services";
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* 2. Create a function and put the service inside it! The async function `getCommunities`
|
|
38
|
+
* will return the events matching the search query.
|
|
39
|
+
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* async function getCommunities() {
|
|
42
|
+
* return await CommunityService.getCommunities({...});
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
47
|
+
*
|
|
48
|
+
* 1. Declare it (or declare multiple params):
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* const headers = { Authorization: `Bearer ${yourToken}` };
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
55
|
+
*
|
|
56
|
+
* :::
|
|
53
57
|
*/
|
|
54
58
|
export default class CommunityService {
|
|
55
59
|
static getCommunities(params, config) {
|
|
@@ -4,13 +4,13 @@ import { CheckoutCreateSessionParams, CheckoutSessionParams, PaymentProductsPara
|
|
|
4
4
|
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCPaywall } from '@selfcommunity/types';
|
|
5
5
|
export interface PaymentApiClientInterface {
|
|
6
6
|
/**
|
|
7
|
-
* Get payment products related to an object (aka paywalls) of type
|
|
7
|
+
* Get payment products related to an object (aka paywalls) of type <content_type> and id <content_id> and the current payment_order
|
|
8
8
|
* @param params
|
|
9
9
|
* @param config
|
|
10
10
|
*/
|
|
11
11
|
getPaymentContentStatus(params?: PaymentContentStatusParams, config?: AxiosRequestConfig): Promise<PaymentContentStatus>;
|
|
12
12
|
/**
|
|
13
|
-
* Get payment products related to an object (aka paywalls) of type
|
|
13
|
+
* Get payment products related to an object (aka paywalls) of type <content_type> and id <content_id>
|
|
14
14
|
* @param params
|
|
15
15
|
* @param config
|
|
16
16
|
*/
|
|
@@ -35,7 +35,7 @@ export interface PaymentApiClientInterface {
|
|
|
35
35
|
*/
|
|
36
36
|
getPaymentProductPrices(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
37
37
|
/**
|
|
38
|
-
* Create session checkout with price_id for an object of type
|
|
38
|
+
* Create session checkout with price_id for an object of type <content_type> and id <content_id>
|
|
39
39
|
* @param data
|
|
40
40
|
* @param config
|
|
41
41
|
*/
|
|
@@ -88,13 +88,13 @@ export interface PaymentApiClientInterface {
|
|
|
88
88
|
*/
|
|
89
89
|
export declare class PaymentApiClient {
|
|
90
90
|
/**
|
|
91
|
-
* This endpoint retrieves all the products related to an object of type
|
|
91
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id> and the current payment_order
|
|
92
92
|
* @param params
|
|
93
93
|
* @param config
|
|
94
94
|
*/
|
|
95
95
|
static getPaymentContentStatus(params?: PaymentContentStatusParams, config?: AxiosRequestConfig): Promise<PaymentContentStatus>;
|
|
96
96
|
/**
|
|
97
|
-
* This endpoint retrieves all the products related to an object of type
|
|
97
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id>
|
|
98
98
|
* @param params
|
|
99
99
|
* @param config
|
|
100
100
|
*/
|
|
@@ -7,7 +7,7 @@ import { urlParams } from '../../utils/url';
|
|
|
7
7
|
*/
|
|
8
8
|
export class PaymentApiClient {
|
|
9
9
|
/**
|
|
10
|
-
* This endpoint retrieves all the products related to an object of type
|
|
10
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id> and the current payment_order
|
|
11
11
|
* @param params
|
|
12
12
|
* @param config
|
|
13
13
|
*/
|
|
@@ -15,7 +15,7 @@ export class PaymentApiClient {
|
|
|
15
15
|
return apiRequest(Object.assign(Object.assign({}, config), { params, url: `${Endpoints.GetPaymentContentStatus.url({})}`, method: Endpoints.GetPaymentContentStatus.method }));
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* This endpoint retrieves all the products related to an object of type
|
|
18
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id>
|
|
19
19
|
* @param params
|
|
20
20
|
* @param config
|
|
21
21
|
*/
|
|
@@ -4,7 +4,7 @@ import { AxiosRequestConfig } from 'axios';
|
|
|
4
4
|
export interface TagApiClientInterface {
|
|
5
5
|
getAllTags(params?: TagGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCTagType>>;
|
|
6
6
|
createTag(data: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
7
|
-
|
|
7
|
+
searchUserTags(params?: TagGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCTagType>>;
|
|
8
8
|
getSpecificTag(id: number | string, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
9
9
|
updateTag(id: number | string, data?: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
10
10
|
patchTag(id: number | string, data?: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
@@ -32,7 +32,7 @@ export declare class TagApiClient {
|
|
|
32
32
|
* @param params
|
|
33
33
|
* @param config
|
|
34
34
|
*/
|
|
35
|
-
static
|
|
35
|
+
static searchUserTags(params?: TagGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCTagType>>;
|
|
36
36
|
/**
|
|
37
37
|
* This endpoint retrieves a specific tag.
|
|
38
38
|
* @param id
|
|
@@ -101,7 +101,7 @@ export declare class TagApiClient {
|
|
|
101
101
|
export default class TagService {
|
|
102
102
|
static getAllTags(params?: TagGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCTagType>>;
|
|
103
103
|
static createTag(data: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
104
|
-
static
|
|
104
|
+
static searchUserTags(params?: TagGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCTagType>>;
|
|
105
105
|
static getSpecificTag(id: number | string, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
106
106
|
static updateTag(id: number | string, data?: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
107
107
|
static patchTag(id: number | string, data?: TagParams, config?: AxiosRequestConfig): Promise<SCTagType>;
|
|
@@ -29,9 +29,9 @@ export class TagApiClient {
|
|
|
29
29
|
* @param params
|
|
30
30
|
* @param config
|
|
31
31
|
*/
|
|
32
|
-
static
|
|
32
|
+
static searchUserTags(params, config) {
|
|
33
33
|
const p = urlParams(params);
|
|
34
|
-
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.
|
|
34
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.SearchUserTags.url({})}?${p.toString()}`, method: Endpoints.SearchUserTags.method }));
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* This endpoint retrieves a specific tag.
|
|
@@ -117,9 +117,9 @@ export default class TagService {
|
|
|
117
117
|
return TagApiClient.createTag(data, config);
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
-
static
|
|
120
|
+
static searchUserTags(params, config) {
|
|
121
121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
return TagApiClient.
|
|
122
|
+
return TagApiClient.searchUserTags(params, config);
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
static getSpecificTag(id, config) {
|