Skip to content

Commit

Permalink
Add Extra parameters example in README
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory Z. Szucs committed Sep 18, 2024
1 parent 4df2454 commit 63ce0e1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,26 @@ You can easily connect multiple accounts
await client.users.getOwnProfile('t5XY4yQzR9WVrlNFyzPMhw');
```

## Extra parameters

If you want to pass some extra parameters for a request beyond what the SDK input defines, all methods allow an `extra_params` options.

```javascript
await client.messaging.getMessageAttachment(
{
attachment_id: '5882031366722404334',
message_id: '3aRdnf34UiympaebB4-NRA',
},
{
extra_params: { my_param_name: 'my param value' },
},
);
```

Depending on the underlying HTTP request mode used, `extra_params` will be added to the request query string or json or formData body.

This may be useful if you know about and want to use a parameter that is either omitted or not yet defined in the sdk.

# LinkedIn Specific

## InMail LinkedIn API
Expand Down
1 change: 1 addition & 0 deletions src/resources/email.resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ export class EmailResource {
}
});
}

return await this.client.request.send({
path: ['emails'],
method: 'POST',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/extra_params.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('extra_params', () => {
{ provider: 'WHATSAPP' },
{ extra_params: { provider: 'garbage', legit: 'test' } },
);
console.log(r);
// console.log(r);
expect((r as any).url).toBe(API_URL + 'accounts');
expect(fetchMock.mock.calls[0]?.[1]?.body).toBe(JSON.stringify({ provider: 'WHATSAPP', legit: 'test' }));
},
Expand Down

0 comments on commit 63ce0e1

Please sign in to comment.