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.
- egain_api_python/__init__.py +17 -0
- egain_api_python/_hooks/__init__.py +5 -0
- egain_api_python/_hooks/registration.py +13 -0
- egain_api_python/_hooks/sdkhooks.py +76 -0
- egain_api_python/_hooks/types.py +112 -0
- egain_api_python/_version.py +15 -0
- egain_api_python/aiservices.py +23 -0
- egain_api_python/answers.py +281 -0
- egain_api_python/articlelists.py +469 -0
- egain_api_python/basesdk.py +368 -0
- egain_api_python/connectorssearchevents.py +537 -0
- egain_api_python/content.py +23 -0
- egain_api_python/errors/__init__.py +78 -0
- egain_api_python/errors/egaindefaulterror.py +40 -0
- egain_api_python/errors/egainerror.py +30 -0
- egain_api_python/errors/gethealthop.py +74 -0
- egain_api_python/errors/no_response_error.py +17 -0
- egain_api_python/errors/responsevalidationerror.py +27 -0
- egain_api_python/errors/schemas_wserrorcommon.py +51 -0
- egain_api_python/errors/wserrorcommon.py +49 -0
- egain_api_python/escalation.py +955 -0
- egain_api_python/export.py +487 -0
- egain_api_python/federatedsearchevent.py +287 -0
- egain_api_python/general.py +925 -0
- egain_api_python/guidedhelp.py +3373 -0
- egain_api_python/health.py +253 -0
- egain_api_python/httpclient.py +125 -0
- egain_api_python/import_.py +1161 -0
- egain_api_python/models/__init__.py +2136 -0
- egain_api_python/models/acceptghsolutionop.py +52 -0
- egain_api_python/models/acceptlanguage.py +23 -0
- egain_api_python/models/accessibleportal.py +37 -0
- egain_api_python/models/action.py +56 -0
- egain_api_python/models/actionsearch.py +92 -0
- egain_api_python/models/addasreferenceop.py +52 -0
- egain_api_python/models/addbookmarkop.py +43 -0
- egain_api_python/models/additionalsnippets.py +57 -0
- egain_api_python/models/addtoreplyop.py +52 -0
- egain_api_python/models/aisearchop.py +131 -0
- egain_api_python/models/aisearchresponse.py +67 -0
- egain_api_python/models/allaccessibleportals.py +28 -0
- egain_api_python/models/answer.py +21 -0
- egain_api_python/models/answeredquestion.py +125 -0
- egain_api_python/models/answerrange.py +41 -0
- egain_api_python/models/answersrequest.py +78 -0
- egain_api_python/models/answersresponse.py +93 -0
- egain_api_python/models/article.py +241 -0
- egain_api_python/models/articleactivitylink.py +62 -0
- egain_api_python/models/articleadditionalattributes.py +23 -0
- egain_api_python/models/articleaisearchresult.py +254 -0
- egain_api_python/models/articleattachment.py +44 -0
- egain_api_python/models/articlelist.py +48 -0
- egain_api_python/models/articlelistresult.py +38 -0
- egain_api_python/models/articlelistsresult.py +22 -0
- egain_api_python/models/articlepermissions.py +25 -0
- egain_api_python/models/articlepermissionsresult.py +27 -0
- egain_api_python/models/articlerating.py +51 -0
- egain_api_python/models/articleratingsresponse.py +28 -0
- egain_api_python/models/articleresult.py +159 -0
- egain_api_python/models/articleresultadditionalattributes.py +22 -0
- egain_api_python/models/articleresults.py +32 -0
- egain_api_python/models/articlesearchresult.py +243 -0
- egain_api_python/models/articlesearchresults.py +32 -0
- egain_api_python/models/articlesort.py +11 -0
- egain_api_python/models/articlesortorder.py +11 -0
- egain_api_python/models/articletype.py +56 -0
- egain_api_python/models/articlewitheditions.py +227 -0
- egain_api_python/models/attachment.py +31 -0
- egain_api_python/models/attachmentadditionalattributes.py +10 -0
- egain_api_python/models/attachmentcontent.py +57 -0
- egain_api_python/models/attachmentcontentresult.py +22 -0
- egain_api_python/models/attachmentforcreatesuggestion.py +25 -0
- egain_api_python/models/attachments.py +35 -0
- egain_api_python/models/attachmentsummary.py +37 -0
- egain_api_python/models/attachmentupload.py +20 -0
- egain_api_python/models/avertcustomerescalationop.py +44 -0
- egain_api_python/models/bookmark.py +57 -0
- egain_api_python/models/bookmarkresult.py +26 -0
- egain_api_python/models/bookmarkstatus.py +34 -0
- egain_api_python/models/case.py +158 -0
- egain_api_python/models/caseadditionalattributes.py +11 -0
- egain_api_python/models/caseanswer.py +21 -0
- egain_api_python/models/casebase.py +67 -0
- egain_api_python/models/casebaseresult.py +28 -0
- egain_api_python/models/casebasesearchsettings.py +26 -0
- egain_api_python/models/caselistresult.py +74 -0
- egain_api_python/models/caselistresults.py +28 -0
- egain_api_python/models/casequestion.py +16 -0
- egain_api_python/models/casequestiondetail.py +29 -0
- egain_api_python/models/casesearch.py +80 -0
- egain_api_python/models/clusterid.py +16 -0
- egain_api_python/models/clusterresult.py +37 -0
- egain_api_python/models/clusterresults.py +28 -0
- egain_api_python/models/comment.py +33 -0
- egain_api_python/models/comments.py +26 -0
- egain_api_python/models/completecustomerescalationop.py +44 -0
- egain_api_python/models/compliancearticleresult.py +166 -0
- egain_api_python/models/compliancearticleresultadditionalattributes.py +22 -0
- egain_api_python/models/compliancearticleresults.py +35 -0
- egain_api_python/models/complianceforarticle.py +59 -0
- egain_api_python/models/complyarticleop.py +40 -0
- egain_api_python/models/components_schemas_tag.py +25 -0
- egain_api_python/models/components_schemas_tagcategory.py +39 -0
- egain_api_python/models/components_schemas_taggroup.py +25 -0
- egain_api_python/models/configurableattribute.py +25 -0
- egain_api_python/models/configurableattributes.py +15 -0
- egain_api_python/models/contactperson.py +43 -0
- egain_api_python/models/contacts.py +21 -0
- egain_api_python/models/createbookmark.py +64 -0
- egain_api_python/models/createdby.py +37 -0
- egain_api_python/models/createfederatedsearchevent.py +85 -0
- egain_api_python/models/createfederatedsearchresulteventop.py +46 -0
- egain_api_python/models/createimportop.py +20 -0
- egain_api_python/models/createimportvalidationop.py +20 -0
- egain_api_python/models/createquickpick.py +34 -0
- egain_api_python/models/createquickpickop.py +55 -0
- egain_api_python/models/createsearchresulteventforconnectors.py +71 -0
- egain_api_python/models/createsearchresulteventforconnectorsop.py +48 -0
- egain_api_python/models/createsignedurlop.py +29 -0
- egain_api_python/models/createsuggestion.py +126 -0
- egain_api_python/models/createviewedsearchresulteventforconnectors.py +76 -0
- egain_api_python/models/createviewedsearchresultseventforconnectorsop.py +48 -0
- egain_api_python/models/customattribute.py +35 -0
- egain_api_python/models/deletebookmarkop.py +40 -0
- egain_api_python/models/deletesuggestionop.py +40 -0
- egain_api_python/models/department.py +21 -0
- egain_api_python/models/detailfield.py +32 -0
- egain_api_python/models/displayfield.py +27 -0
- egain_api_python/models/dynamiccluster.py +21 -0
- egain_api_python/models/dynamicsearch.py +40 -0
- egain_api_python/models/edition.py +79 -0
- egain_api_python/models/editionwithcontent.py +68 -0
- egain_api_python/models/email.py +21 -0
- egain_api_python/models/exportcontentop.py +14 -0
- egain_api_python/models/exportstatus.py +106 -0
- egain_api_python/models/exportstatusop.py +31 -0
- egain_api_python/models/feedbackarticleforsuggestion.py +34 -0
- egain_api_python/models/folderbreadcrumb.py +24 -0
- egain_api_python/models/foldersummary.py +29 -0
- egain_api_python/models/getacknowledgedcompliancearticlesop.py +119 -0
- egain_api_python/models/getallarticlelistsop.py +47 -0
- egain_api_python/models/getallcasebasesreleasesop.py +65 -0
- egain_api_python/models/getallcasesop.py +83 -0
- egain_api_python/models/getallportalsop.py +60 -0
- egain_api_python/models/getallprofilesinportalop.py +64 -0
- egain_api_python/models/getallquickpicksop.py +83 -0
- egain_api_python/models/getalltopicsop.py +132 -0
- egain_api_python/models/getalluserprofilesop.py +47 -0
- egain_api_python/models/getancestortopicsop.py +133 -0
- egain_api_python/models/getannouncementarticlesop.py +134 -0
- egain_api_python/models/getarticleattachmentbyidop.py +31 -0
- egain_api_python/models/getarticlebyidop.py +257 -0
- egain_api_python/models/getarticlebyidwitheditionsop.py +46 -0
- egain_api_python/models/getarticleeditiondetailsop.py +55 -0
- egain_api_python/models/getarticlelistdetailsop.py +115 -0
- egain_api_python/models/getarticlepermissionsbyidop.py +40 -0
- egain_api_python/models/getarticlepersonalizationop.py +73 -0
- egain_api_python/models/getarticleratingsop.py +74 -0
- egain_api_python/models/getarticlesintopicop.py +172 -0
- egain_api_python/models/getattachmentbyidinportalop.py +56 -0
- egain_api_python/models/getbookmarkop.py +31 -0
- egain_api_python/models/getcasebasereleasebyidop.py +64 -0
- egain_api_python/models/getcasebyidop.py +75 -0
- egain_api_python/models/getchildtopicsop.py +150 -0
- egain_api_python/models/getclusterbycasebasereleaseidop.py +74 -0
- egain_api_python/models/gethealthop.py +130 -0
- egain_api_python/models/getimportcontentop.py +46 -0
- egain_api_python/models/getmyportalsop.py +97 -0
- egain_api_python/models/getmysubscriptionop.py +115 -0
- egain_api_python/models/getpendingcompliancearticlesop.py +119 -0
- egain_api_python/models/getpopulararticlesop.py +133 -0
- egain_api_python/models/getportaldetailsbyidop.py +47 -0
- egain_api_python/models/getrelatedarticlesforsuggestionop.py +96 -0
- egain_api_python/models/getrelatedarticlesop.py +143 -0
- egain_api_python/models/getsuggestionattachmentbyidop.py +76 -0
- egain_api_python/models/getsuggestionattachmentsop.py +40 -0
- egain_api_python/models/getsuggestioncommentsop.py +40 -0
- egain_api_python/models/getsuggestionop.py +107 -0
- egain_api_python/models/gettagcategoriesforinterestforportalop.py +46 -0
- egain_api_python/models/gettopicbreadcrumbforarticleop.py +55 -0
- egain_api_python/models/getuserdetailsop.py +22 -0
- egain_api_python/models/getusermilestonesop.py +22 -0
- egain_api_python/models/ghsearchrequest.py +67 -0
- egain_api_python/models/ghsearchresult.py +75 -0
- egain_api_python/models/ghstepsearchrequest.py +64 -0
- egain_api_python/models/image.py +17 -0
- egain_api_python/models/importcontent.py +79 -0
- egain_api_python/models/importstatus.py +29 -0
- egain_api_python/models/kblanguage.py +63 -0
- egain_api_python/models/kblanguagecode.py +48 -0
- egain_api_python/models/kblanguages.py +22 -0
- egain_api_python/models/knowledgeexport.py +237 -0
- egain_api_python/models/l10nstring.py +22 -0
- egain_api_python/models/languagecode.py +39 -0
- egain_api_python/models/languagecode_parameter.py +39 -0
- egain_api_python/models/languagequeryparameter.py +39 -0
- egain_api_python/models/link.py +25 -0
- egain_api_python/models/makesuggestionop.py +44 -0
- egain_api_python/models/mandatorylanguagequeryparameter.py +38 -0
- egain_api_python/models/metadata.py +29 -0
- egain_api_python/models/milestone.py +21 -0
- egain_api_python/models/milestonename.py +26 -0
- egain_api_python/models/milestones.py +21 -0
- egain_api_python/models/modifiedby.py +37 -0
- egain_api_python/models/modifysuggestion.py +78 -0
- egain_api_python/models/modifysuggestionsop.py +44 -0
- egain_api_python/models/optionalarticleattributes.py +20 -0
- egain_api_python/models/order.py +10 -0
- egain_api_python/models/ownedby.py +37 -0
- egain_api_python/models/paginationinfo.py +32 -0
- egain_api_python/models/patchimportcontentvalidationop.py +46 -0
- egain_api_python/models/personalization.py +67 -0
- egain_api_python/models/phone.py +21 -0
- egain_api_python/models/portal.py +102 -0
- egain_api_python/models/portalresult.py +28 -0
- egain_api_python/models/portalsettings.py +398 -0
- egain_api_python/models/post_portalid_answersop.py +88 -0
- egain_api_python/models/post_portalid_retrieveop.py +88 -0
- egain_api_python/models/profile.py +26 -0
- egain_api_python/models/profileresult.py +24 -0
- egain_api_python/models/publishprofile.py +30 -0
- egain_api_python/models/publishview.py +38 -0
- egain_api_python/models/question.py +101 -0
- egain_api_python/models/questionandanswer.py +26 -0
- egain_api_python/models/quickpickrating.py +32 -0
- egain_api_python/models/quickpickresult.py +38 -0
- egain_api_python/models/quickpickresults.py +28 -0
- egain_api_python/models/ratearticleop.py +71 -0
- egain_api_python/models/referenceresponse.py +80 -0
- egain_api_python/models/rejectghsolutionop.py +52 -0
- egain_api_python/models/relatedquestions.py +28 -0
- egain_api_python/models/resourcetype_parameter.py +10 -0
- egain_api_python/models/restorequickpickop.py +63 -0
- egain_api_python/models/retrieverequest.py +47 -0
- egain_api_python/models/retrieveresponse.py +96 -0
- egain_api_python/models/role.py +26 -0
- egain_api_python/models/roletemplate.py +25 -0
- egain_api_python/models/schemas_answer.py +94 -0
- egain_api_python/models/schemas_customattribute.py +35 -0
- egain_api_python/models/schemas_link.py +27 -0
- egain_api_python/models/schemas_tag.py +21 -0
- egain_api_python/models/schemas_tagcategory.py +75 -0
- egain_api_python/models/schemas_taggroup.py +31 -0
- egain_api_python/models/schemas_tags.py +19 -0
- egain_api_python/models/schemas_wserrorcommon.py +17 -0
- egain_api_python/models/searchfilterattribute.py +61 -0
- egain_api_python/models/searchpriortoescalationop.py +108 -0
- egain_api_python/models/searchresult.py +101 -0
- egain_api_python/models/searchsuggestionop.py +93 -0
- egain_api_python/models/security.py +25 -0
- egain_api_python/models/selectuserprofileop.py +44 -0
- egain_api_python/models/sessioncontextvariable.py +17 -0
- egain_api_python/models/shorturl.py +32 -0
- egain_api_python/models/sortidname.py +10 -0
- egain_api_python/models/sortidnamedepartment.py +11 -0
- egain_api_python/models/stage.py +26 -0
- egain_api_python/models/startcustomerescalationop.py +66 -0
- egain_api_python/models/startescalationrequest.py +94 -0
- egain_api_python/models/startghsearchop.py +74 -0
- egain_api_python/models/startquestionandanswer.py +26 -0
- egain_api_python/models/stepghsearchop.py +62 -0
- egain_api_python/models/stringattributevalue.py +30 -0
- egain_api_python/models/structuredauthoringfields.py +33 -0
- egain_api_python/models/subscribearticleop.py +40 -0
- egain_api_python/models/suggestion.py +190 -0
- egain_api_python/models/suggestionadditionalattributes.py +11 -0
- egain_api_python/models/suggestionattachment.py +46 -0
- egain_api_python/models/suggestions.py +28 -0
- egain_api_python/models/tag.py +17 -0
- egain_api_python/models/tagcategoriesforinterest.py +22 -0
- egain_api_python/models/tagcategory.py +34 -0
- egain_api_python/models/taggroup.py +17 -0
- egain_api_python/models/taggroups.py +20 -0
- egain_api_python/models/tags.py +17 -0
- egain_api_python/models/topic.py +113 -0
- egain_api_python/models/topicadditionalattributes.py +20 -0
- egain_api_python/models/topicaisearchresult.py +67 -0
- egain_api_python/models/topicbreadcrumb.py +24 -0
- egain_api_python/models/topicresult.py +26 -0
- egain_api_python/models/topicsummary.py +31 -0
- egain_api_python/models/topictreenode.py +27 -0
- egain_api_python/models/topictreeresult.py +28 -0
- egain_api_python/models/unsubscribearticleop.py +55 -0
- egain_api_python/models/uploadattachmentop.py +36 -0
- egain_api_python/models/userdetails.py +44 -0
- egain_api_python/models/userprofile.py +33 -0
- egain_api_python/models/userprofiles.py +21 -0
- egain_api_python/models/userview.py +33 -0
- egain_api_python/models/validateimportcontent.py +58 -0
- egain_api_python/models/virtualcase.py +52 -0
- egain_api_python/models/workflow.py +21 -0
- egain_api_python/models/workflowmilestone.py +11 -0
- egain_api_python/models/wserrorcommon.py +17 -0
- egain_api_python/populararticles.py +287 -0
- egain_api_python/portal_article.py +4935 -0
- egain_api_python/portal_attachment.py +494 -0
- egain_api_python/portal_bookmark.py +707 -0
- egain_api_python/portal_sdk.py +88 -0
- egain_api_python/portal_suggestion.py +2283 -0
- egain_api_python/portal_topic.py +975 -0
- egain_api_python/portal_userdetails.py +211 -0
- egain_api_python/portal_userprofile.py +431 -0
- egain_api_python/py.typed +1 -0
- egain_api_python/retrieve.py +265 -0
- egain_api_python/sdk.py +216 -0
- egain_api_python/sdkconfiguration.py +50 -0
- egain_api_python/search.py +251 -0
- egain_api_python/types/__init__.py +21 -0
- egain_api_python/types/basemodel.py +39 -0
- egain_api_python/usermilestones.py +219 -0
- egain_api_python/utils/__init__.py +200 -0
- egain_api_python/utils/annotations.py +79 -0
- egain_api_python/utils/datetimes.py +23 -0
- egain_api_python/utils/enums.py +74 -0
- egain_api_python/utils/eventstreaming.py +248 -0
- egain_api_python/utils/forms.py +223 -0
- egain_api_python/utils/headers.py +136 -0
- egain_api_python/utils/logger.py +27 -0
- egain_api_python/utils/metadata.py +118 -0
- egain_api_python/utils/queryparams.py +205 -0
- egain_api_python/utils/requestbodies.py +66 -0
- egain_api_python/utils/retries.py +217 -0
- egain_api_python/utils/security.py +192 -0
- egain_api_python/utils/serializers.py +249 -0
- egain_api_python/utils/unmarshal_json_response.py +24 -0
- egain_api_python/utils/url.py +155 -0
- egain_api_python/utils/values.py +137 -0
- egain_api_python-0.1.1.dist-info/METADATA +827 -0
- egain_api_python-0.1.1.dist-info/RECORD +332 -0
- egain_api_python-0.1.1.dist-info/WHEEL +5 -0
- egain_api_python-0.1.1.dist-info/licenses/LICENSE +21 -0
- egain_api_python-0.1.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,827 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: egain-api-python
|
3
|
+
Version: 0.1.1
|
4
|
+
Summary: Python Client SDK Generated by Speakeasy.
|
5
|
+
Author: Speakeasy
|
6
|
+
Requires-Python: >=3.9.2
|
7
|
+
Description-Content-Type: text/markdown
|
8
|
+
License-File: LICENSE
|
9
|
+
Requires-Dist: httpcore>=1.0.9
|
10
|
+
Requires-Dist: httpx>=0.28.1
|
11
|
+
Requires-Dist: pydantic>=2.11.2
|
12
|
+
Dynamic: license-file
|
13
|
+
|
14
|
+
# egain-api-python
|
15
|
+
|
16
|
+
Developer-friendly & type-safe Python SDK specifically catered to leverage *egain-api-python* API.
|
17
|
+
|
18
|
+
<div align="left">
|
19
|
+
<a href="https://www.speakeasy.com/?utm_source=egain-api-python&utm_campaign=python"><img src="https://www.speakeasy.com/assets/badges/built-by-speakeasy.svg" /></a>
|
20
|
+
<a href="https://opensource.org/licenses/MIT">
|
21
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
|
22
|
+
</a>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<!-- Start Summary [summary] -->
|
26
|
+
## Summary
|
27
|
+
|
28
|
+
Knowledge Portal Manager APIs: ### License
|
29
|
+
The following licenses are required to use the Knowledge Access APIs:
|
30
|
+
* If the user is an agent, then the *Knowledge + AI* license is required.
|
31
|
+
* If the user is a customer, the *Self-Service* and *Advanced Self-Service* licenses must be available.
|
32
|
+
### API Resource Limits
|
33
|
+
The following Resources have predefined limits for specific access attributes for Enterprise use.
|
34
|
+
|
35
|
+
| Resource | Attribute | Enterprise
|
36
|
+
| ---------------- | ---------------------------- | ----------
|
37
|
+
| Article Reference Limits |Number of attachments used in any article | 50
|
38
|
+
| |Number of custom attributes in an article | 15
|
39
|
+
| |Number of publish views used in an article version | 20
|
40
|
+
| Topic Reference Limits |User-defined topics in a department| 50000
|
41
|
+
| |Depth of topics | 20
|
42
|
+
| |Topics at any level | 2500
|
43
|
+
| |Number of custom attributes in a topic | 15
|
44
|
+
| Portal Reference Limits | Tag categories in a portal | 15
|
45
|
+
| |Topics to be included in a portal | 2500
|
46
|
+
| |Number of articles to display in announcements | 25
|
47
|
+
| |Maximum related articles in portal setting | 100
|
48
|
+
| |Usage links and link groups setup for a portal | 25
|
49
|
+
<!-- End Summary [summary] -->
|
50
|
+
|
51
|
+
<!-- Start Table of Contents [toc] -->
|
52
|
+
## Table of Contents
|
53
|
+
<!-- $toc-max-depth=2 -->
|
54
|
+
* [egain-api-python](#egain-api-python)
|
55
|
+
* [SDK Installation](#sdk-installation)
|
56
|
+
* [IDE Support](#ide-support)
|
57
|
+
* [SDK Example Usage](#sdk-example-usage)
|
58
|
+
* [Authentication](#authentication)
|
59
|
+
* [Available Resources and Operations](#available-resources-and-operations)
|
60
|
+
* [File uploads](#file-uploads)
|
61
|
+
* [Retries](#retries)
|
62
|
+
* [Error Handling](#error-handling)
|
63
|
+
* [Server Selection](#server-selection)
|
64
|
+
* [Custom HTTP Client](#custom-http-client)
|
65
|
+
* [Resource Management](#resource-management)
|
66
|
+
* [Debugging](#debugging)
|
67
|
+
* [Development](#development)
|
68
|
+
* [Maturity](#maturity)
|
69
|
+
* [Contributions](#contributions)
|
70
|
+
|
71
|
+
<!-- End Table of Contents [toc] -->
|
72
|
+
|
73
|
+
<!-- Start SDK Installation [installation] -->
|
74
|
+
## SDK Installation
|
75
|
+
|
76
|
+
> [!NOTE]
|
77
|
+
> **Python version upgrade policy**
|
78
|
+
>
|
79
|
+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
80
|
+
|
81
|
+
The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
|
82
|
+
|
83
|
+
### uv
|
84
|
+
|
85
|
+
*uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
|
86
|
+
|
87
|
+
```bash
|
88
|
+
uv add egain-api-python
|
89
|
+
```
|
90
|
+
|
91
|
+
### PIP
|
92
|
+
|
93
|
+
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
|
94
|
+
|
95
|
+
```bash
|
96
|
+
pip install egain-api-python
|
97
|
+
```
|
98
|
+
|
99
|
+
### Poetry
|
100
|
+
|
101
|
+
*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
|
102
|
+
|
103
|
+
```bash
|
104
|
+
poetry add egain-api-python
|
105
|
+
```
|
106
|
+
|
107
|
+
### Shell and script usage with `uv`
|
108
|
+
|
109
|
+
You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
|
110
|
+
|
111
|
+
```shell
|
112
|
+
uvx --from egain-api-python python
|
113
|
+
```
|
114
|
+
|
115
|
+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
|
116
|
+
|
117
|
+
```python
|
118
|
+
#!/usr/bin/env -S uv run --script
|
119
|
+
# /// script
|
120
|
+
# requires-python = ">=3.9"
|
121
|
+
# dependencies = [
|
122
|
+
# "egain-api-python",
|
123
|
+
# ]
|
124
|
+
# ///
|
125
|
+
|
126
|
+
from egain_api_python import Egain
|
127
|
+
|
128
|
+
sdk = Egain(
|
129
|
+
# SDK arguments
|
130
|
+
)
|
131
|
+
|
132
|
+
# Rest of script here...
|
133
|
+
```
|
134
|
+
|
135
|
+
Once that is saved to a file, you can run it with `uv run script.py` where
|
136
|
+
`script.py` can be replaced with the actual file name.
|
137
|
+
<!-- End SDK Installation [installation] -->
|
138
|
+
|
139
|
+
<!-- Start IDE Support [idesupport] -->
|
140
|
+
## IDE Support
|
141
|
+
|
142
|
+
### PyCharm
|
143
|
+
|
144
|
+
Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
|
145
|
+
|
146
|
+
- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
|
147
|
+
<!-- End IDE Support [idesupport] -->
|
148
|
+
|
149
|
+
<!-- Start SDK Example Usage [usage] -->
|
150
|
+
## SDK Example Usage
|
151
|
+
|
152
|
+
### Example
|
153
|
+
|
154
|
+
```python
|
155
|
+
# Synchronous Example
|
156
|
+
from egain_api_python import Egain
|
157
|
+
import os
|
158
|
+
|
159
|
+
|
160
|
+
with Egain(
|
161
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
162
|
+
) as egain:
|
163
|
+
|
164
|
+
res = egain.aiservices.retrieve.post_portal_id_retrieve(q="fair lending", portal_id="PROD-1000", dollar_filter_user_profile_id="PROD-3210", language="en-US", dollar_filter_tags={
|
165
|
+
"PROD-1234": [
|
166
|
+
"PROD-2000",
|
167
|
+
"PROD-2003",
|
168
|
+
],
|
169
|
+
"PROD-2005": [
|
170
|
+
"PROD-2007",
|
171
|
+
],
|
172
|
+
}, channel={
|
173
|
+
"name": "Eight Bank Website",
|
174
|
+
})
|
175
|
+
|
176
|
+
# Handle response
|
177
|
+
print(res)
|
178
|
+
```
|
179
|
+
|
180
|
+
</br>
|
181
|
+
|
182
|
+
The same SDK client can also be used to make asynchronous requests by importing asyncio.
|
183
|
+
|
184
|
+
```python
|
185
|
+
# Asynchronous Example
|
186
|
+
import asyncio
|
187
|
+
from egain_api_python import Egain
|
188
|
+
import os
|
189
|
+
|
190
|
+
async def main():
|
191
|
+
|
192
|
+
async with Egain(
|
193
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
194
|
+
) as egain:
|
195
|
+
|
196
|
+
res = await egain.aiservices.retrieve.post_portal_id_retrieve_async(q="fair lending", portal_id="PROD-1000", dollar_filter_user_profile_id="PROD-3210", language="en-US", dollar_filter_tags={
|
197
|
+
"PROD-1234": [
|
198
|
+
"PROD-2000",
|
199
|
+
"PROD-2003",
|
200
|
+
],
|
201
|
+
"PROD-2005": [
|
202
|
+
"PROD-2007",
|
203
|
+
],
|
204
|
+
}, channel={
|
205
|
+
"name": "Eight Bank Website",
|
206
|
+
})
|
207
|
+
|
208
|
+
# Handle response
|
209
|
+
print(res)
|
210
|
+
|
211
|
+
asyncio.run(main())
|
212
|
+
```
|
213
|
+
<!-- End SDK Example Usage [usage] -->
|
214
|
+
|
215
|
+
<!-- Start Authentication [security] -->
|
216
|
+
## Authentication
|
217
|
+
|
218
|
+
### Per-Client Security Schemes
|
219
|
+
|
220
|
+
This SDK supports the following security scheme globally:
|
221
|
+
|
222
|
+
| Name | Type | Scheme | Environment Variable |
|
223
|
+
| -------------- | ---- | ----------- | -------------------- |
|
224
|
+
| `access_token` | http | HTTP Bearer | `EGAIN_ACCESS_TOKEN` |
|
225
|
+
|
226
|
+
To authenticate with the API the `access_token` parameter must be set when initializing the SDK client instance. For example:
|
227
|
+
```python
|
228
|
+
from egain_api_python import Egain
|
229
|
+
import os
|
230
|
+
|
231
|
+
|
232
|
+
with Egain(
|
233
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
234
|
+
) as egain:
|
235
|
+
|
236
|
+
res = egain.aiservices.retrieve.post_portal_id_retrieve(q="fair lending", portal_id="PROD-1000", dollar_filter_user_profile_id="PROD-3210", language="en-US", dollar_filter_tags={
|
237
|
+
"PROD-1234": [
|
238
|
+
"PROD-2000",
|
239
|
+
"PROD-2003",
|
240
|
+
],
|
241
|
+
"PROD-2005": [
|
242
|
+
"PROD-2007",
|
243
|
+
],
|
244
|
+
}, channel={
|
245
|
+
"name": "Eight Bank Website",
|
246
|
+
})
|
247
|
+
|
248
|
+
# Handle response
|
249
|
+
print(res)
|
250
|
+
|
251
|
+
```
|
252
|
+
<!-- End Authentication [security] -->
|
253
|
+
|
254
|
+
<!-- Start Available Resources and Operations [operations] -->
|
255
|
+
## Available Resources and Operations
|
256
|
+
|
257
|
+
<details open>
|
258
|
+
<summary>Available methods</summary>
|
259
|
+
|
260
|
+
### [aiservices](docs/sdks/aiservices/README.md)
|
261
|
+
|
262
|
+
|
263
|
+
#### [aiservices.answers](docs/sdks/answers/README.md)
|
264
|
+
|
265
|
+
* [post_portal_id_answers](docs/sdks/answers/README.md#post_portal_id_answers) - Get the best answer for a user query
|
266
|
+
|
267
|
+
#### [aiservices.retrieve](docs/sdks/retrieve/README.md)
|
268
|
+
|
269
|
+
* [post_portal_id_retrieve](docs/sdks/retrieve/README.md#post_portal_id_retrieve) - Retrieve Chunks
|
270
|
+
|
271
|
+
### [content](docs/sdks/content/README.md)
|
272
|
+
|
273
|
+
|
274
|
+
#### [content.health](docs/sdks/health/README.md)
|
275
|
+
|
276
|
+
* [get_health](docs/sdks/health/README.md#get_health) - Check service health status
|
277
|
+
|
278
|
+
#### [content.import_](docs/sdks/import/README.md)
|
279
|
+
|
280
|
+
* [create_import](docs/sdks/import/README.md#create_import) - Import content from external sources
|
281
|
+
* [get_import_content](docs/sdks/import/README.md#get_import_content) - Get the current status of an import or validation job
|
282
|
+
* [create_import_validation](docs/sdks/import/README.md#create_import_validation) - Validate content structure and format before import
|
283
|
+
* [patch_import_content_validation](docs/sdks/import/README.md#patch_import_content_validation) - Cancel an import or validation job
|
284
|
+
|
285
|
+
|
286
|
+
### [portal](docs/sdks/portalsdk/README.md)
|
287
|
+
|
288
|
+
|
289
|
+
#### [portal.article](docs/sdks/portalarticle/README.md)
|
290
|
+
|
291
|
+
* [get_article_by_id](docs/sdks/portalarticle/README.md#get_article_by_id) - Get Article by ID
|
292
|
+
* [get_article_by_id_with_editions](docs/sdks/portalarticle/README.md#get_article_by_id_with_editions) - Get Article By ID with Editions
|
293
|
+
* [get_article_edition_details](docs/sdks/portalarticle/README.md#get_article_edition_details) - Get Article Edition Details
|
294
|
+
* [add_to_reply](docs/sdks/portalarticle/README.md#add_to_reply) - Add Article to Reply
|
295
|
+
* [add_as_reference](docs/sdks/portalarticle/README.md#add_as_reference) - Add as Reference
|
296
|
+
* [get_articles_in_topic](docs/sdks/portalarticle/README.md#get_articles_in_topic) - Get Articles in Topic
|
297
|
+
* [get_article_attachment_by_id](docs/sdks/portalarticle/README.md#get_article_attachment_by_id) - Get Article Attachment By ID
|
298
|
+
* [get_attachment_by_id_in_portal](docs/sdks/portalarticle/README.md#get_attachment_by_id_in_portal) - Get Article Attachment in Portal
|
299
|
+
* [get_related_articles](docs/sdks/portalarticle/README.md#get_related_articles) - Get Related Articles
|
300
|
+
* [get_announcement_articles](docs/sdks/portalarticle/README.md#get_announcement_articles) - Get Announcement Articles
|
301
|
+
* [get_article_ratings](docs/sdks/portalarticle/README.md#get_article_ratings) - Get Article Ratings
|
302
|
+
* [rate_article](docs/sdks/portalarticle/README.md#rate_article) - Rate an Article
|
303
|
+
* [get_pending_compliance_articles](docs/sdks/portalarticle/README.md#get_pending_compliance_articles) - Get Pending Article Compliances
|
304
|
+
* [get_acknowledged_compliance_articles](docs/sdks/portalarticle/README.md#get_acknowledged_compliance_articles) - Get Acknowledged Article Compliances
|
305
|
+
* [comply_article](docs/sdks/portalarticle/README.md#comply_article) - Comply With an Article
|
306
|
+
* [get_my_subscription](docs/sdks/portalarticle/README.md#get_my_subscription) - My Subscription
|
307
|
+
* [subscribe_article](docs/sdks/portalarticle/README.md#subscribe_article) - Subscribe to an Article
|
308
|
+
* [unsubscribe_article](docs/sdks/portalarticle/README.md#unsubscribe_article) - Unsubscribe to an Article
|
309
|
+
* [get_article_permissions_by_id](docs/sdks/portalarticle/README.md#get_article_permissions_by_id) - Get Article Permissions By ID
|
310
|
+
* [get_article_personalization](docs/sdks/portalarticle/README.md#get_article_personalization) - Get Article Personalization Details
|
311
|
+
|
312
|
+
#### [portal.articlelists](docs/sdks/articlelists/README.md)
|
313
|
+
|
314
|
+
* [get_all_article_lists](docs/sdks/articlelists/README.md#get_all_article_lists) - Get All Article Lists
|
315
|
+
* [get_article_list_details](docs/sdks/articlelists/README.md#get_article_list_details) - Get Article List by ID
|
316
|
+
|
317
|
+
#### [portal.attachment](docs/sdks/portalattachment/README.md)
|
318
|
+
|
319
|
+
* [create_signed_url](docs/sdks/portalattachment/README.md#create_signed_url) - Generate Signed URL to Upload API
|
320
|
+
* [upload_attachment](docs/sdks/portalattachment/README.md#upload_attachment) - Upload Attachment
|
321
|
+
|
322
|
+
#### [portal.bookmark](docs/sdks/portalbookmark/README.md)
|
323
|
+
|
324
|
+
* [addbookmark](docs/sdks/portalbookmark/README.md#addbookmark) - Add a Bookmark
|
325
|
+
* [getbookmark](docs/sdks/portalbookmark/README.md#getbookmark) - Get All Bookmarks for a Portal
|
326
|
+
* [deletebookmark](docs/sdks/portalbookmark/README.md#deletebookmark) - Delete a Bookmark
|
327
|
+
|
328
|
+
#### [portal.connectorssearchevents](docs/sdks/connectorssearchevents/README.md)
|
329
|
+
|
330
|
+
* [create_search_result_event_for_connectors](docs/sdks/connectorssearchevents/README.md#create_search_result_event_for_connectors) - Event for Search Using Connectors
|
331
|
+
* [create_viewed_search_results_event_for_connectors](docs/sdks/connectorssearchevents/README.md#create_viewed_search_results_event_for_connectors) - Event for Viewed Search Results Using Connectors
|
332
|
+
|
333
|
+
#### [portal.escalation](docs/sdks/escalation/README.md)
|
334
|
+
|
335
|
+
* [start_customer_escalation](docs/sdks/escalation/README.md#start_customer_escalation) - Start Customer Escalation
|
336
|
+
* [search_prior_to_escalation](docs/sdks/escalation/README.md#search_prior_to_escalation) - Search Prior To Customer Escalation
|
337
|
+
* [complete_customer_escalation](docs/sdks/escalation/README.md#complete_customer_escalation) - Complete Customer Escalation
|
338
|
+
* [avert_customer_escalation](docs/sdks/escalation/README.md#avert_customer_escalation) - Avert Customer Escalation
|
339
|
+
|
340
|
+
#### [portal.export](docs/sdks/export/README.md)
|
341
|
+
|
342
|
+
* [export_content](docs/sdks/export/README.md#export_content) - Export Knowledge
|
343
|
+
* [export_status](docs/sdks/export/README.md#export_status) - Get Export Job Status
|
344
|
+
|
345
|
+
#### [portal.federatedsearchevent](docs/sdks/federatedsearchevent/README.md)
|
346
|
+
|
347
|
+
* [create_federated_search_result_event](docs/sdks/federatedsearchevent/README.md#create_federated_search_result_event) - Event For Viewed Federated Search Result
|
348
|
+
|
349
|
+
#### [portal.general](docs/sdks/general/README.md)
|
350
|
+
|
351
|
+
* [get_all_portals](docs/sdks/general/README.md#get_all_portals) - Get All Portals
|
352
|
+
* [get_my_portals](docs/sdks/general/README.md#get_my_portals) - Get All Portals Accessible To User
|
353
|
+
* [get_portal_details_by_id](docs/sdks/general/README.md#get_portal_details_by_id) - Get Portal Details By ID
|
354
|
+
* [get_tag_categories_for_interest_for_portal](docs/sdks/general/README.md#get_tag_categories_for_interest_for_portal) - Get Tag Categories for Interest for a Portal
|
355
|
+
|
356
|
+
#### [portal.guidedhelp](docs/sdks/guidedhelp/README.md)
|
357
|
+
|
358
|
+
* [get_all_casebases_releases](docs/sdks/guidedhelp/README.md#get_all_casebases_releases) - Get Available Casebases Releases
|
359
|
+
* [get_casebase_release_by_id](docs/sdks/guidedhelp/README.md#get_casebase_release_by_id) - Get Details of a Casebase Release
|
360
|
+
* [get_cluster_by_casebase_release_id](docs/sdks/guidedhelp/README.md#get_cluster_by_casebase_release_id) - Get Cluster Details of a Casebase Release
|
361
|
+
* [get_all_profiles_in_portal](docs/sdks/guidedhelp/README.md#get_all_profiles_in_portal) - Get All Profiles Available in Portal
|
362
|
+
* [start_gh_search](docs/sdks/guidedhelp/README.md#start_gh_search) - Start a Guided Help Search
|
363
|
+
* [step_gh_search](docs/sdks/guidedhelp/README.md#step_gh_search) - Perform a Step in a Guided Help Search
|
364
|
+
* [get_all_cases](docs/sdks/guidedhelp/README.md#get_all_cases) - Get All Cases of a Cluster in Release
|
365
|
+
* [get_case_by_id](docs/sdks/guidedhelp/README.md#get_case_by_id) - Get Details of a Case
|
366
|
+
* [accept_gh_solution](docs/sdks/guidedhelp/README.md#accept_gh_solution) - Accept Solution
|
367
|
+
* [reject_gh_solution](docs/sdks/guidedhelp/README.md#reject_gh_solution) - Reject Solution
|
368
|
+
* [create_quickpick](docs/sdks/guidedhelp/README.md#create_quickpick) - Create Quickpick
|
369
|
+
* [get_all_quick_picks](docs/sdks/guidedhelp/README.md#get_all_quick_picks) - Get All Quickpicks for a Portal
|
370
|
+
* [restore_quickpick](docs/sdks/guidedhelp/README.md#restore_quickpick) - Resume a Quickpick
|
371
|
+
|
372
|
+
#### [portal.populararticles](docs/sdks/populararticles/README.md)
|
373
|
+
|
374
|
+
* [getpopulararticles](docs/sdks/populararticles/README.md#getpopulararticles) - Get Popular Articles
|
375
|
+
|
376
|
+
#### [portal.search](docs/sdks/search/README.md)
|
377
|
+
|
378
|
+
* [ai_search](docs/sdks/search/README.md#ai_search) - Get the best search results for a user query
|
379
|
+
|
380
|
+
#### [portal.suggestion](docs/sdks/portalsuggestion/README.md)
|
381
|
+
|
382
|
+
* [make_suggestion](docs/sdks/portalsuggestion/README.md#make_suggestion) - Make a Suggestion
|
383
|
+
* [modify_suggestions](docs/sdks/portalsuggestion/README.md#modify_suggestions) - Modify Suggestion
|
384
|
+
* [search_suggestion](docs/sdks/portalsuggestion/README.md#search_suggestion) - Get Suggestion by Status
|
385
|
+
* [get_suggestion](docs/sdks/portalsuggestion/README.md#get_suggestion) - Get Suggestion by ID
|
386
|
+
* [delete_suggestion](docs/sdks/portalsuggestion/README.md#delete_suggestion) - Delete a Suggestion
|
387
|
+
* [get_related_articles_for_suggestion](docs/sdks/portalsuggestion/README.md#get_related_articles_for_suggestion) - Get Related Articles for Suggestion
|
388
|
+
* [get_suggestion_comments](docs/sdks/portalsuggestion/README.md#get_suggestion_comments) - Get Suggestion Comments
|
389
|
+
* [get_suggestion_attachments](docs/sdks/portalsuggestion/README.md#get_suggestion_attachments) - Get Suggestion Attachments
|
390
|
+
* [get_suggestion_attachment_by_id](docs/sdks/portalsuggestion/README.md#get_suggestion_attachment_by_id) - Get Suggestion Attachment by ID
|
391
|
+
|
392
|
+
#### [portal.topic](docs/sdks/portaltopic/README.md)
|
393
|
+
|
394
|
+
* [get_topic_breadcrumb_for_article](docs/sdks/portaltopic/README.md#get_topic_breadcrumb_for_article) - Get Topic Breadcrumb for Article
|
395
|
+
* [getchildtopics](docs/sdks/portaltopic/README.md#getchildtopics) - Get Immediate Child Topics
|
396
|
+
* [getancestortopics](docs/sdks/portaltopic/README.md#getancestortopics) - Get All Ancestor Topics
|
397
|
+
* [getalltopics](docs/sdks/portaltopic/README.md#getalltopics) - Get All Topics
|
398
|
+
|
399
|
+
#### [portal.userdetails](docs/sdks/portaluserdetails/README.md)
|
400
|
+
|
401
|
+
* [get_user_details](docs/sdks/portaluserdetails/README.md#get_user_details) - Get User Details
|
402
|
+
|
403
|
+
#### [portal.usermilestones](docs/sdks/usermilestones/README.md)
|
404
|
+
|
405
|
+
* [get_user_milestones](docs/sdks/usermilestones/README.md#get_user_milestones) - Get User Milestones
|
406
|
+
|
407
|
+
#### [portal.userprofile](docs/sdks/portaluserprofile/README.md)
|
408
|
+
|
409
|
+
* [get_all_user_profiles](docs/sdks/portaluserprofile/README.md#get_all_user_profiles) - Get All User Profiles Assigned to User
|
410
|
+
* [select_user_profile](docs/sdks/portaluserprofile/README.md#select_user_profile) - Select User Profile
|
411
|
+
|
412
|
+
</details>
|
413
|
+
<!-- End Available Resources and Operations [operations] -->
|
414
|
+
|
415
|
+
<!-- Start File uploads [file-upload] -->
|
416
|
+
## File uploads
|
417
|
+
|
418
|
+
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
|
419
|
+
|
420
|
+
> [!TIP]
|
421
|
+
>
|
422
|
+
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
|
423
|
+
>
|
424
|
+
|
425
|
+
```python
|
426
|
+
from egain_api_python import Egain
|
427
|
+
import os
|
428
|
+
|
429
|
+
|
430
|
+
with Egain(
|
431
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
432
|
+
) as egain:
|
433
|
+
|
434
|
+
egain.portal.attachment.upload_attachment(accept_language="en-US", signature="<value>", request_body=open("example.file", "rb"))
|
435
|
+
|
436
|
+
# Use the SDK ...
|
437
|
+
|
438
|
+
```
|
439
|
+
<!-- End File uploads [file-upload] -->
|
440
|
+
|
441
|
+
<!-- Start Retries [retries] -->
|
442
|
+
## Retries
|
443
|
+
|
444
|
+
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
|
445
|
+
|
446
|
+
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
|
447
|
+
```python
|
448
|
+
from egain_api_python import Egain
|
449
|
+
from egain_api_python.utils import BackoffStrategy, RetryConfig
|
450
|
+
import os
|
451
|
+
|
452
|
+
|
453
|
+
with Egain(
|
454
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
455
|
+
) as egain:
|
456
|
+
|
457
|
+
res = egain.aiservices.retrieve.post_portal_id_retrieve(q="fair lending", portal_id="PROD-1000", dollar_filter_user_profile_id="PROD-3210", language="en-US", dollar_filter_tags={
|
458
|
+
"PROD-1234": [
|
459
|
+
"PROD-2000",
|
460
|
+
"PROD-2003",
|
461
|
+
],
|
462
|
+
"PROD-2005": [
|
463
|
+
"PROD-2007",
|
464
|
+
],
|
465
|
+
}, channel={
|
466
|
+
"name": "Eight Bank Website",
|
467
|
+
},
|
468
|
+
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
469
|
+
|
470
|
+
# Handle response
|
471
|
+
print(res)
|
472
|
+
|
473
|
+
```
|
474
|
+
|
475
|
+
If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
|
476
|
+
```python
|
477
|
+
from egain_api_python import Egain
|
478
|
+
from egain_api_python.utils import BackoffStrategy, RetryConfig
|
479
|
+
import os
|
480
|
+
|
481
|
+
|
482
|
+
with Egain(
|
483
|
+
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
|
484
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
485
|
+
) as egain:
|
486
|
+
|
487
|
+
res = egain.aiservices.retrieve.post_portal_id_retrieve(q="fair lending", portal_id="PROD-1000", dollar_filter_user_profile_id="PROD-3210", language="en-US", dollar_filter_tags={
|
488
|
+
"PROD-1234": [
|
489
|
+
"PROD-2000",
|
490
|
+
"PROD-2003",
|
491
|
+
],
|
492
|
+
"PROD-2005": [
|
493
|
+
"PROD-2007",
|
494
|
+
],
|
495
|
+
}, channel={
|
496
|
+
"name": "Eight Bank Website",
|
497
|
+
})
|
498
|
+
|
499
|
+
# Handle response
|
500
|
+
print(res)
|
501
|
+
|
502
|
+
```
|
503
|
+
<!-- End Retries [retries] -->
|
504
|
+
|
505
|
+
<!-- Start Error Handling [errors] -->
|
506
|
+
## Error Handling
|
507
|
+
|
508
|
+
[`EgainError`](./src/egain_api_python/errors/egainerror.py) is the base class for all HTTP error responses. It has the following properties:
|
509
|
+
|
510
|
+
| Property | Type | Description |
|
511
|
+
| ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
|
512
|
+
| `err.message` | `str` | Error message |
|
513
|
+
| `err.status_code` | `int` | HTTP response status code eg `404` |
|
514
|
+
| `err.headers` | `httpx.Headers` | HTTP response headers |
|
515
|
+
| `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
|
516
|
+
| `err.raw_response` | `httpx.Response` | Raw HTTP response |
|
517
|
+
| `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
|
518
|
+
|
519
|
+
### Example
|
520
|
+
```python
|
521
|
+
from egain_api_python import Egain, errors
|
522
|
+
from egain_api_python.utils import parse_datetime
|
523
|
+
import os
|
524
|
+
|
525
|
+
|
526
|
+
with Egain(
|
527
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
528
|
+
) as egain:
|
529
|
+
res = None
|
530
|
+
try:
|
531
|
+
|
532
|
+
res = egain.content.import_.create_import(data_source={
|
533
|
+
"type": "AWS S3 bucket",
|
534
|
+
"path": "s3://mybucket/myfolder/",
|
535
|
+
"region": "us-east-1",
|
536
|
+
"credentials": {},
|
537
|
+
}, operation="import", schedule_time={
|
538
|
+
"date_": parse_datetime("2024-03-01T10:00:00.000Z"),
|
539
|
+
})
|
540
|
+
|
541
|
+
# Handle response
|
542
|
+
print(res)
|
543
|
+
|
544
|
+
|
545
|
+
except errors.EgainError as e:
|
546
|
+
# The base class for HTTP error responses
|
547
|
+
print(e.message)
|
548
|
+
print(e.status_code)
|
549
|
+
print(e.body)
|
550
|
+
print(e.headers)
|
551
|
+
print(e.raw_response)
|
552
|
+
|
553
|
+
# Depending on the method different errors may be thrown
|
554
|
+
if isinstance(e, errors.WSErrorCommon):
|
555
|
+
print(e.data.code) # str
|
556
|
+
print(e.data.developer_message) # str
|
557
|
+
print(e.data.details) # Optional[List[models.WSErrorCommonDetail]]
|
558
|
+
print(e.data.user_message) # Optional[str]
|
559
|
+
```
|
560
|
+
|
561
|
+
### Error Classes
|
562
|
+
**Primary errors:**
|
563
|
+
* [`EgainError`](./src/egain_api_python/errors/egainerror.py): The base class for HTTP error responses.
|
564
|
+
* [`WSErrorCommon`](./src/egain_api_python/errors/wserrorcommon.py): Bad Request. *
|
565
|
+
|
566
|
+
<details><summary>Less common errors (7)</summary>
|
567
|
+
|
568
|
+
<br />
|
569
|
+
|
570
|
+
**Network errors:**
|
571
|
+
* [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
|
572
|
+
* [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
|
573
|
+
* [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
|
574
|
+
|
575
|
+
|
576
|
+
**Inherit from [`EgainError`](./src/egain_api_python/errors/egainerror.py)**:
|
577
|
+
* [`SchemasWSErrorCommon`](./src/egain_api_python/errors/schemaswserrorcommon.py): Preconditions failed. Status code `412`. Applicable to 2 of 79 methods.*
|
578
|
+
* [`ServiceUnavailableError`](./src/egain_api_python/errors/serviceunavailableerror.py): ## Service is Unhealthy The Import Content service is experiencing critical issues and may not be able to process requests properly. **Health Status Details:** - **Overall Status**: Service is unhealthy and may not function correctly **Response Information:** - **Status**: Current health state (unhealthy) - **Timestamp**: When health check was performed - **Version**: Current API version - **Issues**: List of detected health problems. Status code `503`. Applicable to 1 of 79 methods.*
|
579
|
+
* [`ResponseValidationError`](./src/egain_api_python/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
|
580
|
+
|
581
|
+
</details>
|
582
|
+
|
583
|
+
\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
|
584
|
+
<!-- End Error Handling [errors] -->
|
585
|
+
|
586
|
+
<!-- Start Server Selection [server] -->
|
587
|
+
## Server Selection
|
588
|
+
|
589
|
+
### Server Variables
|
590
|
+
|
591
|
+
The default server `https://${API_DOMAIN}/knowledge/portalmgr/v4` contains variables and is set to `https://$api.egain.cloud/knowledge/portalmgr/v4` by default. To override default values, the following parameters are available when initializing the SDK client instance:
|
592
|
+
|
593
|
+
| Variable | Parameter | Default | Description |
|
594
|
+
| ------------ | ----------------- | ------------------- | ----------- |
|
595
|
+
| `API_DOMAIN` | `api_domain: str` | `"api.egain.cloud"` | |
|
596
|
+
|
597
|
+
#### Example
|
598
|
+
|
599
|
+
```python
|
600
|
+
from egain_api_python import Egain
|
601
|
+
import os
|
602
|
+
|
603
|
+
|
604
|
+
with Egain(
|
605
|
+
api_domain="<value>"
|
606
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
607
|
+
) as egain:
|
608
|
+
|
609
|
+
res = egain.aiservices.retrieve.post_portal_id_retrieve(q="fair lending", portal_id="PROD-1000", dollar_filter_user_profile_id="PROD-3210", language="en-US", dollar_filter_tags={
|
610
|
+
"PROD-1234": [
|
611
|
+
"PROD-2000",
|
612
|
+
"PROD-2003",
|
613
|
+
],
|
614
|
+
"PROD-2005": [
|
615
|
+
"PROD-2007",
|
616
|
+
],
|
617
|
+
}, channel={
|
618
|
+
"name": "Eight Bank Website",
|
619
|
+
})
|
620
|
+
|
621
|
+
# Handle response
|
622
|
+
print(res)
|
623
|
+
|
624
|
+
```
|
625
|
+
|
626
|
+
### Override Server URL Per-Client
|
627
|
+
|
628
|
+
The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
|
629
|
+
```python
|
630
|
+
from egain_api_python import Egain
|
631
|
+
import os
|
632
|
+
|
633
|
+
|
634
|
+
with Egain(
|
635
|
+
server_url="https://$api.egain.cloud/knowledge/portalmgr/v4",
|
636
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
637
|
+
) as egain:
|
638
|
+
|
639
|
+
res = egain.aiservices.retrieve.post_portal_id_retrieve(q="fair lending", portal_id="PROD-1000", dollar_filter_user_profile_id="PROD-3210", language="en-US", dollar_filter_tags={
|
640
|
+
"PROD-1234": [
|
641
|
+
"PROD-2000",
|
642
|
+
"PROD-2003",
|
643
|
+
],
|
644
|
+
"PROD-2005": [
|
645
|
+
"PROD-2007",
|
646
|
+
],
|
647
|
+
}, channel={
|
648
|
+
"name": "Eight Bank Website",
|
649
|
+
})
|
650
|
+
|
651
|
+
# Handle response
|
652
|
+
print(res)
|
653
|
+
|
654
|
+
```
|
655
|
+
|
656
|
+
### Override Server URL Per-Operation
|
657
|
+
|
658
|
+
The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:
|
659
|
+
```python
|
660
|
+
from egain_api_python import Egain
|
661
|
+
import os
|
662
|
+
|
663
|
+
|
664
|
+
with Egain(
|
665
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
666
|
+
) as egain:
|
667
|
+
|
668
|
+
res = egain.aiservices.retrieve.post_portal_id_retrieve(q="fair lending", portal_id="PROD-1000", dollar_filter_user_profile_id="PROD-3210", language="en-US", dollar_filter_tags={
|
669
|
+
"PROD-1234": [
|
670
|
+
"PROD-2000",
|
671
|
+
"PROD-2003",
|
672
|
+
],
|
673
|
+
"PROD-2005": [
|
674
|
+
"PROD-2007",
|
675
|
+
],
|
676
|
+
}, channel={
|
677
|
+
"name": "Eight Bank Website",
|
678
|
+
}, server_url="https://$api.egain.cloud/core/aiservices/v4")
|
679
|
+
|
680
|
+
# Handle response
|
681
|
+
print(res)
|
682
|
+
|
683
|
+
```
|
684
|
+
<!-- End Server Selection [server] -->
|
685
|
+
|
686
|
+
<!-- Start Custom HTTP Client [http-client] -->
|
687
|
+
## Custom HTTP Client
|
688
|
+
|
689
|
+
The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
|
690
|
+
Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
|
691
|
+
This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
|
692
|
+
|
693
|
+
For example, you could specify a header for every request that this sdk makes as follows:
|
694
|
+
```python
|
695
|
+
from egain_api_python import Egain
|
696
|
+
import httpx
|
697
|
+
|
698
|
+
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
|
699
|
+
s = Egain(client=http_client)
|
700
|
+
```
|
701
|
+
|
702
|
+
or you could wrap the client with your own custom logic:
|
703
|
+
```python
|
704
|
+
from egain_api_python import Egain
|
705
|
+
from egain_api_python.httpclient import AsyncHttpClient
|
706
|
+
import httpx
|
707
|
+
|
708
|
+
class CustomClient(AsyncHttpClient):
|
709
|
+
client: AsyncHttpClient
|
710
|
+
|
711
|
+
def __init__(self, client: AsyncHttpClient):
|
712
|
+
self.client = client
|
713
|
+
|
714
|
+
async def send(
|
715
|
+
self,
|
716
|
+
request: httpx.Request,
|
717
|
+
*,
|
718
|
+
stream: bool = False,
|
719
|
+
auth: Union[
|
720
|
+
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
|
721
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
722
|
+
follow_redirects: Union[
|
723
|
+
bool, httpx._client.UseClientDefault
|
724
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
725
|
+
) -> httpx.Response:
|
726
|
+
request.headers["Client-Level-Header"] = "added by client"
|
727
|
+
|
728
|
+
return await self.client.send(
|
729
|
+
request, stream=stream, auth=auth, follow_redirects=follow_redirects
|
730
|
+
)
|
731
|
+
|
732
|
+
def build_request(
|
733
|
+
self,
|
734
|
+
method: str,
|
735
|
+
url: httpx._types.URLTypes,
|
736
|
+
*,
|
737
|
+
content: Optional[httpx._types.RequestContent] = None,
|
738
|
+
data: Optional[httpx._types.RequestData] = None,
|
739
|
+
files: Optional[httpx._types.RequestFiles] = None,
|
740
|
+
json: Optional[Any] = None,
|
741
|
+
params: Optional[httpx._types.QueryParamTypes] = None,
|
742
|
+
headers: Optional[httpx._types.HeaderTypes] = None,
|
743
|
+
cookies: Optional[httpx._types.CookieTypes] = None,
|
744
|
+
timeout: Union[
|
745
|
+
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
|
746
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
747
|
+
extensions: Optional[httpx._types.RequestExtensions] = None,
|
748
|
+
) -> httpx.Request:
|
749
|
+
return self.client.build_request(
|
750
|
+
method,
|
751
|
+
url,
|
752
|
+
content=content,
|
753
|
+
data=data,
|
754
|
+
files=files,
|
755
|
+
json=json,
|
756
|
+
params=params,
|
757
|
+
headers=headers,
|
758
|
+
cookies=cookies,
|
759
|
+
timeout=timeout,
|
760
|
+
extensions=extensions,
|
761
|
+
)
|
762
|
+
|
763
|
+
s = Egain(async_client=CustomClient(httpx.AsyncClient()))
|
764
|
+
```
|
765
|
+
<!-- End Custom HTTP Client [http-client] -->
|
766
|
+
|
767
|
+
<!-- Start Resource Management [resource-management] -->
|
768
|
+
## Resource Management
|
769
|
+
|
770
|
+
The `Egain` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
771
|
+
|
772
|
+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
773
|
+
|
774
|
+
```python
|
775
|
+
from egain_api_python import Egain
|
776
|
+
import os
|
777
|
+
def main():
|
778
|
+
|
779
|
+
with Egain(
|
780
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
781
|
+
) as egain:
|
782
|
+
# Rest of application here...
|
783
|
+
|
784
|
+
|
785
|
+
# Or when using async:
|
786
|
+
async def amain():
|
787
|
+
|
788
|
+
async with Egain(
|
789
|
+
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
|
790
|
+
) as egain:
|
791
|
+
# Rest of application here...
|
792
|
+
```
|
793
|
+
<!-- End Resource Management [resource-management] -->
|
794
|
+
|
795
|
+
<!-- Start Debugging [debug] -->
|
796
|
+
## Debugging
|
797
|
+
|
798
|
+
You can setup your SDK to emit debug logs for SDK requests and responses.
|
799
|
+
|
800
|
+
You can pass your own logger class directly into your SDK.
|
801
|
+
```python
|
802
|
+
from egain_api_python import Egain
|
803
|
+
import logging
|
804
|
+
|
805
|
+
logging.basicConfig(level=logging.DEBUG)
|
806
|
+
s = Egain(debug_logger=logging.getLogger("egain_api_python"))
|
807
|
+
```
|
808
|
+
|
809
|
+
You can also enable a default debug logger by setting an environment variable `EGAIN_DEBUG` to true.
|
810
|
+
<!-- End Debugging [debug] -->
|
811
|
+
|
812
|
+
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
813
|
+
|
814
|
+
# Development
|
815
|
+
|
816
|
+
## Maturity
|
817
|
+
|
818
|
+
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
819
|
+
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
820
|
+
looking for the latest version.
|
821
|
+
|
822
|
+
## Contributions
|
823
|
+
|
824
|
+
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
|
825
|
+
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
826
|
+
|
827
|
+
### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=egain-api-python&utm_campaign=python)
|