egain-api-python 0.1.1__py3-none-any.whl

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.
Files changed (332) hide show
  1. egain_api_python/__init__.py +17 -0
  2. egain_api_python/_hooks/__init__.py +5 -0
  3. egain_api_python/_hooks/registration.py +13 -0
  4. egain_api_python/_hooks/sdkhooks.py +76 -0
  5. egain_api_python/_hooks/types.py +112 -0
  6. egain_api_python/_version.py +15 -0
  7. egain_api_python/aiservices.py +23 -0
  8. egain_api_python/answers.py +281 -0
  9. egain_api_python/articlelists.py +469 -0
  10. egain_api_python/basesdk.py +368 -0
  11. egain_api_python/connectorssearchevents.py +537 -0
  12. egain_api_python/content.py +23 -0
  13. egain_api_python/errors/__init__.py +78 -0
  14. egain_api_python/errors/egaindefaulterror.py +40 -0
  15. egain_api_python/errors/egainerror.py +30 -0
  16. egain_api_python/errors/gethealthop.py +74 -0
  17. egain_api_python/errors/no_response_error.py +17 -0
  18. egain_api_python/errors/responsevalidationerror.py +27 -0
  19. egain_api_python/errors/schemas_wserrorcommon.py +51 -0
  20. egain_api_python/errors/wserrorcommon.py +49 -0
  21. egain_api_python/escalation.py +955 -0
  22. egain_api_python/export.py +487 -0
  23. egain_api_python/federatedsearchevent.py +287 -0
  24. egain_api_python/general.py +925 -0
  25. egain_api_python/guidedhelp.py +3373 -0
  26. egain_api_python/health.py +253 -0
  27. egain_api_python/httpclient.py +125 -0
  28. egain_api_python/import_.py +1161 -0
  29. egain_api_python/models/__init__.py +2136 -0
  30. egain_api_python/models/acceptghsolutionop.py +52 -0
  31. egain_api_python/models/acceptlanguage.py +23 -0
  32. egain_api_python/models/accessibleportal.py +37 -0
  33. egain_api_python/models/action.py +56 -0
  34. egain_api_python/models/actionsearch.py +92 -0
  35. egain_api_python/models/addasreferenceop.py +52 -0
  36. egain_api_python/models/addbookmarkop.py +43 -0
  37. egain_api_python/models/additionalsnippets.py +57 -0
  38. egain_api_python/models/addtoreplyop.py +52 -0
  39. egain_api_python/models/aisearchop.py +131 -0
  40. egain_api_python/models/aisearchresponse.py +67 -0
  41. egain_api_python/models/allaccessibleportals.py +28 -0
  42. egain_api_python/models/answer.py +21 -0
  43. egain_api_python/models/answeredquestion.py +125 -0
  44. egain_api_python/models/answerrange.py +41 -0
  45. egain_api_python/models/answersrequest.py +78 -0
  46. egain_api_python/models/answersresponse.py +93 -0
  47. egain_api_python/models/article.py +241 -0
  48. egain_api_python/models/articleactivitylink.py +62 -0
  49. egain_api_python/models/articleadditionalattributes.py +23 -0
  50. egain_api_python/models/articleaisearchresult.py +254 -0
  51. egain_api_python/models/articleattachment.py +44 -0
  52. egain_api_python/models/articlelist.py +48 -0
  53. egain_api_python/models/articlelistresult.py +38 -0
  54. egain_api_python/models/articlelistsresult.py +22 -0
  55. egain_api_python/models/articlepermissions.py +25 -0
  56. egain_api_python/models/articlepermissionsresult.py +27 -0
  57. egain_api_python/models/articlerating.py +51 -0
  58. egain_api_python/models/articleratingsresponse.py +28 -0
  59. egain_api_python/models/articleresult.py +159 -0
  60. egain_api_python/models/articleresultadditionalattributes.py +22 -0
  61. egain_api_python/models/articleresults.py +32 -0
  62. egain_api_python/models/articlesearchresult.py +243 -0
  63. egain_api_python/models/articlesearchresults.py +32 -0
  64. egain_api_python/models/articlesort.py +11 -0
  65. egain_api_python/models/articlesortorder.py +11 -0
  66. egain_api_python/models/articletype.py +56 -0
  67. egain_api_python/models/articlewitheditions.py +227 -0
  68. egain_api_python/models/attachment.py +31 -0
  69. egain_api_python/models/attachmentadditionalattributes.py +10 -0
  70. egain_api_python/models/attachmentcontent.py +57 -0
  71. egain_api_python/models/attachmentcontentresult.py +22 -0
  72. egain_api_python/models/attachmentforcreatesuggestion.py +25 -0
  73. egain_api_python/models/attachments.py +35 -0
  74. egain_api_python/models/attachmentsummary.py +37 -0
  75. egain_api_python/models/attachmentupload.py +20 -0
  76. egain_api_python/models/avertcustomerescalationop.py +44 -0
  77. egain_api_python/models/bookmark.py +57 -0
  78. egain_api_python/models/bookmarkresult.py +26 -0
  79. egain_api_python/models/bookmarkstatus.py +34 -0
  80. egain_api_python/models/case.py +158 -0
  81. egain_api_python/models/caseadditionalattributes.py +11 -0
  82. egain_api_python/models/caseanswer.py +21 -0
  83. egain_api_python/models/casebase.py +67 -0
  84. egain_api_python/models/casebaseresult.py +28 -0
  85. egain_api_python/models/casebasesearchsettings.py +26 -0
  86. egain_api_python/models/caselistresult.py +74 -0
  87. egain_api_python/models/caselistresults.py +28 -0
  88. egain_api_python/models/casequestion.py +16 -0
  89. egain_api_python/models/casequestiondetail.py +29 -0
  90. egain_api_python/models/casesearch.py +80 -0
  91. egain_api_python/models/clusterid.py +16 -0
  92. egain_api_python/models/clusterresult.py +37 -0
  93. egain_api_python/models/clusterresults.py +28 -0
  94. egain_api_python/models/comment.py +33 -0
  95. egain_api_python/models/comments.py +26 -0
  96. egain_api_python/models/completecustomerescalationop.py +44 -0
  97. egain_api_python/models/compliancearticleresult.py +166 -0
  98. egain_api_python/models/compliancearticleresultadditionalattributes.py +22 -0
  99. egain_api_python/models/compliancearticleresults.py +35 -0
  100. egain_api_python/models/complianceforarticle.py +59 -0
  101. egain_api_python/models/complyarticleop.py +40 -0
  102. egain_api_python/models/components_schemas_tag.py +25 -0
  103. egain_api_python/models/components_schemas_tagcategory.py +39 -0
  104. egain_api_python/models/components_schemas_taggroup.py +25 -0
  105. egain_api_python/models/configurableattribute.py +25 -0
  106. egain_api_python/models/configurableattributes.py +15 -0
  107. egain_api_python/models/contactperson.py +43 -0
  108. egain_api_python/models/contacts.py +21 -0
  109. egain_api_python/models/createbookmark.py +64 -0
  110. egain_api_python/models/createdby.py +37 -0
  111. egain_api_python/models/createfederatedsearchevent.py +85 -0
  112. egain_api_python/models/createfederatedsearchresulteventop.py +46 -0
  113. egain_api_python/models/createimportop.py +20 -0
  114. egain_api_python/models/createimportvalidationop.py +20 -0
  115. egain_api_python/models/createquickpick.py +34 -0
  116. egain_api_python/models/createquickpickop.py +55 -0
  117. egain_api_python/models/createsearchresulteventforconnectors.py +71 -0
  118. egain_api_python/models/createsearchresulteventforconnectorsop.py +48 -0
  119. egain_api_python/models/createsignedurlop.py +29 -0
  120. egain_api_python/models/createsuggestion.py +126 -0
  121. egain_api_python/models/createviewedsearchresulteventforconnectors.py +76 -0
  122. egain_api_python/models/createviewedsearchresultseventforconnectorsop.py +48 -0
  123. egain_api_python/models/customattribute.py +35 -0
  124. egain_api_python/models/deletebookmarkop.py +40 -0
  125. egain_api_python/models/deletesuggestionop.py +40 -0
  126. egain_api_python/models/department.py +21 -0
  127. egain_api_python/models/detailfield.py +32 -0
  128. egain_api_python/models/displayfield.py +27 -0
  129. egain_api_python/models/dynamiccluster.py +21 -0
  130. egain_api_python/models/dynamicsearch.py +40 -0
  131. egain_api_python/models/edition.py +79 -0
  132. egain_api_python/models/editionwithcontent.py +68 -0
  133. egain_api_python/models/email.py +21 -0
  134. egain_api_python/models/exportcontentop.py +14 -0
  135. egain_api_python/models/exportstatus.py +106 -0
  136. egain_api_python/models/exportstatusop.py +31 -0
  137. egain_api_python/models/feedbackarticleforsuggestion.py +34 -0
  138. egain_api_python/models/folderbreadcrumb.py +24 -0
  139. egain_api_python/models/foldersummary.py +29 -0
  140. egain_api_python/models/getacknowledgedcompliancearticlesop.py +119 -0
  141. egain_api_python/models/getallarticlelistsop.py +47 -0
  142. egain_api_python/models/getallcasebasesreleasesop.py +65 -0
  143. egain_api_python/models/getallcasesop.py +83 -0
  144. egain_api_python/models/getallportalsop.py +60 -0
  145. egain_api_python/models/getallprofilesinportalop.py +64 -0
  146. egain_api_python/models/getallquickpicksop.py +83 -0
  147. egain_api_python/models/getalltopicsop.py +132 -0
  148. egain_api_python/models/getalluserprofilesop.py +47 -0
  149. egain_api_python/models/getancestortopicsop.py +133 -0
  150. egain_api_python/models/getannouncementarticlesop.py +134 -0
  151. egain_api_python/models/getarticleattachmentbyidop.py +31 -0
  152. egain_api_python/models/getarticlebyidop.py +257 -0
  153. egain_api_python/models/getarticlebyidwitheditionsop.py +46 -0
  154. egain_api_python/models/getarticleeditiondetailsop.py +55 -0
  155. egain_api_python/models/getarticlelistdetailsop.py +115 -0
  156. egain_api_python/models/getarticlepermissionsbyidop.py +40 -0
  157. egain_api_python/models/getarticlepersonalizationop.py +73 -0
  158. egain_api_python/models/getarticleratingsop.py +74 -0
  159. egain_api_python/models/getarticlesintopicop.py +172 -0
  160. egain_api_python/models/getattachmentbyidinportalop.py +56 -0
  161. egain_api_python/models/getbookmarkop.py +31 -0
  162. egain_api_python/models/getcasebasereleasebyidop.py +64 -0
  163. egain_api_python/models/getcasebyidop.py +75 -0
  164. egain_api_python/models/getchildtopicsop.py +150 -0
  165. egain_api_python/models/getclusterbycasebasereleaseidop.py +74 -0
  166. egain_api_python/models/gethealthop.py +130 -0
  167. egain_api_python/models/getimportcontentop.py +46 -0
  168. egain_api_python/models/getmyportalsop.py +97 -0
  169. egain_api_python/models/getmysubscriptionop.py +115 -0
  170. egain_api_python/models/getpendingcompliancearticlesop.py +119 -0
  171. egain_api_python/models/getpopulararticlesop.py +133 -0
  172. egain_api_python/models/getportaldetailsbyidop.py +47 -0
  173. egain_api_python/models/getrelatedarticlesforsuggestionop.py +96 -0
  174. egain_api_python/models/getrelatedarticlesop.py +143 -0
  175. egain_api_python/models/getsuggestionattachmentbyidop.py +76 -0
  176. egain_api_python/models/getsuggestionattachmentsop.py +40 -0
  177. egain_api_python/models/getsuggestioncommentsop.py +40 -0
  178. egain_api_python/models/getsuggestionop.py +107 -0
  179. egain_api_python/models/gettagcategoriesforinterestforportalop.py +46 -0
  180. egain_api_python/models/gettopicbreadcrumbforarticleop.py +55 -0
  181. egain_api_python/models/getuserdetailsop.py +22 -0
  182. egain_api_python/models/getusermilestonesop.py +22 -0
  183. egain_api_python/models/ghsearchrequest.py +67 -0
  184. egain_api_python/models/ghsearchresult.py +75 -0
  185. egain_api_python/models/ghstepsearchrequest.py +64 -0
  186. egain_api_python/models/image.py +17 -0
  187. egain_api_python/models/importcontent.py +79 -0
  188. egain_api_python/models/importstatus.py +29 -0
  189. egain_api_python/models/kblanguage.py +63 -0
  190. egain_api_python/models/kblanguagecode.py +48 -0
  191. egain_api_python/models/kblanguages.py +22 -0
  192. egain_api_python/models/knowledgeexport.py +237 -0
  193. egain_api_python/models/l10nstring.py +22 -0
  194. egain_api_python/models/languagecode.py +39 -0
  195. egain_api_python/models/languagecode_parameter.py +39 -0
  196. egain_api_python/models/languagequeryparameter.py +39 -0
  197. egain_api_python/models/link.py +25 -0
  198. egain_api_python/models/makesuggestionop.py +44 -0
  199. egain_api_python/models/mandatorylanguagequeryparameter.py +38 -0
  200. egain_api_python/models/metadata.py +29 -0
  201. egain_api_python/models/milestone.py +21 -0
  202. egain_api_python/models/milestonename.py +26 -0
  203. egain_api_python/models/milestones.py +21 -0
  204. egain_api_python/models/modifiedby.py +37 -0
  205. egain_api_python/models/modifysuggestion.py +78 -0
  206. egain_api_python/models/modifysuggestionsop.py +44 -0
  207. egain_api_python/models/optionalarticleattributes.py +20 -0
  208. egain_api_python/models/order.py +10 -0
  209. egain_api_python/models/ownedby.py +37 -0
  210. egain_api_python/models/paginationinfo.py +32 -0
  211. egain_api_python/models/patchimportcontentvalidationop.py +46 -0
  212. egain_api_python/models/personalization.py +67 -0
  213. egain_api_python/models/phone.py +21 -0
  214. egain_api_python/models/portal.py +102 -0
  215. egain_api_python/models/portalresult.py +28 -0
  216. egain_api_python/models/portalsettings.py +398 -0
  217. egain_api_python/models/post_portalid_answersop.py +88 -0
  218. egain_api_python/models/post_portalid_retrieveop.py +88 -0
  219. egain_api_python/models/profile.py +26 -0
  220. egain_api_python/models/profileresult.py +24 -0
  221. egain_api_python/models/publishprofile.py +30 -0
  222. egain_api_python/models/publishview.py +38 -0
  223. egain_api_python/models/question.py +101 -0
  224. egain_api_python/models/questionandanswer.py +26 -0
  225. egain_api_python/models/quickpickrating.py +32 -0
  226. egain_api_python/models/quickpickresult.py +38 -0
  227. egain_api_python/models/quickpickresults.py +28 -0
  228. egain_api_python/models/ratearticleop.py +71 -0
  229. egain_api_python/models/referenceresponse.py +80 -0
  230. egain_api_python/models/rejectghsolutionop.py +52 -0
  231. egain_api_python/models/relatedquestions.py +28 -0
  232. egain_api_python/models/resourcetype_parameter.py +10 -0
  233. egain_api_python/models/restorequickpickop.py +63 -0
  234. egain_api_python/models/retrieverequest.py +47 -0
  235. egain_api_python/models/retrieveresponse.py +96 -0
  236. egain_api_python/models/role.py +26 -0
  237. egain_api_python/models/roletemplate.py +25 -0
  238. egain_api_python/models/schemas_answer.py +94 -0
  239. egain_api_python/models/schemas_customattribute.py +35 -0
  240. egain_api_python/models/schemas_link.py +27 -0
  241. egain_api_python/models/schemas_tag.py +21 -0
  242. egain_api_python/models/schemas_tagcategory.py +75 -0
  243. egain_api_python/models/schemas_taggroup.py +31 -0
  244. egain_api_python/models/schemas_tags.py +19 -0
  245. egain_api_python/models/schemas_wserrorcommon.py +17 -0
  246. egain_api_python/models/searchfilterattribute.py +61 -0
  247. egain_api_python/models/searchpriortoescalationop.py +108 -0
  248. egain_api_python/models/searchresult.py +101 -0
  249. egain_api_python/models/searchsuggestionop.py +93 -0
  250. egain_api_python/models/security.py +25 -0
  251. egain_api_python/models/selectuserprofileop.py +44 -0
  252. egain_api_python/models/sessioncontextvariable.py +17 -0
  253. egain_api_python/models/shorturl.py +32 -0
  254. egain_api_python/models/sortidname.py +10 -0
  255. egain_api_python/models/sortidnamedepartment.py +11 -0
  256. egain_api_python/models/stage.py +26 -0
  257. egain_api_python/models/startcustomerescalationop.py +66 -0
  258. egain_api_python/models/startescalationrequest.py +94 -0
  259. egain_api_python/models/startghsearchop.py +74 -0
  260. egain_api_python/models/startquestionandanswer.py +26 -0
  261. egain_api_python/models/stepghsearchop.py +62 -0
  262. egain_api_python/models/stringattributevalue.py +30 -0
  263. egain_api_python/models/structuredauthoringfields.py +33 -0
  264. egain_api_python/models/subscribearticleop.py +40 -0
  265. egain_api_python/models/suggestion.py +190 -0
  266. egain_api_python/models/suggestionadditionalattributes.py +11 -0
  267. egain_api_python/models/suggestionattachment.py +46 -0
  268. egain_api_python/models/suggestions.py +28 -0
  269. egain_api_python/models/tag.py +17 -0
  270. egain_api_python/models/tagcategoriesforinterest.py +22 -0
  271. egain_api_python/models/tagcategory.py +34 -0
  272. egain_api_python/models/taggroup.py +17 -0
  273. egain_api_python/models/taggroups.py +20 -0
  274. egain_api_python/models/tags.py +17 -0
  275. egain_api_python/models/topic.py +113 -0
  276. egain_api_python/models/topicadditionalattributes.py +20 -0
  277. egain_api_python/models/topicaisearchresult.py +67 -0
  278. egain_api_python/models/topicbreadcrumb.py +24 -0
  279. egain_api_python/models/topicresult.py +26 -0
  280. egain_api_python/models/topicsummary.py +31 -0
  281. egain_api_python/models/topictreenode.py +27 -0
  282. egain_api_python/models/topictreeresult.py +28 -0
  283. egain_api_python/models/unsubscribearticleop.py +55 -0
  284. egain_api_python/models/uploadattachmentop.py +36 -0
  285. egain_api_python/models/userdetails.py +44 -0
  286. egain_api_python/models/userprofile.py +33 -0
  287. egain_api_python/models/userprofiles.py +21 -0
  288. egain_api_python/models/userview.py +33 -0
  289. egain_api_python/models/validateimportcontent.py +58 -0
  290. egain_api_python/models/virtualcase.py +52 -0
  291. egain_api_python/models/workflow.py +21 -0
  292. egain_api_python/models/workflowmilestone.py +11 -0
  293. egain_api_python/models/wserrorcommon.py +17 -0
  294. egain_api_python/populararticles.py +287 -0
  295. egain_api_python/portal_article.py +4935 -0
  296. egain_api_python/portal_attachment.py +494 -0
  297. egain_api_python/portal_bookmark.py +707 -0
  298. egain_api_python/portal_sdk.py +88 -0
  299. egain_api_python/portal_suggestion.py +2283 -0
  300. egain_api_python/portal_topic.py +975 -0
  301. egain_api_python/portal_userdetails.py +211 -0
  302. egain_api_python/portal_userprofile.py +431 -0
  303. egain_api_python/py.typed +1 -0
  304. egain_api_python/retrieve.py +265 -0
  305. egain_api_python/sdk.py +216 -0
  306. egain_api_python/sdkconfiguration.py +50 -0
  307. egain_api_python/search.py +251 -0
  308. egain_api_python/types/__init__.py +21 -0
  309. egain_api_python/types/basemodel.py +39 -0
  310. egain_api_python/usermilestones.py +219 -0
  311. egain_api_python/utils/__init__.py +200 -0
  312. egain_api_python/utils/annotations.py +79 -0
  313. egain_api_python/utils/datetimes.py +23 -0
  314. egain_api_python/utils/enums.py +74 -0
  315. egain_api_python/utils/eventstreaming.py +248 -0
  316. egain_api_python/utils/forms.py +223 -0
  317. egain_api_python/utils/headers.py +136 -0
  318. egain_api_python/utils/logger.py +27 -0
  319. egain_api_python/utils/metadata.py +118 -0
  320. egain_api_python/utils/queryparams.py +205 -0
  321. egain_api_python/utils/requestbodies.py +66 -0
  322. egain_api_python/utils/retries.py +217 -0
  323. egain_api_python/utils/security.py +192 -0
  324. egain_api_python/utils/serializers.py +249 -0
  325. egain_api_python/utils/unmarshal_json_response.py +24 -0
  326. egain_api_python/utils/url.py +155 -0
  327. egain_api_python/utils/values.py +137 -0
  328. egain_api_python-0.1.1.dist-info/METADATA +827 -0
  329. egain_api_python-0.1.1.dist-info/RECORD +332 -0
  330. egain_api_python-0.1.1.dist-info/WHEEL +5 -0
  331. egain_api_python-0.1.1.dist-info/licenses/LICENSE +21 -0
  332. egain_api_python-0.1.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,200 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from typing import TYPE_CHECKING
4
+ from importlib import import_module
5
+ import builtins
6
+ import sys
7
+
8
+ if TYPE_CHECKING:
9
+ from .annotations import get_discriminator
10
+ from .datetimes import parse_datetime
11
+ from .enums import OpenEnumMeta
12
+ from .headers import get_headers, get_response_headers
13
+ from .metadata import (
14
+ FieldMetadata,
15
+ find_metadata,
16
+ FormMetadata,
17
+ HeaderMetadata,
18
+ MultipartFormMetadata,
19
+ PathParamMetadata,
20
+ QueryParamMetadata,
21
+ RequestMetadata,
22
+ SecurityMetadata,
23
+ )
24
+ from .queryparams import get_query_params
25
+ from .retries import BackoffStrategy, Retries, retry, retry_async, RetryConfig
26
+ from .requestbodies import serialize_request_body, SerializedRequestBody
27
+ from .security import get_security, get_security_from_env
28
+
29
+ from .serializers import (
30
+ get_pydantic_model,
31
+ marshal_json,
32
+ unmarshal,
33
+ unmarshal_json,
34
+ serialize_decimal,
35
+ serialize_float,
36
+ serialize_int,
37
+ stream_to_text,
38
+ stream_to_text_async,
39
+ stream_to_bytes,
40
+ stream_to_bytes_async,
41
+ validate_const,
42
+ validate_decimal,
43
+ validate_float,
44
+ validate_int,
45
+ validate_open_enum,
46
+ )
47
+ from .url import generate_url, template_url, remove_suffix
48
+ from .values import (
49
+ get_global_from_env,
50
+ match_content_type,
51
+ match_status_codes,
52
+ match_response,
53
+ cast_partial,
54
+ )
55
+ from .logger import Logger, get_body_content, get_default_logger
56
+
57
+ __all__ = [
58
+ "BackoffStrategy",
59
+ "FieldMetadata",
60
+ "find_metadata",
61
+ "FormMetadata",
62
+ "generate_url",
63
+ "get_body_content",
64
+ "get_default_logger",
65
+ "get_discriminator",
66
+ "parse_datetime",
67
+ "get_global_from_env",
68
+ "get_headers",
69
+ "get_pydantic_model",
70
+ "get_query_params",
71
+ "get_response_headers",
72
+ "get_security",
73
+ "get_security_from_env",
74
+ "HeaderMetadata",
75
+ "Logger",
76
+ "marshal_json",
77
+ "match_content_type",
78
+ "match_status_codes",
79
+ "match_response",
80
+ "MultipartFormMetadata",
81
+ "OpenEnumMeta",
82
+ "PathParamMetadata",
83
+ "QueryParamMetadata",
84
+ "remove_suffix",
85
+ "Retries",
86
+ "retry",
87
+ "retry_async",
88
+ "RetryConfig",
89
+ "RequestMetadata",
90
+ "SecurityMetadata",
91
+ "serialize_decimal",
92
+ "serialize_float",
93
+ "serialize_int",
94
+ "serialize_request_body",
95
+ "SerializedRequestBody",
96
+ "stream_to_text",
97
+ "stream_to_text_async",
98
+ "stream_to_bytes",
99
+ "stream_to_bytes_async",
100
+ "template_url",
101
+ "unmarshal",
102
+ "unmarshal_json",
103
+ "validate_decimal",
104
+ "validate_const",
105
+ "validate_float",
106
+ "validate_int",
107
+ "validate_open_enum",
108
+ "cast_partial",
109
+ ]
110
+
111
+ _dynamic_imports: dict[str, str] = {
112
+ "BackoffStrategy": ".retries",
113
+ "FieldMetadata": ".metadata",
114
+ "find_metadata": ".metadata",
115
+ "FormMetadata": ".metadata",
116
+ "generate_url": ".url",
117
+ "get_body_content": ".logger",
118
+ "get_default_logger": ".logger",
119
+ "get_discriminator": ".annotations",
120
+ "parse_datetime": ".datetimes",
121
+ "get_global_from_env": ".values",
122
+ "get_headers": ".headers",
123
+ "get_pydantic_model": ".serializers",
124
+ "get_query_params": ".queryparams",
125
+ "get_response_headers": ".headers",
126
+ "get_security": ".security",
127
+ "get_security_from_env": ".security",
128
+ "HeaderMetadata": ".metadata",
129
+ "Logger": ".logger",
130
+ "marshal_json": ".serializers",
131
+ "match_content_type": ".values",
132
+ "match_status_codes": ".values",
133
+ "match_response": ".values",
134
+ "MultipartFormMetadata": ".metadata",
135
+ "OpenEnumMeta": ".enums",
136
+ "PathParamMetadata": ".metadata",
137
+ "QueryParamMetadata": ".metadata",
138
+ "remove_suffix": ".url",
139
+ "Retries": ".retries",
140
+ "retry": ".retries",
141
+ "retry_async": ".retries",
142
+ "RetryConfig": ".retries",
143
+ "RequestMetadata": ".metadata",
144
+ "SecurityMetadata": ".metadata",
145
+ "serialize_decimal": ".serializers",
146
+ "serialize_float": ".serializers",
147
+ "serialize_int": ".serializers",
148
+ "serialize_request_body": ".requestbodies",
149
+ "SerializedRequestBody": ".requestbodies",
150
+ "stream_to_text": ".serializers",
151
+ "stream_to_text_async": ".serializers",
152
+ "stream_to_bytes": ".serializers",
153
+ "stream_to_bytes_async": ".serializers",
154
+ "template_url": ".url",
155
+ "unmarshal": ".serializers",
156
+ "unmarshal_json": ".serializers",
157
+ "validate_decimal": ".serializers",
158
+ "validate_const": ".serializers",
159
+ "validate_float": ".serializers",
160
+ "validate_int": ".serializers",
161
+ "validate_open_enum": ".serializers",
162
+ "cast_partial": ".values",
163
+ }
164
+
165
+
166
+ def dynamic_import(modname, retries=3):
167
+ for attempt in range(retries):
168
+ try:
169
+ return import_module(modname, __package__)
170
+ except KeyError:
171
+ # Clear any half-initialized module and retry
172
+ sys.modules.pop(modname, None)
173
+ if attempt == retries - 1:
174
+ break
175
+ raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
176
+
177
+
178
+ def __getattr__(attr_name: str) -> object:
179
+ module_name = _dynamic_imports.get(attr_name)
180
+ if module_name is None:
181
+ raise AttributeError(
182
+ f"no {attr_name} found in _dynamic_imports, module name -> {__name__} "
183
+ )
184
+
185
+ try:
186
+ module = dynamic_import(module_name)
187
+ return getattr(module, attr_name)
188
+ except ImportError as e:
189
+ raise ImportError(
190
+ f"Failed to import {attr_name} from {module_name}: {e}"
191
+ ) from e
192
+ except AttributeError as e:
193
+ raise AttributeError(
194
+ f"Failed to get {attr_name} from {module_name}: {e}"
195
+ ) from e
196
+
197
+
198
+ def __dir__():
199
+ lazy_attrs = builtins.list(_dynamic_imports.keys())
200
+ return builtins.sorted(lazy_attrs)
@@ -0,0 +1,79 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from enum import Enum
4
+ from typing import Any, Optional
5
+
6
+
7
+ def get_discriminator(model: Any, fieldname: str, key: str) -> str:
8
+ """
9
+ Recursively search for the discriminator attribute in a model.
10
+
11
+ Args:
12
+ model (Any): The model to search within.
13
+ fieldname (str): The name of the field to search for.
14
+ key (str): The key to search for in dictionaries.
15
+
16
+ Returns:
17
+ str: The name of the discriminator attribute.
18
+
19
+ Raises:
20
+ ValueError: If the discriminator attribute is not found.
21
+ """
22
+ upper_fieldname = fieldname.upper()
23
+
24
+ def get_field_discriminator(field: Any) -> Optional[str]:
25
+ """Search for the discriminator attribute in a given field."""
26
+
27
+ if isinstance(field, dict):
28
+ if key in field:
29
+ return f"{field[key]}"
30
+
31
+ if hasattr(field, fieldname):
32
+ attr = getattr(field, fieldname)
33
+ if isinstance(attr, Enum):
34
+ return f"{attr.value}"
35
+ return f"{attr}"
36
+
37
+ if hasattr(field, upper_fieldname):
38
+ attr = getattr(field, upper_fieldname)
39
+ if isinstance(attr, Enum):
40
+ return f"{attr.value}"
41
+ return f"{attr}"
42
+
43
+ return None
44
+
45
+ def search_nested_discriminator(obj: Any) -> Optional[str]:
46
+ """Recursively search for discriminator in nested structures."""
47
+ # First try direct field lookup
48
+ discriminator = get_field_discriminator(obj)
49
+ if discriminator is not None:
50
+ return discriminator
51
+
52
+ # If it's a dict, search in nested values
53
+ if isinstance(obj, dict):
54
+ for value in obj.values():
55
+ if isinstance(value, list):
56
+ # Search in list items
57
+ for item in value:
58
+ nested_discriminator = search_nested_discriminator(item)
59
+ if nested_discriminator is not None:
60
+ return nested_discriminator
61
+ elif isinstance(value, dict):
62
+ # Search in nested dict
63
+ nested_discriminator = search_nested_discriminator(value)
64
+ if nested_discriminator is not None:
65
+ return nested_discriminator
66
+
67
+ return None
68
+
69
+ if isinstance(model, list):
70
+ for field in model:
71
+ discriminator = search_nested_discriminator(field)
72
+ if discriminator is not None:
73
+ return discriminator
74
+
75
+ discriminator = search_nested_discriminator(model)
76
+ if discriminator is not None:
77
+ return discriminator
78
+
79
+ raise ValueError(f"Could not find discriminator field {fieldname} in {model}")
@@ -0,0 +1,23 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from datetime import datetime
4
+ import sys
5
+
6
+
7
+ def parse_datetime(datetime_string: str) -> datetime:
8
+ """
9
+ Convert a RFC 3339 / ISO 8601 formatted string into a datetime object.
10
+ Python versions 3.11 and later support parsing RFC 3339 directly with
11
+ datetime.fromisoformat(), but for earlier versions, this function
12
+ encapsulates the necessary extra logic.
13
+ """
14
+ # Python 3.11 and later can parse RFC 3339 directly
15
+ if sys.version_info >= (3, 11):
16
+ return datetime.fromisoformat(datetime_string)
17
+
18
+ # For Python 3.10 and earlier, a common ValueError is trailing 'Z' suffix,
19
+ # so fix that upfront.
20
+ if datetime_string.endswith("Z"):
21
+ datetime_string = datetime_string[:-1] + "+00:00"
22
+
23
+ return datetime.fromisoformat(datetime_string)
@@ -0,0 +1,74 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ import enum
4
+ import sys
5
+
6
+ class OpenEnumMeta(enum.EnumMeta):
7
+ # The __call__ method `boundary` kwarg was added in 3.11 and must be present
8
+ # for pyright. Refer also: https://github.com/pylint-dev/pylint/issues/9622
9
+ # pylint: disable=unexpected-keyword-arg
10
+ # The __call__ method `values` varg must be named for pyright.
11
+ # pylint: disable=keyword-arg-before-vararg
12
+
13
+ if sys.version_info >= (3, 11):
14
+ def __call__(
15
+ cls, value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None
16
+ ):
17
+ # The `type` kwarg also happens to be a built-in that pylint flags as
18
+ # redeclared. Safe to ignore this lint rule with this scope.
19
+ # pylint: disable=redefined-builtin
20
+
21
+ if names is not None:
22
+ return super().__call__(
23
+ value,
24
+ names=names,
25
+ *values,
26
+ module=module,
27
+ qualname=qualname,
28
+ type=type,
29
+ start=start,
30
+ boundary=boundary,
31
+ )
32
+
33
+ try:
34
+ return super().__call__(
35
+ value,
36
+ names=names, # pyright: ignore[reportArgumentType]
37
+ *values,
38
+ module=module,
39
+ qualname=qualname,
40
+ type=type,
41
+ start=start,
42
+ boundary=boundary,
43
+ )
44
+ except ValueError:
45
+ return value
46
+ else:
47
+ def __call__(
48
+ cls, value, names=None, *, module=None, qualname=None, type=None, start=1
49
+ ):
50
+ # The `type` kwarg also happens to be a built-in that pylint flags as
51
+ # redeclared. Safe to ignore this lint rule with this scope.
52
+ # pylint: disable=redefined-builtin
53
+
54
+ if names is not None:
55
+ return super().__call__(
56
+ value,
57
+ names=names,
58
+ module=module,
59
+ qualname=qualname,
60
+ type=type,
61
+ start=start,
62
+ )
63
+
64
+ try:
65
+ return super().__call__(
66
+ value,
67
+ names=names, # pyright: ignore[reportArgumentType]
68
+ module=module,
69
+ qualname=qualname,
70
+ type=type,
71
+ start=start,
72
+ )
73
+ except ValueError:
74
+ return value
@@ -0,0 +1,248 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ import re
4
+ import json
5
+ from typing import (
6
+ Callable,
7
+ Generic,
8
+ TypeVar,
9
+ Optional,
10
+ Generator,
11
+ AsyncGenerator,
12
+ Tuple,
13
+ )
14
+ import httpx
15
+
16
+ T = TypeVar("T")
17
+
18
+
19
+ class EventStream(Generic[T]):
20
+ # Holds a reference to the SDK client to avoid it being garbage collected
21
+ # and cause termination of the underlying httpx client.
22
+ client_ref: Optional[object]
23
+ response: httpx.Response
24
+ generator: Generator[T, None, None]
25
+
26
+ def __init__(
27
+ self,
28
+ response: httpx.Response,
29
+ decoder: Callable[[str], T],
30
+ sentinel: Optional[str] = None,
31
+ client_ref: Optional[object] = None,
32
+ ):
33
+ self.response = response
34
+ self.generator = stream_events(response, decoder, sentinel)
35
+ self.client_ref = client_ref
36
+
37
+ def __iter__(self):
38
+ return self
39
+
40
+ def __next__(self):
41
+ return next(self.generator)
42
+
43
+ def __enter__(self):
44
+ return self
45
+
46
+ def __exit__(self, exc_type, exc_val, exc_tb):
47
+ self.response.close()
48
+
49
+
50
+ class EventStreamAsync(Generic[T]):
51
+ # Holds a reference to the SDK client to avoid it being garbage collected
52
+ # and cause termination of the underlying httpx client.
53
+ client_ref: Optional[object]
54
+ response: httpx.Response
55
+ generator: AsyncGenerator[T, None]
56
+
57
+ def __init__(
58
+ self,
59
+ response: httpx.Response,
60
+ decoder: Callable[[str], T],
61
+ sentinel: Optional[str] = None,
62
+ client_ref: Optional[object] = None,
63
+ ):
64
+ self.response = response
65
+ self.generator = stream_events_async(response, decoder, sentinel)
66
+ self.client_ref = client_ref
67
+
68
+ def __aiter__(self):
69
+ return self
70
+
71
+ async def __anext__(self):
72
+ return await self.generator.__anext__()
73
+
74
+ async def __aenter__(self):
75
+ return self
76
+
77
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
78
+ await self.response.aclose()
79
+
80
+
81
+ class ServerEvent:
82
+ id: Optional[str] = None
83
+ event: Optional[str] = None
84
+ data: Optional[str] = None
85
+ retry: Optional[int] = None
86
+
87
+
88
+ MESSAGE_BOUNDARIES = [
89
+ b"\r\n\r\n",
90
+ b"\n\n",
91
+ b"\r\r",
92
+ ]
93
+
94
+
95
+ async def stream_events_async(
96
+ response: httpx.Response,
97
+ decoder: Callable[[str], T],
98
+ sentinel: Optional[str] = None,
99
+ ) -> AsyncGenerator[T, None]:
100
+ buffer = bytearray()
101
+ position = 0
102
+ discard = False
103
+ async for chunk in response.aiter_bytes():
104
+ # We've encountered the sentinel value and should no longer process
105
+ # incoming data. Instead we throw new data away until the server closes
106
+ # the connection.
107
+ if discard:
108
+ continue
109
+
110
+ buffer += chunk
111
+ for i in range(position, len(buffer)):
112
+ char = buffer[i : i + 1]
113
+ seq: Optional[bytes] = None
114
+ if char in [b"\r", b"\n"]:
115
+ for boundary in MESSAGE_BOUNDARIES:
116
+ seq = _peek_sequence(i, buffer, boundary)
117
+ if seq is not None:
118
+ break
119
+ if seq is None:
120
+ continue
121
+
122
+ block = buffer[position:i]
123
+ position = i + len(seq)
124
+ event, discard = _parse_event(block, decoder, sentinel)
125
+ if event is not None:
126
+ yield event
127
+
128
+ if position > 0:
129
+ buffer = buffer[position:]
130
+ position = 0
131
+
132
+ event, discard = _parse_event(buffer, decoder, sentinel)
133
+ if event is not None:
134
+ yield event
135
+
136
+
137
+ def stream_events(
138
+ response: httpx.Response,
139
+ decoder: Callable[[str], T],
140
+ sentinel: Optional[str] = None,
141
+ ) -> Generator[T, None, None]:
142
+ buffer = bytearray()
143
+ position = 0
144
+ discard = False
145
+ for chunk in response.iter_bytes():
146
+ # We've encountered the sentinel value and should no longer process
147
+ # incoming data. Instead we throw new data away until the server closes
148
+ # the connection.
149
+ if discard:
150
+ continue
151
+
152
+ buffer += chunk
153
+ for i in range(position, len(buffer)):
154
+ char = buffer[i : i + 1]
155
+ seq: Optional[bytes] = None
156
+ if char in [b"\r", b"\n"]:
157
+ for boundary in MESSAGE_BOUNDARIES:
158
+ seq = _peek_sequence(i, buffer, boundary)
159
+ if seq is not None:
160
+ break
161
+ if seq is None:
162
+ continue
163
+
164
+ block = buffer[position:i]
165
+ position = i + len(seq)
166
+ event, discard = _parse_event(block, decoder, sentinel)
167
+ if event is not None:
168
+ yield event
169
+
170
+ if position > 0:
171
+ buffer = buffer[position:]
172
+ position = 0
173
+
174
+ event, discard = _parse_event(buffer, decoder, sentinel)
175
+ if event is not None:
176
+ yield event
177
+
178
+
179
+ def _parse_event(
180
+ raw: bytearray, decoder: Callable[[str], T], sentinel: Optional[str] = None
181
+ ) -> Tuple[Optional[T], bool]:
182
+ block = raw.decode()
183
+ lines = re.split(r"\r?\n|\r", block)
184
+ publish = False
185
+ event = ServerEvent()
186
+ data = ""
187
+ for line in lines:
188
+ if not line:
189
+ continue
190
+
191
+ delim = line.find(":")
192
+ if delim <= 0:
193
+ continue
194
+
195
+ field = line[0:delim]
196
+ value = line[delim + 1 :] if delim < len(line) - 1 else ""
197
+ if len(value) and value[0] == " ":
198
+ value = value[1:]
199
+
200
+ if field == "event":
201
+ event.event = value
202
+ publish = True
203
+ elif field == "data":
204
+ data += value + "\n"
205
+ publish = True
206
+ elif field == "id":
207
+ event.id = value
208
+ publish = True
209
+ elif field == "retry":
210
+ event.retry = int(value) if value.isdigit() else None
211
+ publish = True
212
+
213
+ if sentinel and data == f"{sentinel}\n":
214
+ return None, True
215
+
216
+ if data:
217
+ data = data[:-1]
218
+ event.data = data
219
+
220
+ data_is_primitive = (
221
+ data.isnumeric() or data == "true" or data == "false" or data == "null"
222
+ )
223
+ data_is_json = (
224
+ data.startswith("{") or data.startswith("[") or data.startswith('"')
225
+ )
226
+
227
+ if data_is_primitive or data_is_json:
228
+ try:
229
+ event.data = json.loads(data)
230
+ except Exception:
231
+ pass
232
+
233
+ out = None
234
+ if publish:
235
+ out = decoder(json.dumps(event.__dict__))
236
+
237
+ return out, False
238
+
239
+
240
+ def _peek_sequence(position: int, buffer: bytearray, sequence: bytes):
241
+ if len(sequence) > (len(buffer) - position):
242
+ return None
243
+
244
+ for i, seq in enumerate(sequence):
245
+ if buffer[position + i] != seq:
246
+ return None
247
+
248
+ return sequence