@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.
Files changed (72) hide show
  1. package/README.md +79 -27
  2. package/esm/index.d.ts +14428 -3
  3. package/esm/index.js +2969 -2
  4. package/esm/index.js.map +1 -1
  5. package/package.json +27 -18
  6. package/tsup.config.ts +11 -0
  7. package/esm/client/client.gen.d.ts +0 -3
  8. package/esm/client/client.gen.d.ts.map +0 -1
  9. package/esm/client/client.gen.js +0 -236
  10. package/esm/client/client.gen.js.map +0 -1
  11. package/esm/client/index.d.ts +0 -9
  12. package/esm/client/index.d.ts.map +0 -1
  13. package/esm/client/index.js +0 -7
  14. package/esm/client/index.js.map +0 -1
  15. package/esm/client/types.gen.d.ts +0 -118
  16. package/esm/client/types.gen.d.ts.map +0 -1
  17. package/esm/client/types.gen.js +0 -3
  18. package/esm/client/types.gen.js.map +0 -1
  19. package/esm/client/utils.gen.d.ts +0 -34
  20. package/esm/client/utils.gen.d.ts.map +0 -1
  21. package/esm/client/utils.gen.js +0 -231
  22. package/esm/client/utils.gen.js.map +0 -1
  23. package/esm/client.gen.d.ts +0 -13
  24. package/esm/client.gen.d.ts.map +0 -1
  25. package/esm/client.gen.js +0 -4
  26. package/esm/client.gen.js.map +0 -1
  27. package/esm/core/auth.gen.d.ts +0 -19
  28. package/esm/core/auth.gen.d.ts.map +0 -1
  29. package/esm/core/auth.gen.js +0 -15
  30. package/esm/core/auth.gen.js.map +0 -1
  31. package/esm/core/bodySerializer.gen.d.ts +0 -26
  32. package/esm/core/bodySerializer.gen.d.ts.map +0 -1
  33. package/esm/core/bodySerializer.gen.js +0 -58
  34. package/esm/core/bodySerializer.gen.js.map +0 -1
  35. package/esm/core/params.gen.d.ts +0 -44
  36. package/esm/core/params.gen.d.ts.map +0 -1
  37. package/esm/core/params.gen.js +0 -101
  38. package/esm/core/params.gen.js.map +0 -1
  39. package/esm/core/pathSerializer.gen.d.ts +0 -34
  40. package/esm/core/pathSerializer.gen.d.ts.map +0 -1
  41. package/esm/core/pathSerializer.gen.js +0 -107
  42. package/esm/core/pathSerializer.gen.js.map +0 -1
  43. package/esm/core/queryKeySerializer.gen.d.ts +0 -19
  44. package/esm/core/queryKeySerializer.gen.d.ts.map +0 -1
  45. package/esm/core/queryKeySerializer.gen.js +0 -93
  46. package/esm/core/queryKeySerializer.gen.js.map +0 -1
  47. package/esm/core/serverSentEvents.gen.d.ts +0 -72
  48. package/esm/core/serverSentEvents.gen.d.ts.map +0 -1
  49. package/esm/core/serverSentEvents.gen.js +0 -134
  50. package/esm/core/serverSentEvents.gen.js.map +0 -1
  51. package/esm/core/types.gen.d.ts +0 -79
  52. package/esm/core/types.gen.d.ts.map +0 -1
  53. package/esm/core/types.gen.js +0 -3
  54. package/esm/core/types.gen.js.map +0 -1
  55. package/esm/core/utils.gen.d.ts +0 -20
  56. package/esm/core/utils.gen.d.ts.map +0 -1
  57. package/esm/core/utils.gen.js +0 -88
  58. package/esm/core/utils.gen.js.map +0 -1
  59. package/esm/index.d.ts.map +0 -1
  60. package/esm/sdk.gen.d.ts +0 -1854
  61. package/esm/sdk.gen.d.ts.map +0 -1
  62. package/esm/sdk.gen.js +0 -3875
  63. package/esm/sdk.gen.js.map +0 -1
  64. package/esm/types.gen.d.ts +0 -12463
  65. package/esm/types.gen.d.ts.map +0 -1
  66. package/esm/types.gen.js +0 -3
  67. package/esm/types.gen.js.map +0 -1
  68. package/esm/zod.gen.d.ts +0 -8634
  69. package/esm/zod.gen.d.ts.map +0 -1
  70. package/esm/zod.gen.js +0 -4430
  71. package/esm/zod.gen.js.map +0 -1
  72. package/scripts/fix-esm-extensions.mjs +0 -31
package/README.md CHANGED
@@ -1,6 +1,15 @@
1
- # LineBundle TypeScript SDK
1
+ # @linebundle-sdk/ts
2
2
 
3
- Type-safe TypeScript SDK for the [LineBundle API](https://docs.linebundle.com).
3
+ [![npm](https://img.shields.io/npm/v/@linebundle-sdk/ts)](https://www.npmjs.com/package/@linebundle-sdk/ts)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
5
+ [![Docs](https://img.shields.io/badge/docs-linebundle.com-blue)](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 { Linebundle } from '@linebundle-sdk/ts';
35
+ import { createLinebundle } from '@linebundle-sdk/ts';
15
36
 
16
- const sdk = new Linebundle({
17
- auth: () => 'YOUR_API_KEY',
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 events = await sdk.events.list();
22
-
23
- // Create an event
24
- const event = await sdk.events.create({
25
- body: {
26
- title: 'My Event',
27
- start_dt: '2026-05-01',
28
- start_tm: '10:00',
29
- end_dt: '2026-05-01',
30
- end_tm: '14:00',
31
- timezone: 'Africa/Accra',
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
- ## Authentication
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
- Pass a bearer token via the `auth` option. The function is called per-request, so it handles token refresh automatically:
89
+ To use staging, pass `baseUrl`:
39
90
 
40
91
  ```typescript
41
- const sdk = new Linebundle({
42
- auth: async () => {
43
- const token = await getTokenFromYourAuthProvider();
44
- return token;
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
- ## SDK Reference
99
+ ## Documentation
50
100
 
51
- See the full [SDK Reference](https://docs.linebundle.com/sdk-reference/event) for all available methods.
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