Skip to content

Commit f2f7411

Browse files
Add Gateway and Wiadomosci OpenAPI docs (#99)
Add generated OpenAPI specs for api_v3, gateway_api_20, and wiadomosci.librus.pl/api under openapi/. Keep the legacy package subpath librus-sdk/openapi.json as a compatibility alias for the API v3 spec.
1 parent d7d551e commit f2f7411

12 files changed

Lines changed: 3963 additions & 66 deletions

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- Generated OpenAPI documents for the supported `gateway_api_20` and
12+
`wiadomosci.librus.pl/api` surfaces.
13+
914
## [0.7.1] - 2026-05-20
1015

1116
### Fixed

README.md

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ npm exec --package librus-sdk -- librus-sdk grades list --child <id-or-login>
5858
The canonical CLI binary is `librus-sdk`. A deprecated `librus` alias remains
5959
temporarily for compatibility and prints a warning before delegating.
6060

61-
The package also ships a generated [`openapi.json`](./openapi.json) for the
62-
SDK-supported child-scoped `https://api.librus.pl/3.0` surface, so non-TypeScript
63-
consumers can generate clients in other languages. It is also exported as
64-
`librus-sdk/openapi.json`.
61+
The package also ships generated OpenAPI documents for the SDK-supported
62+
`api_v3`, `gateway_api_20`, and `wiadomosci.librus.pl/api` surfaces, so
63+
non-TypeScript consumers can generate clients in other languages. The legacy
64+
API 3.0 document is [`openapi/api_v3_openapi.json`](./openapi/api_v3_openapi.json).
65+
For package compatibility it is still also exported as `librus-sdk/openapi.json`.
6566

6667
## Public Interface
6768

@@ -111,20 +112,24 @@ import {
111112
LibrusSession,
112113
PortalClient,
113114
SynergiaApiClient,
115+
generateGatewayApi20OpenApiDocument,
114116
generateOpenApiDocument,
117+
generateWiadomosciOpenApiDocument,
115118
LibrusSdkError,
116119
type LibrusApiBackend,
117120
} from "librus-sdk";
118121
```
119122

120-
| Export | Purpose |
121-
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
122-
| `LibrusSession` | Recommended high-level entry point. Handles login, linked-child discovery, child selection, and creation of child-scoped API clients. |
123-
| `BffApiClient` | Experimental child-scoped client for selected `https://testbff.librus.pl/v1` mobile backend reads. |
124-
| `GatewayApi20AuthClient` | Lower-level Gateway API 2.0 login/password auth client for `synergia.librus.pl/gateway/api/2.0` cookie-backed requests. |
125-
| `PortalClient` | Lower-level portal session client for `portal.librus.pl` login, `/Me`, and `/SynergiaAccounts`. |
126-
| `SynergiaApiClient` | Child-scoped GET client for the supported `https://api.librus.pl/3.0` surface when you already have a bearer token. |
127-
| `generateOpenApiDocument` | Generates the shipped OpenAPI document for the supported child-scoped GET subset. |
123+
| Export | Purpose |
124+
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
125+
| `LibrusSession` | Recommended high-level entry point. Handles login, linked-child discovery, child selection, and creation of child-scoped API clients. |
126+
| `BffApiClient` | Experimental child-scoped client for selected `https://testbff.librus.pl/v1` mobile backend reads. |
127+
| `GatewayApi20AuthClient` | Lower-level Gateway API 2.0 login/password auth client for `synergia.librus.pl/gateway/api/2.0` cookie-backed requests. |
128+
| `PortalClient` | Lower-level portal session client for `portal.librus.pl` login, `/Me`, and `/SynergiaAccounts`. |
129+
| `SynergiaApiClient` | Child-scoped GET client for the supported `https://api.librus.pl/3.0` surface when you already have a bearer token. |
130+
| `generateOpenApiDocument` | Generates the shipped OpenAPI document for the supported `api_v3` child-scoped GET subset. |
131+
| `generateGatewayApi20OpenApiDocument` | Generates the shipped OpenAPI document for the supported `gateway_api_20` GET subset. |
132+
| `generateWiadomosciOpenApiDocument` | Generates the shipped OpenAPI document for the supported `wiadomosci.librus.pl/api` inbox subset. |
128133

129134
Recommended session flow:
130135

@@ -280,13 +285,13 @@ here rather than promising every helper type as a named top-level export.
280285
| `authMode` | No | `bearer` by default, or `cookie` for Gateway-created sessions. |
281286
| `requestTimeoutMs` | No | Positive integer timeout in milliseconds. Defaults to `30000`. |
282287

283-
`generateOpenApiDocument()` options (`GenerateOpenApiDocumentOptions`):
288+
OpenAPI generator options (`GenerateOpenApiDocumentOptions`):
284289

285290
| Property | Required | Meaning |
286291
| ----------- | -------- | ---------------------------------------------------------------------------------------------------------------- |
287292
| `title` | No | Overrides the generated OpenAPI `info.title`. |
288293
| `version` | No | Overrides the generated OpenAPI `info.version`. Pass the package version when generating a publishable document. |
289-
| `serverUrl` | No | Overrides the default server URL `https://api.librus.pl/3.0`. |
294+
| `serverUrl` | No | Overrides the generator's default server URL. |
290295

291296
### Public Types And Errors
292297

@@ -430,10 +435,18 @@ credentials, bearer tokens, and cookie values are not included.
430435

431436
### OpenAPI
432437

433-
`openapi.json` is generated from the SDK's supported Synergia GET endpoints and
434-
the shared valibot response schemas. The document is best-effort and
435-
intentionally covers only the child-scoped `api.librus.pl/3.0` requests, not
436-
the `portal.librus.pl` login flow.
438+
OpenAPI documents are generated from the SDK's supported endpoints and valibot
439+
response schemas. The documents are best-effort and intentionally cover only
440+
post-auth API calls, not the Portal or Gateway login flows.
441+
442+
Generated files:
443+
444+
- [`openapi/api_v3_openapi.json`](./openapi/api_v3_openapi.json):
445+
child-scoped `https://api.librus.pl/3.0` `api_v3` bearer-token requests.
446+
- [`openapi/gateway_api_20_openapi.json`](./openapi/gateway_api_20_openapi.json):
447+
cookie-backed `https://synergia.librus.pl/gateway/api/2.0` requests.
448+
- [`openapi/wiadomosci_librus_pl_api_openapi.json`](./openapi/wiadomosci_librus_pl_api_openapi.json):
449+
cookie-backed `https://wiadomosci.librus.pl/api` inbox requests.
437450

438451
Regenerate or verify the file locally with:
439452

@@ -445,9 +458,15 @@ npm run openapi:check
445458
You can also generate the document programmatically:
446459

447460
```ts
448-
import { generateOpenApiDocument } from "librus-sdk";
461+
import {
462+
generateGatewayApi20OpenApiDocument,
463+
generateOpenApiDocument,
464+
generateWiadomosciOpenApiDocument,
465+
} from "librus-sdk";
449466

450467
const openApi = generateOpenApiDocument({ version: "0.4.0" });
468+
const gatewayApi20 = generateGatewayApi20OpenApiDocument({ version: "0.4.0" });
469+
const wiadomosciApi = generateWiadomosciOpenApiDocument({ version: "0.4.0" });
451470
```
452471

453472
### Release And Versioning Policy

docs/releasing.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ continues to publish to npmjs only.
6565

6666
## Release Checklist
6767

68-
1. Run `npm version X.Y.Z --no-git-tag-version` to update
69-
`package.json`, `package-lock.json`, and `openapi.json` together.
68+
1. Run `npm version X.Y.Z --no-git-tag-version` to update `package.json`,
69+
`package-lock.json`, and the generated OpenAPI JSON files together.
7070
2. Move the release notes from `Unreleased` into a new versioned section in
7171
`CHANGELOG.md`.
7272
3. Merge the release commit to `master`.
@@ -78,7 +78,8 @@ continues to publish to npmjs only.
7878
8. Confirm the workflow's published-package verification step succeeds.
7979

8080
Using `npm version` matters here because the repository's `version` lifecycle
81-
hook regenerates `openapi.json` from the new package version automatically.
81+
hook regenerates the OpenAPI JSON files from the new package version
82+
automatically.
8283

8384
## Maintainer Continuity
8485

0 commit comments

Comments
 (0)