@credal/actions 0.1.22 → 0.1.23

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.
@@ -548,7 +548,7 @@ exports.zendeskCreateZendeskTicketDefinition = {
548
548
  scopes: [],
549
549
  parameters: {
550
550
  type: "object",
551
- required: ["subject", "requesterEmail", "subdomain"],
551
+ required: ["subject", "subdomain"],
552
552
  properties: {
553
553
  subject: {
554
554
  type: "string",
@@ -558,10 +558,6 @@ exports.zendeskCreateZendeskTicketDefinition = {
558
558
  type: "string",
559
559
  description: "The body of the ticket",
560
560
  },
561
- requesterEmail: {
562
- type: "string",
563
- description: "The email of the requester",
564
- },
565
561
  subdomain: {
566
562
  type: "string",
567
563
  description: "The subdomain of the Zendesk account",
@@ -591,16 +591,13 @@ export type credalCallCopilotFunction = ActionFunction<credalCallCopilotParamsTy
591
591
  export declare const zendeskCreateZendeskTicketParamsSchema: z.ZodObject<{
592
592
  subject: z.ZodString;
593
593
  body: z.ZodOptional<z.ZodString>;
594
- requesterEmail: z.ZodString;
595
594
  subdomain: z.ZodString;
596
595
  }, "strip", z.ZodTypeAny, {
597
596
  subject: string;
598
- requesterEmail: string;
599
597
  subdomain: string;
600
598
  body?: string | undefined;
601
599
  }, {
602
600
  subject: string;
603
- requesterEmail: string;
604
601
  subdomain: string;
605
602
  body?: string | undefined;
606
603
  }>;
@@ -189,7 +189,6 @@ exports.credalCallCopilotOutputSchema = zod_1.z.object({
189
189
  exports.zendeskCreateZendeskTicketParamsSchema = zod_1.z.object({
190
190
  subject: zod_1.z.string().describe("The subject of the ticket"),
191
191
  body: zod_1.z.string().describe("The body of the ticket").optional(),
192
- requesterEmail: zod_1.z.string().describe("The email of the requester"),
193
192
  subdomain: zod_1.z.string().describe("The subdomain of the Zendesk account"),
194
193
  });
195
194
  exports.zendeskCreateZendeskTicketOutputSchema = zod_1.z.object({
@@ -11,8 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
13
  const createZendeskTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
- const { apiKey } = authParams;
15
- const { subdomain, subject, body, requesterEmail } = params;
14
+ const { apiKey, username } = authParams;
15
+ const { subdomain, subject, body } = params;
16
16
  const url = `https://${subdomain}.zendesk.com/api/v2/tickets.json`;
17
17
  const payload = {
18
18
  ticket: {
@@ -25,21 +25,18 @@ const createZendeskTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({
25
25
  if (!apiKey) {
26
26
  throw new Error("API key is required");
27
27
  }
28
- try {
29
- const response = yield axiosClient_1.axiosClient.post(url, payload, {
30
- auth: {
31
- username: `${requesterEmail}/token`,
32
- password: apiKey,
33
- },
34
- headers: {
35
- "Content-Type": "application/json",
36
- },
37
- });
38
- return response.data;
39
- }
40
- catch (error) {
41
- console.error("Error creating ticket", error);
42
- return { ticketId: "Error" };
43
- }
28
+ const response = yield axiosClient_1.axiosClient.post(url, payload, {
29
+ auth: {
30
+ username: `${username}/token`,
31
+ password: apiKey,
32
+ },
33
+ headers: {
34
+ "Content-Type": "application/json",
35
+ },
36
+ });
37
+ return {
38
+ ticketId: response.data.ticket.id,
39
+ ticketUrl: `https://${subdomain}.zendesk.com/requests/${response.data.ticket.id}`,
40
+ };
44
41
  });
45
42
  exports.default = createZendeskTicket;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "AI Actions by Credal AI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",