@sonoransoftware/sonoran.js 1.0.68 → 1.0.70

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.
@@ -1,5 +1,6 @@
1
1
  import { Collection } from '@discordjs/collection';
2
2
  import { CADDispatchOriginEnums, CADDispatchStatusEnums } from './libs/rest/src';
3
+ import type { CADDispatchNoteStruct } from './libs/rest/src';
3
4
  import { DataManager } from './managers/DataManager';
4
5
  import { CADActiveUnitsManager } from './managers/CADActiveUnitsManager';
5
6
  import { CADActiveUnit } from './structures/CADActiveUnit';
@@ -25,6 +26,24 @@ export interface CADNewDispatchBuilderOptions {
25
26
  units?: string[];
26
27
  deleteAfterMinutes?: number;
27
28
  }
29
+ export interface CADDispatchCallStruct {
30
+ callId: number;
31
+ origin: CADDispatchOriginEnums;
32
+ status: CADDispatchStatusEnums;
33
+ priority: 1 | 2 | 3;
34
+ block: string;
35
+ address: string;
36
+ postal: string;
37
+ title: string;
38
+ code: string;
39
+ primary: number;
40
+ trackPrimary: boolean;
41
+ description: string;
42
+ notes: CADDispatchNoteStruct[];
43
+ idents: number[];
44
+ metaData: Record<string, string>;
45
+ updated: string;
46
+ }
28
47
  export type Constructable<T> = abstract new (...args: any[]) => T;
29
48
  export interface Caches {
30
49
  CADActiveUnitsManager: [manager: typeof CADActiveUnitsManager, holds: CADActiveUnit];
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './instance/Instance';
2
2
  export * from './builders';
3
3
  export * from './libs/rest/src';
4
- export { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum, RadioSubscriptionLevel, RadioSetUserChannelsOptions, RadioChannel, RadioChannelGroup, RadioConnectedUser, RadioSpeakerLocation, RadioGetCommunityChannelsPromiseResult, RadioGetConnectedUsersPromiseResult, RadioGetConnectedUserPromiseResult, RadioSetUserChannelsPromiseResult, RadioSetUserDisplayNamePromiseResult, RadioGetServerSubscriptionFromIpPromiseResult, RadioSetServerIpPromiseResult, RadioSetInGameSpeakerLocationsPromiseResult, CADSetClockTimePromiseResult, CADJoinCommunityPromiseResult, CADLeaveCommunityPromiseResult, CADStandardResponse, CMSProfileField, CMSGetCurrentClockInPromiseResult, CMSAccountsPage, CMSAccountSummary, CMSGetAccountsPromiseResult, CMSGetProfileFieldsPromiseResult, CMSProfileFieldUpdate, CMSEditAccountProfileFieldsPromiseResult, CMSRsvpPromiseResult, CMSChangeFormStagePromiseResult, CMSSetGameServerStruct, CMSSetGameServersPromiseResult, CMSExecuteRankPromotionResult, CMSTriggerPromotionFlowPayload, CMSPromotionFlow, CMSTriggerPromotionFlowsPromiseResult, CMSGetPromotionFlowsPromiseResult, CMSCustomLogType, CMSGetCustomLogTypesPromiseResult, CMSGetFormSubmissionsPromiseResult, CMSERLCGetOnlinePlayersPromiseResult, CMSERLCGetPlayerQueuePromiseResult, CMSERLCAddNewRecordPromiseResult, CMSERLCExecuteCommandPayload, CMSERLCExecuteCommandPromiseResult, CMSERLCTeamsLockPromiseResult, CMSERLCTeamsUnlockPromiseResult } from './constants';
4
+ export { productEnums, CADNewDispatchBuilderOptions, CADDispatchCallStruct, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum, RadioSubscriptionLevel, RadioSetUserChannelsOptions, RadioChannel, RadioChannelGroup, RadioConnectedUser, RadioSpeakerLocation, RadioGetCommunityChannelsPromiseResult, RadioGetConnectedUsersPromiseResult, RadioGetConnectedUserPromiseResult, RadioSetUserChannelsPromiseResult, RadioSetUserDisplayNamePromiseResult, RadioGetServerSubscriptionFromIpPromiseResult, RadioSetServerIpPromiseResult, RadioSetInGameSpeakerLocationsPromiseResult, CADSetClockTimePromiseResult, CADJoinCommunityPromiseResult, CADLeaveCommunityPromiseResult, CADStandardResponse, CMSProfileField, CMSGetCurrentClockInPromiseResult, CMSAccountsPage, CMSAccountSummary, CMSGetAccountsPromiseResult, CMSGetProfileFieldsPromiseResult, CMSProfileFieldUpdate, CMSEditAccountProfileFieldsPromiseResult, CMSRsvpPromiseResult, CMSChangeFormStagePromiseResult, CMSSetGameServerStruct, CMSSetGameServersPromiseResult, CMSExecuteRankPromotionResult, CMSTriggerPromotionFlowPayload, CMSPromotionFlow, CMSTriggerPromotionFlowsPromiseResult, CMSGetPromotionFlowsPromiseResult, CMSCustomLogType, CMSGetCustomLogTypesPromiseResult, CMSGetFormSubmissionsPromiseResult, CMSERLCGetOnlinePlayersPromiseResult, CMSERLCGetPlayerQueuePromiseResult, CMSERLCAddNewRecordPromiseResult, CMSERLCExecuteCommandPayload, CMSERLCExecuteCommandPromiseResult, CMSERLCTeamsLockPromiseResult, CMSERLCTeamsUnlockPromiseResult } from './constants';
@@ -231,11 +231,24 @@ class REST extends events_1.EventEmitter {
231
231
  if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
232
232
  return payload;
233
233
  }
234
+ const noteTypeOrLabel = args[3];
235
+ const isNoteType = noteTypeOrLabel === 'text' || noteTypeOrLabel === 'link';
234
236
  return {
235
237
  serverId: args[0],
236
238
  callId: args[1],
237
239
  note: args[2],
238
- label: args[3]
240
+ noteType: isNoteType ? noteTypeOrLabel : undefined,
241
+ label: isNoteType ? args[4] : noteTypeOrLabel
242
+ };
243
+ }
244
+ case 'REMOVE_911': {
245
+ const payload = args[0];
246
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
247
+ return payload;
248
+ }
249
+ return {
250
+ serverId: args[0],
251
+ callId: args[1]
239
252
  };
240
253
  }
241
254
  case 'CLOSE_CALL': {
@@ -249,6 +249,11 @@ export interface CADAddCallNoteStruct {
249
249
  callId: number;
250
250
  note: string;
251
251
  label?: string;
252
+ noteType?: 'text' | 'link';
253
+ }
254
+ export interface CADRemove911Struct {
255
+ serverId: number;
256
+ callId: number;
252
257
  }
253
258
  export interface CADGetActiveUnitsStruct {
254
259
  serverId?: number;
@@ -422,7 +427,12 @@ export interface RESTTypedAPIDataStructs {
422
427
  ADD_BLIP: [data: CADAddBlipStruct[]];
423
428
  MODIFY_BLIP: [data: CADModifyBlipStruct[]];
424
429
  REMOVE_BLIP: [id: number];
425
- REMOVE_911: [callId: number];
430
+ REMOVE_911: [
431
+ serverId: number,
432
+ callId: number
433
+ ] | [
434
+ data: CADRemove911Struct
435
+ ];
426
436
  GET_CALLS: [data: CADGetCallsStruct];
427
437
  GET_MY_CALL: [data: CADGetMyCallStruct];
428
438
  GET_ACTIVE_UNITS: [data: CADGetActiveUnitsStruct];
@@ -461,6 +471,11 @@ export interface RESTTypedAPIDataStructs {
461
471
  serverId: number,
462
472
  callId: number,
463
473
  note: string
474
+ ] | [
475
+ serverId: number,
476
+ callId: number,
477
+ note: string,
478
+ noteType: 'text' | 'link'
464
479
  ] | [
465
480
  data: CADAddCallNoteStruct
466
481
  ];
@@ -1,7 +1,7 @@
1
1
  import { Instance } from '../instance/Instance';
2
2
  import { CADSubscriptionVersionEnum } from '../constants';
3
3
  import { REST } from '../libs/rest/src';
4
- import type { CADPenalCodeStruct, CADSetAPIIDStruct, CADNewEditRecordOptionOneStruct, CADNewEditRecordOptionTwoStruct, CADSendDraftStruct, CADLookupByIntStruct, CADLookupStruct, CADModifyAccountPermsStruct, CADKickBanUserStruct, CADSetPostalStruct, CADModifyIdentifierStruct, CADIdentsToGroupStruct, CADAddBlipStruct, CADModifyBlipStruct, CADGetCallsStruct, CADGetMyCallStruct, CADAddCallNoteStruct, CADGetActiveUnitsStruct, CADNewDispatchStruct, CADAttachUnitsStruct, CADDetachUnitsStruct, CADStreetSignStruct, CADUnitLocationStruct, CADUnitPanicStruct } from '../libs/rest/src';
4
+ import type { CADPenalCodeStruct, CADSetAPIIDStruct, CADNewEditRecordOptionOneStruct, CADNewEditRecordOptionTwoStruct, CADSendDraftStruct, CADLookupByIntStruct, CADLookupStruct, CADModifyAccountPermsStruct, CADKickBanUserStruct, CADSetPostalStruct, CADModifyIdentifierStruct, CADIdentsToGroupStruct, CADAddBlipStruct, CADModifyBlipStruct, CADGetCallsStruct, CADGetMyCallStruct, CADAddCallNoteStruct, CADRemove911Struct, CADGetActiveUnitsStruct, CADNewDispatchStruct, CADAttachUnitsStruct, CADDetachUnitsStruct, CADStreetSignStruct, CADUnitLocationStruct, CADUnitPanicStruct } from '../libs/rest/src';
5
5
  import { BaseManager } from './BaseManager';
6
6
  import * as globalTypes from '../constants';
7
7
  import { CADServerManager } from './CADServerManager';
@@ -207,7 +207,8 @@ export declare class CADManager extends BaseManager {
207
207
  /**
208
208
  * Removes a 911 call by its identifier.
209
209
  */
210
- remove911Call(callId: number): Promise<globalTypes.CADStandardResponse>;
210
+ remove911Call(serverId: number, callId: number): Promise<globalTypes.CADStandardResponse>;
211
+ remove911Call(params: CADRemove911Struct): Promise<globalTypes.CADStandardResponse>;
211
212
  /**
212
213
  * Retrieves dispatch calls with optional pagination.
213
214
  */
@@ -227,7 +228,7 @@ export declare class CADManager extends BaseManager {
227
228
  /**
228
229
  * Creates a new dispatch call.
229
230
  */
230
- createDispatch(data: CADNewDispatchStruct): Promise<globalTypes.CADStandardResponse>;
231
+ createDispatch(data: CADNewDispatchStruct): Promise<globalTypes.CADStandardResponse<globalTypes.CADDispatchCallStruct>>;
231
232
  /**
232
233
  * Attaches units to an existing dispatch call.
233
234
  */
@@ -250,6 +251,7 @@ export declare class CADManager extends BaseManager {
250
251
  * Adds a note to an active call.
251
252
  */
252
253
  addCallNote(serverId: number, callId: number, note: string, label?: string): Promise<globalTypes.CADStandardResponse>;
254
+ addCallNote(serverId: number, callId: number, note: string, noteType: 'text' | 'link', label?: string): Promise<globalTypes.CADStandardResponse>;
253
255
  addCallNote(params: CADAddCallNoteStruct): Promise<globalTypes.CADStandardResponse>;
254
256
  /**
255
257
  * Closes a CAD call.
@@ -535,14 +535,19 @@ class CADManager extends BaseManager_1.BaseManager {
535
535
  }
536
536
  return this.executeCadRequest('911_CALL', serverId, isEmergency, caller, location, description, metaData);
537
537
  }
538
- /**
539
- * Removes a 911 call by its identifier.
540
- */
541
- async remove911Call(callId) {
542
- if (!Number.isInteger(callId)) {
543
- throw new Error('callId must be an integer when removing a 911 call.');
538
+ async remove911Call(serverIdOrParams, callId) {
539
+ let payload;
540
+ if (serverIdOrParams && typeof serverIdOrParams === 'object') {
541
+ payload = { ...serverIdOrParams };
542
+ }
543
+ else {
544
+ payload = { serverId: serverIdOrParams, callId: callId };
544
545
  }
545
- return this.executeCadRequest('REMOVE_911', callId);
546
+ const { serverId, callId: resolvedCallId } = payload;
547
+ if (!Number.isInteger(serverId) || !Number.isInteger(resolvedCallId)) {
548
+ throw new Error('serverId and callId must be integers when removing a 911 call.');
549
+ }
550
+ return this.executeCadRequest('REMOVE_911', { serverId, callId: resolvedCallId });
546
551
  }
547
552
  /**
548
553
  * Retrieves dispatch calls with optional pagination.
@@ -675,22 +680,29 @@ class CADManager extends BaseManager_1.BaseManager {
675
680
  }
676
681
  return this.executeCadRequest('SET_CALL_PRIMARY', serverId, callId, primary, trackPrimary);
677
682
  }
678
- async addCallNote(serverIdOrParams, callId, note, label) {
683
+ async addCallNote(serverIdOrParams, callId, note, noteTypeOrLabel, label) {
679
684
  let payload;
680
685
  if (serverIdOrParams && typeof serverIdOrParams === 'object') {
681
686
  payload = { ...serverIdOrParams };
682
687
  }
683
688
  else {
684
- payload = { serverId: serverIdOrParams, callId: callId, note: note, label };
689
+ const isNoteType = noteTypeOrLabel === 'text' || noteTypeOrLabel === 'link';
690
+ payload = {
691
+ serverId: serverIdOrParams,
692
+ callId: callId,
693
+ note: note,
694
+ noteType: isNoteType ? noteTypeOrLabel : undefined,
695
+ label: isNoteType ? label : noteTypeOrLabel
696
+ };
685
697
  }
686
- const { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel } = payload;
698
+ const { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel, noteType } = payload;
687
699
  if (!Number.isInteger(serverId) || !Number.isInteger(resolvedCallId)) {
688
700
  throw new Error('serverId and callId must be integers when adding a call note.');
689
701
  }
690
702
  if (!resolvedNote) {
691
703
  throw new Error('note is required when adding a call note.');
692
704
  }
693
- return this.executeCadRequest('ADD_CALL_NOTE', { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel });
705
+ return this.executeCadRequest('ADD_CALL_NOTE', { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel, noteType });
694
706
  }
695
707
  /**
696
708
  * Closes a CAD call.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonoransoftware/sonoran.js",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
4
4
  "description": "Sonoran.js is a library that allows you to interact with the Sonoran CAD and Sonoran CMS API. Based off of and utilizes several Discord.js library techniques for ease of use.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/readme.md CHANGED
@@ -130,13 +130,13 @@ await instance.cad.setUnitPanic({ identIds: [101, 102], isPanic: true });
130
130
  - **`updateStreetSign(serverId, signData)`**
131
131
 
132
132
  ### Calls & Dispatch
133
- - **`create911Call(details)`** / **`remove911Call(callId)`**
133
+ - **`create911Call(details)`** / **`remove911Call(serverId, callId)`**
134
134
  - **`getCalls(options)`**
135
135
  - **`getMyCall({ account })`**
136
136
  - **`createDispatch(data)`** - accepts either `units` (API IDs) or `accounts` (account UUIDs) as arrays.
137
137
  - **`attachUnits(serverId, callId, unitsOrAccount)`** / **`detachUnits(serverId, unitsOrAccount)`**
138
138
  - **`setCallPostal(serverId, callId, postal)`** / **`setCallPrimary(serverId, callId, primary, trackPrimary)`**
139
- - **`addCallNote({ serverId, callId, note, label? })`**
139
+ - **`addCallNote({ serverId, callId, note, noteType?, label? })`**
140
140
  - **`closeCall(serverId, callId)`**
141
141
 
142
142
  ```js
@@ -179,8 +179,8 @@ await instance.cad.attachUnits({ serverId: 1, callId: 1001, account: '91de0ce8-c
179
179
  await instance.cad.detachUnits({ serverId: 1, account: '91de0ce8-c571-11e9-9714-5600023b2434' });
180
180
  // Fetch the current call for an account UUID
181
181
  const myCall = await instance.cad.getMyCall({ account: '91de0ce8-c571-11e9-9714-5600023b2434' });
182
- // Add a call note with optional label
183
- await instance.cad.addCallNote({ serverId: 1, callId: 1001, note: 'This is a test!', label: 'A-10' });
182
+ // Add a call note with optional type/label
183
+ await instance.cad.addCallNote({ serverId: 1, callId: 1001, note: 'This is a test!', noteType: 'text', label: 'A-10' });
184
184
  ```
185
185
 
186
186
  ## CAD Server Functions
package/src/constants.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Collection } from '@discordjs/collection';
2
2
  import { CADDispatchOriginEnums, CADDispatchStatusEnums } from './libs/rest/src';
3
+ import type { CADDispatchNoteStruct } from './libs/rest/src';
3
4
  import { DataManager } from './managers/DataManager';
4
5
  import { CADActiveUnitsManager } from './managers/CADActiveUnitsManager';
5
6
  import { CADActiveUnit } from './structures/CADActiveUnit';
@@ -28,6 +29,25 @@ export interface CADNewDispatchBuilderOptions {
28
29
  deleteAfterMinutes?: number;
29
30
  }
30
31
 
32
+ export interface CADDispatchCallStruct {
33
+ callId: number;
34
+ origin: CADDispatchOriginEnums;
35
+ status: CADDispatchStatusEnums;
36
+ priority: 1 | 2 | 3;
37
+ block: string;
38
+ address: string;
39
+ postal: string;
40
+ title: string;
41
+ code: string;
42
+ primary: number;
43
+ trackPrimary: boolean;
44
+ description: string;
45
+ notes: CADDispatchNoteStruct[];
46
+ idents: number[];
47
+ metaData: Record<string, string>;
48
+ updated: string;
49
+ }
50
+
31
51
  export type Constructable<T> = abstract new (...args: any[]) => T;
32
52
 
33
53
  export interface Caches {
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ export * from './libs/rest/src';
4
4
  export {
5
5
  productEnums,
6
6
  CADNewDispatchBuilderOptions,
7
+ CADDispatchCallStruct,
7
8
  CADSubscriptionVersionEnum,
8
9
  CMSSubscriptionVersionEnum,
9
10
  RadioSubscriptionLevel,
@@ -335,11 +335,24 @@ export class REST extends EventEmitter {
335
335
  if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
336
336
  return payload;
337
337
  }
338
+ const noteTypeOrLabel = args[3];
339
+ const isNoteType = noteTypeOrLabel === 'text' || noteTypeOrLabel === 'link';
338
340
  return {
339
341
  serverId: args[0],
340
342
  callId: args[1],
341
343
  note: args[2],
342
- label: args[3]
344
+ noteType: isNoteType ? noteTypeOrLabel : undefined,
345
+ label: isNoteType ? args[4] : noteTypeOrLabel
346
+ };
347
+ }
348
+ case 'REMOVE_911': {
349
+ const payload = args[0];
350
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
351
+ return payload;
352
+ }
353
+ return {
354
+ serverId: args[0],
355
+ callId: args[1]
343
356
  };
344
357
  }
345
358
  case 'CLOSE_CALL': {
@@ -954,6 +954,12 @@ export interface CADAddCallNoteStruct {
954
954
  callId: number;
955
955
  note: string;
956
956
  label?: string;
957
+ noteType?: 'text' | 'link';
958
+ }
959
+
960
+ export interface CADRemove911Struct {
961
+ serverId: number;
962
+ callId: number;
957
963
  }
958
964
 
959
965
  export interface CADGetActiveUnitsStruct {
@@ -1135,7 +1141,12 @@ export interface RESTTypedAPIDataStructs {
1135
1141
  ADD_BLIP: [data: CADAddBlipStruct[]];
1136
1142
  MODIFY_BLIP: [data: CADModifyBlipStruct[]];
1137
1143
  REMOVE_BLIP: [id: number];
1138
- REMOVE_911: [callId: number];
1144
+ REMOVE_911: [
1145
+ serverId: number,
1146
+ callId: number
1147
+ ] | [
1148
+ data: CADRemove911Struct
1149
+ ];
1139
1150
  GET_CALLS: [data: CADGetCallsStruct];
1140
1151
  GET_MY_CALL: [data: CADGetMyCallStruct];
1141
1152
  GET_ACTIVE_UNITS: [data: CADGetActiveUnitsStruct];
@@ -1174,6 +1185,11 @@ export interface RESTTypedAPIDataStructs {
1174
1185
  serverId: number,
1175
1186
  callId: number,
1176
1187
  note: string
1188
+ ] | [
1189
+ serverId: number,
1190
+ callId: number,
1191
+ note: string,
1192
+ noteType: 'text' | 'link'
1177
1193
  ] | [
1178
1194
  data: CADAddCallNoteStruct
1179
1195
  ];
@@ -20,6 +20,7 @@ import type {
20
20
  CADGetCallsStruct,
21
21
  CADGetMyCallStruct,
22
22
  CADAddCallNoteStruct,
23
+ CADRemove911Struct,
23
24
  CADGetActiveUnitsStruct,
24
25
  CADNewDispatchStruct,
25
26
  CADAttachUnitsStruct,
@@ -587,11 +588,20 @@ export class CADManager extends BaseManager {
587
588
  /**
588
589
  * Removes a 911 call by its identifier.
589
590
  */
590
- public async remove911Call(callId: number): Promise<globalTypes.CADStandardResponse> {
591
- if (!Number.isInteger(callId)) {
592
- throw new Error('callId must be an integer when removing a 911 call.');
591
+ public async remove911Call(serverId: number, callId: number): Promise<globalTypes.CADStandardResponse>;
592
+ public async remove911Call(params: CADRemove911Struct): Promise<globalTypes.CADStandardResponse>;
593
+ public async remove911Call(serverIdOrParams: number | CADRemove911Struct, callId?: number): Promise<globalTypes.CADStandardResponse> {
594
+ let payload: CADRemove911Struct;
595
+ if (serverIdOrParams && typeof serverIdOrParams === 'object') {
596
+ payload = { ...serverIdOrParams };
597
+ } else {
598
+ payload = { serverId: serverIdOrParams as number, callId: callId as number };
599
+ }
600
+ const { serverId, callId: resolvedCallId } = payload;
601
+ if (!Number.isInteger(serverId) || !Number.isInteger(resolvedCallId)) {
602
+ throw new Error('serverId and callId must be integers when removing a 911 call.');
593
603
  }
594
- return this.executeCadRequest('REMOVE_911', callId);
604
+ return this.executeCadRequest('REMOVE_911', { serverId, callId: resolvedCallId });
595
605
  }
596
606
 
597
607
  /**
@@ -634,7 +644,7 @@ export class CADManager extends BaseManager {
634
644
  /**
635
645
  * Creates a new dispatch call.
636
646
  */
637
- public async createDispatch(data: CADNewDispatchStruct): Promise<globalTypes.CADStandardResponse> {
647
+ public async createDispatch(data: CADNewDispatchStruct): Promise<globalTypes.CADStandardResponse<globalTypes.CADDispatchCallStruct>> {
638
648
  const hasUnits = Array.isArray(data.units);
639
649
  const hasAccounts = Array.isArray(data.accounts);
640
650
  const payload: CADNewDispatchStruct = {
@@ -756,27 +766,36 @@ export class CADManager extends BaseManager {
756
766
  * Adds a note to an active call.
757
767
  */
758
768
  public async addCallNote(serverId: number, callId: number, note: string, label?: string): Promise<globalTypes.CADStandardResponse>;
769
+ public async addCallNote(serverId: number, callId: number, note: string, noteType: 'text' | 'link', label?: string): Promise<globalTypes.CADStandardResponse>;
759
770
  public async addCallNote(params: CADAddCallNoteStruct): Promise<globalTypes.CADStandardResponse>;
760
771
  public async addCallNote(
761
772
  serverIdOrParams: number | CADAddCallNoteStruct,
762
773
  callId?: number,
763
774
  note?: string,
775
+ noteTypeOrLabel?: 'text' | 'link' | string,
764
776
  label?: string
765
777
  ): Promise<globalTypes.CADStandardResponse> {
766
778
  let payload: CADAddCallNoteStruct;
767
779
  if (serverIdOrParams && typeof serverIdOrParams === 'object') {
768
780
  payload = { ...serverIdOrParams };
769
781
  } else {
770
- payload = { serverId: serverIdOrParams as number, callId: callId as number, note: note as string, label };
782
+ const isNoteType = noteTypeOrLabel === 'text' || noteTypeOrLabel === 'link';
783
+ payload = {
784
+ serverId: serverIdOrParams as number,
785
+ callId: callId as number,
786
+ note: note as string,
787
+ noteType: isNoteType ? (noteTypeOrLabel as 'text' | 'link') : undefined,
788
+ label: isNoteType ? label : (noteTypeOrLabel as string | undefined)
789
+ };
771
790
  }
772
- const { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel } = payload;
791
+ const { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel, noteType } = payload;
773
792
  if (!Number.isInteger(serverId) || !Number.isInteger(resolvedCallId)) {
774
793
  throw new Error('serverId and callId must be integers when adding a call note.');
775
794
  }
776
795
  if (!resolvedNote) {
777
796
  throw new Error('note is required when adding a call note.');
778
797
  }
779
- return this.executeCadRequest('ADD_CALL_NOTE', { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel });
798
+ return this.executeCadRequest('ADD_CALL_NOTE', { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel, noteType });
780
799
  }
781
800
 
782
801
  /**