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,17 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
from ._version import (
|
4
|
+
__title__,
|
5
|
+
__version__,
|
6
|
+
__openapi_doc_version__,
|
7
|
+
__gen_version__,
|
8
|
+
__user_agent__,
|
9
|
+
)
|
10
|
+
from .sdk import *
|
11
|
+
from .sdkconfiguration import *
|
12
|
+
|
13
|
+
|
14
|
+
VERSION: str = __version__
|
15
|
+
OPENAPI_DOC_VERSION = __openapi_doc_version__
|
16
|
+
SPEAKEASY_GENERATOR_VERSION = __gen_version__
|
17
|
+
USER_AGENT = __user_agent__
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from .types import Hooks
|
2
|
+
|
3
|
+
|
4
|
+
# This file is only ever generated once on the first generation and then is free to be modified.
|
5
|
+
# Any hooks you wish to add should be registered in the init_hooks function. Feel free to define them
|
6
|
+
# in this file or in separate files in the hooks folder.
|
7
|
+
|
8
|
+
|
9
|
+
def init_hooks(hooks: Hooks):
|
10
|
+
# pylint: disable=unused-argument
|
11
|
+
"""Add hooks by calling hooks.register{sdk_init/before_request/after_success/after_error}Hook
|
12
|
+
with an instance of a hook that implements that specific Hook interface
|
13
|
+
Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance"""
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
import httpx
|
4
|
+
from .types import (
|
5
|
+
SDKInitHook,
|
6
|
+
BeforeRequestContext,
|
7
|
+
BeforeRequestHook,
|
8
|
+
AfterSuccessContext,
|
9
|
+
AfterSuccessHook,
|
10
|
+
AfterErrorContext,
|
11
|
+
AfterErrorHook,
|
12
|
+
Hooks,
|
13
|
+
)
|
14
|
+
from .registration import init_hooks
|
15
|
+
from typing import List, Optional, Tuple
|
16
|
+
from egain_api_python.sdkconfiguration import SDKConfiguration
|
17
|
+
|
18
|
+
|
19
|
+
class SDKHooks(Hooks):
|
20
|
+
def __init__(self) -> None:
|
21
|
+
self.sdk_init_hooks: List[SDKInitHook] = []
|
22
|
+
self.before_request_hooks: List[BeforeRequestHook] = []
|
23
|
+
self.after_success_hooks: List[AfterSuccessHook] = []
|
24
|
+
self.after_error_hooks: List[AfterErrorHook] = []
|
25
|
+
init_hooks(self)
|
26
|
+
|
27
|
+
def register_sdk_init_hook(self, hook: SDKInitHook) -> None:
|
28
|
+
self.sdk_init_hooks.append(hook)
|
29
|
+
|
30
|
+
def register_before_request_hook(self, hook: BeforeRequestHook) -> None:
|
31
|
+
self.before_request_hooks.append(hook)
|
32
|
+
|
33
|
+
def register_after_success_hook(self, hook: AfterSuccessHook) -> None:
|
34
|
+
self.after_success_hooks.append(hook)
|
35
|
+
|
36
|
+
def register_after_error_hook(self, hook: AfterErrorHook) -> None:
|
37
|
+
self.after_error_hooks.append(hook)
|
38
|
+
|
39
|
+
def sdk_init(self, config: SDKConfiguration) -> SDKConfiguration:
|
40
|
+
for hook in self.sdk_init_hooks:
|
41
|
+
config = hook.sdk_init(config)
|
42
|
+
return config
|
43
|
+
|
44
|
+
def before_request(
|
45
|
+
self, hook_ctx: BeforeRequestContext, request: httpx.Request
|
46
|
+
) -> httpx.Request:
|
47
|
+
for hook in self.before_request_hooks:
|
48
|
+
out = hook.before_request(hook_ctx, request)
|
49
|
+
if isinstance(out, Exception):
|
50
|
+
raise out
|
51
|
+
request = out
|
52
|
+
|
53
|
+
return request
|
54
|
+
|
55
|
+
def after_success(
|
56
|
+
self, hook_ctx: AfterSuccessContext, response: httpx.Response
|
57
|
+
) -> httpx.Response:
|
58
|
+
for hook in self.after_success_hooks:
|
59
|
+
out = hook.after_success(hook_ctx, response)
|
60
|
+
if isinstance(out, Exception):
|
61
|
+
raise out
|
62
|
+
response = out
|
63
|
+
return response
|
64
|
+
|
65
|
+
def after_error(
|
66
|
+
self,
|
67
|
+
hook_ctx: AfterErrorContext,
|
68
|
+
response: Optional[httpx.Response],
|
69
|
+
error: Optional[Exception],
|
70
|
+
) -> Tuple[Optional[httpx.Response], Optional[Exception]]:
|
71
|
+
for hook in self.after_error_hooks:
|
72
|
+
result = hook.after_error(hook_ctx, response, error)
|
73
|
+
if isinstance(result, Exception):
|
74
|
+
raise result
|
75
|
+
response, error = result
|
76
|
+
return response, error
|
@@ -0,0 +1,112 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
from abc import ABC, abstractmethod
|
4
|
+
from egain_api_python.sdkconfiguration import SDKConfiguration
|
5
|
+
import httpx
|
6
|
+
from typing import Any, Callable, List, Optional, Tuple, Union
|
7
|
+
|
8
|
+
|
9
|
+
class HookContext:
|
10
|
+
config: SDKConfiguration
|
11
|
+
base_url: str
|
12
|
+
operation_id: str
|
13
|
+
oauth2_scopes: Optional[List[str]] = None
|
14
|
+
security_source: Optional[Union[Any, Callable[[], Any]]] = None
|
15
|
+
|
16
|
+
def __init__(
|
17
|
+
self,
|
18
|
+
config: SDKConfiguration,
|
19
|
+
base_url: str,
|
20
|
+
operation_id: str,
|
21
|
+
oauth2_scopes: Optional[List[str]],
|
22
|
+
security_source: Optional[Union[Any, Callable[[], Any]]],
|
23
|
+
):
|
24
|
+
self.config = config
|
25
|
+
self.base_url = base_url
|
26
|
+
self.operation_id = operation_id
|
27
|
+
self.oauth2_scopes = oauth2_scopes
|
28
|
+
self.security_source = security_source
|
29
|
+
|
30
|
+
|
31
|
+
class BeforeRequestContext(HookContext):
|
32
|
+
def __init__(self, hook_ctx: HookContext):
|
33
|
+
super().__init__(
|
34
|
+
hook_ctx.config,
|
35
|
+
hook_ctx.base_url,
|
36
|
+
hook_ctx.operation_id,
|
37
|
+
hook_ctx.oauth2_scopes,
|
38
|
+
hook_ctx.security_source,
|
39
|
+
)
|
40
|
+
|
41
|
+
|
42
|
+
class AfterSuccessContext(HookContext):
|
43
|
+
def __init__(self, hook_ctx: HookContext):
|
44
|
+
super().__init__(
|
45
|
+
hook_ctx.config,
|
46
|
+
hook_ctx.base_url,
|
47
|
+
hook_ctx.operation_id,
|
48
|
+
hook_ctx.oauth2_scopes,
|
49
|
+
hook_ctx.security_source,
|
50
|
+
)
|
51
|
+
|
52
|
+
|
53
|
+
class AfterErrorContext(HookContext):
|
54
|
+
def __init__(self, hook_ctx: HookContext):
|
55
|
+
super().__init__(
|
56
|
+
hook_ctx.config,
|
57
|
+
hook_ctx.base_url,
|
58
|
+
hook_ctx.operation_id,
|
59
|
+
hook_ctx.oauth2_scopes,
|
60
|
+
hook_ctx.security_source,
|
61
|
+
)
|
62
|
+
|
63
|
+
|
64
|
+
class SDKInitHook(ABC):
|
65
|
+
@abstractmethod
|
66
|
+
def sdk_init(self, config: SDKConfiguration) -> SDKConfiguration:
|
67
|
+
pass
|
68
|
+
|
69
|
+
|
70
|
+
class BeforeRequestHook(ABC):
|
71
|
+
@abstractmethod
|
72
|
+
def before_request(
|
73
|
+
self, hook_ctx: BeforeRequestContext, request: httpx.Request
|
74
|
+
) -> Union[httpx.Request, Exception]:
|
75
|
+
pass
|
76
|
+
|
77
|
+
|
78
|
+
class AfterSuccessHook(ABC):
|
79
|
+
@abstractmethod
|
80
|
+
def after_success(
|
81
|
+
self, hook_ctx: AfterSuccessContext, response: httpx.Response
|
82
|
+
) -> Union[httpx.Response, Exception]:
|
83
|
+
pass
|
84
|
+
|
85
|
+
|
86
|
+
class AfterErrorHook(ABC):
|
87
|
+
@abstractmethod
|
88
|
+
def after_error(
|
89
|
+
self,
|
90
|
+
hook_ctx: AfterErrorContext,
|
91
|
+
response: Optional[httpx.Response],
|
92
|
+
error: Optional[Exception],
|
93
|
+
) -> Union[Tuple[Optional[httpx.Response], Optional[Exception]], Exception]:
|
94
|
+
pass
|
95
|
+
|
96
|
+
|
97
|
+
class Hooks(ABC):
|
98
|
+
@abstractmethod
|
99
|
+
def register_sdk_init_hook(self, hook: SDKInitHook):
|
100
|
+
pass
|
101
|
+
|
102
|
+
@abstractmethod
|
103
|
+
def register_before_request_hook(self, hook: BeforeRequestHook):
|
104
|
+
pass
|
105
|
+
|
106
|
+
@abstractmethod
|
107
|
+
def register_after_success_hook(self, hook: AfterSuccessHook):
|
108
|
+
pass
|
109
|
+
|
110
|
+
@abstractmethod
|
111
|
+
def register_after_error_hook(self, hook: AfterErrorHook):
|
112
|
+
pass
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
import importlib.metadata
|
4
|
+
|
5
|
+
__title__: str = "egain-api-python"
|
6
|
+
__version__: str = "0.1.1"
|
7
|
+
__openapi_doc_version__: str = "4.0.0"
|
8
|
+
__gen_version__: str = "2.721.3"
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.1.1 2.721.3 4.0.0 egain-api-python"
|
10
|
+
|
11
|
+
try:
|
12
|
+
if __package__ is not None:
|
13
|
+
__version__ = importlib.metadata.version(__package__)
|
14
|
+
except importlib.metadata.PackageNotFoundError:
|
15
|
+
pass
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
from .basesdk import BaseSDK
|
4
|
+
from .sdkconfiguration import SDKConfiguration
|
5
|
+
from egain_api_python.answers import Answers
|
6
|
+
from egain_api_python.retrieve import Retrieve
|
7
|
+
from typing import Optional
|
8
|
+
|
9
|
+
|
10
|
+
class Aiservices(BaseSDK):
|
11
|
+
retrieve: Retrieve
|
12
|
+
answers: Answers
|
13
|
+
|
14
|
+
def __init__(
|
15
|
+
self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None
|
16
|
+
) -> None:
|
17
|
+
BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref)
|
18
|
+
self.sdk_configuration = sdk_config
|
19
|
+
self._init_sdks()
|
20
|
+
|
21
|
+
def _init_sdks(self):
|
22
|
+
self.retrieve = Retrieve(self.sdk_configuration, parent_ref=self.parent_ref)
|
23
|
+
self.answers = Answers(self.sdk_configuration, parent_ref=self.parent_ref)
|
@@ -0,0 +1,281 @@
|
|
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 Dict, List, Mapping, Optional, Union
|
10
|
+
|
11
|
+
|
12
|
+
class Answers(BaseSDK):
|
13
|
+
def post_portal_id_answers(
|
14
|
+
self,
|
15
|
+
*,
|
16
|
+
q: str,
|
17
|
+
portal_id: str,
|
18
|
+
dollar_filter_user_profile_id: Optional[str] = None,
|
19
|
+
language: Optional[models.LanguageCodeParameter] = None,
|
20
|
+
dollar_filter_tags: Optional[Dict[str, List[str]]] = None,
|
21
|
+
dollar_filter_topic_ids: Optional[List[str]] = None,
|
22
|
+
channel: Optional[
|
23
|
+
Union[models.AnswersRequestChannel, models.AnswersRequestChannelTypedDict]
|
24
|
+
] = None,
|
25
|
+
context: Optional[Union[models.Context, models.ContextTypedDict]] = None,
|
26
|
+
event_id: Optional[str] = None,
|
27
|
+
session_id: Optional[str] = None,
|
28
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
29
|
+
server_url: Optional[str] = None,
|
30
|
+
timeout_ms: Optional[int] = None,
|
31
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
32
|
+
) -> models.AnswersResponse:
|
33
|
+
r"""Get the best answer for a user query
|
34
|
+
|
35
|
+
The **Answers API** allows enterprises to deliver fast, accurate, and contextual responses powered by their organizational knowledge. It supports two complementary approaches:
|
36
|
+
<li> **Certified Answers**: Direct snippets retrieved from enterprise-authored content. </li>
|
37
|
+
<li> **Generative Answers**: Natural language responses synthesized by a large language model (LLM). </li>
|
38
|
+
|
39
|
+
Every response includes supporting search results, references, and confidence scores—ensuring transparency, trust, and traceability. The API is built for secure, scalable integration across enterprise environments.
|
40
|
+
|
41
|
+
|
42
|
+
:param q: The search query string. The string must be escaped as required by the URL syntax rules.
|
43
|
+
: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.
|
44
|
+
:param dollar_filter_user_profile_id:
|
45
|
+
:param language: The language that describes the details of a resource. Resources available in different languages may differ from each other. <br><br> If lang is not passed, then the portal's default language is used.
|
46
|
+
:param dollar_filter_tags: An object where each key is a **Category Tag ID** (numeric string), and each value is an array of **Tag IDs** for that category.
|
47
|
+
:param dollar_filter_topic_ids: An array of topic IDs. It is used to restrict search results to specific topics.
|
48
|
+
:param channel:
|
49
|
+
:param context: Additional contextual metadata that enriches the query, providing the LLM with relevant details for tailoring the response.
|
50
|
+
:param event_id: Unique ID for this specific API call or event.
|
51
|
+
:param session_id: ID that ties multiple API calls to the same user session. Will be used as part of to tie events back to a session.
|
52
|
+
:param retries: Override the default retry configuration for this method
|
53
|
+
:param server_url: Override the default server URL for this method
|
54
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
55
|
+
:param http_headers: Additional headers to set or replace on requests.
|
56
|
+
"""
|
57
|
+
base_url = None
|
58
|
+
url_variables = None
|
59
|
+
if timeout_ms is None:
|
60
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
61
|
+
|
62
|
+
if server_url is not None:
|
63
|
+
base_url = server_url
|
64
|
+
else:
|
65
|
+
base_url = models.POST_PORTAL_ID_ANSWERS_OP_SERVERS[0]
|
66
|
+
url_variables = {
|
67
|
+
"API_DOMAIN": "api.egain.cloud",
|
68
|
+
}
|
69
|
+
|
70
|
+
request = models.PostPortalIDAnswersRequest(
|
71
|
+
q=q,
|
72
|
+
portal_id=portal_id,
|
73
|
+
dollar_filter_user_profile_id=dollar_filter_user_profile_id,
|
74
|
+
language=language,
|
75
|
+
dollar_filter_tags=dollar_filter_tags,
|
76
|
+
dollar_filter_topic_ids=dollar_filter_topic_ids,
|
77
|
+
answers_request=models.AnswersRequest(
|
78
|
+
channel=utils.get_pydantic_model(
|
79
|
+
channel, Optional[models.AnswersRequestChannel]
|
80
|
+
),
|
81
|
+
context=utils.get_pydantic_model(context, Optional[models.Context]),
|
82
|
+
event_id=event_id,
|
83
|
+
session_id=session_id,
|
84
|
+
),
|
85
|
+
)
|
86
|
+
|
87
|
+
req = self._build_request(
|
88
|
+
method="POST",
|
89
|
+
path="/{portalID}/answers",
|
90
|
+
base_url=base_url,
|
91
|
+
url_variables=url_variables,
|
92
|
+
request=request,
|
93
|
+
request_body_required=False,
|
94
|
+
request_has_path_params=True,
|
95
|
+
request_has_query_params=True,
|
96
|
+
user_agent_header="user-agent",
|
97
|
+
accept_header_value="application/json",
|
98
|
+
http_headers=http_headers,
|
99
|
+
security=self.sdk_configuration.security,
|
100
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
101
|
+
request.answers_request,
|
102
|
+
False,
|
103
|
+
True,
|
104
|
+
"json",
|
105
|
+
Optional[models.AnswersRequest],
|
106
|
+
),
|
107
|
+
timeout_ms=timeout_ms,
|
108
|
+
)
|
109
|
+
|
110
|
+
if retries == UNSET:
|
111
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
112
|
+
retries = self.sdk_configuration.retry_config
|
113
|
+
|
114
|
+
retry_config = None
|
115
|
+
if isinstance(retries, utils.RetryConfig):
|
116
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
117
|
+
|
118
|
+
http_res = self.do_request(
|
119
|
+
hook_ctx=HookContext(
|
120
|
+
config=self.sdk_configuration,
|
121
|
+
base_url=base_url or "",
|
122
|
+
operation_id="post_/{portalID}/answers",
|
123
|
+
oauth2_scopes=[],
|
124
|
+
security_source=get_security_from_env(
|
125
|
+
self.sdk_configuration.security, models.Security
|
126
|
+
),
|
127
|
+
),
|
128
|
+
request=req,
|
129
|
+
error_status_codes=["400", "4XX", "500", "5XX"],
|
130
|
+
retry_config=retry_config,
|
131
|
+
)
|
132
|
+
|
133
|
+
if utils.match_response(http_res, "200", "application/json"):
|
134
|
+
return unmarshal_json_response(models.AnswersResponse, http_res)
|
135
|
+
if utils.match_response(http_res, ["400", "4XX"], "*"):
|
136
|
+
http_res_text = utils.stream_to_text(http_res)
|
137
|
+
raise errors.EgainDefaultError(
|
138
|
+
"API error occurred", http_res, http_res_text
|
139
|
+
)
|
140
|
+
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
141
|
+
http_res_text = utils.stream_to_text(http_res)
|
142
|
+
raise errors.EgainDefaultError(
|
143
|
+
"API error occurred", http_res, http_res_text
|
144
|
+
)
|
145
|
+
|
146
|
+
raise errors.EgainDefaultError("Unexpected response received", http_res)
|
147
|
+
|
148
|
+
async def post_portal_id_answers_async(
|
149
|
+
self,
|
150
|
+
*,
|
151
|
+
q: str,
|
152
|
+
portal_id: str,
|
153
|
+
dollar_filter_user_profile_id: Optional[str] = None,
|
154
|
+
language: Optional[models.LanguageCodeParameter] = None,
|
155
|
+
dollar_filter_tags: Optional[Dict[str, List[str]]] = None,
|
156
|
+
dollar_filter_topic_ids: Optional[List[str]] = None,
|
157
|
+
channel: Optional[
|
158
|
+
Union[models.AnswersRequestChannel, models.AnswersRequestChannelTypedDict]
|
159
|
+
] = None,
|
160
|
+
context: Optional[Union[models.Context, models.ContextTypedDict]] = None,
|
161
|
+
event_id: Optional[str] = None,
|
162
|
+
session_id: Optional[str] = None,
|
163
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
164
|
+
server_url: Optional[str] = None,
|
165
|
+
timeout_ms: Optional[int] = None,
|
166
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
167
|
+
) -> models.AnswersResponse:
|
168
|
+
r"""Get the best answer for a user query
|
169
|
+
|
170
|
+
The **Answers API** allows enterprises to deliver fast, accurate, and contextual responses powered by their organizational knowledge. It supports two complementary approaches:
|
171
|
+
<li> **Certified Answers**: Direct snippets retrieved from enterprise-authored content. </li>
|
172
|
+
<li> **Generative Answers**: Natural language responses synthesized by a large language model (LLM). </li>
|
173
|
+
|
174
|
+
Every response includes supporting search results, references, and confidence scores—ensuring transparency, trust, and traceability. The API is built for secure, scalable integration across enterprise environments.
|
175
|
+
|
176
|
+
|
177
|
+
:param q: The search query string. The string must be escaped as required by the URL syntax rules.
|
178
|
+
: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.
|
179
|
+
:param dollar_filter_user_profile_id:
|
180
|
+
:param language: The language that describes the details of a resource. Resources available in different languages may differ from each other. <br><br> If lang is not passed, then the portal's default language is used.
|
181
|
+
:param dollar_filter_tags: An object where each key is a **Category Tag ID** (numeric string), and each value is an array of **Tag IDs** for that category.
|
182
|
+
:param dollar_filter_topic_ids: An array of topic IDs. It is used to restrict search results to specific topics.
|
183
|
+
:param channel:
|
184
|
+
:param context: Additional contextual metadata that enriches the query, providing the LLM with relevant details for tailoring the response.
|
185
|
+
:param event_id: Unique ID for this specific API call or event.
|
186
|
+
:param session_id: ID that ties multiple API calls to the same user session. Will be used as part of to tie events back to a session.
|
187
|
+
:param retries: Override the default retry configuration for this method
|
188
|
+
:param server_url: Override the default server URL for this method
|
189
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
190
|
+
:param http_headers: Additional headers to set or replace on requests.
|
191
|
+
"""
|
192
|
+
base_url = None
|
193
|
+
url_variables = None
|
194
|
+
if timeout_ms is None:
|
195
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
196
|
+
|
197
|
+
if server_url is not None:
|
198
|
+
base_url = server_url
|
199
|
+
else:
|
200
|
+
base_url = models.POST_PORTAL_ID_ANSWERS_OP_SERVERS[0]
|
201
|
+
url_variables = {
|
202
|
+
"API_DOMAIN": "api.egain.cloud",
|
203
|
+
}
|
204
|
+
|
205
|
+
request = models.PostPortalIDAnswersRequest(
|
206
|
+
q=q,
|
207
|
+
portal_id=portal_id,
|
208
|
+
dollar_filter_user_profile_id=dollar_filter_user_profile_id,
|
209
|
+
language=language,
|
210
|
+
dollar_filter_tags=dollar_filter_tags,
|
211
|
+
dollar_filter_topic_ids=dollar_filter_topic_ids,
|
212
|
+
answers_request=models.AnswersRequest(
|
213
|
+
channel=utils.get_pydantic_model(
|
214
|
+
channel, Optional[models.AnswersRequestChannel]
|
215
|
+
),
|
216
|
+
context=utils.get_pydantic_model(context, Optional[models.Context]),
|
217
|
+
event_id=event_id,
|
218
|
+
session_id=session_id,
|
219
|
+
),
|
220
|
+
)
|
221
|
+
|
222
|
+
req = self._build_request_async(
|
223
|
+
method="POST",
|
224
|
+
path="/{portalID}/answers",
|
225
|
+
base_url=base_url,
|
226
|
+
url_variables=url_variables,
|
227
|
+
request=request,
|
228
|
+
request_body_required=False,
|
229
|
+
request_has_path_params=True,
|
230
|
+
request_has_query_params=True,
|
231
|
+
user_agent_header="user-agent",
|
232
|
+
accept_header_value="application/json",
|
233
|
+
http_headers=http_headers,
|
234
|
+
security=self.sdk_configuration.security,
|
235
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
236
|
+
request.answers_request,
|
237
|
+
False,
|
238
|
+
True,
|
239
|
+
"json",
|
240
|
+
Optional[models.AnswersRequest],
|
241
|
+
),
|
242
|
+
timeout_ms=timeout_ms,
|
243
|
+
)
|
244
|
+
|
245
|
+
if retries == UNSET:
|
246
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
247
|
+
retries = self.sdk_configuration.retry_config
|
248
|
+
|
249
|
+
retry_config = None
|
250
|
+
if isinstance(retries, utils.RetryConfig):
|
251
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
252
|
+
|
253
|
+
http_res = await self.do_request_async(
|
254
|
+
hook_ctx=HookContext(
|
255
|
+
config=self.sdk_configuration,
|
256
|
+
base_url=base_url or "",
|
257
|
+
operation_id="post_/{portalID}/answers",
|
258
|
+
oauth2_scopes=[],
|
259
|
+
security_source=get_security_from_env(
|
260
|
+
self.sdk_configuration.security, models.Security
|
261
|
+
),
|
262
|
+
),
|
263
|
+
request=req,
|
264
|
+
error_status_codes=["400", "4XX", "500", "5XX"],
|
265
|
+
retry_config=retry_config,
|
266
|
+
)
|
267
|
+
|
268
|
+
if utils.match_response(http_res, "200", "application/json"):
|
269
|
+
return unmarshal_json_response(models.AnswersResponse, http_res)
|
270
|
+
if utils.match_response(http_res, ["400", "4XX"], "*"):
|
271
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
272
|
+
raise errors.EgainDefaultError(
|
273
|
+
"API error occurred", http_res, http_res_text
|
274
|
+
)
|
275
|
+
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
276
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
277
|
+
raise errors.EgainDefaultError(
|
278
|
+
"API error occurred", http_res, http_res_text
|
279
|
+
)
|
280
|
+
|
281
|
+
raise errors.EgainDefaultError("Unexpected response received", http_res)
|