Skip to content

Service Provider

A Service Provider Business Object publishes an HTTP API of the app: each of its methods answers requests to one path, in one or more versions. Lowgile calls these methods when a request arrives. In code, a Service Provider is reached as This.<ProviderName>.

Availability: Server

This.<ProviderName>

Service Providers are not grouped under a $ namespace: they are reached directly as This.<ProviderName>. They exist only in server-side code; client-side and shared code cannot reference them.

Note

The typings and the runtime object do not match, so the declared methods below cannot be called as typed.

  • Declared: This.<ProviderName> is a class with one instance method per Service Provider method, without the request and response, and without versions. There is no way to get an instance of it.
  • Runtime: This.<ProviderName> is an object with one entry per version, This.<ProviderName>.<version>. A version name that does not start with a lowercase letter or _ gets a v_ prefix, so version 1 becomes v_1. Each version has a static async function per method available in that version, which takes the method’s parameters followed by $request and $response (the Express Request and Response), and an openapi() function that returns the version’s OpenAPI specification as a JSON string.

Code that uses the runtime shape does not pass type-checking.

<method>(<parameter>: <ParameterType>, ...): Promise<<ReturnType>>

One instance method per method of the Service Provider, across all versions, with the method’s parameters in order.

ParameterTypeDescription
<parameter><ParameterType>One per parameter of the method, with the type set on it.

Returns: Promise<<ReturnType>>: the method’s return type, or void when the method responds manually through the Response object · Availability: Server