ServicePackRpc
This endpoint group exposes RPC methods for creating, updating, archiving, retrieving, and listing service packs, plus a reference-data helper for populating field values in client forms. The file defines the request schemas for each method, but the referenced ServicePackSchema and ServicePackService implementations were not available for inspection, so only the behavior directly visible in this RPC class is documented here.
Endpoints
POST /api/rpc (Method: ServicePackRpc.create)
Description: Creates a new service pack by forwarding the validated request body to
ServicePackService.createPack(...).Request Body:
{ "method": "ServicePackRpc.create", "params": { "...": "fields defined by `ServicePackSchema` except `_id`, `createdAt`, and `updatedAt`" } }Parameters:
Name Type Required Description paramsObjectYes A service pack payload validated against ServicePackSchema.omit({ _id: true, createdAt: true, updatedAt: true }). Exact fields could not be confirmed because the imported schema was not inspected.Response:
{ "success": true, "data": { "...": "value returned by `ServicePackService.createPack(...)`" } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ServicePackRpc.create", "params": { "...": "service pack fields" } }'
POST /api/rpc (Method: ServicePackRpc.update)
Description: Updates an existing service pack by extracting
_idfrom the request body and forwarding the remaining fields toServicePackService.updatePack(...).Request Body:
{ "method": "ServicePackRpc.update", "params": { "_id": "string", "...": "other fields defined by `ServicePackSchema.partial()`" } }Parameters:
Name Type Required Description _idStringYes Identifier of the service pack to update. paramsObjectYes Partial service pack data validated against ServicePackSchema.partial().extend({ _id: z.string() }). Exact optional fields could not be confirmed because the imported schema was not inspected.Response:
{ "success": true, "data": { "...": "value returned by `ServicePackService.updatePack(...)`" } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ServicePackRpc.update", "params": { "_id": "service-pack-id", "...": "fields to update" } }'
POST /api/rpc (Method: ServicePackRpc.delete)
Description: Archives a service pack identified by
_idand returns a confirmation object.Request Body:
{ "method": "ServicePackRpc.delete", "params": { "_id": "string" } }Parameters:
Name Type Required Description _idStringYes Identifier of the service pack to archive. Response:
{ "success": true, "data": { "success": true, "message": "Service pack archived." } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ServicePackRpc.delete", "params": { "_id": "service-pack-id" } }'
POST /api/rpc (Method: ServicePackRpc.findById)
Description: Retrieves a service pack by
_idand returns the result fromServicePackService.getPackById(...).Request Body:
{ "method": "ServicePackRpc.findById", "params": { "_id": "string" } }Parameters:
Name Type Required Description _idStringYes Identifier of the service pack to retrieve. Response:
{ "success": true, "data": { "...": "value returned by `ServicePackService.getPackById(...)`" } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ServicePackRpc.findById", "params": { "_id": "service-pack-id" } }'
POST /api/rpc (Method: ServicePackRpc.getData)
Description: Returns a paginated list of service packs by translating
pageandpageSizeintoskipandlimit, then forwarding the query toServicePackService.listPacks(...).Request Body:
{ "method": "ServicePackRpc.getData", "params": { "filter": {}, "sort": {}, "page": 1, "pageSize": 25 } }Parameters:
Name Type Required Description filterAnyYes Filter object passed directly to ServicePackService.listPacks(...). The schema does not constrain its shape.sortAnyYes Sort specification passed directly to ServicePackService.listPacks(...). The schema does not constrain its shape.pageNumberYes Page number used to calculate skipas(page - 1) * pageSize.pageSizeNumberYes Number of records per page used as limit.Response:
{ "success": true, "data": { "...": "value returned by `ServicePackService.listPacks(...)`" } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ServicePackRpc.getData", "params": { "filter": {}, "sort": {}, "page": 1, "pageSize": 25 } }'
POST /api/rpc (Method: ServicePackRpc.getFieldValues)
Description: Provides reference values for fields by listing service packs with an optional filter and mapping each item to
{ value, label }using the configured value and display fields.Request Body:
{ "method": "ServicePackRpc.getFieldValues", "params": { "fieldName": "string", "reference": { "valueField": "string", "displayField": "string", "filter": {} } } }Parameters:
Name Type Required Description fieldNameStringYes Field name associated with the reference lookup. It is validated but not used in the method body. referenceObjectYes Reference configuration object. reference.valueFieldStringYes Object property used as the returned value.reference.displayFieldStringYes Object property used as the returned label.reference.filterRecord<String, Any>No Optional filter object passed to ServicePackService.listPacks(...).Response:
{ "success": true, "data": [ { "value": "string", "label": "string" } ] }The method limits the lookup to 1000 records and maps each returned item into a
{ value, label }object using the configured field names.Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "ServicePackRpc.getFieldValues", "params": { "fieldName": "servicePackId", "reference": { "valueField": "_id", "displayField": "name", "filter": {} } } }'