@marteye/studiojs 1.1.48 → 1.1.49-beta.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 +23 -101
- package/dist/index.common.d.ts +1 -0
- package/dist/index.d.ts +644 -259
- package/dist/index.esm.js +1158 -747
- package/dist/index.js +1172 -746
- package/dist/media-crate-client.d.ts +285 -0
- package/dist/net/http.d.ts +3 -3
- package/dist/resources/actions.d.ts +0 -1
- package/dist/resources/customerLists.d.ts +17 -1
- package/dist/resources/payouts.d.ts +4 -0
- package/dist/resources/productCodes.d.ts +5 -1
- package/dist/resources/webhooks.d.ts +0 -1
- package/dist/resources.d.ts +128 -127
- package/dist/studio.d.ts +128 -127
- package/dist/types.d.ts +48 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,130 +1,52 @@
|
|
|
1
|
-
# MartEye Studio JavaScript SDK (
|
|
1
|
+
# MartEye Studio JavaScript SDK (@marteye/studiojs)
|
|
2
2
|
|
|
3
|
-
JavaScript
|
|
3
|
+
This library is a JavaScript SDK that allows you to easily integrate with MartEye Studio's API. It provides methods to interact with various resources, manage data, and leverage the powerful features offered by MartEye Studio.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install @marteye/studiojs
|
|
9
|
-
```
|
|
7
|
+
You can install the library using npm or yarn:
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
Using npm:
|
|
12
10
|
|
|
13
11
|
```bash
|
|
14
|
-
npm install @marteye/studiojs
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Create a client
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import Studio from "@marteye/studiojs";
|
|
21
|
-
|
|
22
|
-
const studio = Studio({
|
|
23
|
-
apiKey: process.env.STUDIO_API_KEY!,
|
|
24
|
-
baseUrl: "https://app.marteyestudio.com/api", // optional
|
|
25
|
-
defaultTimeout: 30000, // optional
|
|
26
|
-
debug: false, // optional
|
|
27
|
-
});
|
|
12
|
+
npm install @marteye/studiojs
|
|
28
13
|
```
|
|
29
14
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```ts
|
|
33
|
-
const market = await studio.markets.get("greenfields");
|
|
34
|
-
console.log(market.name);
|
|
15
|
+
Using yarn:
|
|
35
16
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
end: "2026-12-31",
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
console.log(sales.sales.length);
|
|
17
|
+
```bash
|
|
18
|
+
yarn add @marteye/studiojs
|
|
42
19
|
```
|
|
43
20
|
|
|
44
|
-
##
|
|
21
|
+
## Usage
|
|
45
22
|
|
|
46
|
-
|
|
23
|
+
### Importing the Library
|
|
47
24
|
|
|
48
|
-
|
|
49
|
-
- `studio.broadcast.get(...)`
|
|
25
|
+
Using ES Modules:
|
|
50
26
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- `type`: `"sms" | "email"`
|
|
54
|
-
- `kind`: `"broadcast" | "statement"`
|
|
55
|
-
|
|
56
|
-
### Send an SMS broadcast
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
await studio.broadcast.send("greenfields", {
|
|
60
|
-
type: "sms",
|
|
61
|
-
kind: "broadcast",
|
|
62
|
-
message: "Sale starts at 7pm",
|
|
63
|
-
recipients: [
|
|
64
|
-
{
|
|
65
|
-
customerId: "customer-1",
|
|
66
|
-
phoneNumbers: ["+447911123456"],
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
});
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Send a statement email
|
|
73
|
-
|
|
74
|
-
```ts
|
|
75
|
-
await studio.broadcast.send("greenfields", {
|
|
76
|
-
type: "email",
|
|
77
|
-
kind: "statement",
|
|
78
|
-
message: "Dear {{customerName}}, your balance is {{balance}}.",
|
|
79
|
-
recipients: [
|
|
80
|
-
{
|
|
81
|
-
customerId: "customer-1",
|
|
82
|
-
emails: ["buyer@example.com"],
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
});
|
|
27
|
+
```javascript
|
|
28
|
+
import StudioJS from "@marteye/studiojs";
|
|
86
29
|
```
|
|
87
30
|
|
|
88
|
-
|
|
31
|
+
Or using CommonJS:
|
|
89
32
|
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
console.log(task.status);
|
|
33
|
+
```javascript
|
|
34
|
+
let StudioJS = require("@marteye/studiojs");
|
|
93
35
|
```
|
|
94
36
|
|
|
95
|
-
|
|
37
|
+
### Initializing the SDK
|
|
96
38
|
|
|
97
|
-
|
|
39
|
+
Before using the library, initialize it with your API key. For more information on obtaining an API key, please contact your MartEye representative.
|
|
98
40
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
await studio.sms.sendSMS(marketId, payload);
|
|
103
|
-
await studio.sms.getSMS(marketId, smsId);
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### After
|
|
107
|
-
|
|
108
|
-
```ts
|
|
109
|
-
await studio.broadcast.send(marketId, {
|
|
110
|
-
type: "sms",
|
|
111
|
-
kind: "broadcast",
|
|
112
|
-
message: "Hello",
|
|
113
|
-
recipients: [{ customerId: "c1", phoneNumbers: ["+447911123456"] }],
|
|
41
|
+
```javascript
|
|
42
|
+
let studioClient = StudioJS.init({
|
|
43
|
+
apiKey: "YOUR_API_KEY_HERE",
|
|
114
44
|
});
|
|
115
|
-
|
|
116
|
-
await studio.broadcast.get(marketId, "sms", taskId);
|
|
117
45
|
```
|
|
118
46
|
|
|
119
|
-
##
|
|
120
|
-
|
|
121
|
-
Relevant exported types include:
|
|
47
|
+
## Contributing
|
|
122
48
|
|
|
123
|
-
|
|
124
|
-
- `BroadcastSendResponse`
|
|
125
|
-
- `BroadcastTask`
|
|
126
|
-
- `SMSTask`
|
|
127
|
-
- `EmailTask`
|
|
49
|
+
Contributions are welcome! Please open an issue or submit a pull request if you have suggestions or improvements.
|
|
128
50
|
|
|
129
51
|
## License
|
|
130
52
|
|
package/dist/index.common.d.ts
CHANGED