~gpo/omglolrs

0de648ec2f405cb7fc0433be4d3a347b47d3f641 — Gil Poiares-Oliveira 1 year, 2 months ago 98bbcee
Progress in documentation
3 files changed, 32 insertions(+), 15 deletions(-)

M README.md
M src/client.rs
M src/structures.rs
M README.md => README.md +8 -2
@@ 3,9 3,15 @@ An asynchronous Rust wrapper for the omg.lol API by [Gil](https://gil.lol).

LICENSE: MPL 2.0 (see [`LICENSE`](/LICENSE))

> **Warning**: **This is a work in progress**
> **Warning**: **Heads up! This is a public alpha for adventurous folks!**
>
> Unstable and bug-prone. Endpoints may change. Upstream endpoints under development.
> Keep in mind:
> All basic features should be implemented and functional
> Not all features have been throughly tested
> Endpoints are bound to change
> Bugs and unresolved issues are bound to come up
> This is available as-is and with no support or warranty
> Upstream endpoints are bound to change and will break this crate

## Contribute


M src/client.rs => src/client.rs +1 -4
@@ 31,7 31,6 @@ pub(crate) use api_endpoint;
pub struct Auth;
pub struct NoAuth;


/// Client for api.omg.lol
#[derive(Clone)]
pub struct OmglolClient<State = NoAuth> {


@@ 385,11 384,10 @@ impl OmglolClient<Auth> {
}

impl OmglolClient<NoAuth> {

    /// Create an authenticated `OmglolClient`.
    ///
    /// This client is able to access private endpoints.
    /// 
    ///
    /// Example:
    /// ```rust
    /// let client = OmglolClient::new()


@@ 530,7 528,6 @@ impl OmglolClient {
    }
}


/// OmglolClient allows you to make authenticated or unauthenticated REST API
/// requests.
impl<State> OmglolClient<State> {

M src/structures.rs => src/structures.rs +23 -9
@@ 444,18 444,25 @@ impl Web {

#[derive(Deserialize, Debug)]
pub struct WeblogEntriesResponse {
    /// Status message povided by the API
    message: String,

    /// A vector of `WeblogEntry` structs.
    entries: Vec<WeblogEntry>,
}

/// API response for a weblog entry GET request.
#[derive(Deserialize, Debug)]
pub struct WeblogEntryResponse {
    message: String,
    /// Status message povided by the API
    pub message: String,

    /// Weblog entry
    #[serde(alias = "post")]
    entry: WeblogEntry,
    pub entry: WeblogEntry,
}

/// A weblog entry
#[derive(Deserialize, Debug)]
pub struct WeblogEntry {
    location: String,


@@ 472,25 479,29 @@ pub struct WeblogEntry {
    entry_type: String,
}

/// Metadata for a weblog entry.
#[derive(Deserialize, Debug)]
pub struct WeblogMetadata {
    date: String,
    slug: String,
    pub date: String,
    pub slug: String,
}

/// API resopnse for a weblog configuration GET request.
#[derive(Deserialize, Debug)]
pub struct WeblogConfigurationResponse {
    message: String,
    configuration: WeblogConfigurationFormats,
    pub message: String,
    pub configuration: WeblogConfigurationFormats,
}

/// Weblog configuration in different formats
#[derive(Deserialize, Debug)]
pub struct WeblogConfigurationFormats {
    object: WeblogConfiguration,
    json: String,
    raw: String,
    pub object: WeblogConfiguration,
    pub json: String,
    pub raw: String,
}

/// A weblog's configuration.
#[derive(Deserialize, Debug)]
pub struct WeblogConfiguration {
    pub weblog_title: String,


@@ 510,14 521,17 @@ pub struct WeblogConfiguration {
    pub search_results_format: String,
}

/// API response for a weblog template GET request.
#[derive(Deserialize, Debug)]
pub struct WeblogTemplateResponse {
    pub message: String,
    pub template: String,
}

/// An HTTP request error
#[derive(Debug, Clone)]
pub struct RequestError {
    /// HTTP status code as defined in [RFC 9110](https://httpwg.org/specs/rfc9110.html#overview.of.status.codes).
    pub status_code: u16,
}