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

update documentation per latest version #34

Merged
merged 3 commits into from
Jan 11, 2023
Merged
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
23 changes: 19 additions & 4 deletions examples/mp_api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""Simple script illustrating some of the features of this package."""
from pprint import pprint

from marketplace.app.marketplace_app import MarketPlaceApp
from fastapi.responses import HTMLResponse

from marketplace.app import get_app
from marketplace.app.v0 import MarketPlaceApp
from marketplace.app.v0_0_1 import MarketPlaceApp as MarketPlaceApp_v_0_0_1
from marketplace.client import MarketPlaceClient

# General MarketPlaceClient for simple requests like user info
Expand All @@ -13,16 +17,27 @@


# To simply instantiate a MarketPlaceApp with a client id
mp = MarketPlaceApp(client_id="<application_client_id>")
mp = get_app(app_id="<application_client_id>")
print(mp.heartbeat())


# To extend the MarketPlaceApp with custom implementations
class MyMarketPlaceApp(MarketPlaceApp):
def heartbeat(self) -> str:
def heartbeat(self) -> HTMLResponse:
res = super().heartbeat()
return f"heartbeat response: {res}"


my_mp_app = MyMarketPlaceApp(client_id="<application_client_id>")
my_mp_app = MyMarketPlaceApp(app_id="<application_client_id>")
print(my_mp_app.heartbeat())


# To extend the MarketPlaceApp with custom implementations for deprecated api version 0.0.1
class MyMarketPlaceApp_v_0_0_1(MarketPlaceApp_v_0_0_1):
def heartbeat(self) -> str:
res = super().heartbeat()
return f"heartbeat response: {res}"


my_mp_app_v_0_0_1 = MyMarketPlaceApp_v_0_0_1(client_id="<application_client_id>")
print(my_mp_app_v_0_0_1.heartbeat())