export type ServiceNowConnectionCheckRequest = {BaseUrl?: string | undefined, Id?: string | undefined, OAuthClientId?: string | undefined, OAuthClientSecret?: string | undefined, Username?: string | undefined, UserPassword?: string | undefined}; export type CreateApiServicenowIntegrationConnectivityTestArgs = {body: ServiceNowConnectionCheckRequest}; export type CreateApiServicenowIntegrationConnectivityTestOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /servicenow-integration/connectivity-test * * Also accepts auth: APIKeyQuery, NugetApiKeyHeader */ export const createApiServicenowIntegrationConnectivityTest = async (args: CreateApiServicenowIntegrationConnectivityTestArgs, options?: CreateApiServicenowIntegrationConnectivityTestOptions) => { const {baseUrl = "https://demo.octopus.app/api", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKeyHeader !== undefined) headers.set("X-Octopus-ApiKey", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/servicenow-integration/connectivity-test${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 };