60 lines
1.5 KiB
YAML
60 lines
1.5 KiB
YAML
overlay: 1.0.0
|
|
info:
|
|
title: CodeSamples overlay for python target
|
|
version: 0.0.0
|
|
actions:
|
|
- target: $["paths"]["/v1/attach"]["post"]
|
|
update:
|
|
x-codeSamples:
|
|
- lang: python
|
|
label: Python (SDK)
|
|
source: |-
|
|
from autumn_sdk import Autumn
|
|
|
|
|
|
with Autumn(
|
|
x_api_version="2.1",
|
|
secret_key="<YOUR_BEARER_TOKEN_HERE>",
|
|
) as autumn:
|
|
|
|
res = autumn.billing.attach(product_id="<id>", redirect_mode="always")
|
|
|
|
# Handle response
|
|
print(res)
|
|
- target: $["paths"]["/v1/customers.getOrCreate"]["post"]
|
|
update:
|
|
x-codeSamples:
|
|
- lang: python
|
|
label: Python (SDK)
|
|
source: |-
|
|
from autumn_sdk import Autumn
|
|
|
|
|
|
with Autumn(
|
|
x_api_version="2.1",
|
|
secret_key="<YOUR_BEARER_TOKEN_HERE>",
|
|
) as autumn:
|
|
|
|
res = autumn.customers.get_or_create(customer_id="cus_123", name="John Doe", email="john@example.com")
|
|
|
|
# Handle response
|
|
print(res)
|
|
- target: $["paths"]["/v1/products"]["get"]
|
|
update:
|
|
x-codeSamples:
|
|
- lang: python
|
|
label: Python (SDK)
|
|
source: |-
|
|
from autumn_sdk import Autumn
|
|
|
|
|
|
with Autumn(
|
|
x_api_version="2.1",
|
|
secret_key="<YOUR_BEARER_TOKEN_HERE>",
|
|
) as autumn:
|
|
|
|
res = autumn.plans.list()
|
|
|
|
# Handle response
|
|
print(res)
|