Skip to content

prekucki/ya-client-python-market

Repository files navigation

ya-market

Yagna Market

The Yagna Market is a core component of the Yagna Network, which enables computational Offers and Demands circulation. The Market is open for all entities willing to buy computations (Demands) or monetize computational resources (Offers).

Yagna Market API

The Yagna Market API is the entry to the Yagna Market through which Requestors and Providers can publish their Demands and Offers respectively, find matching counterparty, conduct negotiations and make an agreement.

This version of Market API conforms with capability level 1 of the <a href="https://docs.google.com/document/d/1Zny_vfgWV-hcsKS7P-Kdr3Fb0dwfl-6T_cYKVQ9mkNg\"> Market API specification.

Market API contains two roles: Requestors and Providers which are symmetrical most of the time (excluding agreement phase).

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.5.2
  • Package version:
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/prekucki/ya-client-python-market.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/prekucki/ya-client-python-market.git)

Then import the package:

import ya_market

Setuptools

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 ya_market

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function

import time
import ya_market
from ya_market.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost/market-api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = ya_market.Configuration(
    host = "http://localhost/market-api/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: app_key
configuration = ya_market.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)


# Enter a context with an instance of the API client
with ya_market.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ya_market.ProviderApi(api_client)
    agreement_id = 'agreement_id_example' # str | 
timeout = 3.4 # float | How many seconds server should wait for new events (0.0 means it should return immediately if there are no events)  (optional)

    try:
        # Approves Agreement proposed by the Reqestor.
        api_instance.approve_agreement(agreement_id, timeout=timeout)
    except ApiException as e:
        print("Exception when calling ProviderApi->approve_agreement: %s\n" % e)
    

Documentation for API Endpoints

All URIs are relative to http://localhost/market-api/v1

Class Method HTTP request Description
ProviderApi approve_agreement POST /agreements/{agreementId}/approve Approves Agreement proposed by the Reqestor.
ProviderApi collect_demands GET /offers/{subscriptionId}/events Reads Market responses to published Offer.
ProviderApi counter_proposal_offer POST /offers/{subscriptionId}/proposals/{proposalId} Responds with a bespoke Offer to received Demand.
ProviderApi get_agreement GET /agreements/{agreementId} Fetches agreement with given agreement id.
ProviderApi get_offers GET /offers Fetches all active Offers which have been published by the Provider.
ProviderApi get_proposal_demand GET /offers/{subscriptionId}/proposals/{proposalId} Fetches Proposal (Demand) with given id.
ProviderApi post_query_reply_offers POST /offers/{subscriptionId}/propertyQuery/{queryId} Handles dynamic property query.
ProviderApi reject_agreement POST /agreements/{agreementId}/reject Rejects Agreement proposed by the Requestor.
ProviderApi reject_proposal_demand DELETE /offers/{subscriptionId}/proposals/{proposalId} Rejects Proposal (Demand).
ProviderApi subscribe_offer POST /offers Publishes Provider capabilities via Offer.
ProviderApi terminate_agreement POST /agreements/{agreementId}/terminate Terminates approved Agreement.
ProviderApi unsubscribe_offer DELETE /offers/{subscriptionId} Stop subscription for previously published Offer.
RequestorApi cancel_agreement DELETE /agreements/{agreementId} Cancels agreement.
RequestorApi collect_offers GET /demands/{subscriptionId}/events Reads Market responses to published Demand.
RequestorApi confirm_agreement POST /agreements/{agreementId}/confirm Sends Agreement draft to the Provider.
RequestorApi counter_proposal_demand POST /demands/{subscriptionId}/proposals/{proposalId} Responds with a bespoke Demand to received Offer.
RequestorApi create_agreement POST /agreements Creates Agreement from selected Proposal.
RequestorApi get_agreement GET /agreements/{agreementId} Fetches agreement with given agreement id.
RequestorApi get_demands GET /demands Fetches all active Demands which have been published by the Requestor.
RequestorApi get_proposal_offer GET /demands/{subscriptionId}/proposals/{proposalId} Fetches Proposal (Offer) with given id.
RequestorApi post_query_reply_demands POST /demands/{subscriptionId}/propertyQuery/{queryId} Handles dynamic property query.
RequestorApi reject_proposal_offer DELETE /demands/{subscriptionId}/proposals/{proposalId} Rejects Proposal (Offer).
RequestorApi subscribe_demand POST /demands Publishes Requestor capabilities via Demand.
RequestorApi terminate_agreement POST /agreements/{agreementId}/terminate Terminates approved Agreement.
RequestorApi unsubscribe_demand DELETE /demands/{subscriptionId} Stop subscription for previously published Demand.
RequestorApi wait_for_approval POST /agreements/{agreementId}/wait Waits for Agreement approval by the Provider.

Documentation For Models

Documentation For Authorization

app_key

  • Type: Bearer authentication

Author

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors