From 89328e7c53563176a85b6f1f96b1b92a17c52df3 Mon Sep 17 00:00:00 2001 From: justanotherbyte Date: Thu, 3 Jul 2025 12:09:40 +0100 Subject: [PATCH 1/3] balances: add python and cURL examples for POST /customers//balances --- api-reference/features.yaml | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/api-reference/features.yaml b/api-reference/features.yaml index 59a8fac..46d7b6c 100644 --- a/api-reference/features.yaml +++ b/api-reference/features.yaml @@ -206,6 +206,48 @@ paths: responses: "200": description: "" + x-code-samples: + - lang: curl + source: | + curl -X POST 'https://api.useautumn.com/v1/customers/user_123/balances' \ + -H 'Authorization: Bearer am_sk_1234567890' \ + -H 'Content-Type: application/json' \ + -d '{ + "balances": [ + { + "feature_id": "chat_messages", + "balance": 10 + }, + { + "feature_id": "seats", + "balance": 15 + } + ] + }' + + - lang: python + source: | + import asyncio + from autumn import Autumn, Balance + + autumn = Autumn('am_sk_1234567890') + + async def main(): + balances = await autumn.features.set_balances( + customer_id='user_123', + balances=[ + Balance( + feature_id='chat_messages', + balance=10 + ), + Balance( + feature_id='seats', + balance=15 + ) + ] + ) + + asyncio.run(main()) components: schemas: From c28c9b2c0b0c60b17721b0f4dc3dd19ac7c6031d Mon Sep 17 00:00:00 2001 From: justanotherbyte Date: Thu, 3 Jul 2025 12:11:55 +0100 Subject: [PATCH 2/3] fix: fix Python example for POST /customers//entities --- api-reference/features.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api-reference/features.yaml b/api-reference/features.yaml index 46d7b6c..a894a4d 100644 --- a/api-reference/features.yaml +++ b/api-reference/features.yaml @@ -99,8 +99,8 @@ paths: autumn = Autumn('am_sk_1234567890') async def main(): - entity = await autumn.create_entity( - 'user_123', + entity = await autumn.features.create_entity( + customer_id='user_123', feature_id='seats', id='seat_456', name='Brandon Yeo' From 42b1e8c7596672c3360b647485a771eb7eb2e67a Mon Sep 17 00:00:00 2001 From: justanotherbyte Date: Thu, 3 Jul 2025 12:16:31 +0100 Subject: [PATCH 3/3] add python example to DELETE /customers//entities/ --- api-reference/features.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/api-reference/features.yaml b/api-reference/features.yaml index a894a4d..b8a75b2 100644 --- a/api-reference/features.yaml +++ b/api-reference/features.yaml @@ -130,6 +130,26 @@ paths: responses: "200": description: "" + x-code-samples: + - lang: curl + source: | + curl -X DELETE 'https://api.useautumn.com/v1/customers/user_123/entities/seat_456' \ + -H 'Authorization: Bearer am_sk_1234567890' + + - lang: python + source: | + import asyncio + from autumn import Autumn + + autumn = Autumn('am_sk_1234567890') + + async def main(): + await autumn.features.delete_entity( + customer_id='user_123', + entity_id='seat_456' + ) + + asyncio.run(main()) /usage: post: