syllable-sdk 0.1.0-alpha.27 → 0.1.0-alpha.29
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/README.md +22 -0
- package/RUNTIMES.md +27 -1
- package/docs/sdks/dashboards/README.md +309 -0
- package/docs/sdks/tools/README.md +36 -0
- package/docs/sdks/v1/README.md +307 -0
- package/funcs/agentsAgentGetAvailableVoices.js +4 -4
- package/funcs/agentsAgentGetAvailableVoices.js.map +1 -1
- package/funcs/agentsCreate.js +4 -4
- package/funcs/agentsCreate.js.map +1 -1
- package/funcs/agentsDelete.js +4 -4
- package/funcs/agentsDelete.js.map +1 -1
- package/funcs/agentsGetById.js +4 -4
- package/funcs/agentsGetById.js.map +1 -1
- package/funcs/agentsList.js +4 -4
- package/funcs/agentsList.js.map +1 -1
- package/funcs/agentsTestSendTestMessage.js +4 -4
- package/funcs/agentsTestSendTestMessage.js.map +1 -1
- package/funcs/agentsUpdate.js +4 -4
- package/funcs/agentsUpdate.js.map +1 -1
- package/funcs/channelsDelete.js +4 -4
- package/funcs/channelsDelete.js.map +1 -1
- package/funcs/channelsList.js +4 -4
- package/funcs/channelsList.js.map +1 -1
- package/funcs/channelsTargetsAvailableTargets.js +4 -4
- package/funcs/channelsTargetsAvailableTargets.js.map +1 -1
- package/funcs/channelsTargetsCreate.js +4 -4
- package/funcs/channelsTargetsCreate.js.map +1 -1
- package/funcs/channelsTargetsGetById.js +4 -4
- package/funcs/channelsTargetsGetById.js.map +1 -1
- package/funcs/channelsTargetsList.js +4 -4
- package/funcs/channelsTargetsList.js.map +1 -1
- package/funcs/channelsTargetsUpdate.js +4 -4
- package/funcs/channelsTargetsUpdate.js.map +1 -1
- package/funcs/conversationsList.js +4 -4
- package/funcs/conversationsList.js.map +1 -1
- package/funcs/customMessagesCreate.js +4 -4
- package/funcs/customMessagesCreate.js.map +1 -1
- package/funcs/customMessagesDelete.js +4 -4
- package/funcs/customMessagesDelete.js.map +1 -1
- package/funcs/customMessagesGetById.js +4 -4
- package/funcs/customMessagesGetById.js.map +1 -1
- package/funcs/customMessagesList.js +4 -4
- package/funcs/customMessagesList.js.map +1 -1
- package/funcs/customMessagesUpdate.js +4 -4
- package/funcs/customMessagesUpdate.js.map +1 -1
- package/funcs/dashboardsPostSessionEventsDashboard.d.ts +18 -0
- package/funcs/dashboardsPostSessionEventsDashboard.d.ts.map +1 -0
- package/funcs/dashboardsPostSessionEventsDashboard.js +89 -0
- package/funcs/dashboardsPostSessionEventsDashboard.js.map +1 -0
- package/funcs/dashboardsPostSessionSummaryDashboard.d.ts +18 -0
- package/funcs/dashboardsPostSessionSummaryDashboard.d.ts.map +1 -0
- package/funcs/dashboardsPostSessionSummaryDashboard.js +89 -0
- package/funcs/dashboardsPostSessionSummaryDashboard.js.map +1 -0
- package/funcs/dashboardsPostSessionTransfersDashboard.d.ts +18 -0
- package/funcs/dashboardsPostSessionTransfersDashboard.d.ts.map +1 -0
- package/funcs/dashboardsPostSessionTransfersDashboard.js +89 -0
- package/funcs/dashboardsPostSessionTransfersDashboard.js.map +1 -0
- package/funcs/dashboardsPostSessionsDashboard.d.ts +18 -0
- package/funcs/dashboardsPostSessionsDashboard.d.ts.map +1 -0
- package/funcs/dashboardsPostSessionsDashboard.js +89 -0
- package/funcs/dashboardsPostSessionsDashboard.js.map +1 -0
- package/funcs/directoryCreate.js +4 -4
- package/funcs/directoryCreate.js.map +1 -1
- package/funcs/directoryDelete.js +4 -4
- package/funcs/directoryDelete.js.map +1 -1
- package/funcs/directoryDirectoryMemberBulkLoad.js +4 -4
- package/funcs/directoryDirectoryMemberBulkLoad.js.map +1 -1
- package/funcs/directoryDirectoryMemberDownload.js +4 -4
- package/funcs/directoryDirectoryMemberDownload.js.map +1 -1
- package/funcs/directoryGetById.js +4 -4
- package/funcs/directoryGetById.js.map +1 -1
- package/funcs/directoryList.js +4 -4
- package/funcs/directoryList.js.map +1 -1
- package/funcs/directoryUpdate.js +4 -4
- package/funcs/directoryUpdate.js.map +1 -1
- package/funcs/eventsList.js +4 -4
- package/funcs/eventsList.js.map +1 -1
- package/funcs/promptsCreate.js +4 -4
- package/funcs/promptsCreate.js.map +1 -1
- package/funcs/promptsDelete.js +4 -4
- package/funcs/promptsDelete.js.map +1 -1
- package/funcs/promptsGetById.js +4 -4
- package/funcs/promptsGetById.js.map +1 -1
- package/funcs/promptsList.js +4 -4
- package/funcs/promptsList.js.map +1 -1
- package/funcs/promptsPromptsHistory.js +4 -4
- package/funcs/promptsPromptsHistory.js.map +1 -1
- package/funcs/promptsUpdate.js +4 -4
- package/funcs/promptsUpdate.js.map +1 -1
- package/funcs/servicesCreate.js +4 -4
- package/funcs/servicesCreate.js.map +1 -1
- package/funcs/servicesList.js +4 -4
- package/funcs/servicesList.js.map +1 -1
- package/funcs/servicesUpdate.js +4 -4
- package/funcs/servicesUpdate.js.map +1 -1
- package/funcs/sessionLabelsCreate.js +4 -4
- package/funcs/sessionLabelsCreate.js.map +1 -1
- package/funcs/sessionLabelsGetById.js +4 -4
- package/funcs/sessionLabelsGetById.js.map +1 -1
- package/funcs/sessionLabelsList.js +4 -4
- package/funcs/sessionLabelsList.js.map +1 -1
- package/funcs/sessionsGenerateSessionRecordingUrls.js +4 -4
- package/funcs/sessionsGenerateSessionRecordingUrls.js.map +1 -1
- package/funcs/sessionsGetById.js +4 -4
- package/funcs/sessionsGetById.js.map +1 -1
- package/funcs/sessionsList.js +4 -4
- package/funcs/sessionsList.js.map +1 -1
- package/funcs/sessionsSessionRecordingStream.js +4 -4
- package/funcs/sessionsSessionRecordingStream.js.map +1 -1
- package/funcs/sessionsTranscriptGetById.js +4 -4
- package/funcs/sessionsTranscriptGetById.js.map +1 -1
- package/funcs/toolsCreate.js +4 -4
- package/funcs/toolsCreate.js.map +1 -1
- package/funcs/toolsGetByName.js +4 -4
- package/funcs/toolsGetByName.js.map +1 -1
- package/funcs/toolsList.js +4 -4
- package/funcs/toolsList.js.map +1 -1
- package/funcs/toolsUpdate.js +4 -4
- package/funcs/toolsUpdate.js.map +1 -1
- package/funcs/v1PostSessionEventsDashboard.d.ts +18 -0
- package/funcs/v1PostSessionEventsDashboard.d.ts.map +1 -0
- package/funcs/v1PostSessionEventsDashboard.js +89 -0
- package/funcs/v1PostSessionEventsDashboard.js.map +1 -0
- package/funcs/v1PostSessionSummaryDashboard.d.ts +18 -0
- package/funcs/v1PostSessionSummaryDashboard.d.ts.map +1 -0
- package/funcs/v1PostSessionSummaryDashboard.js +89 -0
- package/funcs/v1PostSessionSummaryDashboard.js.map +1 -0
- package/funcs/v1PostSessionTransfersDashboard.d.ts +18 -0
- package/funcs/v1PostSessionTransfersDashboard.d.ts.map +1 -0
- package/funcs/v1PostSessionTransfersDashboard.js +89 -0
- package/funcs/v1PostSessionTransfersDashboard.js.map +1 -0
- package/funcs/v1PostSessionsDashboard.d.ts +18 -0
- package/funcs/v1PostSessionsDashboard.d.ts.map +1 -0
- package/funcs/v1PostSessionsDashboard.js +89 -0
- package/funcs/v1PostSessionsDashboard.js.map +1 -0
- package/lib/config.d.ts +3 -3
- package/lib/config.js +4 -5
- package/lib/config.js.map +1 -1
- package/lib/encodings.js +18 -19
- package/lib/encodings.js.map +1 -1
- package/lib/env.js +1 -2
- package/lib/env.js.map +1 -1
- package/lib/http.js +1 -2
- package/lib/http.js.map +1 -1
- package/lib/matchers.js +5 -6
- package/lib/matchers.js.map +1 -1
- package/lib/primitives.js +1 -1
- package/lib/primitives.js.map +1 -1
- package/lib/retries.js +3 -4
- package/lib/retries.js.map +1 -1
- package/lib/sdks.js +15 -16
- package/lib/sdks.js.map +1 -1
- package/lib/security.js +2 -3
- package/lib/security.js.map +1 -1
- package/lib/url.js +1 -1
- package/lib/url.js.map +1 -1
- package/mintlify/scripts/create-md-script.js +46 -0
- package/mintlify/scripts/generate-mintlify-sdk-docs.js +117 -0
- package/models/components/channel.d.ts +0 -3
- package/models/components/channel.d.ts.map +1 -1
- package/models/components/channel.js.map +1 -1
- package/models/components/channeltarget.d.ts +16 -16
- package/models/components/channeltarget.d.ts.map +1 -1
- package/models/components/channeltarget.js +16 -16
- package/models/components/channeltarget.js.map +1 -1
- package/models/components/channeltargetcreaterequest.d.ts +12 -12
- package/models/components/channeltargetcreaterequest.d.ts.map +1 -1
- package/models/components/channeltargetcreaterequest.js +12 -12
- package/models/components/channeltargetcreaterequest.js.map +1 -1
- package/models/components/channeltargetproperties.d.ts +3 -0
- package/models/components/channeltargetproperties.d.ts.map +1 -1
- package/models/components/channeltargetproperties.js +1 -0
- package/models/components/channeltargetproperties.js.map +1 -1
- package/models/components/channeltargetupdaterequest.d.ts +12 -12
- package/models/components/channeltargetupdaterequest.d.ts.map +1 -1
- package/models/components/channeltargetupdaterequest.js +12 -12
- package/models/components/channeltargetupdaterequest.js.map +1 -1
- package/models/components/dashboard.d.ts +35 -0
- package/models/components/dashboard.d.ts.map +1 -0
- package/models/components/dashboard.js +78 -0
- package/models/components/dashboard.js.map +1 -0
- package/models/components/function.d.ts +74 -0
- package/models/components/function.d.ts.map +1 -0
- package/models/components/function.js +86 -0
- package/models/components/function.js.map +1 -0
- package/models/components/httpendpoint.d.ts +114 -0
- package/models/components/httpendpoint.d.ts.map +1 -0
- package/models/components/httpendpoint.js +119 -0
- package/models/components/httpendpoint.js.map +1 -0
- package/models/components/index.d.ts +9 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +9 -0
- package/models/components/index.js.map +1 -1
- package/models/components/llmconfig.d.ts +3 -34
- package/models/components/llmconfig.d.ts.map +1 -1
- package/models/components/llmconfig.js +4 -26
- package/models/components/llmconfig.js.map +1 -1
- package/models/components/prompt.d.ts +0 -3
- package/models/components/prompt.d.ts.map +1 -1
- package/models/components/prompt.js.map +1 -1
- package/models/components/promptcreate.d.ts +0 -3
- package/models/components/promptcreate.d.ts.map +1 -1
- package/models/components/promptcreate.js.map +1 -1
- package/models/components/promptupdate.d.ts +0 -3
- package/models/components/promptupdate.d.ts.map +1 -1
- package/models/components/promptupdate.js.map +1 -1
- package/models/components/provider.d.ts +34 -0
- package/models/components/provider.d.ts.map +1 -0
- package/models/components/provider.js +54 -0
- package/models/components/provider.js.map +1 -0
- package/models/components/sdkinternaltool.d.ts +46 -0
- package/models/components/sdkinternaltool.d.ts.map +1 -0
- package/models/components/sdkinternaltool.js +62 -0
- package/models/components/sdkinternaltool.js.map +1 -0
- package/models/components/sdktooldefinition.d.ts +161 -0
- package/models/components/sdktooldefinition.d.ts.map +1 -0
- package/models/components/sdktooldefinition.js +175 -0
- package/models/components/sdktooldefinition.js.map +1 -0
- package/models/components/target.d.ts +0 -3
- package/models/components/target.d.ts.map +1 -1
- package/models/components/target.js.map +1 -1
- package/models/components/tool.d.ts +3 -29
- package/models/components/tool.d.ts.map +1 -1
- package/models/components/tool.js +4 -26
- package/models/components/tool.js.map +1 -1
- package/models/components/toolcreate.d.ts +3 -29
- package/models/components/toolcreate.d.ts.map +1 -1
- package/models/components/toolcreate.js +4 -26
- package/models/components/toolcreate.js.map +1 -1
- package/models/components/toolparameterdefault.d.ts +42 -0
- package/models/components/toolparameterdefault.d.ts.map +1 -0
- package/models/components/toolparameterdefault.js +60 -0
- package/models/components/toolparameterdefault.js.map +1 -0
- package/models/components/toolparametertransform.d.ts +92 -0
- package/models/components/toolparametertransform.d.ts.map +1 -0
- package/models/components/toolparametertransform.js +90 -0
- package/models/components/toolparametertransform.js.map +1 -0
- package/models/components/toolparametertransformcondition.d.ts +45 -0
- package/models/components/toolparametertransformcondition.d.ts.map +1 -0
- package/models/components/toolparametertransformcondition.js +63 -0
- package/models/components/toolparametertransformcondition.js.map +1 -0
- package/models/components/toolupdate.d.ts +3 -29
- package/models/components/toolupdate.d.ts.map +1 -1
- package/models/components/toolupdate.js +4 -26
- package/models/components/toolupdate.js.map +1 -1
- package/models/errors/httpclienterrors.js +2 -2
- package/models/errors/httpclienterrors.js.map +1 -1
- package/package.json +1 -1
- package/sdk/agents.js +1 -2
- package/sdk/agents.js.map +1 -1
- package/sdk/channels.js +1 -2
- package/sdk/channels.js.map +1 -1
- package/sdk/dashboards.d.ts +45 -0
- package/sdk/dashboards.d.ts.map +1 -0
- package/sdk/dashboards.js +64 -0
- package/sdk/dashboards.js.map +1 -0
- package/sdk/sdk.d.ts +6 -0
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +19 -22
- package/sdk/sdk.js.map +1 -1
- package/sdk/sessions.js +1 -2
- package/sdk/sessions.js.map +1 -1
- package/sdk/v1.d.ts +45 -0
- package/sdk/v1.d.ts.map +1 -0
- package/sdk/v1.js +64 -0
- package/sdk/v1.js.map +1 -0
- package/src/funcs/dashboardsPostSessionEventsDashboard.ts +111 -0
- package/src/funcs/dashboardsPostSessionSummaryDashboard.ts +111 -0
- package/src/funcs/dashboardsPostSessionTransfersDashboard.ts +111 -0
- package/src/funcs/dashboardsPostSessionsDashboard.ts +111 -0
- package/src/funcs/v1PostSessionEventsDashboard.ts +111 -0
- package/src/funcs/v1PostSessionSummaryDashboard.ts +111 -0
- package/src/funcs/v1PostSessionTransfersDashboard.ts +111 -0
- package/src/funcs/v1PostSessionsDashboard.ts +111 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/security.ts +1 -1
- package/src/models/components/channel.ts +0 -3
- package/src/models/components/channeltarget.ts +32 -32
- package/src/models/components/channeltargetcreaterequest.ts +24 -24
- package/src/models/components/channeltargetproperties.ts +1 -0
- package/src/models/components/channeltargetupdaterequest.ts +24 -24
- package/src/models/components/dashboard.ts +87 -0
- package/src/models/components/function.ts +136 -0
- package/src/models/components/httpendpoint.ts +158 -0
- package/src/models/components/index.ts +9 -0
- package/src/models/components/llmconfig.ts +9 -36
- package/src/models/components/prompt.ts +0 -3
- package/src/models/components/promptcreate.ts +0 -3
- package/src/models/components/promptupdate.ts +0 -3
- package/src/models/components/provider.ts +37 -0
- package/src/models/components/sdkinternaltool.ts +88 -0
- package/src/models/components/sdktooldefinition.ts +298 -0
- package/src/models/components/target.ts +0 -3
- package/src/models/components/tool.ts +10 -56
- package/src/models/components/toolcreate.ts +10 -60
- package/src/models/components/toolparameterdefault.ts +84 -0
- package/src/models/components/toolparametertransform.ts +138 -0
- package/src/models/components/toolparametertransformcondition.ts +88 -0
- package/src/models/components/toolupdate.ts +10 -60
- package/src/sdk/dashboards.ts +85 -0
- package/src/sdk/sdk.ts +12 -0
- package/src/sdk/v1.ts +85 -0
- package/test/sdk/contract/agents.test.ts +113 -0
- package/test/sdk/contract/custommessages.test.ts +109 -0
- package/test/sdk/contract/helper.ts +190 -0
- package/test/sdk/contract/prompts.test.ts +70 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
ToolParameterTransformCondition,
|
|
12
|
+
ToolParameterTransformCondition$inboundSchema,
|
|
13
|
+
ToolParameterTransformCondition$Outbound,
|
|
14
|
+
ToolParameterTransformCondition$outboundSchema,
|
|
15
|
+
} from "./toolparametertransformcondition.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The action to perform on the value: `default` means only set the value (using the `format` field) if the parameter doesn't exist or is empty, `override` means always set the value, and `remove` means remove the parameter value.
|
|
19
|
+
*/
|
|
20
|
+
export const Action = {
|
|
21
|
+
Default: "default",
|
|
22
|
+
Override: "override",
|
|
23
|
+
Remove: "remove",
|
|
24
|
+
} as const;
|
|
25
|
+
/**
|
|
26
|
+
* The action to perform on the value: `default` means only set the value (using the `format` field) if the parameter doesn't exist or is empty, `override` means always set the value, and `remove` means remove the parameter value.
|
|
27
|
+
*/
|
|
28
|
+
export type Action = ClosedEnum<typeof Action>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A transform to be applied to the value of a parameter.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
*
|
|
35
|
+
* Either `value` or `format` must be set:
|
|
36
|
+
* - `value` is any arbitrary value: string, list or dictionary.
|
|
37
|
+
* - `format` is a string composed of other parameters or context variables.
|
|
38
|
+
*/
|
|
39
|
+
export type ToolParameterTransform = {
|
|
40
|
+
/**
|
|
41
|
+
* The action to perform on the value: `default` means only set the value (using the `format` field) if the parameter doesn't exist or is empty, `override` means always set the value, and `remove` means remove the parameter value.
|
|
42
|
+
*/
|
|
43
|
+
action?: Action | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Only apply the transform if the condition is met.
|
|
46
|
+
*/
|
|
47
|
+
when?: ToolParameterTransformCondition | null | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* The default value to use for the parameter.
|
|
50
|
+
*/
|
|
51
|
+
value?: any | null | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* The string value to use for the parameter. The value will be evaluated with the Python `str.format` method, for example, `Hello, {name}!`
|
|
54
|
+
*/
|
|
55
|
+
format?: string | null | undefined;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** @internal */
|
|
59
|
+
export const Action$inboundSchema: z.ZodNativeEnum<typeof Action> = z
|
|
60
|
+
.nativeEnum(Action);
|
|
61
|
+
|
|
62
|
+
/** @internal */
|
|
63
|
+
export const Action$outboundSchema: z.ZodNativeEnum<typeof Action> =
|
|
64
|
+
Action$inboundSchema;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
69
|
+
*/
|
|
70
|
+
export namespace Action$ {
|
|
71
|
+
/** @deprecated use `Action$inboundSchema` instead. */
|
|
72
|
+
export const inboundSchema = Action$inboundSchema;
|
|
73
|
+
/** @deprecated use `Action$outboundSchema` instead. */
|
|
74
|
+
export const outboundSchema = Action$outboundSchema;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** @internal */
|
|
78
|
+
export const ToolParameterTransform$inboundSchema: z.ZodType<
|
|
79
|
+
ToolParameterTransform,
|
|
80
|
+
z.ZodTypeDef,
|
|
81
|
+
unknown
|
|
82
|
+
> = z.object({
|
|
83
|
+
action: Action$inboundSchema.default("default"),
|
|
84
|
+
when: z.nullable(ToolParameterTransformCondition$inboundSchema).optional(),
|
|
85
|
+
value: z.nullable(z.any()).optional(),
|
|
86
|
+
format: z.nullable(z.string()).optional(),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
/** @internal */
|
|
90
|
+
export type ToolParameterTransform$Outbound = {
|
|
91
|
+
action: string;
|
|
92
|
+
when?: ToolParameterTransformCondition$Outbound | null | undefined;
|
|
93
|
+
value?: any | null | undefined;
|
|
94
|
+
format?: string | null | undefined;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** @internal */
|
|
98
|
+
export const ToolParameterTransform$outboundSchema: z.ZodType<
|
|
99
|
+
ToolParameterTransform$Outbound,
|
|
100
|
+
z.ZodTypeDef,
|
|
101
|
+
ToolParameterTransform
|
|
102
|
+
> = z.object({
|
|
103
|
+
action: Action$outboundSchema.default("default"),
|
|
104
|
+
when: z.nullable(ToolParameterTransformCondition$outboundSchema).optional(),
|
|
105
|
+
value: z.nullable(z.any()).optional(),
|
|
106
|
+
format: z.nullable(z.string()).optional(),
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @internal
|
|
111
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
112
|
+
*/
|
|
113
|
+
export namespace ToolParameterTransform$ {
|
|
114
|
+
/** @deprecated use `ToolParameterTransform$inboundSchema` instead. */
|
|
115
|
+
export const inboundSchema = ToolParameterTransform$inboundSchema;
|
|
116
|
+
/** @deprecated use `ToolParameterTransform$outboundSchema` instead. */
|
|
117
|
+
export const outboundSchema = ToolParameterTransform$outboundSchema;
|
|
118
|
+
/** @deprecated use `ToolParameterTransform$Outbound` instead. */
|
|
119
|
+
export type Outbound = ToolParameterTransform$Outbound;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function toolParameterTransformToJSON(
|
|
123
|
+
toolParameterTransform: ToolParameterTransform,
|
|
124
|
+
): string {
|
|
125
|
+
return JSON.stringify(
|
|
126
|
+
ToolParameterTransform$outboundSchema.parse(toolParameterTransform),
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function toolParameterTransformFromJSON(
|
|
131
|
+
jsonString: string,
|
|
132
|
+
): SafeParseResult<ToolParameterTransform, SDKValidationError> {
|
|
133
|
+
return safeParse(
|
|
134
|
+
jsonString,
|
|
135
|
+
(x) => ToolParameterTransform$inboundSchema.parse(JSON.parse(x)),
|
|
136
|
+
`Failed to parse 'ToolParameterTransform' from JSON`,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A condition to be met for a transform to be applied to the value of a parameter.
|
|
12
|
+
*/
|
|
13
|
+
export type ToolParameterTransformCondition = {
|
|
14
|
+
/**
|
|
15
|
+
* The name of the parameter to check.
|
|
16
|
+
*/
|
|
17
|
+
key: string;
|
|
18
|
+
/**
|
|
19
|
+
* The value to check against the parameter.
|
|
20
|
+
*/
|
|
21
|
+
value: string;
|
|
22
|
+
/**
|
|
23
|
+
* The operator to use for the comparison.
|
|
24
|
+
*/
|
|
25
|
+
operator?: "eq" | null | undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const ToolParameterTransformCondition$inboundSchema: z.ZodType<
|
|
30
|
+
ToolParameterTransformCondition,
|
|
31
|
+
z.ZodTypeDef,
|
|
32
|
+
unknown
|
|
33
|
+
> = z.object({
|
|
34
|
+
key: z.string(),
|
|
35
|
+
value: z.string(),
|
|
36
|
+
operator: z.nullable(z.literal("eq")).optional(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export type ToolParameterTransformCondition$Outbound = {
|
|
41
|
+
key: string;
|
|
42
|
+
value: string;
|
|
43
|
+
operator: "eq" | null;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
export const ToolParameterTransformCondition$outboundSchema: z.ZodType<
|
|
48
|
+
ToolParameterTransformCondition$Outbound,
|
|
49
|
+
z.ZodTypeDef,
|
|
50
|
+
ToolParameterTransformCondition
|
|
51
|
+
> = z.object({
|
|
52
|
+
key: z.string(),
|
|
53
|
+
value: z.string(),
|
|
54
|
+
operator: z.nullable(z.literal("eq").default("eq" as const)),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
60
|
+
*/
|
|
61
|
+
export namespace ToolParameterTransformCondition$ {
|
|
62
|
+
/** @deprecated use `ToolParameterTransformCondition$inboundSchema` instead. */
|
|
63
|
+
export const inboundSchema = ToolParameterTransformCondition$inboundSchema;
|
|
64
|
+
/** @deprecated use `ToolParameterTransformCondition$outboundSchema` instead. */
|
|
65
|
+
export const outboundSchema = ToolParameterTransformCondition$outboundSchema;
|
|
66
|
+
/** @deprecated use `ToolParameterTransformCondition$Outbound` instead. */
|
|
67
|
+
export type Outbound = ToolParameterTransformCondition$Outbound;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function toolParameterTransformConditionToJSON(
|
|
71
|
+
toolParameterTransformCondition: ToolParameterTransformCondition,
|
|
72
|
+
): string {
|
|
73
|
+
return JSON.stringify(
|
|
74
|
+
ToolParameterTransformCondition$outboundSchema.parse(
|
|
75
|
+
toolParameterTransformCondition,
|
|
76
|
+
),
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function toolParameterTransformConditionFromJSON(
|
|
81
|
+
jsonString: string,
|
|
82
|
+
): SafeParseResult<ToolParameterTransformCondition, SDKValidationError> {
|
|
83
|
+
return safeParse(
|
|
84
|
+
jsonString,
|
|
85
|
+
(x) => ToolParameterTransformCondition$inboundSchema.parse(JSON.parse(x)),
|
|
86
|
+
`Failed to parse 'ToolParameterTransformCondition' from JSON`,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -7,21 +7,19 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
import {
|
|
11
|
+
SDKToolDefinition,
|
|
12
|
+
SDKToolDefinition$inboundSchema,
|
|
13
|
+
SDKToolDefinition$Outbound,
|
|
14
|
+
SDKToolDefinition$outboundSchema,
|
|
15
|
+
} from "./sdktooldefinition.js";
|
|
15
16
|
|
|
16
17
|
export type ToolUpdate = {
|
|
17
18
|
/**
|
|
18
19
|
* The name of the tool
|
|
19
20
|
*/
|
|
20
21
|
name: string;
|
|
21
|
-
|
|
22
|
-
* The definition of the tool
|
|
23
|
-
*/
|
|
24
|
-
definition?: ToolUpdateDefinition | undefined;
|
|
22
|
+
definition: SDKToolDefinition;
|
|
25
23
|
/**
|
|
26
24
|
* The service this tool belongs to
|
|
27
25
|
*/
|
|
@@ -32,54 +30,6 @@ export type ToolUpdate = {
|
|
|
32
30
|
id: number;
|
|
33
31
|
};
|
|
34
32
|
|
|
35
|
-
/** @internal */
|
|
36
|
-
export const ToolUpdateDefinition$inboundSchema: z.ZodType<
|
|
37
|
-
ToolUpdateDefinition,
|
|
38
|
-
z.ZodTypeDef,
|
|
39
|
-
unknown
|
|
40
|
-
> = z.object({});
|
|
41
|
-
|
|
42
|
-
/** @internal */
|
|
43
|
-
export type ToolUpdateDefinition$Outbound = {};
|
|
44
|
-
|
|
45
|
-
/** @internal */
|
|
46
|
-
export const ToolUpdateDefinition$outboundSchema: z.ZodType<
|
|
47
|
-
ToolUpdateDefinition$Outbound,
|
|
48
|
-
z.ZodTypeDef,
|
|
49
|
-
ToolUpdateDefinition
|
|
50
|
-
> = z.object({});
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @internal
|
|
54
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
55
|
-
*/
|
|
56
|
-
export namespace ToolUpdateDefinition$ {
|
|
57
|
-
/** @deprecated use `ToolUpdateDefinition$inboundSchema` instead. */
|
|
58
|
-
export const inboundSchema = ToolUpdateDefinition$inboundSchema;
|
|
59
|
-
/** @deprecated use `ToolUpdateDefinition$outboundSchema` instead. */
|
|
60
|
-
export const outboundSchema = ToolUpdateDefinition$outboundSchema;
|
|
61
|
-
/** @deprecated use `ToolUpdateDefinition$Outbound` instead. */
|
|
62
|
-
export type Outbound = ToolUpdateDefinition$Outbound;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function toolUpdateDefinitionToJSON(
|
|
66
|
-
toolUpdateDefinition: ToolUpdateDefinition,
|
|
67
|
-
): string {
|
|
68
|
-
return JSON.stringify(
|
|
69
|
-
ToolUpdateDefinition$outboundSchema.parse(toolUpdateDefinition),
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function toolUpdateDefinitionFromJSON(
|
|
74
|
-
jsonString: string,
|
|
75
|
-
): SafeParseResult<ToolUpdateDefinition, SDKValidationError> {
|
|
76
|
-
return safeParse(
|
|
77
|
-
jsonString,
|
|
78
|
-
(x) => ToolUpdateDefinition$inboundSchema.parse(JSON.parse(x)),
|
|
79
|
-
`Failed to parse 'ToolUpdateDefinition' from JSON`,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
33
|
/** @internal */
|
|
84
34
|
export const ToolUpdate$inboundSchema: z.ZodType<
|
|
85
35
|
ToolUpdate,
|
|
@@ -87,7 +37,7 @@ export const ToolUpdate$inboundSchema: z.ZodType<
|
|
|
87
37
|
unknown
|
|
88
38
|
> = z.object({
|
|
89
39
|
name: z.string(),
|
|
90
|
-
definition:
|
|
40
|
+
definition: SDKToolDefinition$inboundSchema,
|
|
91
41
|
service_id: z.number().int(),
|
|
92
42
|
id: z.number().int(),
|
|
93
43
|
}).transform((v) => {
|
|
@@ -99,7 +49,7 @@ export const ToolUpdate$inboundSchema: z.ZodType<
|
|
|
99
49
|
/** @internal */
|
|
100
50
|
export type ToolUpdate$Outbound = {
|
|
101
51
|
name: string;
|
|
102
|
-
definition
|
|
52
|
+
definition: SDKToolDefinition$Outbound;
|
|
103
53
|
service_id: number;
|
|
104
54
|
id: number;
|
|
105
55
|
};
|
|
@@ -111,7 +61,7 @@ export const ToolUpdate$outboundSchema: z.ZodType<
|
|
|
111
61
|
ToolUpdate
|
|
112
62
|
> = z.object({
|
|
113
63
|
name: z.string(),
|
|
114
|
-
definition:
|
|
64
|
+
definition: SDKToolDefinition$outboundSchema,
|
|
115
65
|
serviceId: z.number().int(),
|
|
116
66
|
id: z.number().int(),
|
|
117
67
|
}).transform((v) => {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { dashboardsPostSessionEventsDashboard } from "../funcs/dashboardsPostSessionEventsDashboard.js";
|
|
6
|
+
import { dashboardsPostSessionsDashboard } from "../funcs/dashboardsPostSessionsDashboard.js";
|
|
7
|
+
import { dashboardsPostSessionSummaryDashboard } from "../funcs/dashboardsPostSessionSummaryDashboard.js";
|
|
8
|
+
import { dashboardsPostSessionTransfersDashboard } from "../funcs/dashboardsPostSessionTransfersDashboard.js";
|
|
9
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
10
|
+
import * as components from "../models/components/index.js";
|
|
11
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
12
|
+
|
|
13
|
+
export class Dashboards extends ClientSDK {
|
|
14
|
+
/**
|
|
15
|
+
* Post Session Events
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* METHOD: POST
|
|
19
|
+
* URL: /dashboard/session_events
|
|
20
|
+
* ARGUMENTS: None
|
|
21
|
+
* RETURNS: Dashboard info for embedding
|
|
22
|
+
*/
|
|
23
|
+
async postSessionEventsDashboard(
|
|
24
|
+
options?: RequestOptions,
|
|
25
|
+
): Promise<components.Dashboard> {
|
|
26
|
+
return unwrapAsync(dashboardsPostSessionEventsDashboard(
|
|
27
|
+
this,
|
|
28
|
+
options,
|
|
29
|
+
));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Post Session Summary
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* METHOD: POST
|
|
37
|
+
* URL: /dashboard/session_summary
|
|
38
|
+
* ARGUMENTS: None
|
|
39
|
+
* RETURNS: Dashboard info for embedding
|
|
40
|
+
*/
|
|
41
|
+
async postSessionSummaryDashboard(
|
|
42
|
+
options?: RequestOptions,
|
|
43
|
+
): Promise<components.Dashboard> {
|
|
44
|
+
return unwrapAsync(dashboardsPostSessionSummaryDashboard(
|
|
45
|
+
this,
|
|
46
|
+
options,
|
|
47
|
+
));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Post Session Transfers
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* METHOD: POST
|
|
55
|
+
* URL: /dashboard/session_transfers
|
|
56
|
+
* ARGUMENTS: None
|
|
57
|
+
* RETURNS: Dashboard info for embedding
|
|
58
|
+
*/
|
|
59
|
+
async postSessionTransfersDashboard(
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): Promise<components.Dashboard> {
|
|
62
|
+
return unwrapAsync(dashboardsPostSessionTransfersDashboard(
|
|
63
|
+
this,
|
|
64
|
+
options,
|
|
65
|
+
));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Post Sessions
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* METHOD: POST
|
|
73
|
+
* URL: /dashboard/sessions
|
|
74
|
+
* ARGUMENTS: None
|
|
75
|
+
* RETURNS: Dashboard info for embedding
|
|
76
|
+
*/
|
|
77
|
+
async postSessionsDashboard(
|
|
78
|
+
options?: RequestOptions,
|
|
79
|
+
): Promise<components.Dashboard> {
|
|
80
|
+
return unwrapAsync(dashboardsPostSessionsDashboard(
|
|
81
|
+
this,
|
|
82
|
+
options,
|
|
83
|
+
));
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Agents } from "./agents.js";
|
|
|
7
7
|
import { Channels } from "./channels.js";
|
|
8
8
|
import { Conversations } from "./conversations.js";
|
|
9
9
|
import { CustomMessages } from "./custommessages.js";
|
|
10
|
+
import { Dashboards } from "./dashboards.js";
|
|
10
11
|
import { Directory } from "./directory.js";
|
|
11
12
|
import { Events } from "./events.js";
|
|
12
13
|
import { Prompts } from "./prompts.js";
|
|
@@ -14,6 +15,7 @@ import { Services } from "./services.js";
|
|
|
14
15
|
import { SessionLabels } from "./sessionlabels.js";
|
|
15
16
|
import { Sessions } from "./sessions.js";
|
|
16
17
|
import { Tools } from "./tools.js";
|
|
18
|
+
import { V1 } from "./v1.js";
|
|
17
19
|
|
|
18
20
|
export class SyllableSDK extends ClientSDK {
|
|
19
21
|
private _agents?: Agents;
|
|
@@ -70,4 +72,14 @@ export class SyllableSDK extends ClientSDK {
|
|
|
70
72
|
get directory(): Directory {
|
|
71
73
|
return (this._directory ??= new Directory(this._options));
|
|
72
74
|
}
|
|
75
|
+
|
|
76
|
+
private _dashboards?: Dashboards;
|
|
77
|
+
get dashboards(): Dashboards {
|
|
78
|
+
return (this._dashboards ??= new Dashboards(this._options));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private _v1?: V1;
|
|
82
|
+
get v1(): V1 {
|
|
83
|
+
return (this._v1 ??= new V1(this._options));
|
|
84
|
+
}
|
|
73
85
|
}
|
package/src/sdk/v1.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { v1PostSessionEventsDashboard } from "../funcs/v1PostSessionEventsDashboard.js";
|
|
6
|
+
import { v1PostSessionsDashboard } from "../funcs/v1PostSessionsDashboard.js";
|
|
7
|
+
import { v1PostSessionSummaryDashboard } from "../funcs/v1PostSessionSummaryDashboard.js";
|
|
8
|
+
import { v1PostSessionTransfersDashboard } from "../funcs/v1PostSessionTransfersDashboard.js";
|
|
9
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
10
|
+
import * as components from "../models/components/index.js";
|
|
11
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
12
|
+
|
|
13
|
+
export class V1 extends ClientSDK {
|
|
14
|
+
/**
|
|
15
|
+
* Post Session Events
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* METHOD: POST
|
|
19
|
+
* URL: /dashboard/session_events
|
|
20
|
+
* ARGUMENTS: None
|
|
21
|
+
* RETURNS: Dashboard info for embedding
|
|
22
|
+
*/
|
|
23
|
+
async postSessionEventsDashboard(
|
|
24
|
+
options?: RequestOptions,
|
|
25
|
+
): Promise<components.Dashboard> {
|
|
26
|
+
return unwrapAsync(v1PostSessionEventsDashboard(
|
|
27
|
+
this,
|
|
28
|
+
options,
|
|
29
|
+
));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Post Session Summary
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* METHOD: POST
|
|
37
|
+
* URL: /dashboard/session_summary
|
|
38
|
+
* ARGUMENTS: None
|
|
39
|
+
* RETURNS: Dashboard info for embedding
|
|
40
|
+
*/
|
|
41
|
+
async postSessionSummaryDashboard(
|
|
42
|
+
options?: RequestOptions,
|
|
43
|
+
): Promise<components.Dashboard> {
|
|
44
|
+
return unwrapAsync(v1PostSessionSummaryDashboard(
|
|
45
|
+
this,
|
|
46
|
+
options,
|
|
47
|
+
));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Post Session Transfers
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* METHOD: POST
|
|
55
|
+
* URL: /dashboard/session_transfers
|
|
56
|
+
* ARGUMENTS: None
|
|
57
|
+
* RETURNS: Dashboard info for embedding
|
|
58
|
+
*/
|
|
59
|
+
async postSessionTransfersDashboard(
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): Promise<components.Dashboard> {
|
|
62
|
+
return unwrapAsync(v1PostSessionTransfersDashboard(
|
|
63
|
+
this,
|
|
64
|
+
options,
|
|
65
|
+
));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Post Sessions
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* METHOD: POST
|
|
73
|
+
* URL: /dashboard/sessions
|
|
74
|
+
* ARGUMENTS: None
|
|
75
|
+
* RETURNS: Dashboard info for embedding
|
|
76
|
+
*/
|
|
77
|
+
async postSessionsDashboard(
|
|
78
|
+
options?: RequestOptions,
|
|
79
|
+
): Promise<components.Dashboard> {
|
|
80
|
+
return unwrapAsync(v1PostSessionsDashboard(
|
|
81
|
+
this,
|
|
82
|
+
options,
|
|
83
|
+
));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { beforeAll, describe, it, expect, afterAll } from "vitest";
|
|
2
|
+
import { getSDK, generateFake } from "./helper";
|
|
3
|
+
|
|
4
|
+
let sdk
|
|
5
|
+
let createdAgents = []
|
|
6
|
+
beforeAll(async () => {
|
|
7
|
+
sdk = await getSDK()
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
afterAll(async () => {
|
|
11
|
+
for (const agent of createdAgents) {
|
|
12
|
+
const result = await sdk.agents.delete({
|
|
13
|
+
agentId: agent.id,
|
|
14
|
+
reason: 'was a created by a test'
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
for (const agent of createdAgents) {
|
|
18
|
+
const promptResult = await sdk.prompts.delete({
|
|
19
|
+
promptId: agent.promptId,
|
|
20
|
+
reason: 'was a created by a test'
|
|
21
|
+
})
|
|
22
|
+
const customMessageResult = await sdk.customMessages.delete({
|
|
23
|
+
customMessageId: agent.customMessageId,
|
|
24
|
+
reason: 'was a created by a test'
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
describe('Syllable SDK Contract test suite', () => {
|
|
30
|
+
describe('agents', () => {
|
|
31
|
+
describe('create', () => {
|
|
32
|
+
it('should create a agent', async() => {
|
|
33
|
+
const prompt = generateFake('prompt');
|
|
34
|
+
const promptResult = await sdk.prompts.create(prompt);
|
|
35
|
+
const message = generateFake('customMessage');
|
|
36
|
+
delete message.rules[0].daysOfWeek
|
|
37
|
+
message.rules[0].date = new Date().toJSON().slice(0, 10);
|
|
38
|
+
const messageResult = await sdk.customMessages.create(message);
|
|
39
|
+
const agent = generateFake('agent');
|
|
40
|
+
agent.promptId = promptResult.id
|
|
41
|
+
agent.customMessageId = messageResult.id
|
|
42
|
+
const result = await sdk.agents.create(agent);
|
|
43
|
+
createdAgents.push(result)
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
describe('list', () => {
|
|
47
|
+
it('should list a newly created agent', async() => {
|
|
48
|
+
const prompt = generateFake('prompt');
|
|
49
|
+
const promptResult = await sdk.prompts.create(prompt);
|
|
50
|
+
const message = generateFake('customMessage');
|
|
51
|
+
delete message.rules[0].daysOfWeek
|
|
52
|
+
message.rules[0].date = new Date().toJSON().slice(0, 10);
|
|
53
|
+
const messageResult = await sdk.customMessages.create(message);
|
|
54
|
+
const agent = generateFake('agent');
|
|
55
|
+
agent.promptId = promptResult.id
|
|
56
|
+
agent.customMessageId = messageResult.id
|
|
57
|
+
const result = await sdk.agents.create(agent);
|
|
58
|
+
createdAgents.push(result)
|
|
59
|
+
const listResult = await sdk.agents.list({});
|
|
60
|
+
const isFound = listResult.items.some((cm) => {
|
|
61
|
+
return cm.name === agent.name
|
|
62
|
+
})
|
|
63
|
+
if (!isFound) {
|
|
64
|
+
throw new Error('agent that was just created is not listed')
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
describe('update', () => {
|
|
69
|
+
it('should update a newly created agent', async() => {
|
|
70
|
+
const prompt = generateFake('prompt');
|
|
71
|
+
const promptResult = await sdk.prompts.create(prompt);
|
|
72
|
+
const message = generateFake('customMessage');
|
|
73
|
+
delete message.rules[0].daysOfWeek
|
|
74
|
+
message.rules[0].date = new Date().toJSON().slice(0, 10);
|
|
75
|
+
const messageResult = await sdk.customMessages.create(message);
|
|
76
|
+
const agent = generateFake('agent');
|
|
77
|
+
agent.promptId = promptResult.id
|
|
78
|
+
agent.customMessageId = messageResult.id
|
|
79
|
+
const result = await sdk.agents.create(agent);
|
|
80
|
+
createdAgents.push(result)
|
|
81
|
+
agent.id = result.id
|
|
82
|
+
agent.description = 'new description'
|
|
83
|
+
const updateResult = await sdk.agents.update(agent);
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
describe('delete', () => {
|
|
87
|
+
it('should delete a newly created agent', async() => {
|
|
88
|
+
const prompt = generateFake('prompt');
|
|
89
|
+
const promptResult = await sdk.prompts.create(prompt);
|
|
90
|
+
const message = generateFake('customMessage');
|
|
91
|
+
delete message.rules[0].daysOfWeek
|
|
92
|
+
message.rules[0].date = new Date().toJSON().slice(0, 10);
|
|
93
|
+
const messageResult = await sdk.customMessages.create(message);
|
|
94
|
+
const agent = generateFake('agent');
|
|
95
|
+
agent.promptId = promptResult.id
|
|
96
|
+
agent.customMessageId = messageResult.id
|
|
97
|
+
const result = await sdk.agents.create(agent);
|
|
98
|
+
const deleteResult = await sdk.agents.delete({
|
|
99
|
+
agentId: result.id,
|
|
100
|
+
reason: 'created by a test'
|
|
101
|
+
})
|
|
102
|
+
await sdk.prompts.delete({
|
|
103
|
+
promptId: agent.promptId,
|
|
104
|
+
reason: 'was a created by a test'
|
|
105
|
+
})
|
|
106
|
+
await sdk.customMessages.delete({
|
|
107
|
+
customMessageId: agent.customMessageId,
|
|
108
|
+
reason: 'was a created by a test'
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
})
|