Tag fetching and caching (#59)

* basic framework. still has errors

* added functionality for main endpoints + some structuring

* formatting

* unused code

* mimicked CLI function with wait_for process

* added basic auth bindings

* made PR changes, added playground

* cargo fmt

* removed missed println

* misc tests fixes

* cargo fmt

* added windows support

* cargo fmt

* all OS use dunce

* restructured profile slightly; fixed mac bug

* profile changes, new main.rs

* fixed requested pr + canonicaliation bug

* fixed regressed bug in ui

* fixed regressed bugs

* fixed git error

* typo

* ran prettier

* clippy

* playground clippy

* ported profile loading fix

* profile change for real, url println and clippy

* PR changes

* auth bindings + semisynch flow

* fixed dropping task error

* prettier, eslint, clippy

* removed debugging modifications

* removed unused function that eslinter missed :(

* initial errored push

* working draft

* added tag system!

* fixed merge issue

---------

Co-authored-by: Wyatt <wyatt@modrinth.com>
This commit is contained in:
Wyatt Verchere
2023-04-03 16:08:53 -07:00
committed by GitHub
parent a13b7a2566
commit b0c830119b
9 changed files with 436 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
pub mod auth;
pub mod profile;
pub mod profile_create;
pub mod tags;
pub mod settings;
pub mod data {

71
theseus/src/api/tags.rs Normal file
View File

@@ -0,0 +1,71 @@
//! Theseus tag management interface
pub use crate::{
state::{
Category, DonationPlatform, GameVersion, License, Loader, TagBundle,
},
State,
};
// Get bundled set of tags
#[tracing::instrument]
pub async fn get_tag_bundle() -> crate::Result<TagBundle> {
let state = State::get().await?;
let tags = state.tags.read().await;
tags.get_tag_bundle()
}
/// Get category tags
#[tracing::instrument]
pub async fn get_category_tags() -> crate::Result<Vec<Category>> {
let state = State::get().await?;
let tags = state.tags.read().await;
tags.get_categories()
}
/// Get report type tags
#[tracing::instrument]
pub async fn get_report_type_tags() -> crate::Result<Vec<String>> {
let state = State::get().await?;
let tags = state.tags.read().await;
tags.get_report_types()
}
/// Get loader tags
#[tracing::instrument]
pub async fn get_loader_tags() -> crate::Result<Vec<Loader>> {
let state = State::get().await?;
let tags = state.tags.read().await;
tags.get_loaders()
}
/// Get game version tags
#[tracing::instrument]
pub async fn get_game_version_tags() -> crate::Result<Vec<GameVersion>> {
let state = State::get().await?;
let tags = state.tags.read().await;
tags.get_game_versions()
}
/// Get license tags
#[tracing::instrument]
pub async fn get_license_tags() -> crate::Result<Vec<License>> {
let state = State::get().await?;
let tags = state.tags.read().await;
tags.get_licenses()
}
/// Get donation platform tags
#[tracing::instrument]
pub async fn get_donation_platform_tags() -> crate::Result<Vec<DonationPlatform>>
{
let state = State::get().await?;
let tags = state.tags.read().await;
tags.get_donation_platforms()
}