Skip to content

Commit

Permalink
Add active field on callback type (#58)
Browse files Browse the repository at this point in the history
* add 'active' field on 'Callback' type

* 0.2.38
  • Loading branch information
impin2rex authored May 31, 2024
1 parent b89293d commit fc4818a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.2.37",
"version": "0.2.38",
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
28 changes: 21 additions & 7 deletions src/api/callback-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class CallbackClient {
enableEvents?: boolean;
type?: CallbackType;
encoding?: CallbackEncoding;
}): Promise<Omit<CallBack, 'created_at' | 'updated_at'>> {
}): Promise<Omit<CallBack, 'active' | 'created_at' | 'updated_at'>> {
try {
if (!this.isValidUrl(input.callbackUrl)) {
throw new Error(`not a valid URL: ${input.callbackUrl}`);
Expand Down Expand Up @@ -50,7 +50,10 @@ export class CallbackClient {
url: 'callback/create',
data: reqBody,
});
const callback = response.result as CallBack;
const callback = response.result as Omit<
CallBack,
'active' | 'created_at' | 'updated_at'
>;
return callback;
} catch (error) {
throw error;
Expand Down Expand Up @@ -91,6 +94,7 @@ export class CallbackClient {
| 'enable_raw'
| 'enable_events'
| 'type'
| 'active'
| 'encoding'
| 'created_at'
| 'updated_at'
Expand Down Expand Up @@ -126,7 +130,17 @@ export class CallbackClient {
url: 'callback/update',
data: reqBody,
});
const callback = response.result as Omit<CallBack, 'callback_url'>;
const callback = response.result as Omit<
CallBack,
| 'callback_url'
| 'enable_raw'
| 'enable_events'
| 'type'
| 'active'
| 'encoding'
| 'created_at'
| 'updated_at'
>;
return callback;
} catch (error) {
throw error;
Expand Down Expand Up @@ -163,7 +177,7 @@ export class CallbackClient {
async addAddresses(input: {
id: string;
addresses: string[];
}): Promise<Omit<CallBack, 'callback_url' | 'enable_raw'>> {
}): Promise<Omit<CallBack, 'active' | 'callback_url' | 'enable_raw'>> {
try {
const reqBody = {
id: input.id,
Expand All @@ -176,7 +190,7 @@ export class CallbackClient {
});
const callback = response.result as Omit<
CallBack,
'callback_url' | 'enable_raw'
'active' | 'callback_url' | 'enable_raw'
>;
return callback;
} catch (error) {
Expand All @@ -187,7 +201,7 @@ export class CallbackClient {
async removeAddresses(input: {
id: string;
addresses: string[];
}): Promise<Omit<CallBack, 'callback_url' | 'enable_raw'>> {
}): Promise<Omit<CallBack, 'active' | 'callback_url' | 'enable_raw'>> {
try {
const reqBody = {
id: input.id,
Expand All @@ -200,7 +214,7 @@ export class CallbackClient {
});
const callback = response.result as Omit<
CallBack,
'callback_url' | 'enable_raw'
'active' | 'callback_url' | 'enable_raw'
>;
return callback;
} catch (error) {
Expand Down
1 change: 1 addition & 0 deletions src/types/Callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type CallBack = {
enable_raw?: boolean;
enable_events?: boolean;
type?: CallbackType;
active: boolean;
encoding?: CallbackEncoding;
created_at: Date;
updated_at: Date;
Expand Down

0 comments on commit fc4818a

Please sign in to comment.