[][src]Struct ya_client::market::MarketRequestorApi

pub struct MarketRequestorApi { /* fields omitted */ }

Bindings for Requestor part of the Market API.

Implementations

impl MarketRequestorApi[src]

pub async fn subscribe<'_, '_>(&'_ self, demand: &'_ Demand) -> Result<String>[src]

Publishes Requestor capabilities via Demand.

Demand object can be considered an "open" or public Demand, as it is not directed at a specific Provider, but rather is sent to the market so that the matching mechanism implementation can associate relevant Offers.

Note: it is an "atomic" operation, ie. as soon as Subscription is placed, the Demand is published on the market.

pub async fn get_demands<'_>(&'_ self) -> Result<Vec<Demand>>[src]

Fetches all active Demands which have been published by the Requestor.

pub async fn unsubscribe<'_, '_>(
    &'_ self,
    subscription_id: &'_ str
) -> Result<String>
[src]

Stop subscription by invalidating a previously published Demand.

pub async fn collect<'_, '_>(
    &'_ self,
    subscription_id: &'_ str,
    timeout: Option<f32>,
    maxEvents: Option<i32>
) -> Result<Vec<RequestorEvent>>
[src]

Get events which have arrived from the market in response to the Demand published by the Requestor via subscribe. Returns collection of at most max_events RequestorEvents or times out.

pub async fn counter_proposal<'_, '_, '_>(
    &'_ self,
    demand_proposal: &'_ Proposal,
    subscription_id: &'_ str
) -> Result<String>
[src]

Responds with a bespoke Demand to received Offer.

pub async fn get_proposal<'_, '_, '_>(
    &'_ self,
    subscription_id: &'_ str,
    proposal_id: &'_ str
) -> Result<Proposal>
[src]

Fetches Proposal (Offer) with given id.

pub async fn reject_proposal<'_, '_, '_>(
    &'_ self,
    subscription_id: &'_ str,
    proposal_id: &'_ str
) -> Result<String>
[src]

Rejects a bespoke Demand.

pub async fn create_agreement<'_, '_>(
    &'_ self,
    agreement: &'_ AgreementProposal
) -> Result<String>
[src]

Creates Agreement from selected Proposal.

Initiates the Agreement handshake phase.

Formulates an Agreement artifact from the Proposal indicated by the received Proposal Id.

The Approval Expiry Date is added to Agreement artifact and implies the effective timeout on the whole Agreement Confirmation sequence.

A successful call to create_agreement shall immediately be followed by a confirm_agreement and wait_for_approval call in order to listen for responses from the Provider.

Note: Moves given Proposal to Approved state.

pub async fn get_agreement<'_, '_>(
    &'_ self,
    agreement_id: &'_ str
) -> Result<Agreement>
[src]

Fetches agreement with given agreement id.

pub async fn confirm_agreement<'_, '_>(
    &'_ self,
    agreement_id: &'_ str
) -> Result<String>
[src]

Sends Agreement draft to the Provider. Signs Agreement self-created via create_agreement and sends it to the Provider.

pub async fn wait_for_approval<'_, '_>(
    &'_ self,
    agreement_id: &'_ str,
    timeout: Option<f32>
) -> Result<String>
[src]

Waits for Agreement approval by the Provider.

This is a blocking operation. The call may be aborted by Requestor caller code. After the call is aborted or timed out, another wait_for_approval call can be raised on the same agreement_id.

It returns one of the following options:

  • Approved - Indicates that the Agreement has been approved by the Provider.
  • The Provider is now ready to accept a request to start an Activity as described in the negotiated agreement.
  • The Requestor’s corresponding wait_for_approval call returns Ok after this on the Provider side.
  • Rejected - Indicates that the Provider has called reject_agreement, which effectively stops the Agreement handshake. The Requestor may attempt to return to the Negotiation phase by sending a new Proposal.

  • Cancelled - Indicates that the Requestor himself has called cancel_agreement, which effectively stops the Agreement handshake.

pub async fn cancel_agreement<'_, '_>(
    &'_ self,
    agreement_id: &'_ str
) -> Result<()>
[src]

Cancels agreement. Causes the awaiting wait_for_approval call to return with Cancelled response. Also the Provider's corresponding approve_agreement returns Cancelled.

pub async fn terminate_agreement<'_, '_>(
    &'_ self,
    agreement_id: &'_ str
) -> Result<String>
[src]

Terminates approved Agreement.

Trait Implementations

impl Clone for MarketRequestorApi[src]

impl WebInterface for MarketRequestorApi[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,