Skip to content

Commit

Permalink
feat: hide channel for creator (#1109)
Browse files Browse the repository at this point in the history
* Added hide_for_creator property to ChannelResponse type

* Added `keep_channel_hidden` parameter to sendMessage

* `hide_for_creator` in channel request

* Moved `hide_for_creator`

* channel.create accepts ChannelQueryOptions

* Fixed formatting

* Fixed formatting

* chore: added call_types

* fix: watch, state, presence always false
  • Loading branch information
totalimmersion committed Mar 29, 2023
1 parent 10fde78 commit b1d36cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export class Channel<StreamChatGenerics extends ExtendableGenerics = DefaultGene
options?: {
force_moderation?: boolean;
is_pending_message?: boolean;
keep_channel_hidden?: boolean;
pending_message_metadata?: Record<string, string>;
skip_enrich_url?: boolean;
skip_push?: boolean;
Expand Down Expand Up @@ -968,14 +969,16 @@ export class Channel<StreamChatGenerics extends ExtendableGenerics = DefaultGene
* create - Creates a new channel
*
* @return {Promise<QueryChannelAPIResponse<StreamChatGenerics>>} The Server Response
*
*/
create = async () => {
const options = {
create = async (options?: ChannelQueryOptions<StreamChatGenerics>) => {
const defaultOptions = {
...options,
watch: false,
state: false,
presence: false,
};
return await this.query(options, 'latest');
return await this.query(defaultOptions, 'latest');
};

/**
Expand Down
4 changes: 4 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export type APIResponse = {

export type AppSettingsAPIResponse<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = APIResponse & {
app?: {
// TODO
// eslint-disable-next-line @typescript-eslint/no-explicit-any
call_types: any;
channel_configs: Record<
string,
{
Expand Down Expand Up @@ -734,6 +737,7 @@ export type ChannelQueryOptions<StreamChatGenerics extends ExtendableGenerics =
client_id?: string;
connection_id?: string;
data?: ChannelResponse<StreamChatGenerics>;
hide_for_creator?: boolean;
members?: PaginationOptions;
messages?: MessagePaginationOptions;
presence?: boolean;
Expand Down

0 comments on commit b1d36cd

Please sign in to comment.