Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openapi spec and generated library #112

Merged
merged 7 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client-libs/python/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.27
391 changes: 391 additions & 0 deletions client-libs/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,391 @@
# swagger-client
REST API for any Emblem server

This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 2021-07-12
- Package version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

## Requirements.

Python 2.7 and 3.4+

## Installation & Usage
### pip install

If the python package is hosted on Github, you can install directly from Github

```sh
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
engelke marked this conversation as resolved.
Show resolved Hide resolved
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)

Then import the package:
```python
import swagger_client
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
engelke marked this conversation as resolved.
Show resolved Hide resolved

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import swagger_client
```

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))

try:
# Returns a list of approvers
api_response = api_instance.approvers_get()
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->approvers_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reuse previous api_instances here?

If not, we should add a comment explaining that.

(Feel free to ignore this comment if you decide - per my comment below - to split this up into multiple code blocks!)

id = 'id_example' # str | Approver Id

try:
# deletes a single approver
api_instance.approvers_id_delete(id)
except ApiException as e:
print("Exception when calling DefaultApi->approvers_id_delete: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Approver Id

try:
# returns a single approver
api_response = api_instance.approvers_id_get(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->approvers_id_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
body = swagger_client.Approver() # Approver | JSON representation of a single approver
id = 'id_example' # str | Approver Id

try:
# updates a single approver
api_response = api_instance.approvers_id_patch(body, id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->approvers_id_patch: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
body = swagger_client.Approver() # Approver | JSON representation of a single approver

try:
# Create a new approver
api_instance.approvers_post(body)
except ApiException as e:
print("Exception when calling DefaultApi->approvers_post: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))

try:
# Returns a list of campaigns
api_response = api_instance.campaigns_get()
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->campaigns_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Campaign Id

try:
# deletes a single campaign
api_instance.campaigns_id_delete(id)
except ApiException as e:
print("Exception when calling DefaultApi->campaigns_id_delete: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Campaign Id

try:
# lists all donations for the specified campaign
api_response = api_instance.campaigns_id_donations_get(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->campaigns_id_donations_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Campaign Id

try:
# returns a single campaign
api_response = api_instance.campaigns_id_get(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->campaigns_id_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
body = swagger_client.Campaign() # Campaign | JSON representation of a single campaign
id = 'id_example' # str | Campaign Id

try:
# updates a single campaign
api_response = api_instance.campaigns_id_patch(body, id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->campaigns_id_patch: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
body = swagger_client.Campaign() # Campaign | JSON representation of a single campaign

try:
# Create a new campaign
api_instance.campaigns_post(body)
except ApiException as e:
print("Exception when calling DefaultApi->campaigns_post: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))

try:
# Returns a list of causes
api_response = api_instance.causes_get()
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->causes_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Cause Id

try:
# deletes a single cause
api_instance.causes_id_delete(id)
except ApiException as e:
print("Exception when calling DefaultApi->causes_id_delete: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Cause Id

try:
# returns a single cause
api_response = api_instance.causes_id_get(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->causes_id_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
body = swagger_client.Cause() # Cause | JSON representation of a single cause
id = 'id_example' # str | Cause Id

try:
# updates a single cause
api_response = api_instance.causes_id_patch(body, id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->causes_id_patch: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
body = swagger_client.Cause() # Cause | JSON representation of a single cause

try:
# Create a new cause
api_instance.causes_post(body)
except ApiException as e:
print("Exception when calling DefaultApi->causes_post: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))

try:
# Returns a list of donations
api_response = api_instance.donations_get()
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->donations_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Donation Id

try:
# deletes a single donation
api_instance.donations_id_delete(id)
except ApiException as e:
print("Exception when calling DefaultApi->donations_id_delete: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Donation Id

try:
# returns a single donation
api_response = api_instance.donations_id_get(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->donations_id_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
body = swagger_client.Donation() # Donation | JSON representation of a single donation
id = 'id_example' # str | Donation Id

try:
# updates a single donation
api_response = api_instance.donations_id_patch(body, id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->donations_id_patch: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
body = swagger_client.Donation() # Donation | JSON representation of a single donation

try:
# Create a new donation
api_instance.donations_post(body)
except ApiException as e:
print("Exception when calling DefaultApi->donations_post: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))

try:
# Returns a list of donors
api_response = api_instance.donors_get()
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->donors_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Donor Id

try:
# deletes a single donor
api_instance.donors_id_delete(id)
except ApiException as e:
print("Exception when calling DefaultApi->donors_id_delete: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Donor Id

try:
# lists all donations for the specified donor
api_response = api_instance.donors_id_donations_get(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->donors_id_donations_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Donor Id

try:
# returns a single donor
api_response = api_instance.donors_id_get(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->donors_id_get: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
body = swagger_client.Donor() # Donor | JSON representation of a single donor
id = 'id_example' # str | Donor Id

try:
# updates a single donor
api_response = api_instance.donors_id_patch(body, id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->donors_id_patch: %s\n" % e)

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
body = swagger_client.Donor() # Donor | JSON representation of a single donor

try:
# Create a new donor
engelke marked this conversation as resolved.
Show resolved Hide resolved
api_instance.donors_post(body)
except ApiException as e:
print("Exception when calling DefaultApi->donors_post: %s\n" % e)
```

## Documentation for API Endpoints

All URIs are relative to *https://api-pwrmtjf4hq-uc.a.run.app*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**approvers_get**](docs/DefaultApi.md#approvers_get) | **GET** /approvers | Returns a list of approvers
*DefaultApi* | [**approvers_id_delete**](docs/DefaultApi.md#approvers_id_delete) | **DELETE** /approvers/{id} | deletes a single approver
*DefaultApi* | [**approvers_id_get**](docs/DefaultApi.md#approvers_id_get) | **GET** /approvers/{id} | returns a single approver
*DefaultApi* | [**approvers_id_patch**](docs/DefaultApi.md#approvers_id_patch) | **PATCH** /approvers/{id} | updates a single approver
*DefaultApi* | [**approvers_post**](docs/DefaultApi.md#approvers_post) | **POST** /approvers | Create a new approver
*DefaultApi* | [**campaigns_get**](docs/DefaultApi.md#campaigns_get) | **GET** /campaigns | Returns a list of campaigns
*DefaultApi* | [**campaigns_id_delete**](docs/DefaultApi.md#campaigns_id_delete) | **DELETE** /campaigns/{id} | deletes a single campaign
*DefaultApi* | [**campaigns_id_donations_get**](docs/DefaultApi.md#campaigns_id_donations_get) | **GET** /campaigns/{id}/donations | lists all donations for the specified campaign
*DefaultApi* | [**campaigns_id_get**](docs/DefaultApi.md#campaigns_id_get) | **GET** /campaigns/{id} | returns a single campaign
*DefaultApi* | [**campaigns_id_patch**](docs/DefaultApi.md#campaigns_id_patch) | **PATCH** /campaigns/{id} | updates a single campaign
*DefaultApi* | [**campaigns_post**](docs/DefaultApi.md#campaigns_post) | **POST** /campaigns | Create a new campaign
*DefaultApi* | [**causes_get**](docs/DefaultApi.md#causes_get) | **GET** /causes | Returns a list of causes
*DefaultApi* | [**causes_id_delete**](docs/DefaultApi.md#causes_id_delete) | **DELETE** /causes/{id} | deletes a single cause
*DefaultApi* | [**causes_id_get**](docs/DefaultApi.md#causes_id_get) | **GET** /causes/{id} | returns a single cause
*DefaultApi* | [**causes_id_patch**](docs/DefaultApi.md#causes_id_patch) | **PATCH** /causes/{id} | updates a single cause
*DefaultApi* | [**causes_post**](docs/DefaultApi.md#causes_post) | **POST** /causes | Create a new cause
*DefaultApi* | [**donations_get**](docs/DefaultApi.md#donations_get) | **GET** /donations | Returns a list of donations
*DefaultApi* | [**donations_id_delete**](docs/DefaultApi.md#donations_id_delete) | **DELETE** /donations/{id} | deletes a single donation
*DefaultApi* | [**donations_id_get**](docs/DefaultApi.md#donations_id_get) | **GET** /donations/{id} | returns a single donation
*DefaultApi* | [**donations_id_patch**](docs/DefaultApi.md#donations_id_patch) | **PATCH** /donations/{id} | updates a single donation
*DefaultApi* | [**donations_post**](docs/DefaultApi.md#donations_post) | **POST** /donations | Create a new donation
*DefaultApi* | [**donors_get**](docs/DefaultApi.md#donors_get) | **GET** /donors | Returns a list of donors
*DefaultApi* | [**donors_id_delete**](docs/DefaultApi.md#donors_id_delete) | **DELETE** /donors/{id} | deletes a single donor
*DefaultApi* | [**donors_id_donations_get**](docs/DefaultApi.md#donors_id_donations_get) | **GET** /donors/{id}/donations | lists all donations for the specified donor
*DefaultApi* | [**donors_id_get**](docs/DefaultApi.md#donors_id_get) | **GET** /donors/{id} | returns a single donor
*DefaultApi* | [**donors_id_patch**](docs/DefaultApi.md#donors_id_patch) | **PATCH** /donors/{id} | updates a single donor
*DefaultApi* | [**donors_post**](docs/DefaultApi.md#donors_post) | **POST** /donors | Create a new donor

## Documentation For Models

- [Approver](docs/Approver.md)
- [Campaign](docs/Campaign.md)
- [Cause](docs/Cause.md)
- [Donation](docs/Donation.md)
- [Donor](docs/Donor.md)

## Documentation For Authorization

All endpoints do not require authorization.


## Author


Loading