Const Builds a service instance with the specified configuration.
An object with service methods for interacting with the server.
// Create a Kos service instance for managing entities.
const entityService = ServiceFactory.build({
basePath: "/api/entities",
getAllPath: "/list",
getOnePath: "/get",
deleteModelPath: "/delete",
addModelPath: "/add",
modifyModelPath: "/modify",
});
// Fetch a list of entities.
const entities = await entityService.getAll({ ordered: true });
// Get details of a specific entity by ID.
const entityDetails = await entityService.getModelById({ id: "entity123" });
// Add a new entity to the server.
const newEntity = { name: "New Entity" };
await entityService.addModel({ model: newEntity });
// Modify an existing entity.
const updatedEntity = { id: "entity123", name: "Updated Entity" };
await entityService.modifyModel({ model: updatedEntity });
The configuration parameters for the service instance.
Retrieves a list of entities managed by the KOS Server.
The list of entities.
The parameters for the request, including common options.
Retrieves details of a specific entity by its ID.
Details of the requested entity.
The parameters for the request, including common options and the entity ID.
Retrieves details of a single entity.
Details of the requested entity.
The parameters for the request, including common options.
Adds a new entity to the server.
An empty response with status 200.
The parameters for the request, including common options and the new entity model.
Deletes an entity from the server based on its ID.
An empty response with status 200.
The parameters for the request, including common options and the entity ID.
Modifies an existing entity on the server.
An empty response with status 200.
The parameters for the request, including common options and the entity model.
Modifies an existing entity on the server using the HTTP PUT method.
An empty response with status 200.
The parameters for the request, including common options and the entity model.
Adds a new entity to the server using the HTTP POST method.
An empty response with status 200.
The parameters for the request, including common options and the new entity model.
A factory for creating service instances with common configurations.