-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This updates the SDK from internal repo commit segmentio/public-api@1edb94ae.
- Loading branch information
APIs and Common Services team
committed
Oct 19, 2023
1 parent
b9c2208
commit 92c4920
Showing
1,106 changed files
with
63,019 additions
and
188,602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# NOTE: This file is auto generated by OpenAPI Generator. | ||
# URL: https://openapi-generator.tech | ||
# | ||
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: segment_public_api Python package | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ For more information, please visit [https://docs.segmentapis.com](https://docs.s | |
|
||
## Requirements. | ||
|
||
Python >=3.6 | ||
Python 3.7+ | ||
|
||
## Installation & Usage | ||
### pip install | ||
|
@@ -60,39 +60,40 @@ import segment_public_api | |
from segment_public_api.rest import ApiException | ||
from pprint import pprint | ||
|
||
# Defining the host is optional and defaults to https://api.segmentapis.com | ||
# See configuration.py for a list of all supported configuration parameters. | ||
configuration = segment_public_api.Configuration( | ||
host = "https://api.segmentapis.com" | ||
) | ||
|
||
# The client must configure the authentication and authorization parameters | ||
# in accordance with the API server security policy. | ||
# Examples for each auth method are provided below, use the example that | ||
# satisfies your auth use case. | ||
|
||
# Configure Bearer authorization: token | ||
configuration = segment_public_api.Configuration( | ||
access_token = 'YOUR_BEARER_TOKEN' | ||
access_token = os.environ["BEARER_TOKEN"] | ||
) | ||
|
||
|
||
# Enter a context with an instance of the API client | ||
with segment_public_api.ApiClient(configuration) as api_client: | ||
# Create an instance of the API class | ||
api_instance = segment_public_api.APICallsApi(api_client) | ||
period = "2021-02-01" # str | The start of the usage month in the ISO-8601 format. This parameter exists in v1. | ||
pagination = PaginationInput( | ||
cursor="cursor_example", | ||
count=3.14, | ||
) # PaginationInput | Pagination input for per Source API calls counts. This parameter exists in v1. | ||
|
||
api_instance = segment_public_api.WorkspacesApi(api_client) | ||
|
||
try: | ||
# Get Daily Per Source API Calls Usage | ||
api_response = api_instance.get_daily_per_source_api_calls_usage(period, pagination) | ||
print("The response of APICallsApi->get_daily_per_source_api_calls_usage:\n") | ||
# Get Workspace | ||
api_response = api_instance.get_workspace() | ||
print("The response of WorkspacesApi->get_workspace:\n") | ||
pprint(api_response) | ||
except ApiException as e: | ||
print("Exception when calling APICallsApi->get_daily_per_source_api_calls_usage: %s\n" % e) | ||
print("Exception when calling WorkspacesApi->get_workspace: %s\n" % e) | ||
|
||
source_api_instance = segment_public_api.SourcesApi(api_client) | ||
next = None | ||
while True: | ||
try: | ||
# Get Sources | ||
pagination = segment_public_api.PaginationInput(count=50, cursor= next) | ||
api_response = source_api_instance.list_sources(pagination) | ||
# print("The response of SourcesApi->list_sources:\n") | ||
# pprint(api_response) | ||
next = api_response.data.pagination.next | ||
if api_response.data.pagination.next == None: | ||
break | ||
except ApiException as e: | ||
print("Exception when calling SourcesApi->list_sources: %s\n" % e) | ||
``` | ||
|
||
## Contributing | ||
|
||
``` | ||
The contents of this repository are automatically generated, so we can't take contributions from external developers. If you have any issues with this SDK, please raise an issue or reach out to [email protected] instead of opening a pull request. Pull requests will not be reviewed. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[tool.poetry] | ||
name = "segment_public_api" | ||
version = "36.2.0" | ||
description = "Segment Public API" | ||
authors = ["Segment <[email protected]>"] | ||
license = "NoLicense" | ||
readme = "README.md" | ||
repository = "https://github.com/segmentio/public-api-sdk-python" | ||
keywords = ["OpenAPI", "OpenAPI-Generator", "Segment Public API"] | ||
include = ["segment_public_api/py.typed"] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.7" | ||
|
||
urllib3 = ">= 1.25.3" | ||
python-dateutil = ">=2.8.2" | ||
pydantic = "^1.10.5, <2" | ||
aenum = ">=3.1.11" | ||
|
||
[tool.poetry.dev-dependencies] | ||
pytest = ">=7.2.1" | ||
tox = ">=3.9.0" | ||
flake8 = ">=4.0.0" | ||
|
||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.pylint.'MESSAGES CONTROL'] | ||
extension-pkg-whitelist = "pydantic" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
python_dateutil >= 2.5.3 | ||
setuptools >= 21.0.0 | ||
urllib3 >= 1.25.3 | ||
urllib3 >= 1.25.3, < 2.1.0 | ||
pydantic >= 1.10.5, < 2 | ||
aenum >= 3.1.11 |
Oops, something went wrong.