mailmeteor 0.0.9 → 0.0.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Mailmeteor SDK
2
2
 
3
- Official Mailmeteor SDK for Node.js and TypeScript.
3
+ Official (not yet public) Mailmeteor SDK for Node.js and TypeScript.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,7 @@ import { Mailmeteor } from 'mailmeteor'
18
18
  const mailmeteor = new Mailmeteor('your-api-key')
19
19
 
20
20
  // Use the SDK
21
- const subscriptions = await mailmeteor.billingSubscription.getSubscriptions()
21
+ const subscriptions = await mailmeteor.emails.send()
22
22
  ```
23
23
 
24
24
  ### Custom Base URL
@@ -29,14 +29,6 @@ You can specify a custom base URL when initializing the SDK:
29
29
  const mailmeteor = new MailmeteorSDK('your-api-key', { baseUrl: 'https://custom-api.example.com/v1' })
30
30
  ```
31
31
 
32
- ## API Resources
33
-
34
- The SDK provides access to the following resources:
35
-
36
- - `billingAddons` - Manage billing add-ons
37
- - `billingSubscription` - Manage billing subscriptions
38
- - `billing` - General billing operations
39
-
40
32
  ## TypeScript Support
41
33
 
42
34
  The SDK is written in TypeScript and includes complete type definitions. You can import types from the SDK:
package/dist/index.cjs CHANGED
@@ -905,7 +905,7 @@ class HeyApiRegistry2 {
905
905
  get(key) {
906
906
  const instance = this.instances.get(key ?? this.defaultKey);
907
907
  if (!instance) {
908
- throw new Error(`No SDK client found. Create one with "new OrganizationMembers()" to fix this error.`);
908
+ throw new Error(`No SDK client found. Create one with "new OrganizationMembers2()" to fix this error.`);
909
909
  }
910
910
  return instance;
911
911
  }
@@ -937,7 +937,7 @@ class HeyApiRegistry4 {
937
937
  get(key) {
938
938
  const instance = this.instances.get(key ?? this.defaultKey);
939
939
  if (!instance) {
940
- throw new Error(`No SDK client found. Create one with "new ContactLists2()" to fix this error.`);
940
+ throw new Error(`No SDK client found. Create one with "new BillingSubscription2()" to fix this error.`);
941
941
  }
942
942
  return instance;
943
943
  }
@@ -953,7 +953,7 @@ class HeyApiRegistry5 {
953
953
  get(key) {
954
954
  const instance = this.instances.get(key ?? this.defaultKey);
955
955
  if (!instance) {
956
- throw new Error(`No SDK client found. Create one with "new Contacts2()" to fix this error.`);
956
+ throw new Error(`No SDK client found. Create one with "new ContactLists2()" to fix this error.`);
957
957
  }
958
958
  return instance;
959
959
  }
@@ -969,7 +969,7 @@ class HeyApiRegistry6 {
969
969
  get(key) {
970
970
  const instance = this.instances.get(key ?? this.defaultKey);
971
971
  if (!instance) {
972
- throw new Error(`No SDK client found. Create one with "new BillingAddons2()" to fix this error.`);
972
+ throw new Error(`No SDK client found. Create one with "new Contacts2()" to fix this error.`);
973
973
  }
974
974
  return instance;
975
975
  }
@@ -985,7 +985,7 @@ class HeyApiRegistry7 {
985
985
  get(key) {
986
986
  const instance = this.instances.get(key ?? this.defaultKey);
987
987
  if (!instance) {
988
- throw new Error(`No SDK client found. Create one with "new BillingSubscription2()" to fix this error.`);
988
+ throw new Error(`No SDK client found. Create one with "new BillingAddons2()" to fix this error.`);
989
989
  }
990
990
  return instance;
991
991
  }
@@ -1026,6 +1026,15 @@ class HeyApiRegistry9 {
1026
1026
  }
1027
1027
  }
1028
1028
  class Users extends HeyApiClient {
1029
+ retrieve(user_id, parameters, options) {
1030
+ const params = buildClientParams([user_id, parameters], [{ in: 'path', key: 'user_id' }, { args: [{ in: 'query', key: 'expand' }] }]);
1031
+ return (options?.client ?? this.client).get({
1032
+ responseStyle: 'data',
1033
+ url: '/users/{user_id}',
1034
+ ...options,
1035
+ ...params
1036
+ });
1037
+ }
1029
1038
  getCurrentOrganization(user_id, options) {
1030
1039
  const params = buildClientParams([user_id], [{ in: 'path', key: 'user_id' }]);
1031
1040
  return (options?.client ?? this.client).get({
@@ -1083,7 +1092,7 @@ class Users2 extends HeyApiClient {
1083
1092
  }
1084
1093
  }
1085
1094
  Users2.__registry = new HeyApiRegistry();
1086
- class OrganizationMember extends HeyApiClient {
1095
+ class OrganizationMembers extends HeyApiClient {
1087
1096
  list(organization_id, parameters, options) {
1088
1097
  const params = buildClientParams([organization_id, parameters], [{ in: 'path', key: 'organization_id' }, { args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'starting_after' }] }]);
1089
1098
  return (options?.client ?? this.client).get({
@@ -1094,7 +1103,7 @@ class OrganizationMember extends HeyApiClient {
1094
1103
  });
1095
1104
  }
1096
1105
  create(organization_id, parameters, options) {
1097
- const params = buildClientParams([organization_id, parameters], [{ in: 'path', key: 'organization_id' }, { args: [{ in: 'body', key: 'email' }, { in: 'body', key: 'role' }] }]);
1106
+ const params = buildClientParams([organization_id, parameters], [{ in: 'path', key: 'organization_id' }, { args: [{ in: 'body', key: 'email' }, { in: 'body', key: 'roles' }] }]);
1098
1107
  return (options?.client ?? this.client).post({
1099
1108
  responseStyle: 'data',
1100
1109
  url: '/organizations/{organization_id}/members',
@@ -1124,7 +1133,7 @@ class OrganizationMember extends HeyApiClient {
1124
1133
  ], [
1125
1134
  { in: 'path', key: 'organization_id' },
1126
1135
  { in: 'path', key: 'member_id' },
1127
- { args: [{ in: 'body', key: 'role' }] }
1136
+ { args: [{ in: 'body', key: 'roles' }] }
1128
1137
  ]);
1129
1138
  return (options?.client ?? this.client).patch({
1130
1139
  responseStyle: 'data',
@@ -1139,16 +1148,16 @@ class OrganizationMember extends HeyApiClient {
1139
1148
  });
1140
1149
  }
1141
1150
  }
1142
- class OrganizationMembers extends HeyApiClient {
1151
+ class OrganizationMembers2 extends HeyApiClient {
1143
1152
  constructor(args) {
1144
1153
  super(args);
1145
- OrganizationMembers.__registry.set(this, args?.key);
1154
+ OrganizationMembers2.__registry.set(this, args?.key);
1146
1155
  }
1147
- get organizationMember() {
1148
- return this._organizationMember ?? (this._organizationMember = new OrganizationMember({ client: this.client }));
1156
+ get organizationMembers() {
1157
+ return this._organizationMembers ?? (this._organizationMembers = new OrganizationMembers({ client: this.client }));
1149
1158
  }
1150
1159
  }
1151
- OrganizationMembers.__registry = new HeyApiRegistry2();
1160
+ OrganizationMembers2.__registry = new HeyApiRegistry2();
1152
1161
  class Organizations extends HeyApiClient {
1153
1162
  list(options) {
1154
1163
  return (options?.client ?? this.client).get({
@@ -1214,6 +1223,71 @@ class Organizations2 extends HeyApiClient {
1214
1223
  }
1215
1224
  }
1216
1225
  Organizations2.__registry = new HeyApiRegistry3();
1226
+ class BillingSubscription extends HeyApiClient {
1227
+ get(options) {
1228
+ return (options?.client ?? this.client).get({
1229
+ responseStyle: 'data',
1230
+ url: '/billing/subscription',
1231
+ ...options
1232
+ });
1233
+ }
1234
+ update(parameters, options) {
1235
+ const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'plan' }, { in: 'body', key: 'billing_period' }] }]);
1236
+ return (options?.client ?? this.client).post({
1237
+ responseStyle: 'data',
1238
+ url: '/billing/subscription',
1239
+ ...options,
1240
+ ...params,
1241
+ headers: {
1242
+ 'Content-Type': 'application/json',
1243
+ ...options?.headers,
1244
+ ...params.headers
1245
+ }
1246
+ });
1247
+ }
1248
+ previewUpdate(parameters, options) {
1249
+ const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'plan' }, { in: 'body', key: 'billing_period' }] }]);
1250
+ return (options?.client ?? this.client).post({
1251
+ responseStyle: 'data',
1252
+ url: '/billing/subscription/preview',
1253
+ ...options,
1254
+ ...params,
1255
+ headers: {
1256
+ 'Content-Type': 'application/json',
1257
+ ...options?.headers,
1258
+ ...params.headers
1259
+ }
1260
+ });
1261
+ }
1262
+ checkout(parameters, options) {
1263
+ const params = buildClientParams([parameters], [{ args: [
1264
+ { in: 'body', key: 'price_id' },
1265
+ { in: 'body', key: 'coupon' },
1266
+ { in: 'body', key: 'currency' }
1267
+ ] }]);
1268
+ return (options?.client ?? this.client).post({
1269
+ responseStyle: 'data',
1270
+ url: '/billing/subscription/checkout',
1271
+ ...options,
1272
+ ...params,
1273
+ headers: {
1274
+ 'Content-Type': 'application/json',
1275
+ ...options?.headers,
1276
+ ...params.headers
1277
+ }
1278
+ });
1279
+ }
1280
+ }
1281
+ class BillingSubscription2 extends HeyApiClient {
1282
+ constructor(args) {
1283
+ super(args);
1284
+ BillingSubscription2.__registry.set(this, args?.key);
1285
+ }
1286
+ get billingSubscription() {
1287
+ return this._billingSubscription ?? (this._billingSubscription = new BillingSubscription({ client: this.client }));
1288
+ }
1289
+ }
1290
+ BillingSubscription2.__registry = new HeyApiRegistry4();
1217
1291
  class ContactLists extends HeyApiClient {
1218
1292
  create(parameters, options) {
1219
1293
  const params = buildClientParams([parameters], [{ args: [
@@ -1280,7 +1354,7 @@ class ContactLists2 extends HeyApiClient {
1280
1354
  return this._contactLists ?? (this._contactLists = new ContactLists({ client: this.client }));
1281
1355
  }
1282
1356
  }
1283
- ContactLists2.__registry = new HeyApiRegistry4();
1357
+ ContactLists2.__registry = new HeyApiRegistry5();
1284
1358
  class Contacts extends HeyApiClient {
1285
1359
  delAll(parameters, options) {
1286
1360
  const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'contact_list' }] }]);
@@ -1438,7 +1512,7 @@ class Contacts2 extends HeyApiClient {
1438
1512
  return this._contacts ?? (this._contacts = new Contacts({ client: this.client }));
1439
1513
  }
1440
1514
  }
1441
- Contacts2.__registry = new HeyApiRegistry5();
1515
+ Contacts2.__registry = new HeyApiRegistry6();
1442
1516
  class BillingAddons extends HeyApiClient {
1443
1517
  getAddons(options) {
1444
1518
  return (options?.client ?? this.client).get({
@@ -1494,54 +1568,7 @@ class BillingAddons2 extends HeyApiClient {
1494
1568
  return this._billingAddons ?? (this._billingAddons = new BillingAddons({ client: this.client }));
1495
1569
  }
1496
1570
  }
1497
- BillingAddons2.__registry = new HeyApiRegistry6();
1498
- class BillingSubscription extends HeyApiClient {
1499
- get(options) {
1500
- return (options?.client ?? this.client).get({
1501
- responseStyle: 'data',
1502
- url: '/billing/subscription',
1503
- ...options
1504
- });
1505
- }
1506
- update(parameters, options) {
1507
- const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'plan' }, { in: 'body', key: 'billing_period' }] }]);
1508
- return (options?.client ?? this.client).post({
1509
- responseStyle: 'data',
1510
- url: '/billing/subscription',
1511
- ...options,
1512
- ...params,
1513
- headers: {
1514
- 'Content-Type': 'application/json',
1515
- ...options?.headers,
1516
- ...params.headers
1517
- }
1518
- });
1519
- }
1520
- previewUpdate(parameters, options) {
1521
- const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'plan' }, { in: 'body', key: 'billing_period' }] }]);
1522
- return (options?.client ?? this.client).post({
1523
- responseStyle: 'data',
1524
- url: '/billing/subscription/preview',
1525
- ...options,
1526
- ...params,
1527
- headers: {
1528
- 'Content-Type': 'application/json',
1529
- ...options?.headers,
1530
- ...params.headers
1531
- }
1532
- });
1533
- }
1534
- }
1535
- class BillingSubscription2 extends HeyApiClient {
1536
- constructor(args) {
1537
- super(args);
1538
- BillingSubscription2.__registry.set(this, args?.key);
1539
- }
1540
- get billingSubscription() {
1541
- return this._billingSubscription ?? (this._billingSubscription = new BillingSubscription({ client: this.client }));
1542
- }
1543
- }
1544
- BillingSubscription2.__registry = new HeyApiRegistry7();
1571
+ BillingAddons2.__registry = new HeyApiRegistry7();
1545
1572
  class Billing extends HeyApiClient {
1546
1573
  getPrices(parameters, options) {
1547
1574
  const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'currency' }] }]);
@@ -1582,12 +1609,29 @@ var types_gen = /*#__PURE__*/Object.freeze({
1582
1609
  __proto__: null
1583
1610
  });
1584
1611
 
1612
+ function querySerializer(query) {
1613
+ const parts = [];
1614
+ for (const [key, value] of Object.entries(query)) {
1615
+ if (value === undefined || value === null)
1616
+ continue;
1617
+ if (Array.isArray(value)) {
1618
+ for (const item of value) {
1619
+ parts.push(`${encodeURIComponent(key)}[]=${encodeURIComponent(String(item))}`);
1620
+ }
1621
+ }
1622
+ else {
1623
+ parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
1624
+ }
1625
+ }
1626
+ return parts.join('&');
1627
+ }
1585
1628
  class Mailmeteor {
1586
1629
  constructor(key, config) {
1587
- const baseUrl = config?.baseUrl || "https://mailmeteor-emailservice-dev.appspot.com/v1";
1630
+ const baseUrl = config?.baseUrl || "https://api.mailmeteor.com/v1";
1588
1631
  this.client = createClient(createConfig({
1589
1632
  baseUrl,
1590
1633
  throwOnError: true,
1634
+ querySerializer,
1591
1635
  headers: {
1592
1636
  'Authorization': `Bearer ${key}`,
1593
1637
  },