diff --git a/lib/actions/community-actions.js b/lib/actions/community-actions.js --- a/lib/actions/community-actions.js +++ b/lib/actions/community-actions.js @@ -6,6 +6,8 @@ import type { CreateOrUpdateFarcasterChannelTagRequest, CreateOrUpdateFarcasterChannelTagResponse, + DeleteFarcasterChannelTagRequest, + DeleteFarcasterChannelTagPayload, } from '../types/community-types.js'; const updateCalendarCommunityFilter = 'UPDATE_CALENDAR_COMMUNITY_FILTER'; @@ -62,6 +64,36 @@ failed: 'DELETE_FARCASTER_CHANNEL_TAG_FAILED', }); +const deleteFarcasterChannelTag = + ( + callKeyserverEndpoint: CallKeyserverEndpoint, + ): (( + input: DeleteFarcasterChannelTagRequest, + ) => Promise) => + async input => { + const keyserverID = extractKeyserverIDFromID(input.commCommunityID); + + const requests = { + [keyserverID]: { + commCommunityID: input.commCommunityID, + farcasterChannelID: input.farcasterChannelID, + blobHolder: input.blobHolder, + }, + }; + + await callKeyserverEndpoint('delete_farcaster_channel_tag', requests); + + return { + commCommunityID: input.commCommunityID, + }; + }; + +function useDeleteFarcasterChannelTag(): ( + input: DeleteFarcasterChannelTagRequest, +) => Promise { + return useKeyserverCall(deleteFarcasterChannelTag); +} + export { updateCalendarCommunityFilter, clearCalendarCommunityFilter, @@ -71,4 +103,5 @@ createOrUpdateFarcasterChannelTagActionTypes, useCreateOrUpdateFarcasterChannelTag, deleteFarcasterChannelTagActionTypes, + useDeleteFarcasterChannelTag, };