@gtmi/ramp-api-client 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/es/index.d.mts +3615 -0
- package/dist/es/index.mjs +2173 -0
- package/package.json +46 -0
- package/src/client.test.ts +50 -0
- package/src/client.ts +15 -0
- package/src/client.types.ts +11 -0
- package/src/generated/client/client.gen.ts +277 -0
- package/src/generated/client/index.ts +27 -0
- package/src/generated/client/types.gen.ts +214 -0
- package/src/generated/client/utils.gen.ts +316 -0
- package/src/generated/client.gen.ts +18 -0
- package/src/generated/core/auth.gen.ts +48 -0
- package/src/generated/core/bodySerializer.gen.ts +82 -0
- package/src/generated/core/params.gen.ts +178 -0
- package/src/generated/core/pathSerializer.gen.ts +171 -0
- package/src/generated/core/queryKeySerializer.gen.ts +117 -0
- package/src/generated/core/serverSentEvents.gen.ts +242 -0
- package/src/generated/core/types.gen.ts +110 -0
- package/src/generated/core/utils.gen.ts +140 -0
- package/src/generated/index.ts +268 -0
- package/src/generated/sdk.gen.ts +1590 -0
- package/src/generated/types.gen.ts +2089 -0
- package/src/generated/zod.gen.ts +358 -0
- package/src/index.ts +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 twilio.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# @gtmi/ramp-api-client
|
|
2
|
+
|
|
3
|
+
Type-safe SDK for the **RAMP API server** (`apps/api`). Auto-generated from the
|
|
4
|
+
app's committed OpenAPI spec with [`@hey-api/openapi-ts`](https://heyapi.dev),
|
|
5
|
+
shipping tree-shakeable per-operation functions, request/response types, and
|
|
6
|
+
runtime [zod](https://zod.dev) schemas.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
pnpm add @gtmi/ramp-api-client
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { createRampApiClient, postConversations } from '@gtmi/ramp-api-client';
|
|
18
|
+
|
|
19
|
+
const client = createRampApiClient({
|
|
20
|
+
baseUrl: process.env.RAMP_API_URL!,
|
|
21
|
+
getAuthToken: () => process.env.CR_SERVER_API_KEY!, // sent as `Authorization: Bearer …`
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const { data, error } = await postConversations({
|
|
25
|
+
client,
|
|
26
|
+
body: { configurationId: 'cfg_123' },
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Every operation accepts the `client` returned by `createRampApiClient`. Without
|
|
31
|
+
`getAuthToken`, no `Authorization` header is sent (use for public endpoints).
|
|
32
|
+
|
|
33
|
+
### Runtime validation
|
|
34
|
+
|
|
35
|
+
Generated zod schemas are exported under `schemas`:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { schemas } from '@gtmi/ramp-api-client';
|
|
39
|
+
|
|
40
|
+
schemas.zPostConversationsBody.parse(input);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## A note on response types
|
|
44
|
+
|
|
45
|
+
Request inputs are fully typed and zod-validated. Response types are only as
|
|
46
|
+
rich as the OpenAPI spec's response schemas, which are sparse today — many
|
|
47
|
+
responses are loosely typed until handler `@response` JSDoc is enriched. As that
|
|
48
|
+
JSDoc lands, regenerating this SDK upgrades the response types with no API
|
|
49
|
+
change here.
|
|
50
|
+
|
|
51
|
+
## Regenerating
|
|
52
|
+
|
|
53
|
+
This package is generated from `apps/api/public/openapi.json`:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
pnpm --filter @gtmi/ramp-api-client generate
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`src/generated/` is committed and drift-checked in CI. Do not edit it by hand.
|