export type ServiceOrderDto = {service: 'Formation' | 'RegisteredAgent' | 'EinCreation', variant?: ('Standard' | 'Expedite') | undefined}; export type AddCompanyServicesRequest = {services: Array}; export type CreateApiV1PartnerCompaniesCompanyIdServicesArgs = {companyId: string, 'Idempotency-Key': string, body: AddCompanyServicesRequest}; export type CreateApiV1PartnerCompaniesCompanyIdServicesOptions = {baseUrl?: string | undefined, PartnerApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add services to a company * * POST /v1/partner/companies/{companyId}/services */ export const createApiV1PartnerCompaniesCompanyIdServices = async (args: CreateApiV1PartnerCompaniesCompanyIdServicesArgs, options?: CreateApiV1PartnerCompaniesCompanyIdServicesOptions) => { const {baseUrl = "https://api.test.doola.com", fetch: fetchFn = fetch, PartnerApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args['Idempotency-Key'] != null) headers.set("Idempotency-Key", String(args['Idempotency-Key'])) if (PartnerApiKey !== undefined) headers.set("Authorization", PartnerApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/partner/companies/${encodeURIComponent(String(args.companyId))}/services${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 res.blob() };