1
This commit is contained in:
@@ -1897,6 +1897,16 @@ pub(crate) fn map_runtime_referral_invite_center_snapshot(
|
||||
today_inviter_reward_count: snapshot.today_inviter_reward_count,
|
||||
today_inviter_reward_remaining: snapshot.today_inviter_reward_remaining,
|
||||
reward_points: snapshot.reward_points,
|
||||
invited_users: snapshot
|
||||
.invited_users
|
||||
.into_iter()
|
||||
.map(|user| module_runtime::RuntimeReferralInvitedUserSnapshot {
|
||||
user_id: user.user_id,
|
||||
display_name: user.display_name,
|
||||
avatar_url: user.avatar_url,
|
||||
bound_at_micros: user.bound_at_micros,
|
||||
})
|
||||
.collect(),
|
||||
has_redeemed_code: snapshot.has_redeemed_code,
|
||||
bound_inviter_user_id: snapshot.bound_inviter_user_id,
|
||||
bound_at_micros: snapshot.bound_at_micros,
|
||||
@@ -3884,6 +3894,9 @@ pub(crate) fn map_runtime_profile_wallet_ledger_source_type_back(
|
||||
crate::module_bindings::RuntimeProfileWalletLedgerSourceType::SnapshotSync => {
|
||||
module_runtime::RuntimeProfileWalletLedgerSourceType::SnapshotSync
|
||||
}
|
||||
crate::module_bindings::RuntimeProfileWalletLedgerSourceType::NewUserRegistrationReward => {
|
||||
module_runtime::RuntimeProfileWalletLedgerSourceType::NewUserRegistrationReward
|
||||
}
|
||||
crate::module_bindings::RuntimeProfileWalletLedgerSourceType::InviteInviterReward => {
|
||||
module_runtime::RuntimeProfileWalletLedgerSourceType::InviteInviterReward
|
||||
}
|
||||
|
||||
@@ -55,3 +55,4 @@ impl admin_upsert_profile_invite_code for super::RemoteProcedures {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
|
||||
use super::runtime_profile_wallet_adjustment_procedure_result_type::RuntimeProfileWalletAdjustmentProcedureResult;
|
||||
use super::runtime_profile_dashboard_get_input_type::RuntimeProfileDashboardGetInput;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct GrantNewUserRegistrationWalletRewardArgs {
|
||||
pub input: RuntimeProfileDashboardGetInput,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for GrantNewUserRegistrationWalletRewardArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the procedure `grant_new_user_registration_wallet_reward`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait grant_new_user_registration_wallet_reward {
|
||||
fn grant_new_user_registration_wallet_reward(&self, input: RuntimeProfileDashboardGetInput,
|
||||
) {
|
||||
self.grant_new_user_registration_wallet_reward_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn grant_new_user_registration_wallet_reward_then(
|
||||
&self,
|
||||
input: RuntimeProfileDashboardGetInput,
|
||||
|
||||
__callback: impl FnOnce(&super::ProcedureEventContext, Result<RuntimeProfileWalletAdjustmentProcedureResult, __sdk::InternalError>) + Send + 'static,
|
||||
);
|
||||
}
|
||||
|
||||
impl grant_new_user_registration_wallet_reward for super::RemoteProcedures {
|
||||
fn grant_new_user_registration_wallet_reward_then(
|
||||
&self,
|
||||
input: RuntimeProfileDashboardGetInput,
|
||||
|
||||
__callback: impl FnOnce(&super::ProcedureEventContext, Result<RuntimeProfileWalletAdjustmentProcedureResult, __sdk::InternalError>) + Send + 'static,
|
||||
) {
|
||||
self.imp.invoke_procedure_with_callback::<_, RuntimeProfileWalletAdjustmentProcedureResult>(
|
||||
"grant_new_user_registration_wallet_reward",
|
||||
GrantNewUserRegistrationWalletRewardArgs { input, },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,6 +375,7 @@ pub mod runtime_profile_wallet_ledger_source_type_type;
|
||||
pub mod runtime_referral_invite_center_get_input_type;
|
||||
pub mod runtime_referral_invite_center_procedure_result_type;
|
||||
pub mod runtime_referral_invite_center_snapshot_type;
|
||||
pub mod runtime_referral_invited_user_snapshot_type;
|
||||
pub mod runtime_referral_redeem_input_type;
|
||||
pub mod runtime_referral_redeem_procedure_result_type;
|
||||
pub mod runtime_referral_redeem_snapshot_type;
|
||||
@@ -507,6 +508,7 @@ pub mod get_runtime_inventory_state_procedure;
|
||||
pub mod get_runtime_setting_or_default_procedure;
|
||||
pub mod get_runtime_snapshot_procedure;
|
||||
pub mod get_story_session_state_procedure;
|
||||
pub mod grant_new_user_registration_wallet_reward_procedure;
|
||||
pub mod grant_player_progression_experience_and_return_procedure;
|
||||
pub mod import_auth_store_snapshot_procedure;
|
||||
pub mod import_database_migration_from_chunks_procedure;
|
||||
@@ -939,6 +941,7 @@ pub use runtime_profile_wallet_ledger_source_type_type::RuntimeProfileWalletLedg
|
||||
pub use runtime_referral_invite_center_get_input_type::RuntimeReferralInviteCenterGetInput;
|
||||
pub use runtime_referral_invite_center_procedure_result_type::RuntimeReferralInviteCenterProcedureResult;
|
||||
pub use runtime_referral_invite_center_snapshot_type::RuntimeReferralInviteCenterSnapshot;
|
||||
pub use runtime_referral_invited_user_snapshot_type::RuntimeReferralInvitedUserSnapshot;
|
||||
pub use runtime_referral_redeem_input_type::RuntimeReferralRedeemInput;
|
||||
pub use runtime_referral_redeem_procedure_result_type::RuntimeReferralRedeemProcedureResult;
|
||||
pub use runtime_referral_redeem_snapshot_type::RuntimeReferralRedeemSnapshot;
|
||||
@@ -1071,6 +1074,7 @@ pub use get_runtime_inventory_state_procedure::get_runtime_inventory_state;
|
||||
pub use get_runtime_setting_or_default_procedure::get_runtime_setting_or_default;
|
||||
pub use get_runtime_snapshot_procedure::get_runtime_snapshot;
|
||||
pub use get_story_session_state_procedure::get_story_session_state;
|
||||
pub use grant_new_user_registration_wallet_reward_procedure::grant_new_user_registration_wallet_reward;
|
||||
pub use grant_player_progression_experience_and_return_procedure::grant_player_progression_experience_and_return;
|
||||
pub use import_auth_store_snapshot_procedure::import_auth_store_snapshot;
|
||||
pub use import_database_migration_from_chunks_procedure::import_database_migration_from_chunks;
|
||||
|
||||
@@ -23,3 +23,4 @@ pub struct RuntimeProfileInviteCodeAdminProcedureResult {
|
||||
impl __sdk::InModule for RuntimeProfileInviteCodeAdminProcedureResult {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,3 +23,4 @@ pub struct RuntimeProfileInviteCodeAdminUpsertInput {
|
||||
impl __sdk::InModule for RuntimeProfileInviteCodeAdminUpsertInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,3 +24,4 @@ pub struct RuntimeProfileInviteCodeSnapshot {
|
||||
impl __sdk::InModule for RuntimeProfileInviteCodeSnapshot {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ use spacetimedb_sdk::__codegen::{
|
||||
pub enum RuntimeProfileWalletLedgerSourceType {
|
||||
SnapshotSync,
|
||||
|
||||
NewUserRegistrationReward,
|
||||
|
||||
InviteInviterReward,
|
||||
|
||||
InviteInviteeReward,
|
||||
|
||||
@@ -9,6 +9,7 @@ use spacetimedb_sdk::__codegen::{
|
||||
__ws,
|
||||
};
|
||||
|
||||
use super::runtime_referral_invited_user_snapshot_type::RuntimeReferralInvitedUserSnapshot;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
@@ -21,6 +22,7 @@ pub struct RuntimeReferralInviteCenterSnapshot {
|
||||
pub today_inviter_reward_count: u32,
|
||||
pub today_inviter_reward_remaining: u32,
|
||||
pub reward_points: u64,
|
||||
pub invited_users: Vec::<RuntimeReferralInvitedUserSnapshot>,
|
||||
pub has_redeemed_code: bool,
|
||||
pub bound_inviter_user_id: Option::<String>,
|
||||
pub bound_at_micros: Option::<i64>,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct RuntimeReferralInvitedUserSnapshot {
|
||||
pub user_id: String,
|
||||
pub display_name: String,
|
||||
pub avatar_url: Option::<String>,
|
||||
pub bound_at_micros: i64,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for RuntimeReferralInvitedUserSnapshot {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
@@ -89,6 +89,30 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn grant_new_user_registration_wallet_reward(
|
||||
&self,
|
||||
user_id: String,
|
||||
) -> Result<RuntimeProfileDashboardRecord, SpacetimeClientError> {
|
||||
let procedure_input = build_runtime_profile_dashboard_get_input(user_id)
|
||||
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?
|
||||
.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.grant_new_user_registration_wallet_reward_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_runtime_profile_wallet_adjustment_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn consume_profile_wallet_points(
|
||||
&self,
|
||||
user_id: String,
|
||||
|
||||
Reference in New Issue
Block a user