Skip to content

Commit de53d1f

Browse files
committed
temp: api client
1 parent aa851b4 commit de53d1f

27 files changed

+2411
-0
lines changed

src/codegen/api/clients/.gitignore

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these files are written by a python script from a template
29+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*,cover
46+
.hypothesis/
47+
venv/
48+
.venv/
49+
.python-version
50+
.pytest_cache
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
59+
# Sphinx documentation
60+
docs/_build/
61+
62+
# PyBuilder
63+
target/
64+
65+
#Ipython Notebook
66+
.ipynb_checkpoints
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# NOTE: This file is auto generated by OpenAPI Generator.
2+
# URL: https://openapi-generator.tech
3+
#
4+
# ref: https://docs.gitlab.com/ee/ci/README.html
5+
# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
6+
7+
stages:
8+
- test
9+
10+
.pytest:
11+
stage: test
12+
script:
13+
- pip install -r requirements.txt
14+
- pip install -r test-requirements.txt
15+
- pytest --cov=openapi_client
16+
17+
pytest-3.8:
18+
extends: .pytest
19+
image: python:3.8-alpine
20+
pytest-3.9:
21+
extends: .pytest
22+
image: python:3.9-alpine
23+
pytest-3.10:
24+
extends: .pytest
25+
image: python:3.10-alpine
26+
pytest-3.11:
27+
extends: .pytest
28+
image: python:3.11-alpine
29+
pytest-3.12:
30+
extends: .pytest
31+
image: python:3.12-alpine
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.github/workflows/python.yml
2+
.gitignore
3+
.gitlab-ci.yml
4+
.openapi-generator-ignore
5+
.travis.yml
6+
README.md
7+
git_push.sh
8+
openapi_client/__init__.py
9+
openapi_client/api/__init__.py
10+
openapi_client/api_client.py
11+
openapi_client/api_response.py
12+
openapi_client/configuration.py
13+
openapi_client/exceptions.py
14+
openapi_client/models/__init__.py
15+
openapi_client/py.typed
16+
openapi_client/rest.py
17+
pyproject.toml
18+
requirements.txt
19+
setup.cfg
20+
setup.py
21+
test-requirements.txt
22+
test/__init__.py
23+
tox.ini
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.12.0

src/codegen/api/clients/.travis.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ref: https://docs.travis-ci.com/user/languages/python
2+
language: python
3+
python:
4+
- "3.8"
5+
- "3.9"
6+
- "3.10"
7+
- "3.11"
8+
- "3.12"
9+
# uncomment the following if needed
10+
#- "3.12-dev" # 3.12 development branch
11+
#- "nightly" # nightly build
12+
# command to install dependencies
13+
install:
14+
- "pip install -r requirements.txt"
15+
- "pip install -r test-requirements.txt"
16+
# command to run tests
17+
script: pytest --cov=openapi_client

src/codegen/api/clients/README.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# openapi-client
2+
API for application developers
3+
4+
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
5+
6+
- API version: 1.0.0
7+
- Package version: 1.0.0
8+
- Generator version: 7.12.0
9+
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
10+
11+
## Requirements.
12+
13+
Python 3.8+
14+
15+
## Installation & Usage
16+
### pip install
17+
18+
If the python package is hosted on a repository, you can install directly using:
19+
20+
```sh
21+
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
22+
```
23+
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
24+
25+
Then import the package:
26+
```python
27+
import openapi_client
28+
```
29+
30+
### Setuptools
31+
32+
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
33+
34+
```sh
35+
python setup.py install --user
36+
```
37+
(or `sudo python setup.py install` to install the package for all users)
38+
39+
Then import the package:
40+
```python
41+
import openapi_client
42+
```
43+
44+
### Tests
45+
46+
Execute `pytest` to run the tests.
47+
48+
## Getting Started
49+
50+
Please follow the [installation procedure](#installation--usage) and then run the following:
51+
52+
```python
53+
54+
import openapi_client
55+
from openapi_client.rest import ApiException
56+
from pprint import pprint
57+
58+
```
59+
60+
## Documentation for API Endpoints
61+
62+
All URIs are relative to *http://localhost*
63+
64+
Class | Method | HTTP request | Description
65+
------------ | ------------- | ------------- | -------------
66+
67+
68+
## Documentation For Models
69+
70+
71+
72+
<a id="documentation-for-authorization"></a>
73+
## Documentation For Authorization
74+
75+
Endpoints do not require authorization.
76+
77+
78+
## Author
79+
80+
81+

src/codegen/api/clients/git_push.sh

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/sh
2+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3+
#
4+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5+
6+
git_user_id=$1
7+
git_repo_id=$2
8+
release_note=$3
9+
git_host=$4
10+
11+
if [ "$git_host" = "" ]; then
12+
git_host="github.com"
13+
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14+
fi
15+
16+
if [ "$git_user_id" = "" ]; then
17+
git_user_id="GIT_USER_ID"
18+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19+
fi
20+
21+
if [ "$git_repo_id" = "" ]; then
22+
git_repo_id="GIT_REPO_ID"
23+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24+
fi
25+
26+
if [ "$release_note" = "" ]; then
27+
release_note="Minor update"
28+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29+
fi
30+
31+
# Initialize the local directory as a Git repository
32+
git init
33+
34+
# Adds the files in the local repository and stages them for commit.
35+
git add .
36+
37+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
38+
git commit -m "$release_note"
39+
40+
# Sets the new remote
41+
git_remote=$(git remote)
42+
if [ "$git_remote" = "" ]; then # git remote not defined
43+
44+
if [ "$GIT_TOKEN" = "" ]; then
45+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46+
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47+
else
48+
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49+
fi
50+
51+
fi
52+
53+
git pull origin master
54+
55+
# Pushes (Forces) the changes in the local repository up to the remote repository
56+
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57+
git push origin master 2>&1 | grep -v 'To https'

src/codegen/api/clients/main.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def main():
2+
print("Hello from client!")
3+
4+
5+
if __name__ == "__main__":
6+
main()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# coding: utf-8
2+
3+
# flake8: noqa
4+
5+
"""
6+
Developer API
7+
8+
API for application developers
9+
10+
The version of the OpenAPI document: 1.0.0
11+
Generated by OpenAPI Generator (https://openapi-generator.tech)
12+
13+
Do not edit the class manually.
14+
""" # noqa: E501
15+
16+
17+
__version__ = "1.0.0"
18+
19+
# import apis into sdk package
20+
21+
# import ApiClient
22+
from openapi_client.api_response import ApiResponse
23+
from openapi_client.api_client import ApiClient
24+
from openapi_client.configuration import Configuration
25+
from openapi_client.exceptions import OpenApiException
26+
from openapi_client.exceptions import ApiTypeError
27+
from openapi_client.exceptions import ApiValueError
28+
from openapi_client.exceptions import ApiKeyError
29+
from openapi_client.exceptions import ApiAttributeError
30+
from openapi_client.exceptions import ApiException
31+
32+
# import models into sdk package
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# flake8: noqa
2+
3+
# import apis into api package
4+

0 commit comments

Comments
 (0)