Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
feat: add python sdk code examples for all clients (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcschy authored Apr 7, 2022
1 parent fd5895b commit bf3ccb2
Show file tree
Hide file tree
Showing 14 changed files with 531 additions and 66 deletions.
85 changes: 70 additions & 15 deletions source/includes/api-reference/_applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,23 @@ var application = await client.CreateAsync(new Application {
```

```python
# Coming Soon!
import basistheory
from basistheory.api import applications_api
from basistheory.model.create_application_request import CreateApplicationRequest

with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_N88mVGsp3sCXkykyN2EFED")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)

application = application_client.create(create_application_request=CreateApplicationRequest(
name="My Example App",
type="server_to_server",
permissions=[
"token:general:create",
"token:general:read:low",
"token:pci:create",
"token:pci:read:low"
]
))
```

> Response
Expand Down Expand Up @@ -157,7 +173,13 @@ var applications = await client.GetAsync();
```

```python
# Coming Soon!
import basistheory
from basistheory.api import applications_api

with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_N88mVGsp3sCXkykyN2EFED")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)

applications = application_client.get()
```

> Response
Expand Down Expand Up @@ -238,7 +260,13 @@ var application = await client.GetByIdAsync("fe1f9ba4-474e-44b9-b949-110cdba9d66
```

```python
# Coming Soon!
import basistheory
from basistheory.api import applications_api

with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_N88mVGsp3sCXkykyN2EFED")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)

application = application_client.get_by_id("fe1f9ba4-474e-44b9-b949-110cdba9d662")
```

> Response
Expand Down Expand Up @@ -310,7 +338,13 @@ var application = await client.GetByKeyAsync();
```

```python
# Coming Soon!
import basistheory
from basistheory.api import applications_api

with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_N88mVGsp3sCXkykyN2EFED")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)

application = application_client.get_by_key()
```

> Response
Expand Down Expand Up @@ -376,10 +410,8 @@ const bt = await new BasisTheory().init('key_N88mVGsp3sCXkykyN2EFED');
const application = await bt.applications.update('fb124bba-f90d-45f0-9a59-5edca27b3b4a', {
name: 'My Example App',
permissions: [
'token:general:create',
'token:general:read:low',
'token:pci:create',
'token:pci:read:low',
'application:create',
'application:read'
],
});
```
Expand All @@ -393,17 +425,28 @@ var application = await client.UpdateAsync("fb124bba-f90d-45f0-9a59-5edca27b3b4a
new Application {
Name = "My Example App",
Permissions = new List<string> {
"token:general:create",
"token:general:read:low",
"token:pci:create",
"token:pci:read:low"
"application:create",
"application:read"
}
}
);
```

```python
# Coming Soon!
import basistheory
from basistheory.api import applications_api
from basistheory.model.update_application_request import UpdateApplicationRequest

with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_N88mVGsp3sCXkykyN2EFED")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)

application = application_client.update("fb124bba-f90d-45f0-9a59-5edca27b3b4a", update_application_request=UpdateApplicationRequest(
name="My Example App",
permissions=[
"application:create",
"application:read"
]
))
```

> Response
Expand Down Expand Up @@ -483,7 +526,13 @@ var application = await client.RegenerateKeyAsync("fb124bba-f90d-45f0-9a59-5edca
```

```python
# Coming Soon!
import basistheory
from basistheory.api import applications_api

with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_N88mVGsp3sCXkykyN2EFED")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)

application = application_client.regenerate_key("fb124bba-f90d-45f0-9a59-5edca27b3b4a")
```

> Response
Expand Down Expand Up @@ -563,7 +612,13 @@ await client.DeleteAsync("fb124bba-f90d-45f0-9a59-5edca27b3b4a");
```

```python
# Coming Soon!
import basistheory
from basistheory.api import applications_api

with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_N88mVGsp3sCXkykyN2EFED")) as api_client:
application_client = applications_api.ApplicationsApi(api_client)

application_client.delete("fb124bba-f90d-45f0-9a59-5edca27b3b4a")
```

<span class="http-method delete">
Expand Down
28 changes: 21 additions & 7 deletions source/includes/api-reference/_atomic_banks.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ var atomicBank = await client.CreateAsync(new AtomicBank {
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

> Response
Expand Down Expand Up @@ -150,7 +152,9 @@ var atomicBanks = await client.GetAsync();
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

> Response
Expand Down Expand Up @@ -227,7 +231,9 @@ const atomicBank = await bt.atomicBanks.retrieve('1485efb9-6b1f-4248-a5d1-cf9b39
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

> Response
Expand Down Expand Up @@ -321,7 +327,9 @@ var atomicBank = await client.UpdateAsync("1485efb9-6b1f-4248-a5d1-cf9b3907164c"
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

> Response
Expand Down Expand Up @@ -397,7 +405,9 @@ await client.DeleteAsync("1485efb9-6b1f-4248-a5d1-cf9b3907164c");
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

<span class="http-method delete">
Expand Down Expand Up @@ -461,7 +471,9 @@ var atomicBank = await client.GetByIdAsync("1485efb9-6b1f-4248-a5d1-cf9b3907164c
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

> Response
Expand Down Expand Up @@ -566,7 +578,9 @@ var reactResponse = await client.ReactAsync("1485efb9-6b1f-4248-a5d1-cf9b3907164
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

<span class="http-method post">
Expand Down
24 changes: 18 additions & 6 deletions source/includes/api-reference/_atomic_cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ var atomicCard = await client.CreateAsync(new AtomicCard {
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

> Response
Expand Down Expand Up @@ -161,7 +163,9 @@ var atomicCards = await client.GetAsync();
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

> Response
Expand Down Expand Up @@ -236,7 +240,9 @@ var atomicCard = await client.GetByIdAsync("c1e565009-1984-4638-8fca-dce8a82cc2a
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

> Response
Expand Down Expand Up @@ -334,7 +340,9 @@ var atomicCard = await client.UpdateAsync("c1e565009-1984-4638-8fca-dce8a82cc2af
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

> Response
Expand Down Expand Up @@ -411,7 +419,9 @@ await client.DeleteAsync("c1e565009-1984-4638-8fca-dce8a82cc2af");
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

<span class="http-method delete">
Expand Down Expand Up @@ -501,7 +511,9 @@ var reactResponse = await client.ReactAsync("c1e565009-1984-4638-8fca-dce8a82cc2
```

```python
# Coming Soon!
# Atomic methods are deprecated and as such were not added to the Python SDK.
# For adding banks and cards to our platform, use the 'Tokens' endpoints.
# For further information, check the Deprecations section.
```

<span class="http-method post">
Expand Down
8 changes: 7 additions & 1 deletion source/includes/api-reference/_logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ var logs = await client.GetAsync();
```

```python
# Coming Soon!
import basistheory
from basistheory.api import logs_api

with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_N88mVGsp3sCXkykyN2EFED")) as api_client:
logs_client = logs_api.LogsApi(api_client)

logs = logs_client.get()
```

> Response
Expand Down
10 changes: 10 additions & 0 deletions source/includes/api-reference/_pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ var applications = client.GetAsync(new ApplicationGetRequest {
});
```

```python
import basistheory
from basistheory.api import applications_api

with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_N88mVGsp3sCXkykyN2EFED")) as api_client:
applications_client = applications_api.ApplicationsApi(api_client)

applications = applications_client.get(page=2, size=10)
```

> Response
```json
Expand Down
8 changes: 7 additions & 1 deletion source/includes/api-reference/_permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ var permissions = await client.GetAsync();
```

```python
# Coming Soon!
import basistheory
from basistheory.api import permissions_api

with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="key_N88mVGsp3sCXkykyN2EFED")) as api_client:
permissions_client = permissions_api.PermissionsApi(api_client)

permissions = permissions_client.get()
```

> Response
Expand Down
Loading

0 comments on commit bf3ccb2

Please sign in to comment.