From 005f7482113d0959899064d390dbf3370cedf6ea Mon Sep 17 00:00:00 2001 From: Justin Lei Date: Tue, 30 Jun 2026 09:14:49 -0400 Subject: [PATCH] feat: Update OpenAPI specs --- chat.go | 2 +- feeds-v3.go | 16 +++- feeds_test.go | 14 +++ models.go | 237 ++++++++++++++++++++++++++++++++++++++++---------- moderation.go | 52 +++++++++-- requests.go | 84 ++++++++++++++---- 6 files changed, 338 insertions(+), 67 deletions(-) diff --git a/chat.go b/chat.go index eed1499..8eeee9e 100644 --- a/chat.go +++ b/chat.go @@ -868,7 +868,7 @@ func (c *ChatClient) Search(ctx context.Context, request *SearchRequest) (*Strea return res, err } -// Create segment +// Create a segment func (c *ChatClient) CreateSegment(ctx context.Context, request *CreateSegmentRequest) (*StreamResponse[CreateSegmentResponse], error) { var result CreateSegmentResponse res, err := MakeRequest[CreateSegmentRequest, CreateSegmentResponse](c.client, ctx, "POST", "/api/v2/chat/segments", nil, request, &result, nil) diff --git a/feeds-v3.go b/feeds-v3.go index 80c6a94..56625ba 100644 --- a/feeds-v3.go +++ b/feeds-v3.go @@ -29,7 +29,7 @@ func (c *FeedsClient) UpsertActivities(ctx context.Context, request *UpsertActiv return res, err } -// Updates certain fields of multiple activities in a batch. Use 'set' to update specific fields and 'unset' to remove fields. Activities that fail due to not found, permission denied, or no changes detected are silently skipped and not included in the response. However, validation errors (e.g., updating reserved fields, invalid field values) will fail the entire batch request. +// Updates certain fields of multiple activities in a batch. Use 'set' to update specific fields and 'unset' to remove fields. Activities that fail due to not found, permission denied, or no changes detected are silently skipped and not included in the response. However, validation errors (e.g., updating reserved fields, invalid field values, exceeding size limits) will fail the entire batch request. // // Sends events: // - feeds.activity.updated @@ -60,6 +60,13 @@ func (c *FeedsClient) QueryActivities(ctx context.Context, request *QueryActivit return res, err } +// Returns a single user's reactions across a set of activity IDs, without activity payloads +func (c *FeedsClient) BatchQueryActivityReactions(ctx context.Context, request *BatchQueryActivityReactionsRequest) (*StreamResponse[BatchQueryActivityReactionsResponse], error) { + var result BatchQueryActivityReactionsResponse + res, err := MakeRequest[BatchQueryActivityReactionsRequest, BatchQueryActivityReactionsResponse](c.client, ctx, "POST", "/api/v2/feeds/activities/reactions/query", nil, request, &result, nil) + return res, err +} + // Deletes a bookmark from an activity func (c *FeedsClient) DeleteBookmark(ctx context.Context, activityID string, request *DeleteBookmarkRequest) (*StreamResponse[DeleteBookmarkResponse], error) { var result DeleteBookmarkResponse @@ -335,6 +342,13 @@ func (c *FeedsClient) QueryComments(ctx context.Context, request *QueryCommentsR return res, err } +// Returns a single user's reactions across a set of comment IDs, without comment payloads +func (c *FeedsClient) BatchQueryCommentReactions(ctx context.Context, request *BatchQueryCommentReactionsRequest) (*StreamResponse[BatchQueryCommentReactionsResponse], error) { + var result BatchQueryCommentReactionsResponse + res, err := MakeRequest[BatchQueryCommentReactionsRequest, BatchQueryCommentReactionsResponse](c.client, ctx, "POST", "/api/v2/feeds/comments/reactions/query", nil, request, &result, nil) + return res, err +} + // Deletes a bookmark from a comment func (c *FeedsClient) DeleteCommentBookmark(ctx context.Context, commentID string, request *DeleteCommentBookmarkRequest) (*StreamResponse[DeleteCommentBookmarkResponse], error) { var result DeleteCommentBookmarkResponse diff --git a/feeds_test.go b/feeds_test.go index dbdf372..49c1beb 100644 --- a/feeds_test.go +++ b/feeds_test.go @@ -51,6 +51,13 @@ func TestFeedsQueryActivities(t *testing.T) { _, err = client.Feeds().QueryActivities(context.Background(), &getstream.QueryActivitiesRequest{}) require.NoError(t, err) } +func TestFeedsBatchQueryActivityReactions(t *testing.T) { + client, err := getstream.NewClient("key", "secret", getstream.WithHTTPClient(&StubHTTPClient{})) + require.NoError(t, err) + + _, err = client.Feeds().BatchQueryActivityReactions(context.Background(), &getstream.BatchQueryActivityReactionsRequest{}) + require.NoError(t, err) +} func TestFeedsDeleteBookmark(t *testing.T) { client, err := getstream.NewClient("key", "secret", getstream.WithHTTPClient(&StubHTTPClient{})) require.NoError(t, err) @@ -247,6 +254,13 @@ func TestFeedsQueryComments(t *testing.T) { _, err = client.Feeds().QueryComments(context.Background(), &getstream.QueryCommentsRequest{}) require.NoError(t, err) } +func TestFeedsBatchQueryCommentReactions(t *testing.T) { + client, err := getstream.NewClient("key", "secret", getstream.WithHTTPClient(&StubHTTPClient{})) + require.NoError(t, err) + + _, err = client.Feeds().BatchQueryCommentReactions(context.Background(), &getstream.BatchQueryCommentReactionsRequest{}) + require.NoError(t, err) +} func TestFeedsDeleteCommentBookmark(t *testing.T) { client, err := getstream.NewClient("key", "secret", getstream.WithHTTPClient(&StubHTTPClient{})) require.NoError(t, err) diff --git a/models.go b/models.go index ef02a9c..9905764 100644 --- a/models.go +++ b/models.go @@ -648,8 +648,13 @@ type AddCommentReactionResponse struct { Duration string `json:"duration"` Comment CommentResponse `json:"comment"` Reaction FeedsReactionResponse `json:"reaction"` - // Whether a notification activity was successfully created + // Whether notification creation was accepted for asynchronous processing + NotificationAccepted *bool `json:"notification_accepted,omitempty"` + // Deprecated. Mirrors notification_accepted; use notification_accepted for async enqueue status Deprecated: use notification_accepted + // Deprecated: this field is deprecated. NotificationCreated *bool `json:"notification_created,omitempty"` + // ID of the async notification-creation task; poll GET /tasks/{id} for its status + NotificationTaskID *string `json:"notification_task_id,omitempty"` } type AddCommentResponse struct { @@ -697,8 +702,13 @@ type AddReactionResponse struct { Duration string `json:"duration"` Activity ActivityResponse `json:"activity"` Reaction FeedsReactionResponse `json:"reaction"` - // Whether a notification activity was successfully created + // Whether notification creation was accepted for asynchronous processing + NotificationAccepted *bool `json:"notification_accepted,omitempty"` + // Deprecated. Mirrors notification_accepted; use notification_accepted for async enqueue status Deprecated: use notification_accepted + // Deprecated: this field is deprecated. NotificationCreated *bool `json:"notification_created,omitempty"` + // ID of the async notification-creation task; poll GET /tasks/{id} for its status + NotificationTaskID *string `json:"notification_task_id,omitempty"` } // Response for adding members to a user group @@ -796,6 +806,7 @@ type AppResponseFields struct { ImageModerationEnabled bool `json:"image_moderation_enabled"` MaxAggregatedActivitiesLength int `json:"max_aggregated_activities_length"` ModerationAudioCallModerationEnabled bool `json:"moderation_audio_call_moderation_enabled"` + ModerationAudioFileEnabled bool `json:"moderation_audio_file_enabled"` ModerationEnabled bool `json:"moderation_enabled"` ModerationLlmConfigurabilityEnabled bool `json:"moderation_llm_configurability_enabled"` ModerationMultitenantBlocklistEnabled bool `json:"moderation_multitenant_blocklist_enabled"` @@ -822,7 +833,7 @@ type AppResponseFields struct { UserSearchDisallowedRoles []string `json:"user_search_disallowed_roles"` WebhookEvents []string `json:"webhook_events"` CallTypes map[string]*CallType `json:"call_types"` - ChannelConfigs map[string]ChannelConfig `json:"channel_configs"` + ChannelConfigs map[string]*ChannelConfig `json:"channel_configs"` FileUploadConfig FileUploadConfig `json:"file_upload_config"` Grants map[string][]string `json:"grants"` ImageUploadConfig FileUploadConfig `json:"image_upload_config"` @@ -1194,6 +1205,24 @@ type BanResponse struct { User *UserResponse `json:"user,omitempty"` } +// Basic response information +type BatchQueryActivityReactionsResponse struct { + // Duration of the request in milliseconds + Duration string `json:"duration"` + Reactions []FeedsReactionResponse `json:"reactions"` + Next *string `json:"next,omitempty"` + Prev *string `json:"prev,omitempty"` +} + +// Basic response information +type BatchQueryCommentReactionsResponse struct { + // Duration of the request in milliseconds + Duration string `json:"duration"` + Reactions []FeedsReactionResponse `json:"reactions"` + Next *string `json:"next,omitempty"` + Prev *string `json:"prev,omitempty"` +} + // Configuration for block action type BlockActionRequestPayload struct { // Reason for blocking @@ -1219,6 +1248,7 @@ type BlockListResponse struct { IsConfusableFoldingEnabled bool `json:"is_confusable_folding_enabled"` IsLeetCheckEnabled bool `json:"is_leet_check_enabled"` IsPluralCheckEnabled bool `json:"is_plural_check_enabled"` + IsSubstringMatchingEnabled bool `json:"is_substring_matching_enabled"` // Block list name Name string `json:"name"` // Block list type. One of: regex, domain, domain_allowlist, email, email_allowlist, word @@ -2759,8 +2789,48 @@ type ChannelBatchUpdateResponse struct { TaskID *string `json:"task_id,omitempty"` } -// Channel configuration overrides type ChannelConfig struct { + Automod string `json:"automod"` + AutomodBehavior string `json:"automod_behavior"` + ConnectEvents bool `json:"connect_events"` + CountMessages bool `json:"count_messages"` + CreatedAt Timestamp `json:"created_at"` + CustomEvents bool `json:"custom_events"` + DeliveryEvents bool `json:"delivery_events"` + MarkMessagesPending bool `json:"mark_messages_pending"` + MaxMessageLength int `json:"max_message_length"` + Mutes bool `json:"mutes"` + Name string `json:"name"` + Polls bool `json:"polls"` + PushNotifications bool `json:"push_notifications"` + Quotes bool `json:"quotes"` + Reactions bool `json:"reactions"` + ReadEvents bool `json:"read_events"` + Reminders bool `json:"reminders"` + Replies bool `json:"replies"` + Search bool `json:"search"` + SharedLocations bool `json:"shared_locations"` + SkipLastMsgUpdateForSystemMsgs bool `json:"skip_last_msg_update_for_system_msgs"` + TypingEvents bool `json:"typing_events"` + UpdatedAt Timestamp `json:"updated_at"` + Uploads bool `json:"uploads"` + UrlEnrichment bool `json:"url_enrichment"` + UserMessageReminders bool `json:"user_message_reminders"` + // List of commands that channel supports + Commands []string `json:"commands"` + Blocklist *string `json:"blocklist,omitempty"` + BlocklistBehavior *string `json:"blocklist_behavior,omitempty"` + PartitionSize *int `json:"partition_size,omitempty"` + PartitionTtl *string `json:"partition_ttl,omitempty"` + PushLevel *string `json:"push_level,omitempty"` + AllowedFlagReasons []string `json:"allowed_flag_reasons,omitempty"` + Blocklists []BlockListOptions `json:"blocklists,omitempty"` + AutomodThresholds *Thresholds `json:"automod_thresholds,omitempty"` + ChatPreferences *ChatPreferences `json:"chat_preferences,omitempty"` +} + +// Channel configuration overrides +type ChannelConfigOverrides struct { Blocklist *string `json:"blocklist,omitempty"` BlocklistBehavior *string `json:"blocklist_behavior,omitempty"` // Enable/disable message counting @@ -2860,13 +2930,13 @@ func (e *ChannelCreatedEvent) GetEventType() string { } type ChannelDataUpdate struct { - AutoTranslationEnabled *bool `json:"auto_translation_enabled,omitempty"` - AutoTranslationLanguage *string `json:"auto_translation_language,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - Frozen *bool `json:"frozen,omitempty"` - Team *string `json:"team,omitempty"` - ConfigOverrides *ChannelConfig `json:"config_overrides,omitempty"` - Custom map[string]any `json:"custom,omitempty"` + AutoTranslationEnabled *bool `json:"auto_translation_enabled,omitempty"` + AutoTranslationLanguage *string `json:"auto_translation_language,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + Frozen *bool `json:"frozen,omitempty"` + Team *string `json:"team,omitempty"` + ConfigOverrides *ChannelConfigOverrides `json:"config_overrides,omitempty"` + Custom map[string]any `json:"custom,omitempty"` } // Emitted when a channel is successfully deleted. @@ -2981,14 +3051,14 @@ type ChannelInput struct { // Freeze or unfreeze the channel Frozen *bool `json:"frozen,omitempty"` // Team the channel belongs to (if multi-tenant mode is enabled) - Team *string `json:"team,omitempty"` - TruncatedByID *string `json:"truncated_by_id,omitempty"` - FilterTags []string `json:"filter_tags,omitempty"` - Invites []ChannelMemberRequest `json:"invites,omitempty"` - Members []ChannelMemberRequest `json:"members,omitempty"` - ConfigOverrides *ChannelConfig `json:"config_overrides,omitempty"` - CreatedBy *UserRequest `json:"created_by,omitempty"` - Custom map[string]any `json:"custom,omitempty"` + Team *string `json:"team,omitempty"` + TruncatedByID *string `json:"truncated_by_id,omitempty"` + FilterTags []string `json:"filter_tags,omitempty"` + Invites []ChannelMemberRequest `json:"invites,omitempty"` + Members []ChannelMemberRequest `json:"members,omitempty"` + ConfigOverrides *ChannelConfigOverrides `json:"config_overrides,omitempty"` + CreatedBy *UserRequest `json:"created_by,omitempty"` + Custom map[string]any `json:"custom,omitempty"` } type ChannelInputRequest struct { @@ -3094,6 +3164,7 @@ const ( CAST_POLL_VOTE ChannelOwnCapability = "cast-poll-vote" CONNECT_EVENTS ChannelOwnCapability = "connect-events" CREATE_ATTACHMENT ChannelOwnCapability = "create-attachment" + CREATE_MENTION ChannelOwnCapability = "create-mention" DELETE_ANY_MESSAGE ChannelOwnCapability = "delete-any-message" DELETE_CHANNEL ChannelOwnCapability = "delete-channel" DELETE_OWN_MESSAGE ChannelOwnCapability = "delete-own-message" @@ -4227,6 +4298,13 @@ type CreateSIPTrunkResponse struct { SipTrunk *SIPTrunkResponse `json:"sip_trunk,omitempty"` } +// Basic response information +type CreateSegmentResponse struct { + // Duration of the request in milliseconds + Duration string `json:"duration"` + Segment *SegmentResponse `json:"segment,omitempty"` +} + // Response for creating a user group type CreateUserGroupResponse struct { Duration string `json:"duration"` @@ -5713,6 +5791,8 @@ type FileUploadResponse struct { type FilterConfigResponse struct { // LLM moderation labels available as filter values LlmLabels []string `json:"llm_labels"` + // AI image moderation labels available as filter values. Reflects the app's effective image taxonomy: custom Bodyguard taxonomy when enabled, otherwise the standard L1 label set. + AiImageLabels []string `json:"ai_image_labels,omitempty"` // AI text moderation labels available as filter values AiTextLabels []string `json:"ai_text_labels,omitempty"` // Moderation config keys present in the queue, available as filter values @@ -5743,6 +5823,11 @@ type FlagCountRuleParameters struct { Threshold *int `json:"threshold,omitempty"` } +type FlagDetails struct { + OriginalText string `json:"original_text"` + Automod *AutomodDetailsResponse `json:"automod,omitempty"` +} + type FlagDetailsResponse struct { OriginalText string `json:"original_text"` Automod *AutomodDetailsResponse `json:"automod,omitempty"` @@ -5755,6 +5840,12 @@ type FlagFeedbackResponse struct { Labels []LabelResponse `json:"labels"` } +type FlagItemResponse struct { + Duration string `json:"duration"` + // Unique identifier of the created moderation item + ItemID string `json:"item_id"` +} + type FlagMessageDetailsResponse struct { PinChanged *bool `json:"pin_changed,omitempty"` ShouldEnrich *bool `json:"should_enrich,omitempty"` @@ -5763,9 +5854,20 @@ type FlagMessageDetailsResponse struct { } type FlagResponse struct { - Duration string `json:"duration"` - // Unique identifier of the created moderation item - ItemID string `json:"item_id"` + CreatedAt Timestamp `json:"created_at"` + CreatedByAutomod bool `json:"created_by_automod"` + UpdatedAt Timestamp `json:"updated_at"` + ApprovedAt *Timestamp `json:"approved_at,omitempty"` + Reason *string `json:"reason,omitempty"` + RejectedAt *Timestamp `json:"rejected_at,omitempty"` + ReviewedAt *Timestamp `json:"reviewed_at,omitempty"` + ReviewedBy *string `json:"reviewed_by,omitempty"` + TargetMessageID *string `json:"target_message_id,omitempty"` + Custom map[string]any `json:"custom,omitempty"` + Details *FlagDetails `json:"details,omitempty"` + TargetMessage *MessageResponse `json:"target_message,omitempty"` + TargetUser *UserResponse `json:"target_user,omitempty"` + User *UserResponse `json:"user,omitempty"` } type FlagUpdatedEvent struct { @@ -6444,18 +6546,6 @@ type GetReviewQueueItemResponse struct { Item *ReviewQueueItemResponse `json:"item,omitempty"` } -type CreateSegmentResponse struct { - // Duration of the request in milliseconds - Duration string `json:"duration"` - Segment *SegmentResponse `json:"segment,omitempty"` -} - -type UpdateSegmentResponse struct { - // Duration of the request in milliseconds - Duration string `json:"duration"` - Segment SegmentResponse `json:"segment"` -} - type GetSegmentResponse struct { // Duration of the request in milliseconds Duration string `json:"duration"` @@ -7142,6 +7232,13 @@ type ListPushProvidersResponse struct { PushProviders []PushProviderResponse `json:"push_providers"` } +// Basic response information +type ListQueuesResponse struct { + // Duration of the request in milliseconds + Duration string `json:"duration"` + Queues []ModerationQueueResponse `json:"queues"` +} + // Response for listing recordings type ListRecordingsResponse struct { Duration string `json:"duration"` @@ -8005,6 +8102,10 @@ type ModerationActionConfigResponse struct { Custom map[string]any `json:"custom,omitempty"` } +type ModerationBanResponse struct { + Duration string `json:"duration"` +} + // This event is sent when a moderation check is completed type ModerationCheckCompletedEvent struct { CreatedAt Timestamp `json:"created_at"` @@ -8067,6 +8168,7 @@ func (e *ModerationCustomActionEvent) GetEventType() string { type ModerationDashboardPreferences struct { AnalyzeMaxImageSizeBytes *int `json:"analyze_max_image_size_bytes,omitempty"` + AnalyzeMaxKeyframeSizeBytes *int `json:"analyze_max_keyframe_size_bytes,omitempty"` AsyncReviewQueueUpsert *bool `json:"async_review_queue_upsert,omitempty"` DisableAuditLogs *bool `json:"disable_audit_logs,omitempty"` DisableFlaggingReviewedEntity *bool `json:"disable_flagging_reviewed_entity,omitempty"` @@ -8158,14 +8260,21 @@ func (e *ModerationMarkReviewedEvent) GetEventType() string { } type ModerationPayload struct { - Images []string `json:"images,omitempty"` - Texts []string `json:"texts,omitempty"` - Videos []string `json:"videos,omitempty"` - Custom map[string]any `json:"custom,omitempty"` + Audios []string `json:"audios,omitempty"` + ImageOrderedKeys []string `json:"image_ordered_keys,omitempty"` + Images []string `json:"images,omitempty"` + TextOrderedKeys []string `json:"text_ordered_keys,omitempty"` + Texts []string `json:"texts,omitempty"` + Videos []string `json:"videos,omitempty"` + Custom map[string]any `json:"custom,omitempty"` + ImageIds map[string]string `json:"image_ids,omitempty"` + TextIds map[string]string `json:"text_ids,omitempty"` } // Content payload for moderation type ModerationPayloadRequest struct { + // Audio URLs to moderate + Audios []string `json:"audios,omitempty"` // Image URLs to moderate (max 30) Images []string `json:"images,omitempty"` // Text content to moderate @@ -8178,14 +8287,37 @@ type ModerationPayloadRequest struct { // Content payload for moderation type ModerationPayloadResponse struct { + // Audio URLs to moderate + Audios []string `json:"audios,omitempty"` + // Caller-supplied keys for images, index-aligned with images[] + ImageOrderedKeys []string `json:"image_ordered_keys,omitempty"` // Image URLs to moderate Images []string `json:"images,omitempty"` + // Caller-supplied keys for texts (e.g. "title", "description"), index-aligned with texts[] + TextOrderedKeys []string `json:"text_ordered_keys,omitempty"` // Text content to moderate Texts []string `json:"texts,omitempty"` // Video URLs to moderate Videos []string `json:"videos,omitempty"` // Custom data for moderation Custom map[string]any `json:"custom,omitempty"` + // Caller-supplied content IDs per image key (from content_ids on /analyze) + ImageIds map[string]string `json:"image_ids,omitempty"` + // Caller-supplied content IDs per text key (from content_ids on /analyze) + TextIds map[string]string `json:"text_ids,omitempty"` +} + +type ModerationQueueResponse struct { + CreatedAt Timestamp `json:"created_at"` + CreatedBy string `json:"created_by"` + Description string `json:"description"` + ID string `json:"id"` + ItemCount int `json:"item_count"` + Name string `json:"name"` + UpdatedAt Timestamp `json:"updated_at"` + Type string `json:"type"` + Sort []map[string]any `json:"sort"` + Filters map[string]any `json:"filters"` } type ModerationResponse struct { @@ -8775,6 +8907,8 @@ type Permission struct { Name string `json:"name"` // Whether this permission applies to resource owner or not Owner bool `json:"owner"` + // Resource type that defines ownership for this permission's action (e.g. 'Channel' for CreateMessage, 'Message' for UpdateMessage). Identical across all variants of an action; primarily meaningful for owner grants. + OwnerResource string `json:"owner_resource"` // Whether this permission applies to teammates (multi-tenancy mode only) SameTeam bool `json:"same_team"` // List of tags of the permission @@ -9723,6 +9857,13 @@ type QueryUsersResponse struct { Users []FullUserResponse `json:"users"` } +// Basic response information +type QueueResponse struct { + // Duration of the request in milliseconds + Duration string `json:"duration"` + Queue *ModerationQueueResponse `json:"queue,omitempty"` +} + // RTMPBroadcastRequest is the payload for starting an RTMP broadcast. type RTMPBroadcastRequest struct { // Name identifier for RTMP broadcast, must be unique in call @@ -11224,12 +11365,14 @@ type TeamUsageStats struct { } type TextContentParameters struct { - ContainsUrl *bool `json:"contains_url,omitempty"` - LabelOperator *string `json:"label_operator,omitempty"` - Severity *string `json:"severity,omitempty"` - BlocklistMatch []string `json:"blocklist_match,omitempty"` - HarmLabels []string `json:"harm_labels,omitempty"` - LlmHarmLabels map[string]string `json:"llm_harm_labels,omitempty"` + ContainsUrl *bool `json:"contains_url,omitempty"` + LabelOperator *string `json:"label_operator,omitempty"` + Severity *string `json:"severity,omitempty"` + TextLength *int `json:"text_length,omitempty"` + TextLengthOperator *string `json:"text_length_operator,omitempty"` + BlocklistMatch []string `json:"blocklist_match,omitempty"` + HarmLabels []string `json:"harm_labels,omitempty"` + LlmHarmLabels map[string]string `json:"llm_harm_labels,omitempty"` } type TextRuleParameters struct { @@ -11891,6 +12034,12 @@ type UpdateSIPTrunkResponse struct { SipTrunk *SIPTrunkResponse `json:"sip_trunk,omitempty"` } +type UpdateSegmentResponse struct { + // Duration of the request in milliseconds + Duration string `json:"duration"` + Segment SegmentResponse `json:"segment"` +} + type UpdateThreadPartialResponse struct { // Duration of the request in milliseconds Duration string `json:"duration"` diff --git a/moderation.go b/moderation.go index 103c8d9..1884727 100644 --- a/moderation.go +++ b/moderation.go @@ -101,9 +101,9 @@ func (c *ModerationClient) BulkActionAppeals(ctx context.Context, request *BulkA } // Ban a user from a channel or the entire app -func (c *ModerationClient) Ban(ctx context.Context, request *BanRequest) (*StreamResponse[BanResponse], error) { - var result BanResponse - res, err := MakeRequest[BanRequest, BanResponse](c.client, ctx, "POST", "/api/v2/moderation/ban", nil, request, &result, nil) +func (c *ModerationClient) Ban(ctx context.Context, request *BanRequest) (*StreamResponse[ModerationBanResponse], error) { + var result ModerationBanResponse + res, err := MakeRequest[BanRequest, ModerationBanResponse](c.client, ctx, "POST", "/api/v2/moderation/ban", nil, request, &result, nil) return res, err } @@ -200,9 +200,9 @@ func (c *ModerationClient) V2UpsertTemplate(ctx context.Context, request *V2Upse } // Flag any type of content (messages, users, channels, activities) for moderation review. Supports custom content types and additional metadata for flagged content. -func (c *ModerationClient) Flag(ctx context.Context, request *FlagRequest) (*StreamResponse[FlagResponse], error) { - var result FlagResponse - res, err := MakeRequest[FlagRequest, FlagResponse](c.client, ctx, "POST", "/api/v2/moderation/flag", nil, request, &result, nil) +func (c *ModerationClient) Flag(ctx context.Context, request *FlagRequest) (*StreamResponse[FlagItemResponse], error) { + var result FlagItemResponse + res, err := MakeRequest[FlagRequest, FlagItemResponse](c.client, ctx, "POST", "/api/v2/moderation/flag", nil, request, &result, nil) return res, err } @@ -277,6 +277,46 @@ func (c *ModerationClient) Mute(ctx context.Context, request *MuteRequest) (*Str return res, err } +func (c *ModerationClient) ListQueues(ctx context.Context, request *ListQueuesRequest) (*StreamResponse[ListQueuesResponse], error) { + var result ListQueuesResponse + res, err := MakeRequest[any, ListQueuesResponse](c.client, ctx, "GET", "/api/v2/moderation/queues", nil, nil, &result, nil) + return res, err +} + +func (c *ModerationClient) CreateQueue(ctx context.Context, request *CreateQueueRequest) (*StreamResponse[QueueResponse], error) { + var result QueueResponse + res, err := MakeRequest[CreateQueueRequest, QueueResponse](c.client, ctx, "POST", "/api/v2/moderation/queues", nil, request, &result, nil) + return res, err +} + +func (c *ModerationClient) GetQueue(ctx context.Context, id string, request *GetQueueRequest) (*StreamResponse[QueueResponse], error) { + var result QueueResponse + pathParams := map[string]string{ + "id": id, + } + params := extractQueryParams(request) + res, err := MakeRequest[any, QueueResponse](c.client, ctx, "GET", "/api/v2/moderation/queues/{id}", params, nil, &result, pathParams) + return res, err +} + +func (c *ModerationClient) UpdateQueue(ctx context.Context, id string, request *UpdateQueueRequest) (*StreamResponse[QueueResponse], error) { + var result QueueResponse + pathParams := map[string]string{ + "id": id, + } + res, err := MakeRequest[UpdateQueueRequest, QueueResponse](c.client, ctx, "PATCH", "/api/v2/moderation/queues/{id}", nil, request, &result, pathParams) + return res, err +} + +func (c *ModerationClient) DeleteQueue(ctx context.Context, id string, request *DeleteQueueRequest) (*StreamResponse[QueueResponse], error) { + var result QueueResponse + pathParams := map[string]string{ + "id": id, + } + res, err := MakeRequest[DeleteQueueRequest, QueueResponse](c.client, ctx, "POST", "/api/v2/moderation/queues/{id}/delete", nil, request, &result, pathParams) + return res, err +} + // Query review queue items allows you to filter the review queue items. This is used for building a moderation dashboard. func (c *ModerationClient) QueryReviewQueue(ctx context.Context, request *QueryReviewQueueRequest) (*StreamResponse[QueryReviewQueueResponse], error) { var result QueryReviewQueueResponse diff --git a/requests.go b/requests.go index b4bfc29..b489e53 100644 --- a/requests.go +++ b/requests.go @@ -70,6 +70,7 @@ type CreateBlockListRequest struct { IsConfusableFoldingEnabled *bool `json:"is_confusable_folding_enabled,omitempty"` IsLeetCheckEnabled *bool `json:"is_leet_check_enabled,omitempty"` IsPluralCheckEnabled *bool `json:"is_plural_check_enabled,omitempty"` + IsSubstringMatchingEnabled *bool `json:"is_substring_matching_enabled,omitempty"` Team *string `json:"team,omitempty"` // Block list type. One of: regex, domain, domain_allowlist, email, email_allowlist, word Type *string `json:"type,omitempty"` @@ -84,6 +85,7 @@ type UpdateBlockListRequest struct { IsConfusableFoldingEnabled *bool `json:"is_confusable_folding_enabled,omitempty"` IsLeetCheckEnabled *bool `json:"is_leet_check_enabled,omitempty"` IsPluralCheckEnabled *bool `json:"is_plural_check_enabled,omitempty"` + IsSubstringMatchingEnabled *bool `json:"is_substring_matching_enabled,omitempty"` Team *string `json:"team,omitempty"` // List of words to block Words []string `json:"words"` @@ -688,15 +690,6 @@ type GetRetentionPolicyRunsRequest struct { type SearchRequest struct { Payload *SearchPayload `json:"-" query:"payload"` } -type QuerySegmentsRequest struct { - // Filter to apply to the query - Filter map[string]any `json:"filter"` - Limit *int `json:"limit,omitempty"` - Next *string `json:"next,omitempty"` - Prev *string `json:"prev,omitempty"` - // Array of sort parameters - Sort []SortParamRequest `json:"sort"` -} type CreateSegmentRequest struct { // The type of the segment Type string `json:"type"` @@ -713,6 +706,19 @@ type CreateSegmentRequest struct { // Filter to apply to the query Filter map[string]any `json:"filter"` } +type QuerySegmentsRequest struct { + // Filter to apply to the query + Filter map[string]any `json:"filter"` + Limit *int `json:"limit,omitempty"` + Next *string `json:"next,omitempty"` + Prev *string `json:"prev,omitempty"` + // Array of sort parameters + Sort []SortParamRequest `json:"sort"` +} +type DeleteSegmentRequest struct { +} +type GetSegmentRequest struct { +} type UpdateSegmentRequest struct { // The description of the segment (max 256 characters) Description *string `json:"description,omitempty"` @@ -721,15 +727,11 @@ type UpdateSegmentRequest struct { // Filter to apply to the query Filter map[string]any `json:"filter"` } -type DeleteSegmentRequest struct { -} -type GetSegmentRequest struct { -} -type DeleteSegmentTargetsRequest struct { +type AddSegmentTargetsRequest struct { // Target IDs TargetIds []string `json:"target_ids"` } -type AddSegmentTargetsRequest struct { +type DeleteSegmentTargetsRequest struct { // Target IDs TargetIds []string `json:"target_ids"` } @@ -986,6 +988,19 @@ type QueryActivitiesRequest struct { Filter map[string]any `json:"filter"` User *UserRequest `json:"user,omitempty"` } +type BatchQueryActivityReactionsRequest struct { + // Activity IDs to fetch the user's reactions for (max 100) + ActivityIds []string `json:"activity_ids"` + Limit *int `json:"limit,omitempty"` + Next *string `json:"next,omitempty"` + Prev *string `json:"prev,omitempty"` + // Server-side only. The user whose reactions to fetch; defaults to the authenticated user for client-side requests + UserID *string `json:"user_id,omitempty"` + Sort []SortParamRequest `json:"sort"` + // Optional filter on reaction_type or created_at + Filter map[string]any `json:"filter"` + User *UserRequest `json:"user,omitempty"` +} type DeleteBookmarkRequest struct { FolderID *string `json:"-" query:"folder_id"` UserID *string `json:"-" query:"user_id"` @@ -1253,6 +1268,19 @@ type QueryCommentsRequest struct { UserID *string `json:"user_id,omitempty"` User *UserRequest `json:"user,omitempty"` } +type BatchQueryCommentReactionsRequest struct { + // Comment IDs to fetch the user's reactions for (max 100) + CommentIds []string `json:"comment_ids"` + Limit *int `json:"limit,omitempty"` + Next *string `json:"next,omitempty"` + Prev *string `json:"prev,omitempty"` + // Server-side only. The user whose reactions to fetch; defaults to the authenticated user for client-side requests + UserID *string `json:"user_id,omitempty"` + Sort []SortParamRequest `json:"sort"` + // Optional filter on reaction_type or created_at + Filter map[string]any `json:"filter"` + User *UserRequest `json:"user,omitempty"` +} type DeleteCommentBookmarkRequest struct { FolderID *string `json:"-" query:"folder_id"` UserID *string `json:"-" query:"user_id"` @@ -2222,6 +2250,32 @@ type MuteRequest struct { UserID *string `json:"user_id,omitempty"` User *UserRequest `json:"user,omitempty"` } +type ListQueuesRequest struct { +} +type CreateQueueRequest struct { + Name string `json:"name"` + Type string `json:"type"` + Description *string `json:"description,omitempty"` + UserID *string `json:"user_id,omitempty"` + Sort []map[string]any `json:"sort"` + Filters map[string]any `json:"filters"` + User *UserRequest `json:"user,omitempty"` +} +type GetQueueRequest struct { + UserID *string `json:"-" query:"user_id"` +} +type UpdateQueueRequest struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + UserID *string `json:"user_id,omitempty"` + Sort []map[string]any `json:"sort"` + Filters map[string]any `json:"filters"` + User *UserRequest `json:"user,omitempty"` +} +type DeleteQueueRequest struct { + UserID *string `json:"user_id,omitempty"` + User *UserRequest `json:"user,omitempty"` +} type QueryReviewQueueRequest struct { ExcludeDefaultActionConfig *bool `json:"exclude_default_action_config,omitempty"` Limit *int `json:"limit,omitempty"`