Task 3: fluxer-proto REST wire models + hand-authored fixtures #3

Closed
opened 2026-11-11 08:01:21 +00:00 by charles · 0 comments
Owner

Files:

  • Create: crates/fluxer-proto/src/models/{mod.rs,user.rs,guild.rs,channel.rs,message.rs,read_state.rs,presence.rs,settings.rs,instance.rs,auth.rs}
  • Create: fixtures/rest/{well_known.json,login_ok.json,login_mfa.json,user_me.json,guild.json,channel_text.json,channel_voice.json,channel_dm.json,member.json,role.json,message_default.json,message_reply.json,messages_page.json} — authored by hand from the TS schemas, realistic values, no secrets
  • Test: crates/fluxer-proto/tests/models_roundtrip.rs

Interfaces:

  • Produces (all #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)], #[serde(default)] on optional fields):
    • UserPartial { id: Snowflake, username, discriminator: String, global_name: Option<String>, avatar: Option<String>, avatar_color: Option<u32>, bot: bool, system: bool, flags: u64 }; UserPrivate = UserPartial fields + email: Option<String>, verified: bool, mfa_enabled: bool (fork:packages/schema/src/domains/user/UserResponseSchemas.ts:524-587).
    • Guild (GuildResponseSchemas.ts:264-306): id, name, icon: Option<String>, banner, owner_id, system_channel_id, features: Vec<String>, member_count: Option<u64>, online_count, joined_at, unavailable: bool, roles: Vec<Role>, channels: Vec<Channel>, emojis: Vec<Value>.
    • Role (GuildRoleSchemas.ts:7-18), Channel (ChannelSchemas.ts:152-178: id, guild_id, name, topic, r#type: ChannelType, position, parent_id, last_message_id, last_pin_timestamp, permission_overwrites: Vec<PermissionOverwrite{id, kind: u8 as "type", allow: Permissions, deny: Permissions}>, recipients: Vec<UserPartial>, nsfw, rate_limit_per_user, owner_id, icon), GuildMember (GuildMemberSchemas.ts:52-65).
    • Message (MessageResponseSchemas.ts:122-176: id, channel_id, author: UserPartial, r#type: MessageType, flags: u64, content: String, timestamp: Timestamp, edited_timestamp: Option<Timestamp>, pinned, mention_everyone, tts, mentions: Vec<UserPartial>, mention_roles: Vec<Snowflake>, attachments: Vec<Value>, embeds: Vec<Value>, reactions: Vec<Value>, message_reference: Option<MessageReference>, referenced_message: Option<Option<Box<Message>>> (double option: absent vs null), nonce: Option<String>).
    • ReadState { id: Snowflake, mention_count: u32, last_message_id: Option<Snowflake>, last_pin_timestamp, version }, Presence { guild_id, user: UserPartial, status: UserStatus, afk, mobile, custom_status: Option<Value> }.
    • UserSettings = serde_json::Value newtype with typed accessors guild_positions() -> Vec<Snowflake>, theme() -> Option<String> (full typing is sub-project 7).
    • WellKnown { api_code_version: String, endpoints: Endpoints { api, api_client, api_public, gateway, media, static_cdn, webapp: String, upload_relay: Option<String> } }.
    • LoginRequest { login: String, password: String }, LoginResponse = untagged enum Ok(AuthToken { token, user_id, user: UserPartial }) | Mfa { mfa: bool(true), ticket, allowed_methods: Vec<String>, totp: bool, webauthn: bool, backup_codes: bool }; MfaTotpRequest { code, ticket }; MessagesQuery { limit: u8, before/after/around: Option<Snowflake> }; SendMessageRequest { content: String, nonce: String }; EditMessageRequest { content }.

Plan: https://git.forked.io/charles/fluxer-native/src/branch/foundation/docs/superpowers/plans/2026-11-11-foundation.md (section "Task 3")

**Files:** - Create: `crates/fluxer-proto/src/models/{mod.rs,user.rs,guild.rs,channel.rs,message.rs,read_state.rs,presence.rs,settings.rs,instance.rs,auth.rs}` - Create: `fixtures/rest/{well_known.json,login_ok.json,login_mfa.json,user_me.json,guild.json,channel_text.json,channel_voice.json,channel_dm.json,member.json,role.json,message_default.json,message_reply.json,messages_page.json}` — authored by hand from the TS schemas, realistic values, no secrets - Test: `crates/fluxer-proto/tests/models_roundtrip.rs` **Interfaces:** - Produces (all `#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]`, `#[serde(default)]` on optional fields): - `UserPartial { id: Snowflake, username, discriminator: String, global_name: Option<String>, avatar: Option<String>, avatar_color: Option<u32>, bot: bool, system: bool, flags: u64 }`; `UserPrivate` = `UserPartial` fields + `email: Option<String>, verified: bool, mfa_enabled: bool` (`fork:packages/schema/src/domains/user/UserResponseSchemas.ts:524-587`). - `Guild` (`GuildResponseSchemas.ts:264-306`): `id, name, icon: Option<String>, banner, owner_id, system_channel_id, features: Vec<String>, member_count: Option<u64>, online_count, joined_at, unavailable: bool, roles: Vec<Role>, channels: Vec<Channel>, emojis: Vec<Value>`. - `Role` (`GuildRoleSchemas.ts:7-18`), `Channel` (`ChannelSchemas.ts:152-178`: `id, guild_id, name, topic, r#type: ChannelType, position, parent_id, last_message_id, last_pin_timestamp, permission_overwrites: Vec<PermissionOverwrite{id, kind: u8 as "type", allow: Permissions, deny: Permissions}>, recipients: Vec<UserPartial>, nsfw, rate_limit_per_user, owner_id, icon`), `GuildMember` (`GuildMemberSchemas.ts:52-65`). - `Message` (`MessageResponseSchemas.ts:122-176`: `id, channel_id, author: UserPartial, r#type: MessageType, flags: u64, content: String, timestamp: Timestamp, edited_timestamp: Option<Timestamp>, pinned, mention_everyone, tts, mentions: Vec<UserPartial>, mention_roles: Vec<Snowflake>, attachments: Vec<Value>, embeds: Vec<Value>, reactions: Vec<Value>, message_reference: Option<MessageReference>, referenced_message: Option<Option<Box<Message>>> (double option: absent vs null), nonce: Option<String>`). - `ReadState { id: Snowflake, mention_count: u32, last_message_id: Option<Snowflake>, last_pin_timestamp, version }`, `Presence { guild_id, user: UserPartial, status: UserStatus, afk, mobile, custom_status: Option<Value> }`. - `UserSettings` = `serde_json::Value` newtype with typed accessors `guild_positions() -> Vec<Snowflake>`, `theme() -> Option<String>` (full typing is sub-project 7). - `WellKnown { api_code_version: String, endpoints: Endpoints { api, api_client, api_public, gateway, media, static_cdn, webapp: String, upload_relay: Option<String> } }`. - `LoginRequest { login: String, password: String }`, `LoginResponse` = untagged enum `Ok(AuthToken { token, user_id, user: UserPartial })` | `Mfa { mfa: bool(true), ticket, allowed_methods: Vec<String>, totp: bool, webauthn: bool, backup_codes: bool }`; `MfaTotpRequest { code, ticket }`; `MessagesQuery { limit: u8, before/after/around: Option<Snowflake> }`; `SendMessageRequest { content: String, nonce: String }`; `EditMessageRequest { content }`. --- Plan: https://git.forked.io/charles/fluxer-native/src/branch/foundation/docs/superpowers/plans/2026-11-11-foundation.md (section "Task 3")
charles added this to the Foundation milestone 2026-11-11 08:01:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#3
No description provided.