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, Season, isSeason, } from "./model"
|
|
export namespace SeasonResource {
|
|
|
|
/**
|
|
* Remove a specific season
|
|
*/
|
|
export function remove({ restConfig, params, }: {
|
|
restConfig: RESTConfig,
|
|
params: {
|
|
id: Long,
|
|
},
|
|
}): Promise<void> {
|
|
return RESTRequestVoid({
|
|
restModel: {
|
|
endPoint: "/season/{id}",
|
|
requestType: HTTPRequestModel.DELETE,
|
|
contentType: HTTPMimeType.TEXT_PLAIN,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
params,
|
|
});
|
|
};
|
|
/**
|
|
* Get all season
|
|
*/
|
|
export function get({ restConfig, params, }: {
|
|
restConfig: RESTConfig,
|
|
params: {
|
|
id: Long,
|
|
},
|
|
}): Promise<Season> {
|
|
return RESTRequestJson({
|
|
restModel: {
|
|
endPoint: "/season/{id}",
|
|
requestType: HTTPRequestModel.GET,
|
|
contentType: HTTPMimeType.JSON,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
params,
|
|
}, isSeason);
|
|
};
|
|
/**
|
|
* Modify a specific season
|
|
*/
|
|
export function patch({ restConfig, params, data, }: {
|
|
restConfig: RESTConfig,
|
|
params: {
|
|
id: Long,
|
|
},
|
|
data: Season,
|
|
}): Promise<Season> {
|
|
return RESTRequestJson({
|
|
restModel: {
|
|
endPoint: "/season/{id}",
|
|
requestType: HTTPRequestModel.PATCH,
|
|
contentType: HTTPMimeType.JSON,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
params,
|
|
data,
|
|
}, isSeason);
|
|
};
|
|
/**
|
|
* Create a new season
|
|
*/
|
|
export function post({ restConfig, data, }: {
|
|
restConfig: RESTConfig,
|
|
data: Season,
|
|
}): Promise<Season> {
|
|
return RESTRequestJson({
|
|
restModel: {
|
|
endPoint: "/season",
|
|
requestType: HTTPRequestModel.POST,
|
|
contentType: HTTPMimeType.JSON,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
data,
|
|
}, isSeason);
|
|
};
|
|
/**
|
|
* Get a specific Season with his ID
|
|
*/
|
|
export function gets({ restConfig, }: {
|
|
restConfig: RESTConfig,
|
|
}): Promise<Season[]> {
|
|
return RESTRequestJsonArray({
|
|
restModel: {
|
|
endPoint: "/season",
|
|
requestType: HTTPRequestModel.GET,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
}, isSeason);
|
|
};
|
|
/**
|
|
* Upload a new season cover season
|
|
*/
|
|
export function uploadCover({ restConfig, params, data, callback, }: {
|
|
restConfig: RESTConfig,
|
|
params: {
|
|
id: Long,
|
|
},
|
|
data: {
|
|
fileName: string,
|
|
file: File,
|
|
},
|
|
callback?: RESTCallbacks,
|
|
}): Promise<Season> {
|
|
return RESTRequestJson({
|
|
restModel: {
|
|
endPoint: "/season/{id}/cover",
|
|
requestType: HTTPRequestModel.POST,
|
|
contentType: HTTPMimeType.MULTIPART,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
params,
|
|
data,
|
|
callback,
|
|
}, isSeason);
|
|
};
|
|
/**
|
|
* Remove a specific cover of a season
|
|
*/
|
|
export function removeCover({ restConfig, params, }: {
|
|
restConfig: RESTConfig,
|
|
params: {
|
|
coverId: UUID,
|
|
id: Long,
|
|
},
|
|
}): Promise<Season> {
|
|
return RESTRequestJson({
|
|
restModel: {
|
|
endPoint: "/season/{id}/cover/{coverId}",
|
|
requestType: HTTPRequestModel.DELETE,
|
|
contentType: HTTPMimeType.TEXT_PLAIN,
|
|
accept: HTTPMimeType.JSON,
|
|
},
|
|
restConfig,
|
|
params,
|
|
}, isSeason);
|
|
};
|
|
}
|