export type UpdateApiRestAgile10SprintSprintIdArgs = {sprintId: number, body: {completeDate?: string | undefined, createdDate?: string | undefined, endDate?: string | undefined, goal?: string | undefined, id?: number | undefined, name?: string | undefined, originBoardId?: number | undefined, self?: string | undefined, startDate?: string | undefined, state?: string | undefined}}; export type UpdateApiRestAgile10SprintSprintIdOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Update sprint * * PUT /rest/agile/1.0/sprint/{sprintId} * * Also accepts auth: OAuth2 */ export const updateApiRestAgile10SprintSprintId = async (args: UpdateApiRestAgile10SprintSprintIdArgs, options?: UpdateApiRestAgile10SprintSprintIdOptions) => { const {baseUrl = "https://your-domain.atlassian.net", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/rest/agile/1.0/sprint/${encodeURIComponent(String(args.sprintId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 (await res.json()) as unknown };