Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort the providers and fix the lint error #25

Merged
merged 2 commits into from
Mar 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ pub enum Provider {
/// A token string which you may obtain on the provider web service page.
token: String,
},
/// <https://biturl.top> provider
BitUrl,
/// <http://bmeo.org> provider
Bmeo,
/// <http://fifo.cc> provider
Expand Down Expand Up @@ -246,8 +248,6 @@ pub enum Provider {
UrlShortenerIo,
/// <https://v.gd> provider
VGd,
/// <https://biturl.top> provider
BitUrl
}

impl Provider {
Expand All @@ -257,6 +257,7 @@ impl Provider {
Provider::Abv8 => "abv8.me",
Provider::BamBz => "bam.bz",
Provider::BitLy { .. } => "bitly.com",
Provider::BitUrl => "biturl.top",
Provider::Bmeo => "bmeo.org",
Provider::FifoCc => "fifo.cc",
Provider::GooGl { .. } => "goo.gl",
Expand All @@ -278,7 +279,6 @@ impl Provider {
Provider::TnyIm => "tny.im",
Provider::UrlShortenerIo => "url-shortener.io",
Provider::VGd => "v.gd",
Provider::BitUrl => "biturl.top",
}
}
}
Expand Down Expand Up @@ -482,6 +482,7 @@ pub fn parse(res: &str, provider: &Provider) -> Result<String, ProviderError> {
Provider::Abv8 => abv8_parse(res),
Provider::BamBz => bambz_parse(res),
Provider::BitLy { .. } => bitly_parse(res),
Provider::BitUrl => biturl_parse(res),
Provider::Bmeo => bmeo_parse(res),
Provider::FifoCc => fifocc_parse(res),
Provider::GooGl { .. } => googl_parse(res),
Expand All @@ -500,7 +501,6 @@ pub fn parse(res: &str, provider: &Provider) -> Result<String, ProviderError> {
Provider::TnyIm => tnyim_parse(res),
Provider::UrlShortenerIo => urlshortenerio_parse(res),
Provider::VGd => vgd_parse(res),
Provider::BitUrl => biturl_parse(res),
}
.ok_or(ProviderError::Deserialize)
}
Expand All @@ -527,6 +527,7 @@ pub fn request(url: &str, provider: &Provider) -> req::Request {
Provider::Abv8 => abv8_req(url),
Provider::BamBz => bambz_req(url),
Provider::BitLy { ref token } => bitly_req(url, token),
Provider::BitUrl => biturl_req(url),
Provider::Bmeo => bmeo_req(url),
Provider::FifoCc => fifocc_req(url),
Provider::GooGl { ref api_key } => googl_req(url, api_key),
Expand All @@ -548,6 +549,5 @@ pub fn request(url: &str, provider: &Provider) -> req::Request {
Provider::TnyIm => tnyim_req(url),
Provider::UrlShortenerIo => urlshortenerio_req(url),
Provider::VGd => vgd_req(url),
Provider::BitUrl => biturl_req(url),
}
}
Loading