From 610dac69a89801a5d0ccff40cec841295b395ca4 Mon Sep 17 00:00:00 2001 From: PARK BYUNG JUN Date: Tue, 12 Jul 2022 06:43:07 +0000 Subject: [PATCH] initialized --- .devcontainer/Dockerfile | 8 ++ .devcontainer/devcontainer.json | 58 ++++++++++ .devcontainer/rust-toolchain.toml | 7 ++ .gitignore | 7 ++ .rustfmt.toml | 75 +++++++++++++ Cargo.toml | 14 +++ src/c2se/backend/identity.rs | 20 ++++ src/c2se/backend/member.rs | 47 +++++++++ src/c2se/backend/mod.rs | 1 + src/c2se/frontend/identity.rs | 19 ++++ src/c2se/frontend/mod.rs | 1 + src/c2se/mod.rs | 8 ++ src/lib.rs | 15 +++ src/models/member.rs | 91 ++++++++++++++++ src/models/mod.rs | 1 + src/protobuf/mod.rs | 2 + src/protobuf/pagination.rs | 27 +++++ src/protobuf/rpc.rs | 9 ++ src/se2c/event_message_attach_files.rs | 48 +++++++++ src/se2c/event_messages.rs | 53 ++++++++++ src/se2c/mod.rs | 12 +++ src/ss/event_message_attach_files.rs | 48 +++++++++ src/ss/event_messages.rs | 65 ++++++++++++ src/ss/message_attach_files.rs | 79 ++++++++++++++ src/ss/messages.rs | 140 +++++++++++++++++++++++++ src/ss/mod.rs | 22 ++++ 26 files changed, 877 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/rust-toolchain.toml create mode 100644 .gitignore create mode 100644 .rustfmt.toml create mode 100644 Cargo.toml create mode 100644 src/c2se/backend/identity.rs create mode 100644 src/c2se/backend/member.rs create mode 100644 src/c2se/backend/mod.rs create mode 100644 src/c2se/frontend/identity.rs create mode 100644 src/c2se/frontend/mod.rs create mode 100644 src/c2se/mod.rs create mode 100644 src/lib.rs create mode 100644 src/models/member.rs create mode 100644 src/models/mod.rs create mode 100644 src/protobuf/mod.rs create mode 100644 src/protobuf/pagination.rs create mode 100644 src/protobuf/rpc.rs create mode 100644 src/se2c/event_message_attach_files.rs create mode 100644 src/se2c/event_messages.rs create mode 100644 src/se2c/mod.rs create mode 100644 src/ss/event_message_attach_files.rs create mode 100644 src/ss/event_messages.rs create mode 100644 src/ss/message_attach_files.rs create mode 100644 src/ss/messages.rs create mode 100644 src/ss/mod.rs diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..a908b43 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -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 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..e90953e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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" +} \ No newline at end of file diff --git a/.devcontainer/rust-toolchain.toml b/.devcontainer/rust-toolchain.toml new file mode 100644 index 0000000..9f03cc5 --- /dev/null +++ b/.devcontainer/rust-toolchain.toml @@ -0,0 +1,7 @@ +[toolchain] +channel = "stable" +profile = "minimal" +components = ["clippy", "rustfmt"] +targets = [ + +] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..43cd30b --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +/build + +# Added by cargo + +/target +Cargo.lock diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..493c937 --- /dev/null +++ b/.rustfmt.toml @@ -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 diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..1c532ff --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "bbeteran-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 = "0.10" +serde = { version = "1.0", features = ["derive"] } +const_format = "0.2" diff --git a/src/c2se/backend/identity.rs b/src/c2se/backend/identity.rs new file mode 100644 index 0000000..97a6e7f --- /dev/null +++ b/src/c2se/backend/identity.rs @@ -0,0 +1,20 @@ +use crate::protobuf::rpc; + + +/// subject = bet.beteran.c2se.backend.identity.Signin +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SigninRequest { + #[prost(string, tag="1")] + pub username: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub password: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub security_code: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SigninResponse { + #[prost(message, optional, tag="1")] + pub error: ::core::option::Option, + #[prost(string, optional, tag="2")] + pub token: ::core::option::Option<::prost::alloc::string::String>, +} diff --git a/src/c2se/backend/member.rs b/src/c2se/backend/member.rs new file mode 100644 index 0000000..91ea376 --- /dev/null +++ b/src/c2se/backend/member.rs @@ -0,0 +1,47 @@ +use crate::protobuf::rpc; +use crate::protobuf::pagination; +use crate::models::member; + +/// 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, + #[prost(message, repeated, tag="2")] + pub searches: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub sorts: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListMembersResponse { + #[prost(message, optional, tag="1")] + pub error: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub members: ::prost::alloc::vec::Vec, +} +/// 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, + #[prost(message, optional, tag="2")] + pub member: ::core::option::Option, +} +/// 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, + #[prost(message, optional, tag="2")] + pub member: ::core::option::Option, +} diff --git a/src/c2se/backend/mod.rs b/src/c2se/backend/mod.rs new file mode 100644 index 0000000..cf7a71d --- /dev/null +++ b/src/c2se/backend/mod.rs @@ -0,0 +1 @@ +pub mod identity; \ No newline at end of file diff --git a/src/c2se/frontend/identity.rs b/src/c2se/frontend/identity.rs new file mode 100644 index 0000000..8c641aa --- /dev/null +++ b/src/c2se/frontend/identity.rs @@ -0,0 +1,19 @@ +use crate::protobuf::rpc; + +/// subject = bet.beteran.c2se.frontend.identity.Signin +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SigninRequest { + #[prost(string, tag="1")] + pub username: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub password: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub security_code: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SigninResponse { + #[prost(message, optional, tag="1")] + pub error: ::core::option::Option, + #[prost(string, optional, tag="2")] + pub token: ::core::option::Option<::prost::alloc::string::String>, +} diff --git a/src/c2se/frontend/mod.rs b/src/c2se/frontend/mod.rs new file mode 100644 index 0000000..db53a0c --- /dev/null +++ b/src/c2se/frontend/mod.rs @@ -0,0 +1 @@ +pub mod identity; diff --git a/src/c2se/mod.rs b/src/c2se/mod.rs new file mode 100644 index 0000000..d5626ec --- /dev/null +++ b/src/c2se/mod.rs @@ -0,0 +1,8 @@ +//! +//! + +/// +/// +pub mod backend; +/// +pub mod frontend; diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..2d1ada5 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,15 @@ +//! +//! + +#![deny(missing_docs)] +#![deny(missing_debug_implementations)] +#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + +pub mod models; +pub mod protobuf; +pub mod c2se; +pub mod se2c; +pub mod ss; + + + diff --git a/src/models/member.rs b/src/models/member.rs new file mode 100644 index 0000000..5705182 --- /dev/null +++ b/src/models/member.rs @@ -0,0 +1,91 @@ +#[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>, + #[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, +} +#[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, +} +#[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, +} +#[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, + #[prost(message, optional, tag="4")] + pub member_level: ::core::option::Option, + #[prost(message, optional, tag="5")] + pub member_site: ::core::option::Option, + #[prost(message, optional, boxed, tag="6")] + pub referrer: ::core::option::Option<::prost::alloc::boxed::Box>, + #[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, + #[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, + #[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, +} +#[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, +} diff --git a/src/models/mod.rs b/src/models/mod.rs new file mode 100644 index 0000000..0dd2a03 --- /dev/null +++ b/src/models/mod.rs @@ -0,0 +1 @@ +pub mod member; diff --git a/src/protobuf/mod.rs b/src/protobuf/mod.rs new file mode 100644 index 0000000..e536123 --- /dev/null +++ b/src/protobuf/mod.rs @@ -0,0 +1,2 @@ +pub mod pagination; +pub mod rpc; diff --git a/src/protobuf/pagination.rs b/src/protobuf/pagination.rs new file mode 100644 index 0000000..ace17d6 --- /dev/null +++ b/src/protobuf/pagination.rs @@ -0,0 +1,27 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Pagination { + #[prost(uint32, optional, tag="1")] + pub page: ::core::option::Option, + #[prost(uint32, optional, tag="2")] + pub page_size: ::core::option::Option, +} +#[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, +} diff --git a/src/protobuf/rpc.rs b/src/protobuf/rpc.rs new file mode 100644 index 0000000..04dcb2f --- /dev/null +++ b/src/protobuf/rpc.rs @@ -0,0 +1,9 @@ +#[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>, +} diff --git a/src/se2c/event_message_attach_files.rs b/src/se2c/event_message_attach_files.rs new file mode 100644 index 0000000..b0dece4 --- /dev/null +++ b/src/se2c/event_message_attach_files.rs @@ -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, + #[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, +} +#[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, +} diff --git a/src/se2c/event_messages.rs b/src/se2c/event_messages.rs new file mode 100644 index 0000000..a35ed33 --- /dev/null +++ b/src/se2c/event_messages.rs @@ -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, + #[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, +} +#[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, +} diff --git a/src/se2c/mod.rs b/src/se2c/mod.rs new file mode 100644 index 0000000..46416c2 --- /dev/null +++ b/src/se2c/mod.rs @@ -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; diff --git a/src/ss/event_message_attach_files.rs b/src/ss/event_message_attach_files.rs new file mode 100644 index 0000000..c5f88ea --- /dev/null +++ b/src/ss/event_message_attach_files.rs @@ -0,0 +1,48 @@ +use bemily_commons_protobuf_rust::protobuf::bemily::protobuf as bcprpbp; + +pub const SUBJECT: &str = "bemily.messenger.chat.messages.ss.event.messages"; + +#[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, + #[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.ss.event.message_attach_files.Change; +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangeEvent { + #[prost(string, repeated, tag = "1")] + pub identity_ids: ::prost::alloc::vec::Vec<::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, +} +#[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, +} diff --git a/src/ss/event_messages.rs b/src/ss/event_messages.rs new file mode 100644 index 0000000..971ebc0 --- /dev/null +++ b/src/ss/event_messages.rs @@ -0,0 +1,65 @@ +use bemily_commons_protobuf_rust::protobuf::bemily::protobuf as bcprpbp; + +pub const SUBJECT: &str = "bemily.messenger.chat.messages.ss.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, + #[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.ss.event.messages.Change; +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangeEvent { + #[prost(string, repeated, tag = "1")] + pub identity_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(message, optional, tag = "2")] + pub message: ::core::option::Option, +} + +pub const SUBJECT_CHANGE_MESSAGE: &str = const_format::concatcp!(SUBJECT, ".ChangeMessage"); +/// subject = bemily.messenger.chat.messages.ss.event.messages.ChangeMessage; +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangeMessageEvent { + #[prost(string, tag = "1")] + pub room_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub message_id: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub message: ::prost::alloc::string::String, +} +#[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, +} diff --git a/src/ss/message_attach_files.rs b/src/ss/message_attach_files.rs new file mode 100644 index 0000000..dd4e659 --- /dev/null +++ b/src/ss/message_attach_files.rs @@ -0,0 +1,79 @@ +use bemily_commons_protobuf_rust::protobuf::bemily::protobuf as bcprpbp; + +pub const SUBJECT: &str = "bemily.messenger.chat.messages.ss.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, +} + +pub const SUBJECT_LIST_BY_MESSAGE_ID: &str = const_format::concatcp!(SUBJECT, ".ListByMessageId"); +/// subject = bemily.messenger.chat.messages.ss.message_attach_files.ListByMessageId +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListByMessageIdRequest { + #[prost(string, tag = "1")] + pub message_id: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListByMessageIdResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub message_attach_files: ::prost::alloc::vec::Vec, +} + +pub const SUBJECT_DELETE: &str = const_format::concatcp!(SUBJECT, ".Delete"); +/// subject = bemily.messenger.chat.messages.ss.message_attach_files.Delete +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteRequest { + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, +} + +pub const SUBJECT_SYNCHRONIZE: &str = const_format::concatcp!(SUBJECT, ".Synchronize"); +/// subject = bemily.messenger.chat.messages.ss.message_attach_files.Synchronize +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SynchronizeRequest { + #[prost(string, tag = "1")] + pub identity_id: ::prost::alloc::string::String, + #[prost(uint64, optional, tag = "2")] + pub synchronized_at: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SynchronizeResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(uint64, optional, tag = "2")] + pub synchronized_at: ::core::option::Option, + #[prost(message, repeated, tag = "3")] + pub message_attach_files: ::prost::alloc::vec::Vec, +} +#[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, +} diff --git a/src/ss/messages.rs b/src/ss/messages.rs new file mode 100644 index 0000000..3acb644 --- /dev/null +++ b/src/ss/messages.rs @@ -0,0 +1,140 @@ +use bemily_commons_protobuf_rust::protobuf::bemily::protobuf as bcprpbp; + +pub const SUBJECT: &str = "bemily.messenger.chat.messages.ss.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, +} + +pub const SUBJECT_GET: &str = const_format::concatcp!(SUBJECT, ".Get"); +/// subject = bemily.messenger.chat.messages.ss.messages.Get +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetRequest { + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub message: ::core::option::Option, +} + +pub const SUBJECT_LIST_BY_IDS: &str = const_format::concatcp!(SUBJECT, ".ListByIds"); +/// subject = bemily.messenger.chat.messages.ss.messages.ListByIds +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListByIdsRequest { + #[prost(string, repeated, tag = "1")] + pub ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListByIdsResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub messages: ::prost::alloc::vec::Vec, +} + +pub const SUBJECT_CREATE: &str = const_format::concatcp!(SUBJECT, ".Create"); +/// subject = bemily.messenger.chat.messages.ss.messages.Create +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateRequest { + #[prost(string, tag = "1")] + pub room_id: ::prost::alloc::string::String, + #[prost(string, optional, tag = "2")] + pub sender_id: ::core::option::Option<::prost::alloc::string::String>, + #[prost(enumeration = "MessageType", tag = "3")] + pub message_type: i32, + #[prost(string, tag = "4")] + pub message: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub message: ::core::option::Option, +} + +pub const SUBJECT_CHANGE_MESSAGE: &str = const_format::concatcp!(SUBJECT, ".ChangeMessage"); +/// subject = bemily.messenger.chat.messages.ss.messages.ChangeMessage +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangeMessageRequest { + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub message: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangeMessageResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, +} + +pub const SUBJECT_DELETE: &str = const_format::concatcp!(SUBJECT, ".Delete"); +/// subject = bemily.messenger.chat.messages.ss.messages.Delete +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteRequest { + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, +} + +pub const SUBJECT_SYNCHRONIZE: &str = const_format::concatcp!(SUBJECT, ".Synchronize"); +/// subject = bemily.messenger.chat.messages.ss.messages.Synchronize +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SynchronizeRequest { + #[prost(string, tag = "1")] + pub identity_id: ::prost::alloc::string::String, + #[prost(uint64, optional, tag = "2")] + pub synchronized_at: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SynchronizeResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(uint64, optional, tag = "2")] + pub synchronized_at: ::core::option::Option, + #[prost(message, repeated, tag = "3")] + pub messages: ::prost::alloc::vec::Vec, +} + +#[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, +} diff --git a/src/ss/mod.rs b/src/ss/mod.rs new file mode 100644 index 0000000..9f9b345 --- /dev/null +++ b/src/ss/mod.rs @@ -0,0 +1,22 @@ +//! +//! + +/// +/// +#[cfg(feature = "ss_messages")] +pub mod messages; + +/// +/// +#[cfg(feature = "ss_message_attach_files")] +pub mod message_attach_files; + +/// +/// +#[cfg(feature = "ss_event_messages")] +pub mod event_messages; + +/// +/// +#[cfg(feature = "ss_event_message_attach_files")] +pub mod event_message_attach_files;