@scaleway/sdk-tem 1.2.0 → 2.1.1

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 ADDED
@@ -0,0 +1,96 @@
1
+ # @scaleway/sdk-tem
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-tem.svg)](https://www.npmjs.com/package/@scaleway/sdk-tem)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-tem.svg)](https://www.npmjs.com/package/@scaleway/sdk-tem)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-tem.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Tem API.
8
+
9
+ > **Note**
10
+ > This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @scaleway/sdk-tem @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-tem @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-tem @scaleway/sdk-client
28
+ ```
29
+
30
+ ## Getting Started
31
+
32
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
33
+
34
+ ### Basic Usage
35
+
36
+ ```typescript
37
+ import { createClient } from '@scaleway/sdk-client'
38
+ import { Tem } from '@scaleway/sdk-tem'
39
+
40
+ const client = createClient({
41
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
42
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultRegion: 'fr-par',
45
+ defaultZone: 'fr-par-1',
46
+ })
47
+
48
+ const api = new Tem.v1.API(client)
49
+
50
+ // Use the API
51
+ // Example: await api.listServers()
52
+ ```
53
+
54
+ ### Using Configuration Loader
55
+
56
+ For a simpler setup, you can load credentials from the configuration file or environment variables:
57
+
58
+ ```typescript
59
+ import { createClient } from '@scaleway/sdk-client'
60
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
61
+ import { Tem } from '@scaleway/sdk-tem'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Tem.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Tem API Documentation](https://www.scaleway.com/en/developers/api/tem/)
72
+ - 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
73
+ - 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
74
+
75
+ ## Features
76
+
77
+ - ✅ Full TypeScript support with complete type definitions
78
+ - ✅ Promise-based API
79
+ - ✅ Automatic pagination helpers
80
+ - ✅ Built-in error handling
81
+ - ✅ Compatible with Node.js ≥ 20
82
+
83
+ ## Support
84
+
85
+ We love feedback! Feel free to reach us on:
86
+ - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
+ - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
+
89
+ ## Contributing
90
+
91
+ This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
92
+
93
+ ## License
94
+
95
+ This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
+
@@ -1,5 +1,5 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
3
  import type { BulkCreateBlocklistsRequest, BulkCreateBlocklistsResponse, CancelEmailRequest, CheckDomainRequest, CreateDomainRequest, CreateEmailRequest, CreateEmailResponse, CreateWebhookRequest, DeleteBlocklistRequest, DeleteWebhookRequest, Domain, DomainLastStatus, Email, GetDomainLastStatusRequest, GetDomainRequest, GetEmailRequest, GetProjectConsumptionRequest, GetProjectSettingsRequest, GetStatisticsRequest, GetWebhookRequest, ListBlocklistsRequest, ListBlocklistsResponse, ListDomainsRequest, ListDomainsResponse, ListEmailsRequest, ListEmailsResponse, ListOfferSubscriptionsRequest, ListOfferSubscriptionsResponse, ListOffersRequest, ListOffersResponse, ListPoolsRequest, ListPoolsResponse, ListWebhookEventsRequest, ListWebhookEventsResponse, ListWebhooksRequest, ListWebhooksResponse, OfferSubscription, ProjectConsumption, ProjectSettings, RevokeDomainRequest, Statistics, UpdateDomainRequest, UpdateOfferSubscriptionRequest, UpdateProjectSettingsRequest, UpdateWebhookRequest, Webhook } from './types.gen.js';
4
4
  /**
5
5
  * Transactional Email API.
@@ -13,7 +13,7 @@ export declare class API extends ParentAPI {
13
13
  */
14
14
  static readonly LOCALITY: ApiLocality;
15
15
  /**
16
- * Send an email. You must specify the `region`, the sender and the recipient's information and the `project_id` to send an email from a checked domain. The subject of the email must contain at least 6 characters.
16
+ * Send an email. You must specify the `region`, the sender and the recipient's information and the `project_id` to send an email from a checked domain.
17
17
  *
18
18
  * @param request - The request {@link CreateEmailRequest}
19
19
  * @returns A Promise of CreateEmailResponse
@@ -10,10 +10,12 @@ class API extends API$1 {
10
10
  * type ∈ {'zone','region','global','unspecified'}
11
11
  */
12
12
  static LOCALITY = toApiLocality({
13
- regions: ["fr-par"]
13
+ regions: [
14
+ "fr-par"
15
+ ]
14
16
  });
15
17
  /**
16
- * Send an email. You must specify the `region`, the sender and the recipient's information and the `project_id` to send an email from a checked domain. The subject of the email must contain at least 6 characters.
18
+ * Send an email. You must specify the `region`, the sender and the recipient's information and the `project_id` to send an email from a checked domain.
17
19
  *
18
20
  * @param request - The request {@link CreateEmailRequest}
19
21
  * @returns A Promise of CreateEmailResponse
@@ -68,10 +70,7 @@ class API extends API$1 {
68
70
  ["message_id", request.messageId],
69
71
  ["order_by", request.orderBy],
70
72
  ["page", request.page],
71
- [
72
- "page_size",
73
- request.pageSize ?? this.client.settings.defaultPageSize
74
- ],
73
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
75
74
  ["project_id", request.projectId],
76
75
  ["search", request.search],
77
76
  ["since", request.since],
@@ -175,10 +174,7 @@ class API extends API$1 {
175
174
  ["name", request.name],
176
175
  ["organization_id", request.organizationId],
177
176
  ["page", request.page],
178
- [
179
- "page_size",
180
- request.pageSize ?? this.client.settings.defaultPageSize
181
- ],
177
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
182
178
  ["project_id", request.projectId],
183
179
  ["status", request.status]
184
180
  )
@@ -278,10 +274,7 @@ class API extends API$1 {
278
274
  ["order_by", request.orderBy],
279
275
  ["organization_id", request.organizationId],
280
276
  ["page", request.page],
281
- [
282
- "page_size",
283
- request.pageSize ?? this.client.settings.defaultPageSize
284
- ],
277
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
285
278
  ["project_id", request.projectId]
286
279
  )
287
280
  },
@@ -329,10 +322,12 @@ class API extends API$1 {
329
322
  *
330
323
  * @param request - The request {@link DeleteWebhookRequest}
331
324
  */
332
- deleteWebhook = (request) => this.client.fetch({
333
- method: "DELETE",
334
- path: `/transactional-email/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/webhooks/${validatePathParam("webhookId", request.webhookId)}`
335
- });
325
+ deleteWebhook = (request) => this.client.fetch(
326
+ {
327
+ method: "DELETE",
328
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/webhooks/${validatePathParam("webhookId", request.webhookId)}`
329
+ }
330
+ );
336
331
  pageOfListWebhookEvents = (request) => this.client.fetch(
337
332
  {
338
333
  method: "GET",
@@ -344,10 +339,7 @@ class API extends API$1 {
344
339
  ["order_by", request.orderBy],
345
340
  ["organization_id", request.organizationId],
346
341
  ["page", request.page],
347
- [
348
- "page_size",
349
- request.pageSize ?? this.client.settings.defaultPageSize
350
- ],
342
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
351
343
  ["project_id", request.projectId],
352
344
  ["statuses", request.statuses]
353
345
  )
@@ -401,10 +393,7 @@ class API extends API$1 {
401
393
  ["email", request.email],
402
394
  ["order_by", request.orderBy],
403
395
  ["page", request.page],
404
- [
405
- "page_size",
406
- request.pageSize ?? this.client.settings.defaultPageSize
407
- ],
396
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
408
397
  ["type", request.type]
409
398
  )
410
399
  },
@@ -439,10 +428,12 @@ class API extends API$1 {
439
428
  *
440
429
  * @param request - The request {@link DeleteBlocklistRequest}
441
430
  */
442
- deleteBlocklist = (request) => this.client.fetch({
443
- method: "DELETE",
444
- path: `/transactional-email/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/blocklists/${validatePathParam("blocklistId", request.blocklistId)}`
445
- });
431
+ deleteBlocklist = (request) => this.client.fetch(
432
+ {
433
+ method: "DELETE",
434
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/blocklists/${validatePathParam("blocklistId", request.blocklistId)}`
435
+ }
436
+ );
446
437
  /**
447
438
  * Get information about subscribed offers. Retrieve information about the offers you are subscribed to using the `project_id` and `region` parameters.
448
439
  *
@@ -453,10 +444,9 @@ class API extends API$1 {
453
444
  {
454
445
  method: "GET",
455
446
  path: `/transactional-email/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/offer-subscriptions`,
456
- urlParams: urlParams([
457
- "project_id",
458
- request.projectId ?? this.client.settings.defaultProjectId
459
- ])
447
+ urlParams: urlParams(
448
+ ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
449
+ )
460
450
  },
461
451
  unmarshalListOfferSubscriptionsResponse
462
452
  );
@@ -496,14 +486,8 @@ class API extends API$1 {
496
486
  path: `/transactional-email/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pools`,
497
487
  urlParams: urlParams(
498
488
  ["page", request.page],
499
- [
500
- "page_size",
501
- request.pageSize ?? this.client.settings.defaultPageSize
502
- ],
503
- [
504
- "project_id",
505
- request.projectId ?? this.client.settings.defaultProjectId
506
- ]
489
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
490
+ ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
507
491
  )
508
492
  },
509
493
  unmarshalListPoolsResponse
@@ -525,10 +509,9 @@ class API extends API$1 {
525
509
  {
526
510
  method: "GET",
527
511
  path: `/transactional-email/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/project-consumption`,
528
- urlParams: urlParams([
529
- "project_id",
530
- request.projectId ?? this.client.settings.defaultProjectId
531
- ])
512
+ urlParams: urlParams(
513
+ ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
514
+ )
532
515
  },
533
516
  unmarshalProjectConsumption
534
517
  );
@@ -2,7 +2,10 @@ const DOMAIN_TRANSIENT_STATUSES = [
2
2
  "pending",
3
3
  "autoconfiguring"
4
4
  ];
5
- const EMAIL_TRANSIENT_STATUSES = ["new", "sending"];
5
+ const EMAIL_TRANSIENT_STATUSES = [
6
+ "new",
7
+ "sending"
8
+ ];
6
9
  export {
7
10
  DOMAIN_TRANSIENT_STATUSES,
8
11
  EMAIL_TRANSIENT_STATUSES
@@ -1,4 +1,4 @@
1
- export { API } from './api.gen.js';
1
+ export { API, } from './api.gen.js';
2
2
  export * from './content.gen.js';
3
3
  export * from './marshalling.gen.js';
4
4
  export type { Blocklist, BlocklistType, BulkCreateBlocklistsRequest, BulkCreateBlocklistsResponse, CancelEmailRequest, CheckDomainRequest, CreateDomainRequest, CreateEmailRequest, CreateEmailRequestAddress, CreateEmailRequestAttachment, CreateEmailRequestHeader, CreateEmailResponse, CreateWebhookRequest, DeleteBlocklistRequest, DeleteWebhookRequest, Domain, DomainLastStatus, DomainLastStatusAutoconfigState, DomainLastStatusAutoconfigStateReason, DomainLastStatusDkimRecord, DomainLastStatusDmarcRecord, DomainLastStatusMXRecord, DomainLastStatusRecordStatus, DomainLastStatusSpfRecord, DomainRecords, DomainRecordsDKIM, DomainRecordsDMARC, DomainRecordsMX, DomainRecordsSPF, DomainReputation, DomainReputationStatus, DomainStatistics, DomainStatus, Email, EmailFlag, EmailRcptType, EmailStatus, EmailTry, GetDomainLastStatusRequest, GetDomainRequest, GetEmailRequest, GetProjectConsumptionRequest, GetProjectSettingsRequest, GetStatisticsRequest, GetWebhookRequest, ListBlocklistsRequest, ListBlocklistsRequestOrderBy, ListBlocklistsResponse, ListDomainsRequest, ListDomainsResponse, ListEmailsRequest, ListEmailsRequestOrderBy, ListEmailsResponse, ListOfferSubscriptionsRequest, ListOfferSubscriptionsResponse, ListOffersRequest, ListOffersResponse, ListPoolsRequest, ListPoolsResponse, ListWebhookEventsRequest, ListWebhookEventsRequestOrderBy, ListWebhookEventsResponse, ListWebhooksRequest, ListWebhooksRequestOrderBy, ListWebhooksResponse, Offer, OfferName, OfferSubscription, Pool, PoolStatus, ProjectConsumption, ProjectSettings, ProjectSettingsPeriodicReport, ProjectSettingsPeriodicReportFrequency, RevokeDomainRequest, Statistics, UpdateDomainRequest, UpdateOfferSubscriptionRequest, UpdateProjectSettingsRequest, UpdateProjectSettingsRequestUpdatePeriodicReport, UpdateWebhookRequest, Webhook, WebhookEvent, WebhookEventStatus, WebhookEventType, } from './types.gen.js';
@@ -338,10 +338,7 @@ const unmarshalListOfferSubscriptionsResponse = (data) => {
338
338
  );
339
339
  }
340
340
  return {
341
- offerSubscriptions: unmarshalArrayOfObject(
342
- data.offer_subscriptions,
343
- unmarshalOfferSubscription
344
- ),
341
+ offerSubscriptions: unmarshalArrayOfObject(data.offer_subscriptions, unmarshalOfferSubscription),
345
342
  totalCount: data.total_count
346
343
  };
347
344
  };
@@ -428,10 +425,7 @@ const unmarshalListWebhookEventsResponse = (data) => {
428
425
  }
429
426
  return {
430
427
  totalCount: data.total_count,
431
- webhookEvents: unmarshalArrayOfObject(
432
- data.webhook_events,
433
- unmarshalWebhookEvent
434
- )
428
+ webhookEvents: unmarshalArrayOfObject(data.webhook_events, unmarshalWebhookEvent)
435
429
  };
436
430
  };
437
431
  const unmarshalListWebhooksResponse = (data) => {
@@ -524,12 +518,8 @@ const marshalCreateEmailRequestHeader = (request, defaults) => ({
524
518
  value: request.value
525
519
  });
526
520
  const marshalCreateEmailRequest = (request, defaults) => ({
527
- additional_headers: request.additionalHeaders !== void 0 ? request.additionalHeaders.map(
528
- (elt) => marshalCreateEmailRequestHeader(elt)
529
- ) : void 0,
530
- attachments: request.attachments !== void 0 ? request.attachments.map(
531
- (elt) => marshalCreateEmailRequestAttachment(elt)
532
- ) : void 0,
521
+ additional_headers: request.additionalHeaders !== void 0 ? request.additionalHeaders.map((elt) => marshalCreateEmailRequestHeader(elt)) : void 0,
522
+ attachments: request.attachments !== void 0 ? request.attachments.map((elt) => marshalCreateEmailRequestAttachment(elt)) : void 0,
533
523
  bcc: request.bcc !== void 0 ? request.bcc.map((elt) => marshalCreateEmailRequestAddress(elt)) : void 0,
534
524
  cc: request.cc !== void 0 ? request.cc.map((elt) => marshalCreateEmailRequestAddress(elt)) : void 0,
535
525
  from: marshalCreateEmailRequestAddress(request.from),
@@ -561,9 +551,7 @@ const marshalUpdateProjectSettingsRequestUpdatePeriodicReport = (request, defaul
561
551
  sending_hour: request.sendingHour
562
552
  });
563
553
  const marshalUpdateProjectSettingsRequest = (request, defaults) => ({
564
- periodic_report: request.periodicReport !== void 0 ? marshalUpdateProjectSettingsRequestUpdatePeriodicReport(
565
- request.periodicReport
566
- ) : void 0
554
+ periodic_report: request.periodicReport !== void 0 ? marshalUpdateProjectSettingsRequestUpdatePeriodicReport(request.periodicReport) : void 0
567
555
  });
568
556
  const marshalUpdateWebhookRequest = (request, defaults) => ({
569
557
  event_types: request.eventTypes !== void 0 ? request.eventTypes : void 0,
@@ -12,7 +12,6 @@ export declare const CreateDomainRequest: {
12
12
  export declare const CreateEmailRequest: {
13
13
  subject: {
14
14
  maxLength: number;
15
- minLength: number;
16
15
  };
17
16
  };
18
17
  export declare const CreateEmailRequestAddress: {
@@ -78,7 +77,6 @@ export declare const ListEmailsRequest: {
78
77
  };
79
78
  subject: {
80
79
  maxLength: number;
81
- minLength: number;
82
80
  };
83
81
  };
84
82
  export declare const ListPoolsRequest: {
@@ -11,8 +11,7 @@ const CreateDomainRequest = {
11
11
  };
12
12
  const CreateEmailRequest = {
13
13
  subject: {
14
- maxLength: 998,
15
- minLength: 6
14
+ maxLength: 998
16
15
  }
17
16
  };
18
17
  const CreateEmailRequestAddress = {
@@ -77,8 +76,7 @@ const ListEmailsRequest = {
77
76
  minLength: 3
78
77
  },
79
78
  subject: {
80
- maxLength: 998,
81
- minLength: 6
79
+ maxLength: 998
82
80
  }
83
81
  };
84
82
  const ListPoolsRequest = {
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-tem",
3
- "version": "1.2.0",
3
+ "version": "2.1.1",
4
4
  "description": "Scaleway SDK tem",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
+ "README.md",
7
8
  "dist"
8
9
  ],
9
10
  "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/index.gen.d.ts",
13
- "import": "./dist/index.gen.js",
14
- "require": "./dist/index.gen.cjs",
15
14
  "default": "./dist/index.gen.js"
16
15
  },
17
16
  "./*": {
18
17
  "types": "./dist/*/index.gen.d.ts",
19
- "import": "./dist/*/index.gen.js",
20
- "require": "./dist/*/index.gen.cjs",
21
18
  "default": "./dist/*/index.gen.js"
22
19
  }
23
20
  },
@@ -26,17 +23,17 @@
26
23
  "directory": "packages_generated/tem"
27
24
  },
28
25
  "engines": {
29
- "node": ">=20.19.4"
26
+ "node": ">=20.19.6"
30
27
  },
31
28
  "dependencies": {
32
29
  "@scaleway/random-name": "5.1.2",
33
- "@scaleway/sdk-std": "1.1.0"
30
+ "@scaleway/sdk-std": "2.1.0"
34
31
  },
35
32
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.2"
33
+ "@scaleway/sdk-client": "^2.1.0"
37
34
  },
38
35
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.2"
36
+ "@scaleway/sdk-client": "^2.1.0"
40
37
  },
41
38
  "scripts": {
42
39
  "package:check": "pnpm publint",
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index_gen = require("./v1alpha1/index.gen.cjs");
4
- exports.Temv1alpha1 = index_gen;