karusic/front/src/app/model/data-resource.ts

101 lines
2.2 KiB
TypeScript

/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray } from "./rest-tools"
import {Response, isResponse, InputStream, Long, RestErrorResponse, FormDataContentDisposition, } from "./model"
export namespace DataResource {
/**
* Get back some data from the data environment
*/
export function retrieveDataId({ restConfig, queries, params, data, }: {
restConfig: RESTConfig,
queries: {
Authorization: string,
},
params: {
id: Long,
},
data: string,
}): Promise<Response> {
return RESTRequestJson({
restModel: {
endPoint: "/data/{id}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
}, isResponse);
};
/**
* Get a thumbnail of from the data environment (if resize is possible)
*/
export function retrieveDataThumbnailId({ restConfig, queries, params, data, }: {
restConfig: RESTConfig,
queries: {
Authorization: string,
},
params: {
id: Long,
},
data: string,
}): Promise<Response> {
return RESTRequestJson({
restModel: {
endPoint: "/data/thumbnail/{id}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
}, isResponse);
};
/**
* Get back some data from the data environment (with a beautifull name (permit download with basic name)
*/
export function retrieveDataFull({ restConfig, queries, params, data, }: {
restConfig: RESTConfig,
queries: {
Authorization: string,
},
params: {
name: string,
id: Long,
},
data: string,
}): Promise<Response> {
return RESTRequestJson({
restModel: {
endPoint: "/data/{id}/{name}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
}, isResponse);
};
/**
* Insert a new data in the data environment
*/
export function uploadFile({ restConfig, data, }: {
restConfig: RESTConfig,
data: {
file: FormDataContentDisposition,
},
}): Promise<Response> {
return RESTRequestJson({
restModel: {
endPoint: "/data//upload/",
requestType: HTTPRequestModel.POST,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
}, isResponse);
};
}