@linebundle-sdk/ts 1.0.0-rc.4 → 1.0.0-rc.40
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/README.md +79 -27
- package/esm/index.d.ts +14428 -3
- package/esm/index.js +2969 -2
- package/esm/index.js.map +1 -1
- package/package.json +27 -18
- package/tsup.config.ts +11 -0
- package/esm/client/client.gen.d.ts +0 -3
- package/esm/client/client.gen.d.ts.map +0 -1
- package/esm/client/client.gen.js +0 -236
- package/esm/client/client.gen.js.map +0 -1
- package/esm/client/index.d.ts +0 -9
- package/esm/client/index.d.ts.map +0 -1
- package/esm/client/index.js +0 -7
- package/esm/client/index.js.map +0 -1
- package/esm/client/types.gen.d.ts +0 -118
- package/esm/client/types.gen.d.ts.map +0 -1
- package/esm/client/types.gen.js +0 -3
- package/esm/client/types.gen.js.map +0 -1
- package/esm/client/utils.gen.d.ts +0 -34
- package/esm/client/utils.gen.d.ts.map +0 -1
- package/esm/client/utils.gen.js +0 -231
- package/esm/client/utils.gen.js.map +0 -1
- package/esm/client.gen.d.ts +0 -13
- package/esm/client.gen.d.ts.map +0 -1
- package/esm/client.gen.js +0 -4
- package/esm/client.gen.js.map +0 -1
- package/esm/core/auth.gen.d.ts +0 -19
- package/esm/core/auth.gen.d.ts.map +0 -1
- package/esm/core/auth.gen.js +0 -15
- package/esm/core/auth.gen.js.map +0 -1
- package/esm/core/bodySerializer.gen.d.ts +0 -26
- package/esm/core/bodySerializer.gen.d.ts.map +0 -1
- package/esm/core/bodySerializer.gen.js +0 -58
- package/esm/core/bodySerializer.gen.js.map +0 -1
- package/esm/core/params.gen.d.ts +0 -44
- package/esm/core/params.gen.d.ts.map +0 -1
- package/esm/core/params.gen.js +0 -101
- package/esm/core/params.gen.js.map +0 -1
- package/esm/core/pathSerializer.gen.d.ts +0 -34
- package/esm/core/pathSerializer.gen.d.ts.map +0 -1
- package/esm/core/pathSerializer.gen.js +0 -107
- package/esm/core/pathSerializer.gen.js.map +0 -1
- package/esm/core/queryKeySerializer.gen.d.ts +0 -19
- package/esm/core/queryKeySerializer.gen.d.ts.map +0 -1
- package/esm/core/queryKeySerializer.gen.js +0 -93
- package/esm/core/queryKeySerializer.gen.js.map +0 -1
- package/esm/core/serverSentEvents.gen.d.ts +0 -72
- package/esm/core/serverSentEvents.gen.d.ts.map +0 -1
- package/esm/core/serverSentEvents.gen.js +0 -134
- package/esm/core/serverSentEvents.gen.js.map +0 -1
- package/esm/core/types.gen.d.ts +0 -79
- package/esm/core/types.gen.d.ts.map +0 -1
- package/esm/core/types.gen.js +0 -3
- package/esm/core/types.gen.js.map +0 -1
- package/esm/core/utils.gen.d.ts +0 -20
- package/esm/core/utils.gen.d.ts.map +0 -1
- package/esm/core/utils.gen.js +0 -88
- package/esm/core/utils.gen.js.map +0 -1
- package/esm/index.d.ts.map +0 -1
- package/esm/sdk.gen.d.ts +0 -1854
- package/esm/sdk.gen.d.ts.map +0 -1
- package/esm/sdk.gen.js +0 -3875
- package/esm/sdk.gen.js.map +0 -1
- package/esm/types.gen.d.ts +0 -12463
- package/esm/types.gen.d.ts.map +0 -1
- package/esm/types.gen.js +0 -3
- package/esm/types.gen.js.map +0 -1
- package/esm/zod.gen.d.ts +0 -8634
- package/esm/zod.gen.d.ts.map +0 -1
- package/esm/zod.gen.js +0 -4430
- package/esm/zod.gen.js.map +0 -1
- package/scripts/fix-esm-extensions.mjs +0 -31
package/README.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @linebundle-sdk/ts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@linebundle-sdk/ts)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://docs.linebundle.com/sdks/typescript)
|
|
6
|
+
|
|
7
|
+
Auto-generated, type-safe TypeScript client for the [LineBundle API](https://linebundle.com). Generated from the OpenAPI spec on every release — types and methods are always up to date.
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- Node.js 18+ (or any runtime with native `fetch`)
|
|
12
|
+
- ESM project (`"type": "module"`)
|
|
4
13
|
|
|
5
14
|
## Installation
|
|
6
15
|
|
|
@@ -8,47 +17,90 @@ Type-safe TypeScript SDK for the [LineBundle API](https://docs.linebundle.com).
|
|
|
8
17
|
npm install @linebundle-sdk/ts
|
|
9
18
|
```
|
|
10
19
|
|
|
20
|
+
## Get your API credential
|
|
21
|
+
|
|
22
|
+
Generate a token inside the [LineBundle Studio](https://studio.linebundle.com):
|
|
23
|
+
**Organization → Settings → API Credentials → New Credential**
|
|
24
|
+
|
|
25
|
+
Then set your environment variables:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
LINEBUNDLE_TOKEN=sk_lb_your_token_here
|
|
29
|
+
LINEBUNDLE_ORG_ID=your-org-uuid-here
|
|
30
|
+
```
|
|
31
|
+
|
|
11
32
|
## Quick Start
|
|
12
33
|
|
|
13
34
|
```typescript
|
|
14
|
-
import {
|
|
35
|
+
import { createLinebundle } from '@linebundle-sdk/ts';
|
|
15
36
|
|
|
16
|
-
const
|
|
17
|
-
|
|
37
|
+
const lb = createLinebundle({
|
|
38
|
+
token: process.env.LINEBUNDLE_TOKEN!,
|
|
39
|
+
orgId: process.env.LINEBUNDLE_ORG_ID!,
|
|
18
40
|
});
|
|
19
41
|
|
|
20
|
-
// List events
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
// List upcoming events
|
|
43
|
+
const { data, error } = await lb.events.list({
|
|
44
|
+
query: { page: 1, size: 20, sort_by: 'start_dt', sort_dir: 'asc' },
|
|
45
|
+
});
|
|
46
|
+
if (error) throw error;
|
|
47
|
+
console.log(data.items); // typed EventResponse[]
|
|
48
|
+
|
|
49
|
+
// Get a single event
|
|
50
|
+
const { data: event } = await lb.events.get({ path: { id: 123 } });
|
|
51
|
+
console.log(event.title);
|
|
52
|
+
|
|
53
|
+
// List spaces
|
|
54
|
+
const { data: spaces } = await lb.spaces.list({
|
|
55
|
+
query: { page: 1, size: 50, sort_by: 'title', sort_dir: 'asc' },
|
|
33
56
|
});
|
|
34
57
|
```
|
|
35
58
|
|
|
36
|
-
##
|
|
59
|
+
## Response Pattern
|
|
60
|
+
|
|
61
|
+
Every method returns `{ data, error, response }`. HTTP errors are captured in `error` — **they never throw**:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
const { data, error, response } = await lb.events.get({ path: { id: 123 } });
|
|
65
|
+
|
|
66
|
+
if (error) {
|
|
67
|
+
if (response.status === 404) console.warn('Not found');
|
|
68
|
+
else throw error;
|
|
69
|
+
} else {
|
|
70
|
+
console.log(data.title);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## TypeScript Types
|
|
75
|
+
|
|
76
|
+
All types are generated from the API schema and exported from the package:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import type { Event, Space } from '@linebundle-sdk/ts';
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Environments
|
|
83
|
+
|
|
84
|
+
| Environment | Base URL |
|
|
85
|
+
|-------------|----------|
|
|
86
|
+
| Production | `https://api.linebundle.com` (default) |
|
|
87
|
+
| Staging | `https://staging-api.linebundle.com` |
|
|
37
88
|
|
|
38
|
-
|
|
89
|
+
To use staging, pass `baseUrl`:
|
|
39
90
|
|
|
40
91
|
```typescript
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
92
|
+
const lb = createLinebundle({
|
|
93
|
+
token: process.env.LINEBUNDLE_TOKEN!,
|
|
94
|
+
orgId: process.env.LINEBUNDLE_ORG_ID!,
|
|
95
|
+
baseUrl: 'https://staging-api.linebundle.com',
|
|
46
96
|
});
|
|
47
97
|
```
|
|
48
98
|
|
|
49
|
-
##
|
|
99
|
+
## Documentation
|
|
50
100
|
|
|
51
|
-
|
|
101
|
+
- **Full SDK guide**: https://docs.linebundle.com/sdks/typescript
|
|
102
|
+
- **API Reference**: https://docs.linebundle.com/sdk-reference/events
|
|
103
|
+
- **Changelog**: https://docs.linebundle.com/changelog
|
|
52
104
|
|
|
53
105
|
## License
|
|
54
106
|
|