glean-api-client 0.1.0b2__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.
- glean/__init__.py +17 -0
- glean/_hooks/__init__.py +5 -0
- glean/_hooks/registration.py +13 -0
- glean/_hooks/sdkhooks.py +76 -0
- glean/_hooks/types.py +106 -0
- glean/_version.py +15 -0
- glean/agents.py +632 -0
- glean/announcements.py +773 -0
- glean/answers.py +1140 -0
- glean/basesdk.py +358 -0
- glean/client.py +59 -0
- glean/client_activity.py +400 -0
- glean/client_authentication.py +182 -0
- glean/client_chat.py +2186 -0
- glean/client_documents.py +845 -0
- glean/client_shortcuts.py +1100 -0
- glean/client_verification.py +604 -0
- glean/collections.py +1872 -0
- glean/datasources.py +600 -0
- glean/entities.py +402 -0
- glean/errors/__init__.py +14 -0
- glean/errors/collectionerror.py +25 -0
- glean/errors/gleandataerror.py +45 -0
- glean/errors/gleanerror.py +22 -0
- glean/httpclient.py +136 -0
- glean/indexing.py +35 -0
- glean/indexing_authentication.py +182 -0
- glean/indexing_datasource.py +206 -0
- glean/indexing_documents.py +2191 -0
- glean/indexing_permissions.py +2616 -0
- glean/indexing_shortcuts.py +458 -0
- glean/insights.py +266 -0
- glean/messages.py +244 -0
- glean/models/__init__.py +1835 -0
- glean/models/activity.py +15 -0
- glean/models/activityevent.py +49 -0
- glean/models/activityeventparams.py +61 -0
- glean/models/addcollectionitemserror.py +22 -0
- glean/models/addcollectionitemsrequest.py +31 -0
- glean/models/addcollectionitemsresponse.py +22 -0
- glean/models/additionalfielddefinition.py +65 -0
- glean/models/agent.py +49 -0
- glean/models/agentconfig.py +40 -0
- glean/models/agentresult.py +14 -0
- glean/models/aiappactioncounts.py +70 -0
- glean/models/aiappsinsightsresponse.py +45 -0
- glean/models/aiinsightsresponse.py +91 -0
- glean/models/announcement.py +171 -0
- glean/models/anonymousevent.py +35 -0
- glean/models/answer.py +155 -0
- glean/models/answerboard.py +87 -0
- glean/models/answercreationdata.py +94 -0
- glean/models/answerlike.py +26 -0
- glean/models/answerlikes.py +28 -0
- glean/models/answerresult.py +23 -0
- glean/models/appresult.py +32 -0
- glean/models/authconfig.py +115 -0
- glean/models/authtoken.py +34 -0
- glean/models/autocompleterequest.py +82 -0
- glean/models/autocompleteresponse.py +58 -0
- glean/models/autocompleteresult.py +87 -0
- glean/models/autocompleteresultgroup.py +31 -0
- glean/models/badge.py +39 -0
- glean/models/bulkindexdocumentsrequest.py +56 -0
- glean/models/bulkindexemployeesrequest.py +54 -0
- glean/models/bulkindexgroupsrequest.py +59 -0
- glean/models/bulkindexmembershipsrequest.py +57 -0
- glean/models/bulkindexshortcutsrequest.py +44 -0
- glean/models/bulkindexteamsrequest.py +44 -0
- glean/models/bulkindexusersrequest.py +59 -0
- glean/models/bulkuploadhistoryevent.py +62 -0
- glean/models/calendarattendee.py +48 -0
- glean/models/calendarattendees.py +52 -0
- glean/models/calendarevent.py +88 -0
- glean/models/canonicalizingregextype.py +26 -0
- glean/models/channelinviteinfo.py +48 -0
- glean/models/chat.py +66 -0
- glean/models/chatfile.py +36 -0
- glean/models/chatfilefailurereason.py +16 -0
- glean/models/chatfilemetadata.py +47 -0
- glean/models/chatfilestatus.py +13 -0
- glean/models/chatmessage.py +100 -0
- glean/models/chatmessagecitation.py +51 -0
- glean/models/chatmessagefragment.py +50 -0
- glean/models/chatmetadata.py +60 -0
- glean/models/chatmetadataresult.py +25 -0
- glean/models/chatop.py +31 -0
- glean/models/chatrequest.py +65 -0
- glean/models/chatresponse.py +46 -0
- glean/models/chatrestrictionfilters.py +30 -0
- glean/models/chatresult.py +25 -0
- glean/models/chatstreamop.py +31 -0
- glean/models/chatzerostatesuggestionoptions.py +19 -0
- glean/models/checkdocumentaccessrequest.py +35 -0
- glean/models/checkdocumentaccessresponse.py +21 -0
- glean/models/clustergroup.py +35 -0
- glean/models/clustertypeenum.py +18 -0
- glean/models/code.py +32 -0
- glean/models/codeline.py +26 -0
- glean/models/collection.py +143 -0
- glean/models/collectionerror.py +25 -0
- glean/models/collectionitem.py +82 -0
- glean/models/collectionitemdescriptor.py +56 -0
- glean/models/collectionpinmetadata.py +19 -0
- glean/models/collectionpinnablecategories.py +12 -0
- glean/models/collectionpinnabletargets.py +11 -0
- glean/models/collectionpinnedmetadata.py +28 -0
- glean/models/collectionpintarget.py +28 -0
- glean/models/commentdefinition.py +53 -0
- glean/models/communicationchannel.py +9 -0
- glean/models/company.py +84 -0
- glean/models/conferencedata.py +34 -0
- glean/models/connectortype.py +17 -0
- glean/models/contentdefinition.py +31 -0
- glean/models/contentinsightsresponse.py +46 -0
- glean/models/countinfo.py +25 -0
- glean/models/createannouncementrequest.py +105 -0
- glean/models/createanswerrequest.py +14 -0
- glean/models/createauthtokenresponse.py +21 -0
- glean/models/createcollectionrequest.py +78 -0
- glean/models/createcollectionresponse.py +162 -0
- glean/models/createshortcutrequest.py +17 -0
- glean/models/createshortcutresponse.py +19 -0
- glean/models/customdatasourceconfig.py +237 -0
- glean/models/customdatavalue.py +33 -0
- glean/models/customentity.py +51 -0
- glean/models/customentitymetadata.py +20 -0
- glean/models/customer.py +70 -0
- glean/models/customermetadata.py +25 -0
- glean/models/customfielddata.py +27 -0
- glean/models/customfieldvalue.py +32 -0
- glean/models/customfieldvaluehyperlink.py +22 -0
- glean/models/customfieldvalueperson.py +17 -0
- glean/models/customfieldvaluestr.py +17 -0
- glean/models/customproperty.py +23 -0
- glean/models/datasourcebulkmembershipdefinition.py +30 -0
- glean/models/datasourcegroupdefinition.py +19 -0
- glean/models/datasourcemembershipdefinition.py +35 -0
- glean/models/datasourceobjecttypedocumentcountentry.py +22 -0
- glean/models/datasourceprofile.py +41 -0
- glean/models/datasourceuserdefinition.py +32 -0
- glean/models/debugdatasourcestatusidentityresponsecomponent.py +37 -0
- glean/models/debugdatasourcestatusresponse.py +115 -0
- glean/models/debugdocumentrequest.py +25 -0
- glean/models/debugdocumentresponse.py +37 -0
- glean/models/debugdocumentsrequest.py +24 -0
- glean/models/debugdocumentsresponse.py +28 -0
- glean/models/debugdocumentsresponseitem.py +34 -0
- glean/models/debuguserrequest.py +19 -0
- glean/models/debuguserresponse.py +34 -0
- glean/models/deleteallchatsop.py +22 -0
- glean/models/deleteannouncementrequest.py +15 -0
- glean/models/deleteanswerrequest.py +22 -0
- glean/models/deletechatfilesop.py +32 -0
- glean/models/deletechatfilesrequest.py +17 -0
- glean/models/deletechatsop.py +29 -0
- glean/models/deletechatsrequest.py +16 -0
- glean/models/deletecollectionitemrequest.py +27 -0
- glean/models/deletecollectionitemresponse.py +15 -0
- glean/models/deletecollectionrequest.py +24 -0
- glean/models/deletedocumentrequest.py +36 -0
- glean/models/deleteemployeerequest.py +26 -0
- glean/models/deletegrouprequest.py +31 -0
- glean/models/deletemembershiprequest.py +34 -0
- glean/models/deleteshortcutrequest.py +15 -0
- glean/models/deleteteamrequest.py +19 -0
- glean/models/deleteuserrequest.py +30 -0
- glean/models/disambiguation.py +31 -0
- glean/models/displayablelistitemuiconfig.py +23 -0
- glean/models/document.py +71 -0
- glean/models/documentcontent.py +19 -0
- glean/models/documentdefinition.py +156 -0
- glean/models/documentinsight.py +25 -0
- glean/models/documentinteractions.py +50 -0
- glean/models/documentinteractionsdefinition.py +25 -0
- glean/models/documentmetadata.py +228 -0
- glean/models/documentorerror_union.py +27 -0
- glean/models/documentpermissionsdefinition.py +62 -0
- glean/models/documentsection.py +21 -0
- glean/models/documentspec_union.py +70 -0
- glean/models/documentstatusresponse.py +49 -0
- glean/models/documentvisibility.py +15 -0
- glean/models/editanswerrequest.py +111 -0
- glean/models/editcollectionitemrequest.py +37 -0
- glean/models/editcollectionitemresponse.py +15 -0
- glean/models/editcollectionrequest.py +76 -0
- glean/models/editcollectionresponse.py +162 -0
- glean/models/editpinrequest.py +30 -0
- glean/models/employeeinfodefinition.py +198 -0
- glean/models/employeeteaminfo.py +30 -0
- glean/models/entitiessortorder.py +16 -0
- glean/models/entityrelationship.py +24 -0
- glean/models/entitytype.py +12 -0
- glean/models/errormessage.py +20 -0
- glean/models/eventclassification.py +25 -0
- glean/models/eventclassificationname.py +10 -0
- glean/models/eventstrategyname.py +18 -0
- glean/models/externalshortcut.py +69 -0
- glean/models/extractedqna.py +30 -0
- glean/models/facetbucket.py +30 -0
- glean/models/facetbucketfilter.py +21 -0
- glean/models/facetfilter.py +26 -0
- glean/models/facetfilterset.py +19 -0
- glean/models/facetfiltervalue.py +39 -0
- glean/models/facetresult.py +40 -0
- glean/models/facetvalue.py +33 -0
- glean/models/favoriteinfo.py +33 -0
- glean/models/feedback.py +175 -0
- glean/models/feedbackchatexchange.py +53 -0
- glean/models/feedbackop.py +29 -0
- glean/models/feedentry.py +173 -0
- glean/models/feedrequest.py +61 -0
- glean/models/feedrequestoptions.py +59 -0
- glean/models/feedresponse.py +50 -0
- glean/models/feedresult.py +61 -0
- glean/models/followupaction.py +52 -0
- glean/models/generatedattachment.py +51 -0
- glean/models/generatedattachmentcontent.py +28 -0
- glean/models/generatedqna.py +74 -0
- glean/models/getagentinputsop.py +29 -0
- glean/models/getagentinputsrequest.py +17 -0
- glean/models/getagentinputsresponse.py +17 -0
- glean/models/getanswererror.py +29 -0
- glean/models/getanswerrequest.py +22 -0
- glean/models/getanswerresponse.py +22 -0
- glean/models/getchatapplicationop.py +32 -0
- glean/models/getchatapplicationrequest.py +15 -0
- glean/models/getchatapplicationresponse.py +14 -0
- glean/models/getchatfilesop.py +29 -0
- glean/models/getchatfilesrequest.py +17 -0
- glean/models/getchatfilesresponse.py +17 -0
- glean/models/getchatop.py +29 -0
- glean/models/getchatrequest.py +15 -0
- glean/models/getchatresponse.py +18 -0
- glean/models/getcollectionrequest.py +36 -0
- glean/models/getcollectionresponse.py +32 -0
- glean/models/getdatasourceconfigrequest.py +19 -0
- glean/models/getdocpermissionsrequest.py +17 -0
- glean/models/getdocpermissionsresponse.py +19 -0
- glean/models/getdocumentcountrequest.py +19 -0
- glean/models/getdocumentcountresponse.py +23 -0
- glean/models/getdocumentsbyfacetsrequest.py +30 -0
- glean/models/getdocumentsbyfacetsresponse.py +30 -0
- glean/models/getdocumentsrequest.py +36 -0
- glean/models/getdocumentsresponse.py +17 -0
- glean/models/getdocumentstatusrequest.py +30 -0
- glean/models/getdocumentstatusresponse.py +42 -0
- glean/models/getpinrequest.py +16 -0
- glean/models/getpinresponse.py +15 -0
- glean/models/getshortcutrequest_union.py +31 -0
- glean/models/getshortcutresponse.py +19 -0
- glean/models/getusercountrequest.py +19 -0
- glean/models/getusercountresponse.py +21 -0
- glean/models/gleanassistinsightsresponse.py +46 -0
- glean/models/gleandataerror.py +44 -0
- glean/models/grantpermission.py +22 -0
- glean/models/greenlistusersrequest.py +25 -0
- glean/models/group.py +27 -0
- glean/models/grouptype.py +17 -0
- glean/models/iconconfig.py +67 -0
- glean/models/indexdocumentrequest.py +26 -0
- glean/models/indexdocumentsrequest.py +32 -0
- glean/models/indexemployeerequest.py +29 -0
- glean/models/indexgrouprequest.py +34 -0
- glean/models/indexingshortcut.py +57 -0
- glean/models/indexmembershiprequest.py +34 -0
- glean/models/indexstatus.py +27 -0
- glean/models/indexteamrequest.py +26 -0
- glean/models/indexuserrequest.py +34 -0
- glean/models/insightsagentsrequestoptions.py +17 -0
- glean/models/insightsaiapprequestoptions.py +17 -0
- glean/models/insightsrequest.py +83 -0
- glean/models/insightsresponse.py +81 -0
- glean/models/invalidoperatorvalueerror.py +21 -0
- glean/models/inviteinfo.py +58 -0
- glean/models/labeledcountinfo.py +25 -0
- glean/models/listagentsop.py +28 -0
- glean/models/listagentsresponse.py +19 -0
- glean/models/listanswersrequest.py +17 -0
- glean/models/listanswersresponse.py +18 -0
- glean/models/listchatsop.py +22 -0
- glean/models/listchatsresponse.py +18 -0
- glean/models/listcollectionsrequest.py +37 -0
- glean/models/listcollectionsresponse.py +17 -0
- glean/models/listentitiesrequest.py +81 -0
- glean/models/listentitiesresponse.py +66 -0
- glean/models/listpinsop.py +13 -0
- glean/models/listpinsresponse.py +17 -0
- glean/models/listshortcutspaginatedrequest.py +49 -0
- glean/models/listshortcutspaginatedresponse.py +31 -0
- glean/models/listverificationsop.py +20 -0
- glean/models/manualfeedbackinfo.py +159 -0
- glean/models/meeting.py +37 -0
- glean/models/messagesrequest.py +82 -0
- glean/models/messagesresponse.py +29 -0
- glean/models/objectdefinition.py +75 -0
- glean/models/objectpermissions.py +17 -0
- glean/models/operatormetadata.py +50 -0
- glean/models/operatorscope.py +18 -0
- glean/models/peoplerequest.py +69 -0
- glean/models/peopleresponse.py +31 -0
- glean/models/period.py +41 -0
- glean/models/permissions.py +67 -0
- glean/models/permissionsgroupintersectiondefinition.py +21 -0
- glean/models/person.py +36 -0
- glean/models/persondistance.py +26 -0
- glean/models/personmetadata.py +291 -0
- glean/models/personobject.py +21 -0
- glean/models/personteam.py +53 -0
- glean/models/persontoteamrelationship.py +53 -0
- glean/models/pindocument.py +55 -0
- glean/models/pinrequest.py +30 -0
- glean/models/possiblevalue.py +25 -0
- glean/models/post_api_index_v1_debug_datasource_documentop.py +25 -0
- glean/models/post_api_index_v1_debug_datasource_documentsop.py +25 -0
- glean/models/post_api_index_v1_debug_datasource_statusop.py +18 -0
- glean/models/post_api_index_v1_debug_datasource_userop.py +25 -0
- glean/models/processalldocumentsrequest.py +20 -0
- glean/models/processallmembershipsrequest.py +20 -0
- glean/models/processinghistoryevent.py +26 -0
- glean/models/prompttemplate.py +88 -0
- glean/models/prompttemplateresult.py +35 -0
- glean/models/propertydefinition.py +82 -0
- glean/models/propertygroup.py +26 -0
- glean/models/queryinsight.py +45 -0
- glean/models/queryinsightsresponse.py +46 -0
- glean/models/querysuggestion.py +61 -0
- glean/models/querysuggestionlist.py +21 -0
- glean/models/quicklink.py +58 -0
- glean/models/reaction.py +33 -0
- glean/models/readpermission.py +22 -0
- glean/models/recommendationsrequest.py +64 -0
- glean/models/recommendationsrequestoptions.py +47 -0
- glean/models/referencerange.py +26 -0
- glean/models/relateddocuments.py +69 -0
- glean/models/relatedobject.py +35 -0
- glean/models/relatedobjectedge.py +15 -0
- glean/models/relatedquestion.py +29 -0
- glean/models/reminder.py +36 -0
- glean/models/reminderrequest.py +34 -0
- glean/models/restrictionfilters.py +20 -0
- glean/models/resultsdescription.py +25 -0
- glean/models/resultsresponse.py +59 -0
- glean/models/resulttab.py +34 -0
- glean/models/rotatetokenresponse.py +33 -0
- glean/models/runagentop.py +29 -0
- glean/models/runagentrequest.py +27 -0
- glean/models/scopetype.py +11 -0
- glean/models/searchproviderinfo.py +29 -0
- glean/models/searchrequest.py +101 -0
- glean/models/searchrequestinputdetails.py +19 -0
- glean/models/searchrequestoptions.py +135 -0
- glean/models/searchresponse.py +120 -0
- glean/models/searchresponsemetadata.py +95 -0
- glean/models/searchresult.py +149 -0
- glean/models/searchresultprominenceenum.py +12 -0
- glean/models/searchresultsnippet.py +47 -0
- glean/models/searchwarning.py +50 -0
- glean/models/security.py +25 -0
- glean/models/seenfeedbackinfo.py +17 -0
- glean/models/sessioninfo.py +35 -0
- glean/models/share.py +33 -0
- glean/models/shortcut.py +140 -0
- glean/models/shortcuterror.py +25 -0
- glean/models/shortcutinsight.py +27 -0
- glean/models/shortcutinsightsresponse.py +39 -0
- glean/models/shortcutmutableproperties.py +61 -0
- glean/models/shortcutspaginationmetadata.py +25 -0
- glean/models/socialnetwork.py +27 -0
- glean/models/socialnetworkdefinition.py +31 -0
- glean/models/sortoptions.py +24 -0
- glean/models/structuredlink.py +34 -0
- glean/models/structuredlocation.py +61 -0
- glean/models/structuredresult.py +141 -0
- glean/models/structuredtext.py +25 -0
- glean/models/structuredtextitem.py +23 -0
- glean/models/structuredtextmutableproperties.py +13 -0
- glean/models/summarizerequest.py +49 -0
- glean/models/summarizeresponse.py +34 -0
- glean/models/summary.py +22 -0
- glean/models/team.py +146 -0
- glean/models/teamemail.py +25 -0
- glean/models/teaminfodefinition.py +87 -0
- glean/models/teammember.py +31 -0
- glean/models/textrange.py +47 -0
- glean/models/thumbnail.py +22 -0
- glean/models/timeinterval.py +20 -0
- glean/models/timepoint.py +22 -0
- glean/models/toolinfo.py +23 -0
- glean/models/toolmetadata.py +170 -0
- glean/models/ugctype.py +13 -0
- glean/models/unpin.py +16 -0
- glean/models/updateannouncementrequest.py +110 -0
- glean/models/updatepermissionsrequest.py +47 -0
- glean/models/updateshortcutrequest.py +66 -0
- glean/models/updateshortcutresponse.py +19 -0
- glean/models/uploadchatfilesop.py +32 -0
- glean/models/uploadchatfilesrequest.py +43 -0
- glean/models/uploadchatfilesresponse.py +17 -0
- glean/models/uploadshortcutsrequest.py +44 -0
- glean/models/uploadstatusenum.py +12 -0
- glean/models/user.py +22 -0
- glean/models/useractivity.py +52 -0
- glean/models/useractivityinsight.py +47 -0
- glean/models/usergeneratedcontentid.py +16 -0
- glean/models/userinsightsresponse.py +53 -0
- glean/models/userreferencedefinition.py +29 -0
- glean/models/userrole.py +14 -0
- glean/models/userrolespecification.py +34 -0
- glean/models/userstatusresponse.py +38 -0
- glean/models/userviewinfo.py +27 -0
- glean/models/verification.py +34 -0
- glean/models/verificationfeed.py +17 -0
- glean/models/verificationmetadata.py +62 -0
- glean/models/verifyrequest.py +31 -0
- glean/models/viewerinfo.py +40 -0
- glean/models/workflow.py +49 -0
- glean/models/workflowfeedbackinfo.py +25 -0
- glean/models/workflowinputfield.py +16 -0
- glean/models/workflowresult.py +14 -0
- glean/models/writeactionparameter.py +55 -0
- glean/models/writepermission.py +37 -0
- glean/people.py +1847 -0
- glean/pins.py +986 -0
- glean/py.typed +1 -0
- glean/sdk.py +168 -0
- glean/sdkconfiguration.py +56 -0
- glean/search.py +1018 -0
- glean/types/__init__.py +21 -0
- glean/types/basemodel.py +39 -0
- glean/utils/__init__.py +102 -0
- glean/utils/annotations.py +55 -0
- glean/utils/datetimes.py +23 -0
- glean/utils/enums.py +74 -0
- glean/utils/eventstreaming.py +238 -0
- glean/utils/forms.py +202 -0
- glean/utils/headers.py +136 -0
- glean/utils/logger.py +27 -0
- glean/utils/metadata.py +118 -0
- glean/utils/queryparams.py +205 -0
- glean/utils/requestbodies.py +66 -0
- glean/utils/retries.py +217 -0
- glean/utils/security.py +192 -0
- glean/utils/serializers.py +248 -0
- glean/utils/url.py +155 -0
- glean/utils/values.py +137 -0
- glean_api_client-0.1.0b2.dist-info/METADATA +939 -0
- glean_api_client-0.1.0b2.dist-info/RECORD +449 -0
- glean_api_client-0.1.0b2.dist-info/WHEEL +4 -0
glean/__init__.py
ADDED
|
@@ -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__
|
glean/_hooks/__init__.py
ADDED
|
@@ -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"""
|
glean/_hooks/sdkhooks.py
ADDED
|
@@ -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 glean.httpclient import HttpClient
|
|
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, base_url: str, client: HttpClient) -> Tuple[str, HttpClient]:
|
|
40
|
+
for hook in self.sdk_init_hooks:
|
|
41
|
+
base_url, client = hook.sdk_init(base_url, client)
|
|
42
|
+
return base_url, client
|
|
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
|
glean/_hooks/types.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from glean.httpclient import HttpClient
|
|
5
|
+
import httpx
|
|
6
|
+
from typing import Any, Callable, List, Optional, Tuple, Union
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HookContext:
|
|
10
|
+
base_url: str
|
|
11
|
+
operation_id: str
|
|
12
|
+
oauth2_scopes: Optional[List[str]] = None
|
|
13
|
+
security_source: Optional[Union[Any, Callable[[], Any]]] = None
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
base_url: str,
|
|
18
|
+
operation_id: str,
|
|
19
|
+
oauth2_scopes: Optional[List[str]],
|
|
20
|
+
security_source: Optional[Union[Any, Callable[[], Any]]],
|
|
21
|
+
):
|
|
22
|
+
self.base_url = base_url
|
|
23
|
+
self.operation_id = operation_id
|
|
24
|
+
self.oauth2_scopes = oauth2_scopes
|
|
25
|
+
self.security_source = security_source
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class BeforeRequestContext(HookContext):
|
|
29
|
+
def __init__(self, hook_ctx: HookContext):
|
|
30
|
+
super().__init__(
|
|
31
|
+
hook_ctx.base_url,
|
|
32
|
+
hook_ctx.operation_id,
|
|
33
|
+
hook_ctx.oauth2_scopes,
|
|
34
|
+
hook_ctx.security_source,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class AfterSuccessContext(HookContext):
|
|
39
|
+
def __init__(self, hook_ctx: HookContext):
|
|
40
|
+
super().__init__(
|
|
41
|
+
hook_ctx.base_url,
|
|
42
|
+
hook_ctx.operation_id,
|
|
43
|
+
hook_ctx.oauth2_scopes,
|
|
44
|
+
hook_ctx.security_source,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class AfterErrorContext(HookContext):
|
|
49
|
+
def __init__(self, hook_ctx: HookContext):
|
|
50
|
+
super().__init__(
|
|
51
|
+
hook_ctx.base_url,
|
|
52
|
+
hook_ctx.operation_id,
|
|
53
|
+
hook_ctx.oauth2_scopes,
|
|
54
|
+
hook_ctx.security_source,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class SDKInitHook(ABC):
|
|
59
|
+
@abstractmethod
|
|
60
|
+
def sdk_init(self, base_url: str, client: HttpClient) -> Tuple[str, HttpClient]:
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class BeforeRequestHook(ABC):
|
|
65
|
+
@abstractmethod
|
|
66
|
+
def before_request(
|
|
67
|
+
self, hook_ctx: BeforeRequestContext, request: httpx.Request
|
|
68
|
+
) -> Union[httpx.Request, Exception]:
|
|
69
|
+
pass
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class AfterSuccessHook(ABC):
|
|
73
|
+
@abstractmethod
|
|
74
|
+
def after_success(
|
|
75
|
+
self, hook_ctx: AfterSuccessContext, response: httpx.Response
|
|
76
|
+
) -> Union[httpx.Response, Exception]:
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class AfterErrorHook(ABC):
|
|
81
|
+
@abstractmethod
|
|
82
|
+
def after_error(
|
|
83
|
+
self,
|
|
84
|
+
hook_ctx: AfterErrorContext,
|
|
85
|
+
response: Optional[httpx.Response],
|
|
86
|
+
error: Optional[Exception],
|
|
87
|
+
) -> Union[Tuple[Optional[httpx.Response], Optional[Exception]], Exception]:
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class Hooks(ABC):
|
|
92
|
+
@abstractmethod
|
|
93
|
+
def register_sdk_init_hook(self, hook: SDKInitHook):
|
|
94
|
+
pass
|
|
95
|
+
|
|
96
|
+
@abstractmethod
|
|
97
|
+
def register_before_request_hook(self, hook: BeforeRequestHook):
|
|
98
|
+
pass
|
|
99
|
+
|
|
100
|
+
@abstractmethod
|
|
101
|
+
def register_after_success_hook(self, hook: AfterSuccessHook):
|
|
102
|
+
pass
|
|
103
|
+
|
|
104
|
+
@abstractmethod
|
|
105
|
+
def register_after_error_hook(self, hook: AfterErrorHook):
|
|
106
|
+
pass
|
glean/_version.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
import importlib.metadata
|
|
4
|
+
|
|
5
|
+
__title__: str = "glean"
|
|
6
|
+
__version__: str = "0.1.0-beta.2"
|
|
7
|
+
__openapi_doc_version__: str = "0.9.0"
|
|
8
|
+
__gen_version__: str = "2.597.9"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.1.0-beta.2 2.597.9 0.9.0 glean"
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
if __package__ is not None:
|
|
13
|
+
__version__ = importlib.metadata.version(__package__)
|
|
14
|
+
except importlib.metadata.PackageNotFoundError:
|
|
15
|
+
pass
|