1 parent
2e0665f09c
commit
6be9299532
42 files changed
+2342
-5
No files matched your search
@@ -12,6 +12,7 @@ export * from './auth';
|
||||
export * from './service';
|
||||
export * from './credential';
|
||||
export * from './qrart';
|
||||
export * from './luma';
|
||||
export * from './site';
|
||||
export * from './suno';
|
||||
export * from './exchange';
|
||||
@@ -0,0 +1,88 @@
|
||||
import axios, { AxiosResponse } from 'axios';
|
||||
import { ILumaGenerateRequest, ILumaGenerateResponse, ILumaTaskResponse, ILumaTasksResponse } from '@/models';
|
||||
import { BASE_URL_API } from '@/constants';
|
||||
|
||||
class LumaOperator {
|
||||
async task(id: string, options: { token: string }): Promise<AxiosResponse<ILumaTaskResponse>> {
|
||||
return await axios.post(
|
||||
`/luma/tasks`,
|
||||
{
|
||||
action: 'retrieve',
|
||||
id: id
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'content-type': 'application/json',
|
||||
authorization: `Bearer ${options.token}`,
|
||||
'x-record-exempt': 'true'
|
||||
},
|
||||
baseURL: BASE_URL_API
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async tasks(
|
||||
filter: { ids?: string[]; applicationId?: string; userId?: string; limit?: number; offset?: number },
|
||||
options: { token: string }
|
||||
): Promise<AxiosResponse<ILumaTasksResponse>> {
|
||||
return await axios.post(
|
||||
`/luma/tasks`,
|
||||
{
|
||||
action: 'retrieve_batch',
|
||||
...(filter.ids
|
||||
? {
|
||||
ids: filter.ids
|
||||
}
|
||||
: {}),
|
||||
...(filter.applicationId
|
||||
? {
|
||||
application_id: filter.applicationId
|
||||
}
|
||||
: {}),
|
||||
...(filter.userId
|
||||
? {
|
||||
user_id: filter.userId
|
||||
}
|
||||
: {}),
|
||||
...(filter.limit !== undefined
|
||||
? {
|
||||
limit: filter.limit
|
||||
}
|
||||
: {}),
|
||||
...(filter.offset !== undefined
|
||||
? {
|
||||
offset: filter.offset
|
||||
}
|
||||
: {})
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'content-type': 'application/json',
|
||||
authorization: `Bearer ${options.token}`,
|
||||
'x-record-exempt': 'true'
|
||||
},
|
||||
baseURL: BASE_URL_API
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async generate(
|
||||
data: ILumaGenerateRequest,
|
||||
options: {
|
||||
token: string;
|
||||
}
|
||||
): Promise<AxiosResponse<ILumaGenerateResponse>> {
|
||||
return await axios.post('/luma/videos', data, {
|
||||
headers: {
|
||||
authorization: `Bearer ${options.token}`,
|
||||
'content-type': 'application/json',
|
||||
accept: 'application/x-ndjson'
|
||||
},
|
||||
baseURL: BASE_URL_API
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const lumaOperator = new LumaOperator();
|
||||
Reference in new issue
Block a user