Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/chatstate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,16 @@ println!("Cleared typing indicator");
## ChatStateType Enum

```rust
#[non_exhaustive]
pub enum ChatStateType {
Composing, // Typing text
Recording, // Recording audio
Paused, // Stopped typing/recording
}
```

`ChatStateType` is `#[non_exhaustive]`, so match statements should include a wildcard arm to handle future variants.

**Methods:**
- `as_str()` - Returns `"composing"`, `"recording"`, or `"paused"`

Expand Down
21 changes: 15 additions & 6 deletions api/community.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,10 @@ for p in &participants {

### CreateCommunityOptions

Options for creating a new community.
Options for creating a new community. Implements `PartialEq` and `Eq`.

```rust
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CreateCommunityOptions {
pub name: String,
pub description: Option<String>,
Expand All @@ -301,19 +302,21 @@ let options = CreateCommunityOptions::new("My Community");

### CreateCommunityResult

Result of creating a community.
Result of creating a community. Implements `PartialEq` and `Eq`.

```rust
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CreateCommunityResult {
pub gid: Jid,
}
```

### CommunitySubgroup

A subgroup within a community.
A subgroup within a community. Implements `PartialEq` and `Eq`.

```rust
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CommunitySubgroup {
pub id: Jid,
pub subject: String,
Expand All @@ -332,9 +335,10 @@ pub struct CommunitySubgroup {

### LinkSubgroupsResult

Result of linking subgroups to a community.
Result of linking subgroups to a community. Implements `PartialEq` and `Eq`.

```rust
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct LinkSubgroupsResult {
pub linked_jids: Vec<Jid>,
pub failed_groups: Vec<(Jid, u32)>,
Expand All @@ -343,9 +347,10 @@ pub struct LinkSubgroupsResult {

### UnlinkSubgroupsResult

Result of unlinking subgroups from a community.
Result of unlinking subgroups from a community. Implements `PartialEq` and `Eq`.

```rust
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UnlinkSubgroupsResult {
pub unlinked_jids: Vec<Jid>,
pub failed_groups: Vec<(Jid, u32)>,
Expand All @@ -354,9 +359,11 @@ pub struct UnlinkSubgroupsResult {

### GroupType

Classification of a group within the community hierarchy.
Classification of a group within the community hierarchy. Implements `PartialEq` and `Eq`.

```rust
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum GroupType {
Default,
Community,
Expand All @@ -366,6 +373,8 @@ pub enum GroupType {
}
```

`GroupType` is `#[non_exhaustive]`, so match statements should include a wildcard arm to handle future variants.

**Variants:**
- `Default` — Regular standalone group
- `Community` — Community parent group
Expand Down
6 changes: 5 additions & 1 deletion api/groups.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ pub async fn get_participating(&self) -> Result<HashMap<String, GroupMetadata>,
**Returns:**
- `HashMap<String, GroupMetadata>` - Map of group JID strings to metadata

`GroupMetadata` implements `PartialEq` and `Eq`, allowing direct comparison of group metadata instances.

**GroupMetadata fields:**
- `id: Jid` - Group JID
- `subject: String` - Group name
Expand All @@ -75,6 +77,8 @@ pub async fn get_participating(&self) -> Result<HashMap<String, GroupMetadata>,

See [Community API](/api/community) for community-specific operations.

`GroupParticipant` implements `PartialEq` and `Eq`.

**GroupParticipant fields:**
- `jid: Jid` - Participant JID
- `phone_number: Option<Jid>` - Phone number JID (for LID groups)
Expand Down Expand Up @@ -138,7 +142,7 @@ pub async fn create_group(
- `ephemeral_expiration: Option<u32>` - Disappearing messages timer in seconds (default: `0`)

**Returns:**
- `CreateGroupResult` with `gid: Jid` field
- `CreateGroupResult` with `gid: Jid` field. Implements `PartialEq` and `Eq`.

When the `PRIVACY_TOKEN_ON_GROUP_CREATE` AB prop is enabled, the library automatically resolves and attaches privacy tokens (`tc_token`) to each participant during group creation. This is handled internally — you don't need to manage tokens yourself.

Expand Down
14 changes: 12 additions & 2 deletions api/newsletter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,10 @@ println!("Subscribed for {}s", duration);

### NewsletterMetadata

Metadata for a newsletter channel.
Metadata for a newsletter channel. Implements `PartialEq` and `Eq` for direct comparison.

```rust
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct NewsletterMetadata {
pub jid: Jid,
pub name: String,
Expand All @@ -327,6 +328,8 @@ pub struct NewsletterMetadata {
### NewsletterVerification

```rust
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum NewsletterVerification {
Verified,
Unverified,
Expand All @@ -336,6 +339,8 @@ pub enum NewsletterVerification {
### NewsletterState

```rust
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum NewsletterState {
Active,
Suspended,
Expand All @@ -348,6 +353,8 @@ pub enum NewsletterState {
The viewer's role in a newsletter.

```rust
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum NewsletterRole {
Owner,
Admin,
Expand All @@ -356,6 +363,8 @@ pub enum NewsletterRole {
}
```

All newsletter enums are `#[non_exhaustive]`, so match statements should include a wildcard arm to handle future variants.

### NewsletterMessage

A message from a newsletter's history.
Expand All @@ -379,9 +388,10 @@ pub struct NewsletterMessage {

### NewsletterMessageType

The type of a newsletter message. Uses a `StringEnum` for type-safe wire-protocol mapping.
The type of a newsletter message. Uses a `StringEnum` for type-safe wire-protocol mapping. Implements `PartialEq` and `Eq`.

```rust
#[non_exhaustive]
pub enum NewsletterMessageType {
Text, // "text"
Media, // "media"
Expand Down
3 changes: 3 additions & 0 deletions api/presence.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,15 @@ println!("Unsubscribed from {}'s presence", contact_jid);
## PresenceStatus Enum

```rust
#[non_exhaustive]
pub enum PresenceStatus {
Available, // Online
Unavailable, // Offline
}
```

`PresenceStatus` is `#[non_exhaustive]`, so match statements should include a wildcard arm to handle future variants.

**Methods:**
- `as_str()` - Returns `"available"` or `"unavailable"`

Expand Down
7 changes: 7 additions & 0 deletions api/send.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub async fn send_message(
Result of a successfully sent message. Provides the message ID and a convenience method to construct a `MessageKey` for follow-up operations like album child linking.

```rust
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SendResult {
pub message_id: String,
pub to: Jid,
Expand Down Expand Up @@ -389,6 +390,7 @@ pub async fn revoke_message(
Specifies who is revoking (deleting) the message.

```rust
#[non_exhaustive]
pub enum RevokeType {
/// The message sender deleting their own message
Sender,
Expand All @@ -398,6 +400,8 @@ pub enum RevokeType {
}
```

`RevokeType` is `#[non_exhaustive]`, so match statements should include a wildcard arm to handle future variants.

<ParamField path="Sender" type="variant">
Default variant. Use when deleting your own message. Works in both DMs and groups.
</ParamField>
Expand Down Expand Up @@ -474,13 +478,16 @@ pub async fn pin_message(
Specifies how long a message stays pinned. Defaults to 7 days (matches WhatsApp Web behavior).

```rust
#[non_exhaustive]
pub enum PinDuration {
Hours24,
Days7, // default
Days30,
}
```

`PinDuration` is `#[non_exhaustive]`, so match statements should include a wildcard arm to handle future variants.

<ParamField path="Hours24" type="variant">
Pin for 24 hours
</ParamField>
Expand Down
Loading