@eka-care/ekascribe-ts-sdk 1.4.9 → 1.4.11

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.
@@ -0,0 +1,2 @@
1
+ import { TGetConfigV2Response } from '../../constants/types';
2
+ export declare const getConfigV2: () => Promise<TGetConfigV2Response>;
@@ -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,3 @@
1
+ import { TPatchVoiceApiV2ConfigRequest } from '../../constants/types';
2
+ declare const patchVoiceApiV2Config: (request: TPatchVoiceApiV2ConfigRequest) => Promise<any>;
3
+ export default patchVoiceApiV2Config;
@@ -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;
@@ -9,7 +9,7 @@ async function deleteV1TemplateSection(section_id) {
9
9
  method: 'DELETE',
10
10
  headers,
11
11
  };
12
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/api/v1/template/section/${section_id}`, options);
12
+ const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section/${section_id}`, options);
13
13
  let res = await response.json();
14
14
  res = {
15
15
  ...res,
@@ -9,7 +9,7 @@ async function getV1TemplateSections() {
9
9
  method: 'GET',
10
10
  headers,
11
11
  };
12
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/api/v1/template/section`, options);
12
+ const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section`, options);
13
13
  let res = await response.json();
14
14
  res = {
15
15
  ...res,
@@ -19,7 +19,7 @@ async function patchV1TemplateSection({ section_id, template_id, title, desc, fo
19
19
  headers,
20
20
  body: JSON.stringify(raw),
21
21
  };
22
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/api/v1/template/section/${section_id}`, options);
22
+ const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section/${section_id}`, options);
23
23
  let res = await response.json();
24
24
  res = {
25
25
  ...res,
@@ -16,7 +16,7 @@ async function postV1TemplateSection({ title, desc, format, example, }) {
16
16
  headers,
17
17
  body: JSON.stringify(raw),
18
18
  };
19
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/api/v1/template/section`, options);
19
+ const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section`, options);
20
20
  let res = await response.json();
21
21
  res = {
22
22
  ...res,
@@ -9,7 +9,7 @@ async function deleteV1Template(template_id) {
9
9
  method: 'DELETE',
10
10
  headers,
11
11
  };
12
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/api/v1/template/${template_id}`, options);
12
+ const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/${template_id}`, options);
13
13
  let res = await response.json();
14
14
  res = {
15
15
  ...res,
@@ -9,7 +9,7 @@ async function getV1Templates() {
9
9
  method: 'GET',
10
10
  headers,
11
11
  };
12
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/api/v1/template`, options);
12
+ const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template`, options);
13
13
  let res = await response.json();
14
14
  res = {
15
15
  ...res,
@@ -15,7 +15,7 @@ export async function patchV1Template({ template_id, title, desc, section_ids, }
15
15
  headers,
16
16
  body: JSON.stringify(raw),
17
17
  };
18
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/api/v1/template/${template_id}`, options);
18
+ const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/${template_id}`, options);
19
19
  let res = await response.json();
20
20
  res = {
21
21
  ...res,
@@ -15,7 +15,7 @@ async function postV1Template({ title, desc, section_ids, }) {
15
15
  headers,
16
16
  body: JSON.stringify(raw),
17
17
  };
18
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/api/v1/template`, options);
18
+ const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template`, options);
19
19
  let res = await response.json();
20
20
  res = {
21
21
  ...res,
@@ -288,3 +288,17 @@ export interface TGetV1TemplateSectionsResponse {
288
288
  message: string;
289
289
  };
290
290
  }
291
+ export type TPatchVoiceApiV2ConfigRequest = {
292
+ auto_download?: boolean;
293
+ default_languages?: string[];
294
+ my_templates?: string[];
295
+ scribe_enabled?: boolean;
296
+ };
297
+ export interface TPatchVoiceApiV2ConfigResponse extends TPatchVoiceApiV2ConfigRequest {
298
+ msg: string;
299
+ code: number;
300
+ error?: {
301
+ code: string;
302
+ message: string;
303
+ };
304
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TGetStatusResponse } from './api/transaction/get-voice-api-v3-status';
2
- import { TEndRecordingResponse, TErrorCallback, TFileUploadProgressCallback, TGetTransactionHistoryResponse, TPatchTransactionRequest, TPostTransactionResponse, TPostV1TemplateRequest, TPostV1TemplateSectionRequest, TStartRecordingRequest } from './constants/types';
2
+ import { TEndRecordingResponse, TErrorCallback, TFileUploadProgressCallback, TGetTransactionHistoryResponse, TPatchTransactionRequest, TPatchVoiceApiV2ConfigRequest, TPostTransactionResponse, TPostV1TemplateRequest, TPostV1TemplateSectionRequest, TStartRecordingRequest } from './constants/types';
3
3
  declare class EkaScribe {
4
4
  private static instance;
5
5
  private vadInstance;
@@ -55,6 +55,7 @@ declare class EkaScribe {
55
55
  createTemplate(template: TPostV1TemplateRequest): Promise<import("./constants/types").TPostV1TemplateResponse>;
56
56
  updateTemplate(template: TPostV1TemplateRequest): Promise<import("./constants/types").TPostV1TemplateResponse>;
57
57
  deleteTemplate(template_id: string): Promise<import("./constants/types").TPostV1TemplateResponse>;
58
+ updateConfig(request: TPatchVoiceApiV2ConfigRequest): Promise<any>;
58
59
  getAllTemplateSections(): Promise<import("./constants/types").TGetV1TemplateSectionsResponse>;
59
60
  createTemplateSection(templateSection: TPostV1TemplateSectionRequest): Promise<import("./constants/types").TPostV1TemplateSectionResponse>;
60
61
  updateTemplateSection(templateSection: TPostV1TemplateSectionRequest): Promise<import("./constants/types").TPostV1TemplateSectionResponse>;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // ekascribe main Class having all the methods - Entry point
2
- import { getConfigV2 } from './api/transaction/get-voice-api-v2-config';
2
+ import { getConfigV2 } from './api/config/get-voice-api-v2-config';
3
3
  import { getVoiceApiV3Status } from './api/transaction/get-voice-api-v3-status';
4
4
  import patchTransactionStatus from './api/transaction/patch-transaction-status';
5
5
  import postTransactionCommit from './api/transaction/post-transaction-commit';
@@ -25,6 +25,7 @@ import getV1TemplateSections from './api/template-sections/get-v1-template-secti
25
25
  import postV1TemplateSection from './api/template-sections/post-v1-template-section';
26
26
  import patchV1TemplateSection from './api/template-sections/patch-v1-template-section';
27
27
  import deleteV1TemplateSection from './api/template-sections/delete-v1-template-section';
28
+ import patchVoiceApiV2Config from './api/config/patch-voice-api-v2-config';
28
29
  class EkaScribe {
29
30
  // Private constructor to prevent direct instantiation
30
31
  constructor() {
@@ -280,6 +281,10 @@ class EkaScribe {
280
281
  const templatesResponse = await deleteV1Template(template_id);
281
282
  return templatesResponse;
282
283
  }
284
+ async updateConfig(request) {
285
+ const configResponse = await patchVoiceApiV2Config(request);
286
+ return configResponse;
287
+ }
283
288
  // Template Section SDK methods
284
289
  async getAllTemplateSections() {
285
290
  const templateSectionsResponse = await getV1TemplateSections();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "main": "dist/index.js",
5
5
  "repository": "git@github.com:eka-care/eka-js-sdk.git",
6
6
  "author": "Sanikagoyal28 <sanikagoyal9@gmail.com>",