Compare commits
17 Commits
main
...
v0.1.14-sn
Author | SHA1 | Date | |
---|---|---|---|
e5f4b3c8c2 | |||
8b28a1b19c | |||
f220043646 | |||
ea0e9db16f | |||
578c3f8cc3 | |||
ae71cd9e1d | |||
9390008044 | |||
f8373270e9 | |||
4f52195ab1 | |||
8321416df3 | |||
a572e8f45d | |||
d65e294c42 | |||
cabe06d9b9 | |||
8616b0b9b1 | |||
89522014a0 | |||
e332e8976d | |||
610dac69a8 |
8
.devcontainer/Dockerfile
Normal file
8
.devcontainer/Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/rust/.devcontainer/base.Dockerfile
|
||||
# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye
|
||||
ARG VARIANT="bullseye"
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/rust:1-${VARIANT}
|
||||
|
||||
# [Optional] Uncomment this section to install additional packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
58
.devcontainer/devcontainer.json
Normal file
58
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,58 @@
|
||||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/rust
|
||||
{
|
||||
"name": "beteran-protobuf-rust",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"args": {
|
||||
// Use the VARIANT arg to pick a Debian OS version: buster, bullseye
|
||||
// Use bullseye when on local on arm64/Apple Silicon.
|
||||
"VARIANT": "bullseye"
|
||||
}
|
||||
},
|
||||
"runArgs": [
|
||||
"--cap-add=SYS_PTRACE",
|
||||
"--security-opt",
|
||||
"seccomp=unconfined"
|
||||
],
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"lldb.verboseLogging": true,
|
||||
"lldb.executable": "/usr/bin/lldb",
|
||||
"search.exclude": {
|
||||
"**/target": true
|
||||
},
|
||||
// VS Code don't watch files under ./target
|
||||
"files.watcherExclude": {
|
||||
"**/target/**": true
|
||||
},
|
||||
"rust-analyzer.checkOnSave.command": "clippy",
|
||||
"editor.tabSize": 2,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"donjayamanne.githistory",
|
||||
"eamodio.gitlens",
|
||||
"matklad.rust-analyzer",
|
||||
"mhutchie.git-graph",
|
||||
"ms-azuretools.vscode-docker",
|
||||
"mutantdino.resourcemonitor",
|
||||
"serayuzgur.crates",
|
||||
"tamasfe.even-better-toml",
|
||||
"vadimcn.vscode-lldb"
|
||||
]
|
||||
}
|
||||
},
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "",
|
||||
// Comment out to run as root instead.
|
||||
"remoteUser": "vscode"
|
||||
}
|
7
.devcontainer/rust-toolchain.toml
Normal file
7
.devcontainer/rust-toolchain.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[toolchain]
|
||||
channel = "stable"
|
||||
profile = "minimal"
|
||||
components = ["clippy", "rustfmt"]
|
||||
targets = [
|
||||
|
||||
]
|
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
.DS_Store
|
||||
/build
|
||||
|
||||
# Added by cargo
|
||||
|
||||
/target
|
||||
Cargo.lock
|
75
.rustfmt.toml
Normal file
75
.rustfmt.toml
Normal file
@ -0,0 +1,75 @@
|
||||
# https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=
|
||||
array_width = 60
|
||||
attr_fn_like_width = 70
|
||||
binop_separator = "Front" # "Front", "Back"
|
||||
blank_lines_lower_bound = 0
|
||||
blank_lines_upper_bound = 1
|
||||
brace_style = "SameLineWhere" #"AlwaysNextLine", "PreferSameLine", "SameLineWhere"
|
||||
chain_width = 60
|
||||
color = "Auto" #"Auto", "Always", "Never"
|
||||
combine_control_expr = true # true, false
|
||||
comment_width = 80
|
||||
condense_wildcard_suffixes = false # true, false
|
||||
control_brace_style = "AlwaysSameLine" # "AlwaysNextLine", "AlwaysSameLine", "ClosingNextLine"
|
||||
disable_all_formatting = false # true, false
|
||||
edition = "2015" # "2015", "2018", "2021"
|
||||
empty_item_single_line = true # true, false
|
||||
enum_discrim_align_threshold = 0
|
||||
error_on_line_overflow = false # true, false
|
||||
error_on_unformatted = false # true, false
|
||||
fn_args_layout = "Tall" # "Compressed", "Tall", "Vertical"
|
||||
fn_call_width = 60
|
||||
fn_single_line = false # true, false
|
||||
force_explicit_abi = true # true, false
|
||||
force_multiline_blocks = false # true, false
|
||||
format_code_in_doc_comments = false # true, false
|
||||
format_generated_files = false # true, false
|
||||
format_macro_matchers = false # true, false
|
||||
format_macro_bodies = true # true, false
|
||||
format_strings = false # true, false
|
||||
group_imports = "Preserve" # "Preserve", "StdExternalCrate"
|
||||
hard_tabs = false # true, false
|
||||
hex_literal_case = "Preserve" # "Upper", "Lower"
|
||||
hide_parse_errors = false # true, false
|
||||
ignore = []
|
||||
imports_indent = "Block" # "Block", "Visual"
|
||||
imports_layout = "Mixed" # "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
|
||||
indent_style = "Block" # "Block", "Visual"
|
||||
inline_attribute_width = 0
|
||||
license_template_path = ""
|
||||
match_arm_blocks = true # true, false
|
||||
match_arm_leading_pipes = "Never" # "Always", "Never", "Preserve"
|
||||
match_block_trailing_comma = false # true, false
|
||||
max_width = 100
|
||||
merge_derives = true # true, false
|
||||
imports_granularity = "Preserve" # "Preserve", "Crate", "Module", "Item", "One"
|
||||
merge_imports = false # true, false
|
||||
newline_style = "Auto" # "Auto", "Native", "Unix", "Windows"
|
||||
normalize_comments = false # true, false
|
||||
normalize_doc_attributes = false # true, false
|
||||
overflow_delimited_expr = false # true, false
|
||||
remove_nested_parens = true # true, false
|
||||
reorder_impl_items = false # true, false
|
||||
reorder_imports = true # true, false
|
||||
reorder_modules = true # true, false
|
||||
report_fixme = "Never" # "Always", "Unnumbered", "Never"
|
||||
report_todo = "Never" # "Always", "Unnumbered", "Never"
|
||||
skip_children = false # true, false
|
||||
single_line_if_else_max_width = 50
|
||||
space_after_colon = true # true, false
|
||||
space_before_colon = false # true, false
|
||||
spaces_around_ranges = false # true, false
|
||||
struct_field_align_threshold = 0
|
||||
struct_lit_single_line = true # true, false
|
||||
struct_lit_width = 18
|
||||
struct_variant_width = 35
|
||||
tab_spaces = 2
|
||||
trailing_comma = "Vertical" # "Always", "Never", "Vertical"
|
||||
trailing_semicolon = true # true, false
|
||||
type_punctuation_density = "Wide" # "Compressed", "Wide"
|
||||
unstable_features = false # true, false
|
||||
use_field_init_shorthand = false # true, false
|
||||
use_small_heuristics = "Default" # "Default", "Off", "Max"
|
||||
use_try_shorthand = false # true, false
|
||||
where_single_line = false # true, false
|
||||
wrap_comments = false # true, false
|
15
Cargo.toml
Normal file
15
Cargo.toml
Normal file
@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "beteran-protobuf-rust"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[lib]
|
||||
name = "beteran_protobuf_rust"
|
||||
path = "./src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
prost = { version = "0" }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = { version = "1" }
|
||||
const_format = { version = "0" }
|
35
src/c2se/backend/identity.rs
Normal file
35
src/c2se/backend/identity.rs
Normal file
@ -0,0 +1,35 @@
|
||||
use crate::protobuf::rpc;
|
||||
|
||||
const SUBJECT: &str = "bet.beteran.c2se.backend.identity";
|
||||
|
||||
pub const SUBJECT_CHECK_USERNAME_FOR_DUPLICATION: &str =
|
||||
const_format::concatcp!(SUBJECT, ".CheckUsernameForDuplication");
|
||||
/// subject = bet.beteran.c2se.backend.identity.CheckUsernameForDuplication;
|
||||
|
||||
pub const SUBJECT_CHECK_NICKNAME_FOR_DUPLICATION: &str =
|
||||
const_format::concatcp!(SUBJECT, ".CheckNicknameForDuplication");
|
||||
/// subject = bet.beteran.c2se.backend.identity.CheckNicknameForDuplication;
|
||||
|
||||
pub const SUBJECT_CAPTCHA: &str = const_format::concatcp!(SUBJECT, ".Captcha");
|
||||
/// subject = bet.beteran.c2se.backend.identity.Captcha
|
||||
|
||||
pub const SUBJECT_SIGNIN: &str = const_format::concatcp!(SUBJECT, ".Signin");
|
||||
/// subject = bet.beteran.c2se.backend.identity.Signin
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SigninRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub token: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub security_code: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "3")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "4")]
|
||||
pub password: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SigninResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(string, optional, tag = "2")]
|
||||
pub session_id: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
57
src/c2se/backend/member.rs
Normal file
57
src/c2se/backend/member.rs
Normal file
@ -0,0 +1,57 @@
|
||||
use crate::protobuf::rpc;
|
||||
use crate::protobuf::pagination;
|
||||
use crate::models::member;
|
||||
|
||||
const SUBJECT: &str = "bet.beteran.c2se.backend.member";
|
||||
|
||||
pub const SUBJECT_LIST_MEMBERS: &str =
|
||||
const_format::concatcp!(SUBJECT, ".ListMembers");
|
||||
/// subject = bet.beteran.c2se.backend.member.ListMembers
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct ListMembersRequest {
|
||||
#[prost(message, optional, tag="1")]
|
||||
pub pagination: ::core::option::Option<pagination::Pagination>,
|
||||
#[prost(message, repeated, tag="2")]
|
||||
pub searches: ::prost::alloc::vec::Vec<pagination::Search>,
|
||||
#[prost(message, repeated, tag="3")]
|
||||
pub sorts: ::prost::alloc::vec::Vec<pagination::Sort>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct ListMembersResponse {
|
||||
#[prost(message, optional, tag="1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(message, repeated, tag="2")]
|
||||
pub members: ::prost::alloc::vec::Vec<member::Member>,
|
||||
}
|
||||
|
||||
pub const SUBJECT_GET_MEMBER: &str =
|
||||
const_format::concatcp!(SUBJECT, ".GetMember");
|
||||
/// subject = bet.beteran.c2se.backend.member.GetMember
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetMemberRequest {
|
||||
#[prost(string, tag="1")]
|
||||
pub id: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetMemberResponse {
|
||||
#[prost(message, optional, tag="1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(message, optional, tag="2")]
|
||||
pub member: ::core::option::Option<member::Member>,
|
||||
}
|
||||
|
||||
pub const SUBJECT_GET_MEMBER_BY_USERNAME: &str =
|
||||
const_format::concatcp!(SUBJECT, ".GetMemberByUsername");
|
||||
/// subject = bet.beteran.c2se.backend.member.GetMemberByUsername
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetMemberByUsernameRequest {
|
||||
#[prost(string, tag="1")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetMemberByUsernameResponse {
|
||||
#[prost(message, optional, tag="1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(message, optional, tag="2")]
|
||||
pub member: ::core::option::Option<member::Member>,
|
||||
}
|
2
src/c2se/backend/mod.rs
Normal file
2
src/c2se/backend/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub mod identity;
|
||||
pub mod member;
|
44
src/c2se/common/identity.rs
Normal file
44
src/c2se/common/identity.rs
Normal file
@ -0,0 +1,44 @@
|
||||
use crate::protobuf::rpc;
|
||||
|
||||
const SUBJECT: &str = "bet.beteran.c2se.common.identity";
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CheckUsernameForDuplicationRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CheckUsernameForDuplicationResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(bool, optional, tag = "2")]
|
||||
pub duplicated: ::core::option::Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CheckNicknameForDuplicationRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub nickname: ::prost::alloc::string::String,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CheckNicknameForDuplicationResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(bool, optional, tag = "2")]
|
||||
pub duplicated: ::core::option::Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CaptchaRequest {}
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CaptchaResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(string, optional, tag = "2")]
|
||||
pub token: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, optional, tag = "3")]
|
||||
pub image: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
1
src/c2se/common/mod.rs
Normal file
1
src/c2se/common/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod identity;
|
1
src/c2se/core/mod.rs
Normal file
1
src/c2se/core/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod network;
|
3
src/c2se/core/network.rs
Normal file
3
src/c2se/core/network.rs
Normal file
@ -0,0 +1,3 @@
|
||||
const HEADER: &str = "bet.beteran.c2se.core.network";
|
||||
|
||||
pub const HEADER_CLIENT: &str = const_format::concatcp!(HEADER, ".Client");
|
36
src/c2se/frontend/identity.rs
Normal file
36
src/c2se/frontend/identity.rs
Normal file
@ -0,0 +1,36 @@
|
||||
use crate::protobuf::rpc;
|
||||
|
||||
const SUBJECT: &str = "bet.beteran.c2se.frontend.identity";
|
||||
|
||||
pub const SUBJECT_CHECK_USERNAME_FOR_DUPLICATION: &str =
|
||||
const_format::concatcp!(SUBJECT, ".CheckUsernameForDuplication");
|
||||
/// subject = bet.beteran.c2se.frontend.identity.CheckUsernameForDuplication;
|
||||
|
||||
pub const SUBJECT_CHECK_NICKNAME_FOR_DUPLICATION: &str =
|
||||
const_format::concatcp!(SUBJECT, ".CheckNicknameForDuplication");
|
||||
/// subject = bet.beteran.c2se.frontend.identity.CheckNicknameForDuplication;
|
||||
|
||||
pub const SUBJECT_CAPTCHA: &str = const_format::concatcp!(SUBJECT, ".Captcha");
|
||||
/// subject = bet.beteran.c2se.frontend.identity.Captcha
|
||||
|
||||
pub const SUBJECT_SIGNIN: &str = const_format::concatcp!(SUBJECT, ".Signin");
|
||||
/// subject = bet.beteran.c2se.frontend.identity.Signin
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SigninRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub token: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub security_code: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "3")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "4")]
|
||||
pub password: ::prost::alloc::string::String,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SigninResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(string, optional, tag = "2")]
|
||||
pub session_id: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
1
src/c2se/frontend/mod.rs
Normal file
1
src/c2se/frontend/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod identity;
|
11
src/c2se/mod.rs
Normal file
11
src/c2se/mod.rs
Normal file
@ -0,0 +1,11 @@
|
||||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
pub mod backend;
|
||||
///
|
||||
pub mod common;
|
||||
///
|
||||
pub mod core;
|
||||
///
|
||||
pub mod frontend;
|
12
src/lib.rs
Normal file
12
src/lib.rs
Normal file
@ -0,0 +1,12 @@
|
||||
//!
|
||||
//!
|
||||
|
||||
#![deny(missing_docs)]
|
||||
#![deny(missing_debug_implementations)]
|
||||
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
|
||||
|
||||
pub mod c2se;
|
||||
pub mod models;
|
||||
pub mod protobuf;
|
||||
pub mod se2c;
|
||||
pub mod ss;
|
1
src/models/core/mod.rs
Normal file
1
src/models/core/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod network;
|
11
src/models/core/network.rs
Normal file
11
src/models/core/network.rs
Normal file
@ -0,0 +1,11 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message, Serialize, Deserialize)]
|
||||
pub struct Client {
|
||||
#[prost(string, tag = "1")]
|
||||
pub client_ip: ::prost::alloc::string::String,
|
||||
#[prost(string, optional, tag = "2")]
|
||||
pub site_url: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, optional, tag = "3")]
|
||||
pub session_id: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
107
src/models/member.rs
Normal file
107
src/models/member.rs
Normal file
@ -0,0 +1,107 @@
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct MemberClass {
|
||||
#[prost(string, tag = "1")]
|
||||
pub id: ::prost::alloc::string::String,
|
||||
#[prost(message, optional, boxed, tag = "2")]
|
||||
pub parent: ::core::option::Option<::prost::alloc::boxed::Box<MemberClass>>,
|
||||
#[prost(string, tag = "3")]
|
||||
pub name: ::prost::alloc::string::String,
|
||||
#[prost(uint64, tag = "4")]
|
||||
pub created_at: u64,
|
||||
#[prost(uint64, tag = "5")]
|
||||
pub updated_at: u64,
|
||||
#[prost(uint64, optional, tag = "6")]
|
||||
pub deleted_at: ::core::option::Option<u64>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct MemberLevel {
|
||||
#[prost(string, tag = "1")]
|
||||
pub id: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub name: ::prost::alloc::string::String,
|
||||
#[prost(uint32, tag = "3")]
|
||||
pub order: u32,
|
||||
#[prost(uint64, tag = "4")]
|
||||
pub created_at: u64,
|
||||
#[prost(uint64, tag = "5")]
|
||||
pub updated_at: u64,
|
||||
#[prost(uint64, optional, tag = "6")]
|
||||
pub deleted_at: ::core::option::Option<u64>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct MemberSite {
|
||||
#[prost(string, tag = "1")]
|
||||
pub id: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub url: ::prost::alloc::string::String,
|
||||
#[prost(uint64, tag = "3")]
|
||||
pub created_at: u64,
|
||||
#[prost(uint64, tag = "4")]
|
||||
pub updated_at: u64,
|
||||
#[prost(uint64, optional, tag = "5")]
|
||||
pub deleted_at: ::core::option::Option<u64>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Member {
|
||||
#[prost(string, tag = "1")]
|
||||
pub id: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub domain_id: ::prost::alloc::string::String,
|
||||
#[prost(message, optional, tag = "3")]
|
||||
pub member_class: ::core::option::Option<MemberClass>,
|
||||
#[prost(message, optional, tag = "4")]
|
||||
pub member_level: ::core::option::Option<MemberLevel>,
|
||||
#[prost(message, optional, tag = "5")]
|
||||
pub member_site: ::core::option::Option<MemberSite>,
|
||||
#[prost(message, optional, boxed, tag = "6")]
|
||||
pub referrer: ::core::option::Option<::prost::alloc::boxed::Box<Member>>,
|
||||
#[prost(uint64, tag = "7")]
|
||||
pub referred_count: u64,
|
||||
#[prost(string, tag = "8")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "9")]
|
||||
pub nickname: ::prost::alloc::string::String,
|
||||
#[prost(string, optional, tag = "10")]
|
||||
pub mobile_phone_number: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(enumeration = "MemberState", tag = "11")]
|
||||
pub state: i32,
|
||||
#[prost(uint64, optional, tag = "12")]
|
||||
pub state_changed_at: ::core::option::Option<u64>,
|
||||
#[prost(string, optional, tag = "13")]
|
||||
pub last_signined_ip: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(uint64, optional, tag = "14")]
|
||||
pub last_signined_at: ::core::option::Option<u64>,
|
||||
#[prost(uint64, tag = "15")]
|
||||
pub created_at: u64,
|
||||
#[prost(uint64, tag = "16")]
|
||||
pub updated_at: u64,
|
||||
#[prost(uint64, optional, tag = "17")]
|
||||
pub deleted_at: ::core::option::Option<u64>,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum MemberState {
|
||||
None = 0,
|
||||
Normal = 1,
|
||||
Pending = 2,
|
||||
Withdrawal = 3,
|
||||
Dormancy = 4,
|
||||
Blacklist = 5,
|
||||
Suspended = 6,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct MemberSession {
|
||||
#[prost(string, tag = "1")]
|
||||
pub id: ::prost::alloc::string::String,
|
||||
#[prost(message, optional, tag = "2")]
|
||||
pub member: ::core::option::Option<Member>,
|
||||
#[prost(string, tag = "3")]
|
||||
pub data: ::prost::alloc::string::String,
|
||||
#[prost(uint64, tag = "4")]
|
||||
pub last_accessed_at: u64,
|
||||
#[prost(uint64, tag = "5")]
|
||||
pub expires_at: u64,
|
||||
#[prost(uint64, tag = "6")]
|
||||
pub created_at: u64,
|
||||
}
|
2
src/models/mod.rs
Normal file
2
src/models/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub mod core;
|
||||
pub mod member;
|
2
src/protobuf/mod.rs
Normal file
2
src/protobuf/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub mod pagination;
|
||||
pub mod rpc;
|
27
src/protobuf/pagination.rs
Normal file
27
src/protobuf/pagination.rs
Normal file
@ -0,0 +1,27 @@
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Pagination {
|
||||
#[prost(uint32, optional, tag="1")]
|
||||
pub page: ::core::option::Option<u32>,
|
||||
#[prost(uint32, optional, tag="2")]
|
||||
pub page_size: ::core::option::Option<u32>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Search {
|
||||
#[prost(string, tag="1")]
|
||||
pub key: ::prost::alloc::string::String,
|
||||
#[prost(string, tag="2")]
|
||||
pub value: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Sort {
|
||||
#[prost(string, tag="1")]
|
||||
pub by: ::prost::alloc::string::String,
|
||||
#[prost(enumeration="SortOrder", tag="2")]
|
||||
pub order: i32,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum SortOrder {
|
||||
Asc = 0,
|
||||
Desc = 1,
|
||||
}
|
20
src/protobuf/rpc.rs
Normal file
20
src/protobuf/rpc.rs
Normal file
@ -0,0 +1,20 @@
|
||||
use std::fmt;
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Error {
|
||||
#[prost(int32, tag = "1")]
|
||||
pub code: i32,
|
||||
#[prost(string, optional, tag = "2")]
|
||||
pub message: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(bytes = "vec", optional, tag = "3")]
|
||||
pub data: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"Error code: {}, message: {:?}, data: {:?}",
|
||||
self.code, self.message, self.data
|
||||
) // user-facing output
|
||||
}
|
||||
}
|
48
src/se2c/event_message_attach_files.rs
Normal file
48
src/se2c/event_message_attach_files.rs
Normal file
@ -0,0 +1,48 @@
|
||||
use bemily_commons_protobuf_rust::protobuf::bemily::protobuf as bcprpbp;
|
||||
|
||||
pub const SUBJECT: &str = "bemily.messenger.chat.messages.se2c.event.message_attach_files";
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct MessageAttachFile {
|
||||
#[prost(string, tag = "1")]
|
||||
pub id: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub room_id: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "3")]
|
||||
pub message_id: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "4")]
|
||||
pub file_id: ::prost::alloc::string::String,
|
||||
#[prost(enumeration = "MessageAttachFileType", tag = "5")]
|
||||
pub attach_file_type: i32,
|
||||
#[prost(uint64, tag = "6")]
|
||||
pub created_at: u64,
|
||||
#[prost(uint64, tag = "7")]
|
||||
pub updated_at: u64,
|
||||
#[prost(uint64, optional, tag = "8")]
|
||||
pub deleted_at: ::core::option::Option<u64>,
|
||||
#[prost(enumeration = "bcprpbp::event::change::ChangeEventType", tag = "9")]
|
||||
pub change_type: i32,
|
||||
}
|
||||
|
||||
pub const SUBJECT_CHANGE: &str = const_format::concatcp!(SUBJECT, ".Change");
|
||||
/// subject = bemily.messenger.chat.messages.se2c.event.message_attach_files.Change;
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct ChangeEvent {
|
||||
#[prost(string, tag = "1")]
|
||||
pub identity_id: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub room_id: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "3")]
|
||||
pub message_id: ::prost::alloc::string::String,
|
||||
#[prost(message, repeated, tag = "4")]
|
||||
pub message_attach_files: ::prost::alloc::vec::Vec<MessageAttachFile>,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum MessageAttachFileType {
|
||||
None = 0,
|
||||
Image = 1,
|
||||
Video = 2,
|
||||
Sound = 3,
|
||||
File = 4,
|
||||
}
|
53
src/se2c/event_messages.rs
Normal file
53
src/se2c/event_messages.rs
Normal file
@ -0,0 +1,53 @@
|
||||
use bemily_commons_protobuf_rust::protobuf::bemily::protobuf as bcprpbp;
|
||||
|
||||
pub const SUBJECT: &str = "bemily.messenger.chat.messages.se2c.event.messages";
|
||||
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Message {
|
||||
#[prost(string, tag = "1")]
|
||||
pub id: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub room_id: ::prost::alloc::string::String,
|
||||
#[prost(string, optional, tag = "3")]
|
||||
pub sender_id: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(enumeration = "MessageType", tag = "4")]
|
||||
pub message_type: i32,
|
||||
#[prost(string, tag = "5")]
|
||||
pub message: ::prost::alloc::string::String,
|
||||
#[prost(uint64, tag = "6")]
|
||||
pub seq: u64,
|
||||
#[prost(uint64, tag = "7")]
|
||||
pub created_at: u64,
|
||||
#[prost(uint64, tag = "8")]
|
||||
pub updated_at: u64,
|
||||
#[prost(uint64, optional, tag = "9")]
|
||||
pub deleted_at: ::core::option::Option<u64>,
|
||||
#[prost(enumeration = "bcprpbp::event::change::ChangeEventType", tag = "10")]
|
||||
pub change_type: i32,
|
||||
}
|
||||
|
||||
pub const SUBJECT_CHANGE: &str = const_format::concatcp!(SUBJECT, ".Change");
|
||||
/// subject = bemily.messenger.chat.messages.se2c.event.messages.Change;
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct ChangeEvent {
|
||||
#[prost(string, tag = "1")]
|
||||
pub identity_id: ::prost::alloc::string::String,
|
||||
#[prost(message, optional, tag = "2")]
|
||||
pub message: ::core::option::Option<Message>,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum MessageType {
|
||||
None = 0,
|
||||
Normal = 1,
|
||||
Mass = 2,
|
||||
Image = 3,
|
||||
Video = 4,
|
||||
Sound = 5,
|
||||
File = 6,
|
||||
Emoticon = 7,
|
||||
Smileme = 8,
|
||||
Plan = 9,
|
||||
Combination = 10,
|
||||
Information = 11,
|
||||
}
|
12
src/se2c/mod.rs
Normal file
12
src/se2c/mod.rs
Normal file
@ -0,0 +1,12 @@
|
||||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
///
|
||||
#[cfg(feature = "se2c_event_messages")]
|
||||
pub mod event_messages;
|
||||
|
||||
///
|
||||
///
|
||||
#[cfg(feature = "se2c_event_message_attach_files")]
|
||||
pub mod event_message_attach_files;
|
80
src/ss/member/identity.rs
Normal file
80
src/ss/member/identity.rs
Normal file
@ -0,0 +1,80 @@
|
||||
use crate::models::core;
|
||||
use crate::protobuf::rpc;
|
||||
|
||||
const SUBJECT: &str = "bet.beteran.ss.member.identity";
|
||||
|
||||
pub const SUBJECT_CHECK_USERNAME_FOR_DUPLICATION: &str =
|
||||
const_format::concatcp!(SUBJECT, ".CheckUsernameForDuplication");
|
||||
/// subject = bet.beteran.ss.member.identity.CheckUsernameForDuplication;
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CheckUsernameForDuplicationRequest {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub client: ::core::option::Option<core::network::Client>,
|
||||
#[prost(string, tag = "2")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CheckUsernameForDuplicationResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(bool, optional, tag = "2")]
|
||||
pub duplicated: ::core::option::Option<bool>,
|
||||
}
|
||||
|
||||
pub const SUBJECT_CHECK_NICKNAME_FOR_DUPLICATION: &str =
|
||||
const_format::concatcp!(SUBJECT, ".CheckNicknameForDuplication");
|
||||
/// subject = bet.beteran.ss.member.identity.CheckNicknameForDuplication;
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CheckNicknameForDuplicationRequest {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub client: ::core::option::Option<core::network::Client>,
|
||||
#[prost(string, tag = "2")]
|
||||
pub nickname: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CheckNicknameForDuplicationResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(bool, optional, tag = "2")]
|
||||
pub duplicated: ::core::option::Option<bool>,
|
||||
}
|
||||
|
||||
pub const SUBJECT_CAPTCHA: &str = const_format::concatcp!(SUBJECT, ".Captcha");
|
||||
/// subject = bet.beteran.ss.member.identity.Captcha
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CaptchaRequest {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub client: ::core::option::Option<core::network::Client>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CaptchaResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(string, optional, tag = "2")]
|
||||
pub token: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, optional, tag = "3")]
|
||||
pub image: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
|
||||
pub const SUBJECT_SIGNIN: &str = const_format::concatcp!(SUBJECT, ".Signin");
|
||||
/// subject = bet.beteran.ss.member.identity.Signin
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SigninRequest {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub client: ::core::option::Option<core::network::Client>,
|
||||
#[prost(string, tag = "2")]
|
||||
pub token: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "3")]
|
||||
pub security_code: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "4")]
|
||||
pub username: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "5")]
|
||||
pub password: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SigninResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub error: ::core::option::Option<rpc::Error>,
|
||||
#[prost(string, optional, tag = "2")]
|
||||
pub session_id: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
1
src/ss/member/mod.rs
Normal file
1
src/ss/member/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod identity;
|
6
src/ss/mod.rs
Normal file
6
src/ss/mod.rs
Normal file
@ -0,0 +1,6 @@
|
||||
//!
|
||||
//!
|
||||
|
||||
///
|
||||
///
|
||||
pub mod member;
|
Loading…
x
Reference in New Issue
Block a user