@great-detail/support-sdk 0.4.4 → 0.4.6

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.
Files changed (102) hide show
  1. package/dist/{chunk-F67NJYPP.js → chunk-HN3EOCB3.js} +1 -1
  2. package/dist/{chunk-23BXD6T5.js → chunk-OXJTX6H4.js} +1 -1
  3. package/dist/cli/index.cjs +1 -1
  4. package/dist/cli/index.d.cts +1 -1
  5. package/dist/cli/index.d.ts +1 -1
  6. package/dist/cli/index.js +1 -1
  7. package/dist/cli.cjs +1 -1
  8. package/dist/cli.js +1 -1
  9. package/dist/{index-CV2Xq9A0.d.cts → index-BLy-LH3e.d.cts} +115 -90
  10. package/dist/{index-CV2Xq9A0.d.ts → index-BLy-LH3e.d.ts} +115 -90
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.cts +2 -2
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +1 -1
  15. package/package.json +2 -3
  16. package/src/Action/ListActions.ts +0 -40
  17. package/src/Action/index.ts +0 -10
  18. package/src/Authentication/KeyAuthentication.ts +0 -50
  19. package/src/Authentication/PublicAuthentication.ts +0 -32
  20. package/src/Authentication/TokenAuthentication.ts +0 -41
  21. package/src/Authentication/index.ts +0 -13
  22. package/src/Boilerplate/CreateBoilerplateCategoryBoilerplate.ts +0 -55
  23. package/src/Boilerplate/GetBoilerplate.ts +0 -41
  24. package/src/Boilerplate/ListBoilerplateCategoryBoilerplates.ts +0 -41
  25. package/src/Boilerplate/ListBoilerplates.ts +0 -37
  26. package/src/Boilerplate/UpdateBoilerplate.ts +0 -53
  27. package/src/Boilerplate/index.ts +0 -14
  28. package/src/BoilerplateCategory/CreateBoilerplateCategory.ts +0 -52
  29. package/src/BoilerplateCategory/GetBoilerplateCategory.ts +0 -40
  30. package/src/BoilerplateCategory/ListBoilerplateCategories.ts +0 -39
  31. package/src/BoilerplateCategory/UpdateBoilerplateCategory.ts +0 -52
  32. package/src/BoilerplateCategory/index.ts +0 -13
  33. package/src/Channel/ListChannels.ts +0 -53
  34. package/src/Channel/index.ts +0 -10
  35. package/src/Client/index.ts +0 -206
  36. package/src/Contact/ContactVCF/GetContactVCF.ts +0 -45
  37. package/src/Contact/CreateContact.ts +0 -51
  38. package/src/Contact/GetContact.ts +0 -41
  39. package/src/Contact/ListContacts.ts +0 -37
  40. package/src/Contact/ListLabelContacts.ts +0 -41
  41. package/src/Contact/UpdateContact.ts +0 -54
  42. package/src/Contact/index.ts +0 -14
  43. package/src/Conversation/CreateConversation.ts +0 -58
  44. package/src/Conversation/GetConversation.ts +0 -45
  45. package/src/Conversation/ListContactConversations.ts +0 -45
  46. package/src/Conversation/ListConversations.ts +0 -41
  47. package/src/Conversation/ListLabelConversations.ts +0 -45
  48. package/src/Conversation/UpdateConversation.ts +0 -64
  49. package/src/Conversation/index.ts +0 -15
  50. package/src/Error/AuthError.ts +0 -12
  51. package/src/Error/AuthenticationError.ts +0 -16
  52. package/src/Error/AuthorizationError.ts +0 -16
  53. package/src/Error/LogicError.ts +0 -20
  54. package/src/Error/NetworkError.ts +0 -12
  55. package/src/Error/SupportError.ts +0 -10
  56. package/src/Error/ValidationError.ts +0 -16
  57. package/src/Error/index.ts +0 -20
  58. package/src/Label/CreateLabel.ts +0 -49
  59. package/src/Label/DeleteLabel.ts +0 -31
  60. package/src/Label/GetLabel.ts +0 -40
  61. package/src/Label/ListLabels.ts +0 -36
  62. package/src/Label/UpdateLabel.ts +0 -52
  63. package/src/Label/index.ts +0 -14
  64. package/src/Message/ListConversationMessages.ts +0 -49
  65. package/src/Message/ListMessages.ts +0 -45
  66. package/src/Message/index.ts +0 -11
  67. package/src/Model/Correction/CreateCorrectionModel.ts +0 -44
  68. package/src/Model/GetModel.ts +0 -39
  69. package/src/Model/ListModels.ts +0 -35
  70. package/src/Model/Response/CreateResponseModel.ts +0 -53
  71. package/src/Model/index.ts +0 -15
  72. package/src/Note/CreateContactNote.ts +0 -49
  73. package/src/Note/CreateConversationNote.ts +0 -49
  74. package/src/Note/GetNote.ts +0 -38
  75. package/src/Note/ListContactNotes.ts +0 -38
  76. package/src/Note/ListConversationNotes.ts +0 -38
  77. package/src/Note/UpdateNote.ts +0 -49
  78. package/src/Note/index.ts +0 -15
  79. package/src/NotificationSubscription/CreateContactNotificationSubscription.ts +0 -57
  80. package/src/NotificationSubscription/index.ts +0 -10
  81. package/src/Request/RequestFilterable.ts +0 -16
  82. package/src/Request/RequestStandardHeaders.ts +0 -32
  83. package/src/Source/GetSource.ts +0 -40
  84. package/src/Source/ListSources.ts +0 -36
  85. package/src/Source/index.ts +0 -11
  86. package/src/Transport/FetchTransport.ts +0 -100
  87. package/src/Transport/index.ts +0 -18
  88. package/src/Webhook/index.ts +0 -55
  89. package/src/__tests__/Client/Client.test.ts +0 -38
  90. package/src/cli/actions.ts +0 -31
  91. package/src/cli/channels.ts +0 -31
  92. package/src/cli/contacts.ts +0 -45
  93. package/src/cli/conversations.ts +0 -48
  94. package/src/cli/index.ts +0 -46
  95. package/src/cli/labels.ts +0 -62
  96. package/src/cli/messages.ts +0 -31
  97. package/src/cli/models.ts +0 -45
  98. package/src/cli/sources.ts +0 -45
  99. package/src/cli.ts +0 -13
  100. package/src/constants/environment.ts +0 -36
  101. package/src/constants/index.ts +0 -31
  102. package/src/index.ts +0 -39
@@ -1,32 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { STANDARD_HEADERS } from "../constants/index.js";
11
- import RequestFilterable from "./RequestFilterable.js";
12
-
13
- export default class RequestStandardHeaders implements RequestFilterable {
14
- public static STANDARD_HEADERS = STANDARD_HEADERS;
15
-
16
- constructor(
17
- protected _standardHeaders: Record<
18
- string,
19
- string
20
- > = RequestStandardHeaders.STANDARD_HEADERS,
21
- ) {}
22
-
23
- public async filter() {
24
- return {
25
- headers: this.getHeaders(),
26
- };
27
- }
28
-
29
- public getHeaders() {
30
- return this._standardHeaders;
31
- }
32
- }
@@ -1,40 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import FetchTransport from "../Transport/FetchTransport.js";
11
-
12
- export interface Options {
13
- id: string;
14
- request?: RequestInit;
15
- }
16
-
17
- export type GetSourceResponse = {
18
- source: {
19
- id: string;
20
- name: string;
21
- category: string;
22
- url?: string;
23
- icon?: string;
24
- disambiguatingDescription: string;
25
- };
26
- };
27
-
28
- export default class GetSource {
29
- constructor(protected _transport: FetchTransport) {}
30
-
31
- public async send({ id, request = {} }: Options) {
32
- return this._transport.send<GetSourceResponse>(
33
- "v1/sources/" + encodeURIComponent(id),
34
- {
35
- ...request,
36
- method: "GET",
37
- },
38
- );
39
- }
40
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import FetchTransport from "../Transport/FetchTransport.js";
11
-
12
- export interface Options {
13
- request?: RequestInit;
14
- }
15
-
16
- export type ListSourcesResponse = {
17
- sources: {
18
- id: string;
19
- name: string;
20
- category: string;
21
- url?: string;
22
- icon?: string;
23
- disambiguatingDescription: string;
24
- }[];
25
- };
26
-
27
- export default class ListSources {
28
- constructor(protected _transport: FetchTransport) {}
29
-
30
- public async send({ request = {} }: Options = {}) {
31
- return this._transport.send<ListSourcesResponse>("v1/sources", {
32
- ...request,
33
- method: "GET",
34
- });
35
- }
36
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- export { type GetSourceResponse } from "./GetSource.js";
11
- export { type ListSourcesResponse } from "./ListSources.js";
@@ -1,100 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import isNetworkError from "is-network-error";
11
- import ky, { HTTPError, KyInstance } from "ky";
12
- import AuthenticationError from "../Error/AuthenticationError.js";
13
- import AuthorizationError from "../Error/AuthorizationError.js";
14
- import LogicError from "../Error/LogicError.js";
15
- import NetworkError from "../Error/NetworkError.js";
16
- import ValidationError from "../Error/ValidationError.js";
17
- import Transport, { Options as TransportOptions } from "./index.js";
18
-
19
- export interface InputOptions extends TransportOptions {
20
- baseURL: string;
21
- }
22
-
23
- export interface Options extends TransportOptions {
24
- baseURL: string;
25
- }
26
-
27
- export default class FetchTransport implements Transport {
28
- public client: KyInstance;
29
- public options: Options;
30
-
31
- constructor({ baseURL, ...options }: InputOptions) {
32
- this.options = {
33
- ...options,
34
- baseURL,
35
- };
36
- this.client = ky.create({
37
- prefixUrl: this.options.baseURL,
38
- hooks: {
39
- beforeRequest: [
40
- (request) => {
41
- for (const filterable of this.options.requestFilterables) {
42
- const filterableHeaders = filterable.getHeaders();
43
- for (const [headerName, headerValue] of Object.entries(
44
- filterableHeaders,
45
- )) {
46
- // Skip explicitly-overwritten headers
47
- if (request.headers.has(headerName)) {
48
- continue;
49
- }
50
-
51
- request.headers.set(headerName, headerValue);
52
- }
53
- }
54
- },
55
- ],
56
- },
57
- });
58
- }
59
-
60
- public getURL(url: string): string {
61
- return new URL(url, this.options.baseURL).toString();
62
- }
63
-
64
- public async send<T = unknown>(url: string, request: RequestInit) {
65
- return await this.client<T>(url, request).catch((error) => {
66
- if (isNetworkError(error)) {
67
- throw new NetworkError("A network error occurred", { cause: error });
68
- }
69
-
70
- if (error instanceof HTTPError) {
71
- const code = error.response.status;
72
- console.error(JSON.stringify(error.response));
73
-
74
- switch (code) {
75
- case 400: {
76
- throw ValidationError.badRequest();
77
- }
78
-
79
- case 401: {
80
- throw AuthenticationError.unauthenticated();
81
- }
82
-
83
- case 403: {
84
- throw AuthorizationError.forbidden();
85
- }
86
-
87
- case 404: {
88
- throw LogicError.notFound(url);
89
- }
90
-
91
- case 405: {
92
- throw LogicError.forbiddenMethod(url, request.method ?? "GET");
93
- }
94
- }
95
- }
96
-
97
- throw error;
98
- });
99
- }
100
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import RequestFilterable from "../Request/RequestFilterable.js";
11
-
12
- export interface Options {
13
- requestFilterables: RequestFilterable[];
14
- }
15
-
16
- export default interface Transport {
17
- getURL(url: string): string;
18
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { z } from "zod";
11
- import Client from "../Client/index.js";
12
-
13
- export type Options = {
14
- request: {
15
- body: unknown;
16
- headers: Record<string, string | string[]>;
17
- [key: string]: unknown | undefined;
18
- };
19
- };
20
-
21
- export type WebhookResponse = z.infer<typeof Webhook.SCHEMA>;
22
-
23
- export default class Webhook {
24
- public static SCHEMA = z.object({
25
- event: z.intersection(
26
- z.object({
27
- id: z.string(),
28
- createdAt: z.string().datetime(),
29
- }),
30
- z.discriminatedUnion("type", [
31
- z.object({
32
- type: z.literal("contact.created"),
33
- contact: z.string(),
34
- }),
35
- z.object({
36
- type: z.literal("message.created"),
37
- message: z.string(),
38
- }),
39
- ]),
40
- ),
41
- });
42
-
43
- constructor(protected _client: Client) {}
44
-
45
- /**
46
- * @deprecated Pre-release Functionality
47
- */
48
- public async event({ request }: Options) {
49
- const { event } = Webhook.SCHEMA.parse(request.body);
50
-
51
- return {
52
- event,
53
- };
54
- }
55
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { describe, expect, test } from "@jest/globals";
11
- import Client from "../../Client/index.js";
12
- import { DEFAULT_SUPPORT_BASE_URL } from "../../constants/index.js";
13
-
14
- describe("Client", () => {
15
- describe("Determining Base URL", () => {
16
- test("When a base URL is set via environment variables, it should be used as the default base URL", () => {
17
- // Arrange
18
- process.env.SUPPORT_BASE_URL = "https://example.com";
19
-
20
- // Act
21
- const baseURL = Client.getBaseURL();
22
-
23
- // Assert
24
- expect(baseURL).toBe(process.env.SUPPORT_BASE_URL);
25
- });
26
-
27
- test("When a base URL is not set via environment, the default should be assumed", () => {
28
- // Arrange
29
- process.env = { SUPPORT_BASE_URL: undefined };
30
-
31
- // Act
32
- const baseURL = Client.getBaseURL();
33
-
34
- // Assert
35
- expect(baseURL).toBe(DEFAULT_SUPPORT_BASE_URL);
36
- });
37
- });
38
- });
@@ -1,31 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { Command } from "commander";
11
- import { oraPromise } from "ora";
12
- import type { Options as CommandOptions } from "./index.js";
13
-
14
- export type Options = CommandOptions;
15
-
16
- export default function actions({ client, ora }: Options) {
17
- const command = new Command("actions").description("Actions");
18
-
19
- command.addCommand(
20
- new Command("list").description("List actions").action(async () => {
21
- const result = await oraPromise(() => client.action.list.send(), {
22
- ...ora,
23
- text: "Finding actions",
24
- });
25
-
26
- console.log(await result.json());
27
- }),
28
- );
29
-
30
- return command;
31
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { Command } from "commander";
11
- import { oraPromise } from "ora";
12
- import type { Options as CommandOptions } from "./index.js";
13
-
14
- export type Options = CommandOptions;
15
-
16
- export default function channels({ client, ora }: Options) {
17
- const command = new Command("channels").description("Channels");
18
-
19
- command.addCommand(
20
- new Command("list").description("List channels").action(async () => {
21
- const result = await oraPromise(() => client.channel.list.send(), {
22
- ...ora,
23
- text: "Finding channels",
24
- });
25
-
26
- console.log(await result.json());
27
- }),
28
- );
29
-
30
- return command;
31
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { Command } from "commander";
11
- import { oraPromise } from "ora";
12
- import type { Options as CommandOptions } from "./index.js";
13
-
14
- export type Options = CommandOptions;
15
-
16
- export default function contacts({ client, ora }: Options) {
17
- const command = new Command("contacts").description("Contacts");
18
-
19
- command.addCommand(
20
- new Command("get")
21
- .description("Find contact")
22
- .argument("<contact>", "Contact ID")
23
- .action(async (id) => {
24
- const result = await oraPromise(() => client.contact.get.send({ id }), {
25
- ...ora,
26
- text: "Finding contact",
27
- });
28
-
29
- console.log(await result.json());
30
- }),
31
- );
32
-
33
- command.addCommand(
34
- new Command("list").description("List contacts").action(async () => {
35
- const result = await oraPromise(() => client.contact.list.send(), {
36
- ...ora,
37
- text: "Finding contacts",
38
- });
39
-
40
- console.log(await result.json());
41
- }),
42
- );
43
-
44
- return command;
45
- }
@@ -1,48 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { Command } from "commander";
11
- import { oraPromise } from "ora";
12
- import type { Options as CommandOptions } from "./index.js";
13
-
14
- export type Options = CommandOptions;
15
-
16
- export default function conversations({ client, ora }: Options) {
17
- const command = new Command("conversations").description("Conversations");
18
-
19
- command.addCommand(
20
- new Command("get")
21
- .description("Find conversation")
22
- .argument("<conversation>", "Conversation ID")
23
- .action(async (id) => {
24
- const result = await oraPromise(
25
- () => client.conversation.get.send({ id }),
26
- {
27
- ...ora,
28
- text: "Finding conversation",
29
- },
30
- );
31
-
32
- console.log(await result.json());
33
- }),
34
- );
35
-
36
- command.addCommand(
37
- new Command("list").description("List conversations").action(async () => {
38
- const result = await oraPromise(() => client.conversation.list.send(), {
39
- ...ora,
40
- text: "Finding conversations",
41
- });
42
-
43
- console.log(await result.json());
44
- }),
45
- );
46
-
47
- return command;
48
- }
package/src/cli/index.ts DELETED
@@ -1,46 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { Command } from "commander";
11
- import PublicAuthentication from "../Authentication/PublicAuthentication.js";
12
- import Client from "../Client/index.js";
13
- import actions from "./actions.js";
14
- import channels from "./channels.js";
15
- import contacts from "./contacts.js";
16
- import conversations from "./conversations.js";
17
- import labels from "./labels.js";
18
- import messages from "./messages.js";
19
- import models from "./models.js";
20
- import sources from "./sources.js";
21
- import type { Options as OraOptions } from "ora";
22
-
23
- export interface Options {
24
- client: Client;
25
- ora: OraOptions;
26
- }
27
-
28
- const options: Options = {
29
- ora: {
30
- spinner: "simpleDotsScrolling",
31
- },
32
- client: new Client(new PublicAuthentication()),
33
- };
34
-
35
- const cli = new Command("gds")
36
- .description("Great Detail Support System")
37
- .addCommand(actions(options))
38
- .addCommand(channels(options))
39
- .addCommand(contacts(options))
40
- .addCommand(conversations(options))
41
- .addCommand(labels(options))
42
- .addCommand(messages(options))
43
- .addCommand(models(options))
44
- .addCommand(sources(options));
45
-
46
- export default cli;
package/src/cli/labels.ts DELETED
@@ -1,62 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { Command } from "commander";
11
- import { oraPromise } from "ora";
12
- import type { Options as CommandOptions } from "./index.js";
13
-
14
- export type Options = CommandOptions;
15
-
16
- export default function labels({ client, ora }: Options) {
17
- const command = new Command("labels").description("Labels");
18
-
19
- command.addCommand(
20
- new Command("get")
21
- .description("Find label")
22
- .argument("<label>", "Label ID")
23
- .action(async (id) => {
24
- const result = await oraPromise(() => client.label.get.send({ id }), {
25
- ...ora,
26
- text: "Finding label",
27
- });
28
-
29
- console.log(await result.json());
30
- }),
31
- );
32
-
33
- command.addCommand(
34
- new Command("list").description("List labels").action(async () => {
35
- const result = await oraPromise(() => client.label.list.send(), {
36
- ...ora,
37
- text: "Finding labels",
38
- });
39
-
40
- console.log(await result.json());
41
- }),
42
- );
43
-
44
- command.addCommand(
45
- new Command("conversations")
46
- .description("Find label conversations")
47
- .argument("<label>", "Label ID")
48
- .action(async (id) => {
49
- const result = await oraPromise(
50
- () => client.label.conversation.list.send({ id }),
51
- {
52
- ...ora,
53
- text: "Finding conversations",
54
- },
55
- );
56
-
57
- console.log(await result.json());
58
- }),
59
- );
60
-
61
- return command;
62
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { Command } from "commander";
11
- import { oraPromise } from "ora";
12
- import type { Options as CommandOptions } from "./index.js";
13
-
14
- export type Options = CommandOptions;
15
-
16
- export default function messages({ client, ora }: Options) {
17
- const command = new Command("messages").description("Messages");
18
-
19
- command.addCommand(
20
- new Command("list").description("List messages").action(async () => {
21
- const result = await oraPromise(() => client.message.list.send(), {
22
- ...ora,
23
- text: "Finding messages",
24
- });
25
-
26
- console.log(await result.json());
27
- }),
28
- );
29
-
30
- return command;
31
- }
package/src/cli/models.ts DELETED
@@ -1,45 +0,0 @@
1
- /**
2
- * Great Detail Support System.
3
- *
4
- * @copyright 2024 Great Detail Ltd
5
- * @author Great Detail Ltd <info@greatdetail.com>
6
- * @author Dom Webber <dom.webber@greatdetail.com>
7
- * @see https://greatdetail.com
8
- */
9
-
10
- import { Command } from "commander";
11
- import { oraPromise } from "ora";
12
- import type { Options as CommandOptions } from "./index.js";
13
-
14
- export type Options = CommandOptions;
15
-
16
- export default function models({ client, ora }: Options) {
17
- const command = new Command("models").description("Models");
18
-
19
- command.addCommand(
20
- new Command("get")
21
- .description("Find model")
22
- .argument("<model>", "Model ID")
23
- .action(async (id) => {
24
- const result = await oraPromise(() => client.model.get.send({ id }), {
25
- ...ora,
26
- text: "Finding model",
27
- });
28
-
29
- console.log(await result.json());
30
- }),
31
- );
32
-
33
- command.addCommand(
34
- new Command("list").description("List models").action(async () => {
35
- const result = await oraPromise(() => client.model.list.send(), {
36
- ...ora,
37
- text: "Finding models",
38
- });
39
-
40
- console.log(await result.json());
41
- }),
42
- );
43
-
44
- return command;
45
- }