pub struct DynastyApi { /* private fields */ }
Expand description

Dynasty reader’s JSON API client.

Implementations

Creates a DynastyApi client.

DynastyApi is wrapped inside an Arc internally, so you don’t need to wrap it inside an Arc to reuse it.

See with_base if you want to create a DynastyApi client with a custom base.

Examples
let dynasty = DynastyApi::new();

Creates a DynastyApi client with a custom base url.

base is assumed to be compatible with https://dynasty-scans.com / route.

Examples

Create a client with custom base url.

let dynasty = DynastyApi::with_base("https://dynasty-proxy.netlify.app/");
Panics

Panics if it fails to parse the base url as Url.

let _ = DynastyApi::with_base("invalid-url");

Or if you supplied a base url that cannot be used as base.

let _ = DynastyApi::with_base("data:text/plain,Stuff");

List Dynasty reader’s DirectoryListing with pagination.

sample: directory::sample

Examples

List anthologies at page 1.

let kind = TagKind::Anthology;
let anthology_1 = dynasty.list_directory(kind, 1).await?;

You can use total_pages and current_page from DirectoryListing as limit and pointer respectively, you can use DirectoryListing::next_page method to get the next page easily.

let kind = TagKind::Series;
let series_1 = dynasty.list_directory(kind, 1).await?;
let next = series_1.next_page();
assert_eq!(next, Some(2));

Keep in mind that if you exceed the limit you won’t get any error or whatsoever, but you will instead get an empty tags.

let kind = TagKind::Scanlator;
let scanlator_65535 = dynasty.list_directory(kind, 65535).await?;
assert!(scanlator_65535.tags.is_empty());

List Dynasty reader’s TagListing.

sample: tag::sample

If you use &str, it must follow one of the formats below:

  • {kind}/{permalink} where kind must be parse-able into TagKind while permalink can be anything.
  • {permalink} it’ll be as if you wrote tags/{permalink}.
Examples
// valid
assert!(dynasty.list_tag("authors/manio").await.is_ok());
// also valid
assert!(dynasty.list_tag("tags/bread").await.is_ok());
// same as above
assert!(dynasty.list_tag("bread").await.is_ok());

// you could also use the `title`
assert!(dynasty.list_tag("404: Men Not Found").await.is_ok());
// above will be parsed as "tags/404_men_not_found"

Get a Dynasty reader’s Chapter.

sample: chapter::sample

If you use &str, it must follow one of the formats below:

  • chapters/{permalink} where permalink can be anything.
  • {permalink} it’ll be as if you wrote chapters/{permalink}.
Examples
// valid
assert!(dynasty.chapter("chapters/kichiku_yousei").await.is_ok());
// same as above
assert!(dynasty.chapter("kichiku_yousei").await.is_ok());

// you could also use the `title`
assert!(dynasty.chapter("Adachi and Shimamura (Moke ver.) ch27.1").await.is_ok());
// above will be parsed as "chapters/adachi_and_shimamura_moke_ver_ch27_1"

// `long_title` also works
assert!(dynasty.chapter("Adachi and Shimamura (Moke ver.) ch27.1: Leaving Azure").await.is_ok());

Get the base url used to create this DynastyApi.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more