karideo/front/src/app/back-api/user-resource.ts

58 lines
1.3 KiB
TypeScript

/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTCallbacks, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Long, UserKarideo, UserOut, isUserKarideo, isUserOut, } from "./model"
export namespace UserResource {
/**
* Get a specific user data
*/
export function get({ restConfig, params, }: {
restConfig: RESTConfig,
params: {
id: Long,
},
}): Promise<UserKarideo> {
return RESTRequestJson({
restModel: {
endPoint: "/users/{id}",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isUserKarideo);
};
/**
* Get all the users
*/
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<UserKarideo[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/users",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isUserKarideo);
};
/**
* Get the user personal data
*/
export function getMe({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<UserOut> {
return RESTRequestJson({
restModel: {
endPoint: "/users/me",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isUserOut);
};
}