retell-sdk 1.15.21 → 2.2.2
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/README.md +3 -629
- package/example.d.ts +2 -0
- package/example.d.ts.map +1 -0
- package/example.js +74 -0
- package/example.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/{dist/index.js → index.js} +2 -0
- package/index.js.map +1 -0
- package/lib/base64.d.ts +10 -0
- package/lib/base64.d.ts.map +1 -0
- package/lib/base64.js +61 -0
- package/lib/base64.js.map +1 -0
- package/lib/config.d.ts +31 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +36 -0
- package/lib/config.js.map +1 -0
- package/lib/encodings.d.ts +41 -0
- package/lib/encodings.d.ts.map +1 -0
- package/lib/encodings.js +308 -0
- package/lib/encodings.js.map +1 -0
- package/lib/http.d.ts +45 -0
- package/lib/http.d.ts.map +1 -0
- package/lib/http.js +136 -0
- package/lib/http.js.map +1 -0
- package/lib/retries.d.ts +18 -0
- package/lib/retries.d.ts.map +1 -0
- package/lib/retries.js +136 -0
- package/lib/retries.js.map +1 -0
- package/lib/sdks.d.ts +32 -0
- package/lib/sdks.d.ts.map +1 -0
- package/lib/sdks.js +90 -0
- package/lib/sdks.js.map +1 -0
- package/lib/security.d.ts +57 -0
- package/lib/security.d.ts.map +1 -0
- package/lib/security.js +99 -0
- package/lib/security.js.map +1 -0
- package/lib/url.d.ts +4 -0
- package/lib/url.d.ts.map +1 -0
- package/lib/url.js +26 -0
- package/lib/url.js.map +1 -0
- package/models/components/agent.d.ts +180 -0
- package/models/components/agent.d.ts.map +1 -0
- package/models/components/agent.js +182 -0
- package/models/components/agent.js.map +1 -0
- package/models/components/agentnodefaultnorequired.d.ts +61 -0
- package/models/components/agentnodefaultnorequired.d.ts.map +1 -0
- package/models/components/agentnodefaultnorequired.js +66 -0
- package/models/components/agentnodefaultnorequired.js.map +1 -0
- package/models/components/agentpromptparams.d.ts +25 -0
- package/models/components/agentpromptparams.d.ts.map +1 -0
- package/models/components/agentpromptparams.js +34 -0
- package/models/components/agentpromptparams.js.map +1 -0
- package/models/components/calldetail.d.ts +92 -0
- package/models/components/calldetail.d.ts.map +1 -0
- package/models/components/calldetail.js +94 -0
- package/models/components/calldetail.js.map +1 -0
- package/models/components/callphonenumber.d.ts +28 -0
- package/models/components/callphonenumber.d.ts.map +1 -0
- package/models/components/callphonenumber.js +34 -0
- package/models/components/callphonenumber.js.map +1 -0
- package/{dist/models → models}/components/index.d.ts +1 -1
- package/models/components/index.d.ts.map +1 -0
- package/{dist/models → models}/components/index.js +1 -1
- package/models/components/index.js.map +1 -0
- package/{dist/models → models}/components/phonenumber.d.ts +22 -2
- package/models/components/phonenumber.d.ts.map +1 -0
- package/models/components/phonenumber.js +46 -0
- package/models/components/phonenumber.js.map +1 -0
- package/models/components/security.d.ts +4 -0
- package/models/components/security.d.ts.map +1 -0
- package/models/components/security.js +6 -0
- package/models/components/security.js.map +1 -0
- package/models/errors/createagent.d.ts +146 -0
- package/models/errors/createagent.d.ts.map +1 -0
- package/models/errors/createagent.js +236 -0
- package/models/errors/createagent.js.map +1 -0
- package/models/errors/createphonecall.d.ts +218 -0
- package/models/errors/createphonecall.d.ts.map +1 -0
- package/models/errors/createphonecall.js +350 -0
- package/models/errors/createphonecall.js.map +1 -0
- package/models/errors/createphonenumber.d.ts +182 -0
- package/models/errors/createphonenumber.d.ts.map +1 -0
- package/models/errors/createphonenumber.js +295 -0
- package/models/errors/createphonenumber.js.map +1 -0
- package/models/errors/deleteagent.d.ts +146 -0
- package/models/errors/deleteagent.d.ts.map +1 -0
- package/models/errors/deleteagent.js +236 -0
- package/models/errors/deleteagent.js.map +1 -0
- package/models/errors/deletephonenumber.d.ts +146 -0
- package/models/errors/deletephonenumber.d.ts.map +1 -0
- package/models/errors/deletephonenumber.js +238 -0
- package/models/errors/deletephonenumber.js.map +1 -0
- package/models/errors/getagent.d.ts +146 -0
- package/models/errors/getagent.d.ts.map +1 -0
- package/models/errors/getagent.js +236 -0
- package/models/errors/getagent.js.map +1 -0
- package/models/errors/getcall.d.ts +146 -0
- package/models/errors/getcall.d.ts.map +1 -0
- package/models/errors/getcall.js +240 -0
- package/models/errors/getcall.js.map +1 -0
- package/models/errors/getphonenumber.d.ts +146 -0
- package/models/errors/getphonenumber.d.ts.map +1 -0
- package/models/errors/getphonenumber.js +236 -0
- package/models/errors/getphonenumber.js.map +1 -0
- package/{dist/models → models}/errors/index.d.ts +1 -0
- package/models/errors/index.d.ts.map +1 -0
- package/{dist/models → models}/errors/index.js +1 -0
- package/models/errors/index.js.map +1 -0
- package/models/errors/listagents.d.ts +74 -0
- package/models/errors/listagents.d.ts.map +1 -0
- package/models/errors/listagents.js +124 -0
- package/models/errors/listagents.js.map +1 -0
- package/models/errors/listcalls.d.ts +110 -0
- package/models/errors/listcalls.d.ts.map +1 -0
- package/models/errors/listcalls.js +181 -0
- package/models/errors/listcalls.js.map +1 -0
- package/models/errors/listphonenumbers.d.ts +110 -0
- package/models/errors/listphonenumbers.d.ts.map +1 -0
- package/models/errors/listphonenumbers.js +179 -0
- package/models/errors/listphonenumbers.js.map +1 -0
- package/models/errors/sdkerror.d.ts +7 -0
- package/models/errors/sdkerror.d.ts.map +1 -0
- package/models/errors/sdkerror.js +22 -0
- package/models/errors/sdkerror.js.map +1 -0
- package/models/errors/updateagent.d.ts +146 -0
- package/models/errors/updateagent.d.ts.map +1 -0
- package/models/errors/updateagent.js +236 -0
- package/models/errors/updateagent.js.map +1 -0
- package/models/errors/updatephoneagent.d.ts +146 -0
- package/models/errors/updatephoneagent.d.ts.map +1 -0
- package/models/errors/updatephoneagent.js +236 -0
- package/models/errors/updatephoneagent.js.map +1 -0
- package/models/operations/createagent.d.ts +70 -0
- package/models/operations/createagent.d.ts.map +1 -0
- package/models/operations/createagent.js +102 -0
- package/models/operations/createagent.js.map +1 -0
- package/models/operations/createphonecall.d.ts +163 -0
- package/models/operations/createphonecall.d.ts.map +1 -0
- package/models/operations/createphonecall.js +196 -0
- package/models/operations/createphonecall.js.map +1 -0
- package/models/operations/createphonenumber.d.ts +61 -0
- package/models/operations/createphonenumber.d.ts.map +1 -0
- package/models/operations/createphonenumber.js +94 -0
- package/models/operations/createphonenumber.js.map +1 -0
- package/models/operations/createwebcall.d.ts +16 -0
- package/models/operations/createwebcall.d.ts.map +1 -0
- package/models/operations/createwebcall.js +3 -0
- package/models/operations/createwebcall.js.map +1 -0
- package/models/operations/deleteagent.d.ts +48 -0
- package/models/operations/deleteagent.d.ts.map +1 -0
- package/models/operations/deleteagent.js +62 -0
- package/models/operations/deleteagent.js.map +1 -0
- package/models/operations/deletephonenumber.d.ts +48 -0
- package/models/operations/deletephonenumber.d.ts.map +1 -0
- package/models/operations/deletephonenumber.js +62 -0
- package/models/operations/deletephonenumber.js.map +1 -0
- package/models/operations/getagent.d.ts +55 -0
- package/models/operations/getagent.d.ts.map +1 -0
- package/models/operations/getagent.js +90 -0
- package/models/operations/getagent.js.map +1 -0
- package/models/operations/getcall.d.ts +55 -0
- package/models/operations/getcall.d.ts.map +1 -0
- package/models/operations/getcall.js +90 -0
- package/models/operations/getcall.js.map +1 -0
- package/models/operations/getphonenumber.d.ts +55 -0
- package/models/operations/getphonenumber.d.ts.map +1 -0
- package/models/operations/getphonenumber.js +90 -0
- package/models/operations/getphonenumber.js.map +1 -0
- package/{dist/models → models}/operations/index.d.ts +2 -0
- package/models/operations/index.d.ts.map +1 -0
- package/{dist/models → models}/operations/index.js +2 -0
- package/models/operations/index.js.map +1 -0
- package/models/operations/listagents.d.ts +38 -0
- package/models/operations/listagents.d.ts.map +1 -0
- package/models/operations/listagents.js +68 -0
- package/models/operations/listagents.js.map +1 -0
- package/models/operations/listcalls.d.ts +127 -0
- package/models/operations/listcalls.d.ts.map +1 -0
- package/models/operations/listcalls.js +174 -0
- package/models/operations/listcalls.js.map +1 -0
- package/models/operations/listphonenumbers.d.ts +38 -0
- package/models/operations/listphonenumbers.d.ts.map +1 -0
- package/models/operations/listphonenumbers.js +68 -0
- package/models/operations/listphonenumbers.js.map +1 -0
- package/models/operations/updateagent.d.ts +90 -0
- package/models/operations/updateagent.d.ts.map +1 -0
- package/models/operations/updateagent.js +128 -0
- package/models/operations/updateagent.js.map +1 -0
- package/models/operations/updatephoneagent.d.ts +75 -0
- package/models/operations/updatephoneagent.d.ts.map +1 -0
- package/models/operations/updatephoneagent.js +116 -0
- package/models/operations/updatephoneagent.js.map +1 -0
- package/package.json +27 -30
- package/sdk/index.d.ts +3 -0
- package/sdk/index.d.ts.map +1 -0
- package/{dist/sdk → sdk}/index.js +2 -0
- package/sdk/index.js.map +1 -0
- package/sdk/liveClient.d.ts +14 -0
- package/sdk/liveClient.d.ts.map +1 -0
- package/sdk/liveClient.js +98 -0
- package/sdk/liveClient.js.map +1 -0
- package/sdk/sdk.d.ts +62 -0
- package/sdk/sdk.d.ts.map +1 -0
- package/sdk/sdk.js +1137 -0
- package/sdk/sdk.js.map +1 -0
- package/src/example.ts +79 -0
- package/src/index.ts +6 -0
- package/src/lib/base64.ts +37 -0
- package/src/lib/config.ts +57 -0
- package/src/lib/encodings.ts +379 -0
- package/src/lib/http.ts +203 -0
- package/src/lib/retries.ts +207 -0
- package/src/lib/sdks.ts +107 -0
- package/src/lib/security.ts +164 -0
- package/src/lib/url.ts +31 -0
- package/src/models/components/agent.ts +356 -0
- package/src/models/components/agentpromptparams.ts +53 -0
- package/src/models/components/calldetail.ts +160 -0
- package/src/models/components/callphonenumber.ts +56 -0
- package/src/models/components/index.ts +10 -0
- package/src/models/components/phonenumber.ts +83 -0
- package/src/models/components/security.ts +7 -0
- package/src/models/errors/createagent.ts +394 -0
- package/src/models/errors/createphonecall.ts +597 -0
- package/src/models/errors/createphonenumber.ts +500 -0
- package/src/models/errors/deleteagent.ts +394 -0
- package/src/models/errors/deletephonenumber.ts +400 -0
- package/src/models/errors/getagent.ts +383 -0
- package/src/models/errors/getcall.ts +379 -0
- package/src/models/errors/getphonenumber.ts +397 -0
- package/src/models/errors/index.ts +18 -0
- package/src/models/errors/listagents.ts +192 -0
- package/src/models/errors/listcalls.ts +289 -0
- package/src/models/errors/listphonenumbers.ts +297 -0
- package/src/models/errors/sdkerror.ts +24 -0
- package/src/models/errors/updateagent.ts +394 -0
- package/src/models/errors/updatephoneagent.ts +397 -0
- package/src/models/operations/createagent.ts +145 -0
- package/src/models/operations/createphonecall.ts +308 -0
- package/src/models/operations/createphonenumber.ts +124 -0
- package/src/models/operations/createwebcall.ts +16 -0
- package/src/models/operations/deleteagent.ts +103 -0
- package/src/models/operations/deletephonenumber.ts +103 -0
- package/src/models/operations/getagent.ts +114 -0
- package/src/models/operations/getcall.ts +114 -0
- package/src/models/operations/getphonenumber.ts +114 -0
- package/src/models/operations/index.ts +18 -0
- package/src/models/operations/listagents.ts +76 -0
- package/src/models/operations/listcalls.ts +255 -0
- package/src/models/operations/listphonenumbers.ts +76 -0
- package/src/models/operations/updateagent.ts +190 -0
- package/src/models/operations/updatephoneagent.ts +159 -0
- package/src/sdk/index.ts +6 -0
- package/src/sdk/liveClient.ts +109 -0
- package/src/sdk/sdk.ts +1191 -0
- package/src/types/blobs.ts +30 -0
- package/src/types/decimal.ts +5 -0
- package/src/types/index.ts +8 -0
- package/src/types/operations.ts +6 -0
- package/src/types/rfcdate.ts +54 -0
- package/types/blobs.d.ts +4 -0
- package/types/blobs.d.ts.map +1 -0
- package/types/blobs.js +52 -0
- package/types/blobs.js.map +1 -0
- package/types/decimal.d.ts +2 -0
- package/types/decimal.d.ts.map +1 -0
- package/{dist/types/index.js → types/decimal.js} +2 -1
- package/types/decimal.js.map +1 -0
- package/types/index.d.ts +5 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +14 -0
- package/types/index.js.map +1 -0
- package/types/operations.d.ts +5 -0
- package/types/operations.d.ts.map +1 -0
- package/types/operations.js +6 -0
- package/types/operations.js.map +1 -0
- package/types/rfcdate.d.ts +21 -0
- package/types/rfcdate.d.ts.map +1 -0
- package/types/rfcdate.js +46 -0
- package/types/rfcdate.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/internal/utils/contenttype.d.ts +0 -1
- package/dist/internal/utils/contenttype.js +0 -33
- package/dist/internal/utils/headers.d.ts +0 -4
- package/dist/internal/utils/headers.js +0 -92
- package/dist/internal/utils/index.d.ts +0 -8
- package/dist/internal/utils/index.js +0 -27
- package/dist/internal/utils/pathparams.d.ts +0 -2
- package/dist/internal/utils/pathparams.js +0 -53
- package/dist/internal/utils/queryparams.d.ts +0 -2
- package/dist/internal/utils/queryparams.js +0 -182
- package/dist/internal/utils/requestbody.d.ts +0 -2
- package/dist/internal/utils/requestbody.js +0 -328
- package/dist/internal/utils/retries.d.ts +0 -20
- package/dist/internal/utils/retries.js +0 -250
- package/dist/internal/utils/security.d.ts +0 -5
- package/dist/internal/utils/security.js +0 -196
- package/dist/internal/utils/utils.d.ts +0 -37
- package/dist/internal/utils/utils.js +0 -368
- package/dist/models/components/agent.d.ts +0 -43
- package/dist/models/components/agent.js +0 -90
- package/dist/models/components/agentnodefaultnorequired.d.ts +0 -35
- package/dist/models/components/agentnodefaultnorequired.js +0 -80
- package/dist/models/components/agentpromptparams.d.ts +0 -11
- package/dist/models/components/agentpromptparams.js +0 -50
- package/dist/models/components/calldetail.d.ts +0 -58
- package/dist/models/components/calldetail.js +0 -112
- package/dist/models/components/callphonenumber.d.ts +0 -14
- package/dist/models/components/callphonenumber.js +0 -53
- package/dist/models/components/phonenumber.js +0 -65
- package/dist/models/components/security.d.ts +0 -4
- package/dist/models/components/security.js +0 -45
- package/dist/models/errors/createagent.d.ts +0 -45
- package/dist/models/errors/createagent.js +0 -144
- package/dist/models/errors/createphonecall.d.ts +0 -67
- package/dist/models/errors/createphonecall.js +0 -200
- package/dist/models/errors/createphonenumber.d.ts +0 -56
- package/dist/models/errors/createphonenumber.js +0 -172
- package/dist/models/errors/deleteagent.d.ts +0 -45
- package/dist/models/errors/deleteagent.js +0 -144
- package/dist/models/errors/deletephonenumber.d.ts +0 -45
- package/dist/models/errors/deletephonenumber.js +0 -144
- package/dist/models/errors/getagent.d.ts +0 -45
- package/dist/models/errors/getagent.js +0 -144
- package/dist/models/errors/getcall.d.ts +0 -45
- package/dist/models/errors/getcall.js +0 -144
- package/dist/models/errors/getphonenumber.d.ts +0 -45
- package/dist/models/errors/getphonenumber.js +0 -144
- package/dist/models/errors/listagents.d.ts +0 -23
- package/dist/models/errors/listagents.js +0 -88
- package/dist/models/errors/listcalls.d.ts +0 -34
- package/dist/models/errors/listcalls.js +0 -116
- package/dist/models/errors/listphonenumbers.d.ts +0 -34
- package/dist/models/errors/listphonenumbers.js +0 -116
- package/dist/models/errors/sdkerror.d.ts +0 -7
- package/dist/models/errors/sdkerror.js +0 -40
- package/dist/models/errors/updateagent.d.ts +0 -45
- package/dist/models/errors/updateagent.js +0 -144
- package/dist/models/errors/updatephoneagent.d.ts +0 -45
- package/dist/models/errors/updatephoneagent.js +0 -144
- package/dist/models/operations/createagent.d.ts +0 -55
- package/dist/models/operations/createagent.js +0 -128
- package/dist/models/operations/createphonecall.d.ts +0 -87
- package/dist/models/operations/createphonecall.js +0 -187
- package/dist/models/operations/createphonenumber.d.ts +0 -31
- package/dist/models/operations/createphonenumber.js +0 -98
- package/dist/models/operations/deleteagent.d.ts +0 -22
- package/dist/models/operations/deleteagent.js +0 -63
- package/dist/models/operations/deletephonenumber.d.ts +0 -22
- package/dist/models/operations/deletephonenumber.js +0 -63
- package/dist/models/operations/getagent.d.ts +0 -27
- package/dist/models/operations/getagent.js +0 -91
- package/dist/models/operations/getcall.d.ts +0 -27
- package/dist/models/operations/getcall.js +0 -91
- package/dist/models/operations/getphonenumber.d.ts +0 -27
- package/dist/models/operations/getphonenumber.js +0 -91
- package/dist/models/operations/listagents.d.ts +0 -21
- package/dist/models/operations/listagents.js +0 -79
- package/dist/models/operations/listcalls.d.ts +0 -70
- package/dist/models/operations/listcalls.js +0 -145
- package/dist/models/operations/listphonenumbers.d.ts +0 -21
- package/dist/models/operations/listphonenumbers.js +0 -79
- package/dist/models/operations/updateagent.d.ts +0 -28
- package/dist/models/operations/updateagent.js +0 -95
- package/dist/models/operations/updatephoneagent.d.ts +0 -34
- package/dist/models/operations/updatephoneagent.js +0 -109
- package/dist/sdk/index.d.ts +0 -1
- package/dist/sdk/sdk.d.ts +0 -115
- package/dist/sdk/sdk.js +0 -1625
- package/dist/types/index.d.ts +0 -1
- package/dist/types/rfcdate.d.ts +0 -9
- package/dist/types/rfcdate.js +0 -59
- package/docs/models/components/agent.md +0 -17
- package/docs/models/components/agentnodefaultnorequired.md +0 -15
- package/docs/models/components/agentpromptparams.md +0 -9
- package/docs/models/components/calldetail.md +0 -17
- package/docs/models/components/callphonenumber.md +0 -11
- package/docs/models/components/callstatus.md +0 -12
- package/docs/models/components/calltype.md +0 -12
- package/docs/models/components/phonenumber.md +0 -12
- package/docs/models/components/security.md +0 -8
- package/docs/models/errors/createagentresponse422responsebody.md +0 -11
- package/docs/models/errors/createagentresponse500responsebody.md +0 -11
- package/docs/models/errors/createagentresponsebody.md +0 -11
- package/docs/models/errors/createagentresponseresponsebody.md +0 -11
- package/docs/models/errors/createphonecallresponse402responsebody.md +0 -11
- package/docs/models/errors/createphonecallresponse422responsebody.md +0 -11
- package/docs/models/errors/createphonecallresponse429responsebody.md +0 -11
- package/docs/models/errors/createphonecallresponse500responsebody.md +0 -11
- package/docs/models/errors/createphonecallresponsebody.md +0 -11
- package/docs/models/errors/createphonecallresponseresponsebody.md +0 -11
- package/docs/models/errors/createphonenumberresponse402responsebody.md +0 -11
- package/docs/models/errors/createphonenumberresponse422responsebody.md +0 -11
- package/docs/models/errors/createphonenumberresponse500responsebody.md +0 -11
- package/docs/models/errors/createphonenumberresponsebody.md +0 -11
- package/docs/models/errors/createphonenumberresponseresponsebody.md +0 -11
- package/docs/models/errors/deleteagentresponse422responsebody.md +0 -11
- package/docs/models/errors/deleteagentresponse500responsebody.md +0 -11
- package/docs/models/errors/deleteagentresponsebody.md +0 -11
- package/docs/models/errors/deleteagentresponseresponsebody.md +0 -11
- package/docs/models/errors/deletephonenumberresponse422responsebody.md +0 -11
- package/docs/models/errors/deletephonenumberresponse500responsebody.md +0 -11
- package/docs/models/errors/deletephonenumberresponsebody.md +0 -11
- package/docs/models/errors/deletephonenumberresponseresponsebody.md +0 -11
- package/docs/models/errors/getagentresponse422responsebody.md +0 -11
- package/docs/models/errors/getagentresponse500responsebody.md +0 -11
- package/docs/models/errors/getagentresponsebody.md +0 -11
- package/docs/models/errors/getagentresponseresponsebody.md +0 -11
- package/docs/models/errors/getcallresponse422responsebody.md +0 -11
- package/docs/models/errors/getcallresponse500responsebody.md +0 -11
- package/docs/models/errors/getcallresponsebody.md +0 -11
- package/docs/models/errors/getcallresponseresponsebody.md +0 -11
- package/docs/models/errors/getphonenumberresponse422responsebody.md +0 -11
- package/docs/models/errors/getphonenumberresponse500responsebody.md +0 -11
- package/docs/models/errors/getphonenumberresponsebody.md +0 -11
- package/docs/models/errors/getphonenumberresponseresponsebody.md +0 -11
- package/docs/models/errors/listagentsresponsebody.md +0 -11
- package/docs/models/errors/listagentsresponseresponsebody.md +0 -11
- package/docs/models/errors/listcallsresponse500responsebody.md +0 -11
- package/docs/models/errors/listcallsresponsebody.md +0 -11
- package/docs/models/errors/listcallsresponseresponsebody.md +0 -11
- package/docs/models/errors/listphonenumbersresponse500responsebody.md +0 -11
- package/docs/models/errors/listphonenumbersresponsebody.md +0 -11
- package/docs/models/errors/listphonenumbersresponseresponsebody.md +0 -11
- package/docs/models/errors/updateagentresponse422responsebody.md +0 -11
- package/docs/models/errors/updateagentresponse500responsebody.md +0 -11
- package/docs/models/errors/updateagentresponsebody.md +0 -11
- package/docs/models/errors/updateagentresponseresponsebody.md +0 -11
- package/docs/models/errors/updatephoneagentresponse422responsebody.md +0 -11
- package/docs/models/errors/updatephoneagentresponse500responsebody.md +0 -11
- package/docs/models/errors/updatephoneagentresponsebody.md +0 -11
- package/docs/models/errors/updatephoneagentresponseresponsebody.md +0 -11
- package/docs/models/operations/callstatus.md +0 -12
- package/docs/models/operations/calltype.md +0 -10
- package/docs/models/operations/createagentrequestbody.md +0 -15
- package/docs/models/operations/createagentresponse.md +0 -11
- package/docs/models/operations/createphonecallcalltype.md +0 -12
- package/docs/models/operations/createphonecallrequestbody.md +0 -9
- package/docs/models/operations/createphonecallresponse.md +0 -11
- package/docs/models/operations/createphonecallresponsebody.md +0 -16
- package/docs/models/operations/createphonenumberrequestbody.md +0 -9
- package/docs/models/operations/createphonenumberresponse.md +0 -11
- package/docs/models/operations/deleteagentrequest.md +0 -8
- package/docs/models/operations/deleteagentresponse.md +0 -10
- package/docs/models/operations/deletephonenumberrequest.md +0 -8
- package/docs/models/operations/deletephonenumberresponse.md +0 -10
- package/docs/models/operations/filtercriteria.md +0 -13
- package/docs/models/operations/getagentrequest.md +0 -8
- package/docs/models/operations/getagentresponse.md +0 -11
- package/docs/models/operations/getcallrequest.md +0 -8
- package/docs/models/operations/getcallresponse.md +0 -11
- package/docs/models/operations/getphonenumberrequest.md +0 -8
- package/docs/models/operations/getphonenumberresponse.md +0 -11
- package/docs/models/operations/listagentsresponse.md +0 -11
- package/docs/models/operations/listcallsrequest.md +0 -10
- package/docs/models/operations/listcallsresponse.md +0 -11
- package/docs/models/operations/listphonenumbersresponse.md +0 -11
- package/docs/models/operations/phonenumber.md +0 -11
- package/docs/models/operations/sortorder.md +0 -11
- package/docs/models/operations/updateagentrequest.md +0 -9
- package/docs/models/operations/updateagentresponse.md +0 -11
- package/docs/models/operations/updatephoneagentrequest.md +0 -9
- package/docs/models/operations/updatephoneagentrequestbody.md +0 -8
- package/docs/models/operations/updatephoneagentresponse.md +0 -11
- package/docs/sdks/retellclient/README.md +0 -673
package/sdk/sdk.js
ADDED
|
@@ -0,0 +1,1137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.RetellClient = void 0;
|
|
30
|
+
const config_1 = require("../lib/config");
|
|
31
|
+
const enc$ = __importStar(require("../lib/encodings"));
|
|
32
|
+
const http_1 = require("../lib/http");
|
|
33
|
+
const sdks_1 = require("../lib/sdks");
|
|
34
|
+
const errors = __importStar(require("../models/errors"));
|
|
35
|
+
const operations = __importStar(require("../models/operations"));
|
|
36
|
+
const liveClient_1 = require("./liveClient");
|
|
37
|
+
class RetellClient extends sdks_1.ClientSDK {
|
|
38
|
+
constructor(options = {}) {
|
|
39
|
+
super({
|
|
40
|
+
client: options.httpClient || new http_1.HTTPClient(),
|
|
41
|
+
baseURL: (0, config_1.serverURLFromOptions)(options),
|
|
42
|
+
});
|
|
43
|
+
this.options$ = options;
|
|
44
|
+
void this.options$;
|
|
45
|
+
}
|
|
46
|
+
async createWebCall(input) {
|
|
47
|
+
const liveClient = new liveClient_1.LiveClient(this.options$.apiKey, input);
|
|
48
|
+
await liveClient.waitForReady();
|
|
49
|
+
return liveClient;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create a new agent
|
|
53
|
+
*/
|
|
54
|
+
async createAgent(input, options) {
|
|
55
|
+
var _a;
|
|
56
|
+
const headers$ = new Headers();
|
|
57
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
58
|
+
headers$.set("Content-Type", "application/json");
|
|
59
|
+
headers$.set("Accept", "application/json");
|
|
60
|
+
const payload$ = operations.CreateAgentRequestBody$.outboundSchema.parse(input);
|
|
61
|
+
const body$ = enc$.encodeJSON("body", payload$, { explode: true });
|
|
62
|
+
const path$ = this.templateURLComponent("/create-agent")();
|
|
63
|
+
let security$;
|
|
64
|
+
if (typeof this.options$.apiKey === "function") {
|
|
65
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
66
|
+
}
|
|
67
|
+
else if (this.options$.apiKey) {
|
|
68
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
security$ = {};
|
|
72
|
+
}
|
|
73
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
74
|
+
const response = await this.fetch$({
|
|
75
|
+
security: securitySettings$,
|
|
76
|
+
method: "post",
|
|
77
|
+
path: path$,
|
|
78
|
+
headers: headers$,
|
|
79
|
+
body: body$,
|
|
80
|
+
}, options);
|
|
81
|
+
const responseFields$ = {
|
|
82
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
83
|
+
StatusCode: response.status,
|
|
84
|
+
RawResponse: response,
|
|
85
|
+
};
|
|
86
|
+
if (this.matchResponse(response, 201, "application/json")) {
|
|
87
|
+
const responseBody = await response.json();
|
|
88
|
+
const result = operations.CreateAgentResponse$.inboundSchema.parse({
|
|
89
|
+
...responseFields$,
|
|
90
|
+
Agent: responseBody,
|
|
91
|
+
});
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
95
|
+
const responseBody = await response.json();
|
|
96
|
+
const result = errors.CreateAgentResponseBody$.inboundSchema.parse({
|
|
97
|
+
...responseFields$,
|
|
98
|
+
...responseBody,
|
|
99
|
+
});
|
|
100
|
+
throw result;
|
|
101
|
+
}
|
|
102
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
103
|
+
const responseBody = await response.json();
|
|
104
|
+
const result = errors.CreateAgentResponseResponseBody$.inboundSchema.parse({
|
|
105
|
+
...responseFields$,
|
|
106
|
+
...responseBody,
|
|
107
|
+
});
|
|
108
|
+
throw result;
|
|
109
|
+
}
|
|
110
|
+
else if (this.matchResponse(response, 422, "application/json")) {
|
|
111
|
+
const responseBody = await response.json();
|
|
112
|
+
const result = errors.CreateAgentResponse422ResponseBody$.inboundSchema.parse({
|
|
113
|
+
...responseFields$,
|
|
114
|
+
...responseBody,
|
|
115
|
+
});
|
|
116
|
+
throw result;
|
|
117
|
+
}
|
|
118
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
119
|
+
const responseBody = await response.json();
|
|
120
|
+
const result = errors.CreateAgentResponse500ResponseBody$.inboundSchema.parse({
|
|
121
|
+
...responseFields$,
|
|
122
|
+
...responseBody,
|
|
123
|
+
});
|
|
124
|
+
throw result;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
const responseBody = await response.text();
|
|
128
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Initiate an outbound phone call.
|
|
133
|
+
*/
|
|
134
|
+
async createPhoneCall(input, options) {
|
|
135
|
+
var _a;
|
|
136
|
+
const headers$ = new Headers();
|
|
137
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
138
|
+
headers$.set("Content-Type", "application/json");
|
|
139
|
+
headers$.set("Accept", "application/json");
|
|
140
|
+
const payload$ = operations.CreatePhoneCallRequestBody$.outboundSchema.parse(input);
|
|
141
|
+
const body$ = enc$.encodeJSON("body", payload$, { explode: true });
|
|
142
|
+
const path$ = this.templateURLComponent("/create-phone-call")();
|
|
143
|
+
let security$;
|
|
144
|
+
if (typeof this.options$.apiKey === "function") {
|
|
145
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
146
|
+
}
|
|
147
|
+
else if (this.options$.apiKey) {
|
|
148
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
security$ = {};
|
|
152
|
+
}
|
|
153
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
154
|
+
const response = await this.fetch$({
|
|
155
|
+
security: securitySettings$,
|
|
156
|
+
method: "post",
|
|
157
|
+
path: path$,
|
|
158
|
+
headers: headers$,
|
|
159
|
+
body: body$,
|
|
160
|
+
}, options);
|
|
161
|
+
const responseFields$ = {
|
|
162
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
163
|
+
StatusCode: response.status,
|
|
164
|
+
RawResponse: response,
|
|
165
|
+
};
|
|
166
|
+
if (this.matchResponse(response, 201, "application/json")) {
|
|
167
|
+
const responseBody = await response.json();
|
|
168
|
+
const result = operations.CreatePhoneCallResponse$.inboundSchema.parse({
|
|
169
|
+
...responseFields$,
|
|
170
|
+
callDetail: responseBody,
|
|
171
|
+
});
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
175
|
+
const responseBody = await response.json();
|
|
176
|
+
const result = errors.CreatePhoneCallResponseBody$.inboundSchema.parse({
|
|
177
|
+
...responseFields$,
|
|
178
|
+
...responseBody,
|
|
179
|
+
});
|
|
180
|
+
throw result;
|
|
181
|
+
}
|
|
182
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
183
|
+
const responseBody = await response.json();
|
|
184
|
+
const result = errors.CreatePhoneCallResponseResponseBody$.inboundSchema.parse({
|
|
185
|
+
...responseFields$,
|
|
186
|
+
...responseBody,
|
|
187
|
+
});
|
|
188
|
+
throw result;
|
|
189
|
+
}
|
|
190
|
+
else if (this.matchResponse(response, 402, "application/json")) {
|
|
191
|
+
const responseBody = await response.json();
|
|
192
|
+
const result = errors.CreatePhoneCallResponse402ResponseBody$.inboundSchema.parse({
|
|
193
|
+
...responseFields$,
|
|
194
|
+
...responseBody,
|
|
195
|
+
});
|
|
196
|
+
throw result;
|
|
197
|
+
}
|
|
198
|
+
else if (this.matchResponse(response, 422, "application/json")) {
|
|
199
|
+
const responseBody = await response.json();
|
|
200
|
+
const result = errors.CreatePhoneCallResponse422ResponseBody$.inboundSchema.parse({
|
|
201
|
+
...responseFields$,
|
|
202
|
+
...responseBody,
|
|
203
|
+
});
|
|
204
|
+
throw result;
|
|
205
|
+
}
|
|
206
|
+
else if (this.matchResponse(response, 429, "application/json")) {
|
|
207
|
+
const responseBody = await response.json();
|
|
208
|
+
const result = errors.CreatePhoneCallResponse429ResponseBody$.inboundSchema.parse({
|
|
209
|
+
...responseFields$,
|
|
210
|
+
...responseBody,
|
|
211
|
+
});
|
|
212
|
+
throw result;
|
|
213
|
+
}
|
|
214
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
215
|
+
const responseBody = await response.json();
|
|
216
|
+
const result = errors.CreatePhoneCallResponse500ResponseBody$.inboundSchema.parse({
|
|
217
|
+
...responseFields$,
|
|
218
|
+
...responseBody,
|
|
219
|
+
});
|
|
220
|
+
throw result;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
const responseBody = await response.text();
|
|
224
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Create a new phone number
|
|
229
|
+
*/
|
|
230
|
+
async createPhoneNumber(input, options) {
|
|
231
|
+
var _a;
|
|
232
|
+
const headers$ = new Headers();
|
|
233
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
234
|
+
headers$.set("Content-Type", "application/json");
|
|
235
|
+
headers$.set("Accept", "application/json");
|
|
236
|
+
const payload$ = operations.CreatePhoneNumberRequestBody$.outboundSchema.parse(input);
|
|
237
|
+
const body$ = enc$.encodeJSON("body", payload$, { explode: true });
|
|
238
|
+
const path$ = this.templateURLComponent("/create-phone-number")();
|
|
239
|
+
let security$;
|
|
240
|
+
if (typeof this.options$.apiKey === "function") {
|
|
241
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
242
|
+
}
|
|
243
|
+
else if (this.options$.apiKey) {
|
|
244
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
security$ = {};
|
|
248
|
+
}
|
|
249
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
250
|
+
const response = await this.fetch$({
|
|
251
|
+
security: securitySettings$,
|
|
252
|
+
method: "post",
|
|
253
|
+
path: path$,
|
|
254
|
+
headers: headers$,
|
|
255
|
+
body: body$,
|
|
256
|
+
}, options);
|
|
257
|
+
const responseFields$ = {
|
|
258
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
259
|
+
StatusCode: response.status,
|
|
260
|
+
RawResponse: response,
|
|
261
|
+
};
|
|
262
|
+
if (this.matchResponse(response, 201, "application/json")) {
|
|
263
|
+
const responseBody = await response.json();
|
|
264
|
+
const result = operations.CreatePhoneNumberResponse$.inboundSchema.parse({
|
|
265
|
+
...responseFields$,
|
|
266
|
+
PhoneNumber: responseBody,
|
|
267
|
+
});
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
271
|
+
const responseBody = await response.json();
|
|
272
|
+
const result = errors.CreatePhoneNumberResponseBody$.inboundSchema.parse({
|
|
273
|
+
...responseFields$,
|
|
274
|
+
...responseBody,
|
|
275
|
+
});
|
|
276
|
+
throw result;
|
|
277
|
+
}
|
|
278
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
279
|
+
const responseBody = await response.json();
|
|
280
|
+
const result = errors.CreatePhoneNumberResponseResponseBody$.inboundSchema.parse({
|
|
281
|
+
...responseFields$,
|
|
282
|
+
...responseBody,
|
|
283
|
+
});
|
|
284
|
+
throw result;
|
|
285
|
+
}
|
|
286
|
+
else if (this.matchResponse(response, 402, "application/json")) {
|
|
287
|
+
const responseBody = await response.json();
|
|
288
|
+
const result = errors.CreatePhoneNumberResponse402ResponseBody$.inboundSchema.parse({
|
|
289
|
+
...responseFields$,
|
|
290
|
+
...responseBody,
|
|
291
|
+
});
|
|
292
|
+
throw result;
|
|
293
|
+
}
|
|
294
|
+
else if (this.matchResponse(response, 422, "application/json")) {
|
|
295
|
+
const responseBody = await response.json();
|
|
296
|
+
const result = errors.CreatePhoneNumberResponse422ResponseBody$.inboundSchema.parse({
|
|
297
|
+
...responseFields$,
|
|
298
|
+
...responseBody,
|
|
299
|
+
});
|
|
300
|
+
throw result;
|
|
301
|
+
}
|
|
302
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
303
|
+
const responseBody = await response.json();
|
|
304
|
+
const result = errors.CreatePhoneNumberResponse500ResponseBody$.inboundSchema.parse({
|
|
305
|
+
...responseFields$,
|
|
306
|
+
...responseBody,
|
|
307
|
+
});
|
|
308
|
+
throw result;
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
const responseBody = await response.text();
|
|
312
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Delete an existing agent
|
|
317
|
+
*/
|
|
318
|
+
async deleteAgent(agentId, options) {
|
|
319
|
+
var _a;
|
|
320
|
+
const input$ = {
|
|
321
|
+
agentId: agentId,
|
|
322
|
+
};
|
|
323
|
+
const headers$ = new Headers();
|
|
324
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
325
|
+
headers$.set("Accept", "application/json");
|
|
326
|
+
const payload$ = operations.DeleteAgentRequest$.outboundSchema.parse(input$);
|
|
327
|
+
const body$ = null;
|
|
328
|
+
const pathParams$ = {
|
|
329
|
+
agent_id: enc$.encodeSimple("agent_id", payload$.agent_id, {
|
|
330
|
+
explode: false,
|
|
331
|
+
charEncoding: "percent",
|
|
332
|
+
}),
|
|
333
|
+
};
|
|
334
|
+
const path$ = this.templateURLComponent("/delete-agent/{agent_id}")(pathParams$);
|
|
335
|
+
let security$;
|
|
336
|
+
if (typeof this.options$.apiKey === "function") {
|
|
337
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
338
|
+
}
|
|
339
|
+
else if (this.options$.apiKey) {
|
|
340
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
security$ = {};
|
|
344
|
+
}
|
|
345
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
346
|
+
const response = await this.fetch$({
|
|
347
|
+
security: securitySettings$,
|
|
348
|
+
method: "delete",
|
|
349
|
+
path: path$,
|
|
350
|
+
headers: headers$,
|
|
351
|
+
body: body$,
|
|
352
|
+
}, options);
|
|
353
|
+
const responseFields$ = {
|
|
354
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
355
|
+
StatusCode: response.status,
|
|
356
|
+
RawResponse: response,
|
|
357
|
+
};
|
|
358
|
+
if (this.matchStatusCode(response, 204)) {
|
|
359
|
+
// fallthrough
|
|
360
|
+
}
|
|
361
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
362
|
+
const responseBody = await response.json();
|
|
363
|
+
const result = errors.DeleteAgentResponseBody$.inboundSchema.parse({
|
|
364
|
+
...responseFields$,
|
|
365
|
+
...responseBody,
|
|
366
|
+
});
|
|
367
|
+
throw result;
|
|
368
|
+
}
|
|
369
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
370
|
+
const responseBody = await response.json();
|
|
371
|
+
const result = errors.DeleteAgentResponseResponseBody$.inboundSchema.parse({
|
|
372
|
+
...responseFields$,
|
|
373
|
+
...responseBody,
|
|
374
|
+
});
|
|
375
|
+
throw result;
|
|
376
|
+
}
|
|
377
|
+
else if (this.matchResponse(response, 422, "application/json")) {
|
|
378
|
+
const responseBody = await response.json();
|
|
379
|
+
const result = errors.DeleteAgentResponse422ResponseBody$.inboundSchema.parse({
|
|
380
|
+
...responseFields$,
|
|
381
|
+
...responseBody,
|
|
382
|
+
});
|
|
383
|
+
throw result;
|
|
384
|
+
}
|
|
385
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
386
|
+
const responseBody = await response.json();
|
|
387
|
+
const result = errors.DeleteAgentResponse500ResponseBody$.inboundSchema.parse({
|
|
388
|
+
...responseFields$,
|
|
389
|
+
...responseBody,
|
|
390
|
+
});
|
|
391
|
+
throw result;
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
const responseBody = await response.text();
|
|
395
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
396
|
+
}
|
|
397
|
+
return operations.DeleteAgentResponse$.inboundSchema.parse(responseFields$);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Delete a specific phone number
|
|
401
|
+
*/
|
|
402
|
+
async deletePhoneNumber(phoneNumber, options) {
|
|
403
|
+
var _a;
|
|
404
|
+
const input$ = {
|
|
405
|
+
phoneNumber: phoneNumber,
|
|
406
|
+
};
|
|
407
|
+
const headers$ = new Headers();
|
|
408
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
409
|
+
headers$.set("Accept", "application/json");
|
|
410
|
+
const payload$ = operations.DeletePhoneNumberRequest$.outboundSchema.parse(input$);
|
|
411
|
+
const body$ = null;
|
|
412
|
+
const pathParams$ = {
|
|
413
|
+
phone_number: enc$.encodeSimple("phone_number", payload$.phone_number, {
|
|
414
|
+
explode: false,
|
|
415
|
+
charEncoding: "percent",
|
|
416
|
+
}),
|
|
417
|
+
};
|
|
418
|
+
const path$ = this.templateURLComponent("/delete-phone-number/{phone_number}")(pathParams$);
|
|
419
|
+
let security$;
|
|
420
|
+
if (typeof this.options$.apiKey === "function") {
|
|
421
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
422
|
+
}
|
|
423
|
+
else if (this.options$.apiKey) {
|
|
424
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
security$ = {};
|
|
428
|
+
}
|
|
429
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
430
|
+
const response = await this.fetch$({
|
|
431
|
+
security: securitySettings$,
|
|
432
|
+
method: "delete",
|
|
433
|
+
path: path$,
|
|
434
|
+
headers: headers$,
|
|
435
|
+
body: body$,
|
|
436
|
+
}, options);
|
|
437
|
+
const responseFields$ = {
|
|
438
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
439
|
+
StatusCode: response.status,
|
|
440
|
+
RawResponse: response,
|
|
441
|
+
};
|
|
442
|
+
if (this.matchStatusCode(response, 204)) {
|
|
443
|
+
// fallthrough
|
|
444
|
+
}
|
|
445
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
446
|
+
const responseBody = await response.json();
|
|
447
|
+
const result = errors.DeletePhoneNumberResponseBody$.inboundSchema.parse({
|
|
448
|
+
...responseFields$,
|
|
449
|
+
...responseBody,
|
|
450
|
+
});
|
|
451
|
+
throw result;
|
|
452
|
+
}
|
|
453
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
454
|
+
const responseBody = await response.json();
|
|
455
|
+
const result = errors.DeletePhoneNumberResponseResponseBody$.inboundSchema.parse({
|
|
456
|
+
...responseFields$,
|
|
457
|
+
...responseBody,
|
|
458
|
+
});
|
|
459
|
+
throw result;
|
|
460
|
+
}
|
|
461
|
+
else if (this.matchResponse(response, 422, "application/json")) {
|
|
462
|
+
const responseBody = await response.json();
|
|
463
|
+
const result = errors.DeletePhoneNumberResponse422ResponseBody$.inboundSchema.parse({
|
|
464
|
+
...responseFields$,
|
|
465
|
+
...responseBody,
|
|
466
|
+
});
|
|
467
|
+
throw result;
|
|
468
|
+
}
|
|
469
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
470
|
+
const responseBody = await response.json();
|
|
471
|
+
const result = errors.DeletePhoneNumberResponse500ResponseBody$.inboundSchema.parse({
|
|
472
|
+
...responseFields$,
|
|
473
|
+
...responseBody,
|
|
474
|
+
});
|
|
475
|
+
throw result;
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
const responseBody = await response.text();
|
|
479
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
480
|
+
}
|
|
481
|
+
return operations.DeletePhoneNumberResponse$.inboundSchema.parse(responseFields$);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Retrieve details of a specific agent
|
|
485
|
+
*/
|
|
486
|
+
async getAgent(agentId, options) {
|
|
487
|
+
var _a;
|
|
488
|
+
const input$ = {
|
|
489
|
+
agentId: agentId,
|
|
490
|
+
};
|
|
491
|
+
const headers$ = new Headers();
|
|
492
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
493
|
+
headers$.set("Accept", "application/json");
|
|
494
|
+
const payload$ = operations.GetAgentRequest$.outboundSchema.parse(input$);
|
|
495
|
+
const body$ = null;
|
|
496
|
+
const pathParams$ = {
|
|
497
|
+
agent_id: enc$.encodeSimple("agent_id", payload$.agent_id, {
|
|
498
|
+
explode: false,
|
|
499
|
+
charEncoding: "percent",
|
|
500
|
+
}),
|
|
501
|
+
};
|
|
502
|
+
const path$ = this.templateURLComponent("/get-agent/{agent_id}")(pathParams$);
|
|
503
|
+
let security$;
|
|
504
|
+
if (typeof this.options$.apiKey === "function") {
|
|
505
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
506
|
+
}
|
|
507
|
+
else if (this.options$.apiKey) {
|
|
508
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
security$ = {};
|
|
512
|
+
}
|
|
513
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
514
|
+
const response = await this.fetch$({
|
|
515
|
+
security: securitySettings$,
|
|
516
|
+
method: "get",
|
|
517
|
+
path: path$,
|
|
518
|
+
headers: headers$,
|
|
519
|
+
body: body$,
|
|
520
|
+
}, options);
|
|
521
|
+
const responseFields$ = {
|
|
522
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
523
|
+
StatusCode: response.status,
|
|
524
|
+
RawResponse: response,
|
|
525
|
+
};
|
|
526
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
527
|
+
const responseBody = await response.json();
|
|
528
|
+
const result = operations.GetAgentResponse$.inboundSchema.parse({
|
|
529
|
+
...responseFields$,
|
|
530
|
+
Agent: responseBody,
|
|
531
|
+
});
|
|
532
|
+
return result;
|
|
533
|
+
}
|
|
534
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
535
|
+
const responseBody = await response.json();
|
|
536
|
+
const result = errors.GetAgentResponseBody$.inboundSchema.parse({
|
|
537
|
+
...responseFields$,
|
|
538
|
+
...responseBody,
|
|
539
|
+
});
|
|
540
|
+
throw result;
|
|
541
|
+
}
|
|
542
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
543
|
+
const responseBody = await response.json();
|
|
544
|
+
const result = errors.GetAgentResponseResponseBody$.inboundSchema.parse({
|
|
545
|
+
...responseFields$,
|
|
546
|
+
...responseBody,
|
|
547
|
+
});
|
|
548
|
+
throw result;
|
|
549
|
+
}
|
|
550
|
+
else if (this.matchResponse(response, 422, "application/json")) {
|
|
551
|
+
const responseBody = await response.json();
|
|
552
|
+
const result = errors.GetAgentResponse422ResponseBody$.inboundSchema.parse({
|
|
553
|
+
...responseFields$,
|
|
554
|
+
...responseBody,
|
|
555
|
+
});
|
|
556
|
+
throw result;
|
|
557
|
+
}
|
|
558
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
559
|
+
const responseBody = await response.json();
|
|
560
|
+
const result = errors.GetAgentResponse500ResponseBody$.inboundSchema.parse({
|
|
561
|
+
...responseFields$,
|
|
562
|
+
...responseBody,
|
|
563
|
+
});
|
|
564
|
+
throw result;
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
const responseBody = await response.text();
|
|
568
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Retrieve details of a specific call
|
|
573
|
+
*/
|
|
574
|
+
async getCall(callId, options) {
|
|
575
|
+
var _a;
|
|
576
|
+
const input$ = {
|
|
577
|
+
callId: callId,
|
|
578
|
+
};
|
|
579
|
+
const headers$ = new Headers();
|
|
580
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
581
|
+
headers$.set("Accept", "application/json");
|
|
582
|
+
const payload$ = operations.GetCallRequest$.outboundSchema.parse(input$);
|
|
583
|
+
const body$ = null;
|
|
584
|
+
const pathParams$ = {
|
|
585
|
+
call_id: enc$.encodeSimple("call_id", payload$.call_id, {
|
|
586
|
+
explode: false,
|
|
587
|
+
charEncoding: "percent",
|
|
588
|
+
}),
|
|
589
|
+
};
|
|
590
|
+
const path$ = this.templateURLComponent("/get-call/{call_id}")(pathParams$);
|
|
591
|
+
let security$;
|
|
592
|
+
if (typeof this.options$.apiKey === "function") {
|
|
593
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
594
|
+
}
|
|
595
|
+
else if (this.options$.apiKey) {
|
|
596
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
security$ = {};
|
|
600
|
+
}
|
|
601
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
602
|
+
const response = await this.fetch$({
|
|
603
|
+
security: securitySettings$,
|
|
604
|
+
method: "get",
|
|
605
|
+
path: path$,
|
|
606
|
+
headers: headers$,
|
|
607
|
+
body: body$,
|
|
608
|
+
}, options);
|
|
609
|
+
const responseFields$ = {
|
|
610
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
611
|
+
StatusCode: response.status,
|
|
612
|
+
RawResponse: response,
|
|
613
|
+
};
|
|
614
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
615
|
+
const responseBody = await response.json();
|
|
616
|
+
const result = operations.GetCallResponse$.inboundSchema.parse({
|
|
617
|
+
...responseFields$,
|
|
618
|
+
CallDetail: responseBody,
|
|
619
|
+
});
|
|
620
|
+
return result;
|
|
621
|
+
}
|
|
622
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
623
|
+
const responseBody = await response.json();
|
|
624
|
+
const result = errors.GetCallResponseBody$.inboundSchema.parse({
|
|
625
|
+
...responseFields$,
|
|
626
|
+
...responseBody,
|
|
627
|
+
});
|
|
628
|
+
throw result;
|
|
629
|
+
}
|
|
630
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
631
|
+
const responseBody = await response.json();
|
|
632
|
+
const result = errors.GetCallResponseResponseBody$.inboundSchema.parse({
|
|
633
|
+
...responseFields$,
|
|
634
|
+
...responseBody,
|
|
635
|
+
});
|
|
636
|
+
throw result;
|
|
637
|
+
}
|
|
638
|
+
else if (this.matchResponse(response, 422, "application/json")) {
|
|
639
|
+
const responseBody = await response.json();
|
|
640
|
+
const result = errors.GetCallResponse422ResponseBody$.inboundSchema.parse({
|
|
641
|
+
...responseFields$,
|
|
642
|
+
...responseBody,
|
|
643
|
+
});
|
|
644
|
+
throw result;
|
|
645
|
+
}
|
|
646
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
647
|
+
const responseBody = await response.json();
|
|
648
|
+
const result = errors.GetCallResponse500ResponseBody$.inboundSchema.parse({
|
|
649
|
+
...responseFields$,
|
|
650
|
+
...responseBody,
|
|
651
|
+
});
|
|
652
|
+
throw result;
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
const responseBody = await response.text();
|
|
656
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Retrieve info about a specific number
|
|
661
|
+
*/
|
|
662
|
+
async getPhoneNumber(phoneNumber, options) {
|
|
663
|
+
var _a;
|
|
664
|
+
const input$ = {
|
|
665
|
+
phoneNumber: phoneNumber,
|
|
666
|
+
};
|
|
667
|
+
const headers$ = new Headers();
|
|
668
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
669
|
+
headers$.set("Accept", "application/json");
|
|
670
|
+
const payload$ = operations.GetPhoneNumberRequest$.outboundSchema.parse(input$);
|
|
671
|
+
const body$ = null;
|
|
672
|
+
const pathParams$ = {
|
|
673
|
+
phone_number: enc$.encodeSimple("phone_number", payload$.phone_number, {
|
|
674
|
+
explode: false,
|
|
675
|
+
charEncoding: "percent",
|
|
676
|
+
}),
|
|
677
|
+
};
|
|
678
|
+
const path$ = this.templateURLComponent("/get-phone-number/{phone_number}")(pathParams$);
|
|
679
|
+
let security$;
|
|
680
|
+
if (typeof this.options$.apiKey === "function") {
|
|
681
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
682
|
+
}
|
|
683
|
+
else if (this.options$.apiKey) {
|
|
684
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
security$ = {};
|
|
688
|
+
}
|
|
689
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
690
|
+
const response = await this.fetch$({
|
|
691
|
+
security: securitySettings$,
|
|
692
|
+
method: "get",
|
|
693
|
+
path: path$,
|
|
694
|
+
headers: headers$,
|
|
695
|
+
body: body$,
|
|
696
|
+
}, options);
|
|
697
|
+
const responseFields$ = {
|
|
698
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
699
|
+
StatusCode: response.status,
|
|
700
|
+
RawResponse: response,
|
|
701
|
+
};
|
|
702
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
703
|
+
const responseBody = await response.json();
|
|
704
|
+
const result = operations.GetPhoneNumberResponse$.inboundSchema.parse({
|
|
705
|
+
...responseFields$,
|
|
706
|
+
PhoneNumber: responseBody,
|
|
707
|
+
});
|
|
708
|
+
return result;
|
|
709
|
+
}
|
|
710
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
711
|
+
const responseBody = await response.json();
|
|
712
|
+
const result = errors.GetPhoneNumberResponseBody$.inboundSchema.parse({
|
|
713
|
+
...responseFields$,
|
|
714
|
+
...responseBody,
|
|
715
|
+
});
|
|
716
|
+
throw result;
|
|
717
|
+
}
|
|
718
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
719
|
+
const responseBody = await response.json();
|
|
720
|
+
const result = errors.GetPhoneNumberResponseResponseBody$.inboundSchema.parse({
|
|
721
|
+
...responseFields$,
|
|
722
|
+
...responseBody,
|
|
723
|
+
});
|
|
724
|
+
throw result;
|
|
725
|
+
}
|
|
726
|
+
else if (this.matchResponse(response, 422, "application/json")) {
|
|
727
|
+
const responseBody = await response.json();
|
|
728
|
+
const result = errors.GetPhoneNumberResponse422ResponseBody$.inboundSchema.parse({
|
|
729
|
+
...responseFields$,
|
|
730
|
+
...responseBody,
|
|
731
|
+
});
|
|
732
|
+
throw result;
|
|
733
|
+
}
|
|
734
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
735
|
+
const responseBody = await response.json();
|
|
736
|
+
const result = errors.GetPhoneNumberResponse500ResponseBody$.inboundSchema.parse({
|
|
737
|
+
...responseFields$,
|
|
738
|
+
...responseBody,
|
|
739
|
+
});
|
|
740
|
+
throw result;
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
const responseBody = await response.text();
|
|
744
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* List all agents
|
|
749
|
+
*/
|
|
750
|
+
async listAgents(options) {
|
|
751
|
+
var _a;
|
|
752
|
+
const headers$ = new Headers();
|
|
753
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
754
|
+
headers$.set("Accept", "application/json");
|
|
755
|
+
const path$ = this.templateURLComponent("/list-agents")();
|
|
756
|
+
let security$;
|
|
757
|
+
if (typeof this.options$.apiKey === "function") {
|
|
758
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
759
|
+
}
|
|
760
|
+
else if (this.options$.apiKey) {
|
|
761
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
762
|
+
}
|
|
763
|
+
else {
|
|
764
|
+
security$ = {};
|
|
765
|
+
}
|
|
766
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
767
|
+
const response = await this.fetch$({ security: securitySettings$, method: "get", path: path$, headers: headers$ }, options);
|
|
768
|
+
const responseFields$ = {
|
|
769
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
770
|
+
StatusCode: response.status,
|
|
771
|
+
RawResponse: response,
|
|
772
|
+
};
|
|
773
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
774
|
+
const responseBody = await response.json();
|
|
775
|
+
const result = operations.ListAgentsResponse$.inboundSchema.parse({
|
|
776
|
+
...responseFields$,
|
|
777
|
+
agents: responseBody,
|
|
778
|
+
});
|
|
779
|
+
return result;
|
|
780
|
+
}
|
|
781
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
782
|
+
const responseBody = await response.json();
|
|
783
|
+
const result = errors.ListAgentsResponseBody$.inboundSchema.parse({
|
|
784
|
+
...responseFields$,
|
|
785
|
+
...responseBody,
|
|
786
|
+
});
|
|
787
|
+
throw result;
|
|
788
|
+
}
|
|
789
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
790
|
+
const responseBody = await response.json();
|
|
791
|
+
const result = errors.ListAgentsResponseResponseBody$.inboundSchema.parse({
|
|
792
|
+
...responseFields$,
|
|
793
|
+
...responseBody,
|
|
794
|
+
});
|
|
795
|
+
throw result;
|
|
796
|
+
}
|
|
797
|
+
else {
|
|
798
|
+
const responseBody = await response.text();
|
|
799
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Retrieve call details
|
|
804
|
+
*/
|
|
805
|
+
async listCalls(filterCriteria, limit, sortOrder, options) {
|
|
806
|
+
var _a;
|
|
807
|
+
const input$ = {
|
|
808
|
+
filterCriteria: filterCriteria,
|
|
809
|
+
limit: limit,
|
|
810
|
+
sortOrder: sortOrder,
|
|
811
|
+
};
|
|
812
|
+
const headers$ = new Headers();
|
|
813
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
814
|
+
headers$.set("Accept", "application/json");
|
|
815
|
+
const payload$ = operations.ListCallsRequest$.outboundSchema.parse(input$);
|
|
816
|
+
const body$ = null;
|
|
817
|
+
const path$ = this.templateURLComponent("/list-calls")();
|
|
818
|
+
const query$ = [
|
|
819
|
+
enc$.encodeForm("filter_criteria", JSON.stringify(payload$.filter_criteria), {
|
|
820
|
+
explode: true,
|
|
821
|
+
charEncoding: "percent",
|
|
822
|
+
}),
|
|
823
|
+
enc$.encodeForm("limit", payload$.limit, { explode: true, charEncoding: "percent" }),
|
|
824
|
+
enc$.encodeForm("sort_order", payload$.sort_order, {
|
|
825
|
+
explode: true,
|
|
826
|
+
charEncoding: "percent",
|
|
827
|
+
}),
|
|
828
|
+
]
|
|
829
|
+
.filter(Boolean)
|
|
830
|
+
.join("&");
|
|
831
|
+
let security$;
|
|
832
|
+
if (typeof this.options$.apiKey === "function") {
|
|
833
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
834
|
+
}
|
|
835
|
+
else if (this.options$.apiKey) {
|
|
836
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
security$ = {};
|
|
840
|
+
}
|
|
841
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
842
|
+
const response = await this.fetch$({
|
|
843
|
+
security: securitySettings$,
|
|
844
|
+
method: "get",
|
|
845
|
+
path: path$,
|
|
846
|
+
headers: headers$,
|
|
847
|
+
query: query$,
|
|
848
|
+
body: body$,
|
|
849
|
+
}, options);
|
|
850
|
+
const responseFields$ = {
|
|
851
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
852
|
+
StatusCode: response.status,
|
|
853
|
+
RawResponse: response,
|
|
854
|
+
};
|
|
855
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
856
|
+
const responseBody = await response.json();
|
|
857
|
+
const result = operations.ListCallsResponse$.inboundSchema.parse({
|
|
858
|
+
...responseFields$,
|
|
859
|
+
calls: responseBody,
|
|
860
|
+
});
|
|
861
|
+
return result;
|
|
862
|
+
}
|
|
863
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
864
|
+
const responseBody = await response.json();
|
|
865
|
+
const result = errors.ListCallsResponseBody$.inboundSchema.parse({
|
|
866
|
+
...responseFields$,
|
|
867
|
+
...responseBody,
|
|
868
|
+
});
|
|
869
|
+
throw result;
|
|
870
|
+
}
|
|
871
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
872
|
+
const responseBody = await response.json();
|
|
873
|
+
const result = errors.ListCallsResponseResponseBody$.inboundSchema.parse({
|
|
874
|
+
...responseFields$,
|
|
875
|
+
...responseBody,
|
|
876
|
+
});
|
|
877
|
+
throw result;
|
|
878
|
+
}
|
|
879
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
880
|
+
const responseBody = await response.json();
|
|
881
|
+
const result = errors.ListCallsResponse500ResponseBody$.inboundSchema.parse({
|
|
882
|
+
...responseFields$,
|
|
883
|
+
...responseBody,
|
|
884
|
+
});
|
|
885
|
+
throw result;
|
|
886
|
+
}
|
|
887
|
+
else {
|
|
888
|
+
const responseBody = await response.text();
|
|
889
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* List all purchased and active phone numbers
|
|
894
|
+
*/
|
|
895
|
+
async listPhoneNumbers(options) {
|
|
896
|
+
var _a;
|
|
897
|
+
const headers$ = new Headers();
|
|
898
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
899
|
+
headers$.set("Accept", "application/json");
|
|
900
|
+
const path$ = this.templateURLComponent("/list-phone-numbers")();
|
|
901
|
+
let security$;
|
|
902
|
+
if (typeof this.options$.apiKey === "function") {
|
|
903
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
904
|
+
}
|
|
905
|
+
else if (this.options$.apiKey) {
|
|
906
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
909
|
+
security$ = {};
|
|
910
|
+
}
|
|
911
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
912
|
+
const response = await this.fetch$({ security: securitySettings$, method: "get", path: path$, headers: headers$ }, options);
|
|
913
|
+
const responseFields$ = {
|
|
914
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
915
|
+
StatusCode: response.status,
|
|
916
|
+
RawResponse: response,
|
|
917
|
+
};
|
|
918
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
919
|
+
const responseBody = await response.json();
|
|
920
|
+
const result = operations.ListPhoneNumbersResponse$.inboundSchema.parse({
|
|
921
|
+
...responseFields$,
|
|
922
|
+
phoneNumbers: responseBody,
|
|
923
|
+
});
|
|
924
|
+
return result;
|
|
925
|
+
}
|
|
926
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
927
|
+
const responseBody = await response.json();
|
|
928
|
+
const result = errors.ListPhoneNumbersResponseBody$.inboundSchema.parse({
|
|
929
|
+
...responseFields$,
|
|
930
|
+
...responseBody,
|
|
931
|
+
});
|
|
932
|
+
throw result;
|
|
933
|
+
}
|
|
934
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
935
|
+
const responseBody = await response.json();
|
|
936
|
+
const result = errors.ListPhoneNumbersResponseResponseBody$.inboundSchema.parse({
|
|
937
|
+
...responseFields$,
|
|
938
|
+
...responseBody,
|
|
939
|
+
});
|
|
940
|
+
throw result;
|
|
941
|
+
}
|
|
942
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
943
|
+
const responseBody = await response.json();
|
|
944
|
+
const result = errors.ListPhoneNumbersResponse500ResponseBody$.inboundSchema.parse({
|
|
945
|
+
...responseFields$,
|
|
946
|
+
...responseBody,
|
|
947
|
+
});
|
|
948
|
+
throw result;
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
const responseBody = await response.text();
|
|
952
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Update an existing agent
|
|
957
|
+
*/
|
|
958
|
+
async updateAgent(requestBody, agentId, options) {
|
|
959
|
+
var _a;
|
|
960
|
+
const input$ = {
|
|
961
|
+
requestBody: requestBody,
|
|
962
|
+
agentId: agentId,
|
|
963
|
+
};
|
|
964
|
+
const headers$ = new Headers();
|
|
965
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
966
|
+
headers$.set("Content-Type", "application/json");
|
|
967
|
+
headers$.set("Accept", "application/json");
|
|
968
|
+
const payload$ = operations.UpdateAgentRequest$.outboundSchema.parse(input$);
|
|
969
|
+
const body$ = enc$.encodeJSON("body", payload$.RequestBody, { explode: true });
|
|
970
|
+
const pathParams$ = {
|
|
971
|
+
agent_id: enc$.encodeSimple("agent_id", payload$.agent_id, {
|
|
972
|
+
explode: false,
|
|
973
|
+
charEncoding: "percent",
|
|
974
|
+
}),
|
|
975
|
+
};
|
|
976
|
+
const path$ = this.templateURLComponent("/update-agent/{agent_id}")(pathParams$);
|
|
977
|
+
let security$;
|
|
978
|
+
if (typeof this.options$.apiKey === "function") {
|
|
979
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
980
|
+
}
|
|
981
|
+
else if (this.options$.apiKey) {
|
|
982
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
security$ = {};
|
|
986
|
+
}
|
|
987
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
988
|
+
const response = await this.fetch$({
|
|
989
|
+
security: securitySettings$,
|
|
990
|
+
method: "PATCH",
|
|
991
|
+
path: path$,
|
|
992
|
+
headers: headers$,
|
|
993
|
+
body: body$,
|
|
994
|
+
}, options);
|
|
995
|
+
const responseFields$ = {
|
|
996
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
997
|
+
StatusCode: response.status,
|
|
998
|
+
RawResponse: response,
|
|
999
|
+
};
|
|
1000
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
1001
|
+
const responseBody = await response.json();
|
|
1002
|
+
const result = operations.UpdateAgentResponse$.inboundSchema.parse({
|
|
1003
|
+
...responseFields$,
|
|
1004
|
+
Agent: responseBody,
|
|
1005
|
+
});
|
|
1006
|
+
return result;
|
|
1007
|
+
}
|
|
1008
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
1009
|
+
const responseBody = await response.json();
|
|
1010
|
+
const result = errors.UpdateAgentResponseBody$.inboundSchema.parse({
|
|
1011
|
+
...responseFields$,
|
|
1012
|
+
...responseBody,
|
|
1013
|
+
});
|
|
1014
|
+
throw result;
|
|
1015
|
+
}
|
|
1016
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
1017
|
+
const responseBody = await response.json();
|
|
1018
|
+
const result = errors.UpdateAgentResponseResponseBody$.inboundSchema.parse({
|
|
1019
|
+
...responseFields$,
|
|
1020
|
+
...responseBody,
|
|
1021
|
+
});
|
|
1022
|
+
throw result;
|
|
1023
|
+
}
|
|
1024
|
+
else if (this.matchResponse(response, 422, "application/json")) {
|
|
1025
|
+
const responseBody = await response.json();
|
|
1026
|
+
const result = errors.UpdateAgentResponse422ResponseBody$.inboundSchema.parse({
|
|
1027
|
+
...responseFields$,
|
|
1028
|
+
...responseBody,
|
|
1029
|
+
});
|
|
1030
|
+
throw result;
|
|
1031
|
+
}
|
|
1032
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
1033
|
+
const responseBody = await response.json();
|
|
1034
|
+
const result = errors.UpdateAgentResponse500ResponseBody$.inboundSchema.parse({
|
|
1035
|
+
...responseFields$,
|
|
1036
|
+
...responseBody,
|
|
1037
|
+
});
|
|
1038
|
+
throw result;
|
|
1039
|
+
}
|
|
1040
|
+
else {
|
|
1041
|
+
const responseBody = await response.text();
|
|
1042
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Update an existing phone number
|
|
1047
|
+
*/
|
|
1048
|
+
async updatePhoneAgent(requestBody, phoneNumber, options) {
|
|
1049
|
+
var _a;
|
|
1050
|
+
const input$ = {
|
|
1051
|
+
requestBody: requestBody,
|
|
1052
|
+
phoneNumber: phoneNumber,
|
|
1053
|
+
};
|
|
1054
|
+
const headers$ = new Headers();
|
|
1055
|
+
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
1056
|
+
headers$.set("Content-Type", "application/json");
|
|
1057
|
+
headers$.set("Accept", "application/json");
|
|
1058
|
+
const payload$ = operations.UpdatePhoneAgentRequest$.outboundSchema.parse(input$);
|
|
1059
|
+
const body$ = enc$.encodeJSON("body", payload$.RequestBody, { explode: true });
|
|
1060
|
+
const pathParams$ = {
|
|
1061
|
+
phone_number: enc$.encodeSimple("phone_number", payload$.phone_number, {
|
|
1062
|
+
explode: false,
|
|
1063
|
+
charEncoding: "percent",
|
|
1064
|
+
}),
|
|
1065
|
+
};
|
|
1066
|
+
const path$ = this.templateURLComponent("/update-phone-agent/{phone_number}")(pathParams$);
|
|
1067
|
+
let security$;
|
|
1068
|
+
if (typeof this.options$.apiKey === "function") {
|
|
1069
|
+
security$ = { apiKey: await this.options$.apiKey() };
|
|
1070
|
+
}
|
|
1071
|
+
else if (this.options$.apiKey) {
|
|
1072
|
+
security$ = { apiKey: this.options$.apiKey };
|
|
1073
|
+
}
|
|
1074
|
+
else {
|
|
1075
|
+
security$ = {};
|
|
1076
|
+
}
|
|
1077
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
1078
|
+
const response = await this.fetch$({
|
|
1079
|
+
security: securitySettings$,
|
|
1080
|
+
method: "PATCH",
|
|
1081
|
+
path: path$,
|
|
1082
|
+
headers: headers$,
|
|
1083
|
+
body: body$,
|
|
1084
|
+
}, options);
|
|
1085
|
+
const responseFields$ = {
|
|
1086
|
+
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
1087
|
+
StatusCode: response.status,
|
|
1088
|
+
RawResponse: response,
|
|
1089
|
+
};
|
|
1090
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
1091
|
+
const responseBody = await response.json();
|
|
1092
|
+
const result = operations.UpdatePhoneAgentResponse$.inboundSchema.parse({
|
|
1093
|
+
...responseFields$,
|
|
1094
|
+
PhoneNumber: responseBody,
|
|
1095
|
+
});
|
|
1096
|
+
return result;
|
|
1097
|
+
}
|
|
1098
|
+
else if (this.matchResponse(response, 400, "application/json")) {
|
|
1099
|
+
const responseBody = await response.json();
|
|
1100
|
+
const result = errors.UpdatePhoneAgentResponseBody$.inboundSchema.parse({
|
|
1101
|
+
...responseFields$,
|
|
1102
|
+
...responseBody,
|
|
1103
|
+
});
|
|
1104
|
+
throw result;
|
|
1105
|
+
}
|
|
1106
|
+
else if (this.matchResponse(response, 401, "application/json")) {
|
|
1107
|
+
const responseBody = await response.json();
|
|
1108
|
+
const result = errors.UpdatePhoneAgentResponseResponseBody$.inboundSchema.parse({
|
|
1109
|
+
...responseFields$,
|
|
1110
|
+
...responseBody,
|
|
1111
|
+
});
|
|
1112
|
+
throw result;
|
|
1113
|
+
}
|
|
1114
|
+
else if (this.matchResponse(response, 422, "application/json")) {
|
|
1115
|
+
const responseBody = await response.json();
|
|
1116
|
+
const result = errors.UpdatePhoneAgentResponse422ResponseBody$.inboundSchema.parse({
|
|
1117
|
+
...responseFields$,
|
|
1118
|
+
...responseBody,
|
|
1119
|
+
});
|
|
1120
|
+
throw result;
|
|
1121
|
+
}
|
|
1122
|
+
else if (this.matchResponse(response, 500, "application/json")) {
|
|
1123
|
+
const responseBody = await response.json();
|
|
1124
|
+
const result = errors.UpdatePhoneAgentResponse500ResponseBody$.inboundSchema.parse({
|
|
1125
|
+
...responseFields$,
|
|
1126
|
+
...responseBody,
|
|
1127
|
+
});
|
|
1128
|
+
throw result;
|
|
1129
|
+
}
|
|
1130
|
+
else {
|
|
1131
|
+
const responseBody = await response.text();
|
|
1132
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
exports.RetellClient = RetellClient;
|
|
1137
|
+
//# sourceMappingURL=sdk.js.map
|