152 lines
3.1 KiB
TypeScript
152 lines
3.1 KiB
TypeScript
/**
|
|
* API of the server (auto-generated code)
|
|
*/
|
|
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTCallbacks, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
|
|
import {UUID, Long, Series, isSeries, } from "./model"
|
|
export namespace SeriesResource {
|
|
|
|
/**
|
|
* Remove a specific Series
|
|
*/
|
|
export function remove({ restConfig, params, }: {
|
|
restConfig: RESTConfig,
|
|
params: {
|
|
id: Long,
|
|
},
|
|
}): Promise<void> {
|
|
return RESTRequestVoid({
|
|
restModel: {
|
|
endPoint: "/series/{id}",
|
|
requestType: HTTPRequestModel.DELETE,
|
|
contentType: HTTPMimeType.TEXT_PLAIN,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
params,
|
|
});
|
|
};
|
|
/**
|
|
* Get a specific Series with his ID
|
|
*/
|
|
export function get({ restConfig, params, }: {
|
|
restConfig: RESTConfig,
|
|
params: {
|
|
id: Long,
|
|
},
|
|
}): Promise<Series> {
|
|
return RESTRequestJson({
|
|
restModel: {
|
|
endPoint: "/series/{id}",
|
|
requestType: HTTPRequestModel.GET,
|
|
contentType: HTTPMimeType.JSON,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
params,
|
|
}, isSeries);
|
|
};
|
|
/**
|
|
* Modify a specific Series
|
|
*/
|
|
export function patch({ restConfig, params, data, }: {
|
|
restConfig: RESTConfig,
|
|
params: {
|
|
id: Long,
|
|
},
|
|
data: Series,
|
|
}): Promise<Series> {
|
|
return RESTRequestJson({
|
|
restModel: {
|
|
endPoint: "/series/{id}",
|
|
requestType: HTTPRequestModel.PATCH,
|
|
contentType: HTTPMimeType.JSON,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
params,
|
|
data,
|
|
}, isSeries);
|
|
};
|
|
/**
|
|
* Create a new Series
|
|
*/
|
|
export function post({ restConfig, data, }: {
|
|
restConfig: RESTConfig,
|
|
data: Series,
|
|
}): Promise<Series> {
|
|
return RESTRequestJson({
|
|
restModel: {
|
|
endPoint: "/series",
|
|
requestType: HTTPRequestModel.POST,
|
|
contentType: HTTPMimeType.JSON,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
data,
|
|
}, isSeries);
|
|
};
|
|
/**
|
|
* Get all Series
|
|
*/
|
|
export function gets({ restConfig, }: {
|
|
restConfig: RESTConfig,
|
|
}): Promise<Series[]> {
|
|
return RESTRequestJsonArray({
|
|
restModel: {
|
|
endPoint: "/series",
|
|
requestType: HTTPRequestModel.GET,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
}, isSeries);
|
|
};
|
|
/**
|
|
* Upload a new season cover Series
|
|
*/
|
|
export function uploadCover({ restConfig, params, data, callback, }: {
|
|
restConfig: RESTConfig,
|
|
params: {
|
|
id: Long,
|
|
},
|
|
data: {
|
|
fileName: string,
|
|
file: File,
|
|
},
|
|
callback?: RESTCallbacks,
|
|
}): Promise<Series> {
|
|
return RESTRequestJson({
|
|
restModel: {
|
|
endPoint: "/series/{id}/cover",
|
|
requestType: HTTPRequestModel.POST,
|
|
contentType: HTTPMimeType.MULTIPART,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
params,
|
|
data,
|
|
callback,
|
|
}, isSeries);
|
|
};
|
|
/**
|
|
* Remove a specific Series of a season
|
|
*/
|
|
export function removeCover({ restConfig, params, }: {
|
|
restConfig: RESTConfig,
|
|
params: {
|
|
coverId: UUID,
|
|
id: Long,
|
|
},
|
|
}): Promise<Series> {
|
|
return RESTRequestJson({
|
|
restModel: {
|
|
endPoint: "/series/{id}/cover/{coverId}",
|
|
requestType: HTTPRequestModel.DELETE,
|
|
contentType: HTTPMimeType.TEXT_PLAIN,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
params,
|
|
}, isSeries);
|
|
};
|
|
}
|