diff --git a/keyserver/src/endpoints.js b/keyserver/src/endpoints.js --- a/keyserver/src/endpoints.js +++ b/keyserver/src/endpoints.js @@ -17,7 +17,10 @@ setThreadUnreadStatusValidator, updateActivityResponderInputValidator, } from './responders/activity-responders.js'; -import { fetchCommunityInfosResponder } from './responders/community-responders.js'; +import { + fetchCommunityInfosResponder, + fetchAllCommunityInfosWithNamesResponder, +} from './responders/community-responders.js'; import { deviceTokenUpdateResponder, deviceTokenUpdateRequestInputValidator, @@ -496,6 +499,11 @@ inputValidator: ignoredArgumentValidator, policies: baseLegalPolicies, }, + fetch_all_community_infos_with_names: { + responder: fetchAllCommunityInfosWithNamesResponder, + inputValidator: ignoredArgumentValidator, + policies: baseLegalPolicies, + }, create_or_update_farcaster_channel_tag: { responder: createOrUpdateFarcasterChannelTagResponder, inputValidator: createOrUpdateFarcasterChannelTagInputValidator, diff --git a/lib/types/community-types.js b/lib/types/community-types.js --- a/lib/types/community-types.js +++ b/lib/types/community-types.js @@ -35,6 +35,13 @@ +communityName: string, }>; +export const serverCommunityInfoWithCommunityNameValidator: TInterface = + tShape({ + id: tID, + farcasterChannelID: t.maybe(t.String), + communityName: t.String, + }); + export type FetchCommunityInfosResponse = { +communityInfos: $ReadOnlyArray, }; diff --git a/lib/types/endpoints.js b/lib/types/endpoints.js --- a/lib/types/endpoints.js +++ b/lib/types/endpoints.js @@ -113,6 +113,7 @@ GET_OLM_SESSION_INITIALIZATION_DATA: 'get_olm_session_initialization_data', VERSION: 'version', FETCH_COMMUNITY_INFOS: 'fetch_community_infos', + FETCH_ALL_COMMUNITY_INFOS_WITH_NAMES: 'fetch_all_community_infos_with_names', CREATE_OR_UPDATE_FARCASTER_CHANNEL_TAG: 'create_or_update_farcaster_channel_tag', DELETE_FARCASTER_CHANNEL_TAG: 'delete_farcaster_channel_tag', diff --git a/lib/types/validators/community-validators.js b/lib/types/validators/community-validators.js --- a/lib/types/validators/community-validators.js +++ b/lib/types/validators/community-validators.js @@ -5,7 +5,9 @@ import { tShape } from '../../utils/validation-utils.js'; import { serverCommunityInfoValidator, + serverCommunityInfoWithCommunityNameValidator, type FetchCommunityInfosResponse, + type FetchAllCommunityInfosWithNamesResponse, } from '../community-types.js'; const fetchCommunityInfosResponseValidator: TInterface = @@ -13,4 +15,14 @@ communityInfos: t.list(serverCommunityInfoValidator), }); -export { fetchCommunityInfosResponseValidator }; +const fetchAllCommunityInfosWithNamesResponseValidator: TInterface = + tShape({ + allCommunityInfosWithNames: t.list( + serverCommunityInfoWithCommunityNameValidator, + ), + }); + +export { + fetchCommunityInfosResponseValidator, + fetchAllCommunityInfosWithNamesResponseValidator, +}; diff --git a/lib/types/validators/endpoint-validators.js b/lib/types/validators/endpoint-validators.js --- a/lib/types/validators/endpoint-validators.js +++ b/lib/types/validators/endpoint-validators.js @@ -2,7 +2,10 @@ import t from 'tcomb'; -import { fetchCommunityInfosResponseValidator } from './community-validators.js'; +import { + fetchCommunityInfosResponseValidator, + fetchAllCommunityInfosWithNamesResponseValidator, +} from './community-validators.js'; import { saveEntryResponseValidator, deltaEntryInfosResultValidator, @@ -174,6 +177,9 @@ }, version: { validator: versionResponseValidator }, fetch_community_infos: { validator: fetchCommunityInfosResponseValidator }, + fetch_all_community_infos_with_names: { + validator: fetchAllCommunityInfosWithNamesResponseValidator, + }, create_or_update_farcaster_channel_tag: { validator: createOrUpdateFarcasterChannelTagResponseValidator, },