Skip to content

Commit

Permalink
Progress in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
GilOliveira committed Aug 20, 2023
1 parent 98bbcee commit 0de648e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -530,7 +528,6 @@ impl OmglolClient {
}
}


/// OmglolClient allows you to make authenticated or unauthenticated REST API
/// requests.
impl<State> OmglolClient<State> {
Expand Down
32 changes: 23 additions & 9 deletions src/structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
}

Expand Down

0 comments on commit 0de648e

Please sign in to comment.