Skip to content

Commit

Permalink
Merge pull request #237 from mailjet/dev
Browse files Browse the repository at this point in the history
Issue #226
  • Loading branch information
ai-wintermute authored Jan 31, 2023
2 parents e305caf + 358ad28 commit d687e4b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 26 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ As well library has a **generic** method `Request.request<TResult>(data, params,
### Send Email example

```typescript
import Mailjet, { SendEmailV3_1, LibraryResponse } from 'node-mailjet';
import { Client, SendEmailV3_1, LibraryResponse } from 'node-mailjet';

const mailjet = new Mailjet({
const mailjet = new Client({
apiKey: process.env.MJ_APIKEY_PUBLIC,
apiSecret: process.env.MJ_APIKEY_PRIVATE
});
Expand Down Expand Up @@ -536,22 +536,22 @@ And `response` will have this shape:
```
### Send Message Example
```typescript
import Mailjet, { SendMessage, LibraryResponse } from 'node-mailjet'
import * as Mailjet from 'node-mailjet'; // another possible importing option

const mailjet = new Mailjet({
const mailjet = new Mailjet.Client({
apiKey: process.env.MJ_APIKEY_PUBLIC,
apiSecret: process.env.MJ_APIKEY_PRIVATE
});

(async () => {

const body: SendMessage.Body = {
const body: Mailjet.SendMessage.Body = {
From: '[email protected]',
To: '[email protected]',
Text: 'Test'
};

const result: LibraryResponse<SendMessage.Response> = await mailjet
const result: Mailjet.LibraryResponse<Mailjet.SendMessage.Response> = await mailjet
.post('contact', { version: 'v3' })
.request(body);

Expand Down Expand Up @@ -587,9 +587,9 @@ And `response` will have this shape:
### Get Contact Example

```typescript
import Mailjet, { Contact, LibraryResponse } from 'node-mailjet'
import { Client, Contact, LibraryResponse } from 'node-mailjet'

const mailjet = new Mailjet({
const mailjet = new Client({
apiKey: process.env.MJ_APIKEY_PUBLIC,
apiSecret: process.env.MJ_APIKEY_PRIVATE
});
Expand Down Expand Up @@ -725,8 +725,8 @@ request
Manage the **subscription status** of a **contact** to multiple **lists**:

```javascript
const Mailjet = require('node-mailjet')
const mailjet = new Mailjet({
const { Client } = require('node-mailjet') // another importing option using destructuring
const mailjet = new Client({
apiKey: process.env.MJ_APIKEY_PUBLIC,
apiSecret: process.env.MJ_APIKEY_PRIVATE
});
Expand Down
20 changes: 10 additions & 10 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ As well library has a **generic** method `Request.request<TResult>(data, params,
### Send Email example

```typescript
import Mailjet, { SendEmailV3_1, LibraryResponse } from 'node-mailjet';
import { Client, SendEmailV3_1, LibraryResponse } from 'node-mailjet';

const mailjet = new Mailjet({
const mailjet = new Client({
apiKey: process.env.MJ_APIKEY_PUBLIC,
apiSecret: process.env.MJ_APIKEY_PRIVATE
});
Expand Down Expand Up @@ -536,22 +536,22 @@ And `response` will have this shape:
```
### Send Message Example
```typescript
import Mailjet, { SendMessage, LibraryResponse } from 'node-mailjet'
import * as Mailjet from 'node-mailjet'; // another possible importing option

const mailjet = new Mailjet({
const mailjet = new Mailjet.Client({
apiKey: process.env.MJ_APIKEY_PUBLIC,
apiSecret: process.env.MJ_APIKEY_PRIVATE
});

(async () => {

const body: SendMessage.Body = {
const body: Mailjet.SendMessage.Body = {
From: '[email protected]',
To: '[email protected]',
Text: 'Test'
};

const result: LibraryResponse<SendMessage.Response> = await mailjet
const result: Mailjet.LibraryResponse<Mailjet.SendMessage.Response> = await mailjet
.post('contact', { version: 'v3' })
.request(body);

Expand Down Expand Up @@ -587,9 +587,9 @@ And `response` will have this shape:
### Get Contact Example

```typescript
import Mailjet, { Contact, LibraryResponse } from 'node-mailjet'
import { Client, Contact, LibraryResponse } from 'node-mailjet'

const mailjet = new Mailjet({
const mailjet = new Client({
apiKey: process.env.MJ_APIKEY_PUBLIC,
apiSecret: process.env.MJ_APIKEY_PRIVATE
});
Expand Down Expand Up @@ -725,8 +725,8 @@ request
Manage the **subscription status** of a **contact** to multiple **lists**:

```javascript
const Mailjet = require('node-mailjet')
const mailjet = new Mailjet({
const { Client } = require('node-mailjet') // another importing option using destructuring
const mailjet = new Client({
apiKey: process.env.MJ_APIKEY_PUBLIC,
apiSecret: process.env.MJ_APIKEY_PRIVATE
});
Expand Down
1 change: 1 addition & 0 deletions dist/declarations/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Client from './client/index';
declare class Mailjet extends Client {
static Request: typeof Request;
static HttpMethods: typeof HttpMethods;
static Client: typeof Client;
}
export * from './types/api';
export { Client, Request, HttpMethods };
Expand Down
3 changes: 0 additions & 3 deletions dist/mailjet.node.js

This file was deleted.

3 changes: 0 additions & 3 deletions dist/mailjet.web.js

This file was deleted.

1 change: 1 addition & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Client from './client/index';
class Mailjet extends Client {
static Request = Request;
static HttpMethods = HttpMethods;
static Client = Client;
}

export * from './types/api';
Expand Down

0 comments on commit d687e4b

Please sign in to comment.