updatehub_cloud_sdk/
lib.rs

1// Copyright (C) 2020 O.S. Systems Sofware LTDA
2//
3// SPDX-License-Identifier: Apache-2.0
4
5pub mod api;
6mod client;
7
8pub use client::{get, Client};
9
10use derive_more::{Display, Error, From};
11
12pub type Result<T> = std::result::Result<T, Error>;
13
14#[derive(Debug, Display, Error, From)]
15pub enum Error {
16    #[display(fmt = "Package's signature validation has failed")]
17    InvalidSignature,
18    #[display(fmt = "Http response is missing Content Length")]
19    MissingContentLength,
20
21    Io(std::io::Error),
22    JsonParsing(serde_json::Error),
23    OpenSsl(openssl::error::ErrorStack),
24    ParseInt(std::num::ParseIntError),
25
26    Http(reqwest::Error),
27    #[display(fmt = "Invalid status response: {}", _0)]
28    InvalidStatusResponse(#[error(not(source))] reqwest::StatusCode),
29    #[display(fmt = "Invalid header value: {}", _0)]
30    HeaderParse(reqwest::header::ToStrError),
31    #[display(fmt = "Invalid url: {}", _0)]
32    UrlParse(url::ParseError),
33}