Module yapapi.rest
Mid level binding for Golem REST API
Sub-modules
- yapapi.rest.activity
- yapapi.rest.configuration
- yapapi.rest.market
- yapapi.rest.payment
- yapapi.rest.resource
Classes
Activity
class Activity(
api_client:ya_activity.api_client.ApiClient
)
Methods
new_activity
def new_activity(
self,
agreement_id:str
) -> 'Activity'
Configuration
class Configuration(
app_key=None,
*,
url:Union[str, NoneType]=None,
market_url:Union[str, NoneType]=None,
payment_url:Union[str, NoneType]=None,
activity_url:Union[str, NoneType]=None
)
Instance variables
activity_url
app_key
market_url
payment_url
Methods
activity
def activity(
self
) -> ya_activity.api_client.ApiClient
market
def market(
self
) -> ya_market.api_client.ApiClient
payment
def payment(
self
) -> ya_payment.api_client.ApiClient
Market
class Market(
api_client:ya_market.api_client.ApiClient
)
Methods
subscribe
def subscribe(
self,
props:dict,
constraints:str
) -> yapapi.rest.market.AsyncResource
subscriptions
def subscriptions(
self
) -> AsyncIterator[yapapi.rest.market.Subscription]
Payment
class Payment(
api_client:ya_payment.api_client.ApiClient
)
Methods
allocation
def allocation(
self,
allocation_id:str
) -> yapapi.rest.payment.Allocation
allocations
def allocations(
self
) -> AsyncIterator[yapapi.rest.payment.Allocation]
Lists all active allocations.
Example:
Listing all active allocations
from yapapi import rest
async def list_allocations(payment_api: rest.Payment):
async for allocation in payment_api.allocations():
print(f'''allocation: {allocation.id}
amount={allocation.amount},
expires={allocation.expires}''')
incoming_invoices
def incoming_invoices(
self
) -> AsyncIterator[yapapi.rest.payment.Invoice]
invoice
def invoice(
self,
invoice_id:str
) -> yapapi.rest.payment.Invoice
invoices
def invoices(
self
) -> AsyncIterator[yapapi.rest.payment.Invoice]
new_allocation
def new_allocation(
self,
amount:decimal.Decimal,
*,
expires:Union[datetime.datetime, NoneType]=None,
make_deposit:bool=False
) -> yapapi.rest.resource.ResourceCtx
Creates new allocation.
amount
: Allocation amount.expires
: expiration timestamp. by default 30 minutes from now.make_deposit
: (unimplemented).