Skip to content

Commit b23673f

Browse files
authored
fix: updating api call for dialpad lists (#251)
1 parent 2fd2310 commit b23673f

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vesselapi/integrations",
3-
"version": "1.0.37",
3+
"version": "1.0.38",
44
"description": "Vessel integrations",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

src/platforms/dialpad/client.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
DialpadAuthAnswers,
77
dialpadCallSchema,
88
DialpadCallStart,
9-
DialpadClient,
109
DialpadContactCreate,
1110
dialpadContactSchema,
1211
DialpadContactUpdate,
@@ -17,9 +16,7 @@ import {
1716
} from './schemas';
1817

1918
const baseUrl = (answers: DialpadAuthAnswers) =>
20-
`${
21-
dialpadUrlsByAccountType[answers.accountType]
22-
}/api/${API_VERSION}` as HttpsUrl;
19+
`${dialpadUrlsByAccountType[answers.accountType]}/api` as HttpsUrl;
2320

2421
const request = makeRequestFactory(async (auth, options) => {
2522
const { answers } = await auth.getMetadata();
@@ -34,17 +31,17 @@ const request = makeRequestFactory(async (auth, options) => {
3431
};
3532
});
3633

37-
const makeClient = (): DialpadClient => {
34+
const makeClient = () => {
3835
const findObject = (module: DialpadModules, schema: z.ZodSchema) =>
3936
request(({ id }: { id: string }) => ({
40-
url: `/${module}/${id}`,
37+
url: `/${API_VERSION}/${module}/${id}`,
4138
method: 'GET',
4239
schema,
4340
}));
4441

4542
const listObject = (module: DialpadModules, schema: z.ZodSchema) =>
4643
request(({ cursor }: { cursor?: string }) => ({
47-
url: `/${module}`,
44+
url: `/${API_VERSION}/${module}`,
4845
method: 'GET',
4946
query: cursor ? { cursor } : undefined,
5047
schema,
@@ -55,7 +52,7 @@ const makeClient = (): DialpadClient => {
5552
schema: z.ZodSchema,
5653
) =>
5754
request((body: T) => ({
58-
url: `/${module}/`,
55+
url: `/${API_VERSION}/${module}/`,
5956
method: 'POST',
6057
schema,
6158
json: formatUpsertInputWithNative(body),
@@ -66,7 +63,7 @@ const makeClient = (): DialpadClient => {
6663
schema: z.ZodSchema,
6764
) =>
6865
request((body: T) => ({
69-
url: `/${module}/`,
66+
url: `/${API_VERSION}/${module}/`,
7067
method: 'PUT',
7168
schema,
7269
json: formatUpsertInputWithNative(body),
@@ -95,7 +92,6 @@ const makeClient = (): DialpadClient => {
9592
},
9693
calls: {
9794
find: findObject('calls', dialpadCallSchema),
98-
list: listObject('calls', listResponseSchema(dialpadCallSchema)),
9995
start: request((body: DialpadCallStart) => ({
10096
url: `/call`,
10197
method: 'POST',
@@ -104,6 +100,12 @@ const makeClient = (): DialpadClient => {
104100
}),
105101
json: formatUpsertInputWithNative(body),
106102
})),
103+
list: request(({ cursor }: { cursor?: string }) => ({
104+
url: `/call/search`,
105+
method: 'GET',
106+
query: cursor ? { cursor } : undefined,
107+
schema: listResponseSchema(dialpadCallSchema),
108+
})),
107109
},
108110
passthrough: request.passthrough(),
109111
};

0 commit comments

Comments
 (0)