@textbee/sdk 0.0.1 → 0.0.3
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 +9 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @textbee/sdk
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@textbee/sdk)
|
|
4
|
+
[](https://github.com/textbee/textbee-js/actions/workflows/ci.yaml)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
|
|
3
7
|
Official JavaScript SDK for [textbee.dev](https://textbee.dev), the open source SMS gateway that turns an Android phone into an SMS API.
|
|
4
8
|
|
|
5
9
|
Zero dependencies, TypeScript types included, works in Node 18+, Bun, Deno, Cloudflare Workers, and Vercel Edge.
|
|
@@ -70,12 +74,15 @@ await textbee.setDefaultDevice(deviceId)
|
|
|
70
74
|
```js
|
|
71
75
|
// Paginated history, filterable and searchable
|
|
72
76
|
const { data, meta } = await textbee.getMessages(deviceId, {
|
|
73
|
-
type: 'received', // 'all' | 'sent' | 'received'
|
|
77
|
+
type: 'received', // filter is lowercase: 'all' | 'sent' | 'received'
|
|
74
78
|
page: 1,
|
|
75
79
|
limit: 50,
|
|
76
80
|
search: 'invoice',
|
|
77
81
|
})
|
|
78
82
|
|
|
83
|
+
// Each message reports its direction uppercase, so compare accordingly
|
|
84
|
+
data.filter((m) => m.type === 'RECEIVED')
|
|
85
|
+
|
|
79
86
|
// A single message and its current status
|
|
80
87
|
const sms = await textbee.getSms(deviceId, smsId)
|
|
81
88
|
|
|
@@ -133,7 +140,7 @@ new Textbee({
|
|
|
133
140
|
|
|
134
141
|
## What is not covered yet
|
|
135
142
|
|
|
136
|
-
|
|
143
|
+
The SDK focuses on sending and reading messages. Bulk send and a few device operations are still REST only, documented at [textbee.dev/docs](https://textbee.dev/docs).
|
|
137
144
|
|
|
138
145
|
## License
|
|
139
146
|
|
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var TextbeeError = class extends Error {
|
|
|
42
42
|
|
|
43
43
|
// src/client.ts
|
|
44
44
|
var DEFAULT_BASE_URL = "https://api.textbee.dev/api/v1";
|
|
45
|
-
var CLIENT_ID = `textbee-js/${"0.0.
|
|
45
|
+
var CLIENT_ID = `textbee-js/${"0.0.3"}`;
|
|
46
46
|
var Textbee = class {
|
|
47
47
|
#apiKey;
|
|
48
48
|
#baseUrl;
|
package/dist/index.d.cts
CHANGED
|
@@ -85,8 +85,13 @@ interface Device {
|
|
|
85
85
|
interface Message {
|
|
86
86
|
_id: string;
|
|
87
87
|
message: string;
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Direction, uppercase. Note the asymmetry with the `type` filter accepted by
|
|
90
|
+
* getMessages, which is lowercase.
|
|
91
|
+
*/
|
|
92
|
+
type: 'SENT' | 'RECEIVED';
|
|
93
|
+
/** Lowercase, and absent on messages stored before status tracking. */
|
|
94
|
+
status?: 'pending' | 'dispatched' | 'sent' | 'delivered' | 'failed' | 'unknown' | 'received';
|
|
90
95
|
sender?: string;
|
|
91
96
|
recipient?: string;
|
|
92
97
|
requestedAt?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -85,8 +85,13 @@ interface Device {
|
|
|
85
85
|
interface Message {
|
|
86
86
|
_id: string;
|
|
87
87
|
message: string;
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Direction, uppercase. Note the asymmetry with the `type` filter accepted by
|
|
90
|
+
* getMessages, which is lowercase.
|
|
91
|
+
*/
|
|
92
|
+
type: 'SENT' | 'RECEIVED';
|
|
93
|
+
/** Lowercase, and absent on messages stored before status tracking. */
|
|
94
|
+
status?: 'pending' | 'dispatched' | 'sent' | 'delivered' | 'failed' | 'unknown' | 'received';
|
|
90
95
|
sender?: string;
|
|
91
96
|
recipient?: string;
|
|
92
97
|
requestedAt?: string;
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var TextbeeError = class extends Error {
|
|
|
14
14
|
|
|
15
15
|
// src/client.ts
|
|
16
16
|
var DEFAULT_BASE_URL = "https://api.textbee.dev/api/v1";
|
|
17
|
-
var CLIENT_ID = `textbee-js/${"0.0.
|
|
17
|
+
var CLIENT_ID = `textbee-js/${"0.0.3"}`;
|
|
18
18
|
var Textbee = class {
|
|
19
19
|
#apiKey;
|
|
20
20
|
#baseUrl;
|