diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index dc3b06231..faa5fdb36 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 882cf8bc2a3c798e7f8a68a0631a7f90 + docChecksum: aa20ba624ec481df58c29dc50fb2a41e docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.3.233 - configChecksum: 91fd831f93606fdd433f9c287c45b499 + releaseVersion: 1.3.234 + configChecksum: 6d9ede6dcd8a5e5c7ca1a96da8338ff6 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 5e44e1e3-42a0-440f-a3cf-93e1dee5caf4 - pristine_commit_hash: b83c596b5ba2056ef0685d0161cdcc0ab525a786 - pristine_tree_hash: 8a2f17b9a47772f1d18ad7e5bae8fd83dc80ee6c + generation_id: ad7776e0-0883-44c0-af7d-59baa591ffad + pristine_commit_hash: 73cf1e99f5b9cbecff4cc328e37de9e01b812e2f + pristine_tree_hash: eefc5c70d547f44bbf77427dbf665233a7eb6e9c features: python: acceptHeaders: 3.0.0 @@ -3294,6 +3294,10 @@ trackedFiles: id: 3cd77320d674 last_write_checksum: sha1:b6b82e0aa08aa4fc76b79ddd5ffe4e3741707c81 pristine_git_object: 05324ebbc26e0a170d54d939fab938d582327614 + docs/components/deletescimgroupoptoutresponse.mdx: + id: 0238816c7ad4 + last_write_checksum: sha1:388321cb0134ba5458a155027e7cd2eb2d9e9552 + pristine_git_object: ad33409df8d876bef9d42d46d50f64b9b5e47734 docs/components/deletescimorganizationrolemappingresponse.mdx: id: 59cf6895ca6e last_write_checksum: sha1:b7be0cd69d0c9e70bd86771a9a877f5f9cdabe33 @@ -5034,6 +5038,14 @@ trackedFiles: id: 7ac1b5a82a51 last_write_checksum: sha1:8e38f1f6d463fef902d76ab82ddbd7c793059367 pristine_git_object: d86a24d8e5f76c08c15104eda8eb595e533d761a + docs/components/listscimgroupoptoutsresponse.mdx: + id: 05b711050182 + last_write_checksum: sha1:babad4abc9b62938858558a73d666317fbe9a795 + pristine_git_object: 3af7b8a1a7ccccd60e60f41dbe9c24e43caaed7e + docs/components/listscimgrouppolicyassignmentsresponse.mdx: + id: 64fe40f2ae12 + last_write_checksum: sha1:365c9c112f0b282a8f86c2ee200d90d8e16cd9fc + pristine_git_object: 361869a0107600ae6e76714f09019692a3b39c03 docs/components/listscimgroupsresponse.mdx: id: b7b20d46cf95 last_write_checksum: sha1:c746607d8b439f345a4d92401cc2f13ab77b5c79 @@ -8250,6 +8262,22 @@ trackedFiles: id: 0306b7b3cf78 last_write_checksum: sha1:93f2d7d1dc60a2b1635202d83ae9f00cc314e2e6 pristine_git_object: 94331ee57f8ebf2b21903d5ebda22e0faf23044a + docs/components/scimgroupoptout.mdx: + id: f075bce5accb + last_write_checksum: sha1:0a30657a3baf802b9d8e587e4b80489e541f8b04 + pristine_git_object: c460da7490b8c76d01688e98858088bfaef87227 + docs/components/scimgroupoptoutpolicytype.mdx: + id: d371d5e087c3 + last_write_checksum: sha1:e885e39ecb74247e98745f0cff377fd4d5de58de + pristine_git_object: 7bdd0f21288890b966d2dddd7c914af17344f686 + docs/components/scimgrouppolicyassignment.mdx: + id: 32b8adc5b2a7 + last_write_checksum: sha1:3f2818f5509ff6cfa41f3f0f1d7d09c30b82a39c + pristine_git_object: 23cd1b15d9a9efe31fada6f4254a776f4cab106f + docs/components/scimgrouppolicyassignmentresponse.mdx: + id: e1f15352b10e + last_write_checksum: sha1:d802b34e570573c5574e8e8d1bb167728911420a + pristine_git_object: 7e5b5a216654bf5c6db8975b9d80739bff6e5519 docs/components/scimorganizationrolemapping.mdx: id: a75fc1832d1c last_write_checksum: sha1:a0dec5843ccfd9cf9de34e764283b4bb5edc4c25 @@ -9646,6 +9674,10 @@ trackedFiles: id: 6d2a71282cce last_write_checksum: sha1:82e71129837f556e33466bf161704ef06fe7a0b4 pristine_git_object: cb179a3f96b2cb7d07d094a1503b97e87bbf4aa1 + docs/components/updatescimgrouppolicyassignmentrequest.mdx: + id: 25bf9961d319 + last_write_checksum: sha1:2216fb9a20b9701967f0f1750d5bc877be87a07e + pristine_git_object: 734dc377af7715e2f676a5378370a881f705f4cc docs/components/updateworkspacerequest.mdx: id: 9870d016bf28 last_write_checksum: sha1:7c01c6568de95c8dcaaf324b97ec26e13d0f7dcc @@ -10778,6 +10810,18 @@ trackedFiles: id: 429d1931c37a last_write_checksum: sha1:e042b66678a8497bcccb187a80db8d289aa39d80 pristine_git_object: ee532715449a0b834956844e4857b9381402a07f + docs/operations/deletescimgrouppolicyoptoutglobals.mdx: + id: 1ace7c920fc4 + last_write_checksum: sha1:14da7566f7852cccd9cccd949018bed1fd89ad62 + pristine_git_object: 87a4da403368c665b6a485d4f1b48bc036460cc6 + docs/operations/deletescimgrouppolicyoptoutpolicytype.mdx: + id: 65609549c7a5 + last_write_checksum: sha1:d6f45b12aa2dd10242259f9582deaa5453ed5bc9 + pristine_git_object: fb3be70155727701d59b140eec0179c96f4c09fa + docs/operations/deletescimgrouppolicyoptoutrequest.mdx: + id: 24a978c0f5ff + last_write_checksum: sha1:ed05c6d8ad9005c1cacce39b6353d0c831eeab82 + pristine_git_object: 4cefc7ffb690cd437d52ee2d9eab8d0a17e397eb docs/operations/deletescimorganizationrolemappingglobals.mdx: id: 1175e98b2a55 last_write_checksum: sha1:3b6be24fe5ff8870d1b1594226a10dc73587b0dd @@ -11218,6 +11262,14 @@ trackedFiles: id: d5f5f6747522 last_write_checksum: sha1:075678f4eca14a1db5545934d72b65bdb69487e2 pristine_git_object: 2826968df3e54a3b1ce83e5c9cf0231c913aab7c + docs/operations/getscimgrouppolicyassignmentglobals.mdx: + id: ae194cdee98e + last_write_checksum: sha1:43909fdbadb5fe1b9362f00ba7edfaffd50ee5b0 + pristine_git_object: c89763a8f7c2e1046ba5de36705f43eea08ca3fb + docs/operations/getscimgrouppolicyassignmentrequest.mdx: + id: 6becdd3aa5fa + last_write_checksum: sha1:2c6423c009e058953418b9d947388daccac062bb + pristine_git_object: 73eb941ce47b487805a5c5f585f22e53a96dcc06 docs/operations/getscimsyncjobglobals.mdx: id: af2a67cdfc94 last_write_checksum: sha1:409ad79b020e7a6c28c909147840b0b58096b759 @@ -11774,6 +11826,22 @@ trackedFiles: id: 82fd03794ec7 last_write_checksum: sha1:8fb556d57ad8f0fcb24d0382321463c9559f1c21 pristine_git_object: 5a06c059e132913af078793da5c30f17f243f9bb + docs/operations/listscimgrouppolicyassignmentsglobals.mdx: + id: 78414a40c0ae + last_write_checksum: sha1:06290aeb485e2d1a196198d9e4b2eddcb6fd8182 + pristine_git_object: ca4ae13b92b23a99bc0588cc1feaacd4bb9dcf83 + docs/operations/listscimgrouppolicyassignmentsrequest.mdx: + id: d644f026cac7 + last_write_checksum: sha1:600f9a507d72b22c97a0823c7532db1823055fcd + pristine_git_object: 73d6d4d1c9ba8ac7f4f4702c2e3c843c6b00a879 + docs/operations/listscimgrouppolicyoptoutsglobals.mdx: + id: a3588c7dfdf6 + last_write_checksum: sha1:14c99eb862fa0f7e010e4199da591f84b6b1fe99 + pristine_git_object: 8532ed58bafdb49ce9bf611e8740a16b572eef93 + docs/operations/listscimgrouppolicyoptoutsrequest.mdx: + id: 7cbe4112d145 + last_write_checksum: sha1:8957a1334da6335f1f63cb980c949cf59c40c2fc + pristine_git_object: fc4a1e86239081882e229c065ca0d8f7be1f31ff docs/operations/listscimgroupsglobals.mdx: id: 4bba8d8ae8ec last_write_checksum: sha1:f2cf31ad2df7e6ef05457b0bb3eb3d769acaf55d @@ -12182,6 +12250,14 @@ trackedFiles: id: b74e0f64f34e last_write_checksum: sha1:1dd2496d9c3cde9f110f833de62b152450566928 pristine_git_object: e30fab59e41315d4e487a3cab1df75faed69e596 + docs/operations/updatescimgrouppolicyassignmentglobals.mdx: + id: 6e6380af8ca2 + last_write_checksum: sha1:ea1e509e362745a32134f09f2c1f22b8a294c929 + pristine_git_object: 78c66eae708e74c043fe33f24b864f4792bf7293 + docs/operations/updatescimgrouppolicyassignmentrequest.mdx: + id: f1ba87aa14e0 + last_write_checksum: sha1:55e184badd0e4baad083afcdb42ac525ed4c09f5 + pristine_git_object: 6be96ee1f9b1754403aa45157c5d37b36e17abf3 docs/operations/updateworkspaceglobals.mdx: id: 053b3b5bb1eb last_write_checksum: sha1:5e76e6301f4ab80559f5d5d3728bc7c280effa37 @@ -12308,8 +12384,8 @@ trackedFiles: pristine_git_object: 7ec17f429d4a03eb91f993e592edd019caeeb451 docs/sdks/guardrailpolicies/README.mdx: id: 0e5ed6ce5965 - last_write_checksum: sha1:3b6cdcfddd7c382d4e9b4ca8d087c9eb55c66968 - pristine_git_object: 04af1956ac221b8912203963d46e14848a9bef6e + last_write_checksum: sha1:45e5052fc7960a1778e4403f0c9ac076d4ddb699 + pristine_git_object: fca09f04a84e31cf40b360e715c9175220334deb docs/sdks/guardrails/README.mdx: id: a0cd4218b8fa last_write_checksum: sha1:d5af5863ad27cfa25e66f238d58c53422282e73a @@ -12396,8 +12472,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:db11737d1e876c25d4f86036d8b25980e321a544 - pristine_git_object: dc814ab51c92f91737b2627d59f1b3c2b2827593 + last_write_checksum: sha1:7809c0e614e564bf08f764a22e02cc46507a9f4a + pristine_git_object: c40b713125364fa50fdf91309ffb10aab46ad607 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -12424,8 +12500,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:69baf17fd2075ae98fcbbd1add67a26b145ebf51 - pristine_git_object: b79bd4ef1b42bd871a169abdba57d56da5e900e6 + last_write_checksum: sha1:ec83861ca75f26d55ed2661f879f54ebf5a76c32 + pristine_git_object: 7d7fcb4d1fa6846b8c496db0a181a09a239cda74 src/openrouter/alpha.py: id: 306c4d93308d last_write_checksum: sha1:80cc0f39649445431cc2247ed0e0765438467766 @@ -12472,8 +12548,8 @@ trackedFiles: pristine_git_object: ad3d247954547814054c01989a2dff3d12b3e4e1 src/openrouter/components/__init__.py: id: 81754e97b3f4 - last_write_checksum: sha1:c5f3c4d53e39e61178888e16b406c60050eee712 - pristine_git_object: 99a867e982f676e5f36c86b982cbc35957119f1a + last_write_checksum: sha1:d0d475a1ac834861dac6785e6d8fdeed1d32e196 + pristine_git_object: 7348dedb37fa6f42c3ceef7914e1f986e2362614 src/openrouter/components/aabenchmarkentry.py: id: e2e0f0b48c82 last_write_checksum: sha1:08125e1d60df82793e11e8aed6e3c9fdb7512ebb @@ -13902,6 +13978,10 @@ trackedFiles: id: aef026b5e627 last_write_checksum: sha1:ccf8a4261d6c889d320fcce82bd8f73ae13cb07f pristine_git_object: 08a2289ff162c8758168d8da8414dd2f0ec3cc6e + src/openrouter/components/deletescimgroupoptoutresponse.py: + id: ae8b92009fb3 + last_write_checksum: sha1:cbcfde022866e82afc00c06ce5acde1377dbfe46 + pristine_git_object: 0e3fdbc07b04f3b8c6ef2e1e651ec3b2b10e8683 src/openrouter/components/deletescimorganizationrolemappingresponse.py: id: f2aed926989f last_write_checksum: sha1:6c2e5fd638a763dccec050ccfdfcc234e85e5531 @@ -14582,6 +14662,14 @@ trackedFiles: id: 7170aaa087e9 last_write_checksum: sha1:4cf71a1acd3e413f920c8ac02bd3e8f497b8a124 pristine_git_object: 546ec322c98cd8d4904002cc09d3a5b9bc57dd40 + src/openrouter/components/listscimgroupoptoutsresponse.py: + id: fc5e82177527 + last_write_checksum: sha1:87991abe5b264990479363cb359a0939dd5d7e8f + pristine_git_object: 4ff0882613a57f79cbf94e7792c11addef37f4d3 + src/openrouter/components/listscimgrouppolicyassignmentsresponse.py: + id: d5f0b26c9a94 + last_write_checksum: sha1:480e2f71a8d277f286eae40809a46815e765d3eb + pristine_git_object: 2cdd2fbe7b4af940a43ecb01933161f3e6a7b356 src/openrouter/components/listscimgroupsresponse.py: id: 7c20d71efb80 last_write_checksum: sha1:1a8318984c6789d39fcfb26950003decd43e8671 @@ -15750,6 +15838,18 @@ trackedFiles: id: c4d7a895a0bc last_write_checksum: sha1:426befccd88107766691cff08a93741c6f388471 pristine_git_object: b2e0acc56568f3c0ff542ec141c761ad62ddad80 + src/openrouter/components/scimgroupoptout.py: + id: b362dfacc501 + last_write_checksum: sha1:d1a985dabf182d54fe5a5d586af6b83c9fce40d9 + pristine_git_object: 7666d4d046ada750789c03958961e07b07259d03 + src/openrouter/components/scimgrouppolicyassignment.py: + id: "126971218647" + last_write_checksum: sha1:72de607c526c5d672db0626924c58d37a29bb4b2 + pristine_git_object: d50a94705ac9a731a192ce270b5c94d3e80f2890 + src/openrouter/components/scimgrouppolicyassignmentresponse.py: + id: c167cfb4eaab + last_write_checksum: sha1:313a2a11ad40add90e61317744eea8b2137489d9 + pristine_git_object: 9bf8bfc53cc05466e2a0dc3c667280bfda3cbcec src/openrouter/components/scimorganizationrolemapping.py: id: 81f2e9224676 last_write_checksum: sha1:5d34c36872358cff24c87fddc6c4d7e2bdb429a2 @@ -16306,6 +16406,10 @@ trackedFiles: id: 9af86345cb8d last_write_checksum: sha1:8d4b084302952a541df662012eb0d2f0f144a2d0 pristine_git_object: 2f110211bb0a6889bb6455a7a3901e0be260b170 + src/openrouter/components/updatescimgrouppolicyassignmentrequest.py: + id: ad693ce289a3 + last_write_checksum: sha1:a3b03b3dce6386eb4612a42c49ef72cc2813474b + pristine_git_object: dacce9792d87e598b1d6fc67db246d6edb3335bc src/openrouter/components/updateworkspacerequest.py: id: 78d86b3b0a63 last_write_checksum: sha1:ef37587d15a42b515231fae74625e4aac1c5941d @@ -16648,8 +16752,8 @@ trackedFiles: pristine_git_object: 67c135fcabfa563a3f7e2721d2618041ef8d7650 src/openrouter/guardrail_policies.py: id: 0505548eb66e - last_write_checksum: sha1:5fab90d49ee791b30c9140343421e93f2e4b6d7d - pristine_git_object: b2b812577f8ea24153dce094cbab1fb2b229e769 + last_write_checksum: sha1:2544613139808e80185fff69bca4abd3226869a4 + pristine_git_object: 5d25f0c1dedebc98eae66eef48c63dbf5d6c5f02 src/openrouter/guardrails.py: id: 705839f34e66 last_write_checksum: sha1:69bf7403b0ab33a52b621377a3ee404f47f8983b @@ -16688,8 +16792,8 @@ trackedFiles: pristine_git_object: 039fd484b407d7ca13177a892db5939b312ee50d src/openrouter/operations/__init__.py: id: 9afcea1e7161 - last_write_checksum: sha1:b307a82a88fcc61b302e44093de78f264461a9dc - pristine_git_object: 96120c9d11e8bc2f5a75fdc89c241c4cb84c8ce6 + last_write_checksum: sha1:bed4eec66a59879888122e7b05e14d231f884c9d + pristine_git_object: 22931c7a8c02d333b5c02a0e982a1d25a61b79a0 src/openrouter/operations/activateprivateendpoint.py: id: 3b39eec5d66f last_write_checksum: sha1:9406e6b3d38c82895fd795f637702ef579cc6d36 @@ -16926,6 +17030,10 @@ trackedFiles: id: 5006e36e243e last_write_checksum: sha1:5d80b78c9223f946aeb6e17aae26af33948b6b65 pristine_git_object: bada4a4344b1af53386a83a9ddedd28513d04127 + src/openrouter/operations/deletescimgrouppolicyoptout.py: + id: c6bd971f28e1 + last_write_checksum: sha1:2351c795d8897fa64b7cf6b4f5349777119e7f56 + pristine_git_object: 39209c5f7ab09414d1abfb9dda0f5949c2feb3ad src/openrouter/operations/deletescimorganizationrolemapping.py: id: e621cae89d21 last_write_checksum: sha1:887a1f34d14f39a82c520d20c037536a481145af @@ -17078,6 +17186,10 @@ trackedFiles: id: e1222ef7697e last_write_checksum: sha1:e1d1933f745296958538ae7c4bdc8ead53944492 pristine_git_object: d930ef5a4202b0ec9a88329927f7ea6373a7971f + src/openrouter/operations/getscimgrouppolicyassignment.py: + id: 66976605e2e7 + last_write_checksum: sha1:39597f7c411118ff9a9c2af4ae32968754cec1db + pristine_git_object: d2f089faab2f8f90180e9b03c4f5a0b1aeae7e0c src/openrouter/operations/getscimsyncjob.py: id: ebdf522b9390 last_write_checksum: sha1:85e9956e3cf6968cc39f77148f5d032200ed9d19 @@ -17262,6 +17374,14 @@ trackedFiles: id: 67a3b97ff2bc last_write_checksum: sha1:5acad915dd8fcaa9bc7dd4e087635023ae5a4ebf pristine_git_object: a913e2774bfb2a74def1a707076fad6cb49b6496 + src/openrouter/operations/listscimgrouppolicyassignments.py: + id: 15d4bed033ca + last_write_checksum: sha1:b1fa7e0d1015c30d5d4345ca33b151dd9d2f1121 + pristine_git_object: 77bdc3f1c2fef2c260dac0cc7d2ce3fdf73ec8f7 + src/openrouter/operations/listscimgrouppolicyoptouts.py: + id: 1860aa125cfe + last_write_checksum: sha1:0bf91fa6bf450778600b482c625eb8ccf1a799a2 + pristine_git_object: 0ef412a1edf3fd172b8896eeaa75a7504c744958 src/openrouter/operations/listscimgroups.py: id: 9f32309bb157 last_write_checksum: sha1:2319b023e5e8bd308df04a66e535edc2ffaa289d @@ -17386,6 +17506,10 @@ trackedFiles: id: 5887929f6dff last_write_checksum: sha1:c989609f3c53c3e455f0ad77595a1ce07a21b6e9 pristine_git_object: 2cceda1e615ee9e5f8d3d2aedf23f4d49b5110ed + src/openrouter/operations/updatescimgrouppolicyassignment.py: + id: 151c2009b762 + last_write_checksum: sha1:0c5476d434a4e1a54eff938d2bfe45af303d34ea + pristine_git_object: 945a6a5244b4cf8764c752bd082747d5d415aba5 src/openrouter/operations/updateworkspace.py: id: 2e9960985cbc last_write_checksum: sha1:0b74790d6673ca8bb8c203d97c5a6ce8128a16df @@ -22805,7 +22929,113 @@ examples: application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}} "500": application/json: {"error": {"code": 400, "message": "custom_id is required on requests[0]."}} + listScimGroupPolicyAssignments: + speakeasy-default-list-scim-group-policy-assignments: + responses: + "200": + application/json: {"data": [{"budget": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f", "model_availability": null, "moderation": null, "rate_limit": null, "scim_group_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e", "scim_group_mapping_id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f", "workspace_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"}]} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + getScimGroupPolicyAssignment: + speakeasy-default-get-scim-group-policy-assignment: + parameters: + path: + mapping_id: "af65e842-2eb2-4feb-bc51-929aca5a7147" + responses: + "200": + application/json: {"data": {"budget": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f", "model_availability": null, "moderation": null, "rate_limit": null, "scim_group_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e", "scim_group_mapping_id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f", "workspace_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + updateScimGroupPolicyAssignment: + speakeasy-default-update-scim-group-policy-assignment: + parameters: + path: + mapping_id: "10d15a71-fe5b-43e7-a9cc-284d994de944" + requestBody: + application/json: {} + responses: + "200": + application/json: {"data": {"budget": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f", "model_availability": null, "moderation": null, "rate_limit": null, "scim_group_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e", "scim_group_mapping_id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f", "workspace_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + deleteScimGroupPolicyOptOut: + speakeasy-default-delete-scim-group-policy-opt-out: + parameters: + path: + mapping_id: "104dbbf4-a30b-427e-8207-76203c3fadc5" + query: + user_id: "" + policy_type: "rate_limit" + responses: + "200": + application/json: {"deleted": true} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + listScimGroupPolicyOptOuts: + speakeasy-default-list-scim-group-policy-opt-outs: + parameters: + path: + mapping_id: "732784db-8051-4b40-9258-0ffc259c47ec" + responses: + "200": + application/json: {"data": []} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "409": + application/json: {"error": {"code": 409, "message": "Resource conflict. Please try again later."}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 releaseNotes: | ## Python SDK Changes: - * `open_router.generations.get_generation()`: `response.data.api_type.enum(realtime)` **Added** + * `open_router.guardrail_policies.list_scim_group_policy_assignments()`: **Added** + * `open_router.guardrail_policies.get_scim_group_policy_assignment()`: **Added** + * `open_router.guardrail_policies.update_scim_group_policy_assignment()`: **Added** + * `open_router.guardrail_policies.delete_scim_group_policy_opt_out()`: **Added** + * `open_router.guardrail_policies.list_scim_group_policy_opt_outs()`: **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 9292f9afe..b6456a599 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -37,7 +37,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.3.233 + version: 1.3.234 additionalDependencies: dev: pytest: '>=8.3' diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 3a31bf253..c77dca590 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -12883,6 +12883,14 @@ components: required: - 'deleted' type: 'object' + DeleteScimGroupOptOutResponse: + properties: + deleted: + const: true + type: 'boolean' + required: + - 'deleted' + type: 'object' DeleteScimOrganizationRoleMappingResponse: properties: deleted: @@ -19562,6 +19570,24 @@ components: - 'data' - 'total_count' type: 'object' + ListScimGroupOptOutsResponse: + properties: + data: + items: + $ref: '#/components/schemas/ScimGroupOptOut' + type: 'array' + required: + - 'data' + type: 'object' + ListScimGroupPolicyAssignmentsResponse: + properties: + data: + items: + $ref: '#/components/schemas/ScimGroupPolicyAssignment' + type: 'array' + required: + - 'data' + type: 'object' ListScimGroupsResponse: properties: data: @@ -34998,6 +35024,79 @@ components: - 'created_at' - 'updated_at' type: 'object' + ScimGroupOptOut: + properties: + policy_type: + enum: + - 'budget' + - 'model_availability' + - 'moderation' + - 'rate_limit' + type: 'string' + x-speakeasy-unknown-values: allow + user_id: + description: 'Member who opted out of the group policy.' + type: 'string' + required: + - 'user_id' + - 'policy_type' + type: 'object' + ScimGroupPolicyAssignment: + description: 'Guardrail policy attached to a SCIM group mapping for each policy type, or `null` when none. Members receive the group policy unless they have a manual assignment or opted out; when a member is in several mapped groups, the least restrictive policy of each type applies. `rate_limit` is `null` unless capacity policies are enabled for the account (Enterprise-only feature with a custom plan).' + example: + budget: '6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f' + model_availability: null + moderation: null + rate_limit: null + scim_group_id: '2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e' + scim_group_mapping_id: '3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f' + workspace_id: '1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d' + properties: + budget: + format: 'uuid' + type: + - 'string' + - 'null' + model_availability: + format: 'uuid' + type: + - 'string' + - 'null' + moderation: + format: 'uuid' + type: + - 'string' + - 'null' + rate_limit: + format: 'uuid' + type: + - 'string' + - 'null' + scim_group_id: + format: 'uuid' + type: 'string' + scim_group_mapping_id: + format: 'uuid' + type: 'string' + workspace_id: + format: 'uuid' + type: 'string' + required: + - 'scim_group_mapping_id' + - 'scim_group_id' + - 'workspace_id' + - 'budget' + - 'moderation' + - 'model_availability' + - 'rate_limit' + type: 'object' + ScimGroupPolicyAssignmentResponse: + properties: + data: + $ref: '#/components/schemas/ScimGroupPolicyAssignment' + required: + - 'data' + type: 'object' ScimOrganizationRoleMapping: example: created_at: '2025-08-24T10:30:00.000Z' @@ -40041,6 +40140,34 @@ components: required: - 'data' type: 'object' + UpdateScimGroupPolicyAssignmentRequest: + additionalProperties: false + description: 'Merges per policy type: a policy ID attaches that policy, `null` removes the type, and an omitted type is unchanged; an unknown type is rejected. Every type is validated before any is written.' + example: + budget: '6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f' + moderation: null + properties: + budget: + format: 'uuid' + type: + - 'string' + - 'null' + model_availability: + format: 'uuid' + type: + - 'string' + - 'null' + moderation: + format: 'uuid' + type: + - 'string' + - 'null' + rate_limit: + format: 'uuid' + type: + - 'string' + - 'null' + type: 'object' UpdateWorkspaceRequest: example: name: 'Updated Workspace' @@ -52091,6 +52218,438 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/assignments/scim-groups: + get: + description: 'List the guardrail policies attached to each SCIM group mapping in the organization. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'listScimGroupPolicyAssignments' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListScimGroupPolicyAssignmentsResponse' + description: 'Policy assignments for every SCIM group mapping' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'List SCIM group policy assignments' + tags: + - 'Guardrail Policies' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/assignments/scim-groups/{mapping_id}: + get: + description: 'Get the guardrail policies attached to one SCIM group mapping. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'getScimGroupPolicyAssignment' + parameters: + - in: 'path' + name: 'mapping_id' + required: true + schema: + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ScimGroupPolicyAssignmentResponse' + description: 'Policy assignment for the SCIM group mapping' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Get a SCIM group policy assignment' + tags: + - 'Guardrail Policies' + patch: + description: 'Attach or remove guardrail policies on one SCIM group mapping, then update its members'' policies. Every type in the request is applied, or none is. Requires `scim:view`, `guardrails:view` and `guardrails:update`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'updateScimGroupPolicyAssignment' + parameters: + - in: 'path' + name: 'mapping_id' + required: true + schema: + format: 'uuid' + type: 'string' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateScimGroupPolicyAssignmentRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ScimGroupPolicyAssignmentResponse' + description: 'Updated policy assignment' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Update a SCIM group policy assignment' + tags: + - 'Guardrail Policies' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" + /guardrails/policies/assignments/scim-groups/{mapping_id}/opt-outs: + delete: + description: 'Remove a member''s opt-out for one policy type, so the member receives their groups'' policy again right away. The member must be in the mapping''s group and the mapping must set a policy of that type. Requires `scim:view`, `guardrails:view` and `guardrails:update`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'deleteScimGroupPolicyOptOut' + parameters: + - in: 'path' + name: 'mapping_id' + required: true + schema: + format: 'uuid' + type: 'string' + - in: 'query' + name: 'user_id' + required: true + schema: + maxLength: 255 + minLength: 1 + type: 'string' + - in: 'query' + name: 'policy_type' + required: true + schema: + enum: + - 'budget' + - 'model_availability' + - 'moderation' + - 'rate_limit' + type: 'string' + x-speakeasy-unknown-values: allow + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteScimGroupOptOutResponse' + description: 'Opt-out removed' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'Restore a member to a SCIM group policy' + tags: + - 'Guardrail Policies' + get: + description: 'List the group''s members who opted out of a guardrail policy this mapping sets, per policy type. Opted-out members keep their own assignment (or none) instead of the group policy. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required.' + operationId: 'listScimGroupPolicyOptOuts' + parameters: + - in: 'path' + name: 'mapping_id' + required: true + schema: + format: 'uuid' + type: 'string' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListScimGroupOptOutsResponse' + description: 'Opt-outs from the group policies' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '409': + content: + application/json: + example: + error: + code: 409 + message: 'Resource conflict. Please try again later.' + schema: + $ref: '#/components/schemas/ConflictResponse' + description: 'Conflict - Resource conflict or concurrent modification' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + summary: 'List opt-outs from a SCIM group policy assignment' + tags: + - 'Guardrail Policies' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /guardrails/policies/budget: get: description: 'List the budget policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d9badbc7d..216167230 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:ff1967befb35f1852d128504f53c73717a25f1f72a8bca2c4af3407079bcdb5b - sourceBlobDigest: sha256:8f46082f680436e22c3d6676f135812a4904c36f1e577fa5e06bca3ec2439c79 + sourceRevisionDigest: sha256:2a127dbf4ae3f98225ab580e0e1d8af2dd08ee19886e1b577db5efc54b47caca + sourceBlobDigest: sha256:28244438bfe9cce279f0c869625a6d06f59c5889302295ed55dabaa85b75cf8c tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:ff1967befb35f1852d128504f53c73717a25f1f72a8bca2c4af3407079bcdb5b - sourceBlobDigest: sha256:8f46082f680436e22c3d6676f135812a4904c36f1e577fa5e06bca3ec2439c79 + sourceRevisionDigest: sha256:2a127dbf4ae3f98225ab580e0e1d8af2dd08ee19886e1b577db5efc54b47caca + sourceBlobDigest: sha256:28244438bfe9cce279f0c869625a6d06f59c5889302295ed55dabaa85b75cf8c codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:6fbc777d0af2d75ae1e4b71b9e6f5ee68be4cd8fc58329c566140822d6ba48bf + codeSamplesRevisionDigest: sha256:98ca949c625855362450336fe93267d9ed4b17c4d33627f2e4e53e13b40ad21b workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index df3d7af7c..c0a591a86 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -5099,4 +5099,14 @@ Based on: ### Generated - [python v1.3.233] . ### Releases -- [PyPI v1.3.233] https://pypi.org/project/openrouter/1.3.233 - . \ No newline at end of file +- [PyPI v1.3.233] https://pypi.org/project/openrouter/1.3.233 - . + +## 2026-12-03 00:43:20 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.3.234] . +### Releases +- [PyPI v1.3.234] https://pypi.org/project/openrouter/1.3.234 - . \ No newline at end of file diff --git a/docs/components/deletescimgroupoptoutresponse.mdx b/docs/components/deletescimgroupoptoutresponse.mdx new file mode 100644 index 000000000..ad33409df --- /dev/null +++ b/docs/components/deletescimgroupoptoutresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "DeleteScimGroupOptOutResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `deleted` | *Literal[True]* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/listscimgroupoptoutsresponse.mdx b/docs/components/listscimgroupoptoutsresponse.mdx new file mode 100644 index 000000000..3af7b8a1a --- /dev/null +++ b/docs/components/listscimgroupoptoutsresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ListScimGroupOptOutsResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `data` | List[[components.ScimGroupOptOut](../components/scimgroupoptout.mdx)] | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/listscimgrouppolicyassignmentsresponse.mdx b/docs/components/listscimgrouppolicyassignmentsresponse.mdx new file mode 100644 index 000000000..361869a01 --- /dev/null +++ b/docs/components/listscimgrouppolicyassignmentsresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ListScimGroupPolicyAssignmentsResponse" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `data` | List[[components.ScimGroupPolicyAssignment](../components/scimgrouppolicyassignment.mdx)] | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/scimgroupoptout.mdx b/docs/components/scimgroupoptout.mdx new file mode 100644 index 000000000..c460da749 --- /dev/null +++ b/docs/components/scimgroupoptout.mdx @@ -0,0 +1,10 @@ +--- +title: "ScimGroupOptOut" +--- + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `policy_type` | [components.ScimGroupOptOutPolicyType](../components/scimgroupoptoutpolicytype.mdx) | ✔️ | N/A | +| `user_id` | *str* | ✔️ | Member who opted out of the group policy. | \ No newline at end of file diff --git a/docs/components/scimgroupoptoutpolicytype.mdx b/docs/components/scimgroupoptoutpolicytype.mdx new file mode 100644 index 000000000..7bdd0f212 --- /dev/null +++ b/docs/components/scimgroupoptoutpolicytype.mdx @@ -0,0 +1,22 @@ +--- +title: "ScimGroupOptOutPolicyType" +--- + +## Example Usage + +```python +from openrouter.components import ScimGroupOptOutPolicyType + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: ScimGroupOptOutPolicyType = "budget" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"budget"` +- `"model_availability"` +- `"moderation"` +- `"rate_limit"` diff --git a/docs/components/scimgrouppolicyassignment.mdx b/docs/components/scimgrouppolicyassignment.mdx new file mode 100644 index 000000000..23cd1b15d --- /dev/null +++ b/docs/components/scimgrouppolicyassignment.mdx @@ -0,0 +1,18 @@ +--- +title: "ScimGroupPolicyAssignment" +--- + +Guardrail policy attached to a SCIM group mapping for each policy type, or `null` when none. Members receive the group policy unless they have a manual assignment or opted out; when a member is in several mapped groups, the least restrictive policy of each type applies. `rate_limit` is `null` unless capacity policies are enabled for the account (Enterprise-only feature with a custom plan). + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `budget` | *Nullable[str]* | ✔️ | N/A | +| `model_availability` | *Nullable[str]* | ✔️ | N/A | +| `moderation` | *Nullable[str]* | ✔️ | N/A | +| `rate_limit` | *Nullable[str]* | ✔️ | N/A | +| `scim_group_id` | *str* | ✔️ | N/A | +| `scim_group_mapping_id` | *str* | ✔️ | N/A | +| `workspace_id` | *str* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/components/scimgrouppolicyassignmentresponse.mdx b/docs/components/scimgrouppolicyassignmentresponse.mdx new file mode 100644 index 000000000..7e5b5a216 --- /dev/null +++ b/docs/components/scimgrouppolicyassignmentresponse.mdx @@ -0,0 +1,9 @@ +--- +title: "ScimGroupPolicyAssignmentResponse" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.ScimGroupPolicyAssignment](../components/scimgrouppolicyassignment.mdx) | ✔️ | Guardrail policy attached to a SCIM group mapping for each policy type, or `null` when none. Members receive the group policy unless they have a manual assignment or opted out; when a member is in several mapped groups, the least restrictive policy of each type applies. `rate_limit` is `null` unless capacity policies are enabled for the account (Enterprise-only feature with a custom plan). | \{
"budget": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
"model_availability": null,
"moderation": null,
"rate_limit": null,
"scim_group_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"scim_group_mapping_id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
"workspace_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
} | \ No newline at end of file diff --git a/docs/components/updatescimgrouppolicyassignmentrequest.mdx b/docs/components/updatescimgrouppolicyassignmentrequest.mdx new file mode 100644 index 000000000..734dc377a --- /dev/null +++ b/docs/components/updatescimgrouppolicyassignmentrequest.mdx @@ -0,0 +1,15 @@ +--- +title: "UpdateScimGroupPolicyAssignmentRequest" +--- + +Merges per policy type: a policy ID attaches that policy, `null` removes the type, and an omitted type is unchanged; an unknown type is rejected. Every type is validated before any is written. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `budget` | *OptionalNullable[str]* | ➖ | N/A | +| `model_availability` | *OptionalNullable[str]* | ➖ | N/A | +| `moderation` | *OptionalNullable[str]* | ➖ | N/A | +| `rate_limit` | *OptionalNullable[str]* | ➖ | N/A | \ No newline at end of file diff --git a/docs/operations/deletescimgrouppolicyoptoutglobals.mdx b/docs/operations/deletescimgrouppolicyoptoutglobals.mdx new file mode 100644 index 000000000..87a4da403 --- /dev/null +++ b/docs/operations/deletescimgrouppolicyoptoutglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "DeleteScimGroupPolicyOptOutGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/deletescimgrouppolicyoptoutpolicytype.mdx b/docs/operations/deletescimgrouppolicyoptoutpolicytype.mdx new file mode 100644 index 000000000..fb3be7015 --- /dev/null +++ b/docs/operations/deletescimgrouppolicyoptoutpolicytype.mdx @@ -0,0 +1,22 @@ +--- +title: "DeleteScimGroupPolicyOptOutPolicyType" +--- + +## Example Usage + +```python +from openrouter.operations import DeleteScimGroupPolicyOptOutPolicyType + +# Open enum: unrecognized values are captured as UnrecognizedStr +value: DeleteScimGroupPolicyOptOutPolicyType = "budget" +``` + + +## Values + +This is an open enum. Unrecognized values will not fail type checks. + +- `"budget"` +- `"model_availability"` +- `"moderation"` +- `"rate_limit"` diff --git a/docs/operations/deletescimgrouppolicyoptoutrequest.mdx b/docs/operations/deletescimgrouppolicyoptoutrequest.mdx new file mode 100644 index 000000000..4cefc7ffb --- /dev/null +++ b/docs/operations/deletescimgrouppolicyoptoutrequest.mdx @@ -0,0 +1,14 @@ +--- +title: "DeleteScimGroupPolicyOptOutRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `mapping_id` | *str* | ✔️ | N/A | +| `user_id` | *str* | ✔️ | N/A | +| `policy_type` | [operations.DeleteScimGroupPolicyOptOutPolicyType](../operations/deletescimgrouppolicyoptoutpolicytype.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/getscimgrouppolicyassignmentglobals.mdx b/docs/operations/getscimgrouppolicyassignmentglobals.mdx new file mode 100644 index 000000000..c89763a8f --- /dev/null +++ b/docs/operations/getscimgrouppolicyassignmentglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "GetScimGroupPolicyAssignmentGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/getscimgrouppolicyassignmentrequest.mdx b/docs/operations/getscimgrouppolicyassignmentrequest.mdx new file mode 100644 index 000000000..73eb941ce --- /dev/null +++ b/docs/operations/getscimgrouppolicyassignmentrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "GetScimGroupPolicyAssignmentRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `mapping_id` | *str* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/listscimgrouppolicyassignmentsglobals.mdx b/docs/operations/listscimgrouppolicyassignmentsglobals.mdx new file mode 100644 index 000000000..ca4ae13b9 --- /dev/null +++ b/docs/operations/listscimgrouppolicyassignmentsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListScimGroupPolicyAssignmentsGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/listscimgrouppolicyassignmentsrequest.mdx b/docs/operations/listscimgrouppolicyassignmentsrequest.mdx new file mode 100644 index 000000000..73d6d4d1c --- /dev/null +++ b/docs/operations/listscimgrouppolicyassignmentsrequest.mdx @@ -0,0 +1,11 @@ +--- +title: "ListScimGroupPolicyAssignmentsRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/listscimgrouppolicyoptoutsglobals.mdx b/docs/operations/listscimgrouppolicyoptoutsglobals.mdx new file mode 100644 index 000000000..8532ed58b --- /dev/null +++ b/docs/operations/listscimgrouppolicyoptoutsglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "ListScimGroupPolicyOptOutsGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/listscimgrouppolicyoptoutsrequest.mdx b/docs/operations/listscimgrouppolicyoptoutsrequest.mdx new file mode 100644 index 000000000..fc4a1e862 --- /dev/null +++ b/docs/operations/listscimgrouppolicyoptoutsrequest.mdx @@ -0,0 +1,12 @@ +--- +title: "ListScimGroupPolicyOptOutsRequest" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `mapping_id` | *str* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/operations/updatescimgrouppolicyassignmentglobals.mdx b/docs/operations/updatescimgrouppolicyassignmentglobals.mdx new file mode 100644 index 000000000..78c66eae7 --- /dev/null +++ b/docs/operations/updatescimgrouppolicyassignmentglobals.mdx @@ -0,0 +1,11 @@ +--- +title: "UpdateScimGroupPolicyAssignmentGlobals" +--- + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/operations/updatescimgrouppolicyassignmentrequest.mdx b/docs/operations/updatescimgrouppolicyassignmentrequest.mdx new file mode 100644 index 000000000..6be96ee1f --- /dev/null +++ b/docs/operations/updatescimgrouppolicyassignmentrequest.mdx @@ -0,0 +1,13 @@ +--- +title: "UpdateScimGroupPolicyAssignmentRequest" +--- + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | +| `mapping_id` | *str* | ✔️ | N/A | | +| `update_scim_group_policy_assignment_request` | [components.UpdateScimGroupPolicyAssignmentRequest](../components/updatescimgrouppolicyassignmentrequest.mdx) | ✔️ | N/A | \{
"budget": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
"moderation": null
} | \ No newline at end of file diff --git a/docs/sdks/guardrailpolicies/README.mdx b/docs/sdks/guardrailpolicies/README.mdx index 04af1956a..fca09f04a 100644 --- a/docs/sdks/guardrailpolicies/README.mdx +++ b/docs/sdks/guardrailpolicies/README.mdx @@ -17,6 +17,11 @@ Guardrail Policies endpoints * [change_api_key_policy_assignment](#change_api_key_policy_assignment) - Change an API key policy assignment * [get_member_policy_assignment](#get_member_policy_assignment) - Get a member policy assignment * [change_member_policy_assignment](#change_member_policy_assignment) - Change a member policy assignment +* [list_scim_group_policy_assignments](#list_scim_group_policy_assignments) - List SCIM group policy assignments +* [get_scim_group_policy_assignment](#get_scim_group_policy_assignment) - Get a SCIM group policy assignment +* [update_scim_group_policy_assignment](#update_scim_group_policy_assignment) - Update a SCIM group policy assignment +* [delete_scim_group_policy_opt_out](#delete_scim_group_policy_opt_out) - Restore a member to a SCIM group policy +* [list_scim_group_policy_opt_outs](#list_scim_group_policy_opt_outs) - List opt-outs from a SCIM group policy assignment * [list_budget_policies](#list_budget_policies) - List budget policies * [create_budget_policy](#create_budget_policy) - Create a budget policy * [delete_budget_policy](#delete_budget_policy) - Delete a budget policy @@ -484,6 +489,266 @@ with OpenRouter( | errors.InternalServerResponseError | 500 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | +## list_scim_group_policy_assignments + +List the guardrail policies attached to each SCIM group mapping in the organization. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.list_scim_group_policy_assignments() + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | + +### Response + +**[components.ListScimGroupPolicyAssignmentsResponse](../../components/listscimgrouppolicyassignmentsresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## get_scim_group_policy_assignment + +Get the guardrail policies attached to one SCIM group mapping. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.get_scim_group_policy_assignment(mapping_id="af65e842-2eb2-4feb-bc51-929aca5a7147") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `mapping_id` | *str* | ✔️ | N/A | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | + +### Response + +**[components.ScimGroupPolicyAssignmentResponse](../../components/scimgrouppolicyassignmentresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## update_scim_group_policy_assignment + +Attach or remove guardrail policies on one SCIM group mapping, then update its members' policies. Every type in the request is applied, or none is. Requires `scim:view`, `guardrails:view` and `guardrails:update`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.update_scim_group_policy_assignment(mapping_id="10d15a71-fe5b-43e7-a9cc-284d994de944") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `mapping_id` | *str* | ✔️ | N/A | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `budget` | *OptionalNullable[str]* | ➖ | N/A | +| `model_availability` | *OptionalNullable[str]* | ➖ | N/A | +| `moderation` | *OptionalNullable[str]* | ➖ | N/A | +| `rate_limit` | *OptionalNullable[str]* | ➖ | N/A | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | + +### Response + +**[components.ScimGroupPolicyAssignmentResponse](../../components/scimgrouppolicyassignmentresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## delete_scim_group_policy_opt_out + +Remove a member's opt-out for one policy type, so the member receives their groups' policy again right away. The member must be in the mapping's group and the mapping must set a policy of that type. Requires `scim:view`, `guardrails:view` and `guardrails:update`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.delete_scim_group_policy_opt_out(mapping_id="104dbbf4-a30b-427e-8207-76203c3fadc5", user_id="", policy_type="rate_limit") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `mapping_id` | *str* | ✔️ | N/A | +| `user_id` | *str* | ✔️ | N/A | +| `policy_type` | [operations.DeleteScimGroupPolicyOptOutPolicyType](../../operations/deletescimgrouppolicyoptoutpolicytype.mdx) | ✔️ | N/A | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | + +### Response + +**[components.DeleteScimGroupOptOutResponse](../../components/deletescimgroupoptoutresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## list_scim_group_policy_opt_outs + +List the group's members who opted out of a guardrail policy this mapping sets, per policy type. Opted-out members keep their own assignment (or none) instead of the group policy. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + +### Example Usage + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + http_referer="", + x_open_router_title="", + x_open_router_categories="", + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.guardrail_policies.list_scim_group_policy_opt_outs(mapping_id="732784db-8051-4b40-9258-0ffc259c47ec") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `mapping_id` | *str* | ✔️ | N/A | +| `http_referer` | *Optional[str]* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `x_open_router_title` | *Optional[str]* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `x_open_router_categories` | *Optional[str]* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | ➖ | Configuration to override the default retry behavior of the client. | + +### Response + +**[components.ListScimGroupOptOutsResponse](../../components/listscimgroupoptoutsresponse.mdx)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.ConflictResponseError | 409 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + ## list_budget_policies List the budget policies in a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. diff --git a/pyproject.toml b/pyproject.toml index dc814ab51..c40b71312 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.3.233" +version = "1.3.234" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index b79bd4ef1..7d7fcb4d1 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.3.233" +__version__: str = "1.3.234" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.950.13" -__user_agent__: str = "speakeasy-sdk/python 1.3.233 2.950.13 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.3.234 2.950.13 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 99a867e98..7348dedb3 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -1919,6 +1919,10 @@ DeleteScimGroupMappingResponse, DeleteScimGroupMappingResponseTypedDict, ) + from .deletescimgroupoptoutresponse import ( + DeleteScimGroupOptOutResponse, + DeleteScimGroupOptOutResponseTypedDict, + ) from .deletescimorganizationrolemappingresponse import ( DeleteScimOrganizationRoleMappingResponse, DeleteScimOrganizationRoleMappingResponseTypedDict, @@ -2822,6 +2826,14 @@ ListScimGroupMappingsResponse, ListScimGroupMappingsResponseTypedDict, ) + from .listscimgroupoptoutsresponse import ( + ListScimGroupOptOutsResponse, + ListScimGroupOptOutsResponseTypedDict, + ) + from .listscimgrouppolicyassignmentsresponse import ( + ListScimGroupPolicyAssignmentsResponse, + ListScimGroupPolicyAssignmentsResponseTypedDict, + ) from .listscimgroupsresponse import ( ListScimGroupsResponse, ListScimGroupsResponseTypedDict, @@ -4613,6 +4625,19 @@ ScimGroupMappingRole, ScimGroupMappingTypedDict, ) + from .scimgroupoptout import ( + ScimGroupOptOut, + ScimGroupOptOutPolicyType, + ScimGroupOptOutTypedDict, + ) + from .scimgrouppolicyassignment import ( + ScimGroupPolicyAssignment, + ScimGroupPolicyAssignmentTypedDict, + ) + from .scimgrouppolicyassignmentresponse import ( + ScimGroupPolicyAssignmentResponse, + ScimGroupPolicyAssignmentResponseTypedDict, + ) from .scimorganizationrolemapping import ( ScimOrganizationRoleMapping, ScimOrganizationRoleMappingRole, @@ -5208,6 +5233,10 @@ UpdateScimGroupMappingResponse, UpdateScimGroupMappingResponseTypedDict, ) + from .updatescimgrouppolicyassignmentrequest import ( + UpdateScimGroupPolicyAssignmentRequest, + UpdateScimGroupPolicyAssignmentRequestTypedDict, + ) from .updateworkspacerequest import ( UpdateWorkspaceRequest, UpdateWorkspaceRequestDisabledServerTool, @@ -6733,6 +6762,8 @@ "DeletePrivateEndpointResponseTypedDict", "DeleteScimGroupMappingResponse", "DeleteScimGroupMappingResponseTypedDict", + "DeleteScimGroupOptOutResponse", + "DeleteScimGroupOptOutResponseTypedDict", "DeleteScimOrganizationRoleMappingResponse", "DeleteScimOrganizationRoleMappingResponseTypedDict", "DeleteWorkspaceBudgetResponse", @@ -7432,6 +7463,10 @@ "ListPrivateEndpointsResponseTypedDict", "ListScimGroupMappingsResponse", "ListScimGroupMappingsResponseTypedDict", + "ListScimGroupOptOutsResponse", + "ListScimGroupOptOutsResponseTypedDict", + "ListScimGroupPolicyAssignmentsResponse", + "ListScimGroupPolicyAssignmentsResponseTypedDict", "ListScimGroupsResponse", "ListScimGroupsResponseTypedDict", "ListScimOrganizationRoleMappingsResponse", @@ -8717,6 +8752,13 @@ "ScimGroupMapping", "ScimGroupMappingRole", "ScimGroupMappingTypedDict", + "ScimGroupOptOut", + "ScimGroupOptOutPolicyType", + "ScimGroupOptOutTypedDict", + "ScimGroupPolicyAssignment", + "ScimGroupPolicyAssignmentResponse", + "ScimGroupPolicyAssignmentResponseTypedDict", + "ScimGroupPolicyAssignmentTypedDict", "ScimGroupTypedDict", "ScimOrganizationRoleMapping", "ScimOrganizationRoleMappingRole", @@ -9289,6 +9331,8 @@ "UpdateScimGroupMappingRequestTypedDict", "UpdateScimGroupMappingResponse", "UpdateScimGroupMappingResponseTypedDict", + "UpdateScimGroupPolicyAssignmentRequest", + "UpdateScimGroupPolicyAssignmentRequestTypedDict", "UpdateWorkspaceRequest", "UpdateWorkspaceRequestDisabledServerTool", "UpdateWorkspaceRequestTypedDict", @@ -10783,6 +10827,8 @@ "DeletePrivateEndpointResponseTypedDict": ".deleteprivateendpointresponse", "DeleteScimGroupMappingResponse": ".deletescimgroupmappingresponse", "DeleteScimGroupMappingResponseTypedDict": ".deletescimgroupmappingresponse", + "DeleteScimGroupOptOutResponse": ".deletescimgroupoptoutresponse", + "DeleteScimGroupOptOutResponseTypedDict": ".deletescimgroupoptoutresponse", "DeleteScimOrganizationRoleMappingResponse": ".deletescimorganizationrolemappingresponse", "DeleteScimOrganizationRoleMappingResponseTypedDict": ".deletescimorganizationrolemappingresponse", "DeleteWorkspaceBudgetResponse": ".deleteworkspacebudgetresponse", @@ -11456,6 +11502,10 @@ "ListPrivateEndpointsResponseTypedDict": ".listprivateendpointsresponse", "ListScimGroupMappingsResponse": ".listscimgroupmappingsresponse", "ListScimGroupMappingsResponseTypedDict": ".listscimgroupmappingsresponse", + "ListScimGroupOptOutsResponse": ".listscimgroupoptoutsresponse", + "ListScimGroupOptOutsResponseTypedDict": ".listscimgroupoptoutsresponse", + "ListScimGroupPolicyAssignmentsResponse": ".listscimgrouppolicyassignmentsresponse", + "ListScimGroupPolicyAssignmentsResponseTypedDict": ".listscimgrouppolicyassignmentsresponse", "ListScimGroupsResponse": ".listscimgroupsresponse", "ListScimGroupsResponseTypedDict": ".listscimgroupsresponse", "ListScimOrganizationRoleMappingsResponse": ".listscimorganizationrolemappingsresponse", @@ -12836,6 +12886,13 @@ "ScimGroupMapping": ".scimgroupmapping", "ScimGroupMappingRole": ".scimgroupmapping", "ScimGroupMappingTypedDict": ".scimgroupmapping", + "ScimGroupOptOut": ".scimgroupoptout", + "ScimGroupOptOutPolicyType": ".scimgroupoptout", + "ScimGroupOptOutTypedDict": ".scimgroupoptout", + "ScimGroupPolicyAssignment": ".scimgrouppolicyassignment", + "ScimGroupPolicyAssignmentTypedDict": ".scimgrouppolicyassignment", + "ScimGroupPolicyAssignmentResponse": ".scimgrouppolicyassignmentresponse", + "ScimGroupPolicyAssignmentResponseTypedDict": ".scimgrouppolicyassignmentresponse", "ScimOrganizationRoleMapping": ".scimorganizationrolemapping", "ScimOrganizationRoleMappingRole": ".scimorganizationrolemapping", "ScimOrganizationRoleMappingTypedDict": ".scimorganizationrolemapping", @@ -13267,6 +13324,8 @@ "UpdateScimGroupMappingRequestTypedDict": ".updatescimgroupmappingrequest", "UpdateScimGroupMappingResponse": ".updatescimgroupmappingresponse", "UpdateScimGroupMappingResponseTypedDict": ".updatescimgroupmappingresponse", + "UpdateScimGroupPolicyAssignmentRequest": ".updatescimgrouppolicyassignmentrequest", + "UpdateScimGroupPolicyAssignmentRequestTypedDict": ".updatescimgrouppolicyassignmentrequest", "UpdateWorkspaceRequest": ".updateworkspacerequest", "UpdateWorkspaceRequestDisabledServerTool": ".updateworkspacerequest", "UpdateWorkspaceRequestTypedDict": ".updateworkspacerequest", diff --git a/src/openrouter/components/deletescimgroupoptoutresponse.py b/src/openrouter/components/deletescimgroupoptoutresponse.py new file mode 100644 index 000000000..0e3fdbc07 --- /dev/null +++ b/src/openrouter/components/deletescimgroupoptoutresponse.py @@ -0,0 +1,26 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from openrouter.utils import validate_const +import pydantic +from pydantic.functional_validators import AfterValidator +from typing import Literal +from typing_extensions import Annotated, TypedDict + + +class DeleteScimGroupOptOutResponseTypedDict(TypedDict): + deleted: Literal[True] + + +class DeleteScimGroupOptOutResponse(BaseModel): + DELETED: Annotated[ + Annotated[Literal[True], AfterValidator(validate_const(True))], + pydantic.Field(alias="deleted"), + ] = True + + +try: + DeleteScimGroupOptOutResponse.model_rebuild() +except NameError: + pass diff --git a/src/openrouter/components/listscimgroupoptoutsresponse.py b/src/openrouter/components/listscimgroupoptoutsresponse.py new file mode 100644 index 000000000..4ff088261 --- /dev/null +++ b/src/openrouter/components/listscimgroupoptoutsresponse.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .scimgroupoptout import ScimGroupOptOut, ScimGroupOptOutTypedDict +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class ListScimGroupOptOutsResponseTypedDict(TypedDict): + data: List[ScimGroupOptOutTypedDict] + + +class ListScimGroupOptOutsResponse(BaseModel): + data: List[ScimGroupOptOut] diff --git a/src/openrouter/components/listscimgrouppolicyassignmentsresponse.py b/src/openrouter/components/listscimgrouppolicyassignmentsresponse.py new file mode 100644 index 000000000..2cdd2fbe7 --- /dev/null +++ b/src/openrouter/components/listscimgrouppolicyassignmentsresponse.py @@ -0,0 +1,18 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .scimgrouppolicyassignment import ( + ScimGroupPolicyAssignment, + ScimGroupPolicyAssignmentTypedDict, +) +from openrouter.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class ListScimGroupPolicyAssignmentsResponseTypedDict(TypedDict): + data: List[ScimGroupPolicyAssignmentTypedDict] + + +class ListScimGroupPolicyAssignmentsResponse(BaseModel): + data: List[ScimGroupPolicyAssignment] diff --git a/src/openrouter/components/scimgroupoptout.py b/src/openrouter/components/scimgroupoptout.py new file mode 100644 index 000000000..7666d4d04 --- /dev/null +++ b/src/openrouter/components/scimgroupoptout.py @@ -0,0 +1,30 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UnrecognizedStr +from typing import Literal, Union +from typing_extensions import TypedDict + + +ScimGroupOptOutPolicyType = Union[ + Literal[ + "budget", + "model_availability", + "moderation", + "rate_limit", + ], + UnrecognizedStr, +] + + +class ScimGroupOptOutTypedDict(TypedDict): + policy_type: ScimGroupOptOutPolicyType + user_id: str + r"""Member who opted out of the group policy.""" + + +class ScimGroupOptOut(BaseModel): + policy_type: ScimGroupOptOutPolicyType + + user_id: str + r"""Member who opted out of the group policy.""" diff --git a/src/openrouter/components/scimgrouppolicyassignment.py b/src/openrouter/components/scimgrouppolicyassignment.py new file mode 100644 index 000000000..d50a94705 --- /dev/null +++ b/src/openrouter/components/scimgrouppolicyassignment.py @@ -0,0 +1,50 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer +from typing_extensions import TypedDict + + +class ScimGroupPolicyAssignmentTypedDict(TypedDict): + r"""Guardrail policy attached to a SCIM group mapping for each policy type, or `null` when none. Members receive the group policy unless they have a manual assignment or opted out; when a member is in several mapped groups, the least restrictive policy of each type applies. `rate_limit` is `null` unless capacity policies are enabled for the account (Enterprise-only feature with a custom plan).""" + + budget: Nullable[str] + model_availability: Nullable[str] + moderation: Nullable[str] + rate_limit: Nullable[str] + scim_group_id: str + scim_group_mapping_id: str + workspace_id: str + + +class ScimGroupPolicyAssignment(BaseModel): + r"""Guardrail policy attached to a SCIM group mapping for each policy type, or `null` when none. Members receive the group policy unless they have a manual assignment or opted out; when a member is in several mapped groups, the least restrictive policy of each type applies. `rate_limit` is `null` unless capacity policies are enabled for the account (Enterprise-only feature with a custom plan).""" + + budget: Nullable[str] + + model_availability: Nullable[str] + + moderation: Nullable[str] + + rate_limit: Nullable[str] + + scim_group_id: str + + scim_group_mapping_id: str + + workspace_id: str + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + 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: + m[k] = val + + return m diff --git a/src/openrouter/components/scimgrouppolicyassignmentresponse.py b/src/openrouter/components/scimgrouppolicyassignmentresponse.py new file mode 100644 index 000000000..9bf8bfc53 --- /dev/null +++ b/src/openrouter/components/scimgrouppolicyassignmentresponse.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .scimgrouppolicyassignment import ( + ScimGroupPolicyAssignment, + ScimGroupPolicyAssignmentTypedDict, +) +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class ScimGroupPolicyAssignmentResponseTypedDict(TypedDict): + data: ScimGroupPolicyAssignmentTypedDict + r"""Guardrail policy attached to a SCIM group mapping for each policy type, or `null` when none. Members receive the group policy unless they have a manual assignment or opted out; when a member is in several mapped groups, the least restrictive policy of each type applies. `rate_limit` is `null` unless capacity policies are enabled for the account (Enterprise-only feature with a custom plan).""" + + +class ScimGroupPolicyAssignmentResponse(BaseModel): + data: ScimGroupPolicyAssignment + r"""Guardrail policy attached to a SCIM group mapping for each policy type, or `null` when none. Members receive the group policy unless they have a manual assignment or opted out; when a member is in several mapped groups, the least restrictive policy of each type applies. `rate_limit` is `null` unless capacity policies are enabled for the account (Enterprise-only feature with a custom plan).""" diff --git a/src/openrouter/components/updatescimgrouppolicyassignmentrequest.py b/src/openrouter/components/updatescimgrouppolicyassignmentrequest.py new file mode 100644 index 000000000..dacce9792 --- /dev/null +++ b/src/openrouter/components/updatescimgrouppolicyassignmentrequest.py @@ -0,0 +1,62 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing_extensions import NotRequired, TypedDict + + +class UpdateScimGroupPolicyAssignmentRequestTypedDict(TypedDict): + r"""Merges per policy type: a policy ID attaches that policy, `null` removes the type, and an omitted type is unchanged; an unknown type is rejected. Every type is validated before any is written.""" + + budget: NotRequired[Nullable[str]] + model_availability: NotRequired[Nullable[str]] + moderation: NotRequired[Nullable[str]] + rate_limit: NotRequired[Nullable[str]] + + +class UpdateScimGroupPolicyAssignmentRequest(BaseModel): + r"""Merges per policy type: a policy ID attaches that policy, `null` removes the type, and an omitted type is unchanged; an unknown type is rejected. Every type is validated before any is written.""" + + budget: OptionalNullable[str] = UNSET + + model_availability: OptionalNullable[str] = UNSET + + moderation: OptionalNullable[str] = UNSET + + rate_limit: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["budget", "model_availability", "moderation", "rate_limit"] + ) + nullable_fields = set( + ["budget", "model_availability", "moderation", "rate_limit"] + ) + 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)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/src/openrouter/guardrail_policies.py b/src/openrouter/guardrail_policies.py index b2b812577..5d25f0c1d 100644 --- a/src/openrouter/guardrail_policies.py +++ b/src/openrouter/guardrail_policies.py @@ -2570,6 +2570,1504 @@ async def change_member_policy_assignment_async( raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + def list_scim_group_policy_assignments( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: 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, + ) -> components.ListScimGroupPolicyAssignmentsResponse: + r"""List SCIM group policy assignments + + List the guardrail policies attached to each SCIM group mapping in the organization. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 = operations.ListScimGroupPolicyAssignmentsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/assignments/scim-groups", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListScimGroupPolicyAssignmentsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + 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 + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listScimGroupPolicyAssignments", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ListScimGroupPolicyAssignmentsResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_scim_group_policy_assignments_async( + self, + *, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: 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, + ) -> components.ListScimGroupPolicyAssignmentsResponse: + r"""List SCIM group policy assignments + + List the guardrail policies attached to each SCIM group mapping in the organization. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 = operations.ListScimGroupPolicyAssignmentsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/assignments/scim-groups", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListScimGroupPolicyAssignmentsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + 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 + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listScimGroupPolicyAssignments", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ListScimGroupPolicyAssignmentsResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def get_scim_group_policy_assignment( + self, + *, + mapping_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: 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, + ) -> components.ScimGroupPolicyAssignmentResponse: + r"""Get a SCIM group policy assignment + + Get the guardrail policies attached to one SCIM group mapping. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param mapping_id: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 = operations.GetScimGroupPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + mapping_id=mapping_id, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/assignments/scim-groups/{mapping_id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetScimGroupPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + 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 + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getScimGroupPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ScimGroupPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def get_scim_group_policy_assignment_async( + self, + *, + mapping_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: 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, + ) -> components.ScimGroupPolicyAssignmentResponse: + r"""Get a SCIM group policy assignment + + Get the guardrail policies attached to one SCIM group mapping. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param mapping_id: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 = operations.GetScimGroupPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + mapping_id=mapping_id, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/assignments/scim-groups/{mapping_id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.GetScimGroupPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + 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 + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getScimGroupPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ScimGroupPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def update_scim_group_policy_assignment( + self, + *, + mapping_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + budget: OptionalNullable[str] = UNSET, + model_availability: OptionalNullable[str] = UNSET, + moderation: OptionalNullable[str] = UNSET, + rate_limit: OptionalNullable[str] = UNSET, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ScimGroupPolicyAssignmentResponse: + r"""Update a SCIM group policy assignment + + Attach or remove guardrail policies on one SCIM group mapping, then update its members' policies. Every type in the request is applied, or none is. Requires `scim:view`, `guardrails:view` and `guardrails:update`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param mapping_id: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param budget: + :param model_availability: + :param moderation: + :param rate_limit: + :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 = operations.UpdateScimGroupPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + mapping_id=mapping_id, + update_scim_group_policy_assignment_request=components.UpdateScimGroupPolicyAssignmentRequest( + budget=budget, + model_availability=model_availability, + moderation=moderation, + rate_limit=rate_limit, + ), + ) + + req = self._build_request( + method="PATCH", + path="/guardrails/policies/assignments/scim-groups/{mapping_id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateScimGroupPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.update_scim_group_policy_assignment_request, + False, + False, + "json", + components.UpdateScimGroupPolicyAssignmentRequest, + ), + 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 + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updateScimGroupPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ScimGroupPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def update_scim_group_policy_assignment_async( + self, + *, + mapping_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: Optional[str] = None, + budget: OptionalNullable[str] = UNSET, + model_availability: OptionalNullable[str] = UNSET, + moderation: OptionalNullable[str] = UNSET, + rate_limit: OptionalNullable[str] = UNSET, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> components.ScimGroupPolicyAssignmentResponse: + r"""Update a SCIM group policy assignment + + Attach or remove guardrail policies on one SCIM group mapping, then update its members' policies. Every type in the request is applied, or none is. Requires `scim:view`, `guardrails:view` and `guardrails:update`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param mapping_id: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :param budget: + :param model_availability: + :param moderation: + :param rate_limit: + :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 = operations.UpdateScimGroupPolicyAssignmentRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + mapping_id=mapping_id, + update_scim_group_policy_assignment_request=components.UpdateScimGroupPolicyAssignmentRequest( + budget=budget, + model_availability=model_availability, + moderation=moderation, + rate_limit=rate_limit, + ), + ) + + req = self._build_request_async( + method="PATCH", + path="/guardrails/policies/assignments/scim-groups/{mapping_id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.UpdateScimGroupPolicyAssignmentGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.update_scim_group_policy_assignment_request, + False, + False, + "json", + components.UpdateScimGroupPolicyAssignmentRequest, + ), + 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 + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updateScimGroupPolicyAssignment", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ScimGroupPolicyAssignmentResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def delete_scim_group_policy_opt_out( + self, + *, + mapping_id: str, + user_id: str, + policy_type: operations.DeleteScimGroupPolicyOptOutPolicyType, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: 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, + ) -> components.DeleteScimGroupOptOutResponse: + r"""Restore a member to a SCIM group policy + + Remove a member's opt-out for one policy type, so the member receives their groups' policy again right away. The member must be in the mapping's group and the mapping must set a policy of that type. Requires `scim:view`, `guardrails:view` and `guardrails:update`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param mapping_id: + :param user_id: + :param policy_type: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 = operations.DeleteScimGroupPolicyOptOutRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + mapping_id=mapping_id, + user_id=user_id, + policy_type=policy_type, + ) + + req = self._build_request( + method="DELETE", + path="/guardrails/policies/assignments/scim-groups/{mapping_id}/opt-outs", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteScimGroupPolicyOptOutGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + 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 + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteScimGroupPolicyOptOut", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.DeleteScimGroupOptOutResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def delete_scim_group_policy_opt_out_async( + self, + *, + mapping_id: str, + user_id: str, + policy_type: operations.DeleteScimGroupPolicyOptOutPolicyType, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: 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, + ) -> components.DeleteScimGroupOptOutResponse: + r"""Restore a member to a SCIM group policy + + Remove a member's opt-out for one policy type, so the member receives their groups' policy again right away. The member must be in the mapping's group and the mapping must set a policy of that type. Requires `scim:view`, `guardrails:view` and `guardrails:update`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param mapping_id: + :param user_id: + :param policy_type: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 = operations.DeleteScimGroupPolicyOptOutRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + mapping_id=mapping_id, + user_id=user_id, + policy_type=policy_type, + ) + + req = self._build_request_async( + method="DELETE", + path="/guardrails/policies/assignments/scim-groups/{mapping_id}/opt-outs", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.DeleteScimGroupPolicyOptOutGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + 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 + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteScimGroupPolicyOptOut", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.DeleteScimGroupOptOutResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + def list_scim_group_policy_opt_outs( + self, + *, + mapping_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: 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, + ) -> components.ListScimGroupOptOutsResponse: + r"""List opt-outs from a SCIM group policy assignment + + List the group's members who opted out of a guardrail policy this mapping sets, per policy type. Opted-out members keep their own assignment (or none) instead of the group policy. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param mapping_id: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 = operations.ListScimGroupPolicyOptOutsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + mapping_id=mapping_id, + ) + + req = self._build_request( + method="GET", + path="/guardrails/policies/assignments/scim-groups/{mapping_id}/opt-outs", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListScimGroupPolicyOptOutsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + 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 + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listScimGroupPolicyOptOuts", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ListScimGroupOptOutsResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + + async def list_scim_group_policy_opt_outs_async( + self, + *, + mapping_id: str, + http_referer: Optional[str] = None, + x_open_router_title: Optional[str] = None, + x_open_router_categories: 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, + ) -> components.ListScimGroupOptOutsResponse: + r"""List opt-outs from a SCIM group policy assignment + + List the group's members who opted out of a guardrail policy this mapping sets, per policy type. Opted-out members keep their own assignment (or none) instead of the group policy. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](/docs/guides/overview/auth/management-api-keys) required. + + :param mapping_id: + :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + :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 = operations.ListScimGroupPolicyOptOutsRequest( + http_referer=http_referer, + x_open_router_title=x_open_router_title, + x_open_router_categories=x_open_router_categories, + mapping_id=mapping_id, + ) + + req = self._build_request_async( + method="GET", + path="/guardrails/policies/assignments/scim-groups/{mapping_id}/opt-outs", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=operations.ListScimGroupPolicyOptOutsGlobals( + http_referer=self.sdk_configuration.globals.http_referer, + x_open_router_title=self.sdk_configuration.globals.x_open_router_title, + x_open_router_categories=self.sdk_configuration.globals.x_open_router_categories, + ), + security=self.sdk_configuration.security, + 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 + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listScimGroupPolicyOptOuts", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, components.Security + ), + tags=["Guardrail Policies"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + components.ListScimGroupOptOutsResponse, http_res + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = unmarshal_json_response( + errors.BadRequestResponseErrorData, http_res + ) + raise errors.BadRequestResponseError(response_data, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res + ) + raise errors.UnauthorizedResponseError(response_data, http_res) + if utils.match_response(http_res, "403", "application/json"): + response_data = unmarshal_json_response( + errors.ForbiddenResponseErrorData, http_res + ) + raise errors.ForbiddenResponseError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res + ) + raise errors.NotFoundResponseError(response_data, http_res) + if utils.match_response(http_res, "409", "application/json"): + response_data = unmarshal_json_response( + errors.ConflictResponseErrorData, http_res + ) + raise errors.ConflictResponseError(response_data, http_res) + if utils.match_response(http_res, "500", "application/json"): + response_data = unmarshal_json_response( + errors.InternalServerResponseErrorData, http_res + ) + raise errors.InternalServerResponseError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.OpenRouterDefaultError("Unexpected response received", http_res) + def list_budget_policies( self, *, diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index 96120c9d1..22931c7a8 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -449,6 +449,13 @@ KeepMembersEnum, KeepMembersTypedDict, ) + from .deletescimgrouppolicyoptout import ( + DeleteScimGroupPolicyOptOutGlobals, + DeleteScimGroupPolicyOptOutGlobalsTypedDict, + DeleteScimGroupPolicyOptOutPolicyType, + DeleteScimGroupPolicyOptOutRequest, + DeleteScimGroupPolicyOptOutRequestTypedDict, + ) from .deletescimorganizationrolemapping import ( DeleteScimOrganizationRoleMappingGlobals, DeleteScimOrganizationRoleMappingGlobalsTypedDict, @@ -739,6 +746,12 @@ GetScimGroupMappingRequest, GetScimGroupMappingRequestTypedDict, ) + from .getscimgrouppolicyassignment import ( + GetScimGroupPolicyAssignmentGlobals, + GetScimGroupPolicyAssignmentGlobalsTypedDict, + GetScimGroupPolicyAssignmentRequest, + GetScimGroupPolicyAssignmentRequestTypedDict, + ) from .getscimsyncjob import ( GetScimSyncJobGlobals, GetScimSyncJobGlobalsTypedDict, @@ -1099,6 +1112,18 @@ ListScimGroupMappingsResponse, ListScimGroupMappingsResponseTypedDict, ) + from .listscimgrouppolicyassignments import ( + ListScimGroupPolicyAssignmentsGlobals, + ListScimGroupPolicyAssignmentsGlobalsTypedDict, + ListScimGroupPolicyAssignmentsRequest, + ListScimGroupPolicyAssignmentsRequestTypedDict, + ) + from .listscimgrouppolicyoptouts import ( + ListScimGroupPolicyOptOutsGlobals, + ListScimGroupPolicyOptOutsGlobalsTypedDict, + ListScimGroupPolicyOptOutsRequest, + ListScimGroupPolicyOptOutsRequestTypedDict, + ) from .listscimgroups import ( ListScimGroupsGlobals, ListScimGroupsGlobalsTypedDict, @@ -1326,6 +1351,12 @@ UpdateScimGroupMappingRequest, UpdateScimGroupMappingRequestTypedDict, ) + from .updatescimgrouppolicyassignment import ( + UpdateScimGroupPolicyAssignmentGlobals, + UpdateScimGroupPolicyAssignmentGlobalsTypedDict, + UpdateScimGroupPolicyAssignmentRequest, + UpdateScimGroupPolicyAssignmentRequestTypedDict, + ) from .updateworkspace import ( UpdateWorkspaceGlobals, UpdateWorkspaceGlobalsTypedDict, @@ -1661,6 +1692,11 @@ "DeleteScimGroupMappingGlobalsTypedDict", "DeleteScimGroupMappingRequest", "DeleteScimGroupMappingRequestTypedDict", + "DeleteScimGroupPolicyOptOutGlobals", + "DeleteScimGroupPolicyOptOutGlobalsTypedDict", + "DeleteScimGroupPolicyOptOutPolicyType", + "DeleteScimGroupPolicyOptOutRequest", + "DeleteScimGroupPolicyOptOutRequestTypedDict", "DeleteScimOrganizationRoleMappingGlobals", "DeleteScimOrganizationRoleMappingGlobalsTypedDict", "DeleteScimOrganizationRoleMappingRequest", @@ -1868,6 +1904,10 @@ "GetScimGroupMappingGlobalsTypedDict", "GetScimGroupMappingRequest", "GetScimGroupMappingRequestTypedDict", + "GetScimGroupPolicyAssignmentGlobals", + "GetScimGroupPolicyAssignmentGlobalsTypedDict", + "GetScimGroupPolicyAssignmentRequest", + "GetScimGroupPolicyAssignmentRequestTypedDict", "GetScimSyncJobGlobals", "GetScimSyncJobGlobalsTypedDict", "GetScimSyncJobRequest", @@ -2141,6 +2181,14 @@ "ListScimGroupMappingsRequestTypedDict", "ListScimGroupMappingsResponse", "ListScimGroupMappingsResponseTypedDict", + "ListScimGroupPolicyAssignmentsGlobals", + "ListScimGroupPolicyAssignmentsGlobalsTypedDict", + "ListScimGroupPolicyAssignmentsRequest", + "ListScimGroupPolicyAssignmentsRequestTypedDict", + "ListScimGroupPolicyOptOutsGlobals", + "ListScimGroupPolicyOptOutsGlobalsTypedDict", + "ListScimGroupPolicyOptOutsRequest", + "ListScimGroupPolicyOptOutsRequestTypedDict", "ListScimGroupsGlobals", "ListScimGroupsGlobalsTypedDict", "ListScimGroupsRequest", @@ -2326,6 +2374,10 @@ "UpdateScimGroupMappingGlobalsTypedDict", "UpdateScimGroupMappingRequest", "UpdateScimGroupMappingRequestTypedDict", + "UpdateScimGroupPolicyAssignmentGlobals", + "UpdateScimGroupPolicyAssignmentGlobalsTypedDict", + "UpdateScimGroupPolicyAssignmentRequest", + "UpdateScimGroupPolicyAssignmentRequestTypedDict", "UpdateWorkspaceGlobals", "UpdateWorkspaceGlobalsTypedDict", "UpdateWorkspaceRequest", @@ -2678,6 +2730,11 @@ "KeepMembers": ".deletescimgroupmapping", "KeepMembersEnum": ".deletescimgroupmapping", "KeepMembersTypedDict": ".deletescimgroupmapping", + "DeleteScimGroupPolicyOptOutGlobals": ".deletescimgrouppolicyoptout", + "DeleteScimGroupPolicyOptOutGlobalsTypedDict": ".deletescimgrouppolicyoptout", + "DeleteScimGroupPolicyOptOutPolicyType": ".deletescimgrouppolicyoptout", + "DeleteScimGroupPolicyOptOutRequest": ".deletescimgrouppolicyoptout", + "DeleteScimGroupPolicyOptOutRequestTypedDict": ".deletescimgrouppolicyoptout", "DeleteScimOrganizationRoleMappingGlobals": ".deletescimorganizationrolemapping", "DeleteScimOrganizationRoleMappingGlobalsTypedDict": ".deletescimorganizationrolemapping", "DeleteScimOrganizationRoleMappingRequest": ".deletescimorganizationrolemapping", @@ -2892,6 +2949,10 @@ "GetScimGroupMappingGlobalsTypedDict": ".getscimgroupmapping", "GetScimGroupMappingRequest": ".getscimgroupmapping", "GetScimGroupMappingRequestTypedDict": ".getscimgroupmapping", + "GetScimGroupPolicyAssignmentGlobals": ".getscimgrouppolicyassignment", + "GetScimGroupPolicyAssignmentGlobalsTypedDict": ".getscimgrouppolicyassignment", + "GetScimGroupPolicyAssignmentRequest": ".getscimgrouppolicyassignment", + "GetScimGroupPolicyAssignmentRequestTypedDict": ".getscimgrouppolicyassignment", "GetScimSyncJobGlobals": ".getscimsyncjob", "GetScimSyncJobGlobalsTypedDict": ".getscimsyncjob", "GetScimSyncJobRequest": ".getscimsyncjob", @@ -3160,6 +3221,14 @@ "ListScimGroupMappingsRequestTypedDict": ".listscimgroupmappings", "ListScimGroupMappingsResponse": ".listscimgroupmappings", "ListScimGroupMappingsResponseTypedDict": ".listscimgroupmappings", + "ListScimGroupPolicyAssignmentsGlobals": ".listscimgrouppolicyassignments", + "ListScimGroupPolicyAssignmentsGlobalsTypedDict": ".listscimgrouppolicyassignments", + "ListScimGroupPolicyAssignmentsRequest": ".listscimgrouppolicyassignments", + "ListScimGroupPolicyAssignmentsRequestTypedDict": ".listscimgrouppolicyassignments", + "ListScimGroupPolicyOptOutsGlobals": ".listscimgrouppolicyoptouts", + "ListScimGroupPolicyOptOutsGlobalsTypedDict": ".listscimgrouppolicyoptouts", + "ListScimGroupPolicyOptOutsRequest": ".listscimgrouppolicyoptouts", + "ListScimGroupPolicyOptOutsRequestTypedDict": ".listscimgrouppolicyoptouts", "ListScimGroupsGlobals": ".listscimgroups", "ListScimGroupsGlobalsTypedDict": ".listscimgroups", "ListScimGroupsRequest": ".listscimgroups", @@ -3325,6 +3394,10 @@ "UpdateScimGroupMappingGlobalsTypedDict": ".updatescimgroupmapping", "UpdateScimGroupMappingRequest": ".updatescimgroupmapping", "UpdateScimGroupMappingRequestTypedDict": ".updatescimgroupmapping", + "UpdateScimGroupPolicyAssignmentGlobals": ".updatescimgrouppolicyassignment", + "UpdateScimGroupPolicyAssignmentGlobalsTypedDict": ".updatescimgrouppolicyassignment", + "UpdateScimGroupPolicyAssignmentRequest": ".updatescimgrouppolicyassignment", + "UpdateScimGroupPolicyAssignmentRequestTypedDict": ".updatescimgrouppolicyassignment", "UpdateWorkspaceGlobals": ".updateworkspace", "UpdateWorkspaceGlobalsTypedDict": ".updateworkspace", "UpdateWorkspaceRequest": ".updateworkspace", diff --git a/src/openrouter/operations/deletescimgrouppolicyoptout.py b/src/openrouter/operations/deletescimgrouppolicyoptout.py new file mode 100644 index 000000000..39209c5f7 --- /dev/null +++ b/src/openrouter/operations/deletescimgrouppolicyoptout.py @@ -0,0 +1,169 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteScimGroupPolicyOptOutGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteScimGroupPolicyOptOutGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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 + + +DeleteScimGroupPolicyOptOutPolicyType = Union[ + Literal[ + "budget", + "model_availability", + "moderation", + "rate_limit", + ], + UnrecognizedStr, +] + + +class DeleteScimGroupPolicyOptOutRequestTypedDict(TypedDict): + mapping_id: str + user_id: str + policy_type: DeleteScimGroupPolicyOptOutPolicyType + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class DeleteScimGroupPolicyOptOutRequest(BaseModel): + mapping_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + user_id: Annotated[ + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + + policy_type: Annotated[ + DeleteScimGroupPolicyOptOutPolicyType, + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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/openrouter/operations/getscimgrouppolicyassignment.py b/src/openrouter/operations/getscimgrouppolicyassignment.py new file mode 100644 index 000000000..d2f089faa --- /dev/null +++ b/src/openrouter/operations/getscimgrouppolicyassignment.py @@ -0,0 +1,142 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetScimGroupPolicyAssignmentGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetScimGroupPolicyAssignmentGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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 + + +class GetScimGroupPolicyAssignmentRequestTypedDict(TypedDict): + mapping_id: str + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class GetScimGroupPolicyAssignmentRequest(BaseModel): + mapping_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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/openrouter/operations/listscimgrouppolicyassignments.py b/src/openrouter/operations/listscimgrouppolicyassignments.py new file mode 100644 index 000000000..77bdc3f1c --- /dev/null +++ b/src/openrouter/operations/listscimgrouppolicyassignments.py @@ -0,0 +1,137 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListScimGroupPolicyAssignmentsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListScimGroupPolicyAssignmentsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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 + + +class ListScimGroupPolicyAssignmentsRequestTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListScimGroupPolicyAssignmentsRequest(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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/openrouter/operations/listscimgrouppolicyoptouts.py b/src/openrouter/operations/listscimgrouppolicyoptouts.py new file mode 100644 index 000000000..0ef412a1e --- /dev/null +++ b/src/openrouter/operations/listscimgrouppolicyoptouts.py @@ -0,0 +1,142 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListScimGroupPolicyOptOutsGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListScimGroupPolicyOptOutsGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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 + + +class ListScimGroupPolicyOptOutsRequestTypedDict(TypedDict): + mapping_id: str + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class ListScimGroupPolicyOptOutsRequest(BaseModel): + mapping_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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/openrouter/operations/updatescimgrouppolicyassignment.py b/src/openrouter/operations/updatescimgrouppolicyassignment.py new file mode 100644 index 000000000..945a6a524 --- /dev/null +++ b/src/openrouter/operations/updatescimgrouppolicyassignment.py @@ -0,0 +1,156 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.components import ( + updatescimgrouppolicyassignmentrequest as components_updatescimgrouppolicyassignmentrequest, +) +from openrouter.types import BaseModel, UNSET_SENTINEL +from openrouter.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UpdateScimGroupPolicyAssignmentGlobalsTypedDict(TypedDict): + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class UpdateScimGroupPolicyAssignmentGlobals(BaseModel): + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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 + + +class UpdateScimGroupPolicyAssignmentRequestTypedDict(TypedDict): + mapping_id: str + update_scim_group_policy_assignment_request: components_updatescimgrouppolicyassignmentrequest.UpdateScimGroupPolicyAssignmentRequestTypedDict + http_referer: NotRequired[str] + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + x_open_router_title: NotRequired[str] + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + x_open_router_categories: NotRequired[str] + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + +class UpdateScimGroupPolicyAssignmentRequest(BaseModel): + mapping_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + update_scim_group_policy_assignment_request: Annotated[ + components_updatescimgrouppolicyassignmentrequest.UpdateScimGroupPolicyAssignmentRequest, + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] + + http_referer: Annotated[ + Optional[str], + pydantic.Field(alias="HTTP-Referer"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. + This is used to track API usage per application. + + """ + + x_open_router_title: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Title"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard. + + """ + + x_open_router_categories: Annotated[ + Optional[str], + pydantic.Field(alias="X-OpenRouter-Categories"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"] + ) + 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/uv.lock b/uv.lock index c93c99798..e4aa0166a 100644 --- a/uv.lock +++ b/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.3.233" +version = "1.3.234" source = { editable = "." } dependencies = [ { name = "httpcore" },