pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
Sourcepub fn new(config: Config) -> Result<Self, ClientError>
pub fn new(config: Config) -> Result<Self, ClientError>
Sourcepub async fn get_feeds(&self) -> Result<Vec<Feed>, ClientError>
pub async fn get_feeds(&self) -> Result<Vec<Feed>, ClientError>
Returns a list of available feeds.
§Endpoint:
/api/v1/feeds§Type:
- HTTP GET
§Sample request:
GET /api/v1/feeds§Error Response Codes
| Status Code | Description |
|---|---|
| 400 Bad Request | This error is triggered when: - There is any missing/malformed query argument. - Required headers are missing or provided with incorrect values. |
| 401 Unauthorized User | This error is triggered when: - Authentication fails, typically because the HMAC signature provided by the client doesn’t match the one expected by the server. - A user requests access to a feed without the appropriate permission or that does not exist. |
| 500 Internal Server | Indicates an unexpected condition encountered by the server, preventing it from fulfilling the request. This error typically points to issues on the server side. |
Sourcepub async fn get_latest_report(
&self,
feed_id: ID,
) -> Result<ReportResponse, ClientError>
pub async fn get_latest_report( &self, feed_id: ID, ) -> Result<ReportResponse, ClientError>
Returns a single report with the latest timestamp.
§Endpoint:
/api/v1/reports/latest§Type:
- HTTP GET
§Parameters:
feedID- A Data Streams feed ID.
§Sample request:
GET /api/v1/reports/latest?feedID={feedID}§Sample response:
{
"report": {
"feedID": "Hex encoded feedId.",
"validFromTimestamp": "Report's earliest applicable timestamp (in seconds).",
"observationsTimestamp": "Report's latest applicable timestamp (in seconds).",
"fullReport": "A blob containing the report context and body. Encode the fee token into the payload before passing it to the contract for verification."
}
}§Error Response Codes
| Status Code | Description |
|---|---|
| 400 Bad Request | This error is triggered when: - There is any missing/malformed query argument. - Required headers are missing or provided with incorrect values. |
| 401 Unauthorized User | This error is triggered when: - Authentication fails, typically because the HMAC signature provided by the client doesn’t match the one expected by the server. - A user requests access to a feed without the appropriate permission or that does not exist. |
| 500 Internal Server | Indicates an unexpected condition encountered by the server, preventing it from fulfilling the request. This error typically points to issues on the server side. |
Sourcepub async fn get_report(
&self,
feed_id: ID,
timestamp: u128,
) -> Result<ReportResponse, ClientError>
pub async fn get_report( &self, feed_id: ID, timestamp: u128, ) -> Result<ReportResponse, ClientError>
Returns a single report at a given timestamp.
§Endpoint:
/api/v1/reports§Type:
- HTTP GET
§Parameters:
feedID- A Data Streams feed ID.timestamp- The Unix timestamp for the report (in seconds).
§Sample request:
GET /api/v1/reports?feedID={feedID}×tamp={timestamp}§Sample response:
{
"report": {
"feedID": "Hex encoded feedId.",
"validFromTimestamp": "Report's earliest applicable timestamp (in seconds).",
"observationsTimestamp": "Report's latest applicable timestamp (in seconds).",
"fullReport": "A blob containing the report context and body. Encode the fee token into the payload before passing it to the contract for verification."
}
}§Error Response Codes
| Status Code | Description |
|---|---|
| 400 Bad Request | This error is triggered when: - There is any missing/malformed query argument. - Required headers are missing or provided with incorrect values. |
| 401 Unauthorized User | This error is triggered when: - Authentication fails, typically because the HMAC signature provided by the client doesn’t match the one expected by the server. - A user requests access to a feed without the appropriate permission or that does not exist. |
| 500 Internal Server | Indicates an unexpected condition encountered by the server, preventing it from fulfilling the request. This error typically points to issues on the server side. |
Sourcepub async fn get_reports_bulk(
&self,
feed_ids: &[ID],
timestamp: u128,
) -> Result<Vec<Report>, ClientError>
pub async fn get_reports_bulk( &self, feed_ids: &[ID], timestamp: u128, ) -> Result<Vec<Report>, ClientError>
Returns a report for multiple FeedIDs at a given timestamp.
§Endpoint:
/api/v1/reports/bulk§Type:
- HTTP GET
§Parameters:
feedIDs- A comma-separated list of Data Streams feed IDs.timestamp- The Unix timestamp for the reports (in seconds).
§Sample request:
GET /api/v1/reports/bulk?feedIDs={FeedID1},{FeedID2},...×tamp={timestamp}§Sample response:
{
"reports": [
{
"feedID": "Hex encoded feedId.",
"validFromTimestamp": "Report's earliest applicable timestamp (in seconds).",
"observationsTimestamp": "Report's latest applicable timestamp (in seconds).",
"fullReport": "A blob containing the report context and body. Encode the fee token into the payload before passing it to the contract for verification."
},
//...
]
}§Error Response Codes
| Status Code | Description |
|---|---|
| 400 Bad Request | This error is triggered when: - There is any missing/malformed query argument. - Required headers are missing or provided with incorrect values. |
| 401 Unauthorized User | This error is triggered when: - Authentication fails, typically because the HMAC signature provided by the client doesn’t match the one expected by the server. - A user requests access to a feed without the appropriate permission or that does not exist. |
| 500 Internal Server | Indicates an unexpected condition encountered by the server, preventing it from fulfilling the request. This error typically points to issues on the server side. |
| 206 Missing Data | Indicates that at least one feed ID data is missing from the report. E.g., you requested a report for feed IDs <feedID1>, <feedID2>, and <feedID3> at a given timestamp. If data for <feedID2> is missing from the report (not available yet at the specified timestamp), you get [<feedID1 data>, <feedID3 data>] and a 206 response. |
Sourcepub async fn get_reports_page(
&self,
feed_id: ID,
start_timestamp: u128,
) -> Result<Vec<Report>, ClientError>
pub async fn get_reports_page( &self, feed_id: ID, start_timestamp: u128, ) -> Result<Vec<Report>, ClientError>
Returns multiple sequential reports for a single FeedID, starting at a given timestamp
§Endpoint:
/api/v1/reports§Type:
- HTTP GET
§Parameters:
feedID- A Data Streams feed ID.startTimestamp- The UNIX timestamp for the first report (in seconds).
§Sample request:
GET /api/v1/reports/page?feedID={FeedID}&startTimestamp={StartTimestamp}§Sample response:
{
"reports": [
{
"feedID": "Hex encoded feedId.",
"validFromTimestamp": "Report's earliest applicable timestamp (in seconds).",
"observationsTimestamp": "Report's latest applicable timestamp (in seconds).",
"fullReport": "A blob containing the report context and body. Encode the fee token into the payload before passing it to the contract for verification."
},
//...
]
}§Error Response Codes
| Status Code | Description |
|---|---|
| 400 Bad Request | This error is triggered when: - There is any missing/malformed query argument. - Required headers are missing or provided with incorrect values. |
| 401 Unauthorized User | This error is triggered when: - Authentication fails, typically because the HMAC signature provided by the client doesn’t match the one expected by the server. - A user requests access to a feed without the appropriate permission or that does not exist. |
| 500 Internal Server | Indicates an unexpected condition encountered by the server, preventing it from fulfilling the request. This error typically points to issues on the server side. |
Sourcepub async fn get_reports_page_with_limit(
&self,
feed_id: ID,
start_timestamp: u128,
limit: usize,
) -> Result<Vec<Report>, ClientError>
pub async fn get_reports_page_with_limit( &self, feed_id: ID, start_timestamp: u128, limit: usize, ) -> Result<Vec<Report>, ClientError>
Returns multiple sequential reports for a single FeedID, starting at a given timestamp
§Endpoint:
/api/v1/reports§Type:
- HTTP GET
§Parameters:
feedID- A Data Streams feed ID.startTimestamp- The UNIX timestamp for the first report (in seconds).limit- The number of reports to return
§Sample request:
GET /api/v1/reports/page?feedID={FeedID}&startTimestamp={StartTimestamp}&limit={Limit}§Sample response:
{
"reports": [
{
"feedID": "Hex encoded feedId.",
"validFromTimestamp": "Report's earliest applicable timestamp (in seconds).",
"observationsTimestamp": "Report's latest applicable timestamp (in seconds).",
"fullReport": "A blob containing the report context and body. Encode the fee token into the payload before passing it to the contract for verification."
},
//...
]
}§Error Response Codes
| Status Code | Description |
|---|---|
| 400 Bad Request | This error is triggered when: - There is any missing/malformed query argument. - Required headers are missing or provided with incorrect values. |
| 401 Unauthorized User | This error is triggered when: - Authentication fails, typically because the HMAC signature provided by the client doesn’t match the one expected by the server. - A user requests access to a feed without the appropriate permission or that does not exist. |
| 500 Internal Server | Indicates an unexpected condition encountered by the server, preventing it from fulfilling the request. This error typically points to issues on the server side. |
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more