diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..0243837 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target-dir = "Binaries" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0e08d60 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "tribufu" +version = "0.0.1" +description = "TribuFu SDK" +repository = "https://github.com/TribuFu/SDK" +authors = ["TribuFu "] +license = "Apache-2.0" +readme = "README.md" +edition = "2018" +publish = true + +[lib] +name="TribuFu" +crate-type = ["staticlib", "cdylib", "rlib"] +path = "Source/TribuFu.rs" + +[dependencies] +libc = "0.2.0" +tokio = { version = "1.2.0", features = ["full"] } +reqwest = { version = "0.11.1", features = ["blocking", "json"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" + +[[example]] +name="Hello" +path = "Examples/Rust/Hello.rs" diff --git a/Examples/Rust/Hello.rs b/Examples/Rust/Hello.rs new file mode 100644 index 0000000..3130d3d --- /dev/null +++ b/Examples/Rust/Hello.rs @@ -0,0 +1,10 @@ + +// Copyright (c) TribuFu. All Rights Reserved + +#![allow(dead_code)] +#![allow(unused_variables)] +#![allow(non_snake_case)] + +fn main() { + println!("TribuFu SDK = {}", TribuFu::Hello()); +} diff --git a/Source/Account/Auth.rs b/Source/Account/Auth.rs new file mode 100644 index 0000000..c89778c --- /dev/null +++ b/Source/Account/Auth.rs @@ -0,0 +1,35 @@ +// Copyright (c) TribuFu. All Rights Reserved + +use libc::c_char; + +pub fn Login(name: *const c_char, password: *const c_char) {} + +pub fn Logout() {} + +pub fn Refresh() {} + +pub fn Register(name: *const c_char, email: *const c_char, password: *const c_char) {} + +mod External { + use libc::c_char; + + #[no_mangle] + pub extern "C" fn Login(name: *const c_char, password: *const c_char) { + super::Login(name, password); + } + + #[no_mangle] + pub extern "C" fn Logout() { + super::Logout(); + } + + #[no_mangle] + pub extern "C" fn Refresh() { + super::Refresh(); + } + + #[no_mangle] + pub extern "C" fn Register(name: *const c_char, email: *const c_char, password: *const c_char) { + super::Register(name, email, password); + } +} diff --git a/Source/Account/Device.rs b/Source/Account/Device.rs new file mode 100644 index 0000000..4b48e06 --- /dev/null +++ b/Source/Account/Device.rs @@ -0,0 +1,21 @@ +// Copyright (c) TribuFu. All Rights Reserved + +use libc::c_char; + +pub fn GetDevice(id: *const c_char) {} + +pub fn GetUserDevices(id: *const c_char) {} + +mod External { + use libc::c_char; + + #[no_mangle] + pub extern "C" fn GetDevice(id: *const c_char) { + super::GetDevice(id); + } + + #[no_mangle] + pub extern "C" fn GetUserDevices(id: *const c_char) { + super::GetUserDevices(id); + } +} diff --git a/Source/Account/Email.rs b/Source/Account/Email.rs new file mode 100644 index 0000000..d45046e --- /dev/null +++ b/Source/Account/Email.rs @@ -0,0 +1,21 @@ +// Copyright (c) TribuFu. All Rights Reserved + +use libc::c_char; + +pub fn GetEmail(address: *const c_char) {} + +pub fn GetUserEmails(id: *const c_char) {} + +mod External { + use libc::c_char; + + #[no_mangle] + pub extern "C" fn GetEmail(address: *const c_char) { + super::GetEmail(address); + } + + #[no_mangle] + pub extern "C" fn GetUserEmails(id: *const c_char) { + super::GetUserEmails(id); + } +} diff --git a/Source/Account/Role.rs b/Source/Account/Role.rs new file mode 100644 index 0000000..b4f3a12 --- /dev/null +++ b/Source/Account/Role.rs @@ -0,0 +1,21 @@ +// Copyright (c) TribuFu. All Rights Reserved + +use libc::c_char; + +pub fn GetRole(id: *const c_char) {} + +pub fn GetUserRoles(id: *const c_char) {} + +mod External { + use libc::c_char; + + #[no_mangle] + pub extern "C" fn GetRole(id: *const c_char) { + super::GetRole(id); + } + + #[no_mangle] + pub extern "C" fn GetUserRoles(id: *const c_char) { + super::GetUserRoles(id); + } +} diff --git a/Source/Account/User.rs b/Source/Account/User.rs new file mode 100644 index 0000000..dfe0124 --- /dev/null +++ b/Source/Account/User.rs @@ -0,0 +1,14 @@ +// Copyright (c) TribuFu. All Rights Reserved + +use libc::c_char; + +pub fn GetUser(id: *const c_char) {} + +mod External { + use libc::c_char; + + #[no_mangle] + pub extern "C" fn GetUser(id: *const c_char) { + super::GetUser(id); + } +} diff --git a/Source/Account/mod.rs b/Source/Account/mod.rs new file mode 100644 index 0000000..5bf7569 --- /dev/null +++ b/Source/Account/mod.rs @@ -0,0 +1,6 @@ +// Copyright (c) TribuFu. All Rights Reserved + +pub mod Auth; +pub mod Device; +pub mod Role; +pub mod User; diff --git a/Source/Friends/mod.rs b/Source/Friends/mod.rs new file mode 100644 index 0000000..2f6e24d --- /dev/null +++ b/Source/Friends/mod.rs @@ -0,0 +1,28 @@ +// Copyright (c) TribuFu. All Rights Reserved + +use libc::c_char; + +pub fn AddFriend(id1: *const c_char, id2: *const c_char) {} + +pub fn AcceptFriend(id1: *const c_char, id2: *const c_char) {} + +pub fn GetFriends(id: *const c_char) {} + +mod External { + use libc::c_char; + + #[no_mangle] + pub extern "C" fn AddFriend(id1: *const c_char, id2: *const c_char) { + super::AddFriend(id1, id2); + } + + #[no_mangle] + pub extern "C" fn AcceptFriend(id1: *const c_char, id2: *const c_char) { + super::AcceptFriend(id1, id2); + } + + #[no_mangle] + pub extern "C" fn GetFriends(id: *const c_char) { + super::GetFriends(id); + } +} diff --git a/Source/Matchmaking/mod.rs b/Source/Matchmaking/mod.rs new file mode 100644 index 0000000..e11b080 --- /dev/null +++ b/Source/Matchmaking/mod.rs @@ -0,0 +1,17 @@ +// Copyright (c) TribuFu. All Rights Reserved + +pub fn InviteToTeam() {} + +pub fn EnterTeam() {} + +mod External { + #[no_mangle] + pub extern "C" fn InviteToTeam() { + super::InviteToTeam(); + } + + #[no_mangle] + pub extern "C" fn EnterTeam() { + super::EnterTeam(); + } +} diff --git a/Source/Messages/mod.rs b/Source/Messages/mod.rs new file mode 100644 index 0000000..21cd2db --- /dev/null +++ b/Source/Messages/mod.rs @@ -0,0 +1,14 @@ +// Copyright (c) TribuFu. All Rights Reserved + +use libc::c_char; + +pub fn GetMessage(id: *const c_char) {} + +mod External { + use libc::c_char; + + #[no_mangle] + pub extern "C" fn GetMessage(id: *const c_char) { + super::GetMessage(id); + } +} diff --git a/Source/TribuFu.rs b/Source/TribuFu.rs new file mode 100644 index 0000000..bd8c39f --- /dev/null +++ b/Source/TribuFu.rs @@ -0,0 +1,15 @@ +// Copyright (c) TribuFu. All Rights Reserved + +#![allow(dead_code)] +#![allow(unused_variables)] +#![allow(non_snake_case)] + +pub mod Account; +pub mod Friends; +pub mod Matchmaking; +pub mod Messages; + +#[no_mangle] +pub extern "C" fn Hello() -> i32 { + return 1; +}