Music shop REST API
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python >=3.6
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
(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:
import openapi_client
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import openapi_client
Please follow the installation procedure and then run the following:
import time
import openapi_client
from pprint import pprint
from openapi_client.api import default_api
from openapi_client.model.album_dto import AlbumDTO
from openapi_client.model.cart_line_item_dto import CartLineItemDTO
from openapi_client.model.invoice_line_item_dto import InvoiceLineItemDTO
from openapi_client.model.shopping_cart_dto import ShoppingCartDTO
from openapi_client.model.song_dto import SongDTO
from openapi_client.model.user_data_dto import UserDataDTO
# Defining the host is optional and defaults to http://localhost:8080/musicshop-1.0
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost:8080/musicshop-1.0"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = default_api.DefaultApi(api_client)
cart_uuid = "CartUUID_example" # str | (optional)
album_dto = AlbumDTO(
long_id=1,
title="title_example",
image_url="image_url_example",
price=3.14,
stock=1,
medium_type="CD",
release_date="release_date_example",
album_id=AlbumId(
album_id="album_id_example",
),
label="label_example",
songs=[
SongDTO(
long_id=1,
title="title_example",
price=3.14,
stock=1,
medium_type="CD",
release_date="release_date_example",
genre="genre_example",
artists=[
ArtistDTO(
name="name_example",
),
],
in_album=[
AlbumDTO(),
],
),
],
quantity_to_add_to_cart=1,
) # AlbumDTO | (optional)
try:
api_response = api_instance.add_albums_to_cart(cart_uuid=cart_uuid, album_dto=album_dto)
pprint(api_response)
except openapi_client.ApiException as e:
print("Exception when calling DefaultApi->add_albums_to_cart: %s\n" % e)
All URIs are relative to http://localhost:8080/musicshop-1.0
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | add_albums_to_cart | POST /api/albums/addAlbumsToCart | |
DefaultApi | add_songs_from_album_to_cart | POST /api/albums/addSongsFromAlbumToCart | |
DefaultApi | add_songs_to_cart | POST /api/albums/addSongsToCart | |
DefaultApi | buy_product | POST /api/shoppingCart/buyProducts | |
DefaultApi | buy_products_web | POST /api/shoppingCart/buyProductsWeb | |
DefaultApi | clear_shopping_cart | GET /api/shoppingCart/clear | |
DefaultApi | display_shopping_cart | GET /api/shoppingCart/display | |
DefaultApi | find_album_by_album_id | GET /api/album/{albumId} | |
DefaultApi | find_albums_by_song_title | GET /api/albums/digital/{songTitle} | |
DefaultApi | find_albums_by_song_title_physical | GET /api/albums/physical/{songTitle} | |
DefaultApi | login | POST /api/login | |
DefaultApi | login_web | POST /api/loginWeb | |
DefaultApi | remove_line_item_from_cart | POST /api/shoppingCart/removeLineItemFromCart | |
DefaultApi | welcome | GET /api |
All endpoints do not require authorization.
If the OpenAPI document is large, imports in openapi_client.apis and openapi_client.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:
Solution 1: Use specific imports for apis and models like:
from openapi_client.api.default_api import DefaultApi
from openapi_client.model.pet import Pet
Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:
import sys
sys.setrecursionlimit(1500)
import openapi_client
from openapi_client.apis import *
from openapi_client.models import *