8.0.0 • Published 4 years ago

idelic-safety-suite-api v8.0.0

Weekly downloads
21
License
MIT
Repository
github
Last release
4 years ago

Idelic Safety Suite API

This API is to help JavaScript applications run api calls against Idelic's servers.

To create a new API:

All APIs must mirror the server they come from exactly. This includes:

  • the folder structure relative to the URL
  • the TypeScript types relative to the request / response bodies and query params

No logic can be run inside the API functions, they are simply to translate from JavaScript / Immutable types to the format that the server expects.

  1. Identify folder / file to create API in (based on the URL)
  2. Create required request body, response body, and query param types
  3. Create function signatures for normal and Immutable objects
  4. Make the last argument of each API call apiOptions: ApiOptions = {}
  5. Setup Immutable transformers to run based on apiOptions.useImmutable
  6. Build API object and call runApi with it
  7. Ensure the method, url root, route and request options are all correct
  8. Pass through the apiOptions as is
  9. For every new folder, add an index.ts for exporting in it
  10. For every new file, add an export * from './fileName.ts' in its sibling index.ts

To identify the correct folder:

Look for patterns in the URL and put grouped APIs together based on those patterns. Eg, the following would all go in the src/api/notifications.ts file.

GET /api/1.0/notifications
GET /api/1.0/notifications/<id>
POST /api/1.0/notifications
...etc

Eg, the following would all go in the src/api/models/documents.ts file.

GET /api/models/<modelId>/documents
GET /api/models/documemnts/<documentId>/content
POST /api/models/<modelId>/documents
PUT /api/models/documents

If in doubt, ask in the PR! Or take a look through the related server code to see how they structured it.

8.0.0

4 years ago

7.0.1

4 years ago

7.0.0

4 years ago

5.4.1

4 years ago

6.0.0

4 years ago

5.3.0

4 years ago

5.2.0

4 years ago

5.1.1

4 years ago

5.0.1

4 years ago

5.0.0

4 years ago

4.0.0

4 years ago

3.0.0-doclib.13

4 years ago

3.0.0-doclib.12

4 years ago

3.0.0-doclib.11

4 years ago

3.0.0

4 years ago

2.1.2-doclib.10

4 years ago

2.1.1-doclib.9

4 years ago

2.1.2

4 years ago

2.1.1-doclib.8

4 years ago

2.1.1-doclib.7

4 years ago

2.1.1-doclib.6

4 years ago

2.1.1-doclib.5

4 years ago

2.1.1-doclib.4

4 years ago

2.1.1-doclib.3

4 years ago

2.1.1-doclib.2

4 years ago

2.1.1-doclib.1

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.1

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago