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,2283 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from egain_api_python import errors, models, utils
5
+ from egain_api_python._hooks import HookContext
6
+ from egain_api_python.types import OptionalNullable, UNSET
7
+ from egain_api_python.utils import get_security_from_env
8
+ from egain_api_python.utils.unmarshal_json_response import unmarshal_json_response
9
+ from typing import Any, List, Mapping, Optional, Union
10
+
11
+
12
+ class PortalSuggestion(BaseSDK):
13
+ def make_suggestion(
14
+ self,
15
+ *,
16
+ accept_language: models.AcceptLanguage,
17
+ portal_id: str,
18
+ name: str,
19
+ content: str,
20
+ language: Union[
21
+ models.CreateSuggestionLanguage, models.CreateSuggestionLanguageTypedDict
22
+ ],
23
+ description: Optional[str] = None,
24
+ feedback_article: Optional[
25
+ Union[
26
+ models.RelatedArticleForCreateUpdateDeleteSuggestion,
27
+ models.RelatedArticleForCreateUpdateDeleteSuggestionTypedDict,
28
+ ]
29
+ ] = None,
30
+ attachments: Optional[
31
+ Union[
32
+ models.CreateSuggestionAttachments,
33
+ models.CreateSuggestionAttachmentsTypedDict,
34
+ ]
35
+ ] = None,
36
+ custom_attributes: Optional[
37
+ Union[List[models.CustomAttribute], List[models.CustomAttributeTypedDict]]
38
+ ] = None,
39
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
40
+ server_url: Optional[str] = None,
41
+ timeout_ms: Optional[int] = None,
42
+ http_headers: Optional[Mapping[str, str]] = None,
43
+ ):
44
+ r"""Make a Suggestion
45
+
46
+ ## Overview
47
+ The Make a Suggestion API allows users to create an Article Suggestion from within a knowledge portal.
48
+
49
+ ## Prerequisites
50
+ * Enable the setting \"Manage a Suggestion\" for the portal specified in the URL.
51
+ * If the user is a Customer, enable the setting \"Allow Customer Access\" for the portal.
52
+ * If you want to add an attachment to a Suggestion, first call the Generate Signed URL to Upload API to add an attachment using the provided returned altID in attachment request.
53
+
54
+
55
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
56
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
57
+ :param name: The name of the Suggestion.
58
+ :param content: The content of the Suggestion.
59
+ :param language: The knowledge base language in which the Suggestion is created.
60
+ :param description: The description of the Suggestion.
61
+ :param feedback_article: The Article that the Suggestion was created for.
62
+ :param attachments: Details of Attachments for the Suggestion.
63
+ :param custom_attributes: The Custom Attributes of the Suggestion.
64
+ :param retries: Override the default retry configuration for this method
65
+ :param server_url: Override the default server URL for this method
66
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
67
+ :param http_headers: Additional headers to set or replace on requests.
68
+ """
69
+ base_url = None
70
+ url_variables = None
71
+ if timeout_ms is None:
72
+ timeout_ms = self.sdk_configuration.timeout_ms
73
+
74
+ if server_url is not None:
75
+ base_url = server_url
76
+ else:
77
+ base_url = self._get_url(base_url, url_variables)
78
+
79
+ request = models.MakeSuggestionRequest(
80
+ accept_language=accept_language,
81
+ portal_id=portal_id,
82
+ create_suggestion=models.CreateSuggestion(
83
+ name=name,
84
+ description=description,
85
+ content=content,
86
+ feedback_article=utils.get_pydantic_model(
87
+ feedback_article,
88
+ Optional[models.RelatedArticleForCreateUpdateDeleteSuggestion],
89
+ ),
90
+ attachments=utils.get_pydantic_model(
91
+ attachments, Optional[models.CreateSuggestionAttachments]
92
+ ),
93
+ language=utils.get_pydantic_model(
94
+ language, models.CreateSuggestionLanguage
95
+ ),
96
+ custom_attributes=utils.get_pydantic_model(
97
+ custom_attributes, Optional[List[models.CustomAttribute]]
98
+ ),
99
+ ),
100
+ )
101
+
102
+ req = self._build_request(
103
+ method="POST",
104
+ path="/portals/{portalID}/suggestions",
105
+ base_url=base_url,
106
+ url_variables=url_variables,
107
+ request=request,
108
+ request_body_required=False,
109
+ request_has_path_params=True,
110
+ request_has_query_params=True,
111
+ user_agent_header="user-agent",
112
+ accept_header_value="application/json",
113
+ http_headers=http_headers,
114
+ security=self.sdk_configuration.security,
115
+ get_serialized_body=lambda: utils.serialize_request_body(
116
+ request.create_suggestion,
117
+ False,
118
+ True,
119
+ "json",
120
+ Optional[models.CreateSuggestion],
121
+ ),
122
+ timeout_ms=timeout_ms,
123
+ )
124
+
125
+ if retries == UNSET:
126
+ if self.sdk_configuration.retry_config is not UNSET:
127
+ retries = self.sdk_configuration.retry_config
128
+
129
+ retry_config = None
130
+ if isinstance(retries, utils.RetryConfig):
131
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
132
+
133
+ http_res = self.do_request(
134
+ hook_ctx=HookContext(
135
+ config=self.sdk_configuration,
136
+ base_url=base_url or "",
137
+ operation_id="makeSuggestion",
138
+ oauth2_scopes=[],
139
+ security_source=get_security_from_env(
140
+ self.sdk_configuration.security, models.Security
141
+ ),
142
+ ),
143
+ request=req,
144
+ error_status_codes=[
145
+ "400",
146
+ "401",
147
+ "403",
148
+ "404",
149
+ "406",
150
+ "415",
151
+ "4XX",
152
+ "500",
153
+ "5XX",
154
+ ],
155
+ retry_config=retry_config,
156
+ )
157
+
158
+ response_data: Any = None
159
+ if utils.match_response(http_res, "201", "*"):
160
+ return
161
+ if utils.match_response(
162
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
163
+ ):
164
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
165
+ raise errors.WSErrorCommon(response_data, http_res)
166
+ if utils.match_response(http_res, "500", "application/json"):
167
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
168
+ raise errors.WSErrorCommon(response_data, http_res)
169
+ if utils.match_response(http_res, ["415", "4XX"], "*"):
170
+ http_res_text = utils.stream_to_text(http_res)
171
+ raise errors.EgainDefaultError(
172
+ "API error occurred", http_res, http_res_text
173
+ )
174
+ if utils.match_response(http_res, "5XX", "*"):
175
+ http_res_text = utils.stream_to_text(http_res)
176
+ raise errors.EgainDefaultError(
177
+ "API error occurred", http_res, http_res_text
178
+ )
179
+
180
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
181
+
182
+ async def make_suggestion_async(
183
+ self,
184
+ *,
185
+ accept_language: models.AcceptLanguage,
186
+ portal_id: str,
187
+ name: str,
188
+ content: str,
189
+ language: Union[
190
+ models.CreateSuggestionLanguage, models.CreateSuggestionLanguageTypedDict
191
+ ],
192
+ description: Optional[str] = None,
193
+ feedback_article: Optional[
194
+ Union[
195
+ models.RelatedArticleForCreateUpdateDeleteSuggestion,
196
+ models.RelatedArticleForCreateUpdateDeleteSuggestionTypedDict,
197
+ ]
198
+ ] = None,
199
+ attachments: Optional[
200
+ Union[
201
+ models.CreateSuggestionAttachments,
202
+ models.CreateSuggestionAttachmentsTypedDict,
203
+ ]
204
+ ] = None,
205
+ custom_attributes: Optional[
206
+ Union[List[models.CustomAttribute], List[models.CustomAttributeTypedDict]]
207
+ ] = None,
208
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
209
+ server_url: Optional[str] = None,
210
+ timeout_ms: Optional[int] = None,
211
+ http_headers: Optional[Mapping[str, str]] = None,
212
+ ):
213
+ r"""Make a Suggestion
214
+
215
+ ## Overview
216
+ The Make a Suggestion API allows users to create an Article Suggestion from within a knowledge portal.
217
+
218
+ ## Prerequisites
219
+ * Enable the setting \"Manage a Suggestion\" for the portal specified in the URL.
220
+ * If the user is a Customer, enable the setting \"Allow Customer Access\" for the portal.
221
+ * If you want to add an attachment to a Suggestion, first call the Generate Signed URL to Upload API to add an attachment using the provided returned altID in attachment request.
222
+
223
+
224
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
225
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
226
+ :param name: The name of the Suggestion.
227
+ :param content: The content of the Suggestion.
228
+ :param language: The knowledge base language in which the Suggestion is created.
229
+ :param description: The description of the Suggestion.
230
+ :param feedback_article: The Article that the Suggestion was created for.
231
+ :param attachments: Details of Attachments for the Suggestion.
232
+ :param custom_attributes: The Custom Attributes of the Suggestion.
233
+ :param retries: Override the default retry configuration for this method
234
+ :param server_url: Override the default server URL for this method
235
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
236
+ :param http_headers: Additional headers to set or replace on requests.
237
+ """
238
+ base_url = None
239
+ url_variables = None
240
+ if timeout_ms is None:
241
+ timeout_ms = self.sdk_configuration.timeout_ms
242
+
243
+ if server_url is not None:
244
+ base_url = server_url
245
+ else:
246
+ base_url = self._get_url(base_url, url_variables)
247
+
248
+ request = models.MakeSuggestionRequest(
249
+ accept_language=accept_language,
250
+ portal_id=portal_id,
251
+ create_suggestion=models.CreateSuggestion(
252
+ name=name,
253
+ description=description,
254
+ content=content,
255
+ feedback_article=utils.get_pydantic_model(
256
+ feedback_article,
257
+ Optional[models.RelatedArticleForCreateUpdateDeleteSuggestion],
258
+ ),
259
+ attachments=utils.get_pydantic_model(
260
+ attachments, Optional[models.CreateSuggestionAttachments]
261
+ ),
262
+ language=utils.get_pydantic_model(
263
+ language, models.CreateSuggestionLanguage
264
+ ),
265
+ custom_attributes=utils.get_pydantic_model(
266
+ custom_attributes, Optional[List[models.CustomAttribute]]
267
+ ),
268
+ ),
269
+ )
270
+
271
+ req = self._build_request_async(
272
+ method="POST",
273
+ path="/portals/{portalID}/suggestions",
274
+ base_url=base_url,
275
+ url_variables=url_variables,
276
+ request=request,
277
+ request_body_required=False,
278
+ request_has_path_params=True,
279
+ request_has_query_params=True,
280
+ user_agent_header="user-agent",
281
+ accept_header_value="application/json",
282
+ http_headers=http_headers,
283
+ security=self.sdk_configuration.security,
284
+ get_serialized_body=lambda: utils.serialize_request_body(
285
+ request.create_suggestion,
286
+ False,
287
+ True,
288
+ "json",
289
+ Optional[models.CreateSuggestion],
290
+ ),
291
+ timeout_ms=timeout_ms,
292
+ )
293
+
294
+ if retries == UNSET:
295
+ if self.sdk_configuration.retry_config is not UNSET:
296
+ retries = self.sdk_configuration.retry_config
297
+
298
+ retry_config = None
299
+ if isinstance(retries, utils.RetryConfig):
300
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
301
+
302
+ http_res = await self.do_request_async(
303
+ hook_ctx=HookContext(
304
+ config=self.sdk_configuration,
305
+ base_url=base_url or "",
306
+ operation_id="makeSuggestion",
307
+ oauth2_scopes=[],
308
+ security_source=get_security_from_env(
309
+ self.sdk_configuration.security, models.Security
310
+ ),
311
+ ),
312
+ request=req,
313
+ error_status_codes=[
314
+ "400",
315
+ "401",
316
+ "403",
317
+ "404",
318
+ "406",
319
+ "415",
320
+ "4XX",
321
+ "500",
322
+ "5XX",
323
+ ],
324
+ retry_config=retry_config,
325
+ )
326
+
327
+ response_data: Any = None
328
+ if utils.match_response(http_res, "201", "*"):
329
+ return
330
+ if utils.match_response(
331
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
332
+ ):
333
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
334
+ raise errors.WSErrorCommon(response_data, http_res)
335
+ if utils.match_response(http_res, "500", "application/json"):
336
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
337
+ raise errors.WSErrorCommon(response_data, http_res)
338
+ if utils.match_response(http_res, ["415", "4XX"], "*"):
339
+ http_res_text = await utils.stream_to_text_async(http_res)
340
+ raise errors.EgainDefaultError(
341
+ "API error occurred", http_res, http_res_text
342
+ )
343
+ if utils.match_response(http_res, "5XX", "*"):
344
+ http_res_text = await utils.stream_to_text_async(http_res)
345
+ raise errors.EgainDefaultError(
346
+ "API error occurred", http_res, http_res_text
347
+ )
348
+
349
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
350
+
351
+ def modify_suggestions(
352
+ self,
353
+ *,
354
+ accept_language: models.AcceptLanguage,
355
+ portal_id: str,
356
+ id: str,
357
+ modified_date: str,
358
+ name: Optional[str] = None,
359
+ description: Optional[str] = None,
360
+ content: Optional[str] = None,
361
+ attachments: Optional[
362
+ Union[
363
+ models.ModifySuggestionAttachments,
364
+ models.ModifySuggestionAttachmentsTypedDict,
365
+ ]
366
+ ] = None,
367
+ custom_attributes: Optional[
368
+ Union[List[models.CustomAttribute], List[models.CustomAttributeTypedDict]]
369
+ ] = None,
370
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
371
+ server_url: Optional[str] = None,
372
+ timeout_ms: Optional[int] = None,
373
+ http_headers: Optional[Mapping[str, str]] = None,
374
+ ):
375
+ r"""Modify Suggestion
376
+
377
+ ## Overview
378
+ The Modify Suggestion API allows authenticated users to modify their own Suggestion.
379
+
380
+ ## Prerequisites
381
+ * Enable the setting \"Manage a Suggestion\" for the portal specified in the URL.
382
+ * If the user is a Customer, enable the setting \"Allow Customer Access\" for the portal.
383
+ * The \"Suggestion ID\" specified in the request body must exist and belong to the user.
384
+ * The status of this Suggestion as returned by the Get Suggestion by ID API must be \"pending\".
385
+ * At least one of the optional request body attributes must be provided.
386
+
387
+
388
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
389
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
390
+ :param id: The ID of the Suggestion. A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
391
+ :param modified_date: The date on which the Suggestion was last modified.
392
+ :param name: The name of the Suggestion.
393
+ :param description: The description of the Suggestion.
394
+ :param content: The content of the Suggestion.
395
+ :param attachments: Details of Attachments for the Suggestion.
396
+ :param custom_attributes: Custom Attributes of the Suggestion.
397
+ :param retries: Override the default retry configuration for this method
398
+ :param server_url: Override the default server URL for this method
399
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
400
+ :param http_headers: Additional headers to set or replace on requests.
401
+ """
402
+ base_url = None
403
+ url_variables = None
404
+ if timeout_ms is None:
405
+ timeout_ms = self.sdk_configuration.timeout_ms
406
+
407
+ if server_url is not None:
408
+ base_url = server_url
409
+ else:
410
+ base_url = self._get_url(base_url, url_variables)
411
+
412
+ request = models.ModifySuggestionsRequest(
413
+ accept_language=accept_language,
414
+ portal_id=portal_id,
415
+ modify_suggestion=models.ModifySuggestion(
416
+ id=id,
417
+ name=name,
418
+ description=description,
419
+ content=content,
420
+ modified_date=modified_date,
421
+ attachments=utils.get_pydantic_model(
422
+ attachments, Optional[models.ModifySuggestionAttachments]
423
+ ),
424
+ custom_attributes=utils.get_pydantic_model(
425
+ custom_attributes, Optional[List[models.CustomAttribute]]
426
+ ),
427
+ ),
428
+ )
429
+
430
+ req = self._build_request(
431
+ method="PUT",
432
+ path="/portals/{portalID}/suggestions",
433
+ base_url=base_url,
434
+ url_variables=url_variables,
435
+ request=request,
436
+ request_body_required=False,
437
+ request_has_path_params=True,
438
+ request_has_query_params=True,
439
+ user_agent_header="user-agent",
440
+ accept_header_value="application/json",
441
+ http_headers=http_headers,
442
+ security=self.sdk_configuration.security,
443
+ get_serialized_body=lambda: utils.serialize_request_body(
444
+ request.modify_suggestion,
445
+ False,
446
+ True,
447
+ "json",
448
+ Optional[models.ModifySuggestion],
449
+ ),
450
+ timeout_ms=timeout_ms,
451
+ )
452
+
453
+ if retries == UNSET:
454
+ if self.sdk_configuration.retry_config is not UNSET:
455
+ retries = self.sdk_configuration.retry_config
456
+
457
+ retry_config = None
458
+ if isinstance(retries, utils.RetryConfig):
459
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
460
+
461
+ http_res = self.do_request(
462
+ hook_ctx=HookContext(
463
+ config=self.sdk_configuration,
464
+ base_url=base_url or "",
465
+ operation_id="modifySuggestions",
466
+ oauth2_scopes=[],
467
+ security_source=get_security_from_env(
468
+ self.sdk_configuration.security, models.Security
469
+ ),
470
+ ),
471
+ request=req,
472
+ error_status_codes=[
473
+ "400",
474
+ "401",
475
+ "403",
476
+ "404",
477
+ "406",
478
+ "415",
479
+ "4XX",
480
+ "500",
481
+ "5XX",
482
+ ],
483
+ retry_config=retry_config,
484
+ )
485
+
486
+ response_data: Any = None
487
+ if utils.match_response(http_res, "204", "*"):
488
+ return
489
+ if utils.match_response(
490
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
491
+ ):
492
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
493
+ raise errors.WSErrorCommon(response_data, http_res)
494
+ if utils.match_response(http_res, "500", "application/json"):
495
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
496
+ raise errors.WSErrorCommon(response_data, http_res)
497
+ if utils.match_response(http_res, ["415", "4XX"], "*"):
498
+ http_res_text = utils.stream_to_text(http_res)
499
+ raise errors.EgainDefaultError(
500
+ "API error occurred", http_res, http_res_text
501
+ )
502
+ if utils.match_response(http_res, "5XX", "*"):
503
+ http_res_text = utils.stream_to_text(http_res)
504
+ raise errors.EgainDefaultError(
505
+ "API error occurred", http_res, http_res_text
506
+ )
507
+
508
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
509
+
510
+ async def modify_suggestions_async(
511
+ self,
512
+ *,
513
+ accept_language: models.AcceptLanguage,
514
+ portal_id: str,
515
+ id: str,
516
+ modified_date: str,
517
+ name: Optional[str] = None,
518
+ description: Optional[str] = None,
519
+ content: Optional[str] = None,
520
+ attachments: Optional[
521
+ Union[
522
+ models.ModifySuggestionAttachments,
523
+ models.ModifySuggestionAttachmentsTypedDict,
524
+ ]
525
+ ] = None,
526
+ custom_attributes: Optional[
527
+ Union[List[models.CustomAttribute], List[models.CustomAttributeTypedDict]]
528
+ ] = None,
529
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
530
+ server_url: Optional[str] = None,
531
+ timeout_ms: Optional[int] = None,
532
+ http_headers: Optional[Mapping[str, str]] = None,
533
+ ):
534
+ r"""Modify Suggestion
535
+
536
+ ## Overview
537
+ The Modify Suggestion API allows authenticated users to modify their own Suggestion.
538
+
539
+ ## Prerequisites
540
+ * Enable the setting \"Manage a Suggestion\" for the portal specified in the URL.
541
+ * If the user is a Customer, enable the setting \"Allow Customer Access\" for the portal.
542
+ * The \"Suggestion ID\" specified in the request body must exist and belong to the user.
543
+ * The status of this Suggestion as returned by the Get Suggestion by ID API must be \"pending\".
544
+ * At least one of the optional request body attributes must be provided.
545
+
546
+
547
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
548
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
549
+ :param id: The ID of the Suggestion. A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
550
+ :param modified_date: The date on which the Suggestion was last modified.
551
+ :param name: The name of the Suggestion.
552
+ :param description: The description of the Suggestion.
553
+ :param content: The content of the Suggestion.
554
+ :param attachments: Details of Attachments for the Suggestion.
555
+ :param custom_attributes: Custom Attributes of the Suggestion.
556
+ :param retries: Override the default retry configuration for this method
557
+ :param server_url: Override the default server URL for this method
558
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
559
+ :param http_headers: Additional headers to set or replace on requests.
560
+ """
561
+ base_url = None
562
+ url_variables = None
563
+ if timeout_ms is None:
564
+ timeout_ms = self.sdk_configuration.timeout_ms
565
+
566
+ if server_url is not None:
567
+ base_url = server_url
568
+ else:
569
+ base_url = self._get_url(base_url, url_variables)
570
+
571
+ request = models.ModifySuggestionsRequest(
572
+ accept_language=accept_language,
573
+ portal_id=portal_id,
574
+ modify_suggestion=models.ModifySuggestion(
575
+ id=id,
576
+ name=name,
577
+ description=description,
578
+ content=content,
579
+ modified_date=modified_date,
580
+ attachments=utils.get_pydantic_model(
581
+ attachments, Optional[models.ModifySuggestionAttachments]
582
+ ),
583
+ custom_attributes=utils.get_pydantic_model(
584
+ custom_attributes, Optional[List[models.CustomAttribute]]
585
+ ),
586
+ ),
587
+ )
588
+
589
+ req = self._build_request_async(
590
+ method="PUT",
591
+ path="/portals/{portalID}/suggestions",
592
+ base_url=base_url,
593
+ url_variables=url_variables,
594
+ request=request,
595
+ request_body_required=False,
596
+ request_has_path_params=True,
597
+ request_has_query_params=True,
598
+ user_agent_header="user-agent",
599
+ accept_header_value="application/json",
600
+ http_headers=http_headers,
601
+ security=self.sdk_configuration.security,
602
+ get_serialized_body=lambda: utils.serialize_request_body(
603
+ request.modify_suggestion,
604
+ False,
605
+ True,
606
+ "json",
607
+ Optional[models.ModifySuggestion],
608
+ ),
609
+ timeout_ms=timeout_ms,
610
+ )
611
+
612
+ if retries == UNSET:
613
+ if self.sdk_configuration.retry_config is not UNSET:
614
+ retries = self.sdk_configuration.retry_config
615
+
616
+ retry_config = None
617
+ if isinstance(retries, utils.RetryConfig):
618
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
619
+
620
+ http_res = await self.do_request_async(
621
+ hook_ctx=HookContext(
622
+ config=self.sdk_configuration,
623
+ base_url=base_url or "",
624
+ operation_id="modifySuggestions",
625
+ oauth2_scopes=[],
626
+ security_source=get_security_from_env(
627
+ self.sdk_configuration.security, models.Security
628
+ ),
629
+ ),
630
+ request=req,
631
+ error_status_codes=[
632
+ "400",
633
+ "401",
634
+ "403",
635
+ "404",
636
+ "406",
637
+ "415",
638
+ "4XX",
639
+ "500",
640
+ "5XX",
641
+ ],
642
+ retry_config=retry_config,
643
+ )
644
+
645
+ response_data: Any = None
646
+ if utils.match_response(http_res, "204", "*"):
647
+ return
648
+ if utils.match_response(
649
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
650
+ ):
651
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
652
+ raise errors.WSErrorCommon(response_data, http_res)
653
+ if utils.match_response(http_res, "500", "application/json"):
654
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
655
+ raise errors.WSErrorCommon(response_data, http_res)
656
+ if utils.match_response(http_res, ["415", "4XX"], "*"):
657
+ http_res_text = await utils.stream_to_text_async(http_res)
658
+ raise errors.EgainDefaultError(
659
+ "API error occurred", http_res, http_res_text
660
+ )
661
+ if utils.match_response(http_res, "5XX", "*"):
662
+ http_res_text = await utils.stream_to_text_async(http_res)
663
+ raise errors.EgainDefaultError(
664
+ "API error occurred", http_res, http_res_text
665
+ )
666
+
667
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
668
+
669
+ def search_suggestion(
670
+ self,
671
+ *,
672
+ accept_language: models.AcceptLanguage,
673
+ portal_id: str,
674
+ filter_status: models.FilterStatus,
675
+ sort: Optional[models.SortIDName] = None,
676
+ order: Optional[models.Order] = None,
677
+ pagenum: Optional[int] = 1,
678
+ pagesize: Optional[int] = 25,
679
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
680
+ server_url: Optional[str] = None,
681
+ timeout_ms: Optional[int] = None,
682
+ http_headers: Optional[Mapping[str, str]] = None,
683
+ ) -> Optional[models.Suggestions]:
684
+ r"""Get Suggestion by Status
685
+
686
+ ## Overview
687
+ The Get Suggestion by Status API allows authenticated users to retrieve their own suggestions based on Suggestion status.
688
+
689
+ ## Prerequisites
690
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL.
691
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
692
+
693
+
694
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
695
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
696
+ :param filter_status: The search filter applied to the list of suggestions by a user.
697
+ :param sort: Objects returned in server response are sorted based on the attribute supplied under $sort.
698
+ :param order: Common query parameter $order.
699
+ :param pagenum: Pagination parameter that specifies the page number of results to be returned. Used in conjunction with $pagesize.
700
+ :param pagesize: Pagination parameter that specifies the number of results per page. Used in conjunction with $pagenum.<br>Valid range of 5-75<br>_Default value_: 25
701
+ :param retries: Override the default retry configuration for this method
702
+ :param server_url: Override the default server URL for this method
703
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
704
+ :param http_headers: Additional headers to set or replace on requests.
705
+ """
706
+ base_url = None
707
+ url_variables = None
708
+ if timeout_ms is None:
709
+ timeout_ms = self.sdk_configuration.timeout_ms
710
+
711
+ if server_url is not None:
712
+ base_url = server_url
713
+ else:
714
+ base_url = self._get_url(base_url, url_variables)
715
+
716
+ request = models.SearchSuggestionRequest(
717
+ accept_language=accept_language,
718
+ portal_id=portal_id,
719
+ filter_status=filter_status,
720
+ sort=sort,
721
+ order=order,
722
+ pagenum=pagenum,
723
+ pagesize=pagesize,
724
+ )
725
+
726
+ req = self._build_request(
727
+ method="GET",
728
+ path="/portals/{portalID}/suggestions",
729
+ base_url=base_url,
730
+ url_variables=url_variables,
731
+ request=request,
732
+ request_body_required=False,
733
+ request_has_path_params=True,
734
+ request_has_query_params=True,
735
+ user_agent_header="user-agent",
736
+ accept_header_value="application/json",
737
+ http_headers=http_headers,
738
+ security=self.sdk_configuration.security,
739
+ timeout_ms=timeout_ms,
740
+ )
741
+
742
+ if retries == UNSET:
743
+ if self.sdk_configuration.retry_config is not UNSET:
744
+ retries = self.sdk_configuration.retry_config
745
+
746
+ retry_config = None
747
+ if isinstance(retries, utils.RetryConfig):
748
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
749
+
750
+ http_res = self.do_request(
751
+ hook_ctx=HookContext(
752
+ config=self.sdk_configuration,
753
+ base_url=base_url or "",
754
+ operation_id="searchSuggestion",
755
+ oauth2_scopes=[],
756
+ security_source=get_security_from_env(
757
+ self.sdk_configuration.security, models.Security
758
+ ),
759
+ ),
760
+ request=req,
761
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
762
+ retry_config=retry_config,
763
+ )
764
+
765
+ response_data: Any = None
766
+ if utils.match_response(http_res, "200", "application/json"):
767
+ return unmarshal_json_response(models.Suggestions, http_res)
768
+ if utils.match_response(http_res, "204", "*"):
769
+ return None
770
+ if utils.match_response(
771
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
772
+ ):
773
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
774
+ raise errors.WSErrorCommon(response_data, http_res)
775
+ if utils.match_response(http_res, "500", "application/json"):
776
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
777
+ raise errors.WSErrorCommon(response_data, http_res)
778
+ if utils.match_response(http_res, "4XX", "*"):
779
+ http_res_text = utils.stream_to_text(http_res)
780
+ raise errors.EgainDefaultError(
781
+ "API error occurred", http_res, http_res_text
782
+ )
783
+ if utils.match_response(http_res, "5XX", "*"):
784
+ http_res_text = utils.stream_to_text(http_res)
785
+ raise errors.EgainDefaultError(
786
+ "API error occurred", http_res, http_res_text
787
+ )
788
+
789
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
790
+
791
+ async def search_suggestion_async(
792
+ self,
793
+ *,
794
+ accept_language: models.AcceptLanguage,
795
+ portal_id: str,
796
+ filter_status: models.FilterStatus,
797
+ sort: Optional[models.SortIDName] = None,
798
+ order: Optional[models.Order] = None,
799
+ pagenum: Optional[int] = 1,
800
+ pagesize: Optional[int] = 25,
801
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
802
+ server_url: Optional[str] = None,
803
+ timeout_ms: Optional[int] = None,
804
+ http_headers: Optional[Mapping[str, str]] = None,
805
+ ) -> Optional[models.Suggestions]:
806
+ r"""Get Suggestion by Status
807
+
808
+ ## Overview
809
+ The Get Suggestion by Status API allows authenticated users to retrieve their own suggestions based on Suggestion status.
810
+
811
+ ## Prerequisites
812
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL.
813
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
814
+
815
+
816
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
817
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
818
+ :param filter_status: The search filter applied to the list of suggestions by a user.
819
+ :param sort: Objects returned in server response are sorted based on the attribute supplied under $sort.
820
+ :param order: Common query parameter $order.
821
+ :param pagenum: Pagination parameter that specifies the page number of results to be returned. Used in conjunction with $pagesize.
822
+ :param pagesize: Pagination parameter that specifies the number of results per page. Used in conjunction with $pagenum.<br>Valid range of 5-75<br>_Default value_: 25
823
+ :param retries: Override the default retry configuration for this method
824
+ :param server_url: Override the default server URL for this method
825
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
826
+ :param http_headers: Additional headers to set or replace on requests.
827
+ """
828
+ base_url = None
829
+ url_variables = None
830
+ if timeout_ms is None:
831
+ timeout_ms = self.sdk_configuration.timeout_ms
832
+
833
+ if server_url is not None:
834
+ base_url = server_url
835
+ else:
836
+ base_url = self._get_url(base_url, url_variables)
837
+
838
+ request = models.SearchSuggestionRequest(
839
+ accept_language=accept_language,
840
+ portal_id=portal_id,
841
+ filter_status=filter_status,
842
+ sort=sort,
843
+ order=order,
844
+ pagenum=pagenum,
845
+ pagesize=pagesize,
846
+ )
847
+
848
+ req = self._build_request_async(
849
+ method="GET",
850
+ path="/portals/{portalID}/suggestions",
851
+ base_url=base_url,
852
+ url_variables=url_variables,
853
+ request=request,
854
+ request_body_required=False,
855
+ request_has_path_params=True,
856
+ request_has_query_params=True,
857
+ user_agent_header="user-agent",
858
+ accept_header_value="application/json",
859
+ http_headers=http_headers,
860
+ security=self.sdk_configuration.security,
861
+ timeout_ms=timeout_ms,
862
+ )
863
+
864
+ if retries == UNSET:
865
+ if self.sdk_configuration.retry_config is not UNSET:
866
+ retries = self.sdk_configuration.retry_config
867
+
868
+ retry_config = None
869
+ if isinstance(retries, utils.RetryConfig):
870
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
871
+
872
+ http_res = await self.do_request_async(
873
+ hook_ctx=HookContext(
874
+ config=self.sdk_configuration,
875
+ base_url=base_url or "",
876
+ operation_id="searchSuggestion",
877
+ oauth2_scopes=[],
878
+ security_source=get_security_from_env(
879
+ self.sdk_configuration.security, models.Security
880
+ ),
881
+ ),
882
+ request=req,
883
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
884
+ retry_config=retry_config,
885
+ )
886
+
887
+ response_data: Any = None
888
+ if utils.match_response(http_res, "200", "application/json"):
889
+ return unmarshal_json_response(models.Suggestions, http_res)
890
+ if utils.match_response(http_res, "204", "*"):
891
+ return None
892
+ if utils.match_response(
893
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
894
+ ):
895
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
896
+ raise errors.WSErrorCommon(response_data, http_res)
897
+ if utils.match_response(http_res, "500", "application/json"):
898
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
899
+ raise errors.WSErrorCommon(response_data, http_res)
900
+ if utils.match_response(http_res, "4XX", "*"):
901
+ http_res_text = await utils.stream_to_text_async(http_res)
902
+ raise errors.EgainDefaultError(
903
+ "API error occurred", http_res, http_res_text
904
+ )
905
+ if utils.match_response(http_res, "5XX", "*"):
906
+ http_res_text = await utils.stream_to_text_async(http_res)
907
+ raise errors.EgainDefaultError(
908
+ "API error occurred", http_res, http_res_text
909
+ )
910
+
911
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
912
+
913
+ def get_suggestion(
914
+ self,
915
+ *,
916
+ accept_language: models.AcceptLanguage,
917
+ portal_id: str,
918
+ suggestion_id: str,
919
+ suggestion_additional_attributes: Optional[
920
+ List[models.SuggestionAdditionalAttributes]
921
+ ] = None,
922
+ custom_additional_attributes: Optional[str] = None,
923
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
924
+ server_url: Optional[str] = None,
925
+ timeout_ms: Optional[int] = None,
926
+ http_headers: Optional[Mapping[str, str]] = None,
927
+ ) -> Optional[models.Suggestion]:
928
+ r"""Get Suggestion by ID
929
+
930
+ ## Overview
931
+ The Get Suggestion by ID API allows authenticated users to retrieve their own suggestions.
932
+
933
+ ## Prerequisites
934
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL.
935
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
936
+ * The \"Suggestion for the ID\" specified in the URL must belong to the user.
937
+
938
+
939
+
940
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
941
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
942
+ :param suggestion_id: The ID of the Suggestion.<br><br>A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
943
+ :param suggestion_additional_attributes: The attributes of a Suggestion to be returned *in addition to* the default list of attributes, listed below. Multiple additional attributes can be specified using a comma-separated list. Passing 'all' returns all attributes. #### Default Attributes These Suggestion attributes are always returned: | Name | Description | ---- | ----------- | id | The ID of the Suggestion. | name | The name of the Suggestion. | status | The status of the Suggestion. | description | The description of the Suggestion. | language | Details about the language of the Suggestion. | modifiedBy.id | The ID of the user that last modified the Suggestion. | modifiedBy.firstName | The Suggestion's last modified user's first name. | modifiedBy.middleName | The Suggestion's last modified user's middle name. | modifiedBy.lastName | The Suggestion's last modified user's last name. | modifiedDate | The Suggestion's last modified date <u>and</u> information about the user that last modified the Suggestion. | link | The link object, used to retrieve the details of the Suggestion. | hasComments | The Suggestion has one or more comments | hasAttachments | The Suggestion has one or more attachments | hasRelatedArticles | The Suggestion has related articles
944
+ :param custom_additional_attributes:
945
+ :param retries: Override the default retry configuration for this method
946
+ :param server_url: Override the default server URL for this method
947
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
948
+ :param http_headers: Additional headers to set or replace on requests.
949
+ """
950
+ base_url = None
951
+ url_variables = None
952
+ if timeout_ms is None:
953
+ timeout_ms = self.sdk_configuration.timeout_ms
954
+
955
+ if server_url is not None:
956
+ base_url = server_url
957
+ else:
958
+ base_url = self._get_url(base_url, url_variables)
959
+
960
+ request = models.GetSuggestionRequest(
961
+ accept_language=accept_language,
962
+ portal_id=portal_id,
963
+ suggestion_id=suggestion_id,
964
+ suggestion_additional_attributes=suggestion_additional_attributes,
965
+ custom_additional_attributes=custom_additional_attributes,
966
+ )
967
+
968
+ req = self._build_request(
969
+ method="GET",
970
+ path="/portals/{portalID}/suggestions/{suggestionID}",
971
+ base_url=base_url,
972
+ url_variables=url_variables,
973
+ request=request,
974
+ request_body_required=False,
975
+ request_has_path_params=True,
976
+ request_has_query_params=True,
977
+ user_agent_header="user-agent",
978
+ accept_header_value="application/json",
979
+ http_headers=http_headers,
980
+ security=self.sdk_configuration.security,
981
+ timeout_ms=timeout_ms,
982
+ )
983
+
984
+ if retries == UNSET:
985
+ if self.sdk_configuration.retry_config is not UNSET:
986
+ retries = self.sdk_configuration.retry_config
987
+
988
+ retry_config = None
989
+ if isinstance(retries, utils.RetryConfig):
990
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
991
+
992
+ http_res = self.do_request(
993
+ hook_ctx=HookContext(
994
+ config=self.sdk_configuration,
995
+ base_url=base_url or "",
996
+ operation_id="getSuggestion",
997
+ oauth2_scopes=[],
998
+ security_source=get_security_from_env(
999
+ self.sdk_configuration.security, models.Security
1000
+ ),
1001
+ ),
1002
+ request=req,
1003
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
1004
+ retry_config=retry_config,
1005
+ )
1006
+
1007
+ response_data: Any = None
1008
+ if utils.match_response(http_res, "200", "application/json"):
1009
+ return unmarshal_json_response(models.Suggestion, http_res)
1010
+ if utils.match_response(http_res, "204", "*"):
1011
+ return None
1012
+ if utils.match_response(
1013
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
1014
+ ):
1015
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1016
+ raise errors.WSErrorCommon(response_data, http_res)
1017
+ if utils.match_response(http_res, "500", "application/json"):
1018
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1019
+ raise errors.WSErrorCommon(response_data, http_res)
1020
+ if utils.match_response(http_res, "4XX", "*"):
1021
+ http_res_text = utils.stream_to_text(http_res)
1022
+ raise errors.EgainDefaultError(
1023
+ "API error occurred", http_res, http_res_text
1024
+ )
1025
+ if utils.match_response(http_res, "5XX", "*"):
1026
+ http_res_text = utils.stream_to_text(http_res)
1027
+ raise errors.EgainDefaultError(
1028
+ "API error occurred", http_res, http_res_text
1029
+ )
1030
+
1031
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
1032
+
1033
+ async def get_suggestion_async(
1034
+ self,
1035
+ *,
1036
+ accept_language: models.AcceptLanguage,
1037
+ portal_id: str,
1038
+ suggestion_id: str,
1039
+ suggestion_additional_attributes: Optional[
1040
+ List[models.SuggestionAdditionalAttributes]
1041
+ ] = None,
1042
+ custom_additional_attributes: Optional[str] = None,
1043
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1044
+ server_url: Optional[str] = None,
1045
+ timeout_ms: Optional[int] = None,
1046
+ http_headers: Optional[Mapping[str, str]] = None,
1047
+ ) -> Optional[models.Suggestion]:
1048
+ r"""Get Suggestion by ID
1049
+
1050
+ ## Overview
1051
+ The Get Suggestion by ID API allows authenticated users to retrieve their own suggestions.
1052
+
1053
+ ## Prerequisites
1054
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL.
1055
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
1056
+ * The \"Suggestion for the ID\" specified in the URL must belong to the user.
1057
+
1058
+
1059
+
1060
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
1061
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1062
+ :param suggestion_id: The ID of the Suggestion.<br><br>A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1063
+ :param suggestion_additional_attributes: The attributes of a Suggestion to be returned *in addition to* the default list of attributes, listed below. Multiple additional attributes can be specified using a comma-separated list. Passing 'all' returns all attributes. #### Default Attributes These Suggestion attributes are always returned: | Name | Description | ---- | ----------- | id | The ID of the Suggestion. | name | The name of the Suggestion. | status | The status of the Suggestion. | description | The description of the Suggestion. | language | Details about the language of the Suggestion. | modifiedBy.id | The ID of the user that last modified the Suggestion. | modifiedBy.firstName | The Suggestion's last modified user's first name. | modifiedBy.middleName | The Suggestion's last modified user's middle name. | modifiedBy.lastName | The Suggestion's last modified user's last name. | modifiedDate | The Suggestion's last modified date <u>and</u> information about the user that last modified the Suggestion. | link | The link object, used to retrieve the details of the Suggestion. | hasComments | The Suggestion has one or more comments | hasAttachments | The Suggestion has one or more attachments | hasRelatedArticles | The Suggestion has related articles
1064
+ :param custom_additional_attributes:
1065
+ :param retries: Override the default retry configuration for this method
1066
+ :param server_url: Override the default server URL for this method
1067
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1068
+ :param http_headers: Additional headers to set or replace on requests.
1069
+ """
1070
+ base_url = None
1071
+ url_variables = None
1072
+ if timeout_ms is None:
1073
+ timeout_ms = self.sdk_configuration.timeout_ms
1074
+
1075
+ if server_url is not None:
1076
+ base_url = server_url
1077
+ else:
1078
+ base_url = self._get_url(base_url, url_variables)
1079
+
1080
+ request = models.GetSuggestionRequest(
1081
+ accept_language=accept_language,
1082
+ portal_id=portal_id,
1083
+ suggestion_id=suggestion_id,
1084
+ suggestion_additional_attributes=suggestion_additional_attributes,
1085
+ custom_additional_attributes=custom_additional_attributes,
1086
+ )
1087
+
1088
+ req = self._build_request_async(
1089
+ method="GET",
1090
+ path="/portals/{portalID}/suggestions/{suggestionID}",
1091
+ base_url=base_url,
1092
+ url_variables=url_variables,
1093
+ request=request,
1094
+ request_body_required=False,
1095
+ request_has_path_params=True,
1096
+ request_has_query_params=True,
1097
+ user_agent_header="user-agent",
1098
+ accept_header_value="application/json",
1099
+ http_headers=http_headers,
1100
+ security=self.sdk_configuration.security,
1101
+ timeout_ms=timeout_ms,
1102
+ )
1103
+
1104
+ if retries == UNSET:
1105
+ if self.sdk_configuration.retry_config is not UNSET:
1106
+ retries = self.sdk_configuration.retry_config
1107
+
1108
+ retry_config = None
1109
+ if isinstance(retries, utils.RetryConfig):
1110
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1111
+
1112
+ http_res = await self.do_request_async(
1113
+ hook_ctx=HookContext(
1114
+ config=self.sdk_configuration,
1115
+ base_url=base_url or "",
1116
+ operation_id="getSuggestion",
1117
+ oauth2_scopes=[],
1118
+ security_source=get_security_from_env(
1119
+ self.sdk_configuration.security, models.Security
1120
+ ),
1121
+ ),
1122
+ request=req,
1123
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
1124
+ retry_config=retry_config,
1125
+ )
1126
+
1127
+ response_data: Any = None
1128
+ if utils.match_response(http_res, "200", "application/json"):
1129
+ return unmarshal_json_response(models.Suggestion, http_res)
1130
+ if utils.match_response(http_res, "204", "*"):
1131
+ return None
1132
+ if utils.match_response(
1133
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
1134
+ ):
1135
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1136
+ raise errors.WSErrorCommon(response_data, http_res)
1137
+ if utils.match_response(http_res, "500", "application/json"):
1138
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1139
+ raise errors.WSErrorCommon(response_data, http_res)
1140
+ if utils.match_response(http_res, "4XX", "*"):
1141
+ http_res_text = await utils.stream_to_text_async(http_res)
1142
+ raise errors.EgainDefaultError(
1143
+ "API error occurred", http_res, http_res_text
1144
+ )
1145
+ if utils.match_response(http_res, "5XX", "*"):
1146
+ http_res_text = await utils.stream_to_text_async(http_res)
1147
+ raise errors.EgainDefaultError(
1148
+ "API error occurred", http_res, http_res_text
1149
+ )
1150
+
1151
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
1152
+
1153
+ def delete_suggestion(
1154
+ self,
1155
+ *,
1156
+ accept_language: models.AcceptLanguage,
1157
+ portal_id: str,
1158
+ suggestion_id: str,
1159
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1160
+ server_url: Optional[str] = None,
1161
+ timeout_ms: Optional[int] = None,
1162
+ http_headers: Optional[Mapping[str, str]] = None,
1163
+ ):
1164
+ r"""Delete a Suggestion
1165
+
1166
+ ## Overview
1167
+ The Delete a Suggestion API allows authenticated users to delete their own Suggestion.
1168
+
1169
+ ## Prerequisites
1170
+ * Enable the setting \"Manage a Suggestion\" for the portal specified in the URL.
1171
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
1172
+ * The Suggestion must belong to the user.
1173
+ * The status of the Suggestion must not be \"approved\".
1174
+
1175
+
1176
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
1177
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1178
+ :param suggestion_id: The ID of the Suggestion.<br><br>A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1179
+ :param retries: Override the default retry configuration for this method
1180
+ :param server_url: Override the default server URL for this method
1181
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1182
+ :param http_headers: Additional headers to set or replace on requests.
1183
+ """
1184
+ base_url = None
1185
+ url_variables = None
1186
+ if timeout_ms is None:
1187
+ timeout_ms = self.sdk_configuration.timeout_ms
1188
+
1189
+ if server_url is not None:
1190
+ base_url = server_url
1191
+ else:
1192
+ base_url = self._get_url(base_url, url_variables)
1193
+
1194
+ request = models.DeleteSuggestionRequest(
1195
+ accept_language=accept_language,
1196
+ portal_id=portal_id,
1197
+ suggestion_id=suggestion_id,
1198
+ )
1199
+
1200
+ req = self._build_request(
1201
+ method="DELETE",
1202
+ path="/portals/{portalID}/suggestions/{suggestionID}",
1203
+ base_url=base_url,
1204
+ url_variables=url_variables,
1205
+ request=request,
1206
+ request_body_required=False,
1207
+ request_has_path_params=True,
1208
+ request_has_query_params=True,
1209
+ user_agent_header="user-agent",
1210
+ accept_header_value="application/json",
1211
+ http_headers=http_headers,
1212
+ security=self.sdk_configuration.security,
1213
+ timeout_ms=timeout_ms,
1214
+ )
1215
+
1216
+ if retries == UNSET:
1217
+ if self.sdk_configuration.retry_config is not UNSET:
1218
+ retries = self.sdk_configuration.retry_config
1219
+
1220
+ retry_config = None
1221
+ if isinstance(retries, utils.RetryConfig):
1222
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1223
+
1224
+ http_res = self.do_request(
1225
+ hook_ctx=HookContext(
1226
+ config=self.sdk_configuration,
1227
+ base_url=base_url or "",
1228
+ operation_id="deleteSuggestion",
1229
+ oauth2_scopes=[],
1230
+ security_source=get_security_from_env(
1231
+ self.sdk_configuration.security, models.Security
1232
+ ),
1233
+ ),
1234
+ request=req,
1235
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
1236
+ retry_config=retry_config,
1237
+ )
1238
+
1239
+ response_data: Any = None
1240
+ if utils.match_response(http_res, "204", "*"):
1241
+ return
1242
+ if utils.match_response(
1243
+ http_res, ["401", "403", "404", "406"], "application/json"
1244
+ ):
1245
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1246
+ raise errors.WSErrorCommon(response_data, http_res)
1247
+ if utils.match_response(http_res, "500", "application/json"):
1248
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1249
+ raise errors.WSErrorCommon(response_data, http_res)
1250
+ if utils.match_response(http_res, ["400", "4XX"], "*"):
1251
+ http_res_text = utils.stream_to_text(http_res)
1252
+ raise errors.EgainDefaultError(
1253
+ "API error occurred", http_res, http_res_text
1254
+ )
1255
+ if utils.match_response(http_res, "5XX", "*"):
1256
+ http_res_text = utils.stream_to_text(http_res)
1257
+ raise errors.EgainDefaultError(
1258
+ "API error occurred", http_res, http_res_text
1259
+ )
1260
+
1261
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
1262
+
1263
+ async def delete_suggestion_async(
1264
+ self,
1265
+ *,
1266
+ accept_language: models.AcceptLanguage,
1267
+ portal_id: str,
1268
+ suggestion_id: str,
1269
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1270
+ server_url: Optional[str] = None,
1271
+ timeout_ms: Optional[int] = None,
1272
+ http_headers: Optional[Mapping[str, str]] = None,
1273
+ ):
1274
+ r"""Delete a Suggestion
1275
+
1276
+ ## Overview
1277
+ The Delete a Suggestion API allows authenticated users to delete their own Suggestion.
1278
+
1279
+ ## Prerequisites
1280
+ * Enable the setting \"Manage a Suggestion\" for the portal specified in the URL.
1281
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
1282
+ * The Suggestion must belong to the user.
1283
+ * The status of the Suggestion must not be \"approved\".
1284
+
1285
+
1286
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
1287
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1288
+ :param suggestion_id: The ID of the Suggestion.<br><br>A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1289
+ :param retries: Override the default retry configuration for this method
1290
+ :param server_url: Override the default server URL for this method
1291
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1292
+ :param http_headers: Additional headers to set or replace on requests.
1293
+ """
1294
+ base_url = None
1295
+ url_variables = None
1296
+ if timeout_ms is None:
1297
+ timeout_ms = self.sdk_configuration.timeout_ms
1298
+
1299
+ if server_url is not None:
1300
+ base_url = server_url
1301
+ else:
1302
+ base_url = self._get_url(base_url, url_variables)
1303
+
1304
+ request = models.DeleteSuggestionRequest(
1305
+ accept_language=accept_language,
1306
+ portal_id=portal_id,
1307
+ suggestion_id=suggestion_id,
1308
+ )
1309
+
1310
+ req = self._build_request_async(
1311
+ method="DELETE",
1312
+ path="/portals/{portalID}/suggestions/{suggestionID}",
1313
+ base_url=base_url,
1314
+ url_variables=url_variables,
1315
+ request=request,
1316
+ request_body_required=False,
1317
+ request_has_path_params=True,
1318
+ request_has_query_params=True,
1319
+ user_agent_header="user-agent",
1320
+ accept_header_value="application/json",
1321
+ http_headers=http_headers,
1322
+ security=self.sdk_configuration.security,
1323
+ timeout_ms=timeout_ms,
1324
+ )
1325
+
1326
+ if retries == UNSET:
1327
+ if self.sdk_configuration.retry_config is not UNSET:
1328
+ retries = self.sdk_configuration.retry_config
1329
+
1330
+ retry_config = None
1331
+ if isinstance(retries, utils.RetryConfig):
1332
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1333
+
1334
+ http_res = await self.do_request_async(
1335
+ hook_ctx=HookContext(
1336
+ config=self.sdk_configuration,
1337
+ base_url=base_url or "",
1338
+ operation_id="deleteSuggestion",
1339
+ oauth2_scopes=[],
1340
+ security_source=get_security_from_env(
1341
+ self.sdk_configuration.security, models.Security
1342
+ ),
1343
+ ),
1344
+ request=req,
1345
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
1346
+ retry_config=retry_config,
1347
+ )
1348
+
1349
+ response_data: Any = None
1350
+ if utils.match_response(http_res, "204", "*"):
1351
+ return
1352
+ if utils.match_response(
1353
+ http_res, ["401", "403", "404", "406"], "application/json"
1354
+ ):
1355
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1356
+ raise errors.WSErrorCommon(response_data, http_res)
1357
+ if utils.match_response(http_res, "500", "application/json"):
1358
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1359
+ raise errors.WSErrorCommon(response_data, http_res)
1360
+ if utils.match_response(http_res, ["400", "4XX"], "*"):
1361
+ http_res_text = await utils.stream_to_text_async(http_res)
1362
+ raise errors.EgainDefaultError(
1363
+ "API error occurred", http_res, http_res_text
1364
+ )
1365
+ if utils.match_response(http_res, "5XX", "*"):
1366
+ http_res_text = await utils.stream_to_text_async(http_res)
1367
+ raise errors.EgainDefaultError(
1368
+ "API error occurred", http_res, http_res_text
1369
+ )
1370
+
1371
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
1372
+
1373
+ def get_related_articles_for_suggestion(
1374
+ self,
1375
+ *,
1376
+ accept_language: models.AcceptLanguage,
1377
+ portal_id: str,
1378
+ suggestion_id: str,
1379
+ article_result_additional_attributes: Optional[
1380
+ List[models.ArticleResultAdditionalAttributes]
1381
+ ] = None,
1382
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1383
+ server_url: Optional[str] = None,
1384
+ timeout_ms: Optional[int] = None,
1385
+ http_headers: Optional[Mapping[str, str]] = None,
1386
+ ) -> Optional[models.FeedbackArticleForSuggestion]:
1387
+ r"""Get Related Articles for Suggestion
1388
+
1389
+ ## Overview
1390
+ The Get Related Articles for Suggestion API allows authenticated users to retrieve related articles for a Suggestion.
1391
+
1392
+ ## Prerequisites
1393
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL.
1394
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
1395
+ * The Suggestion specified in the URL must belong to the user.
1396
+
1397
+
1398
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
1399
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1400
+ :param suggestion_id: The ID of the Suggestion.<br><br>A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1401
+ :param article_result_additional_attributes: The attributes of an Article to be returned *in addition to* the default list of attributes, listed below. Multiple additional attributes can be specified using a comma-separated list. Passing 'all' will return all attributes. #### Default Attributes These Article attributes are always returned: | Name | Description | ---- | ----------- | id | The ID of the Article. | name | The name of the Article. | articleType | The Article Type and its attributes. | createdBy | The ID, first name, middle name and last name of the user that created the Article. | createdDate | The date that the Article was created. | hasAttachments | True: The Article has one or more attachments.<br>False: The Article does not have any attachments. | languageCode | The language code of the Article language. | modifiedBy | The ID, first name, middle name and last name of the user that last modified the Article. | modifiedDate | The date that the Article was last modified on. | link | The link object, used to retrieve the details of the Article. | versionId | The ID of the Article version that is returned.
1402
+ :param retries: Override the default retry configuration for this method
1403
+ :param server_url: Override the default server URL for this method
1404
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1405
+ :param http_headers: Additional headers to set or replace on requests.
1406
+ """
1407
+ base_url = None
1408
+ url_variables = None
1409
+ if timeout_ms is None:
1410
+ timeout_ms = self.sdk_configuration.timeout_ms
1411
+
1412
+ if server_url is not None:
1413
+ base_url = server_url
1414
+ else:
1415
+ base_url = self._get_url(base_url, url_variables)
1416
+
1417
+ request = models.GetRelatedArticlesForSuggestionRequest(
1418
+ accept_language=accept_language,
1419
+ article_result_additional_attributes=article_result_additional_attributes,
1420
+ portal_id=portal_id,
1421
+ suggestion_id=suggestion_id,
1422
+ )
1423
+
1424
+ req = self._build_request(
1425
+ method="GET",
1426
+ path="/portals/{portalID}/suggestions/{suggestionID}/relatedArticles",
1427
+ base_url=base_url,
1428
+ url_variables=url_variables,
1429
+ request=request,
1430
+ request_body_required=False,
1431
+ request_has_path_params=True,
1432
+ request_has_query_params=True,
1433
+ user_agent_header="user-agent",
1434
+ accept_header_value="application/json",
1435
+ http_headers=http_headers,
1436
+ security=self.sdk_configuration.security,
1437
+ timeout_ms=timeout_ms,
1438
+ )
1439
+
1440
+ if retries == UNSET:
1441
+ if self.sdk_configuration.retry_config is not UNSET:
1442
+ retries = self.sdk_configuration.retry_config
1443
+
1444
+ retry_config = None
1445
+ if isinstance(retries, utils.RetryConfig):
1446
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1447
+
1448
+ http_res = self.do_request(
1449
+ hook_ctx=HookContext(
1450
+ config=self.sdk_configuration,
1451
+ base_url=base_url or "",
1452
+ operation_id="getRelatedArticlesForSuggestion",
1453
+ oauth2_scopes=[],
1454
+ security_source=get_security_from_env(
1455
+ self.sdk_configuration.security, models.Security
1456
+ ),
1457
+ ),
1458
+ request=req,
1459
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
1460
+ retry_config=retry_config,
1461
+ )
1462
+
1463
+ response_data: Any = None
1464
+ if utils.match_response(http_res, "200", "application/json"):
1465
+ return unmarshal_json_response(
1466
+ models.FeedbackArticleForSuggestion, http_res
1467
+ )
1468
+ if utils.match_response(http_res, "204", "*"):
1469
+ return None
1470
+ if utils.match_response(
1471
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
1472
+ ):
1473
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1474
+ raise errors.WSErrorCommon(response_data, http_res)
1475
+ if utils.match_response(http_res, "500", "application/json"):
1476
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1477
+ raise errors.WSErrorCommon(response_data, http_res)
1478
+ if utils.match_response(http_res, "4XX", "*"):
1479
+ http_res_text = utils.stream_to_text(http_res)
1480
+ raise errors.EgainDefaultError(
1481
+ "API error occurred", http_res, http_res_text
1482
+ )
1483
+ if utils.match_response(http_res, "5XX", "*"):
1484
+ http_res_text = utils.stream_to_text(http_res)
1485
+ raise errors.EgainDefaultError(
1486
+ "API error occurred", http_res, http_res_text
1487
+ )
1488
+
1489
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
1490
+
1491
+ async def get_related_articles_for_suggestion_async(
1492
+ self,
1493
+ *,
1494
+ accept_language: models.AcceptLanguage,
1495
+ portal_id: str,
1496
+ suggestion_id: str,
1497
+ article_result_additional_attributes: Optional[
1498
+ List[models.ArticleResultAdditionalAttributes]
1499
+ ] = None,
1500
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1501
+ server_url: Optional[str] = None,
1502
+ timeout_ms: Optional[int] = None,
1503
+ http_headers: Optional[Mapping[str, str]] = None,
1504
+ ) -> Optional[models.FeedbackArticleForSuggestion]:
1505
+ r"""Get Related Articles for Suggestion
1506
+
1507
+ ## Overview
1508
+ The Get Related Articles for Suggestion API allows authenticated users to retrieve related articles for a Suggestion.
1509
+
1510
+ ## Prerequisites
1511
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL.
1512
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
1513
+ * The Suggestion specified in the URL must belong to the user.
1514
+
1515
+
1516
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
1517
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1518
+ :param suggestion_id: The ID of the Suggestion.<br><br>A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1519
+ :param article_result_additional_attributes: The attributes of an Article to be returned *in addition to* the default list of attributes, listed below. Multiple additional attributes can be specified using a comma-separated list. Passing 'all' will return all attributes. #### Default Attributes These Article attributes are always returned: | Name | Description | ---- | ----------- | id | The ID of the Article. | name | The name of the Article. | articleType | The Article Type and its attributes. | createdBy | The ID, first name, middle name and last name of the user that created the Article. | createdDate | The date that the Article was created. | hasAttachments | True: The Article has one or more attachments.<br>False: The Article does not have any attachments. | languageCode | The language code of the Article language. | modifiedBy | The ID, first name, middle name and last name of the user that last modified the Article. | modifiedDate | The date that the Article was last modified on. | link | The link object, used to retrieve the details of the Article. | versionId | The ID of the Article version that is returned.
1520
+ :param retries: Override the default retry configuration for this method
1521
+ :param server_url: Override the default server URL for this method
1522
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1523
+ :param http_headers: Additional headers to set or replace on requests.
1524
+ """
1525
+ base_url = None
1526
+ url_variables = None
1527
+ if timeout_ms is None:
1528
+ timeout_ms = self.sdk_configuration.timeout_ms
1529
+
1530
+ if server_url is not None:
1531
+ base_url = server_url
1532
+ else:
1533
+ base_url = self._get_url(base_url, url_variables)
1534
+
1535
+ request = models.GetRelatedArticlesForSuggestionRequest(
1536
+ accept_language=accept_language,
1537
+ article_result_additional_attributes=article_result_additional_attributes,
1538
+ portal_id=portal_id,
1539
+ suggestion_id=suggestion_id,
1540
+ )
1541
+
1542
+ req = self._build_request_async(
1543
+ method="GET",
1544
+ path="/portals/{portalID}/suggestions/{suggestionID}/relatedArticles",
1545
+ base_url=base_url,
1546
+ url_variables=url_variables,
1547
+ request=request,
1548
+ request_body_required=False,
1549
+ request_has_path_params=True,
1550
+ request_has_query_params=True,
1551
+ user_agent_header="user-agent",
1552
+ accept_header_value="application/json",
1553
+ http_headers=http_headers,
1554
+ security=self.sdk_configuration.security,
1555
+ timeout_ms=timeout_ms,
1556
+ )
1557
+
1558
+ if retries == UNSET:
1559
+ if self.sdk_configuration.retry_config is not UNSET:
1560
+ retries = self.sdk_configuration.retry_config
1561
+
1562
+ retry_config = None
1563
+ if isinstance(retries, utils.RetryConfig):
1564
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1565
+
1566
+ http_res = await self.do_request_async(
1567
+ hook_ctx=HookContext(
1568
+ config=self.sdk_configuration,
1569
+ base_url=base_url or "",
1570
+ operation_id="getRelatedArticlesForSuggestion",
1571
+ oauth2_scopes=[],
1572
+ security_source=get_security_from_env(
1573
+ self.sdk_configuration.security, models.Security
1574
+ ),
1575
+ ),
1576
+ request=req,
1577
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
1578
+ retry_config=retry_config,
1579
+ )
1580
+
1581
+ response_data: Any = None
1582
+ if utils.match_response(http_res, "200", "application/json"):
1583
+ return unmarshal_json_response(
1584
+ models.FeedbackArticleForSuggestion, http_res
1585
+ )
1586
+ if utils.match_response(http_res, "204", "*"):
1587
+ return None
1588
+ if utils.match_response(
1589
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
1590
+ ):
1591
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1592
+ raise errors.WSErrorCommon(response_data, http_res)
1593
+ if utils.match_response(http_res, "500", "application/json"):
1594
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1595
+ raise errors.WSErrorCommon(response_data, http_res)
1596
+ if utils.match_response(http_res, "4XX", "*"):
1597
+ http_res_text = await utils.stream_to_text_async(http_res)
1598
+ raise errors.EgainDefaultError(
1599
+ "API error occurred", http_res, http_res_text
1600
+ )
1601
+ if utils.match_response(http_res, "5XX", "*"):
1602
+ http_res_text = await utils.stream_to_text_async(http_res)
1603
+ raise errors.EgainDefaultError(
1604
+ "API error occurred", http_res, http_res_text
1605
+ )
1606
+
1607
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
1608
+
1609
+ def get_suggestion_comments(
1610
+ self,
1611
+ *,
1612
+ accept_language: models.AcceptLanguage,
1613
+ portal_id: str,
1614
+ suggestion_id: str,
1615
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1616
+ server_url: Optional[str] = None,
1617
+ timeout_ms: Optional[int] = None,
1618
+ http_headers: Optional[Mapping[str, str]] = None,
1619
+ ) -> Optional[models.Comments]:
1620
+ r"""Get Suggestion Comments
1621
+
1622
+ ## Overview
1623
+ The Get Suggestion Comments API allows authenticated users to retrieve all comments for a Suggestion.
1624
+
1625
+ ## Prerequisites
1626
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL.
1627
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
1628
+ * The Suggestion specified in the URL must belong to the user.
1629
+
1630
+
1631
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
1632
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1633
+ :param suggestion_id: The ID of the Suggestion.<br><br>A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1634
+ :param retries: Override the default retry configuration for this method
1635
+ :param server_url: Override the default server URL for this method
1636
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1637
+ :param http_headers: Additional headers to set or replace on requests.
1638
+ """
1639
+ base_url = None
1640
+ url_variables = None
1641
+ if timeout_ms is None:
1642
+ timeout_ms = self.sdk_configuration.timeout_ms
1643
+
1644
+ if server_url is not None:
1645
+ base_url = server_url
1646
+ else:
1647
+ base_url = self._get_url(base_url, url_variables)
1648
+
1649
+ request = models.GetSuggestionCommentsRequest(
1650
+ accept_language=accept_language,
1651
+ portal_id=portal_id,
1652
+ suggestion_id=suggestion_id,
1653
+ )
1654
+
1655
+ req = self._build_request(
1656
+ method="GET",
1657
+ path="/portals/{portalID}/suggestions/{suggestionID}/comments",
1658
+ base_url=base_url,
1659
+ url_variables=url_variables,
1660
+ request=request,
1661
+ request_body_required=False,
1662
+ request_has_path_params=True,
1663
+ request_has_query_params=True,
1664
+ user_agent_header="user-agent",
1665
+ accept_header_value="application/json",
1666
+ http_headers=http_headers,
1667
+ security=self.sdk_configuration.security,
1668
+ timeout_ms=timeout_ms,
1669
+ )
1670
+
1671
+ if retries == UNSET:
1672
+ if self.sdk_configuration.retry_config is not UNSET:
1673
+ retries = self.sdk_configuration.retry_config
1674
+
1675
+ retry_config = None
1676
+ if isinstance(retries, utils.RetryConfig):
1677
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1678
+
1679
+ http_res = self.do_request(
1680
+ hook_ctx=HookContext(
1681
+ config=self.sdk_configuration,
1682
+ base_url=base_url or "",
1683
+ operation_id="getSuggestionComments",
1684
+ oauth2_scopes=[],
1685
+ security_source=get_security_from_env(
1686
+ self.sdk_configuration.security, models.Security
1687
+ ),
1688
+ ),
1689
+ request=req,
1690
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
1691
+ retry_config=retry_config,
1692
+ )
1693
+
1694
+ response_data: Any = None
1695
+ if utils.match_response(http_res, "200", "application/json"):
1696
+ return unmarshal_json_response(models.Comments, http_res)
1697
+ if utils.match_response(http_res, "204", "*"):
1698
+ return None
1699
+ if utils.match_response(
1700
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
1701
+ ):
1702
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1703
+ raise errors.WSErrorCommon(response_data, http_res)
1704
+ if utils.match_response(http_res, "500", "application/json"):
1705
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1706
+ raise errors.WSErrorCommon(response_data, http_res)
1707
+ if utils.match_response(http_res, "4XX", "*"):
1708
+ http_res_text = utils.stream_to_text(http_res)
1709
+ raise errors.EgainDefaultError(
1710
+ "API error occurred", http_res, http_res_text
1711
+ )
1712
+ if utils.match_response(http_res, "5XX", "*"):
1713
+ http_res_text = utils.stream_to_text(http_res)
1714
+ raise errors.EgainDefaultError(
1715
+ "API error occurred", http_res, http_res_text
1716
+ )
1717
+
1718
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
1719
+
1720
+ async def get_suggestion_comments_async(
1721
+ self,
1722
+ *,
1723
+ accept_language: models.AcceptLanguage,
1724
+ portal_id: str,
1725
+ suggestion_id: str,
1726
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1727
+ server_url: Optional[str] = None,
1728
+ timeout_ms: Optional[int] = None,
1729
+ http_headers: Optional[Mapping[str, str]] = None,
1730
+ ) -> Optional[models.Comments]:
1731
+ r"""Get Suggestion Comments
1732
+
1733
+ ## Overview
1734
+ The Get Suggestion Comments API allows authenticated users to retrieve all comments for a Suggestion.
1735
+
1736
+ ## Prerequisites
1737
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL.
1738
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
1739
+ * The Suggestion specified in the URL must belong to the user.
1740
+
1741
+
1742
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
1743
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1744
+ :param suggestion_id: The ID of the Suggestion.<br><br>A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1745
+ :param retries: Override the default retry configuration for this method
1746
+ :param server_url: Override the default server URL for this method
1747
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1748
+ :param http_headers: Additional headers to set or replace on requests.
1749
+ """
1750
+ base_url = None
1751
+ url_variables = None
1752
+ if timeout_ms is None:
1753
+ timeout_ms = self.sdk_configuration.timeout_ms
1754
+
1755
+ if server_url is not None:
1756
+ base_url = server_url
1757
+ else:
1758
+ base_url = self._get_url(base_url, url_variables)
1759
+
1760
+ request = models.GetSuggestionCommentsRequest(
1761
+ accept_language=accept_language,
1762
+ portal_id=portal_id,
1763
+ suggestion_id=suggestion_id,
1764
+ )
1765
+
1766
+ req = self._build_request_async(
1767
+ method="GET",
1768
+ path="/portals/{portalID}/suggestions/{suggestionID}/comments",
1769
+ base_url=base_url,
1770
+ url_variables=url_variables,
1771
+ request=request,
1772
+ request_body_required=False,
1773
+ request_has_path_params=True,
1774
+ request_has_query_params=True,
1775
+ user_agent_header="user-agent",
1776
+ accept_header_value="application/json",
1777
+ http_headers=http_headers,
1778
+ security=self.sdk_configuration.security,
1779
+ timeout_ms=timeout_ms,
1780
+ )
1781
+
1782
+ if retries == UNSET:
1783
+ if self.sdk_configuration.retry_config is not UNSET:
1784
+ retries = self.sdk_configuration.retry_config
1785
+
1786
+ retry_config = None
1787
+ if isinstance(retries, utils.RetryConfig):
1788
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1789
+
1790
+ http_res = await self.do_request_async(
1791
+ hook_ctx=HookContext(
1792
+ config=self.sdk_configuration,
1793
+ base_url=base_url or "",
1794
+ operation_id="getSuggestionComments",
1795
+ oauth2_scopes=[],
1796
+ security_source=get_security_from_env(
1797
+ self.sdk_configuration.security, models.Security
1798
+ ),
1799
+ ),
1800
+ request=req,
1801
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
1802
+ retry_config=retry_config,
1803
+ )
1804
+
1805
+ response_data: Any = None
1806
+ if utils.match_response(http_res, "200", "application/json"):
1807
+ return unmarshal_json_response(models.Comments, http_res)
1808
+ if utils.match_response(http_res, "204", "*"):
1809
+ return None
1810
+ if utils.match_response(
1811
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
1812
+ ):
1813
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1814
+ raise errors.WSErrorCommon(response_data, http_res)
1815
+ if utils.match_response(http_res, "500", "application/json"):
1816
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1817
+ raise errors.WSErrorCommon(response_data, http_res)
1818
+ if utils.match_response(http_res, "4XX", "*"):
1819
+ http_res_text = await utils.stream_to_text_async(http_res)
1820
+ raise errors.EgainDefaultError(
1821
+ "API error occurred", http_res, http_res_text
1822
+ )
1823
+ if utils.match_response(http_res, "5XX", "*"):
1824
+ http_res_text = await utils.stream_to_text_async(http_res)
1825
+ raise errors.EgainDefaultError(
1826
+ "API error occurred", http_res, http_res_text
1827
+ )
1828
+
1829
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
1830
+
1831
+ def get_suggestion_attachments(
1832
+ self,
1833
+ *,
1834
+ accept_language: models.AcceptLanguage,
1835
+ portal_id: str,
1836
+ suggestion_id: str,
1837
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1838
+ server_url: Optional[str] = None,
1839
+ timeout_ms: Optional[int] = None,
1840
+ http_headers: Optional[Mapping[str, str]] = None,
1841
+ ) -> Optional[models.Attachments]:
1842
+ r"""Get Suggestion Attachments
1843
+
1844
+ ## Overview
1845
+ The Get Suggestion Attachments API allows authenticated users to retrieve attachments for a Suggestion.
1846
+
1847
+ ## Prerequisites
1848
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL
1849
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
1850
+ * The Suggestion specified in the URL must belong to the user.
1851
+
1852
+
1853
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
1854
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1855
+ :param suggestion_id: The ID of the Suggestion.<br><br>A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1856
+ :param retries: Override the default retry configuration for this method
1857
+ :param server_url: Override the default server URL for this method
1858
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1859
+ :param http_headers: Additional headers to set or replace on requests.
1860
+ """
1861
+ base_url = None
1862
+ url_variables = None
1863
+ if timeout_ms is None:
1864
+ timeout_ms = self.sdk_configuration.timeout_ms
1865
+
1866
+ if server_url is not None:
1867
+ base_url = server_url
1868
+ else:
1869
+ base_url = self._get_url(base_url, url_variables)
1870
+
1871
+ request = models.GetSuggestionAttachmentsRequest(
1872
+ accept_language=accept_language,
1873
+ portal_id=portal_id,
1874
+ suggestion_id=suggestion_id,
1875
+ )
1876
+
1877
+ req = self._build_request(
1878
+ method="GET",
1879
+ path="/portals/{portalID}/suggestions/{suggestionID}/attachments",
1880
+ base_url=base_url,
1881
+ url_variables=url_variables,
1882
+ request=request,
1883
+ request_body_required=False,
1884
+ request_has_path_params=True,
1885
+ request_has_query_params=True,
1886
+ user_agent_header="user-agent",
1887
+ accept_header_value="application/json",
1888
+ http_headers=http_headers,
1889
+ security=self.sdk_configuration.security,
1890
+ timeout_ms=timeout_ms,
1891
+ )
1892
+
1893
+ if retries == UNSET:
1894
+ if self.sdk_configuration.retry_config is not UNSET:
1895
+ retries = self.sdk_configuration.retry_config
1896
+
1897
+ retry_config = None
1898
+ if isinstance(retries, utils.RetryConfig):
1899
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1900
+
1901
+ http_res = self.do_request(
1902
+ hook_ctx=HookContext(
1903
+ config=self.sdk_configuration,
1904
+ base_url=base_url or "",
1905
+ operation_id="getSuggestionAttachments",
1906
+ oauth2_scopes=[],
1907
+ security_source=get_security_from_env(
1908
+ self.sdk_configuration.security, models.Security
1909
+ ),
1910
+ ),
1911
+ request=req,
1912
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
1913
+ retry_config=retry_config,
1914
+ )
1915
+
1916
+ response_data: Any = None
1917
+ if utils.match_response(http_res, "200", "application/json"):
1918
+ return unmarshal_json_response(models.Attachments, http_res)
1919
+ if utils.match_response(http_res, "204", "*"):
1920
+ return None
1921
+ if utils.match_response(
1922
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
1923
+ ):
1924
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1925
+ raise errors.WSErrorCommon(response_data, http_res)
1926
+ if utils.match_response(http_res, "500", "application/json"):
1927
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
1928
+ raise errors.WSErrorCommon(response_data, http_res)
1929
+ if utils.match_response(http_res, "4XX", "*"):
1930
+ http_res_text = utils.stream_to_text(http_res)
1931
+ raise errors.EgainDefaultError(
1932
+ "API error occurred", http_res, http_res_text
1933
+ )
1934
+ if utils.match_response(http_res, "5XX", "*"):
1935
+ http_res_text = utils.stream_to_text(http_res)
1936
+ raise errors.EgainDefaultError(
1937
+ "API error occurred", http_res, http_res_text
1938
+ )
1939
+
1940
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
1941
+
1942
+ async def get_suggestion_attachments_async(
1943
+ self,
1944
+ *,
1945
+ accept_language: models.AcceptLanguage,
1946
+ portal_id: str,
1947
+ suggestion_id: str,
1948
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1949
+ server_url: Optional[str] = None,
1950
+ timeout_ms: Optional[int] = None,
1951
+ http_headers: Optional[Mapping[str, str]] = None,
1952
+ ) -> Optional[models.Attachments]:
1953
+ r"""Get Suggestion Attachments
1954
+
1955
+ ## Overview
1956
+ The Get Suggestion Attachments API allows authenticated users to retrieve attachments for a Suggestion.
1957
+
1958
+ ## Prerequisites
1959
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL
1960
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
1961
+ * The Suggestion specified in the URL must belong to the user.
1962
+
1963
+
1964
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
1965
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1966
+ :param suggestion_id: The ID of the Suggestion.<br><br>A Suggestion ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
1967
+ :param retries: Override the default retry configuration for this method
1968
+ :param server_url: Override the default server URL for this method
1969
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1970
+ :param http_headers: Additional headers to set or replace on requests.
1971
+ """
1972
+ base_url = None
1973
+ url_variables = None
1974
+ if timeout_ms is None:
1975
+ timeout_ms = self.sdk_configuration.timeout_ms
1976
+
1977
+ if server_url is not None:
1978
+ base_url = server_url
1979
+ else:
1980
+ base_url = self._get_url(base_url, url_variables)
1981
+
1982
+ request = models.GetSuggestionAttachmentsRequest(
1983
+ accept_language=accept_language,
1984
+ portal_id=portal_id,
1985
+ suggestion_id=suggestion_id,
1986
+ )
1987
+
1988
+ req = self._build_request_async(
1989
+ method="GET",
1990
+ path="/portals/{portalID}/suggestions/{suggestionID}/attachments",
1991
+ base_url=base_url,
1992
+ url_variables=url_variables,
1993
+ request=request,
1994
+ request_body_required=False,
1995
+ request_has_path_params=True,
1996
+ request_has_query_params=True,
1997
+ user_agent_header="user-agent",
1998
+ accept_header_value="application/json",
1999
+ http_headers=http_headers,
2000
+ security=self.sdk_configuration.security,
2001
+ timeout_ms=timeout_ms,
2002
+ )
2003
+
2004
+ if retries == UNSET:
2005
+ if self.sdk_configuration.retry_config is not UNSET:
2006
+ retries = self.sdk_configuration.retry_config
2007
+
2008
+ retry_config = None
2009
+ if isinstance(retries, utils.RetryConfig):
2010
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2011
+
2012
+ http_res = await self.do_request_async(
2013
+ hook_ctx=HookContext(
2014
+ config=self.sdk_configuration,
2015
+ base_url=base_url or "",
2016
+ operation_id="getSuggestionAttachments",
2017
+ oauth2_scopes=[],
2018
+ security_source=get_security_from_env(
2019
+ self.sdk_configuration.security, models.Security
2020
+ ),
2021
+ ),
2022
+ request=req,
2023
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
2024
+ retry_config=retry_config,
2025
+ )
2026
+
2027
+ response_data: Any = None
2028
+ if utils.match_response(http_res, "200", "application/json"):
2029
+ return unmarshal_json_response(models.Attachments, http_res)
2030
+ if utils.match_response(http_res, "204", "*"):
2031
+ return None
2032
+ if utils.match_response(
2033
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
2034
+ ):
2035
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
2036
+ raise errors.WSErrorCommon(response_data, http_res)
2037
+ if utils.match_response(http_res, "500", "application/json"):
2038
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
2039
+ raise errors.WSErrorCommon(response_data, http_res)
2040
+ if utils.match_response(http_res, "4XX", "*"):
2041
+ http_res_text = await utils.stream_to_text_async(http_res)
2042
+ raise errors.EgainDefaultError(
2043
+ "API error occurred", http_res, http_res_text
2044
+ )
2045
+ if utils.match_response(http_res, "5XX", "*"):
2046
+ http_res_text = await utils.stream_to_text_async(http_res)
2047
+ raise errors.EgainDefaultError(
2048
+ "API error occurred", http_res, http_res_text
2049
+ )
2050
+
2051
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
2052
+
2053
+ def get_suggestion_attachment_by_id(
2054
+ self,
2055
+ *,
2056
+ accept_language: models.AcceptLanguage,
2057
+ portal_id: str,
2058
+ attachment_id: str,
2059
+ attachment_additional_attributes: Optional[
2060
+ List[models.AttachmentAdditionalAttributes]
2061
+ ] = None,
2062
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2063
+ server_url: Optional[str] = None,
2064
+ timeout_ms: Optional[int] = None,
2065
+ http_headers: Optional[Mapping[str, str]] = None,
2066
+ ) -> Optional[models.SuggestionAttachment]:
2067
+ r"""Get Suggestion Attachment by ID
2068
+
2069
+ ## Overview
2070
+ The Get Suggestion Attachment by ID API allows authenticated users to get the details of an attachment that belongs to their own Suggestion. It also allows the download of attachment content.
2071
+
2072
+ ## Prerequisites
2073
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL
2074
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
2075
+ * The Suggestion specified in the URL must belong to the user.
2076
+
2077
+
2078
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
2079
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
2080
+ :param attachment_id: The ID of the attachment.<br><br>An attachment ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
2081
+ :param attachment_additional_attributes: The attributes of an attachment to be returned, along with the default attachment details. | Attribute | Description | |--------------|------------------------------------| | id | Unique identifier for the attachment | | fileName | Name of the file | | contentType| Content type of the file | | size | Size of the file in bytes | | link | Link to the attachment |
2082
+ :param retries: Override the default retry configuration for this method
2083
+ :param server_url: Override the default server URL for this method
2084
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2085
+ :param http_headers: Additional headers to set or replace on requests.
2086
+ """
2087
+ base_url = None
2088
+ url_variables = None
2089
+ if timeout_ms is None:
2090
+ timeout_ms = self.sdk_configuration.timeout_ms
2091
+
2092
+ if server_url is not None:
2093
+ base_url = server_url
2094
+ else:
2095
+ base_url = self._get_url(base_url, url_variables)
2096
+
2097
+ request = models.GetSuggestionAttachmentByIDRequest(
2098
+ accept_language=accept_language,
2099
+ portal_id=portal_id,
2100
+ attachment_id=attachment_id,
2101
+ attachment_additional_attributes=attachment_additional_attributes,
2102
+ )
2103
+
2104
+ req = self._build_request(
2105
+ method="GET",
2106
+ path="/portals/{portalID}/suggestions/attachments/{attachmentID}",
2107
+ base_url=base_url,
2108
+ url_variables=url_variables,
2109
+ request=request,
2110
+ request_body_required=False,
2111
+ request_has_path_params=True,
2112
+ request_has_query_params=True,
2113
+ user_agent_header="user-agent",
2114
+ accept_header_value="application/json",
2115
+ http_headers=http_headers,
2116
+ security=self.sdk_configuration.security,
2117
+ timeout_ms=timeout_ms,
2118
+ )
2119
+
2120
+ if retries == UNSET:
2121
+ if self.sdk_configuration.retry_config is not UNSET:
2122
+ retries = self.sdk_configuration.retry_config
2123
+
2124
+ retry_config = None
2125
+ if isinstance(retries, utils.RetryConfig):
2126
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2127
+
2128
+ http_res = self.do_request(
2129
+ hook_ctx=HookContext(
2130
+ config=self.sdk_configuration,
2131
+ base_url=base_url or "",
2132
+ operation_id="getSuggestionAttachmentById",
2133
+ oauth2_scopes=[],
2134
+ security_source=get_security_from_env(
2135
+ self.sdk_configuration.security, models.Security
2136
+ ),
2137
+ ),
2138
+ request=req,
2139
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
2140
+ retry_config=retry_config,
2141
+ )
2142
+
2143
+ response_data: Any = None
2144
+ if utils.match_response(http_res, "200", "application/json"):
2145
+ return unmarshal_json_response(models.SuggestionAttachment, http_res)
2146
+ if utils.match_response(http_res, "204", "*"):
2147
+ return None
2148
+ if utils.match_response(
2149
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
2150
+ ):
2151
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
2152
+ raise errors.WSErrorCommon(response_data, http_res)
2153
+ if utils.match_response(http_res, "500", "application/json"):
2154
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
2155
+ raise errors.WSErrorCommon(response_data, http_res)
2156
+ if utils.match_response(http_res, "4XX", "*"):
2157
+ http_res_text = utils.stream_to_text(http_res)
2158
+ raise errors.EgainDefaultError(
2159
+ "API error occurred", http_res, http_res_text
2160
+ )
2161
+ if utils.match_response(http_res, "5XX", "*"):
2162
+ http_res_text = utils.stream_to_text(http_res)
2163
+ raise errors.EgainDefaultError(
2164
+ "API error occurred", http_res, http_res_text
2165
+ )
2166
+
2167
+ raise errors.EgainDefaultError("Unexpected response received", http_res)
2168
+
2169
+ async def get_suggestion_attachment_by_id_async(
2170
+ self,
2171
+ *,
2172
+ accept_language: models.AcceptLanguage,
2173
+ portal_id: str,
2174
+ attachment_id: str,
2175
+ attachment_additional_attributes: Optional[
2176
+ List[models.AttachmentAdditionalAttributes]
2177
+ ] = None,
2178
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2179
+ server_url: Optional[str] = None,
2180
+ timeout_ms: Optional[int] = None,
2181
+ http_headers: Optional[Mapping[str, str]] = None,
2182
+ ) -> Optional[models.SuggestionAttachment]:
2183
+ r"""Get Suggestion Attachment by ID
2184
+
2185
+ ## Overview
2186
+ The Get Suggestion Attachment by ID API allows authenticated users to get the details of an attachment that belongs to their own Suggestion. It also allows the download of attachment content.
2187
+
2188
+ ## Prerequisites
2189
+ * Enable the setting \"My Suggestions\" for the portal specified in the URL
2190
+ * If the user is a customer, enable the setting \"Allow Customer Access\" for the portal.
2191
+ * The Suggestion specified in the URL must belong to the user.
2192
+
2193
+
2194
+ :param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
2195
+ :param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
2196
+ :param attachment_id: The ID of the attachment.<br><br>An attachment ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
2197
+ :param attachment_additional_attributes: The attributes of an attachment to be returned, along with the default attachment details. | Attribute | Description | |--------------|------------------------------------| | id | Unique identifier for the attachment | | fileName | Name of the file | | contentType| Content type of the file | | size | Size of the file in bytes | | link | Link to the attachment |
2198
+ :param retries: Override the default retry configuration for this method
2199
+ :param server_url: Override the default server URL for this method
2200
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2201
+ :param http_headers: Additional headers to set or replace on requests.
2202
+ """
2203
+ base_url = None
2204
+ url_variables = None
2205
+ if timeout_ms is None:
2206
+ timeout_ms = self.sdk_configuration.timeout_ms
2207
+
2208
+ if server_url is not None:
2209
+ base_url = server_url
2210
+ else:
2211
+ base_url = self._get_url(base_url, url_variables)
2212
+
2213
+ request = models.GetSuggestionAttachmentByIDRequest(
2214
+ accept_language=accept_language,
2215
+ portal_id=portal_id,
2216
+ attachment_id=attachment_id,
2217
+ attachment_additional_attributes=attachment_additional_attributes,
2218
+ )
2219
+
2220
+ req = self._build_request_async(
2221
+ method="GET",
2222
+ path="/portals/{portalID}/suggestions/attachments/{attachmentID}",
2223
+ base_url=base_url,
2224
+ url_variables=url_variables,
2225
+ request=request,
2226
+ request_body_required=False,
2227
+ request_has_path_params=True,
2228
+ request_has_query_params=True,
2229
+ user_agent_header="user-agent",
2230
+ accept_header_value="application/json",
2231
+ http_headers=http_headers,
2232
+ security=self.sdk_configuration.security,
2233
+ timeout_ms=timeout_ms,
2234
+ )
2235
+
2236
+ if retries == UNSET:
2237
+ if self.sdk_configuration.retry_config is not UNSET:
2238
+ retries = self.sdk_configuration.retry_config
2239
+
2240
+ retry_config = None
2241
+ if isinstance(retries, utils.RetryConfig):
2242
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2243
+
2244
+ http_res = await self.do_request_async(
2245
+ hook_ctx=HookContext(
2246
+ config=self.sdk_configuration,
2247
+ base_url=base_url or "",
2248
+ operation_id="getSuggestionAttachmentById",
2249
+ oauth2_scopes=[],
2250
+ security_source=get_security_from_env(
2251
+ self.sdk_configuration.security, models.Security
2252
+ ),
2253
+ ),
2254
+ request=req,
2255
+ error_status_codes=["400", "401", "403", "404", "406", "4XX", "500", "5XX"],
2256
+ retry_config=retry_config,
2257
+ )
2258
+
2259
+ response_data: Any = None
2260
+ if utils.match_response(http_res, "200", "application/json"):
2261
+ return unmarshal_json_response(models.SuggestionAttachment, http_res)
2262
+ if utils.match_response(http_res, "204", "*"):
2263
+ return None
2264
+ if utils.match_response(
2265
+ http_res, ["400", "401", "403", "404", "406"], "application/json"
2266
+ ):
2267
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
2268
+ raise errors.WSErrorCommon(response_data, http_res)
2269
+ if utils.match_response(http_res, "500", "application/json"):
2270
+ response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
2271
+ raise errors.WSErrorCommon(response_data, http_res)
2272
+ if utils.match_response(http_res, "4XX", "*"):
2273
+ http_res_text = await utils.stream_to_text_async(http_res)
2274
+ raise errors.EgainDefaultError(
2275
+ "API error occurred", http_res, http_res_text
2276
+ )
2277
+ if utils.match_response(http_res, "5XX", "*"):
2278
+ http_res_text = await utils.stream_to_text_async(http_res)
2279
+ raise errors.EgainDefaultError(
2280
+ "API error occurred", http_res, http_res_text
2281
+ )
2282
+
2283
+ raise errors.EgainDefaultError("Unexpected response received", http_res)