export type AllTopics = Record; export type SinglePartition = {topic: string, partition: number}; export type SingleTopic = {topic: string}; export type TopicPartitionSelection = AllTopics | SinglePartition | SingleTopic; export type ShiftBy = {n: number}; export type ToEarliest = Record; export type ToLatest = Record; export type ToOffset = {offset: number}; export type ToTimestamp = {timestamp: number}; export type OffsetResetSpecification = ShiftBy | ToEarliest | ToLatest | ToOffset | ToTimestamp; export type ResetOffsetRequest = {topicPartitionSelection: TopicPartitionSelection, resetSpecification: OffsetResetSpecification}; export type CreateApiPublicV1ClustersClusterNameConsumergroupsConsumerGroupOffsetResetArgs = {clusterName: string, consumerGroup: string, body: ResetOffsetRequest}; export type CreateApiPublicV1ClustersClusterNameConsumergroupsConsumerGroupOffsetResetOptions = {baseUrl: string, httpAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Consumer group offset reset * * POST /public/v1/clusters/{clusterName}/consumergroups/{consumerGroup}/offset-reset */ export const createApiPublicV1ClustersClusterNameConsumergroupsConsumerGroupOffsetReset = async (args: CreateApiPublicV1ClustersClusterNameConsumergroupsConsumerGroupOffsetResetArgs, options: CreateApiPublicV1ClustersClusterNameConsumergroupsConsumerGroupOffsetResetOptions) => { const {baseUrl, fetch: fetchFn = fetch, httpAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (httpAuth !== undefined) headers.set('authorization', `Bearer ${httpAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/clusters/${encodeURIComponent(String(args.clusterName))}/consumergroups/${encodeURIComponent(String(args.consumerGroup))}/offset-reset${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };