export type Pageable = {page?: number | undefined, size?: number | undefined, sort?: Array | undefined}; export type GetApiPublicV2NetworkCollectionIdTargetsArgs = {collectionId: number, pageable: Pageable}; export type GetApiPublicV2NetworkCollectionIdTargetsOptions = {baseUrl?: string | undefined, TokenAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get targets for a collection * * GET /public/v2/network/{collectionId}/targets */ export const getApiPublicV2NetworkCollectionIdTargets = async (args: GetApiPublicV2NetworkCollectionIdTargetsArgs, options?: GetApiPublicV2NetworkCollectionIdTargetsOptions) => { const {baseUrl = "https://api.prewave.com", fetch: fetchFn = fetch, TokenAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.pageable != null) query.append("pageable", JSON.stringify(args.pageable)) if (TokenAuthentication !== undefined) headers.set("X-Auth-Token", TokenAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/public/v2/network/${encodeURIComponent(String(args.collectionId))}/targets${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };