mirror of
https://github.com/tribufu/sdk-rust
synced 2026-02-04 17:33:07 +00:00
Compare commits
9 Commits
openapi-ge
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9eb473d6d6 | |||
| dfa1dfb1c8 | |||
| 33d76d7a4e | |||
| 66094fc10d | |||
| 7b3af5d291 | |||
|
|
a392dbb119 | ||
| 738f9c947b | |||
| f5d3e86eb2 | |||
|
|
23af141e2d |
14
.cargo/config.toml
Normal file
14
.cargo/config.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
[build]
|
||||
rustflags = ["--cfg", "uuid_unstable"]
|
||||
|
||||
[profile.dev]
|
||||
lto = "off"
|
||||
|
||||
[profile.release]
|
||||
lto = "thin"
|
||||
|
||||
[target.'cfg(target_os = "windows")']
|
||||
rustflags = ["-C", "target-feature=+crt-static"]
|
||||
|
||||
[target.'cfg(target_family = "wasm")']
|
||||
rustflags = ["--cfg", "web_sys_unstable_apis"]
|
||||
221
.clang-format
Normal file
221
.clang-format
Normal file
@@ -0,0 +1,221 @@
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: true
|
||||
AlignConsecutiveBitFields:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveMacros:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments:
|
||||
Kind: Always
|
||||
OverEmptyLines: 0
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BitFieldColonSpacing: Both
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterExternBlock: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: false
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakAfterAttributes: Never
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakArrays: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: Always
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInlineASMColon: OnlyMultiline
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: "^ IWYU pragma:"
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: ".*"
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: "(Test)?$"
|
||||
IncludeIsMainSourceRegex: ""
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: false
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentRequiresClause: true
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertBraces: false
|
||||
InsertNewlineAtEOF: false
|
||||
InsertTrailingCommas: None
|
||||
IntegerLiteralSeparator:
|
||||
Binary: 0
|
||||
Decimal: 0
|
||||
Hex: 0
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
LambdaBodyIndentation: Signature
|
||||
LineEnding: DeriveLF
|
||||
MacroBlockBegin: ""
|
||||
MacroBlockEnd: ""
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PackConstructorInitializers: BinPack
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
||||
PointerAlignment: Right
|
||||
PPIndentWidth: -1
|
||||
QualifierAlignment: Leave
|
||||
ReferenceAlignment: Pointer
|
||||
ReflowComments: true
|
||||
RemoveBracesLLVM: false
|
||||
RemoveSemicolon: false
|
||||
RequiresClausePosition: OwnLine
|
||||
RequiresExpressionIndentation: OuterScope
|
||||
SeparateDefinitionBlocks: Leave
|
||||
ShortNamespaceLines: 1
|
||||
SortIncludes: CaseSensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: LexicographicNumeric
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: true
|
||||
AfterForeachMacros: true
|
||||
AfterFunctionDefinitionName: false
|
||||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: true
|
||||
AfterOverloadedOperator: false
|
||||
AfterRequiresInClause: false
|
||||
AfterRequiresInExpression: false
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: Never
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Latest
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- BOOST_PP_STRINGIZE
|
||||
- CF_SWIFT_NAME
|
||||
- NS_SWIFT_NAME
|
||||
- PP_STRINGIZE
|
||||
- STRINGIZE
|
||||
---
|
||||
|
||||
23
.gitignore
vendored
23
.gitignore
vendored
@@ -1,40 +1,17 @@
|
||||
__pycache__/
|
||||
.gradle/
|
||||
.idea/
|
||||
.metals/
|
||||
.next/
|
||||
.parcel-cache/
|
||||
.vs/
|
||||
.vscode/
|
||||
bin/
|
||||
binaries/
|
||||
build/
|
||||
node_modules/
|
||||
obj/
|
||||
saved/
|
||||
target/
|
||||
|
||||
.DS_Store
|
||||
.env
|
||||
*.crt
|
||||
*.csproj
|
||||
*.filters
|
||||
*.fsproj
|
||||
*.key
|
||||
*.log
|
||||
*.make
|
||||
*.mwb.bak
|
||||
*.pem
|
||||
*.sln
|
||||
*.user
|
||||
*.vcxproj
|
||||
*.vpp.*
|
||||
*.wasm
|
||||
*.xcodeproj
|
||||
*.xcworkspace
|
||||
Cargo.lock
|
||||
desktop.ini
|
||||
keystore.jks
|
||||
local.properties
|
||||
Makefile
|
||||
next-env.d.ts
|
||||
|
||||
@@ -5,38 +5,45 @@ src/models/account.rs
|
||||
src/models/application.rs
|
||||
src/models/application_type.rs
|
||||
src/models/authorize_request.rs
|
||||
src/models/client.rs
|
||||
src/models/client_info.rs
|
||||
src/models/client_type.rs
|
||||
src/models/code_challenge_method.rs
|
||||
src/models/code_response.rs
|
||||
src/models/create_user.rs
|
||||
src/models/crypto_view_model.rs
|
||||
src/models/game.rs
|
||||
src/models/game_server.rs
|
||||
src/models/game_server_cluster.rs
|
||||
src/models/game_server_query.rs
|
||||
src/models/game_server_status.rs
|
||||
src/models/grant_type.rs
|
||||
src/models/group.rs
|
||||
src/models/group_game.rs
|
||||
src/models/group_application.rs
|
||||
src/models/group_member.rs
|
||||
src/models/group_rank.rs
|
||||
src/models/hash_view_model.rs
|
||||
src/models/introspect_request.rs
|
||||
src/models/introspect_response.rs
|
||||
src/models/ip_address.rs
|
||||
src/models/leaderboard_item.rs
|
||||
src/models/leaderboard_order.rs
|
||||
src/models/login_provider.rs
|
||||
src/models/login_request.rs
|
||||
src/models/login_response.rs
|
||||
src/models/mod.rs
|
||||
src/models/package.rs
|
||||
src/models/package_release.rs
|
||||
src/models/product.rs
|
||||
src/models/product_price.rs
|
||||
src/models/product_type.rs
|
||||
src/models/profile.rs
|
||||
src/models/profile_game.rs
|
||||
src/models/profile_group.rs
|
||||
src/models/refresh_request.rs
|
||||
src/models/register_request.rs
|
||||
src/models/response_type.rs
|
||||
src/models/revoke_request.rs
|
||||
src/models/search_request.rs
|
||||
src/models/search.rs
|
||||
src/models/search_type.rs
|
||||
src/models/server_metrics.rs
|
||||
src/models/server_status.rs
|
||||
src/models/subscription.rs
|
||||
src/models/storage_file.rs
|
||||
src/models/token_hint_type.rs
|
||||
src/models/token_request.rs
|
||||
src/models/token_response.rs
|
||||
|
||||
10
Cargo.toml
10
Cargo.toml
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tribufu"
|
||||
version = "1.1.0"
|
||||
version = "1.3.0"
|
||||
description = "REST API to access Tribufu services."
|
||||
repository = "https://github.com/tribufu/tribufu-rust"
|
||||
authors = ["Tribufu <contact@tribufu.com>"]
|
||||
@@ -19,15 +19,21 @@ exclude = [
|
||||
".vscode/",
|
||||
"examples/",
|
||||
"scripts/",
|
||||
"scripts/",
|
||||
"vendor/",
|
||||
]
|
||||
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["src/*"]
|
||||
exclude = ["src/apis", "src/models"]
|
||||
|
||||
[lib]
|
||||
name = "tribufu"
|
||||
crate-type = ["rlib"]
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
tribufu-constants = { version = "1.3.0", path = "./src/constants" }
|
||||
async-trait = "^0.1"
|
||||
reqwest = { version = "^0.12", features = ["json", "multipart"] }
|
||||
serde = { version = "^1.0", features = ["derive"] }
|
||||
|
||||
@@ -9,7 +9,7 @@ Rust SDK to access Tribufu APIs and services.
|
||||
[crates-badge]: https://img.shields.io/crates/v/tribufu.svg
|
||||
[crates-url]: https://crates.io/crates/tribufu
|
||||
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||
[mit-url]: https://github.com/Tribufu/TribufuRust/blob/main/LICENSE.txt
|
||||
[mit-url]: https://github.com/tribufu/tribufu-rust/blob/main/LICENSE.txt
|
||||
[discord-badge]: https://img.shields.io/discord/276504514616623104.svg?logo=discord&style=flat-square
|
||||
[discord-url]: https://www.tribufu.com/discord
|
||||
|
||||
@@ -20,4 +20,4 @@ Rust SDK to access Tribufu APIs and services.
|
||||
|
||||
This project is licensed under the [MIT License].
|
||||
|
||||
[MIT License]: https://github.com/Tribufu/TribufuRust/blob/main/LICENSE.txt
|
||||
[MIT License]: https://github.com/tribufu/tribufu-rust/blob/main/LICENSE.txt
|
||||
|
||||
10
examples/agent.rs
Normal file
10
examples/agent.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use tribufu::TribufuApi;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let user_agent = TribufuApi::get_user_agent();
|
||||
println!("{}", user_agent);
|
||||
}
|
||||
4
scripts/windows/build.ps1
Normal file
4
scripts/windows/build.ps1
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
echo "Building for win-x64"
|
||||
cargo build --workspace
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
$crates = @(
|
||||
"tribufu-types",
|
||||
"tribufu-constants",
|
||||
"tribufu-api",
|
||||
"tribufu-error",
|
||||
"tribufu-json",
|
||||
"tribufu-log",
|
||||
"tribufu-platform",
|
||||
"tribufu"
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ impl Default for Configuration {
|
||||
fn default() -> Self {
|
||||
Configuration {
|
||||
base_path: "http://localhost".to_owned(),
|
||||
user_agent: Some("OpenAPI-Generator/1.1.0/rust".to_owned()),
|
||||
user_agent: Some("OpenAPI-Generator/1.3.0/rust".to_owned()),
|
||||
client: reqwest::Client::new(),
|
||||
basic_auth: None,
|
||||
oauth_access_token: None,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
21
src/constants/Cargo.toml
Normal file
21
src/constants/Cargo.toml
Normal file
@@ -0,0 +1,21 @@
|
||||
[package]
|
||||
name = "tribufu-constants"
|
||||
version = "1.3.0"
|
||||
description = "Tribufu Constants"
|
||||
repository = "https://github.com/tribufu/tribufu-rust"
|
||||
authors = ["Tribufu <contact@tribufu.com>"]
|
||||
license = "MIT"
|
||||
edition = "2021"
|
||||
publish = true
|
||||
|
||||
[lib]
|
||||
name = "tribufu_constants"
|
||||
crate-type = ["rlib"]
|
||||
path = "lib.rs"
|
||||
|
||||
[build-dependencies]
|
||||
vergen = { version = "=5.1.5", default-features = false, features = [
|
||||
"build",
|
||||
"cargo",
|
||||
"rustc",
|
||||
] }
|
||||
8
src/constants/build.rs
Normal file
8
src/constants/build.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use vergen::{vergen, Config};
|
||||
|
||||
fn main() {
|
||||
vergen(Config::default()).unwrap();
|
||||
}
|
||||
19
src/constants/lib.rs
Normal file
19
src/constants/lib.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use std::env::consts;
|
||||
|
||||
pub const BUILD_TIMESTAMP: &'static str = env!("VERGEN_BUILD_TIMESTAMP");
|
||||
pub const CARGO_PROFILE: &'static str = env!("VERGEN_CARGO_PROFILE");
|
||||
pub const LLVM_VERSION: &'static str = env!("VERGEN_RUSTC_LLVM_VERSION");
|
||||
pub const RUSTC_CHANNEL: &'static str = env!("VERGEN_RUSTC_CHANNEL");
|
||||
pub const RUSTC_COMMIT: &'static str = env!("VERGEN_RUSTC_COMMIT_HASH");
|
||||
pub const RUSTC_VERSION: &'static str = env!("VERGEN_RUSTC_SEMVER");
|
||||
pub const TARGET_ARCH: &'static str = consts::ARCH;
|
||||
pub const TARGET_DLL_EXTENSION: &'static str = consts::DLL_EXTENSION;
|
||||
pub const TARGET_DLL_SUFFIX: &'static str = consts::DLL_SUFFIX;
|
||||
pub const TARGET_EXE_EXTENSION: &'static str = consts::EXE_EXTENSION;
|
||||
pub const TARGET_EXE_SUFFIX: &'static str = consts::EXE_SUFFIX;
|
||||
pub const TARGET_FAMILY: &'static str = consts::FAMILY;
|
||||
pub const TARGET_OS: &'static str = consts::OS;
|
||||
pub const TARGET_TRIPLE: &'static str = env!("VERGEN_CARGO_TARGET_TRIPLE");
|
||||
18
src/error/Cargo.toml
Normal file
18
src/error/Cargo.toml
Normal file
@@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "tribufu-error"
|
||||
version = "1.3.0"
|
||||
description = "Tribufu Error"
|
||||
repository = "https://github.com/tribufu/tribufu-rust"
|
||||
authors = ["Tribufu <contact@tribufu.com>"]
|
||||
license = "MIT"
|
||||
edition = "2021"
|
||||
publish = true
|
||||
|
||||
[lib]
|
||||
name = "tribufu_error"
|
||||
crate-type = ["rlib"]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.44"
|
||||
thiserror = "2.0.12"
|
||||
7
src/error/lib.rs
Normal file
7
src/error/lib.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pub use anyhow::Error;
|
||||
pub use thiserror::Error;
|
||||
|
||||
pub type Result<T> = core::result::Result<T, Error>;
|
||||
19
src/json/Cargo.toml
Normal file
19
src/json/Cargo.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "tribufu-json"
|
||||
version = "1.3.0"
|
||||
description = "Tribufu Json"
|
||||
repository = "https://github.com/tribufu/tribufu-rust"
|
||||
authors = ["Tribufu <contact@tribufu.com>"]
|
||||
license = "MIT"
|
||||
edition = "2021"
|
||||
publish = true
|
||||
|
||||
[lib]
|
||||
name = "tribufu_json"
|
||||
crate-type = ["rlib"]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
tribufu-error = { version = "1.3.0", path = "../error" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
49
src/json/lib.rs
Normal file
49
src/json/lib.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use serde::Serialize;
|
||||
use serde_json::ser::PrettyFormatter;
|
||||
use serde_json::Serializer;
|
||||
use tribufu_error::Result;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! include_json {
|
||||
($path:expr) => {
|
||||
$crate::from_str(include_str!($path)).expect("Failed to load JSON")
|
||||
};
|
||||
}
|
||||
|
||||
pub use serde_json::from_slice;
|
||||
pub use serde_json::from_str;
|
||||
pub use serde_json::to_string;
|
||||
pub use serde_json::to_value;
|
||||
pub use serde_json::to_vec_pretty;
|
||||
|
||||
pub fn to_string_pretty<T>(value: &T) -> Result<String>
|
||||
where
|
||||
T: Serialize,
|
||||
{
|
||||
let obj = to_value(value).expect("Failed to serialize JSON");
|
||||
let mut buf = Vec::new();
|
||||
let fmt = PrettyFormatter::with_indent(b" ");
|
||||
let mut ser = Serializer::with_formatter(&mut buf, fmt);
|
||||
obj.serialize(&mut ser)?;
|
||||
Ok(String::from_utf8(buf)?)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct JsonTest {
|
||||
version: String,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_include_json() {
|
||||
let data: JsonTest = include_json!("test.json");
|
||||
assert!(data.version == "0.0.0".to_owned())
|
||||
}
|
||||
}
|
||||
3
src/json/test.json
Normal file
3
src/json/test.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"version": "0.0.0"
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
use crate::apis::configuration::{ApiKey, Configuration};
|
||||
use crate::apis::tribufu_generated_api::TribufuGeneratedApiClient;
|
||||
use reqwest::Client;
|
||||
use tribufu_constants::{RUSTC_VERSION, TARGET_TRIPLE};
|
||||
use std::env::{self, consts};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -68,7 +69,7 @@ impl TribufuApi {
|
||||
/// Gets the user agent string for the Tribufu API client.
|
||||
pub fn get_user_agent() -> String {
|
||||
let version = Self::get_version();
|
||||
format!("Tribufu/{} ({}; {})", version, consts::OS, consts::ARCH)
|
||||
format!("Tribufu/{} (Rust {}; {})", version, RUSTC_VERSION, TARGET_TRIPLE)
|
||||
}
|
||||
|
||||
/// Checks if debug mode is enabled.
|
||||
|
||||
21
src/log/Cargo.toml
Normal file
21
src/log/Cargo.toml
Normal file
@@ -0,0 +1,21 @@
|
||||
[package]
|
||||
name = "tribufu-log"
|
||||
version = "1.3.0"
|
||||
description = "Tribufu Log"
|
||||
repository = "https://github.com/tribufu/tribufu-rust"
|
||||
authors = ["Tribufu <contact@tribufu.com>"]
|
||||
license = "MIT"
|
||||
edition = "2021"
|
||||
publish = true
|
||||
|
||||
[lib]
|
||||
name = "tribufu_log"
|
||||
crate-type = ["rlib"]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
tribufu-error = { version = "1.3.0", path = "../error" }
|
||||
chrono = "0.4.23"
|
||||
env_logger = "0.10.1"
|
||||
log = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
19
src/log/colors.rs
Normal file
19
src/log/colors.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pub const BLACK: u8 = 0;
|
||||
pub const RED: u8 = 1;
|
||||
pub const GREEN: u8 = 2;
|
||||
pub const YELLOW: u8 = 3;
|
||||
pub const BLUE: u8 = 4;
|
||||
pub const MAGENTA: u8 = 5;
|
||||
pub const CYAN: u8 = 6;
|
||||
pub const WHITE: u8 = 7;
|
||||
pub const BRIGHT_BLACK: u8 = 8;
|
||||
pub const BRIGHT_RED: u8 = 9;
|
||||
pub const BRIGHT_GREEN: u8 = 10;
|
||||
pub const BRIGHT_YELLOW: u8 = 11;
|
||||
pub const BRIGHT_BLUE: u8 = 12;
|
||||
pub const BRIGHT_MAGENTA: u8 = 13;
|
||||
pub const BRIGHT_CYAN: u8 = 14;
|
||||
pub const BRIGHT_WHITE: u8 = 15;
|
||||
118
src/log/lib.rs
Normal file
118
src/log/lib.rs
Normal file
@@ -0,0 +1,118 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use chrono::prelude::*;
|
||||
pub use env_logger::fmt::Color;
|
||||
use env_logger::{Builder, Target};
|
||||
pub use log::debug;
|
||||
pub use log::error;
|
||||
pub use log::info;
|
||||
pub use log::trace;
|
||||
pub use log::warn;
|
||||
use log::Level;
|
||||
use log::LevelFilter;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::io::Write;
|
||||
|
||||
pub mod colors;
|
||||
|
||||
mod log_config;
|
||||
pub use log_config::*;
|
||||
|
||||
pub fn init() {
|
||||
let logger = Logger::from_env(None);
|
||||
logger.init();
|
||||
}
|
||||
|
||||
pub fn init_level(level: LogLevel) {
|
||||
let logger = Logger::new(level.into());
|
||||
logger.init();
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Copy, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum LogLevel {
|
||||
#[default]
|
||||
Off,
|
||||
Error,
|
||||
Warn,
|
||||
Info,
|
||||
Debug,
|
||||
Trace,
|
||||
}
|
||||
|
||||
impl LogLevel {
|
||||
pub fn from_str(s: &str) -> Option<Self> {
|
||||
match s {
|
||||
"off" => Some(Self::Off),
|
||||
"error" => Some(Self::Error),
|
||||
"warn" => Some(Self::Warn),
|
||||
"info" => Some(Self::Info),
|
||||
"debug" => Some(Self::Debug),
|
||||
"trace" => Some(Self::Trace),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<LogLevel> for LevelFilter {
|
||||
fn from(level: LogLevel) -> Self {
|
||||
match level {
|
||||
LogLevel::Off => LevelFilter::Off,
|
||||
LogLevel::Error => LevelFilter::Error,
|
||||
LogLevel::Warn => LevelFilter::Warn,
|
||||
LogLevel::Info => LevelFilter::Info,
|
||||
LogLevel::Debug => LevelFilter::Debug,
|
||||
LogLevel::Trace => LevelFilter::Trace,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Logger {
|
||||
builder: Builder,
|
||||
}
|
||||
|
||||
impl Logger {
|
||||
pub fn new(level: LevelFilter) -> Self {
|
||||
let mut builder = Builder::new();
|
||||
builder.filter_level(level);
|
||||
Self { builder }
|
||||
}
|
||||
|
||||
pub fn with_config(config: LogConfig) -> Self {
|
||||
let mut builder = Builder::new();
|
||||
builder.filter_level(config.level.into());
|
||||
Self { builder }
|
||||
}
|
||||
|
||||
pub fn from_env(var: Option<String>) -> Self {
|
||||
let builder = Builder::from_env(var.unwrap_or("LOG_LEVEL".to_string()));
|
||||
Self { builder }
|
||||
}
|
||||
|
||||
pub fn init(mut self) {
|
||||
self.builder
|
||||
.target(Target::Stdout)
|
||||
.format(|fmt, record| {
|
||||
let mut style = fmt.style();
|
||||
|
||||
match record.level() {
|
||||
Level::Error => style.set_color(Color::Ansi256(colors::RED)),
|
||||
Level::Warn => style.set_color(Color::Ansi256(colors::YELLOW)),
|
||||
Level::Info => style.set_color(Color::Ansi256(colors::GREEN)),
|
||||
Level::Debug => style.set_color(Color::Ansi256(colors::WHITE)),
|
||||
Level::Trace => style.set_color(Color::Ansi256(colors::BRIGHT_BLACK)),
|
||||
};
|
||||
|
||||
let line = format!(
|
||||
"[{}] [{}]: {}",
|
||||
Local::now().format("%Y-%m-%dT%H:%M:%S"),
|
||||
record.level(),
|
||||
record.args()
|
||||
);
|
||||
|
||||
writeln!(fmt, "{}", style.value(line))
|
||||
})
|
||||
.init();
|
||||
}
|
||||
}
|
||||
22
src/log/log_config.rs
Normal file
22
src/log/log_config.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use crate::LogLevel;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::env;
|
||||
use tribufu_error::Result;
|
||||
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct LogConfig {
|
||||
pub level: LogLevel,
|
||||
pub file: Option<String>,
|
||||
}
|
||||
|
||||
impl LogConfig {
|
||||
pub fn from_env() -> Result<Self> {
|
||||
Ok(Self {
|
||||
level: LogLevel::from_str(&env::var("LOG_LEVEL")?).unwrap_or_default(),
|
||||
file: env::var("LOG_FILE").ok(),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -13,12 +13,12 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Account {
|
||||
#[serde(rename = "id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<Option<String>>,
|
||||
#[serde(rename = "id", deserialize_with = "Option::deserialize")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(rename = "provider", skip_serializing_if = "Option::is_none")]
|
||||
pub provider: Option<models::LoginProvider>,
|
||||
#[serde(rename = "provider")]
|
||||
pub provider: models::LoginProvider,
|
||||
#[serde(rename = "user_id", skip_serializing_if = "Option::is_none")]
|
||||
pub user_id: Option<String>,
|
||||
#[serde(rename = "authorized", skip_serializing_if = "Option::is_none")]
|
||||
@@ -32,11 +32,11 @@ pub struct Account {
|
||||
}
|
||||
|
||||
impl Account {
|
||||
pub fn new() -> Account {
|
||||
pub fn new(id: Option<String>, provider: models::LoginProvider) -> Account {
|
||||
Account {
|
||||
id: None,
|
||||
id,
|
||||
name: None,
|
||||
provider: None,
|
||||
provider,
|
||||
user_id: None,
|
||||
authorized: None,
|
||||
fields: None,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -15,8 +15,8 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct Application {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<Option<String>>,
|
||||
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
|
||||
@@ -31,24 +31,8 @@ pub struct Application {
|
||||
pub capsule_image_url: Option<Option<String>>,
|
||||
#[serde(rename = "library_image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub library_image_url: Option<Option<String>>,
|
||||
#[serde(rename = "parent_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub parent_id: Option<Option<String>>,
|
||||
#[serde(rename = "slug", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub slug: Option<Option<String>>,
|
||||
#[serde(rename = "visibility", skip_serializing_if = "Option::is_none")]
|
||||
pub visibility: Option<i32>,
|
||||
#[serde(rename = "password", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub password: Option<Option<String>>,
|
||||
#[serde(rename = "primary", skip_serializing_if = "Option::is_none")]
|
||||
pub primary: Option<i32>,
|
||||
#[serde(rename = "user_count", skip_serializing_if = "Option::is_none")]
|
||||
pub user_count: Option<i32>,
|
||||
#[serde(rename = "achievement_count", skip_serializing_if = "Option::is_none")]
|
||||
pub achievement_count: Option<i32>,
|
||||
#[serde(rename = "badge_count", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub badge_count: Option<Option<i32>>,
|
||||
#[serde(rename = "download_count", skip_serializing_if = "Option::is_none")]
|
||||
pub download_count: Option<i32>,
|
||||
#[serde(rename = "created", skip_serializing_if = "Option::is_none")]
|
||||
pub created: Option<String>,
|
||||
#[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -56,10 +40,10 @@ pub struct Application {
|
||||
}
|
||||
|
||||
impl Application {
|
||||
pub fn new() -> Application {
|
||||
pub fn new(name: Option<String>) -> Application {
|
||||
Application {
|
||||
id: None,
|
||||
name: None,
|
||||
name,
|
||||
description: None,
|
||||
r#type: None,
|
||||
organization_id: None,
|
||||
@@ -67,15 +51,7 @@ impl Application {
|
||||
banner_url: None,
|
||||
capsule_image_url: None,
|
||||
library_image_url: None,
|
||||
parent_id: None,
|
||||
slug: None,
|
||||
visibility: None,
|
||||
password: None,
|
||||
primary: None,
|
||||
user_count: None,
|
||||
achievement_count: None,
|
||||
badge_count: None,
|
||||
download_count: None,
|
||||
created: None,
|
||||
updated: None,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -15,14 +15,14 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct AuthorizeRequest {
|
||||
#[serde(rename = "response_type", skip_serializing_if = "Option::is_none")]
|
||||
pub response_type: Option<models::ResponseType>,
|
||||
#[serde(rename = "client_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub client_id: Option<Option<String>>,
|
||||
#[serde(rename = "client_id")]
|
||||
pub client_id: String,
|
||||
#[serde(rename = "code_challenge", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub code_challenge: Option<Option<String>>,
|
||||
#[serde(rename = "code_challenge_method", skip_serializing_if = "Option::is_none")]
|
||||
pub code_challenge_method: Option<models::CodeChallengeMethod>,
|
||||
#[serde(rename = "redirect_uri", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub redirect_uri: Option<Option<String>>,
|
||||
#[serde(rename = "redirect_uri", deserialize_with = "Option::deserialize")]
|
||||
pub redirect_uri: Option<String>,
|
||||
#[serde(rename = "scope", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub scope: Option<Option<String>>,
|
||||
#[serde(rename = "state", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -30,13 +30,13 @@ pub struct AuthorizeRequest {
|
||||
}
|
||||
|
||||
impl AuthorizeRequest {
|
||||
pub fn new() -> AuthorizeRequest {
|
||||
pub fn new(client_id: String, redirect_uri: Option<String>) -> AuthorizeRequest {
|
||||
AuthorizeRequest {
|
||||
response_type: None,
|
||||
client_id: None,
|
||||
client_id,
|
||||
code_challenge: None,
|
||||
code_challenge_method: None,
|
||||
redirect_uri: None,
|
||||
redirect_uri,
|
||||
scope: None,
|
||||
state: None,
|
||||
}
|
||||
|
||||
63
src/models/client.rs
Normal file
63
src/models/client.rs
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Client {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
|
||||
pub r#type: Option<models::ClientType>,
|
||||
#[serde(rename = "organization_id", skip_serializing_if = "Option::is_none")]
|
||||
pub organization_id: Option<String>,
|
||||
#[serde(rename = "trusted", skip_serializing_if = "Option::is_none")]
|
||||
pub trusted: Option<bool>,
|
||||
#[serde(rename = "website_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub website_url: Option<Option<String>>,
|
||||
#[serde(rename = "photo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub photo_url: Option<Option<String>>,
|
||||
#[serde(rename = "background_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub background_url: Option<Option<String>>,
|
||||
#[serde(rename = "redirects", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub redirects: Option<Option<String>>,
|
||||
#[serde(rename = "scopes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub scopes: Option<Option<String>>,
|
||||
#[serde(rename = "permissions", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub permissions: Option<Option<Vec<String>>>,
|
||||
#[serde(rename = "created", skip_serializing_if = "Option::is_none")]
|
||||
pub created: Option<String>,
|
||||
#[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub updated: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
pub fn new(name: Option<String>) -> Client {
|
||||
Client {
|
||||
id: None,
|
||||
name,
|
||||
r#type: None,
|
||||
organization_id: None,
|
||||
trusted: None,
|
||||
website_url: None,
|
||||
photo_url: None,
|
||||
background_url: None,
|
||||
redirects: None,
|
||||
scopes: None,
|
||||
permissions: None,
|
||||
created: None,
|
||||
updated: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
39
src/models/client_info.rs
Normal file
39
src/models/client_info.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ClientInfo {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
|
||||
pub r#type: Option<models::ClientType>,
|
||||
#[serde(rename = "photo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub photo_url: Option<Option<String>>,
|
||||
#[serde(rename = "permissions", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub permissions: Option<Option<Vec<String>>>,
|
||||
}
|
||||
|
||||
impl ClientInfo {
|
||||
pub fn new(name: Option<String>) -> ClientInfo {
|
||||
ClientInfo {
|
||||
id: None,
|
||||
name,
|
||||
r#type: None,
|
||||
photo_url: None,
|
||||
permissions: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
41
src/models/client_type.rs
Normal file
41
src/models/client_type.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
///
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
|
||||
pub enum ClientType {
|
||||
#[serde(rename = "web")]
|
||||
Web,
|
||||
#[serde(rename = "desktop")]
|
||||
Desktop,
|
||||
#[serde(rename = "mobile")]
|
||||
Mobile,
|
||||
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ClientType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Web => write!(f, "web"),
|
||||
Self::Desktop => write!(f, "desktop"),
|
||||
Self::Mobile => write!(f, "mobile"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ClientType {
|
||||
fn default() -> ClientType {
|
||||
Self::Web
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
30
src/models/code_response.rs
Normal file
30
src/models/code_response.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct CodeResponse {
|
||||
#[serde(rename = "code", deserialize_with = "Option::deserialize")]
|
||||
pub code: Option<String>,
|
||||
#[serde(rename = "state", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub state: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl CodeResponse {
|
||||
pub fn new(code: Option<String>) -> CodeResponse {
|
||||
CodeResponse {
|
||||
code,
|
||||
state: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
51
src/models/create_user.rs
Normal file
51
src/models/create_user.rs
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct CreateUser {
|
||||
#[serde(rename = "uuid", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub uuid: Option<Option<uuid::Uuid>>,
|
||||
#[serde(rename = "name")]
|
||||
pub name: String,
|
||||
#[serde(rename = "display_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub display_name: Option<Option<String>>,
|
||||
#[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub email: Option<Option<String>>,
|
||||
#[serde(rename = "password", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub password: Option<Option<String>>,
|
||||
#[serde(rename = "language", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub language: Option<Option<String>>,
|
||||
#[serde(rename = "timezone", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub timezone: Option<Option<String>>,
|
||||
#[serde(rename = "currency", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub currency: Option<Option<String>>,
|
||||
#[serde(rename = "ip_address", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub ip_address: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl CreateUser {
|
||||
pub fn new(name: String) -> CreateUser {
|
||||
CreateUser {
|
||||
uuid: None,
|
||||
name,
|
||||
display_name: None,
|
||||
email: None,
|
||||
password: None,
|
||||
language: None,
|
||||
timezone: None,
|
||||
currency: None,
|
||||
ip_address: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -13,32 +13,10 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Game {
|
||||
#[serde(rename = "game_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub game_port: Option<Option<i32>>,
|
||||
#[serde(rename = "query_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub query_port: Option<Option<i32>>,
|
||||
#[serde(rename = "rcon_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub rcon_port: Option<Option<i32>>,
|
||||
#[serde(rename = "server_count", skip_serializing_if = "Option::is_none")]
|
||||
pub server_count: Option<i32>,
|
||||
#[serde(rename = "steam_app_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub steam_app_id: Option<Option<i32>>,
|
||||
#[serde(rename = "steam_server_app_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub steam_server_app_id: Option<Option<i32>>,
|
||||
#[serde(rename = "enable_servers", skip_serializing_if = "Option::is_none")]
|
||||
pub enable_servers: Option<bool>,
|
||||
#[serde(rename = "rust_gamedig_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub rust_gamedig_id: Option<Option<String>>,
|
||||
#[serde(rename = "node_gamedig_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub node_gamedig_id: Option<Option<String>>,
|
||||
#[serde(rename = "server_connect_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub server_connect_url: Option<Option<String>>,
|
||||
#[serde(rename = "server_tags", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub server_tags: Option<Option<String>>,
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<Option<String>>,
|
||||
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
|
||||
@@ -53,46 +31,33 @@ pub struct Game {
|
||||
pub capsule_image_url: Option<Option<String>>,
|
||||
#[serde(rename = "library_image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub library_image_url: Option<Option<String>>,
|
||||
#[serde(rename = "parent_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub parent_id: Option<Option<String>>,
|
||||
#[serde(rename = "slug", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub slug: Option<Option<String>>,
|
||||
#[serde(rename = "visibility", skip_serializing_if = "Option::is_none")]
|
||||
pub visibility: Option<i32>,
|
||||
#[serde(rename = "password", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub password: Option<Option<String>>,
|
||||
#[serde(rename = "primary", skip_serializing_if = "Option::is_none")]
|
||||
pub primary: Option<i32>,
|
||||
#[serde(rename = "user_count", skip_serializing_if = "Option::is_none")]
|
||||
pub user_count: Option<i32>,
|
||||
#[serde(rename = "achievement_count", skip_serializing_if = "Option::is_none")]
|
||||
pub achievement_count: Option<i32>,
|
||||
#[serde(rename = "badge_count", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub badge_count: Option<Option<i32>>,
|
||||
#[serde(rename = "download_count", skip_serializing_if = "Option::is_none")]
|
||||
pub download_count: Option<i32>,
|
||||
#[serde(rename = "created", skip_serializing_if = "Option::is_none")]
|
||||
pub created: Option<String>,
|
||||
#[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub updated: Option<Option<String>>,
|
||||
#[serde(rename = "enable_servers", skip_serializing_if = "Option::is_none")]
|
||||
pub enable_servers: Option<bool>,
|
||||
#[serde(rename = "game_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub game_port: Option<Option<i32>>,
|
||||
#[serde(rename = "query_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub query_port: Option<Option<i32>>,
|
||||
#[serde(rename = "rcon_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub rcon_port: Option<Option<i32>>,
|
||||
#[serde(rename = "gamedig_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub gamedig_id: Option<Option<String>>,
|
||||
#[serde(rename = "steam_app_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub steam_app_id: Option<Option<i32>>,
|
||||
#[serde(rename = "steam_server_app_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub steam_server_app_id: Option<Option<i32>>,
|
||||
}
|
||||
|
||||
impl Game {
|
||||
pub fn new() -> Game {
|
||||
pub fn new(name: Option<String>) -> Game {
|
||||
Game {
|
||||
game_port: None,
|
||||
query_port: None,
|
||||
rcon_port: None,
|
||||
server_count: None,
|
||||
steam_app_id: None,
|
||||
steam_server_app_id: None,
|
||||
enable_servers: None,
|
||||
rust_gamedig_id: None,
|
||||
node_gamedig_id: None,
|
||||
server_connect_url: None,
|
||||
server_tags: None,
|
||||
id: None,
|
||||
name: None,
|
||||
name,
|
||||
description: None,
|
||||
r#type: None,
|
||||
organization_id: None,
|
||||
@@ -100,17 +65,16 @@ impl Game {
|
||||
banner_url: None,
|
||||
capsule_image_url: None,
|
||||
library_image_url: None,
|
||||
parent_id: None,
|
||||
slug: None,
|
||||
visibility: None,
|
||||
password: None,
|
||||
primary: None,
|
||||
user_count: None,
|
||||
achievement_count: None,
|
||||
badge_count: None,
|
||||
download_count: None,
|
||||
created: None,
|
||||
updated: None,
|
||||
enable_servers: None,
|
||||
game_port: None,
|
||||
query_port: None,
|
||||
rcon_port: None,
|
||||
gamedig_id: None,
|
||||
steam_app_id: None,
|
||||
steam_server_app_id: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -15,50 +15,34 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct GameServer {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<Option<String>>,
|
||||
#[serde(rename = "address", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub address: Option<Option<String>>,
|
||||
#[serde(rename = "owner_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub owner_id: Option<Option<String>>,
|
||||
#[serde(rename = "address", deserialize_with = "Option::deserialize")]
|
||||
pub address: Option<String>,
|
||||
#[serde(rename = "query_port")]
|
||||
pub query_port: i32,
|
||||
#[serde(rename = "game_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub game_port: Option<Option<i32>>,
|
||||
#[serde(rename = "query_port", skip_serializing_if = "Option::is_none")]
|
||||
pub query_port: Option<i32>,
|
||||
#[serde(rename = "map", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub map: Option<Option<String>>,
|
||||
#[serde(rename = "version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub version: Option<Option<String>>,
|
||||
#[serde(rename = "game_id", skip_serializing_if = "Option::is_none")]
|
||||
pub game_id: Option<String>,
|
||||
#[serde(rename = "game_icon_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub game_icon_url: Option<Option<String>>,
|
||||
#[serde(rename = "version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub version: Option<Option<String>>,
|
||||
#[serde(rename = "featured", skip_serializing_if = "Option::is_none")]
|
||||
pub featured: Option<bool>,
|
||||
#[serde(rename = "cluster_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub cluster_id: Option<Option<String>>,
|
||||
#[serde(rename = "website_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub website_url: Option<Option<String>>,
|
||||
#[serde(rename = "banner_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub banner_url: Option<Option<String>>,
|
||||
#[serde(rename = "owner_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub owner_id: Option<Option<String>>,
|
||||
#[serde(rename = "uptime", skip_serializing_if = "Option::is_none")]
|
||||
pub uptime: Option<f64>,
|
||||
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
|
||||
pub status: Option<models::ServerStatus>,
|
||||
#[serde(rename = "ping", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub ping: Option<Option<i32>>,
|
||||
#[serde(rename = "map", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub map: Option<Option<String>>,
|
||||
#[serde(rename = "used_slots", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub used_slots: Option<Option<i32>>,
|
||||
#[serde(rename = "max_slots", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub max_slots: Option<Option<i32>>,
|
||||
#[serde(rename = "motd", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub motd: Option<Option<String>>,
|
||||
#[serde(rename = "players", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub players: Option<Option<String>>,
|
||||
#[serde(rename = "last_online", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub last_online: Option<Option<String>>,
|
||||
#[serde(rename = "country", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub country: Option<Option<String>>,
|
||||
#[serde(rename = "steam", skip_serializing_if = "Option::is_none")]
|
||||
@@ -67,10 +51,6 @@ pub struct GameServer {
|
||||
pub discord_server_id: Option<Option<String>>,
|
||||
#[serde(rename = "youtube_video_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub youtube_video_url: Option<Option<String>>,
|
||||
#[serde(rename = "tags", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub tags: Option<Option<String>>,
|
||||
#[serde(rename = "comment_count", skip_serializing_if = "Option::is_none")]
|
||||
pub comment_count: Option<i32>,
|
||||
#[serde(rename = "created", skip_serializing_if = "Option::is_none")]
|
||||
pub created: Option<String>,
|
||||
#[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -78,37 +58,27 @@ pub struct GameServer {
|
||||
}
|
||||
|
||||
impl GameServer {
|
||||
pub fn new() -> GameServer {
|
||||
pub fn new(name: Option<String>, address: Option<String>, query_port: i32) -> GameServer {
|
||||
GameServer {
|
||||
id: None,
|
||||
name: None,
|
||||
name,
|
||||
description: None,
|
||||
address: None,
|
||||
owner_id: None,
|
||||
address,
|
||||
query_port,
|
||||
game_port: None,
|
||||
query_port: None,
|
||||
map: None,
|
||||
version: None,
|
||||
game_id: None,
|
||||
game_icon_url: None,
|
||||
version: None,
|
||||
featured: None,
|
||||
cluster_id: None,
|
||||
website_url: None,
|
||||
banner_url: None,
|
||||
owner_id: None,
|
||||
uptime: None,
|
||||
status: None,
|
||||
ping: None,
|
||||
map: None,
|
||||
used_slots: None,
|
||||
max_slots: None,
|
||||
motd: None,
|
||||
players: None,
|
||||
last_online: None,
|
||||
country: None,
|
||||
steam: None,
|
||||
discord_server_id: None,
|
||||
youtube_video_url: None,
|
||||
tags: None,
|
||||
comment_count: None,
|
||||
created: None,
|
||||
updated: None,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -15,8 +15,8 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct GameServerCluster {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<Option<String>>,
|
||||
#[serde(rename = "game_id", skip_serializing_if = "Option::is_none")]
|
||||
@@ -44,10 +44,10 @@ pub struct GameServerCluster {
|
||||
}
|
||||
|
||||
impl GameServerCluster {
|
||||
pub fn new() -> GameServerCluster {
|
||||
pub fn new(name: Option<String>) -> GameServerCluster {
|
||||
GameServerCluster {
|
||||
id: None,
|
||||
name: None,
|
||||
name,
|
||||
description: None,
|
||||
game_id: None,
|
||||
website_url: None,
|
||||
|
||||
48
src/models/game_server_query.rs
Normal file
48
src/models/game_server_query.rs
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct GameServerQuery {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "server_id", skip_serializing_if = "Option::is_none")]
|
||||
pub server_id: Option<String>,
|
||||
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
|
||||
pub status: Option<models::GameServerStatus>,
|
||||
#[serde(rename = "ping", skip_serializing_if = "Option::is_none")]
|
||||
pub ping: Option<i32>,
|
||||
#[serde(rename = "current_players", skip_serializing_if = "Option::is_none")]
|
||||
pub current_players: Option<i32>,
|
||||
#[serde(rename = "max_players", skip_serializing_if = "Option::is_none")]
|
||||
pub max_players: Option<i32>,
|
||||
#[serde(rename = "motd", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub motd: Option<Option<String>>,
|
||||
#[serde(rename = "created", skip_serializing_if = "Option::is_none")]
|
||||
pub created: Option<String>,
|
||||
}
|
||||
|
||||
impl GameServerQuery {
|
||||
pub fn new() -> GameServerQuery {
|
||||
GameServerQuery {
|
||||
id: None,
|
||||
server_id: None,
|
||||
status: None,
|
||||
ping: None,
|
||||
current_players: None,
|
||||
max_players: None,
|
||||
motd: None,
|
||||
created: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
///
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
|
||||
pub enum ServerStatus {
|
||||
pub enum GameServerStatus {
|
||||
#[serde(rename = "unknown")]
|
||||
Unknown,
|
||||
#[serde(rename = "offline")]
|
||||
@@ -23,7 +23,7 @@ pub enum ServerStatus {
|
||||
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ServerStatus {
|
||||
impl std::fmt::Display for GameServerStatus {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Unknown => write!(f, "unknown"),
|
||||
@@ -33,8 +33,8 @@ impl std::fmt::Display for ServerStatus {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ServerStatus {
|
||||
fn default() -> ServerStatus {
|
||||
impl Default for GameServerStatus {
|
||||
fn default() -> GameServerStatus {
|
||||
Self::Unknown
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -17,8 +17,8 @@ pub struct Group {
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "uuid", skip_serializing_if = "Option::is_none")]
|
||||
pub uuid: Option<uuid::Uuid>,
|
||||
#[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "tag", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub tag: Option<Option<String>>,
|
||||
#[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -48,11 +48,11 @@ pub struct Group {
|
||||
}
|
||||
|
||||
impl Group {
|
||||
pub fn new() -> Group {
|
||||
pub fn new(name: Option<String>) -> Group {
|
||||
Group {
|
||||
id: None,
|
||||
uuid: None,
|
||||
name: None,
|
||||
name,
|
||||
tag: None,
|
||||
description: None,
|
||||
r#type: None,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -12,9 +12,9 @@ use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct GroupGame {
|
||||
#[serde(rename = "group_id", skip_serializing_if = "Option::is_none")]
|
||||
pub group_id: Option<String>,
|
||||
pub struct GroupApplication {
|
||||
#[serde(rename = "group_id")]
|
||||
pub group_id: String,
|
||||
#[serde(rename = "group", skip_serializing_if = "Option::is_none")]
|
||||
pub group: Option<Box<models::Group>>,
|
||||
#[serde(rename = "application_id", skip_serializing_if = "Option::is_none")]
|
||||
@@ -29,10 +29,10 @@ pub struct GroupGame {
|
||||
pub last_used: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl GroupGame {
|
||||
pub fn new() -> GroupGame {
|
||||
GroupGame {
|
||||
group_id: None,
|
||||
impl GroupApplication {
|
||||
pub fn new(group_id: String) -> GroupApplication {
|
||||
GroupApplication {
|
||||
group_id,
|
||||
group: None,
|
||||
application_id: None,
|
||||
application: None,
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -13,14 +13,14 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HashViewModel {
|
||||
#[serde(rename = "value", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub value: Option<Option<String>>,
|
||||
#[serde(rename = "value", deserialize_with = "Option::deserialize")]
|
||||
pub value: Option<String>,
|
||||
}
|
||||
|
||||
impl HashViewModel {
|
||||
pub fn new() -> HashViewModel {
|
||||
pub fn new(value: Option<String>) -> HashViewModel {
|
||||
HashViewModel {
|
||||
value: None,
|
||||
value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -13,17 +13,17 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct IntrospectRequest {
|
||||
#[serde(rename = "token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub token: Option<Option<String>>,
|
||||
#[serde(rename = "token_type_hint", skip_serializing_if = "Option::is_none")]
|
||||
pub token_type_hint: Option<models::TokenHintType>,
|
||||
#[serde(rename = "token", deserialize_with = "Option::deserialize")]
|
||||
pub token: Option<String>,
|
||||
#[serde(rename = "token_type_hint")]
|
||||
pub token_type_hint: models::TokenHintType,
|
||||
}
|
||||
|
||||
impl IntrospectRequest {
|
||||
pub fn new() -> IntrospectRequest {
|
||||
pub fn new(token: Option<String>, token_type_hint: models::TokenHintType) -> IntrospectRequest {
|
||||
IntrospectRequest {
|
||||
token: None,
|
||||
token_type_hint: None,
|
||||
token,
|
||||
token_type_hint,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
60
src/models/introspect_response.rs
Normal file
60
src/models/introspect_response.rs
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct IntrospectResponse {
|
||||
#[serde(rename = "jti", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub jti: Option<Option<String>>,
|
||||
#[serde(rename = "active", skip_serializing_if = "Option::is_none")]
|
||||
pub active: Option<bool>,
|
||||
#[serde(rename = "token_type", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub token_type: Option<Option<String>>,
|
||||
#[serde(rename = "client_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub client_id: Option<Option<String>>,
|
||||
#[serde(rename = "sub", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub sub: Option<Option<String>>,
|
||||
#[serde(rename = "username", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub username: Option<Option<String>>,
|
||||
#[serde(rename = "scope", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub scope: Option<Option<String>>,
|
||||
#[serde(rename = "iss", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub iss: Option<Option<String>>,
|
||||
#[serde(rename = "aud", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub aud: Option<Option<String>>,
|
||||
#[serde(rename = "iat", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub iat: Option<Option<i64>>,
|
||||
#[serde(rename = "exp", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub exp: Option<Option<i64>>,
|
||||
#[serde(rename = "nbf", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub nbf: Option<Option<i64>>,
|
||||
}
|
||||
|
||||
impl IntrospectResponse {
|
||||
pub fn new() -> IntrospectResponse {
|
||||
IntrospectResponse {
|
||||
jti: None,
|
||||
active: None,
|
||||
token_type: None,
|
||||
client_id: None,
|
||||
sub: None,
|
||||
username: None,
|
||||
scope: None,
|
||||
iss: None,
|
||||
aud: None,
|
||||
iat: None,
|
||||
exp: None,
|
||||
nbf: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -21,6 +21,8 @@ pub struct IpAddress {
|
||||
pub network: Option<Option<String>>,
|
||||
#[serde(rename = "reserved", skip_serializing_if = "Option::is_none")]
|
||||
pub reserved: Option<bool>,
|
||||
#[serde(rename = "banned", skip_serializing_if = "Option::is_none")]
|
||||
pub banned: Option<bool>,
|
||||
#[serde(rename = "asn", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub asn: Option<Option<String>>,
|
||||
#[serde(rename = "isp", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -29,8 +31,8 @@ pub struct IpAddress {
|
||||
pub continent: Option<Option<String>>,
|
||||
#[serde(rename = "country", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub country: Option<Option<String>>,
|
||||
#[serde(rename = "region", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub region: Option<Option<String>>,
|
||||
#[serde(rename = "province", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub province: Option<Option<String>>,
|
||||
#[serde(rename = "city", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub city: Option<Option<String>>,
|
||||
#[serde(rename = "postal_code", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -58,11 +60,12 @@ impl IpAddress {
|
||||
version: None,
|
||||
network: None,
|
||||
reserved: None,
|
||||
banned: None,
|
||||
asn: None,
|
||||
isp: None,
|
||||
continent: None,
|
||||
country: None,
|
||||
region: None,
|
||||
province: None,
|
||||
city: None,
|
||||
postal_code: None,
|
||||
calling_code: None,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct LoginRequest {
|
||||
#[serde(rename = "login", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub login: Option<Option<String>>,
|
||||
#[serde(rename = "password", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub password: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl LoginRequest {
|
||||
pub fn new() -> LoginRequest {
|
||||
LoginRequest {
|
||||
login: None,
|
||||
password: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct LoginResponse {
|
||||
#[serde(rename = "user", skip_serializing_if = "Option::is_none")]
|
||||
pub user: Option<Box<models::UserInfo>>,
|
||||
#[serde(rename = "access_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub access_token: Option<Option<String>>,
|
||||
#[serde(rename = "refresh_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub refresh_token: Option<Option<String>>,
|
||||
#[serde(rename = "expires_in", skip_serializing_if = "Option::is_none")]
|
||||
pub expires_in: Option<i64>,
|
||||
}
|
||||
|
||||
impl LoginResponse {
|
||||
pub fn new() -> LoginResponse {
|
||||
LoginResponse {
|
||||
user: None,
|
||||
access_token: None,
|
||||
refresh_token: None,
|
||||
expires_in: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,18 @@ pub mod application_type;
|
||||
pub use self::application_type::ApplicationType;
|
||||
pub mod authorize_request;
|
||||
pub use self::authorize_request::AuthorizeRequest;
|
||||
pub mod client;
|
||||
pub use self::client::Client;
|
||||
pub mod client_info;
|
||||
pub use self::client_info::ClientInfo;
|
||||
pub mod client_type;
|
||||
pub use self::client_type::ClientType;
|
||||
pub mod code_challenge_method;
|
||||
pub use self::code_challenge_method::CodeChallengeMethod;
|
||||
pub mod code_response;
|
||||
pub use self::code_response::CodeResponse;
|
||||
pub mod create_user;
|
||||
pub use self::create_user::CreateUser;
|
||||
pub mod crypto_view_model;
|
||||
pub use self::crypto_view_model::CryptoViewModel;
|
||||
pub mod game;
|
||||
@@ -16,12 +26,16 @@ pub mod game_server;
|
||||
pub use self::game_server::GameServer;
|
||||
pub mod game_server_cluster;
|
||||
pub use self::game_server_cluster::GameServerCluster;
|
||||
pub mod game_server_query;
|
||||
pub use self::game_server_query::GameServerQuery;
|
||||
pub mod game_server_status;
|
||||
pub use self::game_server_status::GameServerStatus;
|
||||
pub mod grant_type;
|
||||
pub use self::grant_type::GrantType;
|
||||
pub mod group;
|
||||
pub use self::group::Group;
|
||||
pub mod group_game;
|
||||
pub use self::group_game::GroupGame;
|
||||
pub mod group_application;
|
||||
pub use self::group_application::GroupApplication;
|
||||
pub mod group_member;
|
||||
pub use self::group_member::GroupMember;
|
||||
pub mod group_rank;
|
||||
@@ -30,6 +44,8 @@ pub mod hash_view_model;
|
||||
pub use self::hash_view_model::HashViewModel;
|
||||
pub mod introspect_request;
|
||||
pub use self::introspect_request::IntrospectRequest;
|
||||
pub mod introspect_response;
|
||||
pub use self::introspect_response::IntrospectResponse;
|
||||
pub mod ip_address;
|
||||
pub use self::ip_address::IpAddress;
|
||||
pub mod leaderboard_item;
|
||||
@@ -38,36 +54,34 @@ pub mod leaderboard_order;
|
||||
pub use self::leaderboard_order::LeaderboardOrder;
|
||||
pub mod login_provider;
|
||||
pub use self::login_provider::LoginProvider;
|
||||
pub mod login_request;
|
||||
pub use self::login_request::LoginRequest;
|
||||
pub mod login_response;
|
||||
pub use self::login_response::LoginResponse;
|
||||
pub mod package;
|
||||
pub use self::package::Package;
|
||||
pub mod package_release;
|
||||
pub use self::package_release::PackageRelease;
|
||||
pub mod product;
|
||||
pub use self::product::Product;
|
||||
pub mod product_price;
|
||||
pub use self::product_price::ProductPrice;
|
||||
pub mod product_type;
|
||||
pub use self::product_type::ProductType;
|
||||
pub mod profile;
|
||||
pub use self::profile::Profile;
|
||||
pub mod profile_game;
|
||||
pub use self::profile_game::ProfileGame;
|
||||
pub mod profile_group;
|
||||
pub use self::profile_group::ProfileGroup;
|
||||
pub mod refresh_request;
|
||||
pub use self::refresh_request::RefreshRequest;
|
||||
pub mod register_request;
|
||||
pub use self::register_request::RegisterRequest;
|
||||
pub mod response_type;
|
||||
pub use self::response_type::ResponseType;
|
||||
pub mod revoke_request;
|
||||
pub use self::revoke_request::RevokeRequest;
|
||||
pub mod search_request;
|
||||
pub use self::search_request::SearchRequest;
|
||||
pub mod search;
|
||||
pub use self::search::Search;
|
||||
pub mod search_type;
|
||||
pub use self::search_type::SearchType;
|
||||
pub mod server_metrics;
|
||||
pub use self::server_metrics::ServerMetrics;
|
||||
pub mod server_status;
|
||||
pub use self::server_status::ServerStatus;
|
||||
pub mod subscription;
|
||||
pub use self::subscription::Subscription;
|
||||
pub mod storage_file;
|
||||
pub use self::storage_file::StorageFile;
|
||||
pub mod token_hint_type;
|
||||
pub use self::token_hint_type::TokenHintType;
|
||||
pub mod token_request;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -15,24 +15,24 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct Package {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<Option<String>>,
|
||||
#[serde(rename = "image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub image_url: Option<Option<String>>,
|
||||
#[serde(rename = "author_id", skip_serializing_if = "Option::is_none")]
|
||||
pub author_id: Option<String>,
|
||||
#[serde(rename = "version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub version: Option<Option<String>>,
|
||||
#[serde(rename = "file_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub file_url: Option<Option<String>>,
|
||||
#[serde(rename = "raw_size", skip_serializing_if = "Option::is_none")]
|
||||
pub raw_size: Option<f64>,
|
||||
#[serde(rename = "image_url", deserialize_with = "Option::deserialize")]
|
||||
pub image_url: Option<String>,
|
||||
#[serde(rename = "application_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub application_id: Option<Option<String>>,
|
||||
#[serde(rename = "category_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub category_id: Option<Option<String>>,
|
||||
#[serde(rename = "download_count", skip_serializing_if = "Option::is_none")]
|
||||
pub download_count: Option<i32>,
|
||||
#[serde(rename = "last_download", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub last_download: Option<Option<String>>,
|
||||
#[serde(rename = "releases", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub releases: Option<Option<Vec<models::PackageRelease>>>,
|
||||
#[serde(rename = "created", skip_serializing_if = "Option::is_none")]
|
||||
pub created: Option<String>,
|
||||
#[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -40,18 +40,18 @@ pub struct Package {
|
||||
}
|
||||
|
||||
impl Package {
|
||||
pub fn new() -> Package {
|
||||
pub fn new(name: Option<String>, image_url: Option<String>) -> Package {
|
||||
Package {
|
||||
id: None,
|
||||
name: None,
|
||||
name,
|
||||
description: None,
|
||||
image_url: None,
|
||||
author_id: None,
|
||||
version: None,
|
||||
file_url: None,
|
||||
raw_size: None,
|
||||
image_url,
|
||||
application_id: None,
|
||||
category_id: None,
|
||||
download_count: None,
|
||||
last_download: None,
|
||||
releases: None,
|
||||
created: None,
|
||||
updated: None,
|
||||
}
|
||||
|
||||
45
src/models/package_release.rs
Normal file
45
src/models/package_release.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct PackageRelease {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "version", deserialize_with = "Option::deserialize")]
|
||||
pub version: Option<String>,
|
||||
#[serde(rename = "package_id", skip_serializing_if = "Option::is_none")]
|
||||
pub package_id: Option<String>,
|
||||
#[serde(rename = "notes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub notes: Option<Option<String>>,
|
||||
#[serde(rename = "files", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub files: Option<Option<Vec<models::StorageFile>>>,
|
||||
#[serde(rename = "created", skip_serializing_if = "Option::is_none")]
|
||||
pub created: Option<String>,
|
||||
#[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub updated: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl PackageRelease {
|
||||
pub fn new(version: Option<String>) -> PackageRelease {
|
||||
PackageRelease {
|
||||
id: None,
|
||||
version,
|
||||
package_id: None,
|
||||
notes: None,
|
||||
files: None,
|
||||
created: None,
|
||||
updated: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -12,30 +12,39 @@ use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Subscription {
|
||||
pub struct Product {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<Option<String>>,
|
||||
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
|
||||
pub r#type: Option<models::ProductType>,
|
||||
#[serde(rename = "slug", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub slug: Option<Option<String>>,
|
||||
#[serde(rename = "image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub image_url: Option<Option<String>>,
|
||||
#[serde(rename = "is_physical", skip_serializing_if = "Option::is_none")]
|
||||
pub is_physical: Option<bool>,
|
||||
#[serde(rename = "prices", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub prices: Option<Option<std::collections::HashMap<String, f64>>>,
|
||||
pub prices: Option<Option<Vec<models::ProductPrice>>>,
|
||||
#[serde(rename = "created", skip_serializing_if = "Option::is_none")]
|
||||
pub created: Option<String>,
|
||||
#[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub updated: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl Subscription {
|
||||
pub fn new() -> Subscription {
|
||||
Subscription {
|
||||
impl Product {
|
||||
pub fn new(name: Option<String>) -> Product {
|
||||
Product {
|
||||
id: None,
|
||||
name: None,
|
||||
name,
|
||||
description: None,
|
||||
r#type: None,
|
||||
slug: None,
|
||||
image_url: None,
|
||||
is_physical: None,
|
||||
prices: None,
|
||||
created: None,
|
||||
updated: None,
|
||||
33
src/models/product_price.rs
Normal file
33
src/models/product_price.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ProductPrice {
|
||||
#[serde(rename = "currency", deserialize_with = "Option::deserialize")]
|
||||
pub currency: Option<String>,
|
||||
#[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
|
||||
pub amount: Option<f64>,
|
||||
#[serde(rename = "renewal", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub renewal: Option<Option<f64>>,
|
||||
}
|
||||
|
||||
impl ProductPrice {
|
||||
pub fn new(currency: Option<String>) -> ProductPrice {
|
||||
ProductPrice {
|
||||
currency,
|
||||
amount: None,
|
||||
renewal: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
38
src/models/product_type.rs
Normal file
38
src/models/product_type.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
///
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
|
||||
pub enum ProductType {
|
||||
#[serde(rename = "product")]
|
||||
Product,
|
||||
#[serde(rename = "subscription")]
|
||||
Subscription,
|
||||
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ProductType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Product => write!(f, "product"),
|
||||
Self::Subscription => write!(f, "subscription"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ProductType {
|
||||
fn default() -> ProductType {
|
||||
Self::Product
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct RefreshRequest {
|
||||
#[serde(rename = "refresh_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub refresh_token: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl RefreshRequest {
|
||||
pub fn new() -> RefreshRequest {
|
||||
RefreshRequest {
|
||||
refresh_token: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct RegisterRequest {
|
||||
#[serde(rename = "uuid", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub uuid: Option<Option<uuid::Uuid>>,
|
||||
#[serde(rename = "name")]
|
||||
pub name: String,
|
||||
#[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub email: Option<Option<String>>,
|
||||
#[serde(rename = "password")]
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
impl RegisterRequest {
|
||||
pub fn new(name: String, password: String) -> RegisterRequest {
|
||||
RegisterRequest {
|
||||
uuid: None,
|
||||
name,
|
||||
email: None,
|
||||
password,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -13,17 +13,17 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct RevokeRequest {
|
||||
#[serde(rename = "token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub token: Option<Option<String>>,
|
||||
#[serde(rename = "token_type_hint", skip_serializing_if = "Option::is_none")]
|
||||
pub token_type_hint: Option<models::TokenHintType>,
|
||||
#[serde(rename = "token", deserialize_with = "Option::deserialize")]
|
||||
pub token: Option<String>,
|
||||
#[serde(rename = "token_type_hint")]
|
||||
pub token_type_hint: models::TokenHintType,
|
||||
}
|
||||
|
||||
impl RevokeRequest {
|
||||
pub fn new() -> RevokeRequest {
|
||||
pub fn new(token: Option<String>, token_type_hint: models::TokenHintType) -> RevokeRequest {
|
||||
RevokeRequest {
|
||||
token: None,
|
||||
token_type_hint: None,
|
||||
token,
|
||||
token_type_hint,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -12,22 +12,22 @@ use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct SearchRequest {
|
||||
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
|
||||
pub r#type: Option<models::SearchType>,
|
||||
#[serde(rename = "query", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub query: Option<Option<String>>,
|
||||
pub struct Search {
|
||||
#[serde(rename = "type")]
|
||||
pub r#type: models::SearchType,
|
||||
#[serde(rename = "query", deserialize_with = "Option::deserialize")]
|
||||
pub query: Option<String>,
|
||||
#[serde(rename = "page", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub page: Option<Option<i32>>,
|
||||
#[serde(rename = "game_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub game_id: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl SearchRequest {
|
||||
pub fn new() -> SearchRequest {
|
||||
SearchRequest {
|
||||
r#type: None,
|
||||
query: None,
|
||||
impl Search {
|
||||
pub fn new(r#type: models::SearchType, query: Option<String>) -> Search {
|
||||
Search {
|
||||
r#type,
|
||||
query,
|
||||
page: None,
|
||||
game_id: None,
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -18,10 +18,10 @@ pub enum SearchType {
|
||||
User,
|
||||
#[serde(rename = "group")]
|
||||
Group,
|
||||
#[serde(rename = "server")]
|
||||
Server,
|
||||
#[serde(rename = "cluster")]
|
||||
Cluster,
|
||||
#[serde(rename = "game_server")]
|
||||
GameServer,
|
||||
#[serde(rename = "game_server_cluster")]
|
||||
GameServerCluster,
|
||||
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ impl std::fmt::Display for SearchType {
|
||||
match self {
|
||||
Self::User => write!(f, "user"),
|
||||
Self::Group => write!(f, "group"),
|
||||
Self::Server => write!(f, "server"),
|
||||
Self::Cluster => write!(f, "cluster"),
|
||||
Self::GameServer => write!(f, "game_server"),
|
||||
Self::GameServerCluster => write!(f, "game_server_cluster"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
51
src/models/storage_file.rs
Normal file
51
src/models/storage_file.rs
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct StorageFile {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "content_type", deserialize_with = "Option::deserialize")]
|
||||
pub content_type: Option<String>,
|
||||
#[serde(rename = "url", deserialize_with = "Option::deserialize")]
|
||||
pub url: Option<String>,
|
||||
#[serde(rename = "size", skip_serializing_if = "Option::is_none")]
|
||||
pub size: Option<i64>,
|
||||
#[serde(rename = "hash", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub hash: Option<Option<String>>,
|
||||
#[serde(rename = "etag", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub etag: Option<Option<String>>,
|
||||
#[serde(rename = "created", skip_serializing_if = "Option::is_none")]
|
||||
pub created: Option<String>,
|
||||
#[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub updated: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl StorageFile {
|
||||
pub fn new(name: Option<String>, content_type: Option<String>, url: Option<String>) -> StorageFile {
|
||||
StorageFile {
|
||||
id: None,
|
||||
name,
|
||||
content_type,
|
||||
url,
|
||||
size: None,
|
||||
hash: None,
|
||||
etag: None,
|
||||
created: None,
|
||||
updated: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -23,8 +23,6 @@ pub struct TokenRequest {
|
||||
pub password: Option<Option<String>>,
|
||||
#[serde(rename = "refresh_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub refresh_token: Option<Option<String>>,
|
||||
#[serde(rename = "client_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub client_id: Option<Option<String>>,
|
||||
#[serde(rename = "redirect_uri", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub redirect_uri: Option<Option<String>>,
|
||||
#[serde(rename = "code_verifier", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -39,7 +37,6 @@ impl TokenRequest {
|
||||
username: None,
|
||||
password: None,
|
||||
refresh_token: None,
|
||||
client_id: None,
|
||||
redirect_uri: None,
|
||||
code_verifier: None,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -13,10 +13,10 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct TokenResponse {
|
||||
#[serde(rename = "token_type", skip_serializing_if = "Option::is_none")]
|
||||
pub token_type: Option<models::TokenType>,
|
||||
#[serde(rename = "access_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub access_token: Option<Option<String>>,
|
||||
#[serde(rename = "token_type")]
|
||||
pub token_type: models::TokenType,
|
||||
#[serde(rename = "access_token", deserialize_with = "Option::deserialize")]
|
||||
pub access_token: Option<String>,
|
||||
#[serde(rename = "refresh_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub refresh_token: Option<Option<String>>,
|
||||
#[serde(rename = "scope", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -28,10 +28,10 @@ pub struct TokenResponse {
|
||||
}
|
||||
|
||||
impl TokenResponse {
|
||||
pub fn new() -> TokenResponse {
|
||||
pub fn new(token_type: models::TokenType, access_token: Option<String>) -> TokenResponse {
|
||||
TokenResponse {
|
||||
token_type: None,
|
||||
access_token: None,
|
||||
token_type,
|
||||
access_token,
|
||||
refresh_token: None,
|
||||
scope: None,
|
||||
state: None,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -13,16 +13,16 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct UpdateProfile {
|
||||
#[serde(rename = "display_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub display_name: Option<Option<String>>,
|
||||
#[serde(rename = "display_name", deserialize_with = "Option::deserialize")]
|
||||
pub display_name: Option<String>,
|
||||
#[serde(rename = "biography", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub biography: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl UpdateProfile {
|
||||
pub fn new() -> UpdateProfile {
|
||||
pub fn new(display_name: Option<String>) -> UpdateProfile {
|
||||
UpdateProfile {
|
||||
display_name: None,
|
||||
display_name,
|
||||
biography: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
@@ -17,32 +17,16 @@ pub struct UserInfo {
|
||||
pub id: Option<String>,
|
||||
#[serde(rename = "uuid", skip_serializing_if = "Option::is_none")]
|
||||
pub uuid: Option<uuid::Uuid>,
|
||||
#[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(rename = "name", deserialize_with = "Option::deserialize")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "display_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub display_name: Option<Option<String>>,
|
||||
#[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub email: Option<Option<String>>,
|
||||
#[serde(rename = "email_verified", skip_serializing_if = "Option::is_none")]
|
||||
pub email_verified: Option<bool>,
|
||||
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
|
||||
pub r#type: Option<models::UserType>,
|
||||
#[serde(rename = "flags", skip_serializing_if = "Option::is_none")]
|
||||
pub flags: Option<String>,
|
||||
#[serde(rename = "permissions", skip_serializing_if = "Option::is_none")]
|
||||
pub permissions: Option<String>,
|
||||
#[serde(rename = "verified", skip_serializing_if = "Option::is_none")]
|
||||
pub verified: Option<bool>,
|
||||
#[serde(rename = "level", skip_serializing_if = "Option::is_none")]
|
||||
pub level: Option<i32>,
|
||||
#[serde(rename = "experience", skip_serializing_if = "Option::is_none")]
|
||||
pub experience: Option<f64>,
|
||||
#[serde(rename = "public_birthday", skip_serializing_if = "Option::is_none")]
|
||||
pub public_birthday: Option<bool>,
|
||||
#[serde(rename = "birthday", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub birthday: Option<Option<String>>,
|
||||
#[serde(rename = "points", skip_serializing_if = "Option::is_none")]
|
||||
pub points: Option<f64>,
|
||||
#[serde(rename = "location", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub location: Option<Option<String>>,
|
||||
#[serde(rename = "language", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub language: Option<Option<String>>,
|
||||
#[serde(rename = "timezone", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -51,14 +35,8 @@ pub struct UserInfo {
|
||||
pub currency: Option<Option<String>>,
|
||||
#[serde(rename = "photo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub photo_url: Option<Option<String>>,
|
||||
#[serde(rename = "banner_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub banner_url: Option<Option<String>>,
|
||||
#[serde(rename = "last_online", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub last_online: Option<Option<String>>,
|
||||
#[serde(rename = "biography", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub biography: Option<Option<String>>,
|
||||
#[serde(rename = "view_count", skip_serializing_if = "Option::is_none")]
|
||||
pub view_count: Option<i32>,
|
||||
#[serde(rename = "permissions", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub permissions: Option<Option<Vec<String>>>,
|
||||
#[serde(rename = "created", skip_serializing_if = "Option::is_none")]
|
||||
pub created: Option<String>,
|
||||
#[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
@@ -66,31 +44,20 @@ pub struct UserInfo {
|
||||
}
|
||||
|
||||
impl UserInfo {
|
||||
pub fn new() -> UserInfo {
|
||||
pub fn new(name: Option<String>) -> UserInfo {
|
||||
UserInfo {
|
||||
id: None,
|
||||
uuid: None,
|
||||
name: None,
|
||||
name,
|
||||
display_name: None,
|
||||
email: None,
|
||||
email_verified: None,
|
||||
r#type: None,
|
||||
flags: None,
|
||||
permissions: None,
|
||||
verified: None,
|
||||
level: None,
|
||||
experience: None,
|
||||
public_birthday: None,
|
||||
birthday: None,
|
||||
points: None,
|
||||
location: None,
|
||||
language: None,
|
||||
timezone: None,
|
||||
currency: None,
|
||||
photo_url: None,
|
||||
banner_url: None,
|
||||
last_online: None,
|
||||
biography: None,
|
||||
view_count: None,
|
||||
permissions: None,
|
||||
created: None,
|
||||
updated: None,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Tribufu API
|
||||
*
|
||||
* REST API to access Tribufu services.
|
||||
* API to access Tribufu services.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.1.0
|
||||
* The version of the OpenAPI document: 1.3.0
|
||||
* Contact: contact@tribufu.com
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
21
src/platform/Cargo.toml
Normal file
21
src/platform/Cargo.toml
Normal file
@@ -0,0 +1,21 @@
|
||||
[package]
|
||||
name = "tribufu-platform"
|
||||
version = "1.3.0"
|
||||
description = "Tribufu Platform"
|
||||
repository = "https://github.com/tribufu/tribufu-rust"
|
||||
authors = ["Tribufu <contact@tribufu.com>"]
|
||||
license = "MIT"
|
||||
edition = "2021"
|
||||
publish = true
|
||||
|
||||
[lib]
|
||||
name = "tribufu_platform"
|
||||
crate-type = ["rlib"]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
tribufu-error = { version = "1.3.0", path = "../error" }
|
||||
dunce = "1.0.4"
|
||||
|
||||
[target.'cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))'.dependencies]
|
||||
dirs = "5.0.1"
|
||||
4
src/platform/lib.rs
Normal file
4
src/platform/lib.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pub mod paths;
|
||||
50
src/platform/paths.rs
Normal file
50
src/platform/paths.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use tribufu_error::Result;
|
||||
|
||||
/// Gets the root base directory of the application.
|
||||
pub fn app_dir() -> Result<PathBuf> {
|
||||
let mut path = dunce::canonicalize(env::current_exe()?)?; // /bin/platform/app.exe
|
||||
path.pop(); // /bin
|
||||
path.pop(); // /
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
/// Gets the path to the platform-specific binary directory.
|
||||
pub fn bin_dir() -> Result<PathBuf> {
|
||||
let base_dir = app_dir()?;
|
||||
|
||||
#[cfg(all(target_os = "macos", not(debug_assertions)))]
|
||||
return Ok(base_dir.join("MacOS"));
|
||||
|
||||
#[cfg(not(all(target_os = "macos", not(debug_assertions))))]
|
||||
Ok(base_dir.join("bin"))
|
||||
}
|
||||
|
||||
/// Gets the path to the configuration directory.
|
||||
pub fn config_dir() -> Result<PathBuf> {
|
||||
Ok(app_dir()?.join("config"))
|
||||
}
|
||||
|
||||
/// Gets the path to the assets directory.
|
||||
pub fn assets_dir() -> Result<PathBuf> {
|
||||
Ok(app_dir()?.join("assets"))
|
||||
}
|
||||
|
||||
/// Gets the path to the saved data directory.
|
||||
pub fn saved_dir() -> Result<PathBuf> {
|
||||
Ok(app_dir()?.join("saved"))
|
||||
}
|
||||
|
||||
/// Gets the path to the cache directory inside `saved`.
|
||||
pub fn cache_dir() -> Result<PathBuf> {
|
||||
Ok(saved_dir()?.join("cache"))
|
||||
}
|
||||
|
||||
/// Gets the path to the logs directory inside `saved`.
|
||||
pub fn logs_dir() -> Result<PathBuf> {
|
||||
Ok(saved_dir()?.join("logs"))
|
||||
}
|
||||
Reference in New Issue
Block a user