Skip to content

Commit

Permalink
Update the api.ts to reflect a complex uri
Browse files Browse the repository at this point in the history
Signed-off-by: Aindriu Lavelle <aindriu.lavelle@aiven.io>
  • Loading branch information
aindriu-aiven committed Jul 27, 2023
1 parent 0cfd258 commit d95cdfd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions coral/src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,10 @@ const API_PATHS = {
getAclRequests: "/getAclRequests",
getAclRequestsForApprover: "/getAclRequestsForApprover",
getAclCommand: "/getAclCommands",
getTopicRequest: "/getTopicRequest",
} satisfies {
[key in keyof Omit<
ApiOperations,
"getSchemaOfTopicFromSource" | "getSwitchTeams"
"getSchemaOfTopicFromSource" | "getSwitchTeams" | "getTopicRequest"
>]: keyof ApiPaths;
};

Expand All @@ -203,6 +202,7 @@ type GetSchemaOfTopicFromSource = (params: {
schemaVersion: string;
}) => keyof ApiPaths;
type GetSwitchTeams = (params: { userId: string }) => keyof ApiPaths;
type GetTopicRequest = (params: { topicReqId: string }) => keyof ApiPaths;

const DYNAMIC_API_PATHS = {
getSchemaOfTopicFromSource: ({
Expand All @@ -213,12 +213,14 @@ const DYNAMIC_API_PATHS = {
}: Parameters<GetSchemaOfTopicFromSource>[0]) =>
`/schemas/source/${source}/kafkaEnv/${kafkaEnvId}/topic/${topicName}/schemaVersion/${schemaVersion}` as keyof ApiPaths,
getSwitchTeams: ({ userId }: Parameters<GetSwitchTeams>[0]) =>
`/user/${userId}/switchTeamsList` as keyof ApiPaths,
`/user/${userId}/switchTeamsList` as keyof ApiPaths,
getTopicRequest: ({ topicReqId }: Parameters<GetTopicRequest>[0]) =>
`/topic/request/${topicReqId}` as keyof ApiPaths,
} satisfies {
[key in keyof Pick<
ApiOperations,
"getSchemaOfTopicFromSource" | "getSwitchTeams"
>]: GetSchemaOfTopicFromSource | GetSwitchTeams;
"getSchemaOfTopicFromSource" | "getSwitchTeams" | "getTopicRequest"
>]: GetSchemaOfTopicFromSource | GetSwitchTeams | GetTopicRequest;
};

type Params = URLSearchParams;
Expand Down

0 comments on commit d95cdfd

Please sign in to comment.