Public Yagna REST APIs client binding with Data Model and specifications in OpenAPI format.
REST API documentation is available here.
GSB API documentation page.
Specification for REST API in yagna
Home Page: https://golemfactory.github.io/ya-client/
License: GNU Lesser General Public License v3.0
progress
option.Both unsubscribe's should result with ()
and now results with String
.
Comply with yaml which specifies204
code
Base URLs for yagna APIs specified in the command line or via environment vars are truncated to the last '/', which may lead to confusing agent behaviour.
For example, with the environment variable YAGNA_MARKET_URL
set to http://127.0.0.1:5001/market-api/v1" the agent will use just
http://127.0.0.1:5001/market-api/`, without the trailing v1
as the base URL which will lead to errors.
This happens because of the Url::join
method from the url
crate treats v1
above as referring to a file:
use url::{Url, ParseError};
fn test() -> Result<(),ParseError> {
let base_url_str = "http://0.0.0.0:6000/market-api/v1";
{
let base_url = Url::parse(base_url_str)?;
let url = base_url.join("operation")?;
assert_eq!(url.as_str(), "http://0.0.0.0:6000/market-api/operation");
}
{
let base_url = Url::parse(&format!("{}/", base_url_str))?;
let url = base_url.join("operation")?;
assert_eq!(url.as_str(), "http://0.0.0.0:6000/market-api/v1/operation");
}
Ok(())
}
I think all base URLs that are not terminated with "/" should have the '/' character appended.
Why:
What:
DELETE /allocation/{allocation_id}
endpoint in payment apiCurrently only default configuration can be used because ProviderApiConfig
and RequestorApiConfig
have private fields and no constructor. Preferred manner for handling this is:
Notify SDK or address the issue
Refactor of Event flow from all Functional APIs into a dedicated Event API.
Event API shall follow the specs as defined here.
API: Market
Endpoint: POST /agreements/{agreementId}/terminate
(on both provider and requestor APIs)
For the above endpoint, only agreementId
parameter is marked as required in the API spec. Request body is marked as optional (and is generated as such). However, using this endpoint I found out that the request body is required and must include a message
field.
Otherwise, the server returns a 400
with either Json deserialize error: EOF while parsing a value at line 1 column 0
or Json deserialize error: missing field
message at line 1 column 2
, depending on whether we pass an empty request body or not.
... while its well known enum. Instead string is used.
I don't really know ya-client
so I'm not sure how to state the issue correctly and what really needs fixing here.
Nevertheless, let's take a look for example at ya_market.models.proposal.Proposal
and the proposal_id
attribute (other Proposal
attributes and other classes have similar "problems"):
class Proposal(object):
openapi_types = {
'proposal_id': 'str',
}
attribute_map = {
'proposal_id': 'proposalId',
}
def __init__(self, properties=None, constraints=None, proposal_id=None, issuer_id=None, state=None, timestamp=None, prev_proposal_id=None, local_vars_configuration=None): # noqa: E501
self._proposal_id = None
self.proposal_id = proposal_id
@property
def proposal_id(self):
return self._proposal_id
@proposal_id.setter
def proposal_id(self, proposal_id):
if self.local_vars_configuration.client_side_validation and proposal_id is None: # noqa: E501
raise ValueError("Invalid value for `proposal_id`, must not be `None`") # noqa: E501
self._proposal_id = proposal_id
All of this together adds up to "If we have self.local_vars_configuration.client_side_validation
then proposal_id
is required and must not be None
".
So the main question is - what is this self.local_vars_configuration.client_side_validation
& do we really need an option to initialize a Proposal without proposal_id
? Because there is a cost behind such construction: static type checkers are not clever enough to understand this. So e.g. writing:
class OfferProposal(object):
def __init__(self, subscription: "Subscription", proposal: models.ProposalEvent):
self._proposal: models.ProposalEvent = proposal
@property
def id(self) -> str:
return self._proposal.proposal.proposal_id
makes mypy
sad:
Incompatible return value type (got "Optional[str]", expected "str")
--> it would be nice to somehow improve the typing here.
in SecureActivityRequestorApi::from_response
It doesn't make sense to query 0 events, but I implemented it like this since spec requires ;)
Needs changes in spec
@mfranciszkiewicz you are removing timeout
in this PR, but the comment is unchanged and still requires to specify timeout
Originally posted by @tworec in #68 (comment)
Spinned out of golemfactory/yagna#2294, not doing the whole task as it wasn't planned and we don't need that yet (yagna has a different workaround)
https://github.com/golemfactory/ya-client/blob/master/specs/payment-api.yaml#L1412-L1417 Is missing invoiceId
https://github.com/golemfactory/ya-client/blob/master/specs/payment-api.yaml#L1493-L1498 Is missing debitNoteId
Once fixed make sure to fix :
https://github.com/golemfactory/golem-js/blob/master/src/payment/payments.ts#L80-L82
https://github.com/golemfactory/golem-js/blob/master/src/payment/payments.ts#L129-L131
While working on the requestor agent for the python integration tests i found some improvements to the swagger files:
str(datetime.now)
requires an extra Z
at the endStatePair
is not implemented in activity-api.yml
, but available in model/...
https://github.com/golemfactory/ya-client/blob/master/model/src/activity/activity_state.rs#L54Collect events can have optional timeout. It is unspecified what happens if timeout is not set.
I would assume it means 0 timeout, and call should return immediately.
Probably we should mention this in spec.
Check specs/common.yaml
file
relates to #53
Warning: named_arguments_used_positionally
Triggered by: url_format!("{}", arg);
Why: Macro expansion changes all arguments into named ones, and Rust warns about positional uses of named macros since 1.64.0.
chrono
deprecated Date
in 0.4.23
, but changing it will affect ya-client
public API.
As in title
For the yagna-integration level 1 project i have generated the swagger models and client side library.
It seems they belong in the ya-client repository, next to the rust models.
[email protected]
) and apply 3 git patches in a github jobApply changes requested by @stranger80 in PR:
#124
We agreed that agreement events serves a purpose of audit log for Agreement.
It is to be decided how to present this log/history for particular Agreement. Possibilities that we see:
collectAgreementEvents
by agreementId
getAgreement
endpoint to contain related events or at least termination reason.Originally posted by @tworec in #61 (comment)
Let's strive to always populate the topic golem here on Github to show how much of an ecosystem we have.
https://github.com/topics/golem
Please support it by adding the topic golem
to this repo.
In spec it's described as a string with value from an enum.
In implementation it's pub struct StatePair(pub State, pub Option<State>);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.