karso/front/src/back-api/right-resource.ts

115 lines
2.0 KiB
TypeScript

/**
* API of the server (auto-generated code)
*/
import {
HTTPMimeType,
HTTPRequestModel,
ModelResponseHttp,
RESTCallbacks,
RESTConfig,
RESTRequestJson,
RESTRequestJsonArray,
RESTRequestVoid
} from "./rest-tools"
import {
Right,
Long,
isRight,
} from "./model"
export namespace RightResource {
export function remove({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/right/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
},
restConfig,
params,
});
};
export function get({
restConfig,
params,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<Right> {
return RESTRequestJson({
restModel: {
endPoint: "/right/{id}",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isRight);
};
export function patch({
restConfig,
params,
data,
}: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: Right,
}): Promise<Right> {
return RESTRequestJson({
restModel: {
endPoint: "/right/{id}",
requestType: HTTPRequestModel.PATCH,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
}, isRight);
};
export function post({
restConfig,
data,
}: {
restConfig: RESTConfig,
data: Right,
}): Promise<Right> {
return RESTRequestJson({
restModel: {
endPoint: "/right",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
}, isRight);
};
export function gets({
restConfig,
}: {
restConfig: RESTConfig,
}): Promise<Right[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/right",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isRight);
};
}