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,494 @@
|
|
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
|
+
import io
|
10
|
+
from typing import Any, IO, Mapping, Optional, Union
|
11
|
+
|
12
|
+
|
13
|
+
class PortalAttachment(BaseSDK):
|
14
|
+
def create_signed_url(
|
15
|
+
self,
|
16
|
+
*,
|
17
|
+
accept_language: models.AcceptLanguage,
|
18
|
+
name: str,
|
19
|
+
size: int,
|
20
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
21
|
+
server_url: Optional[str] = None,
|
22
|
+
timeout_ms: Optional[int] = None,
|
23
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
24
|
+
) -> models.Attachment:
|
25
|
+
r"""Generate Signed URL to Upload API
|
26
|
+
|
27
|
+
## Overview
|
28
|
+
The Generate Signed URL to Upload API produces a signature that is used to upload an attachment.
|
29
|
+
|
30
|
+
|
31
|
+
:param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
|
32
|
+
:param name: The name of the attachment.
|
33
|
+
:param size: The size of the attachment in bytes. The maximum size is limited to 25MB.
|
34
|
+
:param retries: Override the default retry configuration for this method
|
35
|
+
:param server_url: Override the default server URL for this method
|
36
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
37
|
+
:param http_headers: Additional headers to set or replace on requests.
|
38
|
+
"""
|
39
|
+
base_url = None
|
40
|
+
url_variables = None
|
41
|
+
if timeout_ms is None:
|
42
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
43
|
+
|
44
|
+
if server_url is not None:
|
45
|
+
base_url = server_url
|
46
|
+
else:
|
47
|
+
base_url = self._get_url(base_url, url_variables)
|
48
|
+
|
49
|
+
request = models.CreateSignedURLRequest(
|
50
|
+
accept_language=accept_language,
|
51
|
+
attachment_upload=models.AttachmentUpload(
|
52
|
+
name=name,
|
53
|
+
size=size,
|
54
|
+
),
|
55
|
+
)
|
56
|
+
|
57
|
+
req = self._build_request(
|
58
|
+
method="POST",
|
59
|
+
path="/attachment/preupload",
|
60
|
+
base_url=base_url,
|
61
|
+
url_variables=url_variables,
|
62
|
+
request=request,
|
63
|
+
request_body_required=True,
|
64
|
+
request_has_path_params=False,
|
65
|
+
request_has_query_params=True,
|
66
|
+
user_agent_header="user-agent",
|
67
|
+
accept_header_value="application/json",
|
68
|
+
http_headers=http_headers,
|
69
|
+
security=self.sdk_configuration.security,
|
70
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
71
|
+
request.attachment_upload, False, False, "json", models.AttachmentUpload
|
72
|
+
),
|
73
|
+
timeout_ms=timeout_ms,
|
74
|
+
)
|
75
|
+
|
76
|
+
if retries == UNSET:
|
77
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
78
|
+
retries = self.sdk_configuration.retry_config
|
79
|
+
|
80
|
+
retry_config = None
|
81
|
+
if isinstance(retries, utils.RetryConfig):
|
82
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
83
|
+
|
84
|
+
http_res = self.do_request(
|
85
|
+
hook_ctx=HookContext(
|
86
|
+
config=self.sdk_configuration,
|
87
|
+
base_url=base_url or "",
|
88
|
+
operation_id="createSignedURL",
|
89
|
+
oauth2_scopes=[],
|
90
|
+
security_source=get_security_from_env(
|
91
|
+
self.sdk_configuration.security, models.Security
|
92
|
+
),
|
93
|
+
),
|
94
|
+
request=req,
|
95
|
+
error_status_codes=[
|
96
|
+
"400",
|
97
|
+
"401",
|
98
|
+
"403",
|
99
|
+
"404",
|
100
|
+
"406",
|
101
|
+
"415",
|
102
|
+
"4XX",
|
103
|
+
"500",
|
104
|
+
"5XX",
|
105
|
+
],
|
106
|
+
retry_config=retry_config,
|
107
|
+
)
|
108
|
+
|
109
|
+
response_data: Any = None
|
110
|
+
if utils.match_response(http_res, "200", "application/json"):
|
111
|
+
return unmarshal_json_response(models.Attachment, http_res)
|
112
|
+
if utils.match_response(
|
113
|
+
http_res, ["400", "401", "403", "404", "406"], "application/json"
|
114
|
+
):
|
115
|
+
response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
|
116
|
+
raise errors.WSErrorCommon(response_data, http_res)
|
117
|
+
if utils.match_response(http_res, "500", "application/json"):
|
118
|
+
response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
|
119
|
+
raise errors.WSErrorCommon(response_data, http_res)
|
120
|
+
if utils.match_response(http_res, ["415", "4XX"], "*"):
|
121
|
+
http_res_text = utils.stream_to_text(http_res)
|
122
|
+
raise errors.EgainDefaultError(
|
123
|
+
"API error occurred", http_res, http_res_text
|
124
|
+
)
|
125
|
+
if utils.match_response(http_res, "5XX", "*"):
|
126
|
+
http_res_text = utils.stream_to_text(http_res)
|
127
|
+
raise errors.EgainDefaultError(
|
128
|
+
"API error occurred", http_res, http_res_text
|
129
|
+
)
|
130
|
+
|
131
|
+
raise errors.EgainDefaultError("Unexpected response received", http_res)
|
132
|
+
|
133
|
+
async def create_signed_url_async(
|
134
|
+
self,
|
135
|
+
*,
|
136
|
+
accept_language: models.AcceptLanguage,
|
137
|
+
name: str,
|
138
|
+
size: int,
|
139
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
140
|
+
server_url: Optional[str] = None,
|
141
|
+
timeout_ms: Optional[int] = None,
|
142
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
143
|
+
) -> models.Attachment:
|
144
|
+
r"""Generate Signed URL to Upload API
|
145
|
+
|
146
|
+
## Overview
|
147
|
+
The Generate Signed URL to Upload API produces a signature that is used to upload an attachment.
|
148
|
+
|
149
|
+
|
150
|
+
:param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
|
151
|
+
:param name: The name of the attachment.
|
152
|
+
:param size: The size of the attachment in bytes. The maximum size is limited to 25MB.
|
153
|
+
:param retries: Override the default retry configuration for this method
|
154
|
+
:param server_url: Override the default server URL for this method
|
155
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
156
|
+
:param http_headers: Additional headers to set or replace on requests.
|
157
|
+
"""
|
158
|
+
base_url = None
|
159
|
+
url_variables = None
|
160
|
+
if timeout_ms is None:
|
161
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
162
|
+
|
163
|
+
if server_url is not None:
|
164
|
+
base_url = server_url
|
165
|
+
else:
|
166
|
+
base_url = self._get_url(base_url, url_variables)
|
167
|
+
|
168
|
+
request = models.CreateSignedURLRequest(
|
169
|
+
accept_language=accept_language,
|
170
|
+
attachment_upload=models.AttachmentUpload(
|
171
|
+
name=name,
|
172
|
+
size=size,
|
173
|
+
),
|
174
|
+
)
|
175
|
+
|
176
|
+
req = self._build_request_async(
|
177
|
+
method="POST",
|
178
|
+
path="/attachment/preupload",
|
179
|
+
base_url=base_url,
|
180
|
+
url_variables=url_variables,
|
181
|
+
request=request,
|
182
|
+
request_body_required=True,
|
183
|
+
request_has_path_params=False,
|
184
|
+
request_has_query_params=True,
|
185
|
+
user_agent_header="user-agent",
|
186
|
+
accept_header_value="application/json",
|
187
|
+
http_headers=http_headers,
|
188
|
+
security=self.sdk_configuration.security,
|
189
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
190
|
+
request.attachment_upload, False, False, "json", models.AttachmentUpload
|
191
|
+
),
|
192
|
+
timeout_ms=timeout_ms,
|
193
|
+
)
|
194
|
+
|
195
|
+
if retries == UNSET:
|
196
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
197
|
+
retries = self.sdk_configuration.retry_config
|
198
|
+
|
199
|
+
retry_config = None
|
200
|
+
if isinstance(retries, utils.RetryConfig):
|
201
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
202
|
+
|
203
|
+
http_res = await self.do_request_async(
|
204
|
+
hook_ctx=HookContext(
|
205
|
+
config=self.sdk_configuration,
|
206
|
+
base_url=base_url or "",
|
207
|
+
operation_id="createSignedURL",
|
208
|
+
oauth2_scopes=[],
|
209
|
+
security_source=get_security_from_env(
|
210
|
+
self.sdk_configuration.security, models.Security
|
211
|
+
),
|
212
|
+
),
|
213
|
+
request=req,
|
214
|
+
error_status_codes=[
|
215
|
+
"400",
|
216
|
+
"401",
|
217
|
+
"403",
|
218
|
+
"404",
|
219
|
+
"406",
|
220
|
+
"415",
|
221
|
+
"4XX",
|
222
|
+
"500",
|
223
|
+
"5XX",
|
224
|
+
],
|
225
|
+
retry_config=retry_config,
|
226
|
+
)
|
227
|
+
|
228
|
+
response_data: Any = None
|
229
|
+
if utils.match_response(http_res, "200", "application/json"):
|
230
|
+
return unmarshal_json_response(models.Attachment, http_res)
|
231
|
+
if utils.match_response(
|
232
|
+
http_res, ["400", "401", "403", "404", "406"], "application/json"
|
233
|
+
):
|
234
|
+
response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
|
235
|
+
raise errors.WSErrorCommon(response_data, http_res)
|
236
|
+
if utils.match_response(http_res, "500", "application/json"):
|
237
|
+
response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
|
238
|
+
raise errors.WSErrorCommon(response_data, http_res)
|
239
|
+
if utils.match_response(http_res, ["415", "4XX"], "*"):
|
240
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
241
|
+
raise errors.EgainDefaultError(
|
242
|
+
"API error occurred", http_res, http_res_text
|
243
|
+
)
|
244
|
+
if utils.match_response(http_res, "5XX", "*"):
|
245
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
246
|
+
raise errors.EgainDefaultError(
|
247
|
+
"API error occurred", http_res, http_res_text
|
248
|
+
)
|
249
|
+
|
250
|
+
raise errors.EgainDefaultError("Unexpected response received", http_res)
|
251
|
+
|
252
|
+
def upload_attachment(
|
253
|
+
self,
|
254
|
+
*,
|
255
|
+
accept_language: models.AcceptLanguage,
|
256
|
+
signature: str,
|
257
|
+
request_body: Union[bytes, IO[bytes], io.BufferedReader],
|
258
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
259
|
+
server_url: Optional[str] = None,
|
260
|
+
timeout_ms: Optional[int] = None,
|
261
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
262
|
+
):
|
263
|
+
r"""Upload Attachment
|
264
|
+
|
265
|
+
## Overview
|
266
|
+
The Upload Attachment API uses the signed URL produced by the Generate Signed URL to Upload API to upload an attachment.
|
267
|
+
The Make a Suggestion API uses this API to upload attachments.
|
268
|
+
|
269
|
+
|
270
|
+
:param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
|
271
|
+
:param signature: Signature data to upload attachment.
|
272
|
+
:param request_body:
|
273
|
+
:param retries: Override the default retry configuration for this method
|
274
|
+
:param server_url: Override the default server URL for this method
|
275
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
276
|
+
:param http_headers: Additional headers to set or replace on requests.
|
277
|
+
"""
|
278
|
+
base_url = None
|
279
|
+
url_variables = None
|
280
|
+
if timeout_ms is None:
|
281
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
282
|
+
|
283
|
+
if server_url is not None:
|
284
|
+
base_url = server_url
|
285
|
+
else:
|
286
|
+
base_url = self._get_url(base_url, url_variables)
|
287
|
+
|
288
|
+
request = models.UploadAttachmentRequest(
|
289
|
+
accept_language=accept_language,
|
290
|
+
signature=signature,
|
291
|
+
request_body=request_body,
|
292
|
+
)
|
293
|
+
|
294
|
+
req = self._build_request(
|
295
|
+
method="POST",
|
296
|
+
path="/attachment/upload",
|
297
|
+
base_url=base_url,
|
298
|
+
url_variables=url_variables,
|
299
|
+
request=request,
|
300
|
+
request_body_required=True,
|
301
|
+
request_has_path_params=False,
|
302
|
+
request_has_query_params=True,
|
303
|
+
user_agent_header="user-agent",
|
304
|
+
accept_header_value="application/json",
|
305
|
+
http_headers=http_headers,
|
306
|
+
security=self.sdk_configuration.security,
|
307
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
308
|
+
request.request_body,
|
309
|
+
False,
|
310
|
+
False,
|
311
|
+
"raw",
|
312
|
+
Union[bytes, IO[bytes], io.BufferedReader],
|
313
|
+
),
|
314
|
+
timeout_ms=timeout_ms,
|
315
|
+
)
|
316
|
+
|
317
|
+
if retries == UNSET:
|
318
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
319
|
+
retries = self.sdk_configuration.retry_config
|
320
|
+
|
321
|
+
retry_config = None
|
322
|
+
if isinstance(retries, utils.RetryConfig):
|
323
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
324
|
+
|
325
|
+
http_res = self.do_request(
|
326
|
+
hook_ctx=HookContext(
|
327
|
+
config=self.sdk_configuration,
|
328
|
+
base_url=base_url or "",
|
329
|
+
operation_id="uploadAttachment",
|
330
|
+
oauth2_scopes=[],
|
331
|
+
security_source=get_security_from_env(
|
332
|
+
self.sdk_configuration.security, models.Security
|
333
|
+
),
|
334
|
+
),
|
335
|
+
request=req,
|
336
|
+
error_status_codes=[
|
337
|
+
"400",
|
338
|
+
"401",
|
339
|
+
"403",
|
340
|
+
"404",
|
341
|
+
"406",
|
342
|
+
"415",
|
343
|
+
"4XX",
|
344
|
+
"500",
|
345
|
+
"5XX",
|
346
|
+
],
|
347
|
+
retry_config=retry_config,
|
348
|
+
)
|
349
|
+
|
350
|
+
response_data: Any = None
|
351
|
+
if utils.match_response(http_res, "201", "*"):
|
352
|
+
return
|
353
|
+
if utils.match_response(
|
354
|
+
http_res, ["400", "401", "403", "404", "406"], "application/json"
|
355
|
+
):
|
356
|
+
response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
|
357
|
+
raise errors.WSErrorCommon(response_data, http_res)
|
358
|
+
if utils.match_response(http_res, "500", "application/json"):
|
359
|
+
response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
|
360
|
+
raise errors.WSErrorCommon(response_data, http_res)
|
361
|
+
if utils.match_response(http_res, ["415", "4XX"], "*"):
|
362
|
+
http_res_text = utils.stream_to_text(http_res)
|
363
|
+
raise errors.EgainDefaultError(
|
364
|
+
"API error occurred", http_res, http_res_text
|
365
|
+
)
|
366
|
+
if utils.match_response(http_res, "5XX", "*"):
|
367
|
+
http_res_text = utils.stream_to_text(http_res)
|
368
|
+
raise errors.EgainDefaultError(
|
369
|
+
"API error occurred", http_res, http_res_text
|
370
|
+
)
|
371
|
+
|
372
|
+
raise errors.EgainDefaultError("Unexpected response received", http_res)
|
373
|
+
|
374
|
+
async def upload_attachment_async(
|
375
|
+
self,
|
376
|
+
*,
|
377
|
+
accept_language: models.AcceptLanguage,
|
378
|
+
signature: str,
|
379
|
+
request_body: Union[bytes, IO[bytes], io.BufferedReader],
|
380
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
381
|
+
server_url: Optional[str] = None,
|
382
|
+
timeout_ms: Optional[int] = None,
|
383
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
384
|
+
):
|
385
|
+
r"""Upload Attachment
|
386
|
+
|
387
|
+
## Overview
|
388
|
+
The Upload Attachment API uses the signed URL produced by the Generate Signed URL to Upload API to upload an attachment.
|
389
|
+
The Make a Suggestion API uses this API to upload attachments.
|
390
|
+
|
391
|
+
|
392
|
+
:param accept_language: The Language locale accepted by the client (used for locale specific fields in resource representation and in error responses).
|
393
|
+
:param signature: Signature data to upload attachment.
|
394
|
+
:param request_body:
|
395
|
+
:param retries: Override the default retry configuration for this method
|
396
|
+
:param server_url: Override the default server URL for this method
|
397
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
398
|
+
:param http_headers: Additional headers to set or replace on requests.
|
399
|
+
"""
|
400
|
+
base_url = None
|
401
|
+
url_variables = None
|
402
|
+
if timeout_ms is None:
|
403
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
404
|
+
|
405
|
+
if server_url is not None:
|
406
|
+
base_url = server_url
|
407
|
+
else:
|
408
|
+
base_url = self._get_url(base_url, url_variables)
|
409
|
+
|
410
|
+
request = models.UploadAttachmentRequest(
|
411
|
+
accept_language=accept_language,
|
412
|
+
signature=signature,
|
413
|
+
request_body=request_body,
|
414
|
+
)
|
415
|
+
|
416
|
+
req = self._build_request_async(
|
417
|
+
method="POST",
|
418
|
+
path="/attachment/upload",
|
419
|
+
base_url=base_url,
|
420
|
+
url_variables=url_variables,
|
421
|
+
request=request,
|
422
|
+
request_body_required=True,
|
423
|
+
request_has_path_params=False,
|
424
|
+
request_has_query_params=True,
|
425
|
+
user_agent_header="user-agent",
|
426
|
+
accept_header_value="application/json",
|
427
|
+
http_headers=http_headers,
|
428
|
+
security=self.sdk_configuration.security,
|
429
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
430
|
+
request.request_body,
|
431
|
+
False,
|
432
|
+
False,
|
433
|
+
"raw",
|
434
|
+
Union[bytes, IO[bytes], io.BufferedReader],
|
435
|
+
),
|
436
|
+
timeout_ms=timeout_ms,
|
437
|
+
)
|
438
|
+
|
439
|
+
if retries == UNSET:
|
440
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
441
|
+
retries = self.sdk_configuration.retry_config
|
442
|
+
|
443
|
+
retry_config = None
|
444
|
+
if isinstance(retries, utils.RetryConfig):
|
445
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
446
|
+
|
447
|
+
http_res = await self.do_request_async(
|
448
|
+
hook_ctx=HookContext(
|
449
|
+
config=self.sdk_configuration,
|
450
|
+
base_url=base_url or "",
|
451
|
+
operation_id="uploadAttachment",
|
452
|
+
oauth2_scopes=[],
|
453
|
+
security_source=get_security_from_env(
|
454
|
+
self.sdk_configuration.security, models.Security
|
455
|
+
),
|
456
|
+
),
|
457
|
+
request=req,
|
458
|
+
error_status_codes=[
|
459
|
+
"400",
|
460
|
+
"401",
|
461
|
+
"403",
|
462
|
+
"404",
|
463
|
+
"406",
|
464
|
+
"415",
|
465
|
+
"4XX",
|
466
|
+
"500",
|
467
|
+
"5XX",
|
468
|
+
],
|
469
|
+
retry_config=retry_config,
|
470
|
+
)
|
471
|
+
|
472
|
+
response_data: Any = None
|
473
|
+
if utils.match_response(http_res, "201", "*"):
|
474
|
+
return
|
475
|
+
if utils.match_response(
|
476
|
+
http_res, ["400", "401", "403", "404", "406"], "application/json"
|
477
|
+
):
|
478
|
+
response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
|
479
|
+
raise errors.WSErrorCommon(response_data, http_res)
|
480
|
+
if utils.match_response(http_res, "500", "application/json"):
|
481
|
+
response_data = unmarshal_json_response(errors.WSErrorCommonData, http_res)
|
482
|
+
raise errors.WSErrorCommon(response_data, http_res)
|
483
|
+
if utils.match_response(http_res, ["415", "4XX"], "*"):
|
484
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
485
|
+
raise errors.EgainDefaultError(
|
486
|
+
"API error occurred", http_res, http_res_text
|
487
|
+
)
|
488
|
+
if utils.match_response(http_res, "5XX", "*"):
|
489
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
490
|
+
raise errors.EgainDefaultError(
|
491
|
+
"API error occurred", http_res, http_res_text
|
492
|
+
)
|
493
|
+
|
494
|
+
raise errors.EgainDefaultError("Unexpected response received", http_res)
|