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,265 @@
|
|
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 Retrieve(BaseSDK):
|
13
|
+
def post_portal_id_retrieve(
|
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.RetrieveRequestChannel, models.RetrieveRequestChannelTypedDict]
|
24
|
+
] = None,
|
25
|
+
event_id: Optional[str] = None,
|
26
|
+
session_id: Optional[str] = None,
|
27
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
28
|
+
server_url: Optional[str] = None,
|
29
|
+
timeout_ms: Optional[int] = None,
|
30
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
31
|
+
) -> models.RetrieveResponse:
|
32
|
+
r"""Retrieve Chunks
|
33
|
+
|
34
|
+
The Retrieve API enables enterprises to directly access relevant content chunks from their organizational knowledge sources. It is designed for scenarios where developers want granular control over retrieved information, such as powering custom search, analytics, or retrieval-augmented generation (RAG) pipelines. <br><br> In addition to raw chunk retrieval, the API can return **Certified Answers** if it meets the 'Certified Answer' threshold score. Responses include relevance scores, metadata, and references to maintain transparency and flexibility. By leveraging the Retrieve API, organizations can build tailored experiences while retaining confidence in the source material.
|
35
|
+
|
36
|
+
:param q: The search query string. The string must be escaped as required by the URL syntax rules.
|
37
|
+
: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.
|
38
|
+
:param dollar_filter_user_profile_id:
|
39
|
+
: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.
|
40
|
+
: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.
|
41
|
+
:param dollar_filter_topic_ids: An array of topic IDs. It is used to restrict search results to specific topics.
|
42
|
+
:param channel:
|
43
|
+
:param event_id: Unique ID for this specific API call or event.
|
44
|
+
: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.
|
45
|
+
:param retries: Override the default retry configuration for this method
|
46
|
+
:param server_url: Override the default server URL for this method
|
47
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
48
|
+
:param http_headers: Additional headers to set or replace on requests.
|
49
|
+
"""
|
50
|
+
base_url = None
|
51
|
+
url_variables = None
|
52
|
+
if timeout_ms is None:
|
53
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
54
|
+
|
55
|
+
if server_url is not None:
|
56
|
+
base_url = server_url
|
57
|
+
else:
|
58
|
+
base_url = models.POST_PORTAL_ID_RETRIEVE_OP_SERVERS[0]
|
59
|
+
url_variables = {
|
60
|
+
"API_DOMAIN": "api.egain.cloud",
|
61
|
+
}
|
62
|
+
|
63
|
+
request = models.PostPortalIDRetrieveRequest(
|
64
|
+
q=q,
|
65
|
+
portal_id=portal_id,
|
66
|
+
dollar_filter_user_profile_id=dollar_filter_user_profile_id,
|
67
|
+
language=language,
|
68
|
+
dollar_filter_tags=dollar_filter_tags,
|
69
|
+
dollar_filter_topic_ids=dollar_filter_topic_ids,
|
70
|
+
retrieve_request=models.RetrieveRequest(
|
71
|
+
channel=utils.get_pydantic_model(
|
72
|
+
channel, Optional[models.RetrieveRequestChannel]
|
73
|
+
),
|
74
|
+
event_id=event_id,
|
75
|
+
session_id=session_id,
|
76
|
+
),
|
77
|
+
)
|
78
|
+
|
79
|
+
req = self._build_request(
|
80
|
+
method="POST",
|
81
|
+
path="/{portalID}/retrieve",
|
82
|
+
base_url=base_url,
|
83
|
+
url_variables=url_variables,
|
84
|
+
request=request,
|
85
|
+
request_body_required=False,
|
86
|
+
request_has_path_params=True,
|
87
|
+
request_has_query_params=True,
|
88
|
+
user_agent_header="user-agent",
|
89
|
+
accept_header_value="application/json",
|
90
|
+
http_headers=http_headers,
|
91
|
+
security=self.sdk_configuration.security,
|
92
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
93
|
+
request.retrieve_request,
|
94
|
+
False,
|
95
|
+
True,
|
96
|
+
"json",
|
97
|
+
Optional[models.RetrieveRequest],
|
98
|
+
),
|
99
|
+
timeout_ms=timeout_ms,
|
100
|
+
)
|
101
|
+
|
102
|
+
if retries == UNSET:
|
103
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
104
|
+
retries = self.sdk_configuration.retry_config
|
105
|
+
|
106
|
+
retry_config = None
|
107
|
+
if isinstance(retries, utils.RetryConfig):
|
108
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
109
|
+
|
110
|
+
http_res = self.do_request(
|
111
|
+
hook_ctx=HookContext(
|
112
|
+
config=self.sdk_configuration,
|
113
|
+
base_url=base_url or "",
|
114
|
+
operation_id="post_/{portalID}/retrieve",
|
115
|
+
oauth2_scopes=[],
|
116
|
+
security_source=get_security_from_env(
|
117
|
+
self.sdk_configuration.security, models.Security
|
118
|
+
),
|
119
|
+
),
|
120
|
+
request=req,
|
121
|
+
error_status_codes=["400", "4XX", "500", "5XX"],
|
122
|
+
retry_config=retry_config,
|
123
|
+
)
|
124
|
+
|
125
|
+
if utils.match_response(http_res, "200", "application/json"):
|
126
|
+
return unmarshal_json_response(models.RetrieveResponse, http_res)
|
127
|
+
if utils.match_response(http_res, ["400", "4XX"], "*"):
|
128
|
+
http_res_text = utils.stream_to_text(http_res)
|
129
|
+
raise errors.EgainDefaultError(
|
130
|
+
"API error occurred", http_res, http_res_text
|
131
|
+
)
|
132
|
+
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
133
|
+
http_res_text = utils.stream_to_text(http_res)
|
134
|
+
raise errors.EgainDefaultError(
|
135
|
+
"API error occurred", http_res, http_res_text
|
136
|
+
)
|
137
|
+
|
138
|
+
raise errors.EgainDefaultError("Unexpected response received", http_res)
|
139
|
+
|
140
|
+
async def post_portal_id_retrieve_async(
|
141
|
+
self,
|
142
|
+
*,
|
143
|
+
q: str,
|
144
|
+
portal_id: str,
|
145
|
+
dollar_filter_user_profile_id: Optional[str] = None,
|
146
|
+
language: Optional[models.LanguageCodeParameter] = None,
|
147
|
+
dollar_filter_tags: Optional[Dict[str, List[str]]] = None,
|
148
|
+
dollar_filter_topic_ids: Optional[List[str]] = None,
|
149
|
+
channel: Optional[
|
150
|
+
Union[models.RetrieveRequestChannel, models.RetrieveRequestChannelTypedDict]
|
151
|
+
] = None,
|
152
|
+
event_id: Optional[str] = None,
|
153
|
+
session_id: Optional[str] = None,
|
154
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
155
|
+
server_url: Optional[str] = None,
|
156
|
+
timeout_ms: Optional[int] = None,
|
157
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
158
|
+
) -> models.RetrieveResponse:
|
159
|
+
r"""Retrieve Chunks
|
160
|
+
|
161
|
+
The Retrieve API enables enterprises to directly access relevant content chunks from their organizational knowledge sources. It is designed for scenarios where developers want granular control over retrieved information, such as powering custom search, analytics, or retrieval-augmented generation (RAG) pipelines. <br><br> In addition to raw chunk retrieval, the API can return **Certified Answers** if it meets the 'Certified Answer' threshold score. Responses include relevance scores, metadata, and references to maintain transparency and flexibility. By leveraging the Retrieve API, organizations can build tailored experiences while retaining confidence in the source material.
|
162
|
+
|
163
|
+
:param q: The search query string. The string must be escaped as required by the URL syntax rules.
|
164
|
+
: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.
|
165
|
+
:param dollar_filter_user_profile_id:
|
166
|
+
: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.
|
167
|
+
: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.
|
168
|
+
:param dollar_filter_topic_ids: An array of topic IDs. It is used to restrict search results to specific topics.
|
169
|
+
:param channel:
|
170
|
+
:param event_id: Unique ID for this specific API call or event.
|
171
|
+
: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.
|
172
|
+
:param retries: Override the default retry configuration for this method
|
173
|
+
:param server_url: Override the default server URL for this method
|
174
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
175
|
+
:param http_headers: Additional headers to set or replace on requests.
|
176
|
+
"""
|
177
|
+
base_url = None
|
178
|
+
url_variables = None
|
179
|
+
if timeout_ms is None:
|
180
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
181
|
+
|
182
|
+
if server_url is not None:
|
183
|
+
base_url = server_url
|
184
|
+
else:
|
185
|
+
base_url = models.POST_PORTAL_ID_RETRIEVE_OP_SERVERS[0]
|
186
|
+
url_variables = {
|
187
|
+
"API_DOMAIN": "api.egain.cloud",
|
188
|
+
}
|
189
|
+
|
190
|
+
request = models.PostPortalIDRetrieveRequest(
|
191
|
+
q=q,
|
192
|
+
portal_id=portal_id,
|
193
|
+
dollar_filter_user_profile_id=dollar_filter_user_profile_id,
|
194
|
+
language=language,
|
195
|
+
dollar_filter_tags=dollar_filter_tags,
|
196
|
+
dollar_filter_topic_ids=dollar_filter_topic_ids,
|
197
|
+
retrieve_request=models.RetrieveRequest(
|
198
|
+
channel=utils.get_pydantic_model(
|
199
|
+
channel, Optional[models.RetrieveRequestChannel]
|
200
|
+
),
|
201
|
+
event_id=event_id,
|
202
|
+
session_id=session_id,
|
203
|
+
),
|
204
|
+
)
|
205
|
+
|
206
|
+
req = self._build_request_async(
|
207
|
+
method="POST",
|
208
|
+
path="/{portalID}/retrieve",
|
209
|
+
base_url=base_url,
|
210
|
+
url_variables=url_variables,
|
211
|
+
request=request,
|
212
|
+
request_body_required=False,
|
213
|
+
request_has_path_params=True,
|
214
|
+
request_has_query_params=True,
|
215
|
+
user_agent_header="user-agent",
|
216
|
+
accept_header_value="application/json",
|
217
|
+
http_headers=http_headers,
|
218
|
+
security=self.sdk_configuration.security,
|
219
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
220
|
+
request.retrieve_request,
|
221
|
+
False,
|
222
|
+
True,
|
223
|
+
"json",
|
224
|
+
Optional[models.RetrieveRequest],
|
225
|
+
),
|
226
|
+
timeout_ms=timeout_ms,
|
227
|
+
)
|
228
|
+
|
229
|
+
if retries == UNSET:
|
230
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
231
|
+
retries = self.sdk_configuration.retry_config
|
232
|
+
|
233
|
+
retry_config = None
|
234
|
+
if isinstance(retries, utils.RetryConfig):
|
235
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
236
|
+
|
237
|
+
http_res = await self.do_request_async(
|
238
|
+
hook_ctx=HookContext(
|
239
|
+
config=self.sdk_configuration,
|
240
|
+
base_url=base_url or "",
|
241
|
+
operation_id="post_/{portalID}/retrieve",
|
242
|
+
oauth2_scopes=[],
|
243
|
+
security_source=get_security_from_env(
|
244
|
+
self.sdk_configuration.security, models.Security
|
245
|
+
),
|
246
|
+
),
|
247
|
+
request=req,
|
248
|
+
error_status_codes=["400", "4XX", "500", "5XX"],
|
249
|
+
retry_config=retry_config,
|
250
|
+
)
|
251
|
+
|
252
|
+
if utils.match_response(http_res, "200", "application/json"):
|
253
|
+
return unmarshal_json_response(models.RetrieveResponse, http_res)
|
254
|
+
if utils.match_response(http_res, ["400", "4XX"], "*"):
|
255
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
256
|
+
raise errors.EgainDefaultError(
|
257
|
+
"API error occurred", http_res, http_res_text
|
258
|
+
)
|
259
|
+
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
260
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
261
|
+
raise errors.EgainDefaultError(
|
262
|
+
"API error occurred", http_res, http_res_text
|
263
|
+
)
|
264
|
+
|
265
|
+
raise errors.EgainDefaultError("Unexpected response received", http_res)
|
egain_api_python/sdk.py
ADDED
@@ -0,0 +1,216 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
from .basesdk import BaseSDK
|
4
|
+
from .httpclient import AsyncHttpClient, ClientOwner, HttpClient, close_clients
|
5
|
+
from .sdkconfiguration import SDKConfiguration
|
6
|
+
from .utils.logger import Logger, get_default_logger
|
7
|
+
from .utils.retries import RetryConfig
|
8
|
+
from egain_api_python import models, utils
|
9
|
+
from egain_api_python._hooks import SDKHooks
|
10
|
+
from egain_api_python.types import OptionalNullable, UNSET
|
11
|
+
import httpx
|
12
|
+
import importlib
|
13
|
+
import sys
|
14
|
+
from typing import Any, Callable, Dict, List, Optional, TYPE_CHECKING, Union, cast
|
15
|
+
import weakref
|
16
|
+
|
17
|
+
if TYPE_CHECKING:
|
18
|
+
from egain_api_python.aiservices import Aiservices
|
19
|
+
from egain_api_python.content import Content
|
20
|
+
from egain_api_python.portal_sdk import PortalSDK
|
21
|
+
|
22
|
+
|
23
|
+
class Egain(BaseSDK):
|
24
|
+
r"""Knowledge Portal Manager APIs: ### License
|
25
|
+
The following licenses are required to use the Knowledge Access APIs:
|
26
|
+
* If the user is an agent, then the *Knowledge + AI* license is required.
|
27
|
+
* If the user is a customer, the *Self-Service* and *Advanced Self-Service* licenses must be available.
|
28
|
+
### API Resource Limits
|
29
|
+
The following Resources have predefined limits for specific access attributes for Enterprise use.
|
30
|
+
|
31
|
+
| Resource | Attribute | Enterprise
|
32
|
+
| ---------------- | ---------------------------- | ----------
|
33
|
+
| Article Reference Limits |Number of attachments used in any article | 50
|
34
|
+
| |Number of custom attributes in an article | 15
|
35
|
+
| |Number of publish views used in an article version | 20
|
36
|
+
| Topic Reference Limits |User-defined topics in a department| 50000
|
37
|
+
| |Depth of topics | 20
|
38
|
+
| |Topics at any level | 2500
|
39
|
+
| |Number of custom attributes in a topic | 15
|
40
|
+
| Portal Reference Limits | Tag categories in a portal | 15
|
41
|
+
| |Topics to be included in a portal | 2500
|
42
|
+
| |Number of articles to display in announcements | 25
|
43
|
+
| |Maximum related articles in portal setting | 100
|
44
|
+
| |Usage links and link groups setup for a portal | 25
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
"""
|
49
|
+
|
50
|
+
aiservices: "Aiservices"
|
51
|
+
content: "Content"
|
52
|
+
portal: "PortalSDK"
|
53
|
+
_sub_sdk_map = {
|
54
|
+
"aiservices": ("egain_api_python.aiservices", "Aiservices"),
|
55
|
+
"content": ("egain_api_python.content", "Content"),
|
56
|
+
"portal": ("egain_api_python.portal_sdk", "PortalSDK"),
|
57
|
+
}
|
58
|
+
|
59
|
+
def __init__(
|
60
|
+
self,
|
61
|
+
access_token: Optional[
|
62
|
+
Union[Optional[str], Callable[[], Optional[str]]]
|
63
|
+
] = None,
|
64
|
+
api_domain: Optional[str] = None,
|
65
|
+
server_idx: Optional[int] = None,
|
66
|
+
server_url: Optional[str] = None,
|
67
|
+
url_params: Optional[Dict[str, str]] = None,
|
68
|
+
client: Optional[HttpClient] = None,
|
69
|
+
async_client: Optional[AsyncHttpClient] = None,
|
70
|
+
retry_config: OptionalNullable[RetryConfig] = UNSET,
|
71
|
+
timeout_ms: Optional[int] = None,
|
72
|
+
debug_logger: Optional[Logger] = None,
|
73
|
+
) -> None:
|
74
|
+
r"""Instantiates the SDK configuring it with the provided parameters.
|
75
|
+
|
76
|
+
:param access_token: The access_token required for authentication
|
77
|
+
:param api_domain: Allows setting the API_DOMAIN variable for url substitution
|
78
|
+
:param server_idx: The index of the server to use for all methods
|
79
|
+
:param server_url: The server URL to use for all methods
|
80
|
+
:param url_params: Parameters to optionally template the server URL with
|
81
|
+
:param client: The HTTP client to use for all synchronous methods
|
82
|
+
:param async_client: The Async HTTP client to use for all asynchronous methods
|
83
|
+
:param retry_config: The retry configuration to use for all supported methods
|
84
|
+
:param timeout_ms: Optional request timeout applied to each operation in milliseconds
|
85
|
+
"""
|
86
|
+
client_supplied = True
|
87
|
+
if client is None:
|
88
|
+
client = httpx.Client(follow_redirects=True)
|
89
|
+
client_supplied = False
|
90
|
+
|
91
|
+
assert issubclass(
|
92
|
+
type(client), HttpClient
|
93
|
+
), "The provided client must implement the HttpClient protocol."
|
94
|
+
|
95
|
+
async_client_supplied = True
|
96
|
+
if async_client is None:
|
97
|
+
async_client = httpx.AsyncClient(follow_redirects=True)
|
98
|
+
async_client_supplied = False
|
99
|
+
|
100
|
+
if debug_logger is None:
|
101
|
+
debug_logger = get_default_logger()
|
102
|
+
|
103
|
+
assert issubclass(
|
104
|
+
type(async_client), AsyncHttpClient
|
105
|
+
), "The provided async_client must implement the AsyncHttpClient protocol."
|
106
|
+
|
107
|
+
security: Any = None
|
108
|
+
if callable(access_token):
|
109
|
+
# pylint: disable=unnecessary-lambda-assignment
|
110
|
+
security = lambda: models.Security(access_token=access_token())
|
111
|
+
else:
|
112
|
+
security = models.Security(access_token=access_token)
|
113
|
+
|
114
|
+
if server_url is not None:
|
115
|
+
if url_params is not None:
|
116
|
+
server_url = utils.template_url(server_url, url_params)
|
117
|
+
server_defaults: List[Dict[str, str]] = [
|
118
|
+
{
|
119
|
+
"API_DOMAIN": api_domain or "api.egain.cloud",
|
120
|
+
},
|
121
|
+
]
|
122
|
+
|
123
|
+
BaseSDK.__init__(
|
124
|
+
self,
|
125
|
+
SDKConfiguration(
|
126
|
+
client=client,
|
127
|
+
client_supplied=client_supplied,
|
128
|
+
async_client=async_client,
|
129
|
+
async_client_supplied=async_client_supplied,
|
130
|
+
security=security,
|
131
|
+
server_url=server_url,
|
132
|
+
server_idx=server_idx,
|
133
|
+
server_defaults=server_defaults,
|
134
|
+
retry_config=retry_config,
|
135
|
+
timeout_ms=timeout_ms,
|
136
|
+
debug_logger=debug_logger,
|
137
|
+
),
|
138
|
+
parent_ref=self,
|
139
|
+
)
|
140
|
+
|
141
|
+
hooks = SDKHooks()
|
142
|
+
|
143
|
+
# pylint: disable=protected-access
|
144
|
+
self.sdk_configuration.__dict__["_hooks"] = hooks
|
145
|
+
|
146
|
+
self.sdk_configuration = hooks.sdk_init(self.sdk_configuration)
|
147
|
+
|
148
|
+
weakref.finalize(
|
149
|
+
self,
|
150
|
+
close_clients,
|
151
|
+
cast(ClientOwner, self.sdk_configuration),
|
152
|
+
self.sdk_configuration.client,
|
153
|
+
self.sdk_configuration.client_supplied,
|
154
|
+
self.sdk_configuration.async_client,
|
155
|
+
self.sdk_configuration.async_client_supplied,
|
156
|
+
)
|
157
|
+
|
158
|
+
def dynamic_import(self, modname, retries=3):
|
159
|
+
for attempt in range(retries):
|
160
|
+
try:
|
161
|
+
return importlib.import_module(modname)
|
162
|
+
except KeyError:
|
163
|
+
# Clear any half-initialized module and retry
|
164
|
+
sys.modules.pop(modname, None)
|
165
|
+
if attempt == retries - 1:
|
166
|
+
break
|
167
|
+
raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
|
168
|
+
|
169
|
+
def __getattr__(self, name: str):
|
170
|
+
if name in self._sub_sdk_map:
|
171
|
+
module_path, class_name = self._sub_sdk_map[name]
|
172
|
+
try:
|
173
|
+
module = self.dynamic_import(module_path)
|
174
|
+
klass = getattr(module, class_name)
|
175
|
+
instance = klass(self.sdk_configuration, parent_ref=self)
|
176
|
+
setattr(self, name, instance)
|
177
|
+
return instance
|
178
|
+
except ImportError as e:
|
179
|
+
raise AttributeError(
|
180
|
+
f"Failed to import module {module_path} for attribute {name}: {e}"
|
181
|
+
) from e
|
182
|
+
except AttributeError as e:
|
183
|
+
raise AttributeError(
|
184
|
+
f"Failed to find class {class_name} in module {module_path} for attribute {name}: {e}"
|
185
|
+
) from e
|
186
|
+
|
187
|
+
raise AttributeError(
|
188
|
+
f"'{type(self).__name__}' object has no attribute '{name}'"
|
189
|
+
)
|
190
|
+
|
191
|
+
def __dir__(self):
|
192
|
+
default_attrs = list(super().__dir__())
|
193
|
+
lazy_attrs = list(self._sub_sdk_map.keys())
|
194
|
+
return sorted(list(set(default_attrs + lazy_attrs)))
|
195
|
+
|
196
|
+
def __enter__(self):
|
197
|
+
return self
|
198
|
+
|
199
|
+
async def __aenter__(self):
|
200
|
+
return self
|
201
|
+
|
202
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
203
|
+
if (
|
204
|
+
self.sdk_configuration.client is not None
|
205
|
+
and not self.sdk_configuration.client_supplied
|
206
|
+
):
|
207
|
+
self.sdk_configuration.client.close()
|
208
|
+
self.sdk_configuration.client = None
|
209
|
+
|
210
|
+
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
211
|
+
if (
|
212
|
+
self.sdk_configuration.async_client is not None
|
213
|
+
and not self.sdk_configuration.async_client_supplied
|
214
|
+
):
|
215
|
+
await self.sdk_configuration.async_client.aclose()
|
216
|
+
self.sdk_configuration.async_client = None
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
from ._version import (
|
4
|
+
__gen_version__,
|
5
|
+
__openapi_doc_version__,
|
6
|
+
__user_agent__,
|
7
|
+
__version__,
|
8
|
+
)
|
9
|
+
from .httpclient import AsyncHttpClient, HttpClient
|
10
|
+
from .utils import Logger, RetryConfig, remove_suffix
|
11
|
+
from dataclasses import dataclass, field
|
12
|
+
from egain_api_python import models
|
13
|
+
from egain_api_python.types import OptionalNullable, UNSET
|
14
|
+
from pydantic import Field
|
15
|
+
from typing import Callable, Dict, List, Optional, Tuple, Union
|
16
|
+
|
17
|
+
|
18
|
+
SERVERS = [
|
19
|
+
"https://${API_DOMAIN}/knowledge/portalmgr/v4",
|
20
|
+
# Production Server
|
21
|
+
]
|
22
|
+
"""Contains the list of servers available to the SDK"""
|
23
|
+
|
24
|
+
|
25
|
+
@dataclass
|
26
|
+
class SDKConfiguration:
|
27
|
+
client: Union[HttpClient, None]
|
28
|
+
client_supplied: bool
|
29
|
+
async_client: Union[AsyncHttpClient, None]
|
30
|
+
async_client_supplied: bool
|
31
|
+
debug_logger: Logger
|
32
|
+
security: Optional[Union[models.Security, Callable[[], models.Security]]] = None
|
33
|
+
server_url: Optional[str] = ""
|
34
|
+
server_idx: Optional[int] = 0
|
35
|
+
server_defaults: List[Dict[str, str]] = field(default_factory=List)
|
36
|
+
language: str = "python"
|
37
|
+
openapi_doc_version: str = __openapi_doc_version__
|
38
|
+
sdk_version: str = __version__
|
39
|
+
gen_version: str = __gen_version__
|
40
|
+
user_agent: str = __user_agent__
|
41
|
+
retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
|
42
|
+
timeout_ms: Optional[int] = None
|
43
|
+
|
44
|
+
def get_server_details(self) -> Tuple[str, Dict[str, str]]:
|
45
|
+
if self.server_url is not None and self.server_url:
|
46
|
+
return remove_suffix(self.server_url, "/"), {}
|
47
|
+
if self.server_idx is None:
|
48
|
+
self.server_idx = 0
|
49
|
+
|
50
|
+
return SERVERS[self.server_idx], self.server_defaults[self.server_idx]
|