diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index c34ed015..42424d6d 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: 3e3290ca-0ee8-4981-b1bc-14536048fa63 management: - docChecksum: a20695749796cddfd0cc7c0e4a12a7ab + docChecksum: b85f212c97dab6a91197c069ebd0e114 docVersion: 0.9.0 - speakeasyVersion: 1.770.0 - generationVersion: 2.893.0 - releaseVersion: 0.13.0 - configChecksum: fbdf6564dabfc66d8d43921f9aab9d41 + speakeasyVersion: 1.774.1 + generationVersion: 2.899.1 + releaseVersion: 0.13.1 + configChecksum: d134962da132517a828e8eafe81760bd repoURL: https://github.com/gleanwork/api-client-python.git installationURL: https://github.com/gleanwork/api-client-python.git published: true persistentEdits: - generation_id: 987864f6-cd1e-4c05-a16b-4739643415d0 - pristine_commit_hash: 06cc8c7f7c551cc2f82ad39dd38c63fe2ca63e29 - pristine_tree_hash: 9cd8d96d15f384f677b54671075391a45cdd533f + generation_id: 631bc743-d418-4d3a-a230-4ff655fc3d3c + pristine_commit_hash: 3aa552b57a7addc9115b2a70964049ea7d03d0e7 + pristine_tree_hash: e2a2e6b479645b6241aab7661f66ee421efd67b5 features: python: acceptHeaders: 3.0.0 @@ -21,7 +21,7 @@ features: additionalProperties: 1.0.1 configurableModuleName: 0.2.0 constsAndDefaults: 1.0.7 - core: 6.0.24 + core: 6.0.28 defaultEnabledRetries: 0.2.0 deprecations: 3.0.2 devContainers: 3.0.0 @@ -36,7 +36,7 @@ features: globalSecurityFlattening: 1.0.0 globalServerURLs: 3.2.1 groups: 3.0.1 - methodArguments: 1.1.0 + methodArguments: 1.1.1 methodServerURLs: 3.1.2 mockServer: 0.1.4 multipartFileContentType: 1.0.0 @@ -612,6 +612,10 @@ trackedFiles: id: fdce0b0bc491 last_write_checksum: sha1:6ba12c90efff718bdd939e773d0426df695090d4 pristine_git_object: dd22b66754081ff30b9d76cfc937603c6d80d965 + docs/models/createagentrequest.md: + id: 9484bab389c1 + last_write_checksum: sha1:2d1e18eb538b82a4e4448cf66696872d8f138b9c + pristine_git_object: 6d556c537edb110ad9d80ee992b5f12a3974713e docs/models/createannouncementrequest.md: id: a37b0e57dfe9 last_write_checksum: sha1:5da6f2bd206ac915200248706e91c0601a4c7d79 @@ -672,6 +676,10 @@ trackedFiles: id: 82707fc9efe5 last_write_checksum: sha1:320bddb9b5ab5dec88760d844b2d585aea2d87f8 pristine_git_object: f3315390350a0db0d3eded212d626abc52c0c834 + docs/models/createworkflowrequest.md: + id: dd9173517846 + last_write_checksum: sha1:0c65e19e884a9444d65dbe54e93073f7d2f7d88f + pristine_git_object: e955a419d336ed9e949e8cab1f341aac83901665 docs/models/currentactiveusers.md: id: 8c45d84c2408 last_write_checksum: sha1:74a4477b894de8d1caca58492504b472a82a94c2 @@ -2838,8 +2846,8 @@ trackedFiles: pristine_git_object: 61dd41f0319201cc105e29174ab1cc0018cecbce docs/sdks/agents/README.md: id: 5965d8232fd8 - last_write_checksum: sha1:f78cc3314d4fdb3c52fcf5b49e01706bc2832bde - pristine_git_object: b929a12d5df1c8a99533448d6c5e6d60f4e17fc0 + last_write_checksum: sha1:48c7b15dfcda891f9a1a2e5ad4bd6eac6f1ca056 + pristine_git_object: 00789fbf58096090a54c254a0f112588042626cb docs/sdks/announcements/README.md: id: 3d2e130a217c last_write_checksum: sha1:ecfa655bb27dee6890656542cfafda0aa6ed1ab9 @@ -2990,8 +2998,8 @@ trackedFiles: pristine_git_object: 79e388be87446ab6a4064b372bad0e8376d0cb5e pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:a3a7799c7cc183344491cfa36f7a0b3c7aba85ff - pristine_git_object: f34dd6a5342bf6af6b1000135c5f479020c0c39b + last_write_checksum: sha1:3159bd445181fc0d0f3097d2b1a72e11f767d0db + pristine_git_object: af1e59cf30ac3ab37f9dc80989f7233e43882a7d scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:c2c83f71dea61eb50c9e05da83b16d18b4da8794 @@ -3018,20 +3026,20 @@ trackedFiles: pristine_git_object: 58c4d70ac1797b86ff5c4237cafbc344c42d8f64 src/glean/api_client/_version.py: id: 0ce22b26136b - last_write_checksum: sha1:ea55ade5532c483da10f1cfec9b6ceccde7522d6 - pristine_git_object: 8d9da6a0d3001f2f5448cc7fb89443c4d02ba5ad + last_write_checksum: sha1:b8c9cc420acd566f8168ecf372d6fb58bb3c6be2 + pristine_git_object: fccef4d70ee2e1758e63bc87d76a559e13017aee src/glean/api_client/agents.py: id: b925701a9217 - last_write_checksum: sha1:c90940a6d28847540858c932148d29ef50cac7ec - pristine_git_object: 99f5f6604807830add51abbd79fa0fc82572a11c + last_write_checksum: sha1:c0ef88b0ad7565cfb342c2311587d70e0f18ae57 + pristine_git_object: 2be171859072eeaa3ea7c0bb77de271caa792ed6 src/glean/api_client/announcements.py: id: 452f3d593912 - last_write_checksum: sha1:0767c840c29bba9e3c95bbbd714df374f2907b00 - pristine_git_object: 33123a0a80e55c210fcfb07e47dc9c7cac7e15d9 + last_write_checksum: sha1:63ce0f301a88a9524ab6bbc75d617fea68d283e4 + pristine_git_object: 48d83997d1802da6a568e6fd004aafd9f03b460d src/glean/api_client/answers.py: id: 184a18f8be7e - last_write_checksum: sha1:b839b0e5abf3b11790a98fe100f84f5a3b3254e9 - pristine_git_object: 0757b71f8300ccbd72db4c292ffdf03b03f93231 + last_write_checksum: sha1:910e131bf3b9ce135961b4c810ba008cb0d2ceb9 + pristine_git_object: 20c371ad26e9a541915bbd16eeb9c1c2137a453e src/glean/api_client/authentication.py: id: 84ebb3cfd339 last_write_checksum: sha1:9274054daf1c09ba374849588b20349b079088ea @@ -3050,52 +3058,52 @@ trackedFiles: pristine_git_object: 122be2b984e54e47078c9b37e5722f1aa78b6e28 src/glean/api_client/client_activity.py: id: 8227dd95d034 - last_write_checksum: sha1:7c9fa340b6f5fde6a298fe96f5631cf0b65c7cf0 - pristine_git_object: 0fc1ce18d5ce25d5a371abf17dc974932bb603a8 + last_write_checksum: sha1:dd786de146fb18f813abe7454dee4e40158e5347 + pristine_git_object: 5465d474c851a08895630a7fa9fbd0bc421a0d61 src/glean/api_client/client_agents.py: id: 61b53ccd2b3b - last_write_checksum: sha1:6d12ed745ef6012f59c318195e84c3099e96b081 - pristine_git_object: 6e1ff0f49e8924942f90c22977e38af3d6fb865d + last_write_checksum: sha1:b4b711854c3e872d47a66c271801649453ba19fe + pristine_git_object: 7bc31e5f9550cbd02513002e870af19657c1f134 src/glean/api_client/client_authentication.py: id: 0b237b7c1b11 last_write_checksum: sha1:534efe91d637ae41aa5791b672b2ef91a3fbb81b pristine_git_object: b2e67417be8b3c4927603fb275831447988e9de6 src/glean/api_client/client_chat.py: id: 42cbb9b5acf3 - last_write_checksum: sha1:75b70a975b72b0a748a33fbea4c2e951c89265ca - pristine_git_object: f1e89630d067883690a6fe35687b58a8d2db627e + last_write_checksum: sha1:628139d93bfd23dd4d4956acc9ec0d0f668cc727 + pristine_git_object: f506bfc8a02a5eb8444e02da81daeccc2882bea3 src/glean/api_client/client_documents.py: id: dac599de515c - last_write_checksum: sha1:7a41dae11c9e0c58be6e2e8fe07be6f78d8f24bb - pristine_git_object: c270bf21a93e6b5f3befa10e8975635f18ae2fe9 + last_write_checksum: sha1:f960872f8feecf156459dbfbf2724386df439837 + pristine_git_object: 720450643daf37a932928927b01d2018ffdc33d3 src/glean/api_client/client_entities.py: id: 5a17ae87ac6c - last_write_checksum: sha1:ca58f63deb474cbf31b3da3229e5cc6842631c21 - pristine_git_object: 67fbc0db4c5234d05613f9f37fcf7c382316ecc1 + last_write_checksum: sha1:36b6d96baecd1561239afa1eeaa2b2e09f2bb7be + pristine_git_object: 8f19017d1ada17a9da7b6d2370615f76f70fc01a src/glean/api_client/client_governance.py: id: 106860f10ce0 last_write_checksum: sha1:ebe769873505002b9f00342174c7fd2508af52b6 pristine_git_object: 6011411d2ab08645047358a30c0a87aec61555bc src/glean/api_client/client_shortcuts.py: id: 5ef5dacbcba9 - last_write_checksum: sha1:6bfa420d42f76ed01b60f93abf77ef404d8fa631 - pristine_git_object: a4db274d2b324b9b24a9aa2e5673b229f44d45f1 + last_write_checksum: sha1:a3b62ef016f7254425b99a17df6f16963ac57055 + pristine_git_object: b994e7d26ad43217437c5d5c2d897432db39b794 src/glean/api_client/client_tools.py: id: df600583b558 - last_write_checksum: sha1:5309a9ee24043c49e41c757f575c3d2af899dca3 - pristine_git_object: 14d9f68cc6a74ea72988f7d041dfeb4bffa61921 + last_write_checksum: sha1:3ccc63fabeb10d5578eeebdffdbc93501ce8d9c2 + pristine_git_object: 7cfb900c12ade96665ddc562b525d624166146d2 src/glean/api_client/client_verification.py: id: 211199afa506 last_write_checksum: sha1:468067c52776c584837bccef6db419ea5b339d79 pristine_git_object: 69a3abb71a49fc4cbdb64523f90877d308d1f886 src/glean/api_client/collections.py: id: df34f0fd10dd - last_write_checksum: sha1:f974525cf6b9db9f6be2085224b34653adb9894a - pristine_git_object: f93e472ce543b8e4e46e53c013c680b4f0f031ed + last_write_checksum: sha1:4d5d630346e7f8250b3ecdde182a01129895eb9e + pristine_git_object: fe1c6c917aaf2a5952ccccc7f6ca89a5f39d7313 src/glean/api_client/custommetadata.py: id: d5621a2ad56e - last_write_checksum: sha1:f50c4d35b769079359d852c2f31bcf7237422e38 - pristine_git_object: da51ad9d6751b4fc689538f37db09201189ccb6d + last_write_checksum: sha1:8e5c52c366e4a641bbf160d814757689c059e080 + pristine_git_object: 768525cb007456a3036b7dd42f9cf227c6b814ba src/glean/api_client/data.py: id: 21cf13413429 last_write_checksum: sha1:f03b31e07a912efca080d9298fbb45e16590702c @@ -3146,8 +3154,8 @@ trackedFiles: pristine_git_object: 3e029c12197bb87be06e01323afbc495968a6eaa src/glean/api_client/governance.py: id: e30db8f06e58 - last_write_checksum: sha1:0104a09486062677211230ce8fe2c3dab32a1da1 - pristine_git_object: fd67e05d451590fe3337ad8c8728141035d62294 + last_write_checksum: sha1:90fd16566302ac8cc6529893b7bd4e765033392d + pristine_git_object: 2e662f2bc0f2e2d8ab7afa8ea910b8cca14c2ae1 src/glean/api_client/governance_documents.py: id: e5ab033181fd last_write_checksum: sha1:761beada29ea72f570c55e6377706671d3b8fcbd @@ -3170,20 +3178,20 @@ trackedFiles: pristine_git_object: 0bb158571a104fc4434c1e37680aeb6b7c361e38 src/glean/api_client/indexing_datasources.py: id: 9520e2db8686 - last_write_checksum: sha1:3ac36de64f6216aae0dd69f046bb235dc8bbb8b4 - pristine_git_object: b8b091e823c403c72782ec71db1015aaa6e1cfd9 + last_write_checksum: sha1:d802091ca98a5f4582d95c564117253293405f54 + pristine_git_object: aadeae1444882e049543266e4a9cc1ccc51ae403 src/glean/api_client/indexing_documents.py: id: b5c2b64ee1fa - last_write_checksum: sha1:488660c9bc6160d20012c5e5ab7904c56c276b34 - pristine_git_object: 9817af75d822b6cc1e9eab2ba736819507b0a887 + last_write_checksum: sha1:dd5228d458d97e7f27faa2baed099afaab82f01d + pristine_git_object: 0fc7c88907b6ff0013dd89c8c4e40990b6c8dccb src/glean/api_client/indexing_permissions.py: id: 86fd3f14396c - last_write_checksum: sha1:3e0cb356c1ecc74b3c4fe356b81a3f9e71abe602 - pristine_git_object: c41d5c914dde853dc5403675c3fe0a6108c8db21 + last_write_checksum: sha1:aa1a085d8ab9c2939734b05328304b0b96889379 + pristine_git_object: ce426af46bb46345c41157c4efe7497bbe1f95ca src/glean/api_client/indexing_shortcuts.py: id: e833440cda56 - last_write_checksum: sha1:0dda65c83c173524f8ab4574b8c2b17c3ec884f1 - pristine_git_object: bdfdec85c7d5d5b2cd2cbd09fe5578a78b83c6aa + last_write_checksum: sha1:1254d6adcb57716e131e30e18c46cd18d68f89ba + pristine_git_object: 8e657a10010fd770dea4db539757b6837c34a138 src/glean/api_client/insights.py: id: 4c5708d15234 last_write_checksum: sha1:28398156138e38f0cb8d185bacd54b5aa2cc3ce2 @@ -3194,8 +3202,8 @@ trackedFiles: pristine_git_object: fd580d9a1b7770b488fc424b5f8735d8b9bf681e src/glean/api_client/models/__init__.py: id: d5f6ea5efcbe - last_write_checksum: sha1:5d16cf04d5ea346a12e547e4bfb5ec60f2a656a9 - pristine_git_object: 101111712c9ec0750a3b5599790b4acbf5c9b0e7 + last_write_checksum: sha1:250b75f85cff98c2b34cfdeae92a1178b18361a9 + pristine_git_object: 2563cb4df4dd05307338eb02843f57d7b6b5528e src/glean/api_client/models/actionauthtype.py: id: c7402f35092d last_write_checksum: sha1:7aaa5d1c11b105d0d7265e2a83cb005aafa89645 @@ -3616,6 +3624,10 @@ trackedFiles: id: 2ff7e2d8021d last_write_checksum: sha1:5203cc6e6506bd574e163b2b18d879c4b19c8a99 pristine_git_object: 83d1aa3b243827c0f27678d94a209aac0a4417b3 + src/glean/api_client/models/createagentop.py: + id: bca1b44cf62a + last_write_checksum: sha1:bc9b540e390ca872fe40d0188311660a039a3881 + pristine_git_object: 4ed4192dbb6da328182b40d002360698706b872e src/glean/api_client/models/createannouncementop.py: id: bf2cd073d77d last_write_checksum: sha1:a636cc5aa94d72878446b69b6ca0e3e91482de2c @@ -3664,6 +3676,10 @@ trackedFiles: id: 65fdd9436d15 last_write_checksum: sha1:285ec74a6e451aa0a6698d663cf501dbd0a24bd6 pristine_git_object: 7fd2e6eb90ed6027e2647312ca3550abc0292b74 + src/glean/api_client/models/createworkflowrequest.py: + id: d084964549e1 + last_write_checksum: sha1:8575c9df02747f481fa8723f4a985c0bded046a3 + pristine_git_object: 206d00f37547917505f9c5a54aaffe7dc6aaf224 src/glean/api_client/models/currentactiveusers.py: id: 0a092cf79074 last_write_checksum: sha1:989717f16473a1c661194af34f9940eb00a26e01 @@ -5382,12 +5398,12 @@ trackedFiles: pristine_git_object: 85e816dc7cea2c95b4e067d756e428be2696d0a4 src/glean/api_client/people.py: id: e32c03723ded - last_write_checksum: sha1:5e61d51a667fef9cab9fc6f597a17fcff6df1f79 - pristine_git_object: 8f853d2a543d89ce7553b9e67dd3cf6bfc64c2b7 + last_write_checksum: sha1:8896032bffef1f93990712a1aa6aefbd0bf8b255 + pristine_git_object: 9d0027767af65a0c033f141c05e8464528831195 src/glean/api_client/pins.py: id: 4a37ead65f8a - last_write_checksum: sha1:064a62119d9345a93c5b14a465e70e88df97e591 - pristine_git_object: 0127c0074ca0c944349830ab3806d893f1c4ba4e + last_write_checksum: sha1:67d310095ef3713b8fd8745402b2d54e40331d1e + pristine_git_object: 8635dd29bf9b30ec0a9f8396d501e55c8a624d1f src/glean/api_client/policies.py: id: 680f941e0620 last_write_checksum: sha1:b2509e090e4e63b42c01a0592bcdf857122b7c02 @@ -5410,8 +5426,8 @@ trackedFiles: pristine_git_object: 22e0a4eab0ef8e54dcfd986084d01c14a56f47a6 src/glean/api_client/search.py: id: a3b404a8b402 - last_write_checksum: sha1:69ed4e3adb9f484f5b83d601aa6c7cce686b2055 - pristine_git_object: 2274683221d56688636689111335be70ddf62a99 + last_write_checksum: sha1:b791a69934ab2eb1e0caa2bf0cb059022ca3666b + pristine_git_object: d599dd5aa7a7a4a22d3ec866631965f2cd473cd2 src/glean/api_client/tools.py: id: 3ea40147c1cc last_write_checksum: sha1:c9b1636b2cde77d5a505ce01225171a4305e36d9 @@ -5454,8 +5470,8 @@ trackedFiles: pristine_git_object: 3324e1bc2668c54c4d5f5a1a845675319757a828 src/glean/api_client/utils/eventstreaming.py: id: fdc3230ebb0e - last_write_checksum: sha1:620d78a8b4e3b854e08d136e02e40a01a786bd70 - pristine_git_object: 3bdcd6d3d4fc772cb7f5fca8685dcdc8c85e13e8 + last_write_checksum: sha1:cad7e4feff4f1b2824afd0d30f2b1964a604f4dd + pristine_git_object: 1c189bf6fcad7ba90e0ec6d2f36ca7329d33bb99 src/glean/api_client/utils/forms.py: id: 00f73e14b0f0 last_write_checksum: sha1:0ca31459b99f761fcc6d0557a0a38daac4ad50f4 @@ -5490,8 +5506,8 @@ trackedFiles: pristine_git_object: 4a272f16c2af33f6364bd9aec9cdc33b91f228d2 src/glean/api_client/utils/serializers.py: id: c499367f56e9 - last_write_checksum: sha1:61009f2e4ef6613a1a5af813fe020373dae5a492 - pristine_git_object: d2149f8b909cb96628db140ac3cddb1b1e981367 + last_write_checksum: sha1:7485f1425b0661fd84836186570df90207eec6af + pristine_git_object: 1031ed930bad5ece220cf7416a56c29f40f0588b src/glean/api_client/utils/unmarshal_json_response.py: id: 10872f2f336a last_write_checksum: sha1:8bea26e2247cd1c5b8dc60c70725ad0aed487c6d @@ -5506,8 +5522,8 @@ trackedFiles: pristine_git_object: dae01a44384ac3bc13ae07453a053bf6c898ebe3 src/glean/api_client/visibilityoverrides.py: id: 85e53a1c5de5 - last_write_checksum: sha1:2476bd662c4f99ea96f9f9199e9c0c5402ef2274 - pristine_git_object: ecbc256b43054dcabb7346c9adcd309320f10a93 + last_write_checksum: sha1:2a0a2b50d9a295d4a3e267ac024d5eac4593e510 + pristine_git_object: e7befb7ab605bd398a1ba152cdb20e38b38e62e0 tests/__init__.py: id: 8e911f6351f3 last_write_checksum: sha1:cffdfca8e87b9acc39f414eddf64d233ba5fe450 @@ -5570,8 +5586,8 @@ trackedFiles: pristine_git_object: 929558ef2e1165f7e09da6d0a64f016c90971655 tests/mockserver/internal/handler/generated_handlers.go: id: 61ac4f7cce9e - last_write_checksum: sha1:1efa96a429f9879c5cdb7bd064661b396b568d31 - pristine_git_object: 6400b090e0a8e321f6348ef79d2b14fb83571f7b + last_write_checksum: sha1:c68c837c6af8f55eb8172dbc62ba472d5dde04a8 + pristine_git_object: a8a0a7558361f126dcbf7f995c52b33e660daa37 tests/mockserver/internal/handler/pathdeleterestapiindexcustommetadataschemagroupname.go: id: 979e4583765b last_write_checksum: sha1:b1d4edb259d907c7a88b634bf16f0cf152321693 @@ -5752,6 +5768,10 @@ trackedFiles: id: 3c3d5555c20b last_write_checksum: sha1:8ef1b12ee725ee32fb6a0a1e0e812594df97e06f pristine_git_object: 26fdfdd7e2d2fdffa6ecc736b7a70d6eb1aa5327 + tests/mockserver/internal/handler/pathpostrestapiv1agents.go: + id: b5d188f39094 + last_write_checksum: sha1:b625a3bbaf0748388febcf87d2b92782167c2c63 + pristine_git_object: 6c1367d61758e68e6cb415247e7473355d17c03a tests/mockserver/internal/handler/pathpostrestapiv1autocomplete.go: id: 9830ef01b25b last_write_checksum: sha1:094d64ddc73a91d38e64e3be18690ebb9d4ef3d3 @@ -6428,6 +6448,10 @@ trackedFiles: id: c5f526844132 last_write_checksum: sha1:aa8fbfc7682edb55f79cd9e241d9795d4c8579ea pristine_git_object: df363e8a9dfca1f872da7b286ab2cf7505b2c127 + tests/mockserver/internal/sdk/models/components/createworkflowrequest.go: + id: 92b0c1ccd3f0 + last_write_checksum: sha1:8febb494a066873172f0229af2880901e5f44ef5 + pristine_git_object: 277dd8b7d18f4aa926904cdf892e3475e6e998a6 tests/mockserver/internal/sdk/models/components/currentactiveusers.go: id: 220e7dbe04c9 last_write_checksum: sha1:4c876d24b835be3c5975308c132a4599bc11a71a @@ -7892,6 +7916,10 @@ trackedFiles: id: 89e5236173f5 last_write_checksum: sha1:4ea8a844fedb81791dbff6fd5b45031943c118ed pristine_git_object: 55046755b604159689bf327aa7174a0e080a970e + tests/mockserver/internal/sdk/models/operations/createagent.go: + id: 4338e91202b4 + last_write_checksum: sha1:80daff65223d9d23afb599cb4af805f35c29919b + pristine_git_object: 255e835e82fba8bf4023a2f99c5c2d1af40dd2cf tests/mockserver/internal/sdk/models/operations/createandstreamrun.go: id: e9a974b86a39 last_write_checksum: sha1:ff0bc51a66cdb65f5d36415c82e92377fd0d2cff @@ -8478,8 +8506,8 @@ trackedFiles: pristine_git_object: db4221c9f5953adc8f8219979060f1248ae5c342 tests/test_agents.py: id: 2eb70a860f3a - last_write_checksum: sha1:0c2472116b756d6985f893ff62edb5505e2a260d - pristine_git_object: 1d18b7662e493260672cbaabfcbc8461355ffeba + last_write_checksum: sha1:18a474b39a964820ec42a6d5552ab7961871d286 + pristine_git_object: 46852ff43f1fdbc1c65619cccb7a22f51509104b tests/test_announcements.py: id: 720cc07fca06 last_write_checksum: sha1:1d0dcab6446633bc6809bc67e14b6cc1755aa319 @@ -8574,8 +8602,8 @@ trackedFiles: pristine_git_object: 6cc8aeec3c52329d389081db0a27f10f53f214b9 tests/test_messages.py: id: be23089b1f8b - last_write_checksum: sha1:2404e23964ef6a1f5ddc900402b34e597d2d9617 - pristine_git_object: 132005ec7d1e35f805b6a8c28e07e043bce22f0a + last_write_checksum: sha1:b7415512608102fa07b1990a350a7da66946fe46 + pristine_git_object: 636f01d348f30db3ee81985044634511b615af16 tests/test_people.py: id: 37c243940039 last_write_checksum: sha1:7c7268ffeebe48d81ed25e9b1cfc3a395abf5c1f @@ -8598,8 +8626,8 @@ trackedFiles: pristine_git_object: df2944ebda36db652b2770dd1c23be83df90fc99 tests/test_summarize.py: id: a255d8a6f627 - last_write_checksum: sha1:884caf9e9ba6ac6d6577682c45419d3fd6312dd9 - pristine_git_object: df71d57de672c7e6967ba36b3671d957ef075d55 + last_write_checksum: sha1:e7a682fd4f8263380655d1a2f3dbd583e376a289 + pristine_git_object: ccd9ced13cd14cb1b5cfe5b10ad956bda882783e tests/test_tools.py: id: 70889bdf7321 last_write_checksum: sha1:293cea8c046c30086e5d57cb48aa59ab8da308f1 @@ -9520,6 +9548,13 @@ examples: application/json: {"status": "MISSING"} "400": application/json: {} + createAgent: + speakeasy-default-create-agent: + requestBody: + application/json: {} + responses: + "200": + application/json: {"workflow": {"author": {"name": "George Clooney", "obfuscatedId": "abc123"}, "lastDraftSavedBy": {"name": "George Clooney", "obfuscatedId": "abc123"}, "lastUpdatedBy": {"name": "George Clooney", "obfuscatedId": "abc123"}}} examplesVersion: 1.0.2 generatedTests: activity: "2025-04-28T22:05:12+01:00" @@ -9681,7 +9716,11 @@ generatedTests: delete_/rest/api/index/custom-metadata/schema/{groupName}: "2026-06-05T03:54:47Z" getDatasourceCredentialStatus: "2026-06-05T03:54:47Z" rotateDatasourceCredentials: "2026-06-05T03:54:47Z" -releaseNotes: "## Python SDK Changes:\n* `glean.client.collections.add_items()`: `response` **Changed** (Breaking ⚠️)\n* `glean.chat.get_chat_file()`: **Added**\n* `glean.agents.edit_agent()`: **Added**\n* `glean.entities.get_person_photo()`: **Added**\n* `glean.tools.get_action_pack_auth_status()`: **Added**\n* `glean.tools.authorize_action_pack()`: **Added**\n* `glean.indexing.custom_metadata.upsert()`: **Added**\n* `glean.indexing.custom_metadata.delete()`: **Added**\n* `glean.indexing.custom_metadata.get_schema()`: **Added**\n* `glean.indexing.custom_metadata.upsert_schema()`: **Added**\n* `glean.indexing.custom_metadata.delete_schema()`: **Added**\n* `glean.troubleshooting.post_/api/index/v1/debug/{datasource}/document/events()`: **Added**\n* `glean.datasources.get_datasource_credential_status()`: **Added**\n* `glean.datasources.rotate_datasource_credentials()`: **Added**\n* `glean.client.activity.feedback()`: \n * `request.feedback1.category` **Changed**\n* `glean.client.announcements.create()`: \n * `request.body.structured_list[].document.metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n * `response` **Changed**\n* `glean.client.announcements.update()`: \n * `request.body.structured_list[].document.metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n * `response` **Changed**\n* `glean.client.answers.create()`: \n * `request.data.added_roles[].person.related_documents[]` **Changed**\n * `response` **Changed**\n* `glean.client.answers.update()`: \n * `request.added_roles[].person.related_documents[]` **Changed**\n * `response` **Changed**\n* `glean.client.answers.retrieve()`: `response.answer_result.answer` **Changed**\n* `glean.client.answers.list()`: `response.answer_results[].answer` **Changed**\n* `glean.client.chat.create()`: \n * `request.messages[].citations[].source_document.metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n * `response.messages[].citations[].source_document.metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n* `glean.client.chat.retrieve()`: `response.chat_result.chat.created_by.related_documents[]` **Changed**\n* `glean.client.chat.list()`: `response.chat_results[].chat.created_by.related_documents[]` **Changed**\n* `glean.client.chat.create_stream()`: \n * `request.messages[].citations[].source_document.metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n* `glean.client.collections.create()`: \n * `request.added_roles[].person.related_documents[]` **Changed**\n * `response.union(class (0))` **Changed**\n * `error_code.enum(corrupt_item)` **Added**\n* `glean.client.collections.delete()`: `error_code.enum(corrupt_item)` **Added**\n* `glean.client.collections.delete_item()`: `response.collection` **Changed**\n* `glean.client.collections.update()`: \n * `request.added_roles[].person.related_documents[]` **Changed**\n * `response` **Changed**\n * `error_code.enum(corrupt_item)` **Added**\n* `glean.client.collections.update_item()`: `response.collection` **Changed**\n* `glean.client.collections.retrieve()`: `response` **Changed**\n* `glean.client.collections.list()`: `response.collections[]` **Changed**\n* `glean.client.documents.retrieve()`: `response.documents.Map.union(Document).metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n* `glean.client.documents.retrieve_by_facets()`: `response.documents[].metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n* `glean.client.insights.retrieve()`: \n * `request` **Changed**\n * `response` **Changed**\n* `glean.client.messages.retrieve()`: `response.search_response.results[].structured_results[]` **Changed**\n* `glean.client.pins.update()`: `response.attribution.related_documents[]` **Changed**\n* `glean.client.pins.retrieve()`: `response.pin.attribution.related_documents[]` **Changed**\n* `glean.client.pins.list()`: `response.pins[].attribution.related_documents[]` **Changed**\n* `glean.client.pins.create()`: `response.attribution.related_documents[]` **Changed**\n* `glean.client.search.query_as_admin()`: \n * `request.source_document.metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n * `response.results[].structured_results[]` **Changed**\n* `glean.client.search.autocomplete()`: `response.results[].document.metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n* `glean.client.search.retrieve_feed()`: \n * `request.categories[]` **Changed**\n * `response.results[]` **Changed**\n* `glean.client.search.recommendations()`: \n * `request.source_document.metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n * `response.results[].structured_results[]` **Changed**\n* `glean.client.search.query()`: \n * `request.source_document.metadata.author.related_documents[].results[].structured_results[].answer` **Changed**\n * `response.results[].structured_results[]` **Changed**\n* `glean.client.entities.list()`: `response.results[].related_documents[]` **Changed**\n* `glean.client.entities.read_people()`: `response.results[].related_documents[]` **Changed**\n* `glean.client.shortcuts.create()`: \n * `request.data.added_roles[].person.related_documents[]` **Changed**\n * `response.shortcut.added_roles[].person.related_documents[]` **Changed**\n* `glean.client.shortcuts.retrieve()`: `response.shortcut.added_roles[].person.related_documents[]` **Changed**\n* `glean.client.shortcuts.list()`: `response.shortcuts[].added_roles[].person.related_documents[]` **Changed**\n* `glean.client.shortcuts.update()`: \n * `request.added_roles[].person.related_documents[]` **Changed**\n * `response.shortcut.added_roles[].person.related_documents[]` **Changed**\n* `glean.client.verification.add_reminder()`: `response.metadata.last_verifier.related_documents[]` **Changed**\n* `glean.client.verification.list()`: `response.documents[].metadata.last_verifier.related_documents[]` **Changed**\n* `glean.client.verification.verify()`: `response.metadata.last_verifier.related_documents[]` **Changed**\n" + createAgent: "2026-06-10T03:51:35Z" +releaseNotes: | + ## Python SDK Changes: + * `glean.client.chat.create()`: `response.status[202]` **Added** (Breaking ⚠️) + * `glean.agents.create_agent()`: **Added** generatedFiles: - .devcontainer/README.md - .devcontainer/devcontainer.json diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 8423ecdd..4c90b9f9 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -34,7 +34,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: true python: - version: 0.13.0 + version: 0.13.1 additionalDependencies: dev: {} main: {} @@ -54,6 +54,9 @@ python: enableCustomCodeRegions: false enumFormat: enum envVarPrefix: GLEAN + eventStreamClassNames: + async: EventStreamAsync + sync: EventStream fixFlags: asyncPaginationSep2025: false conflictResistantModelImportsFeb2026: false @@ -73,6 +76,7 @@ python: webhooks: "" inferUnionDiscriminators: true inputModelSuffix: input + inputTypedDictSuffix: TypedDict legacyPyright: true license: "" maxMethodParams: 999 diff --git a/.speakeasy/glean-merged-spec.yaml b/.speakeasy/glean-merged-spec.yaml index bd780d7e..ebf166a3 100644 --- a/.speakeasy/glean-merged-spec.yaml +++ b/.speakeasy/glean-merged-spec.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: version: 0.9.0 title: Glean API - x-source-commit-sha: deacbe1e0fd0b5074c1b1445f05b4a5df529f487 + x-source-commit-sha: 8458b85efeec4d5befaff7fc026de038dd4e0a37 description: | # Introduction In addition to the data sources that Glean has built-in support for, Glean also provides a REST API that enables customers to put arbitrary content in the search index. This is useful, for example, for doing permissions-aware search over content in internal tools that reside on-prem as well as for searching over applications that Glean does not currently support first class. In addition these APIs allow the customer to push organization data (people info, organization structure etc) into Glean. @@ -22,7 +22,7 @@ info: These API clients provide type-safe, idiomatic interfaces for working with Glean IndexingAPIs in your language of choice. x-logo: url: https://app.glean.com/images/glean-text2.svg - x-open-api-commit-sha: 7de1c5956c93a8bdd7b4a2c6a4c6fd98b0c4df70 + x-open-api-commit-sha: eda03784613fbf650c37fbb500f523881aef2ea0 x-speakeasy-name: 'Glean API' servers: - url: https://{instance}-be.glean.com @@ -569,6 +569,23 @@ paths: startIndex: 0 endIndex: 12 type: CITATION + "202": + description: | + Request accepted but not yet processed. Returned when another + in-flight request is already running for the same chat session; + the body's `queuedRequestId` identifies the deferred run and + output will be persisted to the chat session referenced by + `chatId`. + content: + application/json: + schema: + $ref: "#/components/schemas/ChatResponse" + examples: + queuedExample: + value: + chatId: abc123 + queuedRequestId: qr-xyz + isSavedToChatHistory: true "400": description: Invalid request "401": @@ -893,6 +910,40 @@ paths: description: Internal server error. security: - APIToken: [] + /rest/api/v1/agents: + post: + tags: + - Agents + summary: Create an agent + description: Create an agent. + operationId: createAgent + x-visibility: Preview + parameters: + - $ref: "#/components/parameters/locale" + - $ref: "#/components/parameters/timezoneOffset" + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateWorkflowRequest" + responses: + "200": + description: Success + content: + application/json: + schema: + $ref: "#/components/schemas/CreateWorkflowResponse" + "400": + description: Bad request + "401": + description: Not Authorized + "403": + description: Forbidden + "500": + description: Internal server error + security: + - APIToken: [] /rest/api/v1/agents/{agent_id}: get: tags: @@ -8973,6 +9024,80 @@ components: items: type: string description: IDs of files to delete. + WorkflowDraftableProperties: + properties: + name: + type: string + description: The name of the workflow. + WorkflowMutableProperties: + type: object + allOf: + - $ref: "#/components/schemas/WorkflowDraftableProperties" + - type: object + CreateWorkflowRequest: + allOf: + - $ref: "#/components/schemas/WorkflowMutableProperties" + - type: object + properties: + transient: + type: boolean + description: Used to create a transient workflow. + parentWorkflowId: + type: string + description: id of the parent workflow for transient workflows + WorkflowMetadata: + allOf: + - type: object + properties: + author: + $ref: "#/components/schemas/Person" + createTimestamp: + type: integer + description: Server Unix timestamp of the creation time. + lastUpdateTimestamp: + type: integer + description: Server Unix timestamp of the last update time. + lastDraftSavedAt: + type: integer + description: Server Unix timestamp of the last time the draft was saved. + lastDraftSavedBy: + description: The person who last saved the draft. + $ref: "#/components/schemas/Person" + lastDraftGitAuthorId: + type: string + description: ID of the VCS user (e.g. GitHub username) who last saved the draft. Set only by the draft save path via the external Git integration API. + lastUpdatedBy: + $ref: "#/components/schemas/Person" + AttributionProperties: {} + Workflow: + allOf: + - $ref: "#/components/schemas/PermissionedObject" + - $ref: "#/components/schemas/WorkflowMutableProperties" + - $ref: "#/components/schemas/WorkflowMetadata" + - $ref: "#/components/schemas/AttributionProperties" + - type: object + properties: + id: + type: string + description: The ID of the workflow. + verified: + type: boolean + readOnly: true + description: When present, indicates this workflow is admin-verified. Set via the dedicated admin settings endpoint, not by regular edits. + showOrganizationAsAuthor: + type: boolean + readOnly: true + description: When true, displays organization name instead of author name in agent card. Set via the dedicated admin settings endpoint, not by regular edits. + WorkflowResult: + type: object + required: + - workflow + properties: + workflow: + $ref: "#/components/schemas/Workflow" + CreateWorkflowResponse: + allOf: + - $ref: "#/components/schemas/WorkflowResult" Agent: title: Agent type: object @@ -9025,16 +9150,6 @@ components: message: type: string description: Client-facing error message describing what went wrong - WorkflowDraftableProperties: - properties: - name: - type: string - description: The name of the workflow. - WorkflowMutableProperties: - type: object - allOf: - - $ref: "#/components/schemas/WorkflowDraftableProperties" - - type: object EditWorkflowRequest: allOf: - $ref: "#/components/schemas/WorkflowMutableProperties" @@ -11293,7 +11408,6 @@ components: description: A list of removed user roles for the Workflow. items: $ref: "#/components/schemas/UserRoleSpecification" - AttributionProperties: {} PromptTemplate: allOf: - $ref: "#/components/schemas/PromptTemplateMutableProperties" @@ -11369,55 +11483,6 @@ components: runCount: $ref: "#/components/schemas/CountInfo" description: This tracks how many times this prompt template was run. If user runs a prompt template after modifying the original one, it still counts as a run for the original template. - WorkflowMetadata: - allOf: - - type: object - properties: - author: - $ref: "#/components/schemas/Person" - createTimestamp: - type: integer - description: Server Unix timestamp of the creation time. - lastUpdateTimestamp: - type: integer - description: Server Unix timestamp of the last update time. - lastDraftSavedAt: - type: integer - description: Server Unix timestamp of the last time the draft was saved. - lastDraftSavedBy: - description: The person who last saved the draft. - $ref: "#/components/schemas/Person" - lastDraftGitAuthorId: - type: string - description: ID of the VCS user (e.g. GitHub username) who last saved the draft. Set only by the draft save path via the external Git integration API. - lastUpdatedBy: - $ref: "#/components/schemas/Person" - Workflow: - allOf: - - $ref: "#/components/schemas/PermissionedObject" - - $ref: "#/components/schemas/WorkflowMutableProperties" - - $ref: "#/components/schemas/WorkflowMetadata" - - $ref: "#/components/schemas/AttributionProperties" - - type: object - properties: - id: - type: string - description: The ID of the workflow. - verified: - type: boolean - readOnly: true - description: When present, indicates this workflow is admin-verified. Set via the dedicated admin settings endpoint, not by regular edits. - showOrganizationAsAuthor: - type: boolean - readOnly: true - description: When true, displays organization name instead of author name in agent card. Set via the dedicated admin settings endpoint, not by regular edits. - WorkflowResult: - type: object - required: - - workflow - properties: - workflow: - $ref: "#/components/schemas/Workflow" UserActivity: properties: actor: diff --git a/.speakeasy/tests.arazzo.yaml b/.speakeasy/tests.arazzo.yaml index 48029e67..4f92272d 100644 --- a/.speakeasy/tests.arazzo.yaml +++ b/.speakeasy/tests.arazzo.yaml @@ -158705,3 +158705,19 @@ workflows: type: simple x-speakeasy-test-group: Datasources x-speakeasy-test-rebuild: true + - workflowId: createAgent + steps: + - stepId: test + operationId: createAgent + requestBody: + contentType: application/json + payload: {} + successCriteria: + - condition: $statusCode == 200 + - condition: $response.header.Content-Type == application/json + - context: $response.body + condition: | + {"workflow":{"author":{"name":"George Clooney","obfuscatedId":"abc123"},"lastDraftSavedBy":{"name":"George Clooney","obfuscatedId":"abc123"},"lastUpdatedBy":{"name":"George Clooney","obfuscatedId":"abc123"}}} + type: simple + x-speakeasy-test-group: Agents + x-speakeasy-test-rebuild: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 92827bbf..5ccd60aa 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.770.0 +speakeasyVersion: 1.774.1 sources: Glean API: sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:500649ecd919cc2dcfeb6c54fe552ddcf8628a42b2f67a2ef0f206ad8561a56c - sourceBlobDigest: sha256:cb8902f4548ad637f07f6be9b7ef3f0d5fda8fe6f6540c7eea338bf4dde98413 + sourceRevisionDigest: sha256:dd9eb91f0a42152889334650de4a7a12ab261520792a3aff77a32ee40d1a114a + sourceBlobDigest: sha256:d2a18c0e49eef76ffc808b6211e8e59704c293516b048d0d9a83ccdf1acb6008 tags: - latest Glean Client API: @@ -16,10 +16,10 @@ targets: glean: source: Glean API sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:500649ecd919cc2dcfeb6c54fe552ddcf8628a42b2f67a2ef0f206ad8561a56c - sourceBlobDigest: sha256:cb8902f4548ad637f07f6be9b7ef3f0d5fda8fe6f6540c7eea338bf4dde98413 + sourceRevisionDigest: sha256:dd9eb91f0a42152889334650de4a7a12ab261520792a3aff77a32ee40d1a114a + sourceBlobDigest: sha256:d2a18c0e49eef76ffc808b6211e8e59704c293516b048d0d9a83ccdf1acb6008 codeSamplesNamespace: glean-api-specs-python-code-samples - codeSamplesRevisionDigest: sha256:cc23275cb351da5ef6256061aed3868dab2d09e7764658ea22e4958928b42d8c + codeSamplesRevisionDigest: sha256:60aa38a0f093349fa189ac4f535bcdf0b2bc99464ffb48ebf83b4318400ff5de workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 203405ee..f5a59cba 100644 --- a/README.md +++ b/README.md @@ -339,6 +339,7 @@ For more information on obtaining the appropriate token type, please contact you ### [Agents](docs/sdks/agents/README.md) +* [create_agent](docs/sdks/agents/README.md#create_agent) - Create an agent * [edit_agent](docs/sdks/agents/README.md#edit_agent) - Edit an agent ### [Authentication](docs/sdks/authentication/README.md) diff --git a/RELEASES.md b/RELEASES.md index 87ea457d..2977d80b 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -748,4 +748,14 @@ Based on: ### Generated - [python v0.13.0] . ### Releases -- [PyPI v0.13.0] https://pypi.org/project/glean-api-client/0.13.0 - . \ No newline at end of file +- [PyPI v0.13.0] https://pypi.org/project/glean-api-client/0.13.0 - . + +## 2026-06-10 03:50:46 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.774.1 (2.899.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.13.1] . +### Releases +- [PyPI v0.13.1] https://pypi.org/project/glean-api-client/0.13.1 - . \ No newline at end of file diff --git a/docs/models/createagentrequest.md b/docs/models/createagentrequest.md new file mode 100644 index 00000000..6d556c53 --- /dev/null +++ b/docs/models/createagentrequest.md @@ -0,0 +1,10 @@ +# CreateAgentRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `locale` | *Optional[str]* | :heavy_minus_sign: | The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`. | +| `timezone_offset` | *Optional[int]* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. | +| `create_workflow_request` | [models.CreateWorkflowRequest](../models/createworkflowrequest.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/createworkflowrequest.md b/docs/models/createworkflowrequest.md new file mode 100644 index 00000000..e955a419 --- /dev/null +++ b/docs/models/createworkflowrequest.md @@ -0,0 +1,10 @@ +# CreateWorkflowRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| `name` | *Optional[str]* | :heavy_minus_sign: | The name of the workflow. | +| `transient` | *Optional[bool]* | :heavy_minus_sign: | Used to create a transient workflow. | +| `parent_workflow_id` | *Optional[str]* | :heavy_minus_sign: | id of the parent workflow for transient workflows | \ No newline at end of file diff --git a/docs/sdks/agents/README.md b/docs/sdks/agents/README.md index b929a12d..00789fbf 100644 --- a/docs/sdks/agents/README.md +++ b/docs/sdks/agents/README.md @@ -4,8 +4,53 @@ ### Available Operations +* [create_agent](#create_agent) - Create an agent * [edit_agent](#edit_agent) - Edit an agent +## create_agent + +Create an agent. + +### Example Usage + + +```python +from glean.api_client import Glean +import os + + +with Glean( + api_token=os.getenv("GLEAN_API_TOKEN", ""), +) as glean: + + res = glean.agents.create_agent() + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `locale` | *Optional[str]* | :heavy_minus_sign: | The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`. | +| `timezone_offset` | *Optional[int]* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. | +| `name` | *Optional[str]* | :heavy_minus_sign: | The name of the workflow. | +| `transient` | *Optional[bool]* | :heavy_minus_sign: | Used to create a transient workflow. | +| `parent_workflow_id` | *Optional[str]* | :heavy_minus_sign: | id of the parent workflow for transient workflows | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.WorkflowResult](../../models/workflowresult.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------- | ----------------- | ----------------- | +| errors.GleanError | 4XX, 5XX | \*/\* | + ## edit_agent Creates a draft or publishes an [agent](https://developers.glean.com/agents/agents-api). Use `isDraft=true` to save a draft, or `isDraft=false` (or omit) to publish immediately. Only draft and publish modes are supported. diff --git a/pyproject.toml b/pyproject.toml index f34dd6a5..af1e59cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "glean-api-client" -version = "0.13.0" +version = "0.13.1" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Glean Technologies, Inc." },] readme = "README-PYPI.md" diff --git a/src/glean/api_client/_version.py b/src/glean/api_client/_version.py index 8d9da6a0..fccef4d7 100644 --- a/src/glean/api_client/_version.py +++ b/src/glean/api_client/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "glean-api-client" -__version__: str = "0.13.0" +__version__: str = "0.13.1" __openapi_doc_version__: str = "0.9.0" -__gen_version__: str = "2.893.0" -__user_agent__: str = "speakeasy-sdk/python 0.13.0 2.893.0 0.9.0 glean-api-client" +__gen_version__: str = "2.899.1" +__user_agent__: str = "speakeasy-sdk/python 0.13.1 2.899.1 0.9.0 glean-api-client" try: if __package__ is not None: diff --git a/src/glean/api_client/agents.py b/src/glean/api_client/agents.py index 99f5f660..2be17185 100644 --- a/src/glean/api_client/agents.py +++ b/src/glean/api_client/agents.py @@ -10,6 +10,216 @@ class Agents(BaseSDK): + def create_agent( + self, + *, + locale: Optional[str] = None, + timezone_offset: Optional[int] = None, + name: Optional[str] = None, + transient: Optional[bool] = None, + parent_workflow_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.WorkflowResult: + r"""Create an agent + + Create an agent. + + :param locale: The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`. + :param timezone_offset: The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. + :param name: The name of the workflow. + :param transient: Used to create a transient workflow. + :param parent_workflow_id: id of the parent workflow for transient workflows + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.CreateAgentRequest( + locale=locale, + timezone_offset=timezone_offset, + create_workflow_request=models.CreateWorkflowRequest( + name=name, + transient=transient, + parent_workflow_id=parent_workflow_id, + ), + ) + + req = self._build_request( + method="POST", + path="/rest/api/v1/agents", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.create_workflow_request, + False, + False, + "json", + models.CreateWorkflowRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createAgent", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.WorkflowResult, http_res) + if utils.match_response(http_res, ["400", "401", "403", "4XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, ["500", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + + raise errors.GleanError("Unexpected response received", http_res) + + async def create_agent_async( + self, + *, + locale: Optional[str] = None, + timezone_offset: Optional[int] = None, + name: Optional[str] = None, + transient: Optional[bool] = None, + parent_workflow_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.WorkflowResult: + r"""Create an agent + + Create an agent. + + :param locale: The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`. + :param timezone_offset: The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. + :param name: The name of the workflow. + :param transient: Used to create a transient workflow. + :param parent_workflow_id: id of the parent workflow for transient workflows + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.CreateAgentRequest( + locale=locale, + timezone_offset=timezone_offset, + create_workflow_request=models.CreateWorkflowRequest( + name=name, + transient=transient, + parent_workflow_id=parent_workflow_id, + ), + ) + + req = self._build_request_async( + method="POST", + path="/rest/api/v1/agents", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.create_workflow_request, + False, + False, + "json", + models.CreateWorkflowRequest, + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createAgent", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.WorkflowResult, http_res) + if utils.match_response(http_res, ["400", "401", "403", "4XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, ["500", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + + raise errors.GleanError("Unexpected response received", http_res) + def edit_agent( self, *, diff --git a/src/glean/api_client/announcements.py b/src/glean/api_client/announcements.py index 33123a0a..48d83997 100644 --- a/src/glean/api_client/announcements.py +++ b/src/glean/api_client/announcements.py @@ -7,7 +7,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class Announcements(BaseSDK): @@ -25,7 +25,7 @@ def create( thumbnail: Optional[Union[models.Thumbnail, models.ThumbnailTypedDict]] = None, banner: Optional[Union[models.Thumbnail, models.ThumbnailTypedDict]] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, source_document_id: Optional[str] = None, hide_attribution: Optional[bool] = None, @@ -168,7 +168,7 @@ async def create_async( thumbnail: Optional[Union[models.Thumbnail, models.ThumbnailTypedDict]] = None, banner: Optional[Union[models.Thumbnail, models.ThumbnailTypedDict]] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, source_document_id: Optional[str] = None, hide_attribution: Optional[bool] = None, @@ -504,7 +504,7 @@ def update( thumbnail: Optional[Union[models.Thumbnail, models.ThumbnailTypedDict]] = None, banner: Optional[Union[models.Thumbnail, models.ThumbnailTypedDict]] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, source_document_id: Optional[str] = None, hide_attribution: Optional[bool] = None, @@ -650,7 +650,7 @@ async def update_async( thumbnail: Optional[Union[models.Thumbnail, models.ThumbnailTypedDict]] = None, banner: Optional[Union[models.Thumbnail, models.ThumbnailTypedDict]] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, source_document_id: Optional[str] = None, hide_attribution: Optional[bool] = None, diff --git a/src/glean/api_client/answers.py b/src/glean/api_client/answers.py index 0757b71f..20c371ad 100644 --- a/src/glean/api_client/answers.py +++ b/src/glean/api_client/answers.py @@ -6,7 +6,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union from typing_extensions import deprecated @@ -408,36 +408,36 @@ def update( locale: Optional[str] = None, doc_id: Optional[str] = None, question: Optional[str] = None, - question_variations: Optional[List[str]] = None, + question_variations: Optional[Iterable[str]] = None, body_text: Optional[str] = None, board_id: Optional[int] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, added_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, removed_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, source_document_spec: Optional[ Union[models.DocumentSpecUnion, models.DocumentSpecUnionTypedDict] ] = None, source_type: Optional[models.EditAnswerRequestSourceType] = None, - added_collections: Optional[List[int]] = None, - removed_collections: Optional[List[int]] = None, + added_collections: Optional[Iterable[int]] = None, + removed_collections: Optional[Iterable[int]] = None, combined_answer_text: Optional[ Union[ models.StructuredTextMutableProperties, @@ -490,7 +490,9 @@ def update( id=id, doc_id=doc_id, question=question, - question_variations=question_variations, + question_variations=utils.unmarshal( + question_variations, Optional[List[str]] + ), body_text=body_text, board_id=board_id, audience_filters=utils.get_pydantic_model( @@ -509,8 +511,12 @@ def update( source_document_spec, Optional[models.DocumentSpecUnion] ), source_type=source_type, - added_collections=added_collections, - removed_collections=removed_collections, + added_collections=utils.unmarshal( + added_collections, Optional[List[int]] + ), + removed_collections=utils.unmarshal( + removed_collections, Optional[List[int]] + ), combined_answer_text=utils.get_pydantic_model( combined_answer_text, Optional[models.StructuredTextMutableProperties], @@ -583,36 +589,36 @@ async def update_async( locale: Optional[str] = None, doc_id: Optional[str] = None, question: Optional[str] = None, - question_variations: Optional[List[str]] = None, + question_variations: Optional[Iterable[str]] = None, body_text: Optional[str] = None, board_id: Optional[int] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, added_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, removed_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, source_document_spec: Optional[ Union[models.DocumentSpecUnion, models.DocumentSpecUnionTypedDict] ] = None, source_type: Optional[models.EditAnswerRequestSourceType] = None, - added_collections: Optional[List[int]] = None, - removed_collections: Optional[List[int]] = None, + added_collections: Optional[Iterable[int]] = None, + removed_collections: Optional[Iterable[int]] = None, combined_answer_text: Optional[ Union[ models.StructuredTextMutableProperties, @@ -665,7 +671,9 @@ async def update_async( id=id, doc_id=doc_id, question=question, - question_variations=question_variations, + question_variations=utils.unmarshal( + question_variations, Optional[List[str]] + ), body_text=body_text, board_id=board_id, audience_filters=utils.get_pydantic_model( @@ -684,8 +692,12 @@ async def update_async( source_document_spec, Optional[models.DocumentSpecUnion] ), source_type=source_type, - added_collections=added_collections, - removed_collections=removed_collections, + added_collections=utils.unmarshal( + added_collections, Optional[List[int]] + ), + removed_collections=utils.unmarshal( + removed_collections, Optional[List[int]] + ), combined_answer_text=utils.get_pydantic_model( combined_answer_text, Optional[models.StructuredTextMutableProperties], diff --git a/src/glean/api_client/client_activity.py b/src/glean/api_client/client_activity.py index 0fc1ce18..5465d474 100644 --- a/src/glean/api_client/client_activity.py +++ b/src/glean/api_client/client_activity.py @@ -5,14 +5,16 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class ClientActivity(BaseSDK): def report( self, *, - events: Union[List[models.ActivityEvent], List[models.ActivityEventTypedDict]], + events: Union[ + Iterable[models.ActivityEvent], Iterable[models.ActivityEventTypedDict] + ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -99,7 +101,9 @@ def report( async def report_async( self, *, - events: Union[List[models.ActivityEvent], List[models.ActivityEventTypedDict]], + events: Union[ + Iterable[models.ActivityEvent], Iterable[models.ActivityEventTypedDict] + ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, diff --git a/src/glean/api_client/client_agents.py b/src/glean/api_client/client_agents.py index 6e1ff0f4..7bc31e5f 100644 --- a/src/glean/api_client/client_agents.py +++ b/src/glean/api_client/client_agents.py @@ -6,7 +6,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Dict, List, Mapping, Optional, Union +from typing import Any, Dict, Iterable, List, Mapping, Optional, Union class ClientAgents(BaseSDK): @@ -572,11 +572,11 @@ def run_stream( self, *, agent_id: str, - input: Optional[Dict[str, Any]] = None, + input: Optional[Mapping[str, Any]] = None, messages: Optional[ - Union[List[models.Message], List[models.MessageTypedDict]] + Union[Iterable[models.Message], Iterable[models.MessageTypedDict]] ] = None, - metadata: Optional[Dict[str, Any]] = None, + metadata: Optional[Mapping[str, Any]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -607,9 +607,9 @@ def run_stream( request = models.AgentRunCreate( agent_id=agent_id, - input=input, + input=utils.unmarshal(input, Optional[Dict[str, Any]]), messages=utils.get_pydantic_model(messages, Optional[List[models.Message]]), - metadata=metadata, + metadata=utils.unmarshal(metadata, Optional[Dict[str, Any]]), ) req = self._build_request( @@ -674,11 +674,11 @@ async def run_stream_async( self, *, agent_id: str, - input: Optional[Dict[str, Any]] = None, + input: Optional[Mapping[str, Any]] = None, messages: Optional[ - Union[List[models.Message], List[models.MessageTypedDict]] + Union[Iterable[models.Message], Iterable[models.MessageTypedDict]] ] = None, - metadata: Optional[Dict[str, Any]] = None, + metadata: Optional[Mapping[str, Any]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -709,9 +709,9 @@ async def run_stream_async( request = models.AgentRunCreate( agent_id=agent_id, - input=input, + input=utils.unmarshal(input, Optional[Dict[str, Any]]), messages=utils.get_pydantic_model(messages, Optional[List[models.Message]]), - metadata=metadata, + metadata=utils.unmarshal(metadata, Optional[Dict[str, Any]]), ) req = self._build_request_async( @@ -776,11 +776,11 @@ def run( self, *, agent_id: str, - input: Optional[Dict[str, Any]] = None, + input: Optional[Mapping[str, Any]] = None, messages: Optional[ - Union[List[models.Message], List[models.MessageTypedDict]] + Union[Iterable[models.Message], Iterable[models.MessageTypedDict]] ] = None, - metadata: Optional[Dict[str, Any]] = None, + metadata: Optional[Mapping[str, Any]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -811,9 +811,9 @@ def run( request = models.AgentRunCreate( agent_id=agent_id, - input=input, + input=utils.unmarshal(input, Optional[Dict[str, Any]]), messages=utils.get_pydantic_model(messages, Optional[List[models.Message]]), - metadata=metadata, + metadata=utils.unmarshal(metadata, Optional[Dict[str, Any]]), ) req = self._build_request( @@ -876,11 +876,11 @@ async def run_async( self, *, agent_id: str, - input: Optional[Dict[str, Any]] = None, + input: Optional[Mapping[str, Any]] = None, messages: Optional[ - Union[List[models.Message], List[models.MessageTypedDict]] + Union[Iterable[models.Message], Iterable[models.MessageTypedDict]] ] = None, - metadata: Optional[Dict[str, Any]] = None, + metadata: Optional[Mapping[str, Any]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -911,9 +911,9 @@ async def run_async( request = models.AgentRunCreate( agent_id=agent_id, - input=input, + input=utils.unmarshal(input, Optional[Dict[str, Any]]), messages=utils.get_pydantic_model(messages, Optional[List[models.Message]]), - metadata=metadata, + metadata=utils.unmarshal(metadata, Optional[Dict[str, Any]]), ) req = self._build_request_async( diff --git a/src/glean/api_client/client_chat.py b/src/glean/api_client/client_chat.py index f1e89630..f506bfc8 100644 --- a/src/glean/api_client/client_chat.py +++ b/src/glean/api_client/client_chat.py @@ -6,14 +6,16 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class ClientChat(BaseSDK): def create( self, *, - messages: Union[List[models.ChatMessage], List[models.ChatMessageTypedDict]], + messages: Union[ + Iterable[models.ChatMessage], Iterable[models.ChatMessageTypedDict] + ], locale: Optional[str] = None, timezone_offset: Optional[int] = None, session_info: Optional[ @@ -140,7 +142,7 @@ def create( retry_config=retry_config, ) - if utils.match_response(http_res, "200", "application/json"): + if utils.match_response(http_res, ["200", "202"], "application/json"): return unmarshal_json_response(models.ChatResponse, http_res) if utils.match_response(http_res, ["400", "401", "408", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) @@ -154,7 +156,9 @@ def create( async def create_async( self, *, - messages: Union[List[models.ChatMessage], List[models.ChatMessageTypedDict]], + messages: Union[ + Iterable[models.ChatMessage], Iterable[models.ChatMessageTypedDict] + ], locale: Optional[str] = None, timezone_offset: Optional[int] = None, session_info: Optional[ @@ -281,7 +285,7 @@ async def create_async( retry_config=retry_config, ) - if utils.match_response(http_res, "200", "application/json"): + if utils.match_response(http_res, ["200", "202"], "application/json"): return unmarshal_json_response(models.ChatResponse, http_res) if utils.match_response(http_res, ["400", "401", "408", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) @@ -469,7 +473,7 @@ async def delete_all_async( def delete( self, *, - ids: List[str], + ids: Iterable[str], locale: Optional[str] = None, timezone_offset: Optional[int] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -503,7 +507,7 @@ def delete( locale=locale, timezone_offset=timezone_offset, delete_chats_request=models.DeleteChatsRequest( - ids=ids, + ids=utils.unmarshal(ids, List[str]), ), ) @@ -568,7 +572,7 @@ def delete( async def delete_async( self, *, - ids: List[str], + ids: Iterable[str], locale: Optional[str] = None, timezone_offset: Optional[int] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -602,7 +606,7 @@ async def delete_async( locale=locale, timezone_offset=timezone_offset, delete_chats_request=models.DeleteChatsRequest( - ids=ids, + ids=utils.unmarshal(ids, List[str]), ), ) @@ -1229,7 +1233,7 @@ async def retrieve_application_async( def upload_files( self, *, - files: Union[List[models.File], List[models.FileTypedDict]], + files: Union[Iterable[models.File], Iterable[models.FileTypedDict]], locale: Optional[str] = None, timezone_offset: Optional[int] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1328,7 +1332,7 @@ def upload_files( async def upload_files_async( self, *, - files: Union[List[models.File], List[models.FileTypedDict]], + files: Union[Iterable[models.File], Iterable[models.FileTypedDict]], locale: Optional[str] = None, timezone_offset: Optional[int] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1427,7 +1431,7 @@ async def upload_files_async( def retrieve_files( self, *, - file_ids: List[str], + file_ids: Iterable[str], locale: Optional[str] = None, timezone_offset: Optional[int] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1461,7 +1465,7 @@ def retrieve_files( locale=locale, timezone_offset=timezone_offset, get_chat_files_request=models.GetChatFilesRequest( - file_ids=file_ids, + file_ids=utils.unmarshal(file_ids, List[str]), ), ) @@ -1526,7 +1530,7 @@ def retrieve_files( async def retrieve_files_async( self, *, - file_ids: List[str], + file_ids: Iterable[str], locale: Optional[str] = None, timezone_offset: Optional[int] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1560,7 +1564,7 @@ async def retrieve_files_async( locale=locale, timezone_offset=timezone_offset, get_chat_files_request=models.GetChatFilesRequest( - file_ids=file_ids, + file_ids=utils.unmarshal(file_ids, List[str]), ), ) @@ -1625,7 +1629,7 @@ async def retrieve_files_async( def delete_files( self, *, - file_ids: List[str], + file_ids: Iterable[str], locale: Optional[str] = None, timezone_offset: Optional[int] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1659,7 +1663,7 @@ def delete_files( locale=locale, timezone_offset=timezone_offset, delete_chat_files_request=models.DeleteChatFilesRequest( - file_ids=file_ids, + file_ids=utils.unmarshal(file_ids, List[str]), ), ) @@ -1724,7 +1728,7 @@ def delete_files( async def delete_files_async( self, *, - file_ids: List[str], + file_ids: Iterable[str], locale: Optional[str] = None, timezone_offset: Optional[int] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -1758,7 +1762,7 @@ async def delete_files_async( locale=locale, timezone_offset=timezone_offset, delete_chat_files_request=models.DeleteChatFilesRequest( - file_ids=file_ids, + file_ids=utils.unmarshal(file_ids, List[str]), ), ) @@ -1823,7 +1827,9 @@ async def delete_files_async( def create_stream( self, *, - messages: Union[List[models.ChatMessage], List[models.ChatMessageTypedDict]], + messages: Union[ + Iterable[models.ChatMessage], Iterable[models.ChatMessageTypedDict] + ], timezone_offset: Optional[int] = None, session_info: Optional[ Union[models.SessionInfo, models.SessionInfoTypedDict] @@ -1961,7 +1967,9 @@ def create_stream( async def create_stream_async( self, *, - messages: Union[List[models.ChatMessage], List[models.ChatMessageTypedDict]], + messages: Union[ + Iterable[models.ChatMessage], Iterable[models.ChatMessageTypedDict] + ], timezone_offset: Optional[int] = None, session_info: Optional[ Union[models.SessionInfo, models.SessionInfoTypedDict] diff --git a/src/glean/api_client/client_documents.py b/src/glean/api_client/client_documents.py index c270bf21..72045064 100644 --- a/src/glean/api_client/client_documents.py +++ b/src/glean/api_client/client_documents.py @@ -7,7 +7,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class ClientDocuments(BaseSDK): @@ -615,7 +615,8 @@ def summarize( self, *, document_specs: Union[ - List[models.DocumentSpecUnion], List[models.DocumentSpecUnionTypedDict] + Iterable[models.DocumentSpecUnion], + Iterable[models.DocumentSpecUnionTypedDict], ], locale: Optional[str] = None, timestamp: Optional[datetime] = None, @@ -723,7 +724,8 @@ async def summarize_async( self, *, document_specs: Union[ - List[models.DocumentSpecUnion], List[models.DocumentSpecUnionTypedDict] + Iterable[models.DocumentSpecUnion], + Iterable[models.DocumentSpecUnionTypedDict], ], locale: Optional[str] = None, timestamp: Optional[datetime] = None, diff --git a/src/glean/api_client/client_entities.py b/src/glean/api_client/client_entities.py index 67fbc0db..8f19017d 100644 --- a/src/glean/api_client/client_entities.py +++ b/src/glean/api_client/client_entities.py @@ -6,7 +6,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class ClientEntities(BaseSDK): @@ -15,17 +15,19 @@ def list( *, locale: Optional[str] = None, filter_: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, sort: Optional[ - Union[List[models.SortOptions], List[models.SortOptionsTypedDict]] + Union[Iterable[models.SortOptions], Iterable[models.SortOptionsTypedDict]] ] = None, entity_type: Optional[ models.ListEntitiesRequestEntityType ] = models.ListEntitiesRequestEntityType.PEOPLE, datasource: Optional[str] = None, query: Optional[str] = None, - include_fields: Optional[List[models.ListEntitiesRequestIncludeField]] = None, + include_fields: Optional[ + Iterable[models.ListEntitiesRequestIncludeField] + ] = None, page_size: Optional[int] = None, cursor: Optional[str] = None, source: Optional[str] = None, @@ -75,7 +77,10 @@ def list( entity_type=entity_type, datasource=datasource, query=query, - include_fields=include_fields, + include_fields=utils.unmarshal( + include_fields, + Optional[List[models.ListEntitiesRequestIncludeField]], + ), page_size=page_size, cursor=cursor, source=source, @@ -146,17 +151,19 @@ async def list_async( *, locale: Optional[str] = None, filter_: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, sort: Optional[ - Union[List[models.SortOptions], List[models.SortOptionsTypedDict]] + Union[Iterable[models.SortOptions], Iterable[models.SortOptionsTypedDict]] ] = None, entity_type: Optional[ models.ListEntitiesRequestEntityType ] = models.ListEntitiesRequestEntityType.PEOPLE, datasource: Optional[str] = None, query: Optional[str] = None, - include_fields: Optional[List[models.ListEntitiesRequestIncludeField]] = None, + include_fields: Optional[ + Iterable[models.ListEntitiesRequestIncludeField] + ] = None, page_size: Optional[int] = None, cursor: Optional[str] = None, source: Optional[str] = None, @@ -206,7 +213,10 @@ async def list_async( entity_type=entity_type, datasource=datasource, query=query, - include_fields=include_fields, + include_fields=utils.unmarshal( + include_fields, + Optional[List[models.ListEntitiesRequestIncludeField]], + ), page_size=page_size, cursor=cursor, source=source, @@ -277,10 +287,10 @@ def read_people( *, locale: Optional[str] = None, timezone_offset: Optional[int] = None, - obfuscated_ids: Optional[List[str]] = None, - email_ids: Optional[List[str]] = None, - include_fields: Optional[List[models.PeopleRequestIncludeField]] = None, - include_types: Optional[List[models.IncludeType]] = None, + obfuscated_ids: Optional[Iterable[str]] = None, + email_ids: Optional[Iterable[str]] = None, + include_fields: Optional[Iterable[models.PeopleRequestIncludeField]] = None, + include_types: Optional[Iterable[models.IncludeType]] = None, source: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -317,10 +327,14 @@ def read_people( locale=locale, people_request=models.PeopleRequest( timezone_offset=timezone_offset, - obfuscated_ids=obfuscated_ids, - email_ids=email_ids, - include_fields=include_fields, - include_types=include_types, + obfuscated_ids=utils.unmarshal(obfuscated_ids, Optional[List[str]]), + email_ids=utils.unmarshal(email_ids, Optional[List[str]]), + include_fields=utils.unmarshal( + include_fields, Optional[List[models.PeopleRequestIncludeField]] + ), + include_types=utils.unmarshal( + include_types, Optional[List[models.IncludeType]] + ), source=source, ), ) @@ -384,10 +398,10 @@ async def read_people_async( *, locale: Optional[str] = None, timezone_offset: Optional[int] = None, - obfuscated_ids: Optional[List[str]] = None, - email_ids: Optional[List[str]] = None, - include_fields: Optional[List[models.PeopleRequestIncludeField]] = None, - include_types: Optional[List[models.IncludeType]] = None, + obfuscated_ids: Optional[Iterable[str]] = None, + email_ids: Optional[Iterable[str]] = None, + include_fields: Optional[Iterable[models.PeopleRequestIncludeField]] = None, + include_types: Optional[Iterable[models.IncludeType]] = None, source: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -424,10 +438,14 @@ async def read_people_async( locale=locale, people_request=models.PeopleRequest( timezone_offset=timezone_offset, - obfuscated_ids=obfuscated_ids, - email_ids=email_ids, - include_fields=include_fields, - include_types=include_types, + obfuscated_ids=utils.unmarshal(obfuscated_ids, Optional[List[str]]), + email_ids=utils.unmarshal(email_ids, Optional[List[str]]), + include_fields=utils.unmarshal( + include_fields, Optional[List[models.PeopleRequestIncludeField]] + ), + include_types=utils.unmarshal( + include_types, Optional[List[models.IncludeType]] + ), source=source, ), ) diff --git a/src/glean/api_client/client_shortcuts.py b/src/glean/api_client/client_shortcuts.py index a4db274d..b994e7d2 100644 --- a/src/glean/api_client/client_shortcuts.py +++ b/src/glean/api_client/client_shortcuts.py @@ -6,7 +6,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class ClientShortcuts(BaseSDK): @@ -600,11 +600,11 @@ def list( page_size: int, locale: Optional[str] = None, include_fields: Optional[ - List[models.ListShortcutsPaginatedRequestIncludeField] + Iterable[models.ListShortcutsPaginatedRequestIncludeField] ] = None, cursor: Optional[str] = None, filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, sort: Optional[Union[models.SortOptions, models.SortOptionsTypedDict]] = None, query: Optional[str] = None, @@ -642,7 +642,10 @@ def list( request = models.ListshortcutsRequest( locale=locale, list_shortcuts_paginated_request=models.ListShortcutsPaginatedRequest( - include_fields=include_fields, + include_fields=utils.unmarshal( + include_fields, + Optional[List[models.ListShortcutsPaginatedRequestIncludeField]], + ), page_size=page_size, cursor=cursor, filters=utils.get_pydantic_model( @@ -719,11 +722,11 @@ async def list_async( page_size: int, locale: Optional[str] = None, include_fields: Optional[ - List[models.ListShortcutsPaginatedRequestIncludeField] + Iterable[models.ListShortcutsPaginatedRequestIncludeField] ] = None, cursor: Optional[str] = None, filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, sort: Optional[Union[models.SortOptions, models.SortOptionsTypedDict]] = None, query: Optional[str] = None, @@ -761,7 +764,10 @@ async def list_async( request = models.ListshortcutsRequest( locale=locale, list_shortcuts_paginated_request=models.ListShortcutsPaginatedRequest( - include_fields=include_fields, + include_fields=utils.unmarshal( + include_fields, + Optional[List[models.ListShortcutsPaginatedRequestIncludeField]], + ), page_size=page_size, cursor=cursor, filters=utils.get_pydantic_model( @@ -845,14 +851,14 @@ def update( url_template: Optional[str] = None, added_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, removed_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -979,14 +985,14 @@ async def update_async( url_template: Optional[str] = None, added_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, removed_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, diff --git a/src/glean/api_client/client_tools.py b/src/glean/api_client/client_tools.py index 14d9f68c..7cfb900c 100644 --- a/src/glean/api_client/client_tools.py +++ b/src/glean/api_client/client_tools.py @@ -6,14 +6,14 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import Dict, List, Mapping, Optional, Union +from typing import Dict, Iterable, List, Mapping, Optional, Union class ClientTools(BaseSDK): def list( self, *, - tool_names: Optional[List[str]] = None, + tool_names: Optional[Iterable[str]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -40,7 +40,7 @@ def list( base_url = self._get_url(base_url, url_variables) request = models.GetRestAPIV1ToolsListRequest( - tool_names=tool_names, + tool_names=utils.unmarshal(tool_names, Optional[List[str]]), ) req = self._build_request( @@ -97,7 +97,7 @@ def list( async def list_async( self, *, - tool_names: Optional[List[str]] = None, + tool_names: Optional[Iterable[str]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -124,7 +124,7 @@ async def list_async( base_url = self._get_url(base_url, url_variables) request = models.GetRestAPIV1ToolsListRequest( - tool_names=tool_names, + tool_names=utils.unmarshal(tool_names, Optional[List[str]]), ) req = self._build_request_async( @@ -183,8 +183,8 @@ def run( *, name: str, parameters: Union[ - Dict[str, models.ToolsCallParameter], - Dict[str, models.ToolsCallParameterTypedDict], + Mapping[str, models.ToolsCallParameter], + Mapping[str, models.ToolsCallParameterTypedDict], ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -278,8 +278,8 @@ async def run_async( *, name: str, parameters: Union[ - Dict[str, models.ToolsCallParameter], - Dict[str, models.ToolsCallParameterTypedDict], + Mapping[str, models.ToolsCallParameter], + Mapping[str, models.ToolsCallParameterTypedDict], ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, diff --git a/src/glean/api_client/collections.py b/src/glean/api_client/collections.py index f93e472c..fe1c6c91 100644 --- a/src/glean/api_client/collections.py +++ b/src/glean/api_client/collections.py @@ -6,7 +6,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional, Union +from typing import Any, Iterable, List, Mapping, Optional, Union class Collections(BaseSDK): @@ -17,8 +17,8 @@ def add_items( locale: Optional[str] = None, added_collection_item_descriptors: Optional[ Union[ - List[models.CollectionItemDescriptor], - List[models.CollectionItemDescriptorTypedDict], + Iterable[models.CollectionItemDescriptor], + Iterable[models.CollectionItemDescriptorTypedDict], ] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -124,8 +124,8 @@ async def add_items_async( locale: Optional[str] = None, added_collection_item_descriptors: Optional[ Union[ - List[models.CollectionItemDescriptor], - List[models.CollectionItemDescriptorTypedDict], + Iterable[models.CollectionItemDescriptor], + Iterable[models.CollectionItemDescriptorTypedDict], ] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -232,18 +232,18 @@ def create( description: Optional[str] = None, added_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, removed_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, icon: Optional[str] = None, admin_locked: Optional[bool] = None, @@ -384,18 +384,18 @@ async def create_async( description: Optional[str] = None, added_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, removed_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, icon: Optional[str] = None, admin_locked: Optional[bool] = None, @@ -531,7 +531,7 @@ async def create_async( def delete( self, *, - ids: List[int], + ids: Iterable[int], locale: Optional[str] = None, allowed_datasource: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -564,7 +564,7 @@ def delete( request = models.DeletecollectionRequestRequest( locale=locale, delete_collection_request=models.DeleteCollectionRequest( - ids=ids, + ids=utils.unmarshal(ids, List[int]), allowed_datasource=allowed_datasource, ), ) @@ -636,7 +636,7 @@ def delete( async def delete_async( self, *, - ids: List[int], + ids: Iterable[int], locale: Optional[str] = None, allowed_datasource: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -669,7 +669,7 @@ async def delete_async( request = models.DeletecollectionRequestRequest( locale=locale, delete_collection_request=models.DeleteCollectionRequest( - ids=ids, + ids=utils.unmarshal(ids, List[int]), allowed_datasource=allowed_datasource, ), ) @@ -955,18 +955,18 @@ def update( description: Optional[str] = None, added_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, removed_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, icon: Optional[str] = None, admin_locked: Optional[bool] = None, @@ -1107,18 +1107,18 @@ async def update_async( description: Optional[str] = None, added_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, removed_roles: Optional[ Union[ - List[models.UserRoleSpecification], - List[models.UserRoleSpecificationTypedDict], + Iterable[models.UserRoleSpecification], + Iterable[models.UserRoleSpecificationTypedDict], ] ] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, icon: Optional[str] = None, admin_locked: Optional[bool] = None, diff --git a/src/glean/api_client/custommetadata.py b/src/glean/api_client/custommetadata.py index da51ad9d..768525cb 100644 --- a/src/glean/api_client/custommetadata.py +++ b/src/glean/api_client/custommetadata.py @@ -6,7 +6,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional, Union +from typing import Any, Iterable, List, Mapping, Optional, Union class CustomMetadata(BaseSDK): @@ -16,7 +16,7 @@ def upsert( doc_id: str, group_name: str, custom_metadata: Union[ - List[models.CustomProperty], List[models.CustomPropertyTypedDict] + Iterable[models.CustomProperty], Iterable[models.CustomPropertyTypedDict] ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -137,7 +137,7 @@ async def upsert_async( doc_id: str, group_name: str, custom_metadata: Union[ - List[models.CustomProperty], List[models.CustomPropertyTypedDict] + Iterable[models.CustomProperty], Iterable[models.CustomPropertyTypedDict] ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -671,8 +671,8 @@ def upsert_schema( *, group_name: str, metadata_keys: Union[ - List[models.CustomMetadataPropertyDefinition], - List[models.CustomMetadataPropertyDefinitionTypedDict], + Iterable[models.CustomMetadataPropertyDefinition], + Iterable[models.CustomMetadataPropertyDefinitionTypedDict], ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -792,8 +792,8 @@ async def upsert_schema_async( *, group_name: str, metadata_keys: Union[ - List[models.CustomMetadataPropertyDefinition], - List[models.CustomMetadataPropertyDefinitionTypedDict], + Iterable[models.CustomMetadataPropertyDefinition], + Iterable[models.CustomMetadataPropertyDefinitionTypedDict], ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, diff --git a/src/glean/api_client/governance.py b/src/glean/api_client/governance.py index fd67e05d..2e662f2b 100644 --- a/src/glean/api_client/governance.py +++ b/src/glean/api_client/governance.py @@ -6,7 +6,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class Governance(BaseSDK): @@ -22,7 +22,7 @@ def createfindingsexport( ] = None, file_name: Optional[str] = None, field_scope: Optional[models.FieldScope] = None, - fields_to_exclude: Optional[List[str]] = None, + fields_to_exclude: Optional[Iterable[str]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -63,7 +63,7 @@ def createfindingsexport( ), file_name=file_name, field_scope=field_scope, - fields_to_exclude=fields_to_exclude, + fields_to_exclude=utils.unmarshal(fields_to_exclude, Optional[List[str]]), ) req = self._build_request( @@ -132,7 +132,7 @@ async def createfindingsexport_async( ] = None, file_name: Optional[str] = None, field_scope: Optional[models.FieldScope] = None, - fields_to_exclude: Optional[List[str]] = None, + fields_to_exclude: Optional[Iterable[str]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -173,7 +173,7 @@ async def createfindingsexport_async( ), file_name=file_name, field_scope=field_scope, - fields_to_exclude=fields_to_exclude, + fields_to_exclude=utils.unmarshal(fields_to_exclude, Optional[List[str]]), ) req = self._build_request_async( diff --git a/src/glean/api_client/indexing_datasources.py b/src/glean/api_client/indexing_datasources.py index b8b091e8..aadeae14 100644 --- a/src/glean/api_client/indexing_datasources.py +++ b/src/glean/api_client/indexing_datasources.py @@ -6,7 +6,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class IndexingDatasources(BaseSDK): @@ -21,32 +21,35 @@ def add( url_regex: Optional[str] = None, icon_url: Optional[str] = None, object_definitions: Optional[ - Union[List[models.ObjectDefinition], List[models.ObjectDefinitionTypedDict]] + Union[ + Iterable[models.ObjectDefinition], + Iterable[models.ObjectDefinitionTypedDict], + ] ] = None, suggestion_text: Optional[str] = None, home_url: Optional[str] = None, - crawler_seed_urls: Optional[List[str]] = None, + crawler_seed_urls: Optional[Iterable[str]] = None, icon_dark_url: Optional[str] = None, - hide_built_in_facets: Optional[List[models.HideBuiltInFacet]] = None, + hide_built_in_facets: Optional[Iterable[models.HideBuiltInFacet]] = None, canonicalizing_url_regex: Optional[ Union[ - List[models.CanonicalizingRegexType], - List[models.CanonicalizingRegexTypeTypedDict], + Iterable[models.CanonicalizingRegexType], + Iterable[models.CanonicalizingRegexTypeTypedDict], ] ] = None, canonicalizing_title_regex: Optional[ Union[ - List[models.CanonicalizingRegexType], - List[models.CanonicalizingRegexTypeTypedDict], + Iterable[models.CanonicalizingRegexType], + Iterable[models.CanonicalizingRegexTypeTypedDict], ] ] = None, redlist_title_regex: Optional[str] = None, connector_type: Optional[models.CustomDatasourceConfigConnectorType] = None, quicklinks: Optional[ - Union[List[models.Quicklink], List[models.QuicklinkTypedDict]] + Union[Iterable[models.Quicklink], Iterable[models.QuicklinkTypedDict]] ] = None, render_config_preset: Optional[str] = None, - aliases: Optional[List[str]] = None, + aliases: Optional[Iterable[str]] = None, is_on_prem: Optional[bool] = None, trust_url_regex_for_view_activity: Optional[bool] = True, include_utm_source: Optional[bool] = None, @@ -118,9 +121,11 @@ def add( ), suggestion_text=suggestion_text, home_url=home_url, - crawler_seed_urls=crawler_seed_urls, + crawler_seed_urls=utils.unmarshal(crawler_seed_urls, Optional[List[str]]), icon_dark_url=icon_dark_url, - hide_built_in_facets=hide_built_in_facets, + hide_built_in_facets=utils.unmarshal( + hide_built_in_facets, Optional[List[models.HideBuiltInFacet]] + ), canonicalizing_url_regex=utils.get_pydantic_model( canonicalizing_url_regex, Optional[List[models.CanonicalizingRegexType]] ), @@ -134,7 +139,7 @@ def add( quicklinks, Optional[List[models.Quicklink]] ), render_config_preset=render_config_preset, - aliases=aliases, + aliases=utils.unmarshal(aliases, Optional[List[str]]), is_on_prem=is_on_prem, trust_url_regex_for_view_activity=trust_url_regex_for_view_activity, include_utm_source=include_utm_source, @@ -211,32 +216,35 @@ async def add_async( url_regex: Optional[str] = None, icon_url: Optional[str] = None, object_definitions: Optional[ - Union[List[models.ObjectDefinition], List[models.ObjectDefinitionTypedDict]] + Union[ + Iterable[models.ObjectDefinition], + Iterable[models.ObjectDefinitionTypedDict], + ] ] = None, suggestion_text: Optional[str] = None, home_url: Optional[str] = None, - crawler_seed_urls: Optional[List[str]] = None, + crawler_seed_urls: Optional[Iterable[str]] = None, icon_dark_url: Optional[str] = None, - hide_built_in_facets: Optional[List[models.HideBuiltInFacet]] = None, + hide_built_in_facets: Optional[Iterable[models.HideBuiltInFacet]] = None, canonicalizing_url_regex: Optional[ Union[ - List[models.CanonicalizingRegexType], - List[models.CanonicalizingRegexTypeTypedDict], + Iterable[models.CanonicalizingRegexType], + Iterable[models.CanonicalizingRegexTypeTypedDict], ] ] = None, canonicalizing_title_regex: Optional[ Union[ - List[models.CanonicalizingRegexType], - List[models.CanonicalizingRegexTypeTypedDict], + Iterable[models.CanonicalizingRegexType], + Iterable[models.CanonicalizingRegexTypeTypedDict], ] ] = None, redlist_title_regex: Optional[str] = None, connector_type: Optional[models.CustomDatasourceConfigConnectorType] = None, quicklinks: Optional[ - Union[List[models.Quicklink], List[models.QuicklinkTypedDict]] + Union[Iterable[models.Quicklink], Iterable[models.QuicklinkTypedDict]] ] = None, render_config_preset: Optional[str] = None, - aliases: Optional[List[str]] = None, + aliases: Optional[Iterable[str]] = None, is_on_prem: Optional[bool] = None, trust_url_regex_for_view_activity: Optional[bool] = True, include_utm_source: Optional[bool] = None, @@ -308,9 +316,11 @@ async def add_async( ), suggestion_text=suggestion_text, home_url=home_url, - crawler_seed_urls=crawler_seed_urls, + crawler_seed_urls=utils.unmarshal(crawler_seed_urls, Optional[List[str]]), icon_dark_url=icon_dark_url, - hide_built_in_facets=hide_built_in_facets, + hide_built_in_facets=utils.unmarshal( + hide_built_in_facets, Optional[List[models.HideBuiltInFacet]] + ), canonicalizing_url_regex=utils.get_pydantic_model( canonicalizing_url_regex, Optional[List[models.CanonicalizingRegexType]] ), @@ -324,7 +334,7 @@ async def add_async( quicklinks, Optional[List[models.Quicklink]] ), render_config_preset=render_config_preset, - aliases=aliases, + aliases=utils.unmarshal(aliases, Optional[List[str]]), is_on_prem=is_on_prem, trust_url_regex_for_view_activity=trust_url_regex_for_view_activity, include_utm_source=include_utm_source, diff --git a/src/glean/api_client/indexing_documents.py b/src/glean/api_client/indexing_documents.py index 9817af75..0fc7c889 100644 --- a/src/glean/api_client/indexing_documents.py +++ b/src/glean/api_client/indexing_documents.py @@ -6,7 +6,7 @@ from glean.api_client.types import BaseModel, OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union, cast +from typing import Iterable, List, Mapping, Optional, Union, cast from typing_extensions import deprecated @@ -196,7 +196,8 @@ def index( *, datasource: str, documents: Union[ - List[models.DocumentDefinition], List[models.DocumentDefinitionTypedDict] + Iterable[models.DocumentDefinition], + Iterable[models.DocumentDefinitionTypedDict], ], upload_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -293,7 +294,8 @@ async def index_async( *, datasource: str, documents: Union[ - List[models.DocumentDefinition], List[models.DocumentDefinitionTypedDict] + Iterable[models.DocumentDefinition], + Iterable[models.DocumentDefinitionTypedDict], ], upload_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -391,7 +393,8 @@ def bulk_index( upload_id: str, datasource: str, documents: Union[ - List[models.DocumentDefinition], List[models.DocumentDefinitionTypedDict] + Iterable[models.DocumentDefinition], + Iterable[models.DocumentDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -500,7 +503,8 @@ async def bulk_index_async( upload_id: str, datasource: str, documents: Union[ - List[models.DocumentDefinition], List[models.DocumentDefinitionTypedDict] + Iterable[models.DocumentDefinition], + Iterable[models.DocumentDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -1222,8 +1226,8 @@ def debug_many( *, datasource: str, debug_documents: Union[ - List[models.DebugDocumentRequest], - List[models.DebugDocumentRequestTypedDict], + Iterable[models.DebugDocumentRequest], + Iterable[models.DebugDocumentRequestTypedDict], ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -1326,8 +1330,8 @@ async def debug_many_async( *, datasource: str, debug_documents: Union[ - List[models.DebugDocumentRequest], - List[models.DebugDocumentRequestTypedDict], + Iterable[models.DebugDocumentRequest], + Iterable[models.DebugDocumentRequestTypedDict], ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, diff --git a/src/glean/api_client/indexing_permissions.py b/src/glean/api_client/indexing_permissions.py index c41d5c91..ce426af4 100644 --- a/src/glean/api_client/indexing_permissions.py +++ b/src/glean/api_client/indexing_permissions.py @@ -5,7 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import BaseModel, OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env -from typing import List, Mapping, Optional, Union, cast +from typing import Iterable, List, Mapping, Optional, Union, cast class IndexingPermissions(BaseSDK): @@ -415,8 +415,8 @@ def bulk_index_users( upload_id: str, datasource: str, users: Union[ - List[models.DatasourceUserDefinition], - List[models.DatasourceUserDefinitionTypedDict], + Iterable[models.DatasourceUserDefinition], + Iterable[models.DatasourceUserDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -527,8 +527,8 @@ async def bulk_index_users_async( upload_id: str, datasource: str, users: Union[ - List[models.DatasourceUserDefinition], - List[models.DatasourceUserDefinitionTypedDict], + Iterable[models.DatasourceUserDefinition], + Iterable[models.DatasourceUserDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -829,8 +829,8 @@ def bulk_index_groups( upload_id: str, datasource: str, groups: Union[ - List[models.DatasourceGroupDefinition], - List[models.DatasourceGroupDefinitionTypedDict], + Iterable[models.DatasourceGroupDefinition], + Iterable[models.DatasourceGroupDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -941,8 +941,8 @@ async def bulk_index_groups_async( upload_id: str, datasource: str, groups: Union[ - List[models.DatasourceGroupDefinition], - List[models.DatasourceGroupDefinitionTypedDict], + Iterable[models.DatasourceGroupDefinition], + Iterable[models.DatasourceGroupDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -1249,8 +1249,8 @@ def bulk_index_memberships( upload_id: str, datasource: str, memberships: Union[ - List[models.DatasourceBulkMembershipDefinition], - List[models.DatasourceBulkMembershipDefinitionTypedDict], + Iterable[models.DatasourceBulkMembershipDefinition], + Iterable[models.DatasourceBulkMembershipDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -1359,8 +1359,8 @@ async def bulk_index_memberships_async( upload_id: str, datasource: str, memberships: Union[ - List[models.DatasourceBulkMembershipDefinition], - List[models.DatasourceBulkMembershipDefinitionTypedDict], + Iterable[models.DatasourceBulkMembershipDefinition], + Iterable[models.DatasourceBulkMembershipDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -2241,7 +2241,7 @@ def authorize_beta_users( self, *, datasource: str, - emails: List[str], + emails: Iterable[str], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2270,7 +2270,7 @@ def authorize_beta_users( request = models.GreenlistUsersRequest( datasource=datasource, - emails=emails, + emails=utils.unmarshal(emails, List[str]), ) req = self._build_request( @@ -2331,7 +2331,7 @@ async def authorize_beta_users_async( self, *, datasource: str, - emails: List[str], + emails: Iterable[str], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -2360,7 +2360,7 @@ async def authorize_beta_users_async( request = models.GreenlistUsersRequest( datasource=datasource, - emails=emails, + emails=utils.unmarshal(emails, List[str]), ) req = self._build_request_async( diff --git a/src/glean/api_client/indexing_shortcuts.py b/src/glean/api_client/indexing_shortcuts.py index bdfdec85..8e657a10 100644 --- a/src/glean/api_client/indexing_shortcuts.py +++ b/src/glean/api_client/indexing_shortcuts.py @@ -5,7 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class IndexingShortcuts(BaseSDK): @@ -14,7 +14,8 @@ def bulk_index( *, upload_id: str, shortcuts: Union[ - List[models.ExternalShortcut], List[models.ExternalShortcutTypedDict] + Iterable[models.ExternalShortcut], + Iterable[models.ExternalShortcutTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -117,7 +118,8 @@ async def bulk_index_async( *, upload_id: str, shortcuts: Union[ - List[models.ExternalShortcut], List[models.ExternalShortcutTypedDict] + Iterable[models.ExternalShortcut], + Iterable[models.ExternalShortcutTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -220,7 +222,8 @@ def upload( *, upload_id: str, shortcuts: Union[ - List[models.IndexingShortcut], List[models.IndexingShortcutTypedDict] + Iterable[models.IndexingShortcut], + Iterable[models.IndexingShortcutTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -323,7 +326,8 @@ async def upload_async( *, upload_id: str, shortcuts: Union[ - List[models.IndexingShortcut], List[models.IndexingShortcutTypedDict] + Iterable[models.IndexingShortcut], + Iterable[models.IndexingShortcutTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, diff --git a/src/glean/api_client/models/__init__.py b/src/glean/api_client/models/__init__.py index 10111171..2563cb4d 100644 --- a/src/glean/api_client/models/__init__.py +++ b/src/glean/api_client/models/__init__.py @@ -342,6 +342,7 @@ from .contentdefinition import ContentDefinition, ContentDefinitionTypedDict from .contenttype import ContentType from .countinfo import CountInfo, CountInfoTypedDict + from .createagentop import CreateAgentRequest, CreateAgentRequestTypedDict from .createannouncementop import ( CreateannouncementRequestRequest, CreateannouncementRequestRequestTypedDict, @@ -395,6 +396,10 @@ CreateShortcutResponse, CreateShortcutResponseTypedDict, ) + from .createworkflowrequest import ( + CreateWorkflowRequest, + CreateWorkflowRequestTypedDict, + ) from .currentactiveusers import CurrentActiveUsers, CurrentActiveUsersTypedDict from .customdatasourceconfig import ( CustomDatasourceConfig, @@ -1799,6 +1804,8 @@ "ContentType", "CountInfo", "CountInfoTypedDict", + "CreateAgentRequest", + "CreateAgentRequestTypedDict", "CreateAnnouncementRequest", "CreateAnnouncementRequestChannel", "CreateAnnouncementRequestPostType", @@ -1817,6 +1824,8 @@ "CreateShortcutRequestTypedDict", "CreateShortcutResponse", "CreateShortcutResponseTypedDict", + "CreateWorkflowRequest", + "CreateWorkflowRequestTypedDict", "CreateannouncementRequestRequest", "CreateannouncementRequestRequestTypedDict", "CreateanswerRequestRequest", @@ -3019,6 +3028,8 @@ "ContentType": ".contenttype", "CountInfo": ".countinfo", "CountInfoTypedDict": ".countinfo", + "CreateAgentRequest": ".createagentop", + "CreateAgentRequestTypedDict": ".createagentop", "CreateannouncementRequestRequest": ".createannouncementop", "CreateannouncementRequestRequestTypedDict": ".createannouncementop", "CreateAnnouncementRequest": ".createannouncementrequest", @@ -3051,6 +3062,8 @@ "CreateShortcutRequestTypedDict": ".createshortcutrequest", "CreateShortcutResponse": ".createshortcutresponse", "CreateShortcutResponseTypedDict": ".createshortcutresponse", + "CreateWorkflowRequest": ".createworkflowrequest", + "CreateWorkflowRequestTypedDict": ".createworkflowrequest", "CurrentActiveUsers": ".currentactiveusers", "CurrentActiveUsersTypedDict": ".currentactiveusers", "CustomDatasourceConfig": ".customdatasourceconfig", diff --git a/src/glean/api_client/models/createagentop.py b/src/glean/api_client/models/createagentop.py new file mode 100644 index 00000000..4ed4192d --- /dev/null +++ b/src/glean/api_client/models/createagentop.py @@ -0,0 +1,54 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .createworkflowrequest import CreateWorkflowRequest, CreateWorkflowRequestTypedDict +from glean.api_client.types import BaseModel, UNSET_SENTINEL +from glean.api_client.utils import FieldMetadata, QueryParamMetadata, RequestMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateAgentRequestTypedDict(TypedDict): + create_workflow_request: CreateWorkflowRequestTypedDict + locale: NotRequired[str] + r"""The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`.""" + timezone_offset: NotRequired[int] + r"""The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC.""" + + +class CreateAgentRequest(BaseModel): + create_workflow_request: Annotated[ + CreateWorkflowRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + locale: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`.""" + + timezone_offset: Annotated[ + Optional[int], + pydantic.Field(alias="timezoneOffset"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["locale", "timezoneOffset"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/glean/api_client/models/createworkflowrequest.py b/src/glean/api_client/models/createworkflowrequest.py new file mode 100644 index 00000000..206d00f3 --- /dev/null +++ b/src/glean/api_client/models/createworkflowrequest.py @@ -0,0 +1,52 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from glean.api_client.types import BaseModel, UNSET_SENTINEL +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateWorkflowRequestTypedDict(TypedDict): + name: NotRequired[str] + r"""The name of the workflow.""" + transient: NotRequired[bool] + r"""Used to create a transient workflow.""" + parent_workflow_id: NotRequired[str] + r"""id of the parent workflow for transient workflows""" + + +class CreateWorkflowRequest(BaseModel): + name: Optional[str] = None + r"""The name of the workflow.""" + + transient: Optional[bool] = None + r"""Used to create a transient workflow.""" + + parent_workflow_id: Annotated[ + Optional[str], pydantic.Field(alias="parentWorkflowId") + ] = None + r"""id of the parent workflow for transient workflows""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name", "transient", "parentWorkflowId"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +try: + CreateWorkflowRequest.model_rebuild() +except NameError: + pass diff --git a/src/glean/api_client/people.py b/src/glean/api_client/people.py index 8f853d2a..9d002776 100644 --- a/src/glean/api_client/people.py +++ b/src/glean/api_client/people.py @@ -6,7 +6,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union from typing_extensions import deprecated @@ -587,8 +587,8 @@ def bulk_index( *, upload_id: str, employees: Union[ - List[models.EmployeeInfoDefinition], - List[models.EmployeeInfoDefinitionTypedDict], + Iterable[models.EmployeeInfoDefinition], + Iterable[models.EmployeeInfoDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -697,8 +697,8 @@ async def bulk_index_async( *, upload_id: str, employees: Union[ - List[models.EmployeeInfoDefinition], - List[models.EmployeeInfoDefinitionTypedDict], + Iterable[models.EmployeeInfoDefinition], + Iterable[models.EmployeeInfoDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -1494,7 +1494,8 @@ def bulk_index_teams( *, upload_id: str, teams: Union[ - List[models.TeamInfoDefinition], List[models.TeamInfoDefinitionTypedDict] + Iterable[models.TeamInfoDefinition], + Iterable[models.TeamInfoDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, @@ -1595,7 +1596,8 @@ async def bulk_index_teams_async( *, upload_id: str, teams: Union[ - List[models.TeamInfoDefinition], List[models.TeamInfoDefinitionTypedDict] + Iterable[models.TeamInfoDefinition], + Iterable[models.TeamInfoDefinitionTypedDict], ], is_first_page: Optional[bool] = None, is_last_page: Optional[bool] = None, diff --git a/src/glean/api_client/pins.py b/src/glean/api_client/pins.py index 0127c007..8635dd29 100644 --- a/src/glean/api_client/pins.py +++ b/src/glean/api_client/pins.py @@ -6,7 +6,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class Pins(BaseSDK): @@ -14,9 +14,9 @@ def update( self, *, locale: Optional[str] = None, - queries: Optional[List[str]] = None, + queries: Optional[Iterable[str]] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -50,7 +50,7 @@ def update( request = models.EditpinRequestRequest( locale=locale, edit_pin_request=models.EditPinRequest( - queries=queries, + queries=utils.unmarshal(queries, Optional[List[str]]), audience_filters=utils.get_pydantic_model( audience_filters, Optional[List[models.FacetFilter]] ), @@ -116,9 +116,9 @@ async def update_async( self, *, locale: Optional[str] = None, - queries: Optional[List[str]] = None, + queries: Optional[Iterable[str]] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -152,7 +152,7 @@ async def update_async( request = models.EditpinRequestRequest( locale=locale, edit_pin_request=models.EditPinRequest( - queries=queries, + queries=utils.unmarshal(queries, Optional[List[str]]), audience_filters=utils.get_pydantic_model( audience_filters, Optional[List[models.FacetFilter]] ), @@ -590,9 +590,9 @@ def create( self, *, locale: Optional[str] = None, - queries: Optional[List[str]] = None, + queries: Optional[Iterable[str]] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, document_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -626,7 +626,7 @@ def create( request = models.PinRequestRequest( locale=locale, pin_request=models.PinRequest( - queries=queries, + queries=utils.unmarshal(queries, Optional[List[str]]), audience_filters=utils.get_pydantic_model( audience_filters, Optional[List[models.FacetFilter]] ), @@ -692,9 +692,9 @@ async def create_async( self, *, locale: Optional[str] = None, - queries: Optional[List[str]] = None, + queries: Optional[Iterable[str]] = None, audience_filters: Optional[ - Union[List[models.FacetFilter], List[models.FacetFilterTypedDict]] + Union[Iterable[models.FacetFilter], Iterable[models.FacetFilterTypedDict]] ] = None, document_id: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -728,7 +728,7 @@ async def create_async( request = models.PinRequestRequest( locale=locale, pin_request=models.PinRequest( - queries=queries, + queries=utils.unmarshal(queries, Optional[List[str]]), audience_filters=utils.get_pydantic_model( audience_filters, Optional[List[models.FacetFilter]] ), diff --git a/src/glean/api_client/search.py b/src/glean/api_client/search.py index 22746832..d599dd5a 100644 --- a/src/glean/api_client/search.py +++ b/src/glean/api_client/search.py @@ -7,7 +7,7 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional, Union +from typing import Any, Iterable, List, Mapping, Optional, Union class Search(BaseSDK): @@ -27,7 +27,7 @@ def query_as_admin( page_size: Optional[int] = None, max_snippet_size: Optional[int] = None, cursor: Optional[str] = None, - result_tab_ids: Optional[List[str]] = None, + result_tab_ids: Optional[Iterable[str]] = None, input_details: Optional[ Union[ models.SearchRequestInputDetails, @@ -92,7 +92,7 @@ def query_as_admin( max_snippet_size=max_snippet_size, query=query, cursor=cursor, - result_tab_ids=result_tab_ids, + result_tab_ids=utils.unmarshal(result_tab_ids, Optional[List[str]]), input_details=utils.get_pydantic_model( input_details, Optional[models.SearchRequestInputDetails] ), @@ -178,7 +178,7 @@ async def query_as_admin_async( page_size: Optional[int] = None, max_snippet_size: Optional[int] = None, cursor: Optional[str] = None, - result_tab_ids: Optional[List[str]] = None, + result_tab_ids: Optional[Iterable[str]] = None, input_details: Optional[ Union[ models.SearchRequestInputDetails, @@ -243,7 +243,7 @@ async def query_as_admin_async( max_snippet_size=max_snippet_size, query=query, cursor=cursor, - result_tab_ids=result_tab_ids, + result_tab_ids=utils.unmarshal(result_tab_ids, Optional[List[str]]), input_details=utils.get_pydantic_model( input_details, Optional[models.SearchRequestInputDetails] ), @@ -322,12 +322,12 @@ def autocomplete( Union[models.SessionInfo, models.SessionInfoTypedDict] ] = None, query: Optional[str] = None, - datasources_filter: Optional[List[str]] = None, + datasources_filter: Optional[Iterable[str]] = None, datasource: Optional[str] = None, - result_types: Optional[List[models.AutocompleteRequestResultType]] = None, + result_types: Optional[Iterable[models.AutocompleteRequestResultType]] = None, result_size: Optional[int] = None, auth_tokens: Optional[ - Union[List[models.AuthToken], List[models.AuthTokenTypedDict]] + Union[Iterable[models.AuthToken], Iterable[models.AuthTokenTypedDict]] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -371,9 +371,13 @@ def autocomplete( session_info, Optional[models.SessionInfo] ), query=query, - datasources_filter=datasources_filter, + datasources_filter=utils.unmarshal( + datasources_filter, Optional[List[str]] + ), datasource=datasource, - result_types=result_types, + result_types=utils.unmarshal( + result_types, Optional[List[models.AutocompleteRequestResultType]] + ), result_size=result_size, auth_tokens=utils.get_pydantic_model( auth_tokens, Optional[List[models.AuthToken]] @@ -448,12 +452,12 @@ async def autocomplete_async( Union[models.SessionInfo, models.SessionInfoTypedDict] ] = None, query: Optional[str] = None, - datasources_filter: Optional[List[str]] = None, + datasources_filter: Optional[Iterable[str]] = None, datasource: Optional[str] = None, - result_types: Optional[List[models.AutocompleteRequestResultType]] = None, + result_types: Optional[Iterable[models.AutocompleteRequestResultType]] = None, result_size: Optional[int] = None, auth_tokens: Optional[ - Union[List[models.AuthToken], List[models.AuthTokenTypedDict]] + Union[Iterable[models.AuthToken], Iterable[models.AuthTokenTypedDict]] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -497,9 +501,13 @@ async def autocomplete_async( session_info, Optional[models.SessionInfo] ), query=query, - datasources_filter=datasources_filter, + datasources_filter=utils.unmarshal( + datasources_filter, Optional[List[str]] + ), datasource=datasource, - result_types=result_types, + result_types=utils.unmarshal( + result_types, Optional[List[models.AutocompleteRequestResultType]] + ), result_size=result_size, auth_tokens=utils.get_pydantic_model( auth_tokens, Optional[List[models.AuthToken]] @@ -569,7 +577,7 @@ def retrieve_feed( self, *, locale: Optional[str] = None, - categories: Optional[List[models.FeedRequestCategory]] = None, + categories: Optional[Iterable[models.FeedRequestCategory]] = None, request_options: Optional[ Union[models.FeedRequestOptions, models.FeedRequestOptionsTypedDict] ] = None, @@ -609,7 +617,9 @@ def retrieve_feed( request = models.FeedRequestRequest( locale=locale, feed_request=models.FeedRequest( - categories=categories, + categories=utils.unmarshal( + categories, Optional[List[models.FeedRequestCategory]] + ), request_options=utils.get_pydantic_model( request_options, Optional[models.FeedRequestOptions] ), @@ -678,7 +688,7 @@ async def retrieve_feed_async( self, *, locale: Optional[str] = None, - categories: Optional[List[models.FeedRequestCategory]] = None, + categories: Optional[Iterable[models.FeedRequestCategory]] = None, request_options: Optional[ Union[models.FeedRequestOptions, models.FeedRequestOptionsTypedDict] ] = None, @@ -718,7 +728,9 @@ async def retrieve_feed_async( request = models.FeedRequestRequest( locale=locale, feed_request=models.FeedRequest( - categories=categories, + categories=utils.unmarshal( + categories, Optional[List[models.FeedRequestCategory]] + ), request_options=utils.get_pydantic_model( request_options, Optional[models.FeedRequestOptions] ), @@ -1075,7 +1087,7 @@ def query( page_size: Optional[int] = None, max_snippet_size: Optional[int] = None, cursor: Optional[str] = None, - result_tab_ids: Optional[List[str]] = None, + result_tab_ids: Optional[Iterable[str]] = None, input_details: Optional[ Union[ models.SearchRequestInputDetails, @@ -1140,7 +1152,7 @@ def query( max_snippet_size=max_snippet_size, query=query, cursor=cursor, - result_tab_ids=result_tab_ids, + result_tab_ids=utils.unmarshal(result_tab_ids, Optional[List[str]]), input_details=utils.get_pydantic_model( input_details, Optional[models.SearchRequestInputDetails] ), @@ -1226,7 +1238,7 @@ async def query_async( page_size: Optional[int] = None, max_snippet_size: Optional[int] = None, cursor: Optional[str] = None, - result_tab_ids: Optional[List[str]] = None, + result_tab_ids: Optional[Iterable[str]] = None, input_details: Optional[ Union[ models.SearchRequestInputDetails, @@ -1291,7 +1303,7 @@ async def query_async( max_snippet_size=max_snippet_size, query=query, cursor=cursor, - result_tab_ids=result_tab_ids, + result_tab_ids=utils.unmarshal(result_tab_ids, Optional[List[str]]), input_details=utils.get_pydantic_model( input_details, Optional[models.SearchRequestInputDetails] ), diff --git a/src/glean/api_client/utils/eventstreaming.py b/src/glean/api_client/utils/eventstreaming.py index 3bdcd6d3..1c189bf6 100644 --- a/src/glean/api_client/utils/eventstreaming.py +++ b/src/glean/api_client/utils/eventstreaming.py @@ -53,6 +53,9 @@ def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + + def close(self): self._closed = True self.response.close() @@ -92,6 +95,9 @@ async def __aenter__(self): return self async def __aexit__(self, exc_type, exc_val, exc_tb): + await self.close() + + async def close(self): self._closed = True await self.response.aclose() @@ -124,52 +130,54 @@ async def stream_events_async( sentinel: Optional[str] = None, data_required: bool = True, ) -> AsyncGenerator[T, None]: - buffer = bytearray() - position = 0 - event_id: Optional[str] = None - async for chunk in response.aiter_bytes(): - if len(buffer) == 0 and chunk.startswith(UTF8_BOM): - chunk = chunk[len(UTF8_BOM) :] - buffer += chunk - for i in range(position, len(buffer)): - char = buffer[i : i + 1] - seq: Optional[bytes] = None - if char in [b"\r", b"\n"]: - for boundary in MESSAGE_BOUNDARIES: - seq = _peek_sequence(i, buffer, boundary) - if seq is not None: - break - if seq is None: - continue - - block = buffer[position:i] - position = i + len(seq) - event, discard, event_id = _parse_event( - raw=block, - decoder=decoder, - sentinel=sentinel, - event_id=event_id, - data_required=data_required, - ) - if event is not None: - yield event - if discard: - await response.aclose() - return - - if position > 0: - buffer = buffer[position:] - position = 0 - - event, discard, _ = _parse_event( - raw=buffer, - decoder=decoder, - sentinel=sentinel, - event_id=event_id, - data_required=data_required, - ) - if event is not None: - yield event + try: + buffer = bytearray() + position = 0 + event_id: Optional[str] = None + async for chunk in response.aiter_bytes(): + if len(buffer) == 0 and chunk.startswith(UTF8_BOM): + chunk = chunk[len(UTF8_BOM) :] + buffer += chunk + for i in range(position, len(buffer)): + char = buffer[i : i + 1] + seq: Optional[bytes] = None + if char in [b"\r", b"\n"]: + for boundary in MESSAGE_BOUNDARIES: + seq = _peek_sequence(i, buffer, boundary) + if seq is not None: + break + if seq is None: + continue + + block = buffer[position:i] + position = i + len(seq) + event, discard, event_id = _parse_event( + raw=block, + decoder=decoder, + sentinel=sentinel, + event_id=event_id, + data_required=data_required, + ) + if event is not None: + yield event + if discard: + return + + if position > 0: + buffer = buffer[position:] + position = 0 + + event, discard, _ = _parse_event( + raw=buffer, + decoder=decoder, + sentinel=sentinel, + event_id=event_id, + data_required=data_required, + ) + if event is not None: + yield event + finally: + await response.aclose() def stream_events( @@ -178,52 +186,54 @@ def stream_events( sentinel: Optional[str] = None, data_required: bool = True, ) -> Generator[T, None, None]: - buffer = bytearray() - position = 0 - event_id: Optional[str] = None - for chunk in response.iter_bytes(): - if len(buffer) == 0 and chunk.startswith(UTF8_BOM): - chunk = chunk[len(UTF8_BOM) :] - buffer += chunk - for i in range(position, len(buffer)): - char = buffer[i : i + 1] - seq: Optional[bytes] = None - if char in [b"\r", b"\n"]: - for boundary in MESSAGE_BOUNDARIES: - seq = _peek_sequence(i, buffer, boundary) - if seq is not None: - break - if seq is None: - continue - - block = buffer[position:i] - position = i + len(seq) - event, discard, event_id = _parse_event( - raw=block, - decoder=decoder, - sentinel=sentinel, - event_id=event_id, - data_required=data_required, - ) - if event is not None: - yield event - if discard: - response.close() - return - - if position > 0: - buffer = buffer[position:] - position = 0 - - event, discard, _ = _parse_event( - raw=buffer, - decoder=decoder, - sentinel=sentinel, - event_id=event_id, - data_required=data_required, - ) - if event is not None: - yield event + try: + buffer = bytearray() + position = 0 + event_id: Optional[str] = None + for chunk in response.iter_bytes(): + if len(buffer) == 0 and chunk.startswith(UTF8_BOM): + chunk = chunk[len(UTF8_BOM) :] + buffer += chunk + for i in range(position, len(buffer)): + char = buffer[i : i + 1] + seq: Optional[bytes] = None + if char in [b"\r", b"\n"]: + for boundary in MESSAGE_BOUNDARIES: + seq = _peek_sequence(i, buffer, boundary) + if seq is not None: + break + if seq is None: + continue + + block = buffer[position:i] + position = i + len(seq) + event, discard, event_id = _parse_event( + raw=block, + decoder=decoder, + sentinel=sentinel, + event_id=event_id, + data_required=data_required, + ) + if event is not None: + yield event + if discard: + return + + if position > 0: + buffer = buffer[position:] + position = 0 + + event, discard, _ = _parse_event( + raw=buffer, + decoder=decoder, + sentinel=sentinel, + event_id=event_id, + data_required=data_required, + ) + if event is not None: + yield event + finally: + response.close() def _parse_event( diff --git a/src/glean/api_client/utils/serializers.py b/src/glean/api_client/utils/serializers.py index d2149f8b..1031ed93 100644 --- a/src/glean/api_client/utils/serializers.py +++ b/src/glean/api_client/utils/serializers.py @@ -4,7 +4,7 @@ import functools import json import typing -from typing import Any, Dict, List, Tuple, Union, get_args +from typing import Any, Dict, Iterable, List, Mapping, Tuple, Union, get_args import typing_extensions from typing_extensions import get_origin @@ -113,10 +113,12 @@ def validate(c): def unmarshal_json(raw, typ: Any) -> Any: - return unmarshal(from_json(raw), typ) + return unmarshal(from_json(raw), typ, coerce_iterables=False) -def unmarshal(val, typ: Any) -> Any: +def unmarshal(val, typ: Any, coerce_iterables: bool = True) -> Any: + if coerce_iterables: + val = _coerce_iterables_for_type(val, typ) unmarshaller = create_model( "Unmarshaller", body=(typ, ...), @@ -193,9 +195,88 @@ def get_pydantic_model(data: Any, typ: Any) -> Any: if not _contains_pydantic_model(data): return unmarshal(data, typ) + return _coerce_iterables_for_type(data, typ) + + +def _coerce_iterables_for_type(data: Any, typ: Any) -> Any: + if data is None or isinstance(data, (BaseModel, Unset)): + return data + + typ = _resolve_type_alias(typ) + origin = get_origin(typ) + + if _is_annotated_type(origin): + args = get_args(typ) + return _coerce_iterables_for_type(data, args[0]) if args else data + + if is_union(origin): + for arg in (arg for arg in get_args(typ) if arg is not type(None)): + coerced = _coerce_iterables_for_type(data, arg) + if coerced is not data: + return coerced + return data + + if _is_list_type(typ): + item_type = get_args(typ)[0] if get_args(typ) else Any + if isinstance(data, (str, bytes, bytearray, Mapping)): + return data + if isinstance(data, Iterable): + return [_coerce_iterables_for_type(item, item_type) for item in data] + return data + + if _is_mapping_type(typ): + value_type = get_args(typ)[1] if len(get_args(typ)) > 1 else Any + if isinstance(data, Mapping): + return { + key: _coerce_iterables_for_type(value, value_type) + for key, value in data.items() + } + return data + + if _is_pydantic_model_type(typ) and isinstance(data, Mapping): + coerced = None + for field_name, field in typ.model_fields.items(): + field_type = field.annotation + for key in (field_name, field.alias): + if key is not None and key in data: + value = data[key] if coerced is None else coerced[key] + coerced_value = _coerce_iterables_for_type(value, field_type) + if coerced_value is not value: + if coerced is None: + coerced = dict(data) + coerced[key] = coerced_value + return coerced if coerced is not None else data + return data +def _resolve_type_alias(typ: Any) -> Any: + return getattr(typ, "__value__", typ) + + +def _is_annotated_type(origin: Any) -> bool: + return any( + origin is typing_obj + for typing_obj in _get_typing_objects_by_name_of("Annotated") + ) + + +def _is_list_type(typ: Any) -> bool: + typ = _resolve_type_alias(typ) + return typ is list or get_origin(typ) is list + + +def _is_mapping_type(typ: Any) -> bool: + typ = _resolve_type_alias(typ) + origin = get_origin(typ) + mapping_origin = get_origin(Mapping[Any, Any]) + return typ in (dict, Dict, Mapping) or origin in (dict, Mapping, mapping_origin) + + +def _is_pydantic_model_type(typ: Any) -> bool: + return isinstance(typ, type) and issubclass(typ, BaseModel) + + def _contains_pydantic_model(data: Any) -> bool: if isinstance(data, BaseModel): return True diff --git a/src/glean/api_client/visibilityoverrides.py b/src/glean/api_client/visibilityoverrides.py index ecbc256b..e7befb7a 100644 --- a/src/glean/api_client/visibilityoverrides.py +++ b/src/glean/api_client/visibilityoverrides.py @@ -6,14 +6,14 @@ from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Iterable, List, Mapping, Optional, Union class Visibilityoverrides(BaseSDK): def list( self, *, - doc_ids: Optional[List[str]] = None, + doc_ids: Optional[Iterable[str]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -40,7 +40,7 @@ def list( base_url = self._get_url(base_url, url_variables) request = models.GetdocvisibilityRequest( - doc_ids=doc_ids, + doc_ids=utils.unmarshal(doc_ids, Optional[List[str]]), ) req = self._build_request( @@ -99,7 +99,7 @@ def list( async def list_async( self, *, - doc_ids: Optional[List[str]] = None, + doc_ids: Optional[Iterable[str]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -126,7 +126,7 @@ async def list_async( base_url = self._get_url(base_url, url_variables) request = models.GetdocvisibilityRequest( - doc_ids=doc_ids, + doc_ids=utils.unmarshal(doc_ids, Optional[List[str]]), ) req = self._build_request_async( @@ -187,8 +187,8 @@ def create( *, visibility_overrides: Optional[ Union[ - List[models.DocumentVisibilityOverride], - List[models.DocumentVisibilityOverrideTypedDict], + Iterable[models.DocumentVisibilityOverride], + Iterable[models.DocumentVisibilityOverrideTypedDict], ] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, @@ -287,8 +287,8 @@ async def create_async( *, visibility_overrides: Optional[ Union[ - List[models.DocumentVisibilityOverride], - List[models.DocumentVisibilityOverrideTypedDict], + Iterable[models.DocumentVisibilityOverride], + Iterable[models.DocumentVisibilityOverrideTypedDict], ] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, diff --git a/tests/mockserver/internal/handler/generated_handlers.go b/tests/mockserver/internal/handler/generated_handlers.go index 6400b090..a8a0a755 100644 --- a/tests/mockserver/internal/handler/generated_handlers.go +++ b/tests/mockserver/internal/handler/generated_handlers.go @@ -57,6 +57,7 @@ func GeneratedHandlers(ctx context.Context, dir *logging.HTTPFileDirectory, rt * NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/addcollectionitems", pathPostRestAPIV1Addcollectionitems(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/addverificationreminder", pathPostRestAPIV1Addverificationreminder(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/adminsearch", pathPostRestAPIV1Adminsearch(dir, rt)), + NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/agents", pathPostRestAPIV1Agents(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/autocomplete", pathPostRestAPIV1Autocomplete(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/chat", pathPostRestAPIV1Chat(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/checkdatasourceauth", pathPostRestAPIV1Checkdatasourceauth(dir, rt)), diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1agents.go b/tests/mockserver/internal/handler/pathpostrestapiv1agents.go new file mode 100644 index 00000000..6c1367d6 --- /dev/null +++ b/tests/mockserver/internal/handler/pathpostrestapiv1agents.go @@ -0,0 +1,82 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package handler + +import ( + "fmt" + "log" + "mockserver/internal/handler/assert" + "mockserver/internal/logging" + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" + "mockserver/internal/tracking" + "net/http" +) + +func pathPostRestAPIV1Agents(dir *logging.HTTPFileDirectory, rt *tracking.RequestTracker) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + test := req.Header.Get("x-speakeasy-test-name") + instanceID := req.Header.Get("x-speakeasy-test-instance-id") + + count := rt.GetRequestCount(test, instanceID) + + switch fmt.Sprintf("%s[%d]", test, count) { + case "createAgent[0]": + dir.HandlerFunc("createAgent", testCreateAgentCreateAgent0)(w, req) + default: + http.Error(w, fmt.Sprintf("Unknown test: %s[%d]", test, count), http.StatusBadRequest) + } + } +} + +func testCreateAgentCreateAgent0(w http.ResponseWriter, req *http.Request) { + if err := assert.SecurityAuthorizationHeader(req, false, "Bearer"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.ContentType(req, "application/json", true); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + if err := assert.AcceptHeader(req, []string{"application/json"}); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + if err := assert.HeaderExists(req, "User-Agent"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + var respBody *components.WorkflowResult = &components.WorkflowResult{ + Workflow: components.Workflow{ + Author: &components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, + LastDraftSavedBy: &components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, + LastUpdatedBy: &components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, + }, + } + respBodyBytes, err := utils.MarshalJSON(respBody, "", true) + + if err != nil { + http.Error( + w, + "Unable to encode response body as JSON: "+err.Error(), + http.StatusInternalServerError, + ) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write(respBodyBytes) +} diff --git a/tests/mockserver/internal/sdk/models/components/createworkflowrequest.go b/tests/mockserver/internal/sdk/models/components/createworkflowrequest.go new file mode 100644 index 00000000..277dd8b7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createworkflowrequest.go @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type CreateWorkflowRequest struct { + // The name of the workflow. + Name *string `json:"name,omitempty"` + // Used to create a transient workflow. + Transient *bool `json:"transient,omitempty"` + // id of the parent workflow for transient workflows + ParentWorkflowID *string `json:"parentWorkflowId,omitempty"` +} + +func (o *CreateWorkflowRequest) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *CreateWorkflowRequest) GetTransient() *bool { + if o == nil { + return nil + } + return o.Transient +} + +func (o *CreateWorkflowRequest) GetParentWorkflowID() *string { + if o == nil { + return nil + } + return o.ParentWorkflowID +} diff --git a/tests/mockserver/internal/sdk/models/operations/createagent.go b/tests/mockserver/internal/sdk/models/operations/createagent.go new file mode 100644 index 00000000..255e835e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createagent.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateAgentRequest struct { + // The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`. + Locale *string `queryParam:"style=form,explode=true,name=locale"` + // The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. + TimezoneOffset *int64 `queryParam:"style=form,explode=true,name=timezoneOffset"` + Body components.CreateWorkflowRequest `request:"mediaType=application/json"` +} + +func (o *CreateAgentRequest) GetLocale() *string { + if o == nil { + return nil + } + return o.Locale +} + +func (o *CreateAgentRequest) GetTimezoneOffset() *int64 { + if o == nil { + return nil + } + return o.TimezoneOffset +} + +func (o *CreateAgentRequest) GetBody() components.CreateWorkflowRequest { + if o == nil { + return components.CreateWorkflowRequest{} + } + return o.Body +} + +type CreateAgentResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Success + WorkflowResult *components.WorkflowResult +} + +func (o *CreateAgentResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateAgentResponse) GetWorkflowResult() *components.WorkflowResult { + if o == nil { + return nil + } + return o.WorkflowResult +} diff --git a/tests/test_agents.py b/tests/test_agents.py index 1d18b766..46852ff4 100644 --- a/tests/test_agents.py +++ b/tests/test_agents.py @@ -74,3 +74,17 @@ def test_agents_create_and_stream_run(): ) def test_agents_create_and_wait_run(): pass + + +def test_agents_create_agent(): + test_http_client = create_test_http_client("createAgent") + + with Glean( + server_url=os.getenv("TEST_SERVER_URL", "http://localhost:18080"), + client=test_http_client, + api_token=os.getenv("GLEAN_API_TOKEN", "value"), + ) as glean: + assert glean is not None + + res = glean.agents.create_agent() + assert res is not None diff --git a/tests/test_messages.py b/tests/test_messages.py index 132005ec..636f01d3 100644 --- a/tests/test_messages.py +++ b/tests/test_messages.py @@ -18,7 +18,7 @@ def test_messages_messages(): res = glean.client.messages.retrieve( id_type=models.IDType.CONVERSATION_ID, id="", - datasource=models.Datasource.FACEBOOKWORKPLACE, + datasource=models.Datasource.GCHAT, timestamp_millis=558834, ) assert res is not None diff --git a/tests/test_summarize.py b/tests/test_summarize.py index df71d57d..ccd9ced1 100644 --- a/tests/test_summarize.py +++ b/tests/test_summarize.py @@ -18,12 +18,12 @@ def test_summarize_summarize(): res = glean.client.documents.summarize( document_specs=[ { - "ugc_type": models.DocumentSpecUgcType2.ANNOUNCEMENTS, + "ugc_type": models.DocumentSpecUgcType2.CHATS, "ugc_id": "", }, { - "ugc_type": models.DocumentSpecUgcType1.COLLECTIONS, - "content_id": 885812, + "ugc_type": models.DocumentSpecUgcType1.SHORTCUTS, + "content_id": 472910, }, ] )