@selfcommunity/api-services 0.7.0-alpha.0 → 0.7.0-alpha.10
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 +105 -0
- package/lib/cjs/index.d.ts +5 -2
- package/lib/cjs/index.js +10 -1
- package/lib/cjs/services/community/index.d.ts +69 -0
- package/lib/cjs/services/community/index.js +74 -0
- package/lib/cjs/services/contact_us/index.d.ts +57 -0
- package/lib/cjs/services/contact_us/index.js +65 -0
- package/lib/cjs/services/custom_menu/index.d.ts +0 -7
- package/lib/cjs/services/custom_menu/index.js +0 -12
- package/lib/cjs/services/feed_object/index.d.ts +28 -1
- package/lib/cjs/services/feed_object/index.js +44 -0
- package/lib/cjs/services/payment/index.d.ts +219 -0
- package/lib/cjs/services/payment/index.js +218 -0
- package/lib/cjs/services/user/index.d.ts +29 -1
- package/lib/cjs/services/user/index.js +43 -0
- package/lib/cjs/types/contactUs.d.ts +25 -0
- package/lib/cjs/types/contactUs.js +5 -0
- package/lib/cjs/types/feedObject.d.ts +17 -0
- package/lib/cjs/types/index.d.ts +4 -2
- package/lib/cjs/types/payment.d.ts +137 -0
- package/lib/cjs/types/payment.js +2 -0
- package/lib/cjs/types/user.d.ts +4 -0
- package/lib/esm/client/index.d.ts +3 -3
- package/lib/esm/client/index.js +3 -3
- package/lib/esm/constants/Endpoints.js +105 -0
- package/lib/esm/index.d.ts +5 -2
- package/lib/esm/index.js +4 -1
- package/lib/esm/services/community/index.d.ts +69 -0
- package/lib/esm/services/community/index.js +69 -0
- package/lib/esm/services/contact_us/index.d.ts +57 -0
- package/lib/esm/services/contact_us/index.js +60 -0
- package/lib/esm/services/custom_menu/index.d.ts +0 -7
- package/lib/esm/services/custom_menu/index.js +0 -12
- package/lib/esm/services/feed_object/index.d.ts +28 -1
- package/lib/esm/services/feed_object/index.js +44 -0
- package/lib/esm/services/payment/index.d.ts +219 -0
- package/lib/esm/services/payment/index.js +213 -0
- package/lib/esm/services/user/index.d.ts +29 -1
- package/lib/esm/services/user/index.js +43 -0
- package/lib/esm/types/contactUs.d.ts +25 -0
- package/lib/esm/types/contactUs.js +4 -0
- package/lib/esm/types/feedObject.d.ts +17 -0
- package/lib/esm/types/index.d.ts +4 -2
- package/lib/esm/types/payment.d.ts +137 -0
- package/lib/esm/types/payment.js +1 -0
- package/lib/esm/types/user.d.ts +4 -0
- package/lib/umd/api-services.js +1 -1
- package/package.json +4 -4
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { CustomAdvParams } from './customAdv';
|
|
|
16
16
|
import { CustomPageParams, CustomPageSearchParams } from './customPage';
|
|
17
17
|
import { EmbedUpdateParams, EmbedSearchParams } from './embed';
|
|
18
18
|
import { BaseGetParams, BaseSearchParams } from './baseParams';
|
|
19
|
-
import { FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch } from './feedObject';
|
|
19
|
+
import { FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, ScheduledFeedObjParams } from './feedObject';
|
|
20
20
|
import { FeedParams } from './feed';
|
|
21
21
|
import { LegalPageFilterParams } from './legalPage';
|
|
22
22
|
import { FeatureParams } from './feature';
|
|
@@ -28,4 +28,6 @@ import { EventCreateParams, EventFeedParams, EventRelatedParams, EventSearchPara
|
|
|
28
28
|
import { LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams } from './liveStream';
|
|
29
29
|
import { StartStepParams, OnBoardingStep } from './onBoarding';
|
|
30
30
|
import { CourseCreateParams, CourseSearchParams, CourseInfoViewType, CourseInfoParams, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams } from './course';
|
|
31
|
-
|
|
31
|
+
import { PaymentContentStatusParams, PaymentContentStatus, PaymentProductsParams, CustomerPortalCreateSessionParams, CheckoutSessionParams, CheckoutCreateSessionParams, PaymentOrderParams } from './payment';
|
|
32
|
+
import { ContactUsRequestParams } from './contactUs';
|
|
33
|
+
export { AccountCreateParams, AccountVerifyParams, AccountRecoverParams, AccountResetParams, AccountSearchParams, SCPaginatedResponse, WebhookParamType, WebhookEventsType, SSOSignUpParams, CommentListParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, ModerateContributionParams, FlaggedContributionParams, CustomNotificationParams, UserGetParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadCompleteParams, ChunkUploadParams, ThreadParams, ThreadDeleteParams, MessageCreateParams, MessageMediaUploadParams, MessageThumbnailUploadParams, MessageChunkUploadDoneParams, MessageMediaChunksParams, CategoryParams, CustomAdvParams, CustomPageParams, CustomPageSearchParams, EmbedUpdateParams, EmbedSearchParams, BaseGetParams, BaseSearchParams, FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, ScheduledFeedObjParams, FeedParams, LegalPageFilterParams, FeatureParams, ScoreParams, InsightContributionParams, InsightUserParams, InsightEmbedParams, InsightCommonParams, ReactionParams, GroupCreateParams, GroupFeedParams, EventCreateParams, EventFeedParams, EventRelatedParams, EventSearchParams, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, StartStepParams, OnBoardingStep, CourseCreateParams, CourseSearchParams, CourseInfoViewType, CourseInfoParams, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams, PaymentContentStatusParams, PaymentContentStatus, PaymentProductsParams, CustomerPortalCreateSessionParams, CheckoutSessionParams, CheckoutCreateSessionParams, PaymentOrderParams, ContactUsRequestParams };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { BaseGetParams, BaseSearchParams } from './baseParams';
|
|
2
|
+
import { SCCheckoutSessionUIMode, SCContentType, SCPaymentOrder, SCPaymentPriceCurrencyType, SCPaywall } from '@selfcommunity/types';
|
|
3
|
+
/**
|
|
4
|
+
* PaymentParams interface.
|
|
5
|
+
*/
|
|
6
|
+
export interface PaymentProductsParams extends BaseGetParams {
|
|
7
|
+
/**
|
|
8
|
+
* Content id
|
|
9
|
+
*/
|
|
10
|
+
id?: number | string;
|
|
11
|
+
/**
|
|
12
|
+
* Content id
|
|
13
|
+
*/
|
|
14
|
+
content_id?: number | string;
|
|
15
|
+
/**
|
|
16
|
+
* Content type
|
|
17
|
+
*/
|
|
18
|
+
content_type?: SCContentType;
|
|
19
|
+
}
|
|
20
|
+
export interface CheckoutCreateSessionParams {
|
|
21
|
+
/**
|
|
22
|
+
* Content id
|
|
23
|
+
*/
|
|
24
|
+
content_id: number;
|
|
25
|
+
/**
|
|
26
|
+
* Content type
|
|
27
|
+
*/
|
|
28
|
+
content_type: SCContentType;
|
|
29
|
+
/**
|
|
30
|
+
* Price id
|
|
31
|
+
*/
|
|
32
|
+
payment_price_id: number;
|
|
33
|
+
/**
|
|
34
|
+
* Return url
|
|
35
|
+
*/
|
|
36
|
+
return_url?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Success url
|
|
39
|
+
*/
|
|
40
|
+
success_url?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Session UI mode
|
|
43
|
+
*/
|
|
44
|
+
ui_mode?: SCCheckoutSessionUIMode;
|
|
45
|
+
}
|
|
46
|
+
export interface CheckoutSessionParams {
|
|
47
|
+
/**
|
|
48
|
+
* Session Id
|
|
49
|
+
*/
|
|
50
|
+
session_id: string;
|
|
51
|
+
}
|
|
52
|
+
export interface CustomerPortalCreateSessionParams {
|
|
53
|
+
/**
|
|
54
|
+
* Return url
|
|
55
|
+
*/
|
|
56
|
+
return_url?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* PaymentContentStatusParams interface.
|
|
60
|
+
*/
|
|
61
|
+
export interface PaymentContentStatusParams extends BaseGetParams {
|
|
62
|
+
/**
|
|
63
|
+
* Content id
|
|
64
|
+
*/
|
|
65
|
+
content_id?: number | string;
|
|
66
|
+
/**
|
|
67
|
+
* Content type
|
|
68
|
+
*/
|
|
69
|
+
content_type?: SCContentType;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* PaymentOrderParams interface.
|
|
73
|
+
*/
|
|
74
|
+
export interface PaymentOrderParams extends BaseSearchParams {
|
|
75
|
+
/**
|
|
76
|
+
* Ordering
|
|
77
|
+
*/
|
|
78
|
+
ordering?: string;
|
|
79
|
+
/**
|
|
80
|
+
* The content type
|
|
81
|
+
*/
|
|
82
|
+
content_type?: SCContentType;
|
|
83
|
+
/**
|
|
84
|
+
* The creation date
|
|
85
|
+
*/
|
|
86
|
+
created_at?: string;
|
|
87
|
+
/**
|
|
88
|
+
* The creation date
|
|
89
|
+
*/
|
|
90
|
+
created_at__gte?: string;
|
|
91
|
+
/**
|
|
92
|
+
* The creation date
|
|
93
|
+
*/
|
|
94
|
+
created_at__lte?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* CreatePaymentProduct interface.
|
|
98
|
+
*/
|
|
99
|
+
export interface CreatePaymentProductParams {
|
|
100
|
+
/**
|
|
101
|
+
* Product name
|
|
102
|
+
*/
|
|
103
|
+
name: string;
|
|
104
|
+
/**
|
|
105
|
+
* Prduct price
|
|
106
|
+
*/
|
|
107
|
+
unit_amount: number;
|
|
108
|
+
/**
|
|
109
|
+
* Description name
|
|
110
|
+
*/
|
|
111
|
+
description?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Price currency
|
|
114
|
+
*/
|
|
115
|
+
currency?: SCPaymentPriceCurrencyType;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* PaymentContentStatus response interface.
|
|
119
|
+
*/
|
|
120
|
+
export interface PaymentContentStatus {
|
|
121
|
+
/**
|
|
122
|
+
* Content id
|
|
123
|
+
*/
|
|
124
|
+
content_id?: number | string;
|
|
125
|
+
/**
|
|
126
|
+
* Content type
|
|
127
|
+
*/
|
|
128
|
+
content_type?: SCContentType;
|
|
129
|
+
/**
|
|
130
|
+
* Payment Order
|
|
131
|
+
*/
|
|
132
|
+
payment_order?: SCPaymentOrder;
|
|
133
|
+
/**
|
|
134
|
+
* Price currency
|
|
135
|
+
*/
|
|
136
|
+
paywalls?: SCPaywall[];
|
|
137
|
+
}
|
package/lib/cjs/types/user.d.ts
CHANGED
|
@@ -27,6 +27,10 @@ export interface UserAutocompleteParams extends BaseSearchParams {
|
|
|
27
27
|
* Ordering fields (eg?: ?ordering=username). Minus char is used for descending ordering, eg. -username
|
|
28
28
|
*/
|
|
29
29
|
ordering?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Filter using the user ids
|
|
32
|
+
*/
|
|
33
|
+
exclude?: string;
|
|
30
34
|
}
|
|
31
35
|
/**
|
|
32
36
|
* UserScoreParams interface.
|
|
@@ -2,17 +2,17 @@ import { AxiosInstance, AxiosResponse } from 'axios';
|
|
|
2
2
|
/**
|
|
3
3
|
* List of all Http methods
|
|
4
4
|
*/
|
|
5
|
-
export type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
5
|
+
export declare 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 type AxiosResponseHeaders = Record<string, string> & {
|
|
9
|
+
export declare type AxiosResponseHeaders = Record<string, string> & {
|
|
10
10
|
'set-cookie'?: string[];
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* General HttpResponse
|
|
14
14
|
*/
|
|
15
|
-
export type HttpResponse<T = unknown, D = any> = AxiosResponse<T, D>;
|
|
15
|
+
export declare 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,9 +6,6 @@ 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({}, (config && config.baseURL && { baseURL: config.baseURL })), { responseType: 'json', headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
|
|
11
|
-
}
|
|
12
9
|
constructor(config) {
|
|
13
10
|
/**
|
|
14
11
|
* Set default header
|
|
@@ -50,6 +47,9 @@ export class ApiClient {
|
|
|
50
47
|
this.client = this.createClient(config);
|
|
51
48
|
this.setDefaultHeader({ name: 'Content-Type', value: 'application/json', methods: ['post'] });
|
|
52
49
|
}
|
|
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
|
*/
|
|
@@ -152,6 +152,22 @@ const Endpoints = {
|
|
|
152
152
|
url: urlReplacer('/api/v2/$(type)/$(id)/flag/'),
|
|
153
153
|
method: 'POST'
|
|
154
154
|
},
|
|
155
|
+
GetScheduledFeedObjects: {
|
|
156
|
+
url: urlReplacer('/api/v2/$(type)/scheduled/'),
|
|
157
|
+
method: 'GET'
|
|
158
|
+
},
|
|
159
|
+
PublishFeedObject: {
|
|
160
|
+
url: urlReplacer('/api/v2/$(type)/$(id)/publish/'),
|
|
161
|
+
method: 'POST'
|
|
162
|
+
},
|
|
163
|
+
GetDraftedFeedObjects: {
|
|
164
|
+
url: urlReplacer('/api/v2/$(type)/drafted/'),
|
|
165
|
+
method: 'GET'
|
|
166
|
+
},
|
|
167
|
+
GetDownloadCSV: {
|
|
168
|
+
url: urlReplacer('/api/v2/$(type)/$(id)/export/'),
|
|
169
|
+
method: 'GET'
|
|
170
|
+
},
|
|
155
171
|
/**
|
|
156
172
|
* Comments
|
|
157
173
|
*/
|
|
@@ -315,6 +331,10 @@ const Endpoints = {
|
|
|
315
331
|
url: urlReplacer('/api/v2/user/'),
|
|
316
332
|
method: 'GET'
|
|
317
333
|
},
|
|
334
|
+
UserMatchUsernames: {
|
|
335
|
+
url: urlReplacer('/api/v2/user/match/'),
|
|
336
|
+
method: 'POST'
|
|
337
|
+
},
|
|
318
338
|
ListHiddenUsers: {
|
|
319
339
|
url: urlReplacer('/api/v2/user/hidden_users/'),
|
|
320
340
|
method: 'GET'
|
|
@@ -519,6 +539,14 @@ const Endpoints = {
|
|
|
519
539
|
url: urlReplacer('/api/v2/user/$(id)/live_stream/'),
|
|
520
540
|
method: 'GET'
|
|
521
541
|
},
|
|
542
|
+
GetOrderHistory: {
|
|
543
|
+
url: urlReplacer('/api/v2/user/$(id)/order/'),
|
|
544
|
+
method: 'GET'
|
|
545
|
+
},
|
|
546
|
+
GetOrderDetail: {
|
|
547
|
+
url: urlReplacer('/api/v2/user/$(id)/order/$(order)/'),
|
|
548
|
+
method: 'GET'
|
|
549
|
+
},
|
|
522
550
|
/**
|
|
523
551
|
* Broadcast Messages
|
|
524
552
|
*/
|
|
@@ -1570,6 +1598,83 @@ const Endpoints = {
|
|
|
1570
1598
|
GetUserJoinedCourses: {
|
|
1571
1599
|
url: urlReplacer('/api/v2/user/$(id)/courses/'),
|
|
1572
1600
|
method: 'GET'
|
|
1601
|
+
},
|
|
1602
|
+
/**
|
|
1603
|
+
* Community
|
|
1604
|
+
*/
|
|
1605
|
+
GetCommunities: {
|
|
1606
|
+
url: urlReplacer('/api/v2/community/'),
|
|
1607
|
+
method: 'GET'
|
|
1608
|
+
},
|
|
1609
|
+
GetCommunity: {
|
|
1610
|
+
url: urlReplacer('/api/v2/community/$(id)/'),
|
|
1611
|
+
method: 'GET'
|
|
1612
|
+
},
|
|
1613
|
+
/**
|
|
1614
|
+
* Payments/Paywalls
|
|
1615
|
+
*/
|
|
1616
|
+
GetPaymentContentStatus: {
|
|
1617
|
+
url: urlReplacer('/api/v2/payments/content_status/'),
|
|
1618
|
+
method: 'GET'
|
|
1619
|
+
},
|
|
1620
|
+
GetPaywalls: {
|
|
1621
|
+
url: urlReplacer('/api/v2/payments/paywall/'),
|
|
1622
|
+
method: 'GET'
|
|
1623
|
+
},
|
|
1624
|
+
GetPaywall: {
|
|
1625
|
+
url: urlReplacer('/api/v2/payments/paywall/$(id)/'),
|
|
1626
|
+
method: 'GET'
|
|
1627
|
+
},
|
|
1628
|
+
GetPaymentProducts: {
|
|
1629
|
+
url: urlReplacer('/api/v2/payments/payment_product/'),
|
|
1630
|
+
method: 'GET'
|
|
1631
|
+
},
|
|
1632
|
+
GetPaymentProduct: {
|
|
1633
|
+
url: urlReplacer('/api/v2/payments/payment_product/$(id)/'),
|
|
1634
|
+
method: 'GET'
|
|
1635
|
+
},
|
|
1636
|
+
GetPaymentProductPrices: {
|
|
1637
|
+
url: urlReplacer('/api/v2/payments/payment_product/$(id)/'),
|
|
1638
|
+
method: 'GET'
|
|
1639
|
+
},
|
|
1640
|
+
GetCheckoutSession: {
|
|
1641
|
+
url: urlReplacer('/api/v2/payments/checkout_session/'),
|
|
1642
|
+
method: 'GET'
|
|
1643
|
+
},
|
|
1644
|
+
CheckoutCreateSession: {
|
|
1645
|
+
url: urlReplacer('/api/v2/payments/checkout_session/'),
|
|
1646
|
+
method: 'POST'
|
|
1647
|
+
},
|
|
1648
|
+
CheckoutSessionComplete: {
|
|
1649
|
+
url: urlReplacer('/api/v2/payments/checkout_session/complete/'),
|
|
1650
|
+
method: 'POST'
|
|
1651
|
+
},
|
|
1652
|
+
GetPaymentOrders: {
|
|
1653
|
+
url: urlReplacer('/api/v2/payments/payment_order/'),
|
|
1654
|
+
method: 'GET'
|
|
1655
|
+
},
|
|
1656
|
+
GetPaymentOrder: {
|
|
1657
|
+
url: urlReplacer('/api/v2/payments/payment_order/$(id)/'),
|
|
1658
|
+
method: 'GET'
|
|
1659
|
+
},
|
|
1660
|
+
GetPaymentOrderPdf: {
|
|
1661
|
+
url: urlReplacer('/api/v2/payments/payment_order/$(id)/pdf/'),
|
|
1662
|
+
method: 'GET'
|
|
1663
|
+
},
|
|
1664
|
+
CreateCustomerPortalSession: {
|
|
1665
|
+
url: urlReplacer('/api/v2/payments/customer_portal_session/'),
|
|
1666
|
+
method: 'POST'
|
|
1667
|
+
},
|
|
1668
|
+
CreatePaymentProduct: {
|
|
1669
|
+
url: urlReplacer('/api/v2/payments/payment_product/price/'),
|
|
1670
|
+
method: 'POST'
|
|
1671
|
+
},
|
|
1672
|
+
/**
|
|
1673
|
+
* Contact-us Endpoints
|
|
1674
|
+
*/
|
|
1675
|
+
ContactRequest: {
|
|
1676
|
+
url: urlReplacer('/api/v2/contact/request/'),
|
|
1677
|
+
method: 'POST'
|
|
1573
1678
|
}
|
|
1574
1679
|
};
|
|
1575
1680
|
export default Endpoints;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -51,11 +51,14 @@ import EventService, { EventApiClient, EventApiClientInterface } from './service
|
|
|
51
51
|
import LiveStreamService, { LiveStreamApiClient, LiveStreamApiClientInterface } from './services/live_stream';
|
|
52
52
|
import OnBoardingService, { OnBoardingApiClient, OnBoardingApiClientInterface } from './services/onboarding';
|
|
53
53
|
import CourseService, { CourseApiClient, CourseApiClientInterface } from './services/course';
|
|
54
|
+
import PaymentService, { PaymentApiClient, PaymentApiClientInterface } from './services/payment';
|
|
55
|
+
import CommunityService, { CommunityApiClient, CommunityApiClientInterface } from './services/community';
|
|
56
|
+
import ContactUsService, { ContactUsApiClient, ContactUsApiClientInterface } from './services/contact_us';
|
|
54
57
|
/**
|
|
55
58
|
* Types
|
|
56
59
|
*/
|
|
57
|
-
import { AccountCreateParams, AccountVerifyParams, AccountResetParams, AccountRecoverParams, AccountSearchParams, SCPaginatedResponse, WebhookParamType, WebhookEventsType, SSOSignUpParams, CommentListParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, ModerateContributionParams, FlaggedContributionParams, CustomNotificationParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadParams, ChunkUploadCompleteParams, ThreadParams, MessageCreateParams, MessageMediaUploadParams, MessageThumbnailUploadParams, MessageChunkUploadDoneParams, MessageMediaChunksParams, CategoryParams, CustomAdvParams, CustomPageParams, CustomPageSearchParams, EmbedUpdateParams, EmbedSearchParams, BaseGetParams, BaseSearchParams, FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, FeedParams, LegalPageFilterParams, FeatureParams, ScoreParams, InsightContributionParams, InsightUserParams, InsightEmbedParams, InsightCommonParams, ReactionParams, GroupCreateParams, GroupFeedParams, EventCreateParams, EventFeedParams, EventSearchParams, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, StartStepParams, OnBoardingStep, CourseCreateParams, CourseSearchParams, CourseInfoViewType, CourseInfoParams, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams } from './types';
|
|
60
|
+
import { AccountCreateParams, AccountVerifyParams, AccountResetParams, AccountRecoverParams, AccountSearchParams, SCPaginatedResponse, WebhookParamType, WebhookEventsType, SSOSignUpParams, CommentListParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, ModerateContributionParams, FlaggedContributionParams, CustomNotificationParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadParams, ChunkUploadCompleteParams, ThreadParams, MessageCreateParams, MessageMediaUploadParams, MessageThumbnailUploadParams, MessageChunkUploadDoneParams, MessageMediaChunksParams, CategoryParams, CustomAdvParams, CustomPageParams, CustomPageSearchParams, EmbedUpdateParams, EmbedSearchParams, BaseGetParams, BaseSearchParams, FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, ScheduledFeedObjParams, FeedParams, LegalPageFilterParams, FeatureParams, ScoreParams, InsightContributionParams, InsightUserParams, InsightEmbedParams, InsightCommonParams, ReactionParams, GroupCreateParams, GroupFeedParams, EventCreateParams, EventFeedParams, EventSearchParams, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, StartStepParams, OnBoardingStep, CourseCreateParams, CourseSearchParams, CourseInfoViewType, CourseInfoParams, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams, PaymentContentStatusParams, PaymentContentStatus, PaymentProductsParams, CustomerPortalCreateSessionParams, CheckoutSessionParams, CheckoutCreateSessionParams, PaymentOrderParams, ContactUsRequestParams } from './types';
|
|
58
61
|
/**
|
|
59
62
|
* Export all
|
|
60
63
|
*/
|
|
61
|
-
export { http, HttpResponse, HttpMethod, apiRequest, formatHttpError, formatHttpErrorCode, getCancelTokenSourceRequest, generateJWTToken, parseJwt, urlParams, Endpoints, EndpointType, AccountService, AccountApiClient, AccountApiClientInterface, PreferenceService, PreferenceApiClient, PreferenceApiClientInterface, UserService, UserApiClient, UserApiClientInterface, FeatureService, FeatureApiClient, FeatureApiClientInterface, CategoryService, CategoryApiClient, CategoryApiClientInterface, CommentService, CommentApiClient, CommentApiClientInterface, CustomAdvService, CustomAdvApiClient, CustomAdvApiClientInterface, CustomMenuService, CustomMenuApiClient, CustomMenuApiClientInterface, CustomPageService, CustomPageApiClient, CustomPageApiClientInterface, DataPortabilityService, DataPortabilityApiClient, DataPortabilityApiClientInterface, EmbedService, EmbedApiClient, EmbedApiClientInterface, FeedService, FeedApiClient, FeedApiClientInterface, FeedObjectService, FeedObjectApiClient, FeedObjectApiClientInterface, IncubatorService, IncubatorApiClient, IncubatorApiClientInterface, InsightService, InsightApiClient, InsightApiClientInterface, InviteService, InviteApiClient, InviteApiClientInterface, LegalPageService, LegalPageApiClient, LegalPageApiClientInterface, LocalityService, LocalityApiClient, LocalityApiClientInterface, LoyaltyService, LoyaltyApiClient, LoyaltyApiClientInterface, MediaService, MediaApiClient, MediaApiClientInterface, ModerationService, ModerationApiClient, ModerationApiClientInterface, NotificationService, NotificationApiClient, NotificationApiClientInterface, PrivateMessageService, PrivateMessageApiClient, PrivateMessageApiClientInterface, PromoService, PromoApiClient, PromoApiClientInterface, ScoreService, ScoreApiClient, ScoreApiClientInterface, SSOService, SSOApiClient, SSOApiClientInterface, SuggestionService, SuggestionApiClient, SuggestionApiClientInterface, TagService, TagApiClient, TagApiClientInterface, WebhookService, WebhookApiClient, WebhookApiClientInterface, SCPaginatedResponse, WebhookParamType, WebhookEventsType, AccountSearchParams, AccountCreateParams, AccountVerifyParams, AccountResetParams, AccountRecoverParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, SSOSignUpParams, CommentListParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, FlaggedContributionParams, ModerateContributionParams, CustomNotificationParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadParams, ChunkUploadCompleteParams, ThreadParams, MessageCreateParams, MessageMediaUploadParams, MessageThumbnailUploadParams, MessageChunkUploadDoneParams, MessageMediaChunksParams, CategoryParams, CustomAdvParams, CustomPageParams, CustomPageSearchParams, EmbedUpdateParams, EmbedSearchParams, BaseGetParams, BaseSearchParams, FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, FeedParams, LegalPageFilterParams, FeatureParams, ScoreParams, InsightContributionParams, InsightUserParams, InsightEmbedParams, InsightCommonParams, ReactionParams, ReactionService, ReactionApiClient, ReactionApiClientInterface, GroupCreateParams, GroupFeedParams, GroupService, GroupApiClient, GroupApiClientInterface, EventCreateParams, EventFeedParams, EventSearchParams, EventService, EventApiClient, EventApiClientInterface, LiveStreamService, LiveStreamApiClient, LiveStreamApiClientInterface, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, OnBoardingService, OnBoardingApiClientInterface, OnBoardingApiClient, StartStepParams, OnBoardingStep, CourseCreateParams, CourseSearchParams, CourseInfoParams, CourseInfoViewType, CourseService, CourseApiClientInterface, CourseApiClient, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams };
|
|
64
|
+
export { http, HttpResponse, HttpMethod, apiRequest, formatHttpError, formatHttpErrorCode, getCancelTokenSourceRequest, generateJWTToken, parseJwt, urlParams, Endpoints, EndpointType, AccountService, AccountApiClient, AccountApiClientInterface, PreferenceService, PreferenceApiClient, PreferenceApiClientInterface, UserService, UserApiClient, UserApiClientInterface, FeatureService, FeatureApiClient, FeatureApiClientInterface, CategoryService, CategoryApiClient, CategoryApiClientInterface, CommentService, CommentApiClient, CommentApiClientInterface, CustomAdvService, CustomAdvApiClient, CustomAdvApiClientInterface, CustomMenuService, CustomMenuApiClient, CustomMenuApiClientInterface, CustomPageService, CustomPageApiClient, CustomPageApiClientInterface, DataPortabilityService, DataPortabilityApiClient, DataPortabilityApiClientInterface, EmbedService, EmbedApiClient, EmbedApiClientInterface, FeedService, FeedApiClient, FeedApiClientInterface, FeedObjectService, FeedObjectApiClient, FeedObjectApiClientInterface, IncubatorService, IncubatorApiClient, IncubatorApiClientInterface, InsightService, InsightApiClient, InsightApiClientInterface, InviteService, InviteApiClient, InviteApiClientInterface, LegalPageService, LegalPageApiClient, LegalPageApiClientInterface, LocalityService, LocalityApiClient, LocalityApiClientInterface, LoyaltyService, LoyaltyApiClient, LoyaltyApiClientInterface, MediaService, MediaApiClient, MediaApiClientInterface, ModerationService, ModerationApiClient, ModerationApiClientInterface, NotificationService, NotificationApiClient, NotificationApiClientInterface, PrivateMessageService, PrivateMessageApiClient, PrivateMessageApiClientInterface, PromoService, PromoApiClient, PromoApiClientInterface, ScoreService, ScoreApiClient, ScoreApiClientInterface, SSOService, SSOApiClient, SSOApiClientInterface, SuggestionService, SuggestionApiClient, SuggestionApiClientInterface, TagService, TagApiClient, TagApiClientInterface, WebhookService, WebhookApiClient, WebhookApiClientInterface, SCPaginatedResponse, WebhookParamType, WebhookEventsType, AccountSearchParams, AccountCreateParams, AccountVerifyParams, AccountResetParams, AccountRecoverParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, SSOSignUpParams, CommentListParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, FlaggedContributionParams, ModerateContributionParams, CustomNotificationParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadParams, ChunkUploadCompleteParams, ThreadParams, MessageCreateParams, MessageMediaUploadParams, MessageThumbnailUploadParams, MessageChunkUploadDoneParams, MessageMediaChunksParams, CategoryParams, CustomAdvParams, CustomPageParams, CustomPageSearchParams, EmbedUpdateParams, EmbedSearchParams, BaseGetParams, BaseSearchParams, FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, ScheduledFeedObjParams, FeedParams, LegalPageFilterParams, FeatureParams, ScoreParams, InsightContributionParams, InsightUserParams, InsightEmbedParams, InsightCommonParams, ReactionParams, ReactionService, ReactionApiClient, ReactionApiClientInterface, GroupCreateParams, GroupFeedParams, GroupService, GroupApiClient, GroupApiClientInterface, EventCreateParams, EventFeedParams, EventSearchParams, EventService, EventApiClient, EventApiClientInterface, LiveStreamService, LiveStreamApiClient, LiveStreamApiClientInterface, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, OnBoardingService, OnBoardingApiClientInterface, OnBoardingApiClient, StartStepParams, OnBoardingStep, CourseCreateParams, CourseSearchParams, CourseInfoParams, CourseInfoViewType, CourseService, CourseApiClientInterface, CourseApiClient, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams, PaymentService, PaymentApiClientInterface, PaymentApiClient, CommunityService, CommunityApiClient, CommunityApiClientInterface, PaymentContentStatusParams, PaymentContentStatus, PaymentProductsParams, CustomerPortalCreateSessionParams, CheckoutSessionParams, CheckoutCreateSessionParams, PaymentOrderParams, ContactUsRequestParams, ContactUsService, ContactUsApiClient, ContactUsApiClientInterface };
|
package/lib/esm/index.js
CHANGED
|
@@ -51,6 +51,9 @@ import EventService, { EventApiClient } from './services/event';
|
|
|
51
51
|
import LiveStreamService, { LiveStreamApiClient } from './services/live_stream';
|
|
52
52
|
import OnBoardingService, { OnBoardingApiClient } from './services/onboarding';
|
|
53
53
|
import CourseService, { CourseApiClient } from './services/course';
|
|
54
|
+
import PaymentService, { PaymentApiClient } from './services/payment';
|
|
55
|
+
import CommunityService, { CommunityApiClient } from './services/community';
|
|
56
|
+
import ContactUsService, { ContactUsApiClient } from './services/contact_us';
|
|
54
57
|
/**
|
|
55
58
|
* Types
|
|
56
59
|
*/
|
|
@@ -58,4 +61,4 @@ import { MediaTypes, OnBoardingStep, CourseInfoViewType } from './types';
|
|
|
58
61
|
/**
|
|
59
62
|
* Export all
|
|
60
63
|
*/
|
|
61
|
-
export { http, apiRequest, formatHttpError, formatHttpErrorCode, getCancelTokenSourceRequest, generateJWTToken, parseJwt, urlParams, Endpoints, AccountService, AccountApiClient, PreferenceService, PreferenceApiClient, UserService, UserApiClient, FeatureService, FeatureApiClient, CategoryService, CategoryApiClient, CommentService, CommentApiClient, CustomAdvService, CustomAdvApiClient, CustomMenuService, CustomMenuApiClient, CustomPageService, CustomPageApiClient, DataPortabilityService, DataPortabilityApiClient, EmbedService, EmbedApiClient, FeedService, FeedApiClient, FeedObjectService, FeedObjectApiClient, IncubatorService, IncubatorApiClient, InsightService, InsightApiClient, InviteService, InviteApiClient, LegalPageService, LegalPageApiClient, LocalityService, LocalityApiClient, LoyaltyService, LoyaltyApiClient, MediaService, MediaApiClient, ModerationService, ModerationApiClient, NotificationService, NotificationApiClient, PrivateMessageService, PrivateMessageApiClient, PromoService, PromoApiClient, ScoreService, ScoreApiClient, SSOService, SSOApiClient, SuggestionService, SuggestionApiClient, TagService, TagApiClient, WebhookService, WebhookApiClient, MediaTypes, ReactionService, ReactionApiClient, GroupService, GroupApiClient, EventService, EventApiClient, LiveStreamService, LiveStreamApiClient, OnBoardingService, OnBoardingApiClient, OnBoardingStep, CourseInfoViewType, CourseService, CourseApiClient };
|
|
64
|
+
export { http, apiRequest, formatHttpError, formatHttpErrorCode, getCancelTokenSourceRequest, generateJWTToken, parseJwt, urlParams, Endpoints, AccountService, AccountApiClient, PreferenceService, PreferenceApiClient, UserService, UserApiClient, FeatureService, FeatureApiClient, CategoryService, CategoryApiClient, CommentService, CommentApiClient, CustomAdvService, CustomAdvApiClient, CustomMenuService, CustomMenuApiClient, CustomPageService, CustomPageApiClient, DataPortabilityService, DataPortabilityApiClient, EmbedService, EmbedApiClient, FeedService, FeedApiClient, FeedObjectService, FeedObjectApiClient, IncubatorService, IncubatorApiClient, InsightService, InsightApiClient, InviteService, InviteApiClient, LegalPageService, LegalPageApiClient, LocalityService, LocalityApiClient, LoyaltyService, LoyaltyApiClient, MediaService, MediaApiClient, ModerationService, ModerationApiClient, NotificationService, NotificationApiClient, PrivateMessageService, PrivateMessageApiClient, PromoService, PromoApiClient, ScoreService, ScoreApiClient, SSOService, SSOApiClient, SuggestionService, SuggestionApiClient, TagService, TagApiClient, WebhookService, WebhookApiClient, MediaTypes, ReactionService, ReactionApiClient, GroupService, GroupApiClient, EventService, EventApiClient, LiveStreamService, LiveStreamApiClient, OnBoardingService, OnBoardingApiClient, OnBoardingStep, CourseInfoViewType, CourseService, CourseApiClient, PaymentService, PaymentApiClient, CommunityService, CommunityApiClient, ContactUsService, ContactUsApiClient };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { BaseGetParams, SCPaginatedResponse } from '../../types';
|
|
3
|
+
import { SCCommunityType } from '@selfcommunity/types';
|
|
4
|
+
export interface CommunityApiClientInterface {
|
|
5
|
+
/**
|
|
6
|
+
* Get list of communities. Used to get the payment products related to the community (aka paywalls)
|
|
7
|
+
* @param params
|
|
8
|
+
* @param config
|
|
9
|
+
*/
|
|
10
|
+
getCommunities(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCommunityType>>;
|
|
11
|
+
/**
|
|
12
|
+
* Get Community
|
|
13
|
+
* @param id
|
|
14
|
+
* @param config
|
|
15
|
+
*/
|
|
16
|
+
getCommunity(id: number | string, config?: AxiosRequestConfig): Promise<SCCommunityType>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Contains all the endpoints needed to manage payments.
|
|
20
|
+
*/
|
|
21
|
+
export declare class CommunityApiClient {
|
|
22
|
+
/**
|
|
23
|
+
* Get list of communities. Used to get the payment products related to the community (aka paywalls)
|
|
24
|
+
* @param params
|
|
25
|
+
* @param config
|
|
26
|
+
*/
|
|
27
|
+
static getCommunities(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCommunityType>>;
|
|
28
|
+
/**
|
|
29
|
+
* Get Community
|
|
30
|
+
* @param id
|
|
31
|
+
* @param config
|
|
32
|
+
*/
|
|
33
|
+
static getCommunity(id: number | string, config?: AxiosRequestConfig): Promise<SCCommunityType>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
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
|
+
* :::
|
|
65
|
+
*/
|
|
66
|
+
export default class CommunityService {
|
|
67
|
+
static getCommunities(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCommunityType>>;
|
|
68
|
+
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCCommunityType>;
|
|
69
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import Endpoints from '../../constants/Endpoints';
|
|
3
|
+
import { apiRequest } from '../../utils/apiRequest';
|
|
4
|
+
import { urlParams } from '../../utils/url';
|
|
5
|
+
/**
|
|
6
|
+
* Contains all the endpoints needed to manage payments.
|
|
7
|
+
*/
|
|
8
|
+
export class CommunityApiClient {
|
|
9
|
+
/**
|
|
10
|
+
* Get list of communities. Used to get the payment products related to the community (aka paywalls)
|
|
11
|
+
* @param params
|
|
12
|
+
* @param config
|
|
13
|
+
*/
|
|
14
|
+
static getCommunities(params, config) {
|
|
15
|
+
const p = urlParams(params);
|
|
16
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetCommunities.url({})}?${p.toString()}`, method: Endpoints.GetCommunities.method }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get Community
|
|
20
|
+
* @param id
|
|
21
|
+
* @param config
|
|
22
|
+
*/
|
|
23
|
+
static getCommunity(id, config) {
|
|
24
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetCommunity.url({ id }), method: Endpoints.GetCommunity.method }));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
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
|
+
* :::
|
|
57
|
+
*/
|
|
58
|
+
export default class CommunityService {
|
|
59
|
+
static getCommunities(params, config) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return CommunityApiClient.getCommunities(params, config);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
static getPaymentProduct(id, config) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
return CommunityApiClient.getCommunity(id, config);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ContactUsRequestParams } from '../../types';
|
|
2
|
+
import { type SCContactUsRequestType } from '@selfcommunity/types';
|
|
3
|
+
import { AxiosRequestConfig } from 'axios';
|
|
4
|
+
export interface ContactUsApiClientInterface {
|
|
5
|
+
request(data?: ContactUsRequestParams, config?: AxiosRequestConfig): Promise<SCContactUsRequestType>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Contains all the endpoints needed to contact-us.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ContactUsApiClient {
|
|
11
|
+
/**
|
|
12
|
+
* This endpoint create an contact request.
|
|
13
|
+
*
|
|
14
|
+
* It requires an authenticated user.
|
|
15
|
+
*
|
|
16
|
+
* @param data
|
|
17
|
+
* @param config
|
|
18
|
+
*/
|
|
19
|
+
static request(data?: ContactUsRequestParams, config?: AxiosRequestConfig): Promise<SCContactUsRequestType>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
:::tip Contact service can be used in the following way:
|
|
24
|
+
```jsx
|
|
25
|
+
1. Import the service from our library:
|
|
26
|
+
|
|
27
|
+
import {ContactService} from "@selfcommunity/api-services";
|
|
28
|
+
```
|
|
29
|
+
```jsx
|
|
30
|
+
2. Create a function and put the service inside it!
|
|
31
|
+
The async function `create` will return the paginated list of categories.
|
|
32
|
+
|
|
33
|
+
async create() {
|
|
34
|
+
return await ContactService.request();
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
```jsx
|
|
38
|
+
In case of required `params`, just add them inside the brackets.
|
|
39
|
+
|
|
40
|
+
async request(data) {
|
|
41
|
+
return await ContactService.request(data);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
```jsx
|
|
45
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
46
|
+
|
|
47
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
48
|
+
|
|
49
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
50
|
+
|
|
51
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
52
|
+
```
|
|
53
|
+
:::
|
|
54
|
+
*/
|
|
55
|
+
export default class ContactUsService {
|
|
56
|
+
static request(data?: ContactUsRequestParams, config?: AxiosRequestConfig): Promise<SCContactUsRequestType>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import Endpoints from '../../constants/Endpoints';
|
|
3
|
+
import { apiRequest } from '../../utils/apiRequest';
|
|
4
|
+
/**
|
|
5
|
+
* Contains all the endpoints needed to contact-us.
|
|
6
|
+
*/
|
|
7
|
+
export class ContactUsApiClient {
|
|
8
|
+
/**
|
|
9
|
+
* This endpoint create an contact request.
|
|
10
|
+
*
|
|
11
|
+
* It requires an authenticated user.
|
|
12
|
+
*
|
|
13
|
+
* @param data
|
|
14
|
+
* @param config
|
|
15
|
+
*/
|
|
16
|
+
static request(data, config) {
|
|
17
|
+
return apiRequest(Object.assign(Object.assign({}, config), { data, url: Endpoints.ContactRequest.url({}), method: Endpoints.ContactRequest.method }));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
:::tip Contact service can be used in the following way:
|
|
23
|
+
```jsx
|
|
24
|
+
1. Import the service from our library:
|
|
25
|
+
|
|
26
|
+
import {ContactService} from "@selfcommunity/api-services";
|
|
27
|
+
```
|
|
28
|
+
```jsx
|
|
29
|
+
2. Create a function and put the service inside it!
|
|
30
|
+
The async function `create` will return the paginated list of categories.
|
|
31
|
+
|
|
32
|
+
async create() {
|
|
33
|
+
return await ContactService.request();
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
```jsx
|
|
37
|
+
In case of required `params`, just add them inside the brackets.
|
|
38
|
+
|
|
39
|
+
async request(data) {
|
|
40
|
+
return await ContactService.request(data);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
```jsx
|
|
44
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
45
|
+
|
|
46
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
47
|
+
|
|
48
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
49
|
+
|
|
50
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
51
|
+
```
|
|
52
|
+
:::
|
|
53
|
+
*/
|
|
54
|
+
export default class ContactUsService {
|
|
55
|
+
static request(data, config) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
return ContactUsApiClient.request(data, config);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|