@@ -1067,35 +1067,22 @@ export function DisableAssistantAuthentication(
10671067
10681068export function GetAllAssistantWebhook (
10691069 connectionConfig : ConnectionConfig ,
1070- assistantId : string ,
1071- page : number ,
1072- pageSize : number ,
1073- criteria : { key : string ; value : string } [ ] ,
1074- cb : (
1075- err : ServiceError | null ,
1076- response : GetAllAssistantWebhookResponse | null
1077- ) => void ,
1078- authHeader : ClientAuthInfo | UserAuthInfo
1079- ) {
1080- const req = new GetAllAssistantWebhookRequest ( ) ;
1081- const paginate = new Paginate ( ) ;
1082- criteria . forEach ( ( { key, value } ) => {
1083- const ctr = new Criteria ( ) ;
1084- ctr . setKey ( key ) ;
1085- ctr . setValue ( value ) ;
1086- req . addCriterias ( ctr ) ;
1070+ req : GetAllAssistantWebhookRequest ,
1071+ authHeader ?: ClientAuthInfo | UserAuthInfo
1072+ ) : Promise < GetAllAssistantWebhookResponse > {
1073+ return new Promise ( ( resolve , reject ) => {
1074+ connectionConfig . assistantClient . getAllAssistantWebhook (
1075+ req ,
1076+ WithAuthContext ( connectionConfig . auth || authHeader ) ,
1077+ (
1078+ err : ServiceError | null ,
1079+ response : GetAllAssistantWebhookResponse | null
1080+ ) => {
1081+ if ( err ) reject ( err ) ;
1082+ else resolve ( response ! ) ;
1083+ }
1084+ ) ;
10871085 } ) ;
1088-
1089- paginate . setPage ( page ) ;
1090- paginate . setPagesize ( pageSize ) ;
1091- req . setPaginate ( paginate ) ;
1092-
1093- req . setAssistantid ( assistantId ) ;
1094- return connectionConfig . assistantClient . getAllAssistantWebhook (
1095- req ,
1096- WithAuthContext ( authHeader ) ,
1097- cb
1098- ) ;
10991086}
11001087
11011088/**
@@ -1117,44 +1104,22 @@ export function GetAllAssistantWebhook(
11171104 */
11181105export function CreateWebhook (
11191106 connectionConfig : ConnectionConfig ,
1120- assistantId : string ,
1121- method : string ,
1122- endpoint : string ,
1123- headers : { key : string ; value : string } [ ] ,
1124- parameters : { key : string ; value : string } [ ] ,
1125- events : string [ ] ,
1126- retryOnStatus : string [ ] ,
1127- maxRetries : number ,
1128- timeout : number ,
1129- priority : number ,
1130- cb : (
1131- err : ServiceError | null ,
1132- response : GetAssistantWebhookResponse | null
1133- ) => void ,
1134- authHeader : UserAuthInfo ,
1135- description ?: string
1136- ) {
1137- const req = new CreateAssistantWebhookRequest ( ) ;
1138- req . setAssistantid ( assistantId ) ;
1139- req . setHttpurl ( endpoint ) ;
1140- req . setHttpmethod ( method ) ;
1141- req . setAssistanteventsList ( events ) ;
1142- headers . forEach ( ( k ) => {
1143- req . getHttpheadersMap ( ) . set ( k . key , k . value ) ;
1144- } ) ;
1145- parameters . forEach ( ( k ) => {
1146- req . getHttpbodyMap ( ) . set ( k . key , k . value ) ;
1107+ req : CreateAssistantWebhookRequest ,
1108+ authHeader ?: UserAuthInfo | ClientAuthInfo
1109+ ) : Promise < GetAssistantWebhookResponse > {
1110+ return new Promise ( ( resolve , reject ) => {
1111+ connectionConfig . assistantClient . createAssistantWebhook (
1112+ req ,
1113+ WithAuthContext ( connectionConfig . auth || authHeader ) ,
1114+ (
1115+ err : ServiceError | null ,
1116+ response : GetAssistantWebhookResponse | null
1117+ ) => {
1118+ if ( err ) reject ( err ) ;
1119+ else resolve ( response ! ) ;
1120+ }
1121+ ) ;
11471122 } ) ;
1148- req . setRetrystatuscodesList ( retryOnStatus ) ;
1149- req . setMaxretrycount ( maxRetries ) ;
1150- req . setTimeoutsecond ( timeout ) ;
1151- req . setExecutionpriority ( priority ) ;
1152- if ( description ) req . setDescription ( description ) ;
1153- return connectionConfig . assistantClient . createAssistantWebhook (
1154- req ,
1155- WithAuthContext ( authHeader ) ,
1156- cb
1157- ) ;
11581123}
11591124
11601125/**
@@ -1175,46 +1140,22 @@ export function CreateWebhook(
11751140 */
11761141export function UpdateWebhook (
11771142 connectionConfig : ConnectionConfig ,
1178- assistantId : string ,
1179- webhookId : string ,
1180- method : string ,
1181- endpoint : string ,
1182- headers : { key : string ; value : string } [ ] ,
1183- parameters : { key : string ; value : string } [ ] ,
1184- events : string [ ] ,
1185- retryOnStatus : string [ ] ,
1186- maxRetries : number ,
1187- timeout : number ,
1188- priority : number ,
1189- cb : (
1190- err : ServiceError | null ,
1191- response : GetAssistantWebhookResponse | null
1192- ) => void ,
1193- authHeader : UserAuthInfo ,
1194- description ?: string
1195- ) {
1196- const req = new UpdateAssistantWebhookRequest ( ) ;
1197- req . setId ( webhookId ) ;
1198- req . setAssistantid ( assistantId ) ;
1199- req . setHttpurl ( endpoint ) ;
1200- req . setHttpmethod ( method ) ;
1201- req . setAssistanteventsList ( events ) ;
1202- headers . forEach ( ( k ) => {
1203- req . getHttpheadersMap ( ) . set ( k . key , k . value ) ;
1204- } ) ;
1205- parameters . forEach ( ( k ) => {
1206- req . getHttpbodyMap ( ) . set ( k . key , k . value ) ;
1143+ req : UpdateAssistantWebhookRequest ,
1144+ authHeader ?: UserAuthInfo | ClientAuthInfo
1145+ ) : Promise < GetAssistantWebhookResponse > {
1146+ return new Promise ( ( resolve , reject ) => {
1147+ connectionConfig . assistantClient . updateAssistantWebhook (
1148+ req ,
1149+ WithAuthContext ( connectionConfig . auth || authHeader ) ,
1150+ (
1151+ err : ServiceError | null ,
1152+ response : GetAssistantWebhookResponse | null
1153+ ) => {
1154+ if ( err ) reject ( err ) ;
1155+ else resolve ( response ! ) ;
1156+ }
1157+ ) ;
12071158 } ) ;
1208- req . setRetrystatuscodesList ( retryOnStatus ) ;
1209- req . setMaxretrycount ( maxRetries ) ;
1210- req . setTimeoutsecond ( timeout ) ;
1211- req . setExecutionpriority ( priority ) ;
1212- if ( description ) req . setDescription ( description ) ;
1213- return connectionConfig . assistantClient . updateAssistantWebhook (
1214- req ,
1215- WithAuthContext ( authHeader ) ,
1216- cb
1217- ) ;
12181159}
12191160
12201161/**
@@ -1227,22 +1168,22 @@ export function UpdateWebhook(
12271168 */
12281169export function GetAssistantWebhook (
12291170 connectionConfig : ConnectionConfig ,
1230- assistantId : string ,
1231- webhookId : string ,
1232- cb : (
1233- err : ServiceError | null ,
1234- response : GetAssistantWebhookResponse | null
1235- ) => void ,
1236- authHeader : ClientAuthInfo | UserAuthInfo
1237- ) {
1238- const req = new GetAssistantWebhookRequest ( ) ;
1239- req . setAssistantid ( assistantId ) ;
1240- req . setId ( webhookId ) ;
1241- return connectionConfig . assistantClient . getAssistantWebhook (
1242- req ,
1243- WithAuthContext ( authHeader ) ,
1244- cb
1245- ) ;
1171+ req : GetAssistantWebhookRequest ,
1172+ authHeader ?: ClientAuthInfo | UserAuthInfo
1173+ ) : Promise < GetAssistantWebhookResponse > {
1174+ return new Promise ( ( resolve , reject ) => {
1175+ connectionConfig . assistantClient . getAssistantWebhook (
1176+ req ,
1177+ WithAuthContext ( connectionConfig . auth || authHeader ) ,
1178+ (
1179+ err : ServiceError | null ,
1180+ response : GetAssistantWebhookResponse | null
1181+ ) => {
1182+ if ( err ) reject ( err ) ;
1183+ else resolve ( response ! ) ;
1184+ }
1185+ ) ;
1186+ } ) ;
12461187}
12471188
12481189/**
@@ -1255,22 +1196,22 @@ export function GetAssistantWebhook(
12551196 */
12561197export function DeleteAssistantWebhook (
12571198 connectionConfig : ConnectionConfig ,
1258- assistantId : string ,
1259- webhookId : string ,
1260- cb : (
1261- err : ServiceError | null ,
1262- response : GetAssistantWebhookResponse | null
1263- ) => void ,
1264- authHeader : UserAuthInfo
1265- ) {
1266- const req = new DeleteAssistantWebhookRequest ( ) ;
1267- req . setAssistantid ( assistantId ) ;
1268- req . setId ( webhookId ) ;
1269- return connectionConfig . assistantClient . deleteAssistantWebhook (
1270- req ,
1271- WithAuthContext ( authHeader ) ,
1272- cb
1273- ) ;
1199+ req : DeleteAssistantWebhookRequest ,
1200+ authHeader ?: UserAuthInfo | ClientAuthInfo
1201+ ) : Promise < GetAssistantWebhookResponse > {
1202+ return new Promise ( ( resolve , reject ) => {
1203+ connectionConfig . assistantClient . deleteAssistantWebhook (
1204+ req ,
1205+ WithAuthContext ( connectionConfig . auth || authHeader ) ,
1206+ (
1207+ err : ServiceError | null ,
1208+ response : GetAssistantWebhookResponse | null
1209+ ) => {
1210+ if ( err ) reject ( err ) ;
1211+ else resolve ( response ! ) ;
1212+ }
1213+ ) ;
1214+ } ) ;
12741215}
12751216
12761217/**
0 commit comments