@selfcommunity/api-services 0.3.3-alpha.0 → 0.3.3-alpha.1

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.
@@ -0,0 +1,54 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { SCInviteCodeType } from '@selfcommunity/types';
3
+ export interface InviteCodeApiClientInterface {
4
+ getSpecificInviteCode(invite_code: string, config?: AxiosRequestConfig): Promise<SCInviteCodeType>;
5
+ }
6
+ /**
7
+ * Contains all the endpoints needed to manage invite codes.
8
+ */
9
+ export declare class InviteCodeApiClient {
10
+ /**
11
+ * This endpoint retrieves a specific invite code identified by invite_code.
12
+ * @param invite_code
13
+ * @param config
14
+ */
15
+ static getSpecificInviteCode(invite_code: string, config?: AxiosRequestConfig): Promise<SCInviteCodeType>;
16
+ }
17
+ /**
18
+ *
19
+ :::tip InviteCode service can be used in the following way:
20
+ ```jsx
21
+ 1. Import the service from our library:
22
+
23
+ import {InviteCodeService} from "@selfcommunity/api-services";
24
+ ```
25
+ ```jsx
26
+ 2. Create a function and put the service inside it!
27
+ The async function `create` will return the paginated list of categories.
28
+
29
+ async getSpecificInviteCode() {
30
+ return await InviteCodeService.getSpecificInviteCode();
31
+ }
32
+ ```
33
+ ```jsx
34
+ In case of required `params`, just add them inside the brackets.
35
+
36
+ async create(data) {
37
+ return await InviteCodeService.getSpecificInviteCode(invite_code);
38
+ }
39
+ ```
40
+ ```jsx
41
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
42
+
43
+ 1. Declare it(or declare them, it is possible to add multiple params)
44
+
45
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
46
+
47
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
48
+ ```
49
+ :::
50
+ */
51
+ export default class InviteCodeService {
52
+ static getSpecificInviteCode(invite_code: string, config?: AxiosRequestConfig): Promise<SCInviteCodeType>;
53
+ }
54
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/invite_code/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAC,MAAM,OAAO,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,4BAA4B;IAC3C,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpG;AAED;;GAEG;AACH,qBAAa,mBAAmB;IAC9B;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAG1G;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;WACvB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAGhH"}
@@ -0,0 +1,66 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import Endpoints from '../../constants/Endpoints';
11
+ import { apiRequest } from '../../utils/apiRequest';
12
+ /**
13
+ * Contains all the endpoints needed to manage invite codes.
14
+ */
15
+ export class InviteCodeApiClient {
16
+ /**
17
+ * This endpoint retrieves a specific invite code identified by invite_code.
18
+ * @param invite_code
19
+ * @param config
20
+ */
21
+ static getSpecificInviteCode(invite_code, config) {
22
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.InviteCode.url({ invite_code }), method: Endpoints.User.method }));
23
+ }
24
+ }
25
+ /**
26
+ *
27
+ :::tip InviteCode service can be used in the following way:
28
+ ```jsx
29
+ 1. Import the service from our library:
30
+
31
+ import {InviteCodeService} from "@selfcommunity/api-services";
32
+ ```
33
+ ```jsx
34
+ 2. Create a function and put the service inside it!
35
+ The async function `create` will return the paginated list of categories.
36
+
37
+ async getSpecificInviteCode() {
38
+ return await InviteCodeService.getSpecificInviteCode();
39
+ }
40
+ ```
41
+ ```jsx
42
+ In case of required `params`, just add them inside the brackets.
43
+
44
+ async create(data) {
45
+ return await InviteCodeService.getSpecificInviteCode(invite_code);
46
+ }
47
+ ```
48
+ ```jsx
49
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
50
+
51
+ 1. Declare it(or declare them, it is possible to add multiple params)
52
+
53
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
54
+
55
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
56
+ ```
57
+ :::
58
+ */
59
+ export default class InviteCodeService {
60
+ static getSpecificInviteCode(invite_code, config) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ return InviteCodeApiClient.getSpecificInviteCode(invite_code, config);
63
+ });
64
+ }
65
+ }
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/invite_code/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAQlD;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,WAAmB,EAAE,MAA2B;QAC3E,OAAO,UAAU,iCAAK,MAAM,KAAE,GAAG,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAC,WAAW,EAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,MAAM,IAAE,CAAC;IAC9G,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC,MAAM,CAAO,qBAAqB,CAAC,WAAmB,EAAE,MAA2B;;YACjF,OAAO,mBAAmB,CAAC,qBAAqB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACxE,CAAC;KAAA;CACF"}
@@ -14,6 +14,10 @@ export interface AccountCreateParams {
14
14
  * Password field for the account
15
15
  */
16
16
  password: string;
17
+ /**
18
+ * Optional Invite Code field for confirm invitation
19
+ */
20
+ invite_code?: string;
17
21
  }
18
22
  export interface AccountVerifyParams {
19
23
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/types/account.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/types/account.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}