@japro/luma-sdk 0.1.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.
@@ -0,0 +1,349 @@
1
+ import { AxiosInstance, AxiosRequestConfig, ResponseType, AxiosResponse } from 'axios';
2
+ import { Agent } from 'node:https';
3
+
4
+ /** ArchitectAiMentorLesson */
5
+ interface ArchitectAiMentorLesson {
6
+ /** Name */
7
+ name: string;
8
+ /** Aimentorinstructions */
9
+ aiMentorInstructions: string;
10
+ /** Completionconditions */
11
+ completionConditions: string;
12
+ /** Type */
13
+ type: "ROLEPLAY" | "MENTOR" | "TEACHER";
14
+ /** Taskdescription */
15
+ taskDescription: string;
16
+ }
17
+ /** ArchitectChapter */
18
+ interface ArchitectChapter {
19
+ /** Chapterindex */
20
+ chapterIndex: number;
21
+ /** Title */
22
+ title: string;
23
+ /** Lessons */
24
+ lessons: ArchitectLesson[];
25
+ }
26
+ /** ArchitectCourseResponse */
27
+ interface ArchitectCourseResponse {
28
+ /** Title */
29
+ title: string;
30
+ /** Description */
31
+ description: string;
32
+ /** Chapters */
33
+ chapters: ArchitectChapter[];
34
+ }
35
+ /** ArchitectLesson */
36
+ interface ArchitectLesson {
37
+ /** Lessontype */
38
+ lessonType: "AI_MENTOR" | "CONTENT" | "QUIZ";
39
+ /** Title */
40
+ title: string;
41
+ /** Content */
42
+ content: string | null;
43
+ /** Questions */
44
+ questions: ArchitectQuizQuestion[] | null;
45
+ aiMentor: ArchitectAiMentorLesson | null;
46
+ }
47
+ /** ArchitectQuizOption */
48
+ interface ArchitectQuizOption {
49
+ /** Optionindex */
50
+ optionIndex: number;
51
+ /** Optiontext */
52
+ optionText: string;
53
+ /** Iscorrect */
54
+ isCorrect: boolean;
55
+ }
56
+ /** ArchitectQuizQuestion */
57
+ interface ArchitectQuizQuestion {
58
+ /** Questionindex */
59
+ questionIndex: number;
60
+ /** Type */
61
+ type: "SingleSelect" | "MultiSelect" | "TrueOrFalse" | "BriefResponse" | "DetailedResponse" | "FillInTheBlanks" | "GapFill";
62
+ /** Title */
63
+ title: string;
64
+ /** Description */
65
+ description: string | null;
66
+ /** Solutionexplanation */
67
+ solutionExplanation: string | null;
68
+ /** Options */
69
+ options: ArchitectQuizOption[] | null;
70
+ }
71
+ /** Body_ingest_api_public_v1_draft_ingest__integration_id__post */
72
+ interface BodyIngestApiPublicV1DraftIngestIntegrationIdPost {
73
+ /**
74
+ * File
75
+ * @format binary
76
+ */
77
+ file: File;
78
+ }
79
+ /** CreateDraft */
80
+ interface CreateDraft {
81
+ /**
82
+ * Integrationid
83
+ * @format uuid
84
+ */
85
+ integrationId: string;
86
+ /** Draftname */
87
+ draftName: string;
88
+ }
89
+ /** CreateDraftResponse */
90
+ interface CreateDraftResponse {
91
+ /**
92
+ * Draftid
93
+ * @format uuid
94
+ */
95
+ draftId: string;
96
+ }
97
+ /** DeleteIngestedDocumentResponse */
98
+ interface DeleteIngestedDocumentResponse {
99
+ /** Message */
100
+ message: string;
101
+ }
102
+ /** DraftFilesResponseBody */
103
+ interface DraftFilesResponseBody {
104
+ /**
105
+ * Id
106
+ * @format uuid
107
+ */
108
+ id: string;
109
+ /** Filename */
110
+ filename: string;
111
+ /** Contenttype */
112
+ contentType: string;
113
+ }
114
+ /** DraftMessageResponse */
115
+ interface DraftMessageResponse {
116
+ /**
117
+ * Id
118
+ * @format uuid
119
+ */
120
+ id: string;
121
+ /**
122
+ * Draftid
123
+ * @format uuid
124
+ */
125
+ draftId: string;
126
+ /** Role */
127
+ role: string;
128
+ /** Content */
129
+ content: string;
130
+ /** Contenttype */
131
+ contentType: string;
132
+ /** Draftmetadata */
133
+ draftMetadata?: Record<string, any> | null;
134
+ /**
135
+ * Createdat
136
+ * @format date-time
137
+ */
138
+ createdAt: string;
139
+ /**
140
+ * Updatedat
141
+ * @format date-time
142
+ */
143
+ updatedAt: string;
144
+ }
145
+ /** GetDraftResponse */
146
+ interface GetDraftResponse {
147
+ /**
148
+ * Draftid
149
+ * @format uuid
150
+ */
151
+ draftId: string;
152
+ /** Iscoursegenerated */
153
+ isCourseGenerated: boolean;
154
+ }
155
+ /** IngestDraftResponse */
156
+ interface IngestDraftResponse {
157
+ /** Success */
158
+ success: boolean;
159
+ /** Queued */
160
+ queued: boolean;
161
+ /** Jobid */
162
+ jobId?: string | null;
163
+ }
164
+ /** Message */
165
+ interface Message {
166
+ /** Message */
167
+ message: string;
168
+ }
169
+ type QueryParamsType = Record<string | number, any>;
170
+ interface FullRequestParams extends Omit<AxiosRequestConfig, "data" | "params" | "url" | "responseType"> {
171
+ /** set parameter to `true` for call `securityWorker` for this request */
172
+ secure?: boolean;
173
+ /** request path */
174
+ path: string;
175
+ /** content type of request body */
176
+ type?: ContentType;
177
+ /** query params */
178
+ query?: QueryParamsType;
179
+ /** format of response (i.e. response.json() -> format: "json") */
180
+ format?: ResponseType;
181
+ /** request body */
182
+ body?: unknown;
183
+ }
184
+ type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
185
+ interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, "data" | "cancelToken"> {
186
+ securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
187
+ secure?: boolean;
188
+ format?: ResponseType;
189
+ }
190
+ declare enum ContentType {
191
+ Json = "application/json",
192
+ JsonApi = "application/vnd.api+json",
193
+ FormData = "multipart/form-data",
194
+ UrlEncoded = "application/x-www-form-urlencoded",
195
+ Text = "text/plain"
196
+ }
197
+ declare class HttpClient<SecurityDataType = unknown> {
198
+ instance: AxiosInstance;
199
+ private securityData;
200
+ private securityWorker?;
201
+ private secure?;
202
+ private format?;
203
+ constructor({ securityWorker, secure, format, ...axiosConfig }?: ApiConfig<SecurityDataType>);
204
+ setSecurityData: (data: SecurityDataType | null) => void;
205
+ protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig;
206
+ protected stringifyFormItem(formItem: unknown): string;
207
+ protected createFormData(input: Record<string, unknown>): FormData;
208
+ request: <T = any, _E = any>({ secure, path, type, query, format, body, ...params }: FullRequestParams) => Promise<AxiosResponse<T>>;
209
+ }
210
+ /**
211
+ * @title Luma API
212
+ * @version 0.1.0
213
+ */
214
+ declare class API<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
215
+ api: {
216
+ /**
217
+ * @description Streams AI chat responses for the draft associated with `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
218
+ *
219
+ * @tags Public - Require API Key
220
+ * @name ChatApiPublicV1AiChatIntegrationIdPost
221
+ * @summary Chat With Draft By Integration ID
222
+ * @request POST:/api/public/v1/ai/chat/{integration_id}
223
+ * @secure
224
+ */
225
+ chatApiPublicV1AiChatIntegrationIdPost: (integrationId: string, data: Message, params?: RequestParams) => Promise<AxiosResponse<T>>;
226
+ /**
227
+ * @description Creates a draft for a given `integration_id` (the external course identifier you are building a draft for) under the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
228
+ *
229
+ * @tags Public - Require API Key
230
+ * @name CreateDraftApiPublicV1DraftPost
231
+ * @summary Create Draft By Integration ID
232
+ * @request POST:/api/public/v1/draft
233
+ * @secure
234
+ */
235
+ createDraftApiPublicV1DraftPost: (data: CreateDraft, params?: RequestParams) => Promise<AxiosResponse<T>>;
236
+ /**
237
+ * @description Uploads a file to the draft associated with `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
238
+ *
239
+ * @tags Public - Require API Key
240
+ * @name IngestApiPublicV1DraftIngestIntegrationIdPost
241
+ * @summary Ingest File To Draft By Integration ID
242
+ * @request POST:/api/public/v1/draft/ingest/{integration_id}
243
+ * @secure
244
+ */
245
+ ingestApiPublicV1DraftIngestIntegrationIdPost: (integrationId: string, data: BodyIngestApiPublicV1DraftIngestIntegrationIdPost, params?: RequestParams) => Promise<AxiosResponse<T>>;
246
+ /**
247
+ * @description Removes a previously ingested document from the draft associated with `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
248
+ *
249
+ * @tags Public - Require API Key
250
+ * @name DeleteIngestedDocumentApiPublicV1DraftIngestIntegrationIdDocumentIdDelete
251
+ * @summary Delete Ingested Document By Integration ID
252
+ * @request DELETE:/api/public/v1/draft/ingest/{integration_id}/{document_id}
253
+ * @secure
254
+ */
255
+ deleteIngestedDocumentApiPublicV1DraftIngestIntegrationIdDocumentIdDelete: (integrationId: string, documentId: string, params?: RequestParams) => Promise<AxiosResponse<T>>;
256
+ /**
257
+ * @description Returns all files linked to the draft for the provided `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
258
+ *
259
+ * @tags Public - Require API Key
260
+ * @name GetDraftFilesApiPublicV1DraftFilesIntegrationIdGet
261
+ * @summary Get Draft Files By Integration ID
262
+ * @request GET:/api/public/v1/draft/files/{integration_id}
263
+ * @secure
264
+ */
265
+ getDraftFilesApiPublicV1DraftFilesIntegrationIdGet: (integrationId: string, params?: RequestParams) => Promise<AxiosResponse<T>>;
266
+ /**
267
+ * @description Fetches draft status for the provided `integration_id` (the external course identifier you are building a draft for) inside the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
268
+ *
269
+ * @tags Public - Require API Key
270
+ * @name GetDraftApiPublicV1DraftIntegrationIdGet
271
+ * @summary Get Draft Status By Integration ID
272
+ * @request GET:/api/public/v1/draft/{integration_id}
273
+ * @secure
274
+ */
275
+ getDraftApiPublicV1DraftIntegrationIdGet: (integrationId: string, params?: RequestParams) => Promise<AxiosResponse<T>>;
276
+ /**
277
+ * @description Returns all draft chat messages for the draft associated with `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
278
+ *
279
+ * @tags Public - Require API Key
280
+ * @name GetDraftMessagesApiPublicV1DraftMessagesIntegrationIdGet
281
+ * @summary Get Draft Messages By Integration ID
282
+ * @request GET:/api/public/v1/draft/messages/{integration_id}
283
+ * @secure
284
+ */
285
+ getDraftMessagesApiPublicV1DraftMessagesIntegrationIdGet: (integrationId: string, params?: RequestParams) => Promise<AxiosResponse<T>>;
286
+ /**
287
+ * @description Returns the generated course payload for the draft associated with `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
288
+ *
289
+ * @tags Public - Require API Key
290
+ * @name GetGeneratedCourseApiPublicV1DraftGeneratedCourseIntegrationIdGet
291
+ * @summary Get Generated Course By Integration ID
292
+ * @request GET:/api/public/v1/draft/generated-course/{integration_id}
293
+ * @secure
294
+ */
295
+ getGeneratedCourseApiPublicV1DraftGeneratedCourseIntegrationIdGet: (integrationId: string, params?: RequestParams) => Promise<AxiosResponse<T>>;
296
+ };
297
+ }
298
+
299
+ type IntegrationIdOptions = {
300
+ integrationId: string;
301
+ };
302
+ type ChatOptions = IntegrationIdOptions & Message;
303
+ type CreateDraftOptions = CreateDraft;
304
+ type DraftFile = DraftFilesResponseBody;
305
+ type DraftFilesResponse = DraftFile[];
306
+ type DraftMessage = DraftMessageResponse;
307
+ type DraftMessagesResponse = DraftMessage[];
308
+ type GeneratedCourseResponse = ArchitectCourseResponse;
309
+ type IngestDraftFileOptions = IntegrationIdOptions & BodyIngestApiPublicV1DraftIngestIntegrationIdPost;
310
+ type DeleteIngestedDocumentOptions = IntegrationIdOptions & {
311
+ documentId: string;
312
+ };
313
+
314
+ declare class PublicApiExecutions {
315
+ private readonly apiClient;
316
+ constructor(apiClient: API<unknown>);
317
+ chat(opts: ChatOptions): ReturnType<API<unknown>["api"]["chatApiPublicV1AiChatIntegrationIdPost"]>;
318
+ createDraft(opts: CreateDraftOptions): Promise<CreateDraftResponse>;
319
+ ingestDraftFile(opts: IngestDraftFileOptions): Promise<IngestDraftResponse>;
320
+ deleteIngestedDocument(opts: DeleteIngestedDocumentOptions): Promise<DeleteIngestedDocumentResponse>;
321
+ getDraftFiles(opts: IntegrationIdOptions): Promise<DraftFilesResponse>;
322
+ getDraft(opts: IntegrationIdOptions): Promise<GetDraftResponse>;
323
+ getDraftMessages(opts: IntegrationIdOptions): Promise<DraftMessagesResponse>;
324
+ getGeneratedCourse(opts: IntegrationIdOptions): Promise<GeneratedCourseResponse>;
325
+ }
326
+
327
+ type LumaClientOptions = {
328
+ baseURL?: string;
329
+ apiKey?: string;
330
+ httpsAgent?: Agent;
331
+ allowInsecureTls?: boolean;
332
+ };
333
+ declare class LumaClient {
334
+ apiClient: API<unknown>;
335
+ private readonly executions;
336
+ constructor(opts: LumaClientOptions);
337
+ chat(opts: ChatOptions): ReturnType<PublicApiExecutions["chat"]>;
338
+ createDraft(opts: CreateDraftOptions): Promise<CreateDraftResponse>;
339
+ ingestDraftFile(opts: IngestDraftFileOptions): Promise<IngestDraftResponse>;
340
+ deleteIngestedDocument(opts: DeleteIngestedDocumentOptions): Promise<DeleteIngestedDocumentResponse>;
341
+ getDraftFiles(opts: IntegrationIdOptions): Promise<DraftFilesResponse>;
342
+ getDraft(opts: IntegrationIdOptions): Promise<GetDraftResponse>;
343
+ getDraftMessages(opts: IntegrationIdOptions): Promise<DraftMessagesResponse>;
344
+ getGeneratedCourse(opts: IntegrationIdOptions): Promise<GeneratedCourseResponse>;
345
+ }
346
+
347
+ declare const createLumaClient: (opts: LumaClientOptions) => LumaClient;
348
+
349
+ export { type ChatOptions, type CreateDraftOptions, type CreateDraftResponse, type DeleteIngestedDocumentOptions, type DeleteIngestedDocumentResponse, type DraftFile, type DraftFilesResponse, type DraftMessage, type DraftMessagesResponse, type GeneratedCourseResponse, type GetDraftResponse, type IngestDraftFileOptions, type IngestDraftResponse as IngestDraftFileResponse, type IntegrationIdOptions, LumaClient, type LumaClientOptions, createLumaClient };
package/dist/index.js ADDED
@@ -0,0 +1,344 @@
1
+ // src/api/generated-api.ts
2
+ import axios from "axios";
3
+ var HttpClient = class {
4
+ constructor({
5
+ securityWorker,
6
+ secure,
7
+ format,
8
+ ...axiosConfig
9
+ } = {}) {
10
+ this.securityData = null;
11
+ this.setSecurityData = (data) => {
12
+ this.securityData = data;
13
+ };
14
+ this.request = async ({
15
+ secure,
16
+ path,
17
+ type,
18
+ query,
19
+ format,
20
+ body,
21
+ ...params
22
+ }) => {
23
+ const secureParams = (typeof secure === "boolean" ? secure : this.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
24
+ const requestParams = this.mergeRequestParams(params, secureParams);
25
+ const responseFormat = format || this.format || void 0;
26
+ if (type === "multipart/form-data" /* FormData */ && body && body !== null && typeof body === "object") {
27
+ body = this.createFormData(body);
28
+ }
29
+ if (type === "text/plain" /* Text */ && body && body !== null && typeof body !== "string") {
30
+ body = JSON.stringify(body);
31
+ }
32
+ return this.instance.request({
33
+ ...requestParams,
34
+ headers: {
35
+ ...requestParams.headers || {},
36
+ ...type ? { "Content-Type": type } : {}
37
+ },
38
+ params: query,
39
+ responseType: responseFormat,
40
+ data: body,
41
+ url: path
42
+ });
43
+ };
44
+ this.instance = axios.create({
45
+ ...axiosConfig,
46
+ baseURL: axiosConfig.baseURL || ""
47
+ });
48
+ this.secure = secure;
49
+ this.format = format;
50
+ this.securityWorker = securityWorker;
51
+ }
52
+ mergeRequestParams(params1, params2) {
53
+ const method = params1.method || params2 && params2.method;
54
+ return {
55
+ ...this.instance.defaults,
56
+ ...params1,
57
+ ...params2 || {},
58
+ headers: {
59
+ ...method && this.instance.defaults.headers[method.toLowerCase()] || {},
60
+ ...params1.headers || {},
61
+ ...params2 && params2.headers || {}
62
+ }
63
+ };
64
+ }
65
+ stringifyFormItem(formItem) {
66
+ if (typeof formItem === "object" && formItem !== null) {
67
+ return JSON.stringify(formItem);
68
+ } else {
69
+ return `${formItem}`;
70
+ }
71
+ }
72
+ createFormData(input) {
73
+ if (input instanceof FormData) {
74
+ return input;
75
+ }
76
+ return Object.keys(input || {}).reduce((formData, key) => {
77
+ const property = input[key];
78
+ const propertyContent = property instanceof Array ? property : [property];
79
+ for (const formItem of propertyContent) {
80
+ const isFileType = formItem instanceof Blob || formItem instanceof File;
81
+ formData.append(
82
+ key,
83
+ isFileType ? formItem : this.stringifyFormItem(formItem)
84
+ );
85
+ }
86
+ return formData;
87
+ }, new FormData());
88
+ }
89
+ };
90
+ var API = class extends HttpClient {
91
+ constructor() {
92
+ super(...arguments);
93
+ this.api = {
94
+ /**
95
+ * @description Streams AI chat responses for the draft associated with `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
96
+ *
97
+ * @tags Public - Require API Key
98
+ * @name ChatApiPublicV1AiChatIntegrationIdPost
99
+ * @summary Chat With Draft By Integration ID
100
+ * @request POST:/api/public/v1/ai/chat/{integration_id}
101
+ * @secure
102
+ */
103
+ chatApiPublicV1AiChatIntegrationIdPost: (integrationId, data, params = {}) => this.request({
104
+ path: `/api/public/v1/ai/chat/${integrationId}`,
105
+ method: "POST",
106
+ body: data,
107
+ secure: true,
108
+ type: "application/json" /* Json */,
109
+ format: "json",
110
+ ...params
111
+ }),
112
+ /**
113
+ * @description Creates a draft for a given `integration_id` (the external course identifier you are building a draft for) under the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
114
+ *
115
+ * @tags Public - Require API Key
116
+ * @name CreateDraftApiPublicV1DraftPost
117
+ * @summary Create Draft By Integration ID
118
+ * @request POST:/api/public/v1/draft
119
+ * @secure
120
+ */
121
+ createDraftApiPublicV1DraftPost: (data, params = {}) => this.request({
122
+ path: `/api/public/v1/draft`,
123
+ method: "POST",
124
+ body: data,
125
+ secure: true,
126
+ type: "application/json" /* Json */,
127
+ format: "json",
128
+ ...params
129
+ }),
130
+ /**
131
+ * @description Uploads a file to the draft associated with `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
132
+ *
133
+ * @tags Public - Require API Key
134
+ * @name IngestApiPublicV1DraftIngestIntegrationIdPost
135
+ * @summary Ingest File To Draft By Integration ID
136
+ * @request POST:/api/public/v1/draft/ingest/{integration_id}
137
+ * @secure
138
+ */
139
+ ingestApiPublicV1DraftIngestIntegrationIdPost: (integrationId, data, params = {}) => this.request({
140
+ path: `/api/public/v1/draft/ingest/${integrationId}`,
141
+ method: "POST",
142
+ body: data,
143
+ secure: true,
144
+ type: "multipart/form-data" /* FormData */,
145
+ format: "json",
146
+ ...params
147
+ }),
148
+ /**
149
+ * @description Removes a previously ingested document from the draft associated with `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
150
+ *
151
+ * @tags Public - Require API Key
152
+ * @name DeleteIngestedDocumentApiPublicV1DraftIngestIntegrationIdDocumentIdDelete
153
+ * @summary Delete Ingested Document By Integration ID
154
+ * @request DELETE:/api/public/v1/draft/ingest/{integration_id}/{document_id}
155
+ * @secure
156
+ */
157
+ deleteIngestedDocumentApiPublicV1DraftIngestIntegrationIdDocumentIdDelete: (integrationId, documentId, params = {}) => this.request({
158
+ path: `/api/public/v1/draft/ingest/${integrationId}/${documentId}`,
159
+ method: "DELETE",
160
+ secure: true,
161
+ format: "json",
162
+ ...params
163
+ }),
164
+ /**
165
+ * @description Returns all files linked to the draft for the provided `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
166
+ *
167
+ * @tags Public - Require API Key
168
+ * @name GetDraftFilesApiPublicV1DraftFilesIntegrationIdGet
169
+ * @summary Get Draft Files By Integration ID
170
+ * @request GET:/api/public/v1/draft/files/{integration_id}
171
+ * @secure
172
+ */
173
+ getDraftFilesApiPublicV1DraftFilesIntegrationIdGet: (integrationId, params = {}) => this.request({
174
+ path: `/api/public/v1/draft/files/${integrationId}`,
175
+ method: "GET",
176
+ secure: true,
177
+ format: "json",
178
+ ...params
179
+ }),
180
+ /**
181
+ * @description Fetches draft status for the provided `integration_id` (the external course identifier you are building a draft for) inside the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
182
+ *
183
+ * @tags Public - Require API Key
184
+ * @name GetDraftApiPublicV1DraftIntegrationIdGet
185
+ * @summary Get Draft Status By Integration ID
186
+ * @request GET:/api/public/v1/draft/{integration_id}
187
+ * @secure
188
+ */
189
+ getDraftApiPublicV1DraftIntegrationIdGet: (integrationId, params = {}) => this.request({
190
+ path: `/api/public/v1/draft/${integrationId}`,
191
+ method: "GET",
192
+ secure: true,
193
+ format: "json",
194
+ ...params
195
+ }),
196
+ /**
197
+ * @description Returns all draft chat messages for the draft associated with `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
198
+ *
199
+ * @tags Public - Require API Key
200
+ * @name GetDraftMessagesApiPublicV1DraftMessagesIntegrationIdGet
201
+ * @summary Get Draft Messages By Integration ID
202
+ * @request GET:/api/public/v1/draft/messages/{integration_id}
203
+ * @secure
204
+ */
205
+ getDraftMessagesApiPublicV1DraftMessagesIntegrationIdGet: (integrationId, params = {}) => this.request({
206
+ path: `/api/public/v1/draft/messages/${integrationId}`,
207
+ method: "GET",
208
+ secure: true,
209
+ format: "json",
210
+ ...params
211
+ }),
212
+ /**
213
+ * @description Returns the generated course payload for the draft associated with `integration_id` (the external course identifier you are building a draft for), scoped to the organization resolved from `X-API-Key`. Authorization header required: `X-API-Key: <luma_api_key>`.
214
+ *
215
+ * @tags Public - Require API Key
216
+ * @name GetGeneratedCourseApiPublicV1DraftGeneratedCourseIntegrationIdGet
217
+ * @summary Get Generated Course By Integration ID
218
+ * @request GET:/api/public/v1/draft/generated-course/{integration_id}
219
+ * @secure
220
+ */
221
+ getGeneratedCourseApiPublicV1DraftGeneratedCourseIntegrationIdGet: (integrationId, params = {}) => this.request({
222
+ path: `/api/public/v1/draft/generated-course/${integrationId}`,
223
+ method: "GET",
224
+ secure: true,
225
+ format: "json",
226
+ ...params
227
+ })
228
+ };
229
+ }
230
+ };
231
+
232
+ // src/client.ts
233
+ import { Agent as HttpsAgent } from "https";
234
+
235
+ // src/executions/public-api-executions.ts
236
+ var PublicApiExecutions = class {
237
+ constructor(apiClient) {
238
+ this.apiClient = apiClient;
239
+ }
240
+ async chat(opts) {
241
+ return this.apiClient.api.chatApiPublicV1AiChatIntegrationIdPost(
242
+ opts.integrationId,
243
+ {
244
+ message: opts.message
245
+ },
246
+ {
247
+ format: "stream"
248
+ }
249
+ );
250
+ }
251
+ async createDraft(opts) {
252
+ const response = await this.apiClient.api.createDraftApiPublicV1DraftPost(opts);
253
+ return response.data;
254
+ }
255
+ async ingestDraftFile(opts) {
256
+ const response = await this.apiClient.api.ingestApiPublicV1DraftIngestIntegrationIdPost(
257
+ opts.integrationId,
258
+ {
259
+ file: opts.file
260
+ }
261
+ );
262
+ return response.data;
263
+ }
264
+ async deleteIngestedDocument(opts) {
265
+ const response = await this.apiClient.api.deleteIngestedDocumentApiPublicV1DraftIngestIntegrationIdDocumentIdDelete(
266
+ opts.integrationId,
267
+ opts.documentId
268
+ );
269
+ return response.data;
270
+ }
271
+ async getDraftFiles(opts) {
272
+ const response = await this.apiClient.api.getDraftFilesApiPublicV1DraftFilesIntegrationIdGet(
273
+ opts.integrationId
274
+ );
275
+ return response.data;
276
+ }
277
+ async getDraft(opts) {
278
+ const response = await this.apiClient.api.getDraftApiPublicV1DraftIntegrationIdGet(
279
+ opts.integrationId
280
+ );
281
+ return response.data;
282
+ }
283
+ async getDraftMessages(opts) {
284
+ const response = await this.apiClient.api.getDraftMessagesApiPublicV1DraftMessagesIntegrationIdGet(
285
+ opts.integrationId
286
+ );
287
+ return response.data;
288
+ }
289
+ async getGeneratedCourse(opts) {
290
+ const response = await this.apiClient.api.getGeneratedCourseApiPublicV1DraftGeneratedCourseIntegrationIdGet(
291
+ opts.integrationId
292
+ );
293
+ return response.data;
294
+ }
295
+ };
296
+
297
+ // src/client.ts
298
+ var LumaClient = class {
299
+ constructor(opts) {
300
+ const httpsAgent = opts.httpsAgent ?? (opts.allowInsecureTls ? new HttpsAgent({ rejectUnauthorized: false }) : void 0);
301
+ this.apiClient = new API({
302
+ baseURL: opts.baseURL,
303
+ secure: true,
304
+ httpsAgent,
305
+ headers: {
306
+ "X-API-Key": opts.apiKey
307
+ }
308
+ });
309
+ this.executions = new PublicApiExecutions(this.apiClient);
310
+ }
311
+ async chat(opts) {
312
+ return this.executions.chat(opts);
313
+ }
314
+ async createDraft(opts) {
315
+ return this.executions.createDraft(opts);
316
+ }
317
+ async ingestDraftFile(opts) {
318
+ return this.executions.ingestDraftFile(opts);
319
+ }
320
+ async deleteIngestedDocument(opts) {
321
+ return this.executions.deleteIngestedDocument(opts);
322
+ }
323
+ async getDraftFiles(opts) {
324
+ return this.executions.getDraftFiles(opts);
325
+ }
326
+ async getDraft(opts) {
327
+ return this.executions.getDraft(opts);
328
+ }
329
+ async getDraftMessages(opts) {
330
+ return this.executions.getDraftMessages(opts);
331
+ }
332
+ async getGeneratedCourse(opts) {
333
+ return this.executions.getGeneratedCourse(opts);
334
+ }
335
+ };
336
+
337
+ // src/index.ts
338
+ var createLumaClient = (opts) => {
339
+ return new LumaClient(opts);
340
+ };
341
+ export {
342
+ LumaClient,
343
+ createLumaClient
344
+ };