shred-api-client 1.9.24 → 1.10.0
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/dist/api/Prompt.api.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import Context from "../model/Context";
|
|
2
|
-
import { Prompt, PromptAPISchema } from "../model/Prompt.schema";
|
|
2
|
+
import { Prompt, PromptAPISchema, Script } from "../model/Prompt.schema";
|
|
3
3
|
import Environment from "../model/Env";
|
|
4
4
|
declare class PromptAPI implements PromptAPISchema {
|
|
5
5
|
private env;
|
|
6
6
|
private clientHTTP;
|
|
7
7
|
constructor(env: Environment);
|
|
8
8
|
getPrompt(context: Context): Promise<Prompt>;
|
|
9
|
+
getScripts(context: Context): Promise<Script[]>;
|
|
10
|
+
updateScript(c: Context, id: string, script: Partial<Script>): Promise<boolean>;
|
|
11
|
+
addScript(c: Context, script: Partial<Script>): Promise<Script>;
|
|
12
|
+
deleteScript(c: Context, id: string): Promise<boolean>;
|
|
9
13
|
}
|
|
10
14
|
export default PromptAPI;
|
package/dist/api/Prompt.api.js
CHANGED
|
@@ -15,5 +15,27 @@ class PromptAPI {
|
|
|
15
15
|
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, context);
|
|
16
16
|
return data;
|
|
17
17
|
}
|
|
18
|
+
async getScripts(context) {
|
|
19
|
+
const endpointInfo = Prompt_schema_1.PromptEndpoints.ListScript;
|
|
20
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, context);
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
async updateScript(c, id, script) {
|
|
24
|
+
const endpointData = Prompt_schema_1.PromptEndpoints.UpdateScript;
|
|
25
|
+
const endpoint = endpointData.uri.replace(":id", id);
|
|
26
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpoint, endpointData.method, Object.assign({}, script), c);
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
async addScript(c, script) {
|
|
30
|
+
const endpointInfo = Prompt_schema_1.PromptEndpoints.AddScript;
|
|
31
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, Object.assign({}, script), c);
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
async deleteScript(c, id) {
|
|
35
|
+
const endpointData = Prompt_schema_1.PromptEndpoints.DeleteScript;
|
|
36
|
+
const endpoint = endpointData.uri.replace(":id", id);
|
|
37
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpoint, endpointData.method, null, c);
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
18
40
|
}
|
|
19
41
|
exports.default = PromptAPI;
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import Context from "./Context";
|
|
2
2
|
interface PromptAPISchema {
|
|
3
3
|
getPrompt: (c: Context) => Promise<Prompt>;
|
|
4
|
+
addScript: (c: Context, script: Partial<Script>) => Promise<Script>;
|
|
5
|
+
deleteScript: (c: Context, id: string) => Promise<boolean>;
|
|
6
|
+
getScripts: (c: Context) => Promise<Script[]>;
|
|
7
|
+
updateScript: (c: Context, id: string, script: Partial<Script>) => Promise<boolean>;
|
|
4
8
|
}
|
|
5
9
|
declare const PromptEndpoints: {
|
|
6
10
|
GetPrompt: {
|
|
7
11
|
uri: string;
|
|
8
12
|
method: string;
|
|
9
13
|
};
|
|
14
|
+
AddScript: {
|
|
15
|
+
uri: string;
|
|
16
|
+
method: string;
|
|
17
|
+
};
|
|
18
|
+
DeleteScript: {
|
|
19
|
+
uri: string;
|
|
20
|
+
method: string;
|
|
21
|
+
};
|
|
22
|
+
ListScript: {
|
|
23
|
+
uri: string;
|
|
24
|
+
method: string;
|
|
25
|
+
};
|
|
26
|
+
UpdateScript: {
|
|
27
|
+
uri: string;
|
|
28
|
+
method: string;
|
|
29
|
+
};
|
|
10
30
|
};
|
|
11
31
|
type Script = {
|
|
12
32
|
id: string;
|
|
@@ -6,5 +6,21 @@ const PromptEndpoints = {
|
|
|
6
6
|
uri: "/prompts/getPrompt",
|
|
7
7
|
method: "GET",
|
|
8
8
|
},
|
|
9
|
+
AddScript: {
|
|
10
|
+
uri: "/prompts/script/new/",
|
|
11
|
+
method: "POST",
|
|
12
|
+
},
|
|
13
|
+
DeleteScript: {
|
|
14
|
+
uri: "/prompts/script/:id/delete/",
|
|
15
|
+
method: "DELETE",
|
|
16
|
+
},
|
|
17
|
+
ListScript: {
|
|
18
|
+
uri: "/prompts/script/list/",
|
|
19
|
+
method: "GET",
|
|
20
|
+
},
|
|
21
|
+
UpdateScript: {
|
|
22
|
+
uri: "/prompts/script/:id/update/",
|
|
23
|
+
method: "PUT",
|
|
24
|
+
},
|
|
9
25
|
};
|
|
10
26
|
exports.PromptEndpoints = PromptEndpoints;
|