Skip to content

Commit

Permalink
Add missing types
Browse files Browse the repository at this point in the history
  • Loading branch information
arnautov-anton committed Feb 24, 2025
1 parent bc2023b commit d04bff1
Showing 1 changed file with 51 additions and 21 deletions.
72 changes: 51 additions & 21 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ export type UpdateChannelOptions = {
remove_members?: string[];
user?: UserResponse;
user_id?: string;
};
} & ChannelConfigWithInfo;

export type MarkChannelsReadOptions = {
client_id?: string;
Expand Down Expand Up @@ -1461,25 +1461,30 @@ export type ReactionFilters = QueryFilters<

export type ChannelFilters = QueryFilters<
ContainsOperator<CustomChannelData> & {
archived?: boolean;
'member.user.name'?:
| RequireOnlyOne<{
$autocomplete?: string;
$eq?: string;
}>
| string;

members?:
| RequireOnlyOne<Pick<QueryFilter<string>, '$in'>>
| RequireOnlyOne<Pick<QueryFilter<string[]>, '$eq'>>
| PrimitiveFilter<string[]>;
} & {
name?:
| RequireOnlyOne<
{
$autocomplete?: ChannelResponse['name'];
} & QueryFilter<ChannelResponse['name']>
>
| PrimitiveFilter<ChannelResponse['name']>;
pinned?: boolean;
} & {
[Key in keyof Omit<ChannelResponse, 'name' | 'members' | keyof CustomChannelData>]:
| RequireOnlyOne<QueryFilter<ChannelResponse[Key]>>
| PrimitiveFilter<ChannelResponse[Key]>;
} & {
archived?: boolean;
pinned?: boolean;
}
>;

Expand Down Expand Up @@ -1591,6 +1596,13 @@ export type ContainsOperator<CustomType = {}> = {

export type MessageFilters = QueryFilters<
ContainsOperator<CustomMessageData> & {
'attachments.type'?:
| RequireOnlyOne<{
$eq: PrimitiveFilter<Attachment['type']>;
$in: PrimitiveFilter<Attachment['type']>[];
}>
| PrimitiveFilter<Attachment['type']>;
'mentioned_users.id'?: RequireOnlyOne<{ $contains: PrimitiveFilter<UserResponse['id']> }>;
text?:
| RequireOnlyOne<
{
Expand All @@ -1599,6 +1611,13 @@ export type MessageFilters = QueryFilters<
} & QueryFilter<MessageResponse['text']>
>
| PrimitiveFilter<MessageResponse['text']>;
'user.id'?:
| RequireOnlyOne<
{
$autocomplete?: UserResponse['id'];
} & QueryFilter<UserResponse['id']>
>
| PrimitiveFilter<UserResponse['id']>;
} & {
[Key in keyof Omit<MessageResponse, 'text' | keyof CustomMessageData>]?:
| RequireOnlyOne<QueryFilter<MessageResponse[Key]>>
Expand Down Expand Up @@ -1693,6 +1712,9 @@ export type MemberFilters = QueryFilters<
}>
| UserResponse['id'];
invite?: { $eq?: ChannelMemberResponse['status'] } | ChannelMemberResponse['status'];
is_moderator?:
| RequireOnlyOne<{ $eq?: ChannelMemberResponse['is_moderator'] }>
| ChannelMemberResponse['is_moderator'];
joined?: { $eq?: boolean } | boolean;
last_active?:
| {
Expand All @@ -1711,6 +1733,9 @@ export type MemberFilters = QueryFilters<
$q?: NonNullable<ChannelMemberResponse['user']>['name'];
}>
| PrimitiveFilter<NonNullable<ChannelMemberResponse['user']>['name']>;
notifications_muted?:
| RequireOnlyOne<{ $eq?: ChannelMemberResponse['notifications_muted'] }>
| ChannelMemberResponse['notifications_muted'];
updated_at?:
| {
$eq?: ChannelMemberResponse['updated_at'];
Expand All @@ -1732,7 +1757,7 @@ export type MemberFilters = QueryFilters<
$eq?: ChannelMemberResponse['user_id'];
$in?: ChannelMemberResponse['user_id'][];
}>
| PrimitiveFilter<NonNullable<ChannelMemberResponse['user']>['id'][]>;
| PrimitiveFilter<ChannelMemberResponse['user_id']>;
} & {
[Key in keyof ContainsOperator<CustomMemberData>]?:
| RequireOnlyOne<QueryFilter<ContainsOperator<CustomMemberData>[Key]>>
Expand Down Expand Up @@ -1956,6 +1981,7 @@ export type Attachment = CustomAttachmentData & {
original_height?: number;
original_width?: number;
pretext?: string;
stopped_sharing?: boolean;
text?: string;
thumb_url?: string;
title?: string;
Expand Down Expand Up @@ -1990,15 +2016,13 @@ export type ChannelConfig = ChannelConfigFields &
commands?: CommandVariants[];
};

export type ChannelConfigAutomod = '' | 'AI' | 'disabled' | 'simple';
export type ChannelConfigAutomod = 'AI' | 'disabled' | 'simple' | (string & {});

export type ChannelConfigAutomodBehavior = '' | 'block' | 'flag';
export type ChannelConfigAutomodBehavior = 'block' | 'flag' | (string & {});

export type ChannelConfigAutomodThresholds = null | {
explicit?: { block?: number; flag?: number };
spam?: { block?: number; flag?: number };
toxic?: { block?: number; flag?: number };
};
export type ChannelConfigAutomodThresholds = null | Partial<
Record<'explicit' | 'spam' | 'toxic', { block?: number; flag?: number }>
>;

export type ChannelConfigFields = {
reminders: boolean;
Expand Down Expand Up @@ -2283,13 +2307,15 @@ export type EndpointName =
| 'ListPushProviders'
| 'CreatePoll';

export type ExportChannelRequest = {
id: string;
type: string;
cid?: string;
messages_since?: Date;
messages_until?: Date;
};
export type ExportChannelRequest = (
| {
id: string;
type: string;
}
| {
cid: string;
}
) & { messages_since?: Date; messages_until?: Date };

export type ExportChannelOptions = {
clear_deleted_message_text?: boolean;
Expand Down Expand Up @@ -2628,7 +2654,10 @@ export type ReservedMessageFields =
| 'updated_at'
| 'user';

export type UpdatedMessage = Omit<MessageResponse, 'mentioned_users'> & { mentioned_users?: string[] };
export type UpdatedMessage = Omit<MessageResponse, 'mentioned_users' | 'type'> & {
mentioned_users?: string[];
type?: MessageLabel;
};

export type User = CustomUserData & {
id: string;
Expand Down Expand Up @@ -2953,6 +2982,7 @@ export type UpdatePollAPIResponse = {

export type PollResponse = CustomPollData &
PollEnrichData & {
cid: string;
created_at: string;
created_by: UserResponse | null;
created_by_id: string;
Expand Down

0 comments on commit d04bff1

Please sign in to comment.