@eka-care/ekascribe-ts-sdk 1.4.39 → 1.4.41
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/dist/api/config/get-voice-api-v2-config.d.ts +2 -0
- package/dist/api/config/get-voice-api-v2-config.js +26 -0
- package/dist/api/config/patch-voice-api-v2-config.d.ts +3 -0
- package/dist/api/config/patch-voice-api-v2-config.js +28 -0
- package/dist/api/post-cog-init.js +2 -1
- package/dist/api/post-transaction-init.d.ts +1 -1
- package/dist/api/post-transaction-init.js +2 -2
- package/dist/api/template-sections/delete-v1-template-section.d.ts +3 -0
- package/dist/api/template-sections/delete-v1-template-section.js +28 -0
- package/dist/api/template-sections/get-v1-template-sections.d.ts +3 -0
- package/dist/api/template-sections/get-v1-template-sections.js +28 -0
- package/dist/api/template-sections/patch-v1-template-section.d.ts +3 -0
- package/dist/api/template-sections/patch-v1-template-section.js +37 -0
- package/dist/api/template-sections/post-v1-template-section.d.ts +3 -0
- package/dist/api/template-sections/post-v1-template-section.js +36 -0
- package/dist/api/templates/cook-v1-medai-ai-create-template.d.ts +3 -0
- package/dist/api/templates/cook-v1-medai-ai-create-template.js +26 -0
- package/dist/api/templates/delete-v1-template.d.ts +3 -0
- package/dist/api/templates/delete-v1-template.js +28 -0
- package/dist/api/templates/get-v1-templates.d.ts +3 -0
- package/dist/api/templates/get-v1-templates.js +28 -0
- package/dist/api/templates/patch-v1-template.d.ts +3 -0
- package/dist/api/templates/patch-v1-template.js +34 -0
- package/dist/api/templates/post-transaction-convert-to-template.d.ts +3 -0
- package/dist/api/templates/post-transaction-convert-to-template.js +29 -0
- package/dist/api/templates/post-v1-template.d.ts +3 -0
- package/dist/api/templates/post-v1-template.js +34 -0
- package/dist/api/transaction/get-transaction-history.d.ts +5 -0
- package/dist/api/transaction/get-transaction-history.js +28 -0
- package/dist/api/transaction/get-voice-api-v2-config.d.ts +2 -0
- package/dist/api/transaction/get-voice-api-v2-config.js +26 -0
- package/dist/api/transaction/get-voice-api-v3-status.d.ts +54 -0
- package/dist/api/transaction/get-voice-api-v3-status.js +26 -0
- package/dist/api/transaction/patch-transaction-status.d.ts +4 -0
- package/dist/api/transaction/patch-transaction-status.js +43 -0
- package/dist/api/transaction/post-transaction-commit.d.ts +3 -0
- package/dist/api/transaction/post-transaction-commit.js +32 -0
- package/dist/api/transaction/post-transaction-init.d.ts +3 -0
- package/dist/api/transaction/post-transaction-init.js +40 -0
- package/dist/api/transaction/post-transaction-stop.d.ts +3 -0
- package/dist/api/transaction/post-transaction-stop.js +32 -0
- package/dist/audio-chunker/vad-web.js +0 -3
- package/dist/constants/types.d.ts +117 -2
- package/dist/fetch-client/helper.d.ts +6 -4
- package/dist/fetch-client/helper.js +18 -10
- package/dist/fetch-client/index.js +7 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +73 -12
- package/dist/main/end-recording.js +2 -2
- package/dist/main/init-transaction.js +1 -1
- package/dist/main/pause-recording.js +1 -0
- package/dist/main/resume-recording.js +1 -0
- package/dist/main/retry-upload-recording.js +1 -1
- package/dist/main/start-recording.js +4 -1
- package/dist/utils/search-sessions-by-patient-name.d.ts +7 -0
- package/dist/utils/search-sessions-by-patient-name.js +27 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V2 } from '../../fetch-client/helper';
|
|
4
|
+
export const getConfigV2 = async () => {
|
|
5
|
+
try {
|
|
6
|
+
const options = {
|
|
7
|
+
method: 'GET',
|
|
8
|
+
headers: {
|
|
9
|
+
'Content-Type': 'application/json',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V2()}/config/`, options);
|
|
13
|
+
const res = await response.json();
|
|
14
|
+
return {
|
|
15
|
+
...res,
|
|
16
|
+
code: response.status,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.log('Error in getConfigV2 api: ', error);
|
|
21
|
+
return {
|
|
22
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
23
|
+
message: `Failed to fetch initial configurations, ${error}`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V2 } from '../../fetch-client/helper';
|
|
4
|
+
const patchVoiceApiV2Config = async (request) => {
|
|
5
|
+
try {
|
|
6
|
+
const options = {
|
|
7
|
+
method: 'PATCH',
|
|
8
|
+
headers: {
|
|
9
|
+
'Content-Type': 'application/json',
|
|
10
|
+
},
|
|
11
|
+
body: JSON.stringify(request),
|
|
12
|
+
};
|
|
13
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V2()}/config/`, options);
|
|
14
|
+
const res = await response.json();
|
|
15
|
+
return {
|
|
16
|
+
...res,
|
|
17
|
+
code: response.status,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.log('Error in getConfigV2 api: ', error);
|
|
22
|
+
return {
|
|
23
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
24
|
+
msg: `Failed to fetch initial configurations, ${error}`,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export default patchVoiceApiV2Config;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import fetchWrapper from '../fetch-client';
|
|
2
|
+
import { GET_COG_HOST } from '../fetch-client/helper';
|
|
2
3
|
async function postCogInit() {
|
|
3
4
|
try {
|
|
4
5
|
const options = {
|
|
5
6
|
method: 'GET',
|
|
6
7
|
};
|
|
7
|
-
const respJson = await fetchWrapper(
|
|
8
|
+
const respJson = await fetchWrapper(`${GET_COG_HOST()}/credentials`, options);
|
|
8
9
|
const resp = await respJson.json();
|
|
9
10
|
return resp;
|
|
10
11
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TPostTransactionInitRequest, TPostTransactionResponse } from '../constants/types';
|
|
2
|
-
declare function postTransactionInit({ mode, txnId, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info,
|
|
2
|
+
declare function postTransactionInit({ mode, txnId, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, model_type, }: TPostTransactionInitRequest): Promise<TPostTransactionResponse>;
|
|
3
3
|
export default postTransactionInit;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
2
2
|
import fetchWrapper from '../fetch-client';
|
|
3
3
|
import { GET_EKA_V2RX_HOST_V2 } from '../fetch-client/helper';
|
|
4
|
-
async function postTransactionInit({ mode, txnId, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info,
|
|
4
|
+
async function postTransactionInit({ mode, txnId, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, model_type, }) {
|
|
5
5
|
try {
|
|
6
6
|
const headers = new Headers();
|
|
7
7
|
headers.append('Content-Type', 'application/json');
|
|
@@ -14,7 +14,7 @@ async function postTransactionInit({ mode, txnId, s3Url, input_language, output_
|
|
|
14
14
|
auto_download,
|
|
15
15
|
transfer,
|
|
16
16
|
system_info,
|
|
17
|
-
|
|
17
|
+
model_type,
|
|
18
18
|
};
|
|
19
19
|
const options = {
|
|
20
20
|
method: 'POST',
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
async function deleteV1TemplateSection(section_id) {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const options = {
|
|
9
|
+
method: 'DELETE',
|
|
10
|
+
headers,
|
|
11
|
+
};
|
|
12
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section/${section_id}`, options);
|
|
13
|
+
let res = await response.json();
|
|
14
|
+
res = {
|
|
15
|
+
...res,
|
|
16
|
+
code: response.status,
|
|
17
|
+
};
|
|
18
|
+
return res;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.log('%c deleteV1TemplateSection -> error', 'color:#f5ce50', error);
|
|
22
|
+
return {
|
|
23
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
24
|
+
msg: `Something went wrong! ${error}`,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export default deleteV1TemplateSection;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
async function getV1TemplateSections() {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const options = {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
headers,
|
|
11
|
+
};
|
|
12
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section`, options);
|
|
13
|
+
let res = await response.json();
|
|
14
|
+
res = {
|
|
15
|
+
...res,
|
|
16
|
+
code: response.status,
|
|
17
|
+
};
|
|
18
|
+
return res;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.log('%c getV1TemplateSections -> error', 'color:#f5ce50', error);
|
|
22
|
+
return {
|
|
23
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
24
|
+
items: [],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export default getV1TemplateSections;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TPostV1TemplateSectionRequest, TPostV1TemplateSectionResponse } from '../../constants/types';
|
|
2
|
+
declare function patchV1TemplateSection({ section_id, title, desc, format, example, }: TPostV1TemplateSectionRequest): Promise<TPostV1TemplateSectionResponse>;
|
|
3
|
+
export default patchV1TemplateSection;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
async function patchV1TemplateSection({ section_id, title, desc, format, example, }) {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const raw = {
|
|
9
|
+
title,
|
|
10
|
+
desc,
|
|
11
|
+
format,
|
|
12
|
+
example,
|
|
13
|
+
};
|
|
14
|
+
const options = {
|
|
15
|
+
method: 'PATCH',
|
|
16
|
+
headers,
|
|
17
|
+
body: JSON.stringify(raw),
|
|
18
|
+
};
|
|
19
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section/${section_id}`, options);
|
|
20
|
+
let res = await response.json();
|
|
21
|
+
res = {
|
|
22
|
+
...res,
|
|
23
|
+
code: response.status,
|
|
24
|
+
};
|
|
25
|
+
return res;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.log('%c patchV1TemplateSection -> error', 'color:#f5ce50', error);
|
|
29
|
+
return {
|
|
30
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
31
|
+
msg: `Something went wrong! ${error}`,
|
|
32
|
+
section_id: '',
|
|
33
|
+
action: 'updated',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export default patchV1TemplateSection;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TPostV1TemplateSectionRequest, TPostV1TemplateSectionResponse } from '../../constants/types';
|
|
2
|
+
declare function postV1TemplateSection({ title, desc, format, example, }: TPostV1TemplateSectionRequest): Promise<TPostV1TemplateSectionResponse>;
|
|
3
|
+
export default postV1TemplateSection;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
async function postV1TemplateSection({ title, desc, format, example, }) {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const raw = {
|
|
9
|
+
title,
|
|
10
|
+
desc,
|
|
11
|
+
format,
|
|
12
|
+
example,
|
|
13
|
+
};
|
|
14
|
+
const options = {
|
|
15
|
+
method: 'POST',
|
|
16
|
+
headers,
|
|
17
|
+
body: JSON.stringify(raw),
|
|
18
|
+
};
|
|
19
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section`, options);
|
|
20
|
+
let res = await response.json();
|
|
21
|
+
res = {
|
|
22
|
+
...res,
|
|
23
|
+
code: response.status,
|
|
24
|
+
};
|
|
25
|
+
return res;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.log('%c postV1TemplateSection -> error', 'color:#f5ce50', error);
|
|
29
|
+
return {
|
|
30
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
31
|
+
msg: `Something went wrong! ${error}`,
|
|
32
|
+
section_id: '',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export default postV1TemplateSection;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_COOK_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
async function cookV1MediaAiCreateTemplate(formData) {
|
|
5
|
+
try {
|
|
6
|
+
const options = {
|
|
7
|
+
method: 'POST',
|
|
8
|
+
body: formData,
|
|
9
|
+
};
|
|
10
|
+
const response = await fetchWrapper(`${GET_COOK_HOST_V1()}/medai/ai-create-template`, options, 60000);
|
|
11
|
+
let res = await response.json();
|
|
12
|
+
res = {
|
|
13
|
+
...res,
|
|
14
|
+
code: response.status,
|
|
15
|
+
};
|
|
16
|
+
return res;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.log('%c postV1Template -> error', 'color:#f5ce50', error);
|
|
20
|
+
return {
|
|
21
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
22
|
+
message: `Something went wrong! ${error}`,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export default cookV1MediaAiCreateTemplate;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
async function deleteV1Template(template_id) {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const options = {
|
|
9
|
+
method: 'DELETE',
|
|
10
|
+
headers,
|
|
11
|
+
};
|
|
12
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/${template_id}`, options);
|
|
13
|
+
let res = await response.json();
|
|
14
|
+
res = {
|
|
15
|
+
...res,
|
|
16
|
+
code: response.status,
|
|
17
|
+
};
|
|
18
|
+
return res;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.log('%c deleteV1Template -> error', 'color:#f5ce50', error);
|
|
22
|
+
return {
|
|
23
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
24
|
+
msg: `Something went wrong! ${error}`,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export default deleteV1Template;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
async function getV1Templates() {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const options = {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
headers,
|
|
11
|
+
};
|
|
12
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template`, options);
|
|
13
|
+
let res = await response.json();
|
|
14
|
+
res = {
|
|
15
|
+
...res,
|
|
16
|
+
code: response.status,
|
|
17
|
+
};
|
|
18
|
+
return res;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.log('%c getV1Templates -> error', 'color:#f5ce50', error);
|
|
22
|
+
return {
|
|
23
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
24
|
+
items: [],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export default getV1Templates;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
export async function patchV1Template({ template_id, title, desc, section_ids, }) {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const raw = {
|
|
9
|
+
title,
|
|
10
|
+
desc,
|
|
11
|
+
section_ids,
|
|
12
|
+
};
|
|
13
|
+
const options = {
|
|
14
|
+
method: 'PATCH',
|
|
15
|
+
headers,
|
|
16
|
+
body: JSON.stringify(raw),
|
|
17
|
+
};
|
|
18
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/${template_id}`, options);
|
|
19
|
+
let res = await response.json();
|
|
20
|
+
res = {
|
|
21
|
+
...res,
|
|
22
|
+
code: response.status,
|
|
23
|
+
};
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.log('%c patchV1Template -> error', 'color:#f5ce50', error);
|
|
28
|
+
return {
|
|
29
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
30
|
+
msg: `Something went wrong! ${error}`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export default patchV1Template;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TPostV1ConvertToTemplateRequest, TPostV1ConvertToTemplateResponse } from '../../constants/types';
|
|
2
|
+
declare function postV1ConvertToTemplate({ txn_id, template_id, }: TPostV1ConvertToTemplateRequest): Promise<TPostV1ConvertToTemplateResponse>;
|
|
3
|
+
export default postV1ConvertToTemplate;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
async function postV1ConvertToTemplate({ txn_id, template_id, }) {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const options = {
|
|
9
|
+
method: 'POST',
|
|
10
|
+
headers,
|
|
11
|
+
body: JSON.stringify({}),
|
|
12
|
+
};
|
|
13
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/transaction/${txn_id}/convert-to-template/${template_id}`, options, 60000);
|
|
14
|
+
let res = await response.json();
|
|
15
|
+
res = {
|
|
16
|
+
...res,
|
|
17
|
+
code: response.status,
|
|
18
|
+
};
|
|
19
|
+
return res;
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.log('%c postV1ConvertToTemplate -> error', 'color:#f5ce50', error);
|
|
23
|
+
return {
|
|
24
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
25
|
+
message: `Something went wrong! ${error}`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export default postV1ConvertToTemplate;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
+
async function postV1Template({ title, desc, section_ids, }) {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const raw = {
|
|
9
|
+
title,
|
|
10
|
+
desc,
|
|
11
|
+
section_ids,
|
|
12
|
+
};
|
|
13
|
+
const options = {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
headers,
|
|
16
|
+
body: JSON.stringify(raw),
|
|
17
|
+
};
|
|
18
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template`, options);
|
|
19
|
+
let res = await response.json();
|
|
20
|
+
res = {
|
|
21
|
+
...res,
|
|
22
|
+
code: response.status,
|
|
23
|
+
};
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.log('%c postV1Template -> error', 'color:#f5ce50', error);
|
|
28
|
+
return {
|
|
29
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
30
|
+
message: `Something went wrong! ${error}`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export default postV1Template;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V2 } from '../../fetch-client/helper';
|
|
4
|
+
// TODO: pagination changes
|
|
5
|
+
const getTransactionHistory = async ({ txn_count, }) => {
|
|
6
|
+
try {
|
|
7
|
+
const headers = new Headers();
|
|
8
|
+
headers.append('Content-Type', 'application/json');
|
|
9
|
+
const options = {
|
|
10
|
+
method: 'GET',
|
|
11
|
+
headers,
|
|
12
|
+
};
|
|
13
|
+
const responseJson = await fetchWrapper(`${GET_EKA_VOICE_HOST_V2()}/transaction/history?count=${txn_count}`, options);
|
|
14
|
+
const response = await responseJson.json();
|
|
15
|
+
return {
|
|
16
|
+
data: response.data,
|
|
17
|
+
status_code: responseJson.status,
|
|
18
|
+
message: `Past ${txn_count} transactions fetched successfully.`,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
return {
|
|
23
|
+
status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
24
|
+
message: `Something went wrong in fetching transactions. ${error}`,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export default getTransactionHistory;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V2 } from '../../fetch-client/helper';
|
|
4
|
+
export const getConfigV2 = async () => {
|
|
5
|
+
try {
|
|
6
|
+
const options = {
|
|
7
|
+
method: 'GET',
|
|
8
|
+
headers: {
|
|
9
|
+
'Content-Type': 'application/json',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V2()}/config/`, options);
|
|
13
|
+
const res = await response.json();
|
|
14
|
+
return {
|
|
15
|
+
...res,
|
|
16
|
+
code: response.status,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.log('Error in getConfigV2 api: ', error);
|
|
21
|
+
return {
|
|
22
|
+
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
23
|
+
message: `Failed to fetch initial configurations, ${error}`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type TTemplateMessage = {
|
|
2
|
+
type: 'warning' | 'error';
|
|
3
|
+
code?: string;
|
|
4
|
+
msg: string;
|
|
5
|
+
};
|
|
6
|
+
export type TOutputSummary = {
|
|
7
|
+
template_id: string;
|
|
8
|
+
value?: string | null;
|
|
9
|
+
type: string;
|
|
10
|
+
name: string;
|
|
11
|
+
status: TTemplateStatus;
|
|
12
|
+
errors?: TTemplateMessage[];
|
|
13
|
+
warnings?: TTemplateMessage[];
|
|
14
|
+
};
|
|
15
|
+
export type TTemplateStatus = 'success' | 'partial_success' | 'failure';
|
|
16
|
+
type TAdditionalData = {
|
|
17
|
+
doctor: {
|
|
18
|
+
_id: string;
|
|
19
|
+
profile: {
|
|
20
|
+
personal: {
|
|
21
|
+
name: {
|
|
22
|
+
l: string;
|
|
23
|
+
f: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type TApiResponse = {
|
|
30
|
+
data: {
|
|
31
|
+
output?: TOutputSummary[];
|
|
32
|
+
audio_matrix?: {
|
|
33
|
+
quality: string;
|
|
34
|
+
};
|
|
35
|
+
additional_data?: TAdditionalData;
|
|
36
|
+
meta_data?: {
|
|
37
|
+
total_resources?: number;
|
|
38
|
+
total_parsed_resources?: number;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
error?: {
|
|
42
|
+
code: string;
|
|
43
|
+
msg: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export type TGetStatusResponse = {
|
|
47
|
+
response?: TApiResponse | null;
|
|
48
|
+
status_code: number;
|
|
49
|
+
message?: string;
|
|
50
|
+
};
|
|
51
|
+
export declare const getVoiceApiV3Status: ({ txnId, }: {
|
|
52
|
+
txnId: string;
|
|
53
|
+
}) => Promise<TGetStatusResponse>;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V3 } from '../../fetch-client/helper';
|
|
4
|
+
export const getVoiceApiV3Status = async ({ txnId, }) => {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const options = {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
headers,
|
|
11
|
+
};
|
|
12
|
+
// Use custom timeout for this API (16 seconds instead of default 5 seconds)
|
|
13
|
+
const getResponse = await fetchWrapper(`${GET_EKA_VOICE_HOST_V3()}/status/${txnId}`, options, 16000);
|
|
14
|
+
const response = await getResponse.json();
|
|
15
|
+
return {
|
|
16
|
+
response,
|
|
17
|
+
status_code: getResponse.status,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return {
|
|
22
|
+
status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
23
|
+
message: `Something went wrong! ${error}`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TPatchTransactionError, TPatchTransactionRequest, TPostTransactionResponse } from '../../constants/types';
|
|
2
|
+
export declare const processingError: TPatchTransactionError;
|
|
3
|
+
declare const patchTransactionStatus: ({ sessionId, processing_status, processing_error, }: TPatchTransactionRequest) => Promise<TPostTransactionResponse>;
|
|
4
|
+
export default patchTransactionStatus;
|