Skip to content

Commit 8317523

Browse files
Merge pull request #1 from thetradedesk/adi-DATEX-472-publish-data-apis-sdk
adi-DATEX-472-publish-data-apis-sdk
2 parents 99de743 + 3515943 commit 8317523

85 files changed

Lines changed: 7816 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
> **Remember to shutdown a GitHub Codespace when it is not in use!**
3+
4+
# Dev Containers Quick Start
5+
6+
The default location for usage snippets is the `samples` directory.
7+
8+
## Running a Usage Sample
9+
10+
A sample usage example has been provided in a `root.py` file. As you work with the SDK, it's expected that you will modify these samples to fit your needs. To execute this particular snippet, use the command below.
11+
12+
```
13+
python root.py
14+
```
15+
16+
## Generating Additional Usage Samples
17+
18+
The speakeasy CLI allows you to generate more usage snippets. Here's how:
19+
20+
- To generate a sample for a specific operation by providing an operation ID, use:
21+
22+
```
23+
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -i {INPUT_OPERATION_ID} -o ./samples
24+
```
25+
26+
- To generate samples for an entire namespace (like a tag or group name), use:
27+
28+
```
29+
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -n {INPUT_TAG_NAME} -o ./samples
30+
```

.devcontainer/devcontainer.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/images/tree/main/src/python
3+
{
4+
"name": "Python",
5+
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
6+
// Features to add to the dev container. More info: https://containers.dev/features.
7+
"features": {
8+
"ghcr.io/astral-sh/devcontainer-features/uv:latest": {}
9+
},
10+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
11+
// "forwardPorts": [],
12+
// Use 'postCreateCommand' to run commands after the container is created.
13+
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"ms-python.python",
18+
"ms-python.vscode-pylance",
19+
"github.vscode-pull-request-github"
20+
],
21+
"settings": {
22+
"files.eol": "\n",
23+
"editor.formatOnSave": true,
24+
"python.formatting.provider": "black",
25+
"python.linting.enabled": true,
26+
"python.linting.pylintEnabled": true,
27+
"python.linting.flake8Enabled": true,
28+
"python.linting.banditEnabled": true,
29+
"python.testing.pytestEnabled": true
30+
}
31+
},
32+
"codespaces": {
33+
"openFiles": [
34+
".devcontainer/README.md"
35+
]
36+
}
37+
}
38+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
39+
// "remoteUser": "root"
40+
}

.devcontainer/setup.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# Install the speakeasy CLI
4+
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh
5+
6+
# Setup samples directory
7+
rmdir samples || true
8+
mkdir samples
9+
10+
11+
uv sync --dev
12+
13+
# Generate starter usage sample with speakeasy
14+
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -o samples/root.py

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This allows generated code to be indexed correctly
2+
*.py linguist-generated=false
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Generate
2+
permissions:
3+
checks: write
4+
contents: write
5+
pull-requests: write
6+
statuses: write
7+
id-token: write
8+
"on":
9+
workflow_dispatch:
10+
inputs:
11+
force:
12+
description: Force generation of SDKs
13+
type: boolean
14+
default: false
15+
set_version:
16+
description: optionally set a specific SDK version
17+
type: string
18+
schedule:
19+
- cron: 0 0 * * *
20+
jobs:
21+
generate:
22+
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
23+
with:
24+
force: ${{ github.event.inputs.force }}
25+
mode: pr
26+
set_version: ${{ github.event.inputs.set_version }}
27+
secrets:
28+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
29+
pypi_token: ${{ secrets.PYPI_TOKEN }}
30+
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

.github/workflows/sdk_publish.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Publish
2+
permissions:
3+
checks: write
4+
contents: write
5+
pull-requests: write
6+
statuses: write
7+
id-token: write
8+
"on":
9+
push:
10+
branches:
11+
- main
12+
paths:
13+
- .speakeasy/gen.lock
14+
workflow_dispatch: {}
15+
jobs:
16+
publish:
17+
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-publish.yaml@v15
18+
with:
19+
target: data-api
20+
secrets:
21+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
22+
pypi_token: ${{ secrets.PYPI_TOKEN }}
23+
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

.github/workflows/tagging.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
gitname: Speakeasy Tagging
2+
permissions:
3+
checks: write
4+
contents: write
5+
pull-requests: write
6+
statuses: write
7+
"on":
8+
push:
9+
branches:
10+
- main
11+
workflow_dispatch: {}
12+
jobs:
13+
tag:
14+
uses: speakeasy-api/sdk-generation-action/.github/workflows/tag.yaml@v15
15+
with:
16+
registry_tags: main
17+
secrets:
18+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
19+
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Python
2+
.venv/
3+
venv/
4+
src/*.egg-info/
5+
**/__pycache__/
6+
.pytest_cache/
7+
.python-version
8+
pyrightconfig.json
9+
*.pyc
10+
*.pyo
11+
*.pyd
12+
__pycache__/
13+
*.so
14+
*.egg
15+
*.egg-info/
16+
dist/
17+
build/
18+
# Environment
19+
.env
20+
.env.local
21+
.env.example
22+
# IDE
23+
.DS_Store
24+
.vscode/
25+
.idea/
26+
# Speakeasy
27+
**/.speakeasy/temp/
28+
**/.speakeasy/logs/
29+
.speakeasy/reports
30+
# Testing examples (don't commit)
31+
load_env.sh
32+
restructure.sh

0 commit comments

Comments
 (0)