Skip to content

Commit 28dfebf

Browse files
feat: market module (#16)
Co-authored-by: Matej Voboril <[email protected]>
1 parent 7e05df4 commit 28dfebf

16 files changed

+852
-113
lines changed

.github/workflows/release.yml

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
name: CI
12
on:
23
push:
34
branches:
@@ -10,24 +11,20 @@ jobs:
1011
get-next-version:
1112
uses: semantic-release-action/next-release-version/.github/workflows/next-release-version.yml@v4
1213

13-
build:
14-
name: Build
14+
commitlint:
15+
name: CommitLint
1516
runs-on: ubuntu-latest
16-
needs:
17-
- get-next-version
18-
1917
steps:
2018
- name: Checkout
2119
uses: actions/checkout@v4
2220
with:
23-
persist-credentials: false
24-
fetch-depth: 0
25-
# checkout as wfcd-bot-boi
26-
token: ${{ secrets.GH_TOKEN }}
21+
fetch-depth: 0
22+
2723
- name: Setup Node.js
2824
uses: actions/setup-node@v4
2925
with:
3026
node-version: lts/*
27+
3128
- name: Install Commitlint dependencies
3229
run: npm install --global @commitlint/{cli,config-conventional}
3330

@@ -39,6 +36,20 @@ jobs:
3936
if: github.event_name == 'push'
4037
run: npx commitlint --last --verbose
4138

39+
build:
40+
name: Build
41+
runs-on: ubuntu-latest
42+
needs:
43+
- get-next-version
44+
- commitlint
45+
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
with:
50+
persist-credentials: false
51+
# checkout as wfcd-bot-boi
52+
token: ${{ secrets.GH_TOKEN }}
4253

4354
- name: Install semantic-release-cargo
4455
if: needs.get-next-version.outputs.new-release-published == 'true'
@@ -67,6 +78,7 @@ jobs:
6778
- name: Semantic Release
6879
id: release
6980
uses: cycjimmy/[email protected]
81+
if: needs.get-next-version.outputs.new-release-published == 'true'
7082
env:
7183
# push as wfcd-bot-boi
7284
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

.vscode/test.code-snippets

+77-77
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,79 @@
11
{
2-
// Place your warframe workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3-
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4-
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5-
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6-
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7-
// Placeholders with the same ids are connected.
8-
// Example:
9-
"Test a model (RTObj)": {
10-
"scope": "rust",
11-
"prefix": "model_test",
12-
"body": [
13-
"#[cfg(test)]"
14-
"mod test {"
15-
" use super::${1:model};"
16-
" use crate::worldstate::{client::Client, error::ApiError};"
17-
""
18-
" #[cfg(not(feature = \"multilangual\"))]"
19-
" #[tokio::test]"
20-
" async fn test_${1/(.*)/${1:/downcase}/}() -> Result<(), ApiError> {"
21-
" let client = Client::new();"
22-
""
23-
" match client.fetch::<${1:model}>().await {"
24-
" Ok(_${1/(.*)/${1:/downcase}/}) => Ok(()),"
25-
" Err(why) => Err(why),"
26-
" }"
27-
" }"
28-
""
29-
" #[cfg(feature = \"multilangual\")]"
30-
" #[tokio::test]"
31-
" async fn test_${1/(.*)/${1:/downcase}/}_ml() -> Result<(), ApiError> {"
32-
" use crate::worldstate::prelude::Language;"
33-
""
34-
" let client = Client::new();"
35-
""
36-
" match client.fetch_using_lang::<${1:model}>(Language::ZH).await {"
37-
" Ok(_${1/(.*)/${1:/downcase}/}) => Ok(()),"
38-
" Err(why) => Err(why),"
39-
" }"
40-
" }"
41-
"}"
42-
]
43-
},
44-
"Test a model (RTArray)": {
45-
"scope": "rust",
46-
"prefix": "model_test_array",
47-
"body": [
48-
"#[cfg(test)]"
49-
"mod test {"
50-
" use super::${1:model};"
51-
" use crate::worldstate::{client::Client, error::ApiError};"
52-
""
53-
" #[cfg(not(feature = \"multilangual\"))]"
54-
" #[tokio::test]"
55-
" async fn test_${1/(.*)/${1:/downcase}/}() -> Result<(), ApiError> {"
56-
" let client = Client::new();"
57-
""
58-
" match client.fetch_arr::<${1:model}>().await {"
59-
" Ok(_${1/(.*)/${1:/downcase}/}s) => Ok(()),"
60-
" Err(why) => Err(why),"
61-
" }"
62-
" }"
63-
""
64-
" #[cfg(feature = \"multilangual\")]"
65-
" #[tokio::test]"
66-
" async fn test_${1/(.*)/${1:/downcase}/}_ml() -> Result<(), ApiError> {"
67-
" use crate::worldstate::prelude::Language;"
68-
""
69-
" let client = Client::new();"
70-
""
71-
" match client.fetch_arr_using_lang::<${1:model}>(Language::ZH).await {"
72-
" Ok(_${1/(.*)/${1:/downcase}/}s) => Ok(()),"
73-
" Err(why) => Err(why),"
74-
" }"
75-
" }"
76-
"}"
77-
]
78-
}
2+
// Place your warframe workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3+
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4+
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5+
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7+
// Placeholders with the same ids are connected.
8+
// Example:
9+
"Test a model (RTObj)": {
10+
"scope": "rust",
11+
"prefix": "model_test",
12+
"body": [
13+
"#[cfg(test)]",
14+
"mod test {",
15+
" use super::${1:model};",
16+
" use crate::worldstate::{client::Client, error::ApiError};",
17+
"",
18+
" #[cfg(not(feature = \"multilangual\"))]",
19+
" #[tokio::test]",
20+
" async fn test_${1/(.*)/${1:/downcase}/}() -> Result<(), ApiError> {",
21+
" let client = Client::new();",
22+
"",
23+
" match client.fetch::<${1:model}>().await {",
24+
" Ok(_${1/(.*)/${1:/downcase}/}) => Ok(()),",
25+
" Err(why) => Err(why),",
26+
" }",
27+
" }",
28+
"",
29+
" #[cfg(feature = \"multilangual\")]",
30+
" #[tokio::test]",
31+
" async fn test_${1/(.*)/${1:/downcase}/}_ml() -> Result<(), ApiError> {",
32+
" use crate::worldstate::prelude::Language;",
33+
"",
34+
" let client = Client::new();",
35+
"",
36+
" match client.fetch_using_lang::<${1:model}>(Language::ZH).await {",
37+
" Ok(_${1/(.*)/${1:/downcase}/}) => Ok(()),",
38+
" Err(why) => Err(why),",
39+
" }",
40+
" }",
41+
"}",
42+
]
43+
},
44+
"Test a model (RTArray)": {
45+
"scope": "rust",
46+
"prefix": "model_test_array",
47+
"body": [
48+
"#[cfg(test)]",
49+
"mod test {",
50+
" use super::${1:model};",
51+
" use crate::worldstate::{client::Client, error::ApiError};",
52+
"",
53+
" #[cfg(not(feature = \"multilangual\"))]",
54+
" #[tokio::test]",
55+
" async fn test_${1/(.*)/${1:/downcase}/}() -> Result<(), ApiError> {",
56+
" let client = Client::new();",
57+
"",
58+
" match client.fetch_arr::<${1:model}>().await {",
59+
" Ok(_${1/(.*)/${1:/downcase}/}s) => Ok(()),",
60+
" Err(why) => Err(why),",
61+
" }",
62+
" }",
63+
"",
64+
" #[cfg(feature = \"multilangual\")]",
65+
" #[tokio::test]",
66+
" async fn test_${1/(.*)/${1:/downcase}/}_ml() -> Result<(), ApiError> {",
67+
" use crate::worldstate::prelude::Language;",
68+
"",
69+
" let client = Client::new();",
70+
"",
71+
" match client.fetch_arr_using_lang::<${1:model}>(Language::ZH).await {",
72+
" Ok(_${1/(.*)/${1:/downcase}/}s) => Ok(()),",
73+
" Err(why) => Err(why),",
74+
" }",
75+
" }",
76+
"}",
77+
]
78+
}
7979
}

Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@ worldstate = []
1717
multilangual = ["worldstate"]
1818
worldstate_listeners = ["worldstate"]
1919
worldstate_full = ["worldstate", "multilangual", "worldstate_listeners"]
20-
20+
market = []
21+
market_cache = ["market", "dep:moka"]
22+
market_full = ["market", "market_cache"]
2123

2224
[dependencies]
2325
tokio = { version = "1.34.0", features = ["full"] }
2426
reqwest = { version = "0.11.22", features = ["json"] }
2527
chrono = { version = "0.4.31", features = ["serde", "clock"] }
2628
serde = { version = "1.0.190", features = ["derive"] }
2729
serde_json = { version = "1.0.108" }
28-
serde_flat_path = "0.1.2"
2930
serde_repr = "0.1.18"
3031
futures = "0.3.30"
3132
log = "0.4.20"
3233
env_logger = "0.11.1"
3334
thiserror = "1.0.61"
35+
moka = { version = "0.12.7", optional = true, features = ["future"] }

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#[cfg(feature = "worldstate")]
22
pub mod worldstate;
33

4+
#[cfg(feature = "market")]
5+
pub mod market;
6+
47
pub(crate) mod ws {
58
#[cfg(feature = "multilangual")]
69
pub(crate) use crate::worldstate::language::Language;

0 commit comments

Comments
 (0)