shred-api-client 2.0.7 → 2.0.9
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.
|
@@ -9,6 +9,7 @@ declare class ProjectAPI implements Project.IAPI {
|
|
|
9
9
|
permissions: {
|
|
10
10
|
isEligibleForFreeProject: (ctx: Context) => Promise<boolean>;
|
|
11
11
|
};
|
|
12
|
+
getNext(ctx: Context, userId: string): Promise<Project.Entity | null>;
|
|
12
13
|
getUserHistory(context: Context, userId: string): Promise<Core.APIResponse<Project.Entity>>;
|
|
13
14
|
find(context: Context, projectId: string): Promise<Project.Entity>;
|
|
14
15
|
create(context: Context, createData: Project.ProjectCreation): Promise<Project.Entity>;
|
package/dist/api/Project.api.js
CHANGED
|
@@ -41,6 +41,12 @@ class ProjectAPI {
|
|
|
41
41
|
this.env = env;
|
|
42
42
|
this.clientHTTP = new HTTPClient_1.default();
|
|
43
43
|
}
|
|
44
|
+
async getNext(ctx, userId) {
|
|
45
|
+
const endpointData = Project.Endpoints.GetNext;
|
|
46
|
+
const endpoint = endpointData.uri.replace(":userId", userId);
|
|
47
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpoint, endpointData.method, null, ctx);
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
44
50
|
async getUserHistory(context, userId) {
|
|
45
51
|
const endpointData = Project.Endpoints.GetUserHistory;
|
|
46
52
|
const endpoint = endpointData.uri.replace(":userId", userId);
|
|
@@ -13,6 +13,7 @@ export interface IAPI {
|
|
|
13
13
|
deny: (context: Context, projectId: string, denyFeedback: string, categories?: string[]) => Promise<boolean>;
|
|
14
14
|
unschedule: (context: Context, projectId: string) => Promise<boolean>;
|
|
15
15
|
rollback: (context: Context, projectId: string) => Promise<boolean>;
|
|
16
|
+
getNext: (context: Context, userId: string) => Promise<Project | null>;
|
|
16
17
|
getUserHistory: (context: Context, userId: string) => Promise<Core.APIResponse<Project>>;
|
|
17
18
|
permissions: {
|
|
18
19
|
isEligibleForFreeProject(context: Context): Promise<boolean>;
|
|
@@ -23,6 +24,10 @@ export declare const Endpoints: {
|
|
|
23
24
|
uri: string;
|
|
24
25
|
method: string;
|
|
25
26
|
};
|
|
27
|
+
GetNext: {
|
|
28
|
+
uri: string;
|
|
29
|
+
method: string;
|
|
30
|
+
};
|
|
26
31
|
CreateProject: {
|
|
27
32
|
uri: string;
|
|
28
33
|
method: string;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Endpoints = void 0;
|
|
4
4
|
exports.Endpoints = {
|
|
5
5
|
List: { uri: "/projects/list", method: "GET" },
|
|
6
|
+
GetNext: { uri: "/projects/:userId/next", method: "GET" },
|
|
6
7
|
CreateProject: { uri: "/projects/create", method: "POST" },
|
|
7
8
|
FindOne: { uri: `/projects/:projectId/`, method: "GET" },
|
|
8
9
|
GetGoals: { uri: `/projects/goals/list/`, method: "GET" },
|
package/dist/util/HTTPClient.js
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const axios_1 =
|
|
26
|
+
const axios_1 = __importStar(require("axios"));
|
|
7
27
|
const HOSTS = {
|
|
8
28
|
prod: "https://api.shreditapp.com",
|
|
9
29
|
staging: "https://api.staging.shreditapp.com",
|
|
@@ -38,7 +58,7 @@ class HTTPClient {
|
|
|
38
58
|
return response.data;
|
|
39
59
|
}
|
|
40
60
|
catch (error) {
|
|
41
|
-
if (axios_1.
|
|
61
|
+
if ((0, axios_1.isAxiosError)(error)) {
|
|
42
62
|
const axiosError = error;
|
|
43
63
|
throw ((_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.data) || axiosError;
|
|
44
64
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shred-api-client",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "API Client for Shred",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"zod": "^3.24.3"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/node": "^
|
|
24
|
+
"@types/node": "^22.15.19",
|
|
25
25
|
"@types/uuid": "^10.0.0",
|
|
26
26
|
"tscpaths": "^0.0.9",
|
|
27
27
|
"tsup": "^8.0.2",
|