@otterlabs/blocx 0.1.0
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 +64 -0
- package/dist/index.cjs +2243 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2591 -0
- package/dist/index.d.ts +2591 -0
- package/dist/index.js +2229 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @otterlabs/blocx
|
|
2
|
+
|
|
3
|
+
Official Blocx SDK — messaging, email, and 2FA verification.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @otterlabs/blocx
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { createBlocxClient, Messaging } from '@otterlabs/blocx'
|
|
15
|
+
|
|
16
|
+
const { client } = createBlocxClient({
|
|
17
|
+
accessKeyId: process.env.BLOCX_ACCESS_KEY_ID!,
|
|
18
|
+
secretAccessKey: process.env.BLOCX_SECRET_ACCESS_KEY!,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const res = await Messaging.sendMessage({
|
|
22
|
+
client,
|
|
23
|
+
body: {
|
|
24
|
+
to: '+15551234567',
|
|
25
|
+
from: '+15557654321',
|
|
26
|
+
body: 'Hello from the SDK!',
|
|
27
|
+
type: 'SMS',
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
console.log(res.data)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use `setDefault()` if you'd rather not pass `client` to every call:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
createBlocxClient({ accessKeyId, secretAccessKey }).setDefault()
|
|
38
|
+
await Messaging.sendMessage({ body: { /* ... */ } })
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Available service classes: `Messaging`, `Email`, `FaVerifications`,
|
|
42
|
+
`FaTemplates`, `Brands`, `Campaigns`, `PhoneNumbers`, `PhoneOrders`,
|
|
43
|
+
`MessagingProfiles`, `Compliance`, `Quotas`, `Balance`. Common methods include
|
|
44
|
+
`Messaging.sendMessage`, `Email.sendEmail`, `FaVerifications.createVerification`,
|
|
45
|
+
`FaVerifications.checkVerification`, `Brands.createBrand`, etc.
|
|
46
|
+
|
|
47
|
+
## Authentication
|
|
48
|
+
|
|
49
|
+
Every request needs:
|
|
50
|
+
|
|
51
|
+
- `x-access-key-id` — your API key ID
|
|
52
|
+
- `x-secret-access-key` — your API secret
|
|
53
|
+
|
|
54
|
+
Create keys in the dashboard under **Developer → API Keys**.
|
|
55
|
+
|
|
56
|
+
## Generated SDK
|
|
57
|
+
|
|
58
|
+
This package is fully generated from the public OpenAPI spec via
|
|
59
|
+
[`@hey-api/openapi-ts`](https://heyapi.dev). To regenerate after API changes:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm run generate # dumps openapi.json + runs codegen
|
|
63
|
+
npm run build # generates + bundles
|
|
64
|
+
```
|