@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.
- package/dist/index.cjs +382 -0
- package/dist/index.d.cts +349 -0
- package/dist/index.d.ts +349 -0
- package/dist/index.js +344 -0
- package/package.json +46 -0
package/dist/index.d.cts
ADDED
|
@@ -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 };
|