/* tslint:disable */
/* eslint-disable */
/**
 * MailSlurp API
 * MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It\'s designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more.  ## Resources  - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
 *
 * The version of the OpenAPI document: 6.5.2
 * Contact: contact@mailslurp.dev
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import * as runtime from '../runtime';
import {
  CountDto,
  CountDtoFromJSON,
  CountDtoToJSON,
  CreateInboxDto,
  CreateInboxDtoFromJSON,
  CreateInboxDtoToJSON,
  CreateInboxRulesetOptions,
  CreateInboxRulesetOptionsFromJSON,
  CreateInboxRulesetOptionsToJSON,
  Email,
  EmailFromJSON,
  EmailToJSON,
  EmailPreview,
  EmailPreviewFromJSON,
  EmailPreviewToJSON,
  FlushExpiredInboxesResult,
  FlushExpiredInboxesResultFromJSON,
  FlushExpiredInboxesResultToJSON,
  ImapSmtpAccessDetails,
  ImapSmtpAccessDetailsFromJSON,
  ImapSmtpAccessDetailsToJSON,
  InboxByEmailAddressResult,
  InboxByEmailAddressResultFromJSON,
  InboxByEmailAddressResultToJSON,
  InboxByNameResult,
  InboxByNameResultFromJSON,
  InboxByNameResultToJSON,
  InboxDto,
  InboxDtoFromJSON,
  InboxDtoToJSON,
  InboxExistsDto,
  InboxExistsDtoFromJSON,
  InboxExistsDtoToJSON,
  InboxIdsResult,
  InboxIdsResultFromJSON,
  InboxIdsResultToJSON,
  InboxRulesetDto,
  InboxRulesetDtoFromJSON,
  InboxRulesetDtoToJSON,
  PageDeliveryStatus,
  PageDeliveryStatusFromJSON,
  PageDeliveryStatusToJSON,
  PageEmailPreview,
  PageEmailPreviewFromJSON,
  PageEmailPreviewToJSON,
  PageInboxProjection,
  PageInboxProjectionFromJSON,
  PageInboxProjectionToJSON,
  PageInboxRulesetDto,
  PageInboxRulesetDtoFromJSON,
  PageInboxRulesetDtoToJSON,
  PageOrganizationInboxProjection,
  PageOrganizationInboxProjectionFromJSON,
  PageOrganizationInboxProjectionToJSON,
  PageScheduledJobs,
  PageScheduledJobsFromJSON,
  PageScheduledJobsToJSON,
  PageSentEmailProjection,
  PageSentEmailProjectionFromJSON,
  PageSentEmailProjectionToJSON,
  PageTrackingPixelProjection,
  PageTrackingPixelProjectionFromJSON,
  PageTrackingPixelProjectionToJSON,
  ScheduledJobDto,
  ScheduledJobDtoFromJSON,
  ScheduledJobDtoToJSON,
  SendEmailOptions,
  SendEmailOptionsFromJSON,
  SendEmailOptionsToJSON,
  SendSMTPEnvelopeOptions,
  SendSMTPEnvelopeOptionsFromJSON,
  SendSMTPEnvelopeOptionsToJSON,
  SentEmailDto,
  SentEmailDtoFromJSON,
  SentEmailDtoToJSON,
  SetInboxFavouritedOptions,
  SetInboxFavouritedOptionsFromJSON,
  SetInboxFavouritedOptionsToJSON,
  UpdateInboxOptions,
  UpdateInboxOptionsFromJSON,
  UpdateInboxOptionsToJSON,
} from '../models';

export interface CancelScheduledJobRequest {
  jobId: string;
}

export interface CreateInboxRequest {
  emailAddress?: string;
  tags?: Array<string>;
  name?: string;
  description?: string;
  useDomainPool?: boolean;
  favourite?: boolean;
  expiresAt?: Date;
  expiresIn?: number;
  allowTeamAccess?: boolean;
  inboxType?: CreateInboxInboxTypeEnum;
  virtualInbox?: boolean;
  useShortAddress?: boolean;
  domainId?: string;
  domainName?: string;
}

export interface CreateInboxRulesetRequest {
  inboxId: string;
  createInboxRulesetOptions: CreateInboxRulesetOptions;
}

export interface CreateInboxWithOptionsRequest {
  createInboxDto: CreateInboxDto;
}

export interface DeleteAllInboxEmailsRequest {
  inboxId: string;
}

export interface DeleteAllInboxesByDescriptionRequest {
  description: string;
}

export interface DeleteAllInboxesByNameRequest {
  name: string;
}

export interface DeleteAllInboxesByTagRequest {
  tag: string;
}

export interface DeleteInboxRequest {
  inboxId: string;
}

export interface DoesInboxExistRequest {
  emailAddress: string;
  allowCatchAll?: boolean;
}

export interface FlushExpiredRequest {
  before?: Date;
}

export interface GetAllInboxesRequest {
  page?: number;
  size?: number;
  sort?: GetAllInboxesSortEnum;
  favourite?: boolean;
  search?: string;
  tag?: string;
  teamAccess?: boolean;
  since?: Date;
  before?: Date;
  inboxType?: GetAllInboxesInboxTypeEnum;
  inboxFunction?: GetAllInboxesInboxFunctionEnum;
  domainId?: string;
}

export interface GetAllScheduledJobsRequest {
  page?: number;
  size?: number;
  sort?: GetAllScheduledJobsSortEnum;
  since?: Date;
  before?: Date;
}

export interface GetDeliveryStatusesByInboxIdRequest {
  inboxId: string;
  page?: number;
  size?: number;
  sort?: GetDeliveryStatusesByInboxIdSortEnum;
  since?: Date;
  before?: Date;
}

export interface GetEmailsRequest {
  inboxId: string;
  size?: number;
  limit?: number;
  sort?: GetEmailsSortEnum;
  retryTimeout?: number;
  delayTimeout?: number;
  minCount?: number;
  unreadOnly?: boolean;
  before?: Date;
  since?: Date;
}

export interface GetImapSmtpAccessRequest {
  inboxId?: string;
}

export interface GetInboxRequest {
  inboxId: string;
}

export interface GetInboxByEmailAddressRequest {
  emailAddress: string;
}

export interface GetInboxByNameRequest {
  name: string;
}

export interface GetInboxEmailCountRequest {
  inboxId: string;
}

export interface GetInboxEmailsPaginatedRequest {
  inboxId: string;
  page?: number;
  size?: number;
  sort?: GetInboxEmailsPaginatedSortEnum;
  since?: Date;
  before?: Date;
}

export interface GetInboxSentEmailsRequest {
  inboxId: string;
  page?: number;
  size?: number;
  sort?: GetInboxSentEmailsSortEnum;
  searchFilter?: string;
  since?: Date;
  before?: Date;
}

export interface GetInboxesRequest {
  size?: number;
  sort?: GetInboxesSortEnum;
  since?: Date;
  excludeCatchAllInboxes?: boolean;
  before?: Date;
}

export interface GetLatestEmailInInboxRequest {
  inboxId: string;
  timeoutMillis: number;
}

export interface GetOrganizationInboxesRequest {
  page?: number;
  size?: number;
  sort?: GetOrganizationInboxesSortEnum;
  searchFilter?: string;
  since?: Date;
  before?: Date;
}

export interface GetScheduledJobRequest {
  jobId: string;
}

export interface GetScheduledJobsByInboxIdRequest {
  inboxId: string;
  page?: number;
  size?: number;
  sort?: GetScheduledJobsByInboxIdSortEnum;
  since?: Date;
  before?: Date;
}

export interface ListInboxRulesetsRequest {
  inboxId: string;
  page?: number;
  size?: number;
  sort?: ListInboxRulesetsSortEnum;
  searchFilter?: string;
  since?: Date;
  before?: Date;
}

export interface ListInboxTrackingPixelsRequest {
  inboxId: string;
  page?: number;
  size?: number;
  sort?: ListInboxTrackingPixelsSortEnum;
  searchFilter?: string;
  since?: Date;
  before?: Date;
}

export interface SendEmailRequest {
  inboxId: string;
  sendEmailOptions: SendEmailOptions;
}

export interface SendEmailAndConfirmRequest {
  inboxId: string;
  sendEmailOptions: SendEmailOptions;
}

export interface SendEmailWithQueueRequest {
  inboxId: string;
  validateBeforeEnqueue: boolean;
  sendEmailOptions: SendEmailOptions;
}

export interface SendSmtpEnvelopeRequest {
  inboxId: string;
  sendSMTPEnvelopeOptions: SendSMTPEnvelopeOptions;
}

export interface SendTestEmailRequest {
  inboxId: string;
}

export interface SendWithScheduleRequest {
  inboxId: string;
  sendEmailOptions: SendEmailOptions;
  sendAtTimestamp?: Date;
  sendAtNowPlusSeconds?: number;
  validateBeforeEnqueue?: boolean;
}

export interface SetInboxFavouritedRequest {
  inboxId: string;
  setInboxFavouritedOptions: SetInboxFavouritedOptions;
}

export interface UpdateInboxRequest {
  inboxId: string;
  updateInboxOptions: UpdateInboxOptions;
}

/**
 *
 */
export class InboxControllerApi extends runtime.BaseAPI {
  /**
   * Get a scheduled email job and cancel it. Will fail if status of job is already cancelled, failed, or complete.
   * Cancel a scheduled email job
   */
  async cancelScheduledJobRaw(
    requestParameters: CancelScheduledJobRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<ScheduledJobDto>> {
    if (
      requestParameters.jobId === null ||
      requestParameters.jobId === undefined
    ) {
      throw new runtime.RequiredError(
        'jobId',
        'Required parameter requestParameters.jobId was null or undefined when calling cancelScheduledJob.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/scheduled-jobs/{jobId}`.replace(
          `{${'jobId'}}`,
          encodeURIComponent(String(requestParameters.jobId))
        ),
        method: 'DELETE',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      ScheduledJobDtoFromJSON(jsonValue)
    );
  }

  /**
   * Get a scheduled email job and cancel it. Will fail if status of job is already cancelled, failed, or complete.
   * Cancel a scheduled email job
   */
  async cancelScheduledJob(
    requestParameters: CancelScheduledJobRequest,
    initOverrides?: RequestInit
  ): Promise<ScheduledJobDto> {
    const response = await this.cancelScheduledJobRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Create a new inbox and with a randomized email address to send and receive from. Pass emailAddress parameter if you wish to use a specific email address. Creating an inbox is required before sending or receiving emails. If writing tests it is recommended that you create a new inbox during each test method so that it is unique and empty.
   * Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes.
   */
  async createInboxRaw(
    requestParameters: CreateInboxRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxDto>> {
    const queryParameters: any = {};

    if (requestParameters.emailAddress !== undefined) {
      queryParameters['emailAddress'] = requestParameters.emailAddress;
    }

    if (requestParameters.tags) {
      queryParameters['tags'] = requestParameters.tags;
    }

    if (requestParameters.name !== undefined) {
      queryParameters['name'] = requestParameters.name;
    }

    if (requestParameters.description !== undefined) {
      queryParameters['description'] = requestParameters.description;
    }

    if (requestParameters.useDomainPool !== undefined) {
      queryParameters['useDomainPool'] = requestParameters.useDomainPool;
    }

    if (requestParameters.favourite !== undefined) {
      queryParameters['favourite'] = requestParameters.favourite;
    }

    if (requestParameters.expiresAt !== undefined) {
      queryParameters['expiresAt'] = (
        requestParameters.expiresAt as any
      ).toISOString();
    }

    if (requestParameters.expiresIn !== undefined) {
      queryParameters['expiresIn'] = requestParameters.expiresIn;
    }

    if (requestParameters.allowTeamAccess !== undefined) {
      queryParameters['allowTeamAccess'] = requestParameters.allowTeamAccess;
    }

    if (requestParameters.inboxType !== undefined) {
      queryParameters['inboxType'] = requestParameters.inboxType;
    }

    if (requestParameters.virtualInbox !== undefined) {
      queryParameters['virtualInbox'] = requestParameters.virtualInbox;
    }

    if (requestParameters.useShortAddress !== undefined) {
      queryParameters['useShortAddress'] = requestParameters.useShortAddress;
    }

    if (requestParameters.domainId !== undefined) {
      queryParameters['domainId'] = requestParameters.domainId;
    }

    if (requestParameters.domainName !== undefined) {
      queryParameters['domainName'] = requestParameters.domainName;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes`,
        method: 'POST',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxDtoFromJSON(jsonValue)
    );
  }

  /**
   * Create a new inbox and with a randomized email address to send and receive from. Pass emailAddress parameter if you wish to use a specific email address. Creating an inbox is required before sending or receiving emails. If writing tests it is recommended that you create a new inbox during each test method so that it is unique and empty.
   * Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes.
   */
  async createInbox(
    requestParameters: CreateInboxRequest,
    initOverrides?: RequestInit
  ): Promise<InboxDto> {
    const response = await this.createInboxRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving
   * Create an inbox ruleset
   */
  async createInboxRulesetRaw(
    requestParameters: CreateInboxRulesetRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxRulesetDto>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling createInboxRuleset.'
      );
    }

    if (
      requestParameters.createInboxRulesetOptions === null ||
      requestParameters.createInboxRulesetOptions === undefined
    ) {
      throw new runtime.RequiredError(
        'createInboxRulesetOptions',
        'Required parameter requestParameters.createInboxRulesetOptions was null or undefined when calling createInboxRuleset.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    headerParameters['Content-Type'] = 'application/json';

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/rulesets`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'POST',
        headers: headerParameters,
        query: queryParameters,
        body: CreateInboxRulesetOptionsToJSON(
          requestParameters.createInboxRulesetOptions
        ),
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxRulesetDtoFromJSON(jsonValue)
    );
  }

  /**
   * Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving
   * Create an inbox ruleset
   */
  async createInboxRuleset(
    requestParameters: CreateInboxRulesetRequest,
    initOverrides?: RequestInit
  ): Promise<InboxRulesetDto> {
    const response = await this.createInboxRulesetRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Create an inbox with default options. Uses MailSlurp domain pool address and is private.
   */
  async createInboxWithDefaultsRaw(
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxDto>> {
    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/withDefaults`,
        method: 'POST',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxDtoFromJSON(jsonValue)
    );
  }

  /**
   * Create an inbox with default options. Uses MailSlurp domain pool address and is private.
   */
  async createInboxWithDefaults(
    initOverrides?: RequestInit
  ): Promise<InboxDto> {
    const response = await this.createInboxWithDefaultsRaw(initOverrides);
    return await response.value();
  }

  /**
   * Additional endpoint that allows inbox creation with request body options. Can be more flexible that other methods for some clients.
   * Create an inbox with options. Extended options for inbox creation.
   */
  async createInboxWithOptionsRaw(
    requestParameters: CreateInboxWithOptionsRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxDto>> {
    if (
      requestParameters.createInboxDto === null ||
      requestParameters.createInboxDto === undefined
    ) {
      throw new runtime.RequiredError(
        'createInboxDto',
        'Required parameter requestParameters.createInboxDto was null or undefined when calling createInboxWithOptions.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    headerParameters['Content-Type'] = 'application/json';

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/withOptions`,
        method: 'POST',
        headers: headerParameters,
        query: queryParameters,
        body: CreateInboxDtoToJSON(requestParameters.createInboxDto),
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxDtoFromJSON(jsonValue)
    );
  }

  /**
   * Additional endpoint that allows inbox creation with request body options. Can be more flexible that other methods for some clients.
   * Create an inbox with options. Extended options for inbox creation.
   */
  async createInboxWithOptions(
    requestParameters: CreateInboxWithOptionsRequest,
    initOverrides?: RequestInit
  ): Promise<InboxDto> {
    const response = await this.createInboxWithOptionsRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Deletes all emails in an inbox. Be careful as emails cannot be recovered
   * Delete all emails in a given inboxes.
   */
  async deleteAllInboxEmailsRaw(
    requestParameters: DeleteAllInboxEmailsRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<void>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling deleteAllInboxEmails.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/deleteAllInboxEmails`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'DELETE',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.VoidApiResponse(response);
  }

  /**
   * Deletes all emails in an inbox. Be careful as emails cannot be recovered
   * Delete all emails in a given inboxes.
   */
  async deleteAllInboxEmails(
    requestParameters: DeleteAllInboxEmailsRequest,
    initOverrides?: RequestInit
  ): Promise<void> {
    await this.deleteAllInboxEmailsRaw(requestParameters, initOverrides);
  }

  /**
   * Permanently delete all inboxes and associated email addresses. This will also delete all emails within the inboxes. Be careful as inboxes cannot be recovered once deleted. Note: deleting inboxes will not impact your usage limits. Monthly inbox creation limits are based on how many inboxes were created in the last 30 days, not how many inboxes you currently have.
   * Delete all inboxes
   */
  async deleteAllInboxesRaw(
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<void>> {
    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes`,
        method: 'DELETE',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.VoidApiResponse(response);
  }

  /**
   * Permanently delete all inboxes and associated email addresses. This will also delete all emails within the inboxes. Be careful as inboxes cannot be recovered once deleted. Note: deleting inboxes will not impact your usage limits. Monthly inbox creation limits are based on how many inboxes were created in the last 30 days, not how many inboxes you currently have.
   * Delete all inboxes
   */
  async deleteAllInboxes(initOverrides?: RequestInit): Promise<void> {
    await this.deleteAllInboxesRaw(initOverrides);
  }

  /**
   * Permanently delete all inboxes by description
   * Delete inboxes by description
   */
  async deleteAllInboxesByDescriptionRaw(
    requestParameters: DeleteAllInboxesByDescriptionRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<void>> {
    if (
      requestParameters.description === null ||
      requestParameters.description === undefined
    ) {
      throw new runtime.RequiredError(
        'description',
        'Required parameter requestParameters.description was null or undefined when calling deleteAllInboxesByDescription.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.description !== undefined) {
      queryParameters['description'] = requestParameters.description;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/by-description`,
        method: 'DELETE',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.VoidApiResponse(response);
  }

  /**
   * Permanently delete all inboxes by description
   * Delete inboxes by description
   */
  async deleteAllInboxesByDescription(
    requestParameters: DeleteAllInboxesByDescriptionRequest,
    initOverrides?: RequestInit
  ): Promise<void> {
    await this.deleteAllInboxesByDescriptionRaw(
      requestParameters,
      initOverrides
    );
  }

  /**
   * Permanently delete all inboxes by name
   * Delete inboxes by name
   */
  async deleteAllInboxesByNameRaw(
    requestParameters: DeleteAllInboxesByNameRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<void>> {
    if (
      requestParameters.name === null ||
      requestParameters.name === undefined
    ) {
      throw new runtime.RequiredError(
        'name',
        'Required parameter requestParameters.name was null or undefined when calling deleteAllInboxesByName.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.name !== undefined) {
      queryParameters['name'] = requestParameters.name;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/by-name`,
        method: 'DELETE',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.VoidApiResponse(response);
  }

  /**
   * Permanently delete all inboxes by name
   * Delete inboxes by name
   */
  async deleteAllInboxesByName(
    requestParameters: DeleteAllInboxesByNameRequest,
    initOverrides?: RequestInit
  ): Promise<void> {
    await this.deleteAllInboxesByNameRaw(requestParameters, initOverrides);
  }

  /**
   * Permanently delete all inboxes by tag
   * Delete inboxes by tag
   */
  async deleteAllInboxesByTagRaw(
    requestParameters: DeleteAllInboxesByTagRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<void>> {
    if (requestParameters.tag === null || requestParameters.tag === undefined) {
      throw new runtime.RequiredError(
        'tag',
        'Required parameter requestParameters.tag was null or undefined when calling deleteAllInboxesByTag.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.tag !== undefined) {
      queryParameters['tag'] = requestParameters.tag;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/by-tag`,
        method: 'DELETE',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.VoidApiResponse(response);
  }

  /**
   * Permanently delete all inboxes by tag
   * Delete inboxes by tag
   */
  async deleteAllInboxesByTag(
    requestParameters: DeleteAllInboxesByTagRequest,
    initOverrides?: RequestInit
  ): Promise<void> {
    await this.deleteAllInboxesByTagRaw(requestParameters, initOverrides);
  }

  /**
   * Permanently delete an inbox and associated email address as well as all emails within the given inbox. This action cannot be undone. Note: deleting an inbox will not affect your account usage. Monthly inbox usage is based on how many inboxes you create within 30 days, not how many exist at time of request.
   * Delete inbox
   */
  async deleteInboxRaw(
    requestParameters: DeleteInboxRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<void>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling deleteInbox.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'DELETE',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.VoidApiResponse(response);
  }

  /**
   * Permanently delete an inbox and associated email address as well as all emails within the given inbox. This action cannot be undone. Note: deleting an inbox will not affect your account usage. Monthly inbox usage is based on how many inboxes you create within 30 days, not how many exist at time of request.
   * Delete inbox
   */
  async deleteInbox(
    requestParameters: DeleteInboxRequest,
    initOverrides?: RequestInit
  ): Promise<void> {
    await this.deleteInboxRaw(requestParameters, initOverrides);
  }

  /**
   * Check if inboxes exist by email address. Useful if you are sending emails to mailslurp addresses
   * Does inbox exist
   */
  async doesInboxExistRaw(
    requestParameters: DoesInboxExistRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxExistsDto>> {
    if (
      requestParameters.emailAddress === null ||
      requestParameters.emailAddress === undefined
    ) {
      throw new runtime.RequiredError(
        'emailAddress',
        'Required parameter requestParameters.emailAddress was null or undefined when calling doesInboxExist.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.emailAddress !== undefined) {
      queryParameters['emailAddress'] = requestParameters.emailAddress;
    }

    if (requestParameters.allowCatchAll !== undefined) {
      queryParameters['allowCatchAll'] = requestParameters.allowCatchAll;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/exists`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxExistsDtoFromJSON(jsonValue)
    );
  }

  /**
   * Check if inboxes exist by email address. Useful if you are sending emails to mailslurp addresses
   * Does inbox exist
   */
  async doesInboxExist(
    requestParameters: DoesInboxExistRequest,
    initOverrides?: RequestInit
  ): Promise<InboxExistsDto> {
    const response = await this.doesInboxExistRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Remove any expired inboxes for your account (instead of waiting for scheduled removal on server)
   * Remove expired inboxes
   */
  async flushExpiredRaw(
    requestParameters: FlushExpiredRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<FlushExpiredInboxesResult>> {
    const queryParameters: any = {};

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/expired`,
        method: 'DELETE',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      FlushExpiredInboxesResultFromJSON(jsonValue)
    );
  }

  /**
   * Remove any expired inboxes for your account (instead of waiting for scheduled removal on server)
   * Remove expired inboxes
   */
  async flushExpired(
    requestParameters: FlushExpiredRequest,
    initOverrides?: RequestInit
  ): Promise<FlushExpiredInboxesResult> {
    const response = await this.flushExpiredRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * List inboxes in paginated form. The results are available on the `content` property of the returned object. This method allows for page index (zero based), page size (how many results to return), and a sort direction (based on createdAt time). You Can also filter by whether an inbox is favorited or use email address pattern. This method is the recommended way to query inboxes. The alternative `getInboxes` method returns a full list of inboxes but is limited to 100 results.
   * List All Inboxes Paginated
   */
  async getAllInboxesRaw(
    requestParameters: GetAllInboxesRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<PageInboxProjection>> {
    const queryParameters: any = {};

    if (requestParameters.page !== undefined) {
      queryParameters['page'] = requestParameters.page;
    }

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.favourite !== undefined) {
      queryParameters['favourite'] = requestParameters.favourite;
    }

    if (requestParameters.search !== undefined) {
      queryParameters['search'] = requestParameters.search;
    }

    if (requestParameters.tag !== undefined) {
      queryParameters['tag'] = requestParameters.tag;
    }

    if (requestParameters.teamAccess !== undefined) {
      queryParameters['teamAccess'] = requestParameters.teamAccess;
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    if (requestParameters.inboxType !== undefined) {
      queryParameters['inboxType'] = requestParameters.inboxType;
    }

    if (requestParameters.inboxFunction !== undefined) {
      queryParameters['inboxFunction'] = requestParameters.inboxFunction;
    }

    if (requestParameters.domainId !== undefined) {
      queryParameters['domainId'] = requestParameters.domainId;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/paginated`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      PageInboxProjectionFromJSON(jsonValue)
    );
  }

  /**
   * List inboxes in paginated form. The results are available on the `content` property of the returned object. This method allows for page index (zero based), page size (how many results to return), and a sort direction (based on createdAt time). You Can also filter by whether an inbox is favorited or use email address pattern. This method is the recommended way to query inboxes. The alternative `getInboxes` method returns a full list of inboxes but is limited to 100 results.
   * List All Inboxes Paginated
   */
  async getAllInboxes(
    requestParameters: GetAllInboxesRequest,
    initOverrides?: RequestInit
  ): Promise<PageInboxProjection> {
    const response = await this.getAllInboxesRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Schedule sending of emails using scheduled jobs. These can be inbox or account level.
   * Get all scheduled email sending jobs for account
   */
  async getAllScheduledJobsRaw(
    requestParameters: GetAllScheduledJobsRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<PageScheduledJobs>> {
    const queryParameters: any = {};

    if (requestParameters.page !== undefined) {
      queryParameters['page'] = requestParameters.page;
    }

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/scheduled-jobs`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      PageScheduledJobsFromJSON(jsonValue)
    );
  }

  /**
   * Schedule sending of emails using scheduled jobs. These can be inbox or account level.
   * Get all scheduled email sending jobs for account
   */
  async getAllScheduledJobs(
    requestParameters: GetAllScheduledJobsRequest,
    initOverrides?: RequestInit
  ): Promise<PageScheduledJobs> {
    const response = await this.getAllScheduledJobsRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Get all email delivery statuses for an inbox
   */
  async getDeliveryStatusesByInboxIdRaw(
    requestParameters: GetDeliveryStatusesByInboxIdRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<PageDeliveryStatus>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling getDeliveryStatusesByInboxId.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.page !== undefined) {
      queryParameters['page'] = requestParameters.page;
    }

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/delivery-status`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      PageDeliveryStatusFromJSON(jsonValue)
    );
  }

  /**
   * Get all email delivery statuses for an inbox
   */
  async getDeliveryStatusesByInboxId(
    requestParameters: GetDeliveryStatusesByInboxIdRequest,
    initOverrides?: RequestInit
  ): Promise<PageDeliveryStatus> {
    const response = await this.getDeliveryStatusesByInboxIdRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * List emails that an inbox has received. Only emails that are sent to the inbox\'s email address will appear in the inbox. It may take several seconds for any email you send to an inbox\'s email address to appear in the inbox. To make this endpoint wait for a minimum number of emails use the `minCount` parameter. The server will retry the inbox database until the `minCount` is satisfied or the `retryTimeout` is reached
   * Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead.
   */
  async getEmailsRaw(
    requestParameters: GetEmailsRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<Array<EmailPreview>>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling getEmails.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.limit !== undefined) {
      queryParameters['limit'] = requestParameters.limit;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.retryTimeout !== undefined) {
      queryParameters['retryTimeout'] = requestParameters.retryTimeout;
    }

    if (requestParameters.delayTimeout !== undefined) {
      queryParameters['delayTimeout'] = requestParameters.delayTimeout;
    }

    if (requestParameters.minCount !== undefined) {
      queryParameters['minCount'] = requestParameters.minCount;
    }

    if (requestParameters.unreadOnly !== undefined) {
      queryParameters['unreadOnly'] = requestParameters.unreadOnly;
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/emails`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      jsonValue.map(EmailPreviewFromJSON)
    );
  }

  /**
   * List emails that an inbox has received. Only emails that are sent to the inbox\'s email address will appear in the inbox. It may take several seconds for any email you send to an inbox\'s email address to appear in the inbox. To make this endpoint wait for a minimum number of emails use the `minCount` parameter. The server will retry the inbox database until the `minCount` is satisfied or the `retryTimeout` is reached
   * Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead.
   */
  async getEmails(
    requestParameters: GetEmailsRequest,
    initOverrides?: RequestInit
  ): Promise<Array<EmailPreview>> {
    const response = await this.getEmailsRaw(requestParameters, initOverrides);
    return await response.value();
  }

  /**
   * Get IMAP and SMTP access usernames and passwords
   */
  async getImapSmtpAccessRaw(
    requestParameters: GetImapSmtpAccessRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<ImapSmtpAccessDetails>> {
    const queryParameters: any = {};

    if (requestParameters.inboxId !== undefined) {
      queryParameters['inboxId'] = requestParameters.inboxId;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/imap-smtp-access`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      ImapSmtpAccessDetailsFromJSON(jsonValue)
    );
  }

  /**
   * Get IMAP and SMTP access usernames and passwords
   */
  async getImapSmtpAccess(
    requestParameters: GetImapSmtpAccessRequest,
    initOverrides?: RequestInit
  ): Promise<ImapSmtpAccessDetails> {
    const response = await this.getImapSmtpAccessRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Returns an inbox\'s properties, including its email address and ID.
   * Get Inbox. Returns properties of an inbox.
   */
  async getInboxRaw(
    requestParameters: GetInboxRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxDto>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling getInbox.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxDtoFromJSON(jsonValue)
    );
  }

  /**
   * Returns an inbox\'s properties, including its email address and ID.
   * Get Inbox. Returns properties of an inbox.
   */
  async getInbox(
    requestParameters: GetInboxRequest,
    initOverrides?: RequestInit
  ): Promise<InboxDto> {
    const response = await this.getInboxRaw(requestParameters, initOverrides);
    return await response.value();
  }

  /**
   * Get a inbox result by email address
   * Search for an inbox with the provided email address
   */
  async getInboxByEmailAddressRaw(
    requestParameters: GetInboxByEmailAddressRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxByEmailAddressResult>> {
    if (
      requestParameters.emailAddress === null ||
      requestParameters.emailAddress === undefined
    ) {
      throw new runtime.RequiredError(
        'emailAddress',
        'Required parameter requestParameters.emailAddress was null or undefined when calling getInboxByEmailAddress.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.emailAddress !== undefined) {
      queryParameters['emailAddress'] = requestParameters.emailAddress;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/byEmailAddress`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxByEmailAddressResultFromJSON(jsonValue)
    );
  }

  /**
   * Get a inbox result by email address
   * Search for an inbox with the provided email address
   */
  async getInboxByEmailAddress(
    requestParameters: GetInboxByEmailAddressRequest,
    initOverrides?: RequestInit
  ): Promise<InboxByEmailAddressResult> {
    const response = await this.getInboxByEmailAddressRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Get a inbox result by name
   * Search for an inbox with the given name
   */
  async getInboxByNameRaw(
    requestParameters: GetInboxByNameRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxByNameResult>> {
    if (
      requestParameters.name === null ||
      requestParameters.name === undefined
    ) {
      throw new runtime.RequiredError(
        'name',
        'Required parameter requestParameters.name was null or undefined when calling getInboxByName.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.name !== undefined) {
      queryParameters['name'] = requestParameters.name;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/byName`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxByNameResultFromJSON(jsonValue)
    );
  }

  /**
   * Get a inbox result by name
   * Search for an inbox with the given name
   */
  async getInboxByName(
    requestParameters: GetInboxByNameRequest,
    initOverrides?: RequestInit
  ): Promise<InboxByNameResult> {
    const response = await this.getInboxByNameRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Get total inbox count
   */
  async getInboxCountRaw(
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<CountDto>> {
    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/count`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      CountDtoFromJSON(jsonValue)
    );
  }

  /**
   * Get total inbox count
   */
  async getInboxCount(initOverrides?: RequestInit): Promise<CountDto> {
    const response = await this.getInboxCountRaw(initOverrides);
    return await response.value();
  }

  /**
   * Get email count in inbox
   */
  async getInboxEmailCountRaw(
    requestParameters: GetInboxEmailCountRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<CountDto>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling getInboxEmailCount.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/emails/count`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      CountDtoFromJSON(jsonValue)
    );
  }

  /**
   * Get email count in inbox
   */
  async getInboxEmailCount(
    requestParameters: GetInboxEmailCountRequest,
    initOverrides?: RequestInit
  ): Promise<CountDto> {
    const response = await this.getInboxEmailCountRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Get a paginated list of emails in an inbox. Does not hold connections open.
   * Get inbox emails paginated
   */
  async getInboxEmailsPaginatedRaw(
    requestParameters: GetInboxEmailsPaginatedRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<PageEmailPreview>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling getInboxEmailsPaginated.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.page !== undefined) {
      queryParameters['page'] = requestParameters.page;
    }

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/emails/paginated`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      PageEmailPreviewFromJSON(jsonValue)
    );
  }

  /**
   * Get a paginated list of emails in an inbox. Does not hold connections open.
   * Get inbox emails paginated
   */
  async getInboxEmailsPaginated(
    requestParameters: GetInboxEmailsPaginatedRequest,
    initOverrides?: RequestInit
  ): Promise<PageEmailPreview> {
    const response = await this.getInboxEmailsPaginatedRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Get list of inbox IDs
   * Get all inbox IDs
   */
  async getInboxIdsRaw(
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxIdsResult>> {
    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/ids`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxIdsResultFromJSON(jsonValue)
    );
  }

  /**
   * Get list of inbox IDs
   * Get all inbox IDs
   */
  async getInboxIds(initOverrides?: RequestInit): Promise<InboxIdsResult> {
    const response = await this.getInboxIdsRaw(initOverrides);
    return await response.value();
  }

  /**
   * Returns an inbox\'s sent email receipts. Call individual sent email endpoints for more details. Note for privacy reasons the full body of sent emails is never stored. An MD5 hash hex is available for comparison instead.
   * Get Inbox Sent Emails
   */
  async getInboxSentEmailsRaw(
    requestParameters: GetInboxSentEmailsRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<PageSentEmailProjection>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling getInboxSentEmails.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.page !== undefined) {
      queryParameters['page'] = requestParameters.page;
    }

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.searchFilter !== undefined) {
      queryParameters['searchFilter'] = requestParameters.searchFilter;
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/sent`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      PageSentEmailProjectionFromJSON(jsonValue)
    );
  }

  /**
   * Returns an inbox\'s sent email receipts. Call individual sent email endpoints for more details. Note for privacy reasons the full body of sent emails is never stored. An MD5 hash hex is available for comparison instead.
   * Get Inbox Sent Emails
   */
  async getInboxSentEmails(
    requestParameters: GetInboxSentEmailsRequest,
    initOverrides?: RequestInit
  ): Promise<PageSentEmailProjection> {
    const response = await this.getInboxSentEmailsRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Get all inbox tags
   * Get inbox tags
   */
  async getInboxTagsRaw(
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<Array<string>>> {
    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/tags`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse<any>(response);
  }

  /**
   * Get all inbox tags
   * Get inbox tags
   */
  async getInboxTags(initOverrides?: RequestInit): Promise<Array<string>> {
    const response = await this.getInboxTagsRaw(initOverrides);
    return await response.value();
  }

  /**
   * List the inboxes you have created. Note use of the more advanced `getAllInboxes` is recommended and allows paginated access using a limit and sort parameter.
   * List Inboxes and email addresses
   */
  async getInboxesRaw(
    requestParameters: GetInboxesRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<Array<InboxDto>>> {
    const queryParameters: any = {};

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    if (requestParameters.excludeCatchAllInboxes !== undefined) {
      queryParameters['excludeCatchAllInboxes'] =
        requestParameters.excludeCatchAllInboxes;
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      jsonValue.map(InboxDtoFromJSON)
    );
  }

  /**
   * List the inboxes you have created. Note use of the more advanced `getAllInboxes` is recommended and allows paginated access using a limit and sort parameter.
   * List Inboxes and email addresses
   */
  async getInboxes(
    requestParameters: GetInboxesRequest,
    initOverrides?: RequestInit
  ): Promise<Array<InboxDto>> {
    const response = await this.getInboxesRaw(requestParameters, initOverrides);
    return await response.value();
  }

  /**
   * Get the newest email in an inbox or wait for one to arrive
   * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.
   */
  async getLatestEmailInInboxRaw(
    requestParameters: GetLatestEmailInInboxRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<Email>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling getLatestEmailInInbox.'
      );
    }

    if (
      requestParameters.timeoutMillis === null ||
      requestParameters.timeoutMillis === undefined
    ) {
      throw new runtime.RequiredError(
        'timeoutMillis',
        'Required parameter requestParameters.timeoutMillis was null or undefined when calling getLatestEmailInInbox.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.inboxId !== undefined) {
      queryParameters['inboxId'] = requestParameters.inboxId;
    }

    if (requestParameters.timeoutMillis !== undefined) {
      queryParameters['timeoutMillis'] = requestParameters.timeoutMillis;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/getLatestEmail`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      EmailFromJSON(jsonValue)
    );
  }

  /**
   * Get the newest email in an inbox or wait for one to arrive
   * Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.
   */
  async getLatestEmailInInbox(
    requestParameters: GetLatestEmailInInboxRequest,
    initOverrides?: RequestInit
  ): Promise<Email> {
    const response = await this.getLatestEmailInInboxRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * List organization inboxes in paginated form. These are inboxes created with `allowTeamAccess` flag enabled. Organization inboxes are `readOnly` for non-admin users. The results are available on the `content` property of the returned object. This method allows for page index (zero based), page size (how many results to return), and a sort direction (based on createdAt time).
   * List Organization Inboxes Paginated
   */
  async getOrganizationInboxesRaw(
    requestParameters: GetOrganizationInboxesRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<PageOrganizationInboxProjection>> {
    const queryParameters: any = {};

    if (requestParameters.page !== undefined) {
      queryParameters['page'] = requestParameters.page;
    }

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.searchFilter !== undefined) {
      queryParameters['searchFilter'] = requestParameters.searchFilter;
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/organization`,
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      PageOrganizationInboxProjectionFromJSON(jsonValue)
    );
  }

  /**
   * List organization inboxes in paginated form. These are inboxes created with `allowTeamAccess` flag enabled. Organization inboxes are `readOnly` for non-admin users. The results are available on the `content` property of the returned object. This method allows for page index (zero based), page size (how many results to return), and a sort direction (based on createdAt time).
   * List Organization Inboxes Paginated
   */
  async getOrganizationInboxes(
    requestParameters: GetOrganizationInboxesRequest,
    initOverrides?: RequestInit
  ): Promise<PageOrganizationInboxProjection> {
    const response = await this.getOrganizationInboxesRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Get a scheduled email job details.
   * Get a scheduled email job
   */
  async getScheduledJobRaw(
    requestParameters: GetScheduledJobRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<ScheduledJobDto>> {
    if (
      requestParameters.jobId === null ||
      requestParameters.jobId === undefined
    ) {
      throw new runtime.RequiredError(
        'jobId',
        'Required parameter requestParameters.jobId was null or undefined when calling getScheduledJob.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/scheduled-jobs/{jobId}`.replace(
          `{${'jobId'}}`,
          encodeURIComponent(String(requestParameters.jobId))
        ),
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      ScheduledJobDtoFromJSON(jsonValue)
    );
  }

  /**
   * Get a scheduled email job details.
   * Get a scheduled email job
   */
  async getScheduledJob(
    requestParameters: GetScheduledJobRequest,
    initOverrides?: RequestInit
  ): Promise<ScheduledJobDto> {
    const response = await this.getScheduledJobRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Schedule sending of emails using scheduled jobs.
   * Get all scheduled email sending jobs for the inbox
   */
  async getScheduledJobsByInboxIdRaw(
    requestParameters: GetScheduledJobsByInboxIdRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<PageScheduledJobs>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling getScheduledJobsByInboxId.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.page !== undefined) {
      queryParameters['page'] = requestParameters.page;
    }

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/scheduled-jobs`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      PageScheduledJobsFromJSON(jsonValue)
    );
  }

  /**
   * Schedule sending of emails using scheduled jobs.
   * Get all scheduled email sending jobs for the inbox
   */
  async getScheduledJobsByInboxId(
    requestParameters: GetScheduledJobsByInboxIdRequest,
    initOverrides?: RequestInit
  ): Promise<PageScheduledJobs> {
    const response = await this.getScheduledJobsByInboxIdRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * List all rulesets attached to an inbox
   * List inbox rulesets
   */
  async listInboxRulesetsRaw(
    requestParameters: ListInboxRulesetsRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<PageInboxRulesetDto>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling listInboxRulesets.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.page !== undefined) {
      queryParameters['page'] = requestParameters.page;
    }

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.searchFilter !== undefined) {
      queryParameters['searchFilter'] = requestParameters.searchFilter;
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/rulesets`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      PageInboxRulesetDtoFromJSON(jsonValue)
    );
  }

  /**
   * List all rulesets attached to an inbox
   * List inbox rulesets
   */
  async listInboxRulesets(
    requestParameters: ListInboxRulesetsRequest,
    initOverrides?: RequestInit
  ): Promise<PageInboxRulesetDto> {
    const response = await this.listInboxRulesetsRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * List all tracking pixels sent from an inbox
   * List inbox tracking pixels
   */
  async listInboxTrackingPixelsRaw(
    requestParameters: ListInboxTrackingPixelsRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<PageTrackingPixelProjection>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling listInboxTrackingPixels.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.page !== undefined) {
      queryParameters['page'] = requestParameters.page;
    }

    if (requestParameters.size !== undefined) {
      queryParameters['size'] = requestParameters.size;
    }

    if (requestParameters.sort !== undefined) {
      queryParameters['sort'] = requestParameters.sort;
    }

    if (requestParameters.searchFilter !== undefined) {
      queryParameters['searchFilter'] = requestParameters.searchFilter;
    }

    if (requestParameters.since !== undefined) {
      queryParameters['since'] = (requestParameters.since as any).toISOString();
    }

    if (requestParameters.before !== undefined) {
      queryParameters['before'] = (
        requestParameters.before as any
      ).toISOString();
    }

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/tracking-pixels`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'GET',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      PageTrackingPixelProjectionFromJSON(jsonValue)
    );
  }

  /**
   * List all tracking pixels sent from an inbox
   * List inbox tracking pixels
   */
  async listInboxTrackingPixels(
    requestParameters: ListInboxTrackingPixelsRequest,
    initOverrides?: RequestInit
  ): Promise<PageTrackingPixelProjection> {
    const response = await this.listInboxTrackingPixelsRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Send an email from an inbox\'s email address.  The request body should contain the `SendEmailOptions` that include recipients, attachments, body etc. See `SendEmailOptions` for all available properties. Note the `inboxId` refers to the inbox\'s id not the inbox\'s email address. See https://www.mailslurp.com/guides/ for more information on how to send emails. This method does not return a sent email entity due to legacy reasons. To send and get a sent email as returned response use the sister method `sendEmailAndConfirm`.
   * Send Email
   */
  async sendEmailRaw(
    requestParameters: SendEmailRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<void>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling sendEmail.'
      );
    }

    if (
      requestParameters.sendEmailOptions === null ||
      requestParameters.sendEmailOptions === undefined
    ) {
      throw new runtime.RequiredError(
        'sendEmailOptions',
        'Required parameter requestParameters.sendEmailOptions was null or undefined when calling sendEmail.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    headerParameters['Content-Type'] = 'application/json';

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'POST',
        headers: headerParameters,
        query: queryParameters,
        body: SendEmailOptionsToJSON(requestParameters.sendEmailOptions),
      },
      initOverrides
    );

    return new runtime.VoidApiResponse(response);
  }

  /**
   * Send an email from an inbox\'s email address.  The request body should contain the `SendEmailOptions` that include recipients, attachments, body etc. See `SendEmailOptions` for all available properties. Note the `inboxId` refers to the inbox\'s id not the inbox\'s email address. See https://www.mailslurp.com/guides/ for more information on how to send emails. This method does not return a sent email entity due to legacy reasons. To send and get a sent email as returned response use the sister method `sendEmailAndConfirm`.
   * Send Email
   */
  async sendEmail(
    requestParameters: SendEmailRequest,
    initOverrides?: RequestInit
  ): Promise<void> {
    await this.sendEmailRaw(requestParameters, initOverrides);
  }

  /**
   * Sister method for standard `sendEmail` method with the benefit of returning a `SentEmail` entity confirming the successful sending of the email with a link to the sent object created for it.
   * Send email and return sent confirmation
   */
  async sendEmailAndConfirmRaw(
    requestParameters: SendEmailAndConfirmRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<SentEmailDto>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling sendEmailAndConfirm.'
      );
    }

    if (
      requestParameters.sendEmailOptions === null ||
      requestParameters.sendEmailOptions === undefined
    ) {
      throw new runtime.RequiredError(
        'sendEmailOptions',
        'Required parameter requestParameters.sendEmailOptions was null or undefined when calling sendEmailAndConfirm.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    headerParameters['Content-Type'] = 'application/json';

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/confirm`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'POST',
        headers: headerParameters,
        query: queryParameters,
        body: SendEmailOptionsToJSON(requestParameters.sendEmailOptions),
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      SentEmailDtoFromJSON(jsonValue)
    );
  }

  /**
   * Sister method for standard `sendEmail` method with the benefit of returning a `SentEmail` entity confirming the successful sending of the email with a link to the sent object created for it.
   * Send email and return sent confirmation
   */
  async sendEmailAndConfirm(
    requestParameters: SendEmailAndConfirmRequest,
    initOverrides?: RequestInit
  ): Promise<SentEmailDto> {
    const response = await this.sendEmailAndConfirmRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Send an email using a queue. Will place the email onto a queue that will then be processed and sent. Use this queue method to enable any failed email sending to be recovered. This will prevent lost emails when sending if your account encounters a block or payment issue.
   * Send email with queue
   */
  async sendEmailWithQueueRaw(
    requestParameters: SendEmailWithQueueRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<void>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling sendEmailWithQueue.'
      );
    }

    if (
      requestParameters.validateBeforeEnqueue === null ||
      requestParameters.validateBeforeEnqueue === undefined
    ) {
      throw new runtime.RequiredError(
        'validateBeforeEnqueue',
        'Required parameter requestParameters.validateBeforeEnqueue was null or undefined when calling sendEmailWithQueue.'
      );
    }

    if (
      requestParameters.sendEmailOptions === null ||
      requestParameters.sendEmailOptions === undefined
    ) {
      throw new runtime.RequiredError(
        'sendEmailOptions',
        'Required parameter requestParameters.sendEmailOptions was null or undefined when calling sendEmailWithQueue.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.validateBeforeEnqueue !== undefined) {
      queryParameters['validateBeforeEnqueue'] =
        requestParameters.validateBeforeEnqueue;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    headerParameters['Content-Type'] = 'application/json';

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/with-queue`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'POST',
        headers: headerParameters,
        query: queryParameters,
        body: SendEmailOptionsToJSON(requestParameters.sendEmailOptions),
      },
      initOverrides
    );

    return new runtime.VoidApiResponse(response);
  }

  /**
   * Send an email using a queue. Will place the email onto a queue that will then be processed and sent. Use this queue method to enable any failed email sending to be recovered. This will prevent lost emails when sending if your account encounters a block or payment issue.
   * Send email with queue
   */
  async sendEmailWithQueue(
    requestParameters: SendEmailWithQueueRequest,
    initOverrides?: RequestInit
  ): Promise<void> {
    await this.sendEmailWithQueueRaw(requestParameters, initOverrides);
  }

  /**
   * Send email using an SMTP envelope containing RCPT TO, MAIL FROM, and a SMTP BODY.
   * Send email using an SMTP mail envelope and message body and return sent confirmation
   */
  async sendSmtpEnvelopeRaw(
    requestParameters: SendSmtpEnvelopeRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<SentEmailDto>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling sendSmtpEnvelope.'
      );
    }

    if (
      requestParameters.sendSMTPEnvelopeOptions === null ||
      requestParameters.sendSMTPEnvelopeOptions === undefined
    ) {
      throw new runtime.RequiredError(
        'sendSMTPEnvelopeOptions',
        'Required parameter requestParameters.sendSMTPEnvelopeOptions was null or undefined when calling sendSmtpEnvelope.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    headerParameters['Content-Type'] = 'application/json';

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/smtp-envelope`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'POST',
        headers: headerParameters,
        query: queryParameters,
        body: SendSMTPEnvelopeOptionsToJSON(
          requestParameters.sendSMTPEnvelopeOptions
        ),
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      SentEmailDtoFromJSON(jsonValue)
    );
  }

  /**
   * Send email using an SMTP envelope containing RCPT TO, MAIL FROM, and a SMTP BODY.
   * Send email using an SMTP mail envelope and message body and return sent confirmation
   */
  async sendSmtpEnvelope(
    requestParameters: SendSmtpEnvelopeRequest,
    initOverrides?: RequestInit
  ): Promise<SentEmailDto> {
    const response = await this.sendSmtpEnvelopeRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Send an inbox a test email to test email receiving is working
   * Send a test email to inbox
   */
  async sendTestEmailRaw(
    requestParameters: SendTestEmailRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<void>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling sendTestEmail.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/send-test-email`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'POST',
        headers: headerParameters,
        query: queryParameters,
      },
      initOverrides
    );

    return new runtime.VoidApiResponse(response);
  }

  /**
   * Send an inbox a test email to test email receiving is working
   * Send a test email to inbox
   */
  async sendTestEmail(
    requestParameters: SendTestEmailRequest,
    initOverrides?: RequestInit
  ): Promise<void> {
    await this.sendTestEmailRaw(requestParameters, initOverrides);
  }

  /**
   * Send an email using a delay. Will place the email onto a scheduler that will then be processed and sent. Use delays to schedule email sending.
   * Send email with with delay or schedule
   */
  async sendWithScheduleRaw(
    requestParameters: SendWithScheduleRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<ScheduledJobDto>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling sendWithSchedule.'
      );
    }

    if (
      requestParameters.sendEmailOptions === null ||
      requestParameters.sendEmailOptions === undefined
    ) {
      throw new runtime.RequiredError(
        'sendEmailOptions',
        'Required parameter requestParameters.sendEmailOptions was null or undefined when calling sendWithSchedule.'
      );
    }

    const queryParameters: any = {};

    if (requestParameters.sendAtTimestamp !== undefined) {
      queryParameters['sendAtTimestamp'] = (
        requestParameters.sendAtTimestamp as any
      ).toISOString();
    }

    if (requestParameters.sendAtNowPlusSeconds !== undefined) {
      queryParameters['sendAtNowPlusSeconds'] =
        requestParameters.sendAtNowPlusSeconds;
    }

    if (requestParameters.validateBeforeEnqueue !== undefined) {
      queryParameters['validateBeforeEnqueue'] =
        requestParameters.validateBeforeEnqueue;
    }

    const headerParameters: runtime.HTTPHeaders = {};

    headerParameters['Content-Type'] = 'application/json';

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/with-schedule`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'POST',
        headers: headerParameters,
        query: queryParameters,
        body: SendEmailOptionsToJSON(requestParameters.sendEmailOptions),
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      ScheduledJobDtoFromJSON(jsonValue)
    );
  }

  /**
   * Send an email using a delay. Will place the email onto a scheduler that will then be processed and sent. Use delays to schedule email sending.
   * Send email with with delay or schedule
   */
  async sendWithSchedule(
    requestParameters: SendWithScheduleRequest,
    initOverrides?: RequestInit
  ): Promise<ScheduledJobDto> {
    const response = await this.sendWithScheduleRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Set and return new favourite state for an inbox
   * Set inbox favourited state
   */
  async setInboxFavouritedRaw(
    requestParameters: SetInboxFavouritedRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxDto>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling setInboxFavourited.'
      );
    }

    if (
      requestParameters.setInboxFavouritedOptions === null ||
      requestParameters.setInboxFavouritedOptions === undefined
    ) {
      throw new runtime.RequiredError(
        'setInboxFavouritedOptions',
        'Required parameter requestParameters.setInboxFavouritedOptions was null or undefined when calling setInboxFavourited.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    headerParameters['Content-Type'] = 'application/json';

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}/favourite`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'PUT',
        headers: headerParameters,
        query: queryParameters,
        body: SetInboxFavouritedOptionsToJSON(
          requestParameters.setInboxFavouritedOptions
        ),
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxDtoFromJSON(jsonValue)
    );
  }

  /**
   * Set and return new favourite state for an inbox
   * Set inbox favourited state
   */
  async setInboxFavourited(
    requestParameters: SetInboxFavouritedRequest,
    initOverrides?: RequestInit
  ): Promise<InboxDto> {
    const response = await this.setInboxFavouritedRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }

  /**
   * Update editable fields on an inbox
   * Update Inbox. Change name and description. Email address is not editable.
   */
  async updateInboxRaw(
    requestParameters: UpdateInboxRequest,
    initOverrides?: RequestInit
  ): Promise<runtime.ApiResponse<InboxDto>> {
    if (
      requestParameters.inboxId === null ||
      requestParameters.inboxId === undefined
    ) {
      throw new runtime.RequiredError(
        'inboxId',
        'Required parameter requestParameters.inboxId was null or undefined when calling updateInbox.'
      );
    }

    if (
      requestParameters.updateInboxOptions === null ||
      requestParameters.updateInboxOptions === undefined
    ) {
      throw new runtime.RequiredError(
        'updateInboxOptions',
        'Required parameter requestParameters.updateInboxOptions was null or undefined when calling updateInbox.'
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    headerParameters['Content-Type'] = 'application/json';

    if (this.configuration && this.configuration.apiKey) {
      headerParameters['x-api-key'] = this.configuration.apiKey('x-api-key'); // API_KEY authentication
    }

    const response = await this.request(
      {
        path: `/inboxes/{inboxId}`.replace(
          `{${'inboxId'}}`,
          encodeURIComponent(String(requestParameters.inboxId))
        ),
        method: 'PATCH',
        headers: headerParameters,
        query: queryParameters,
        body: UpdateInboxOptionsToJSON(requestParameters.updateInboxOptions),
      },
      initOverrides
    );

    return new runtime.JSONApiResponse(response, (jsonValue) =>
      InboxDtoFromJSON(jsonValue)
    );
  }

  /**
   * Update editable fields on an inbox
   * Update Inbox. Change name and description. Email address is not editable.
   */
  async updateInbox(
    requestParameters: UpdateInboxRequest,
    initOverrides?: RequestInit
  ): Promise<InboxDto> {
    const response = await this.updateInboxRaw(
      requestParameters,
      initOverrides
    );
    return await response.value();
  }
}

/**
 * @export
 * @enum {string}
 */
export enum CreateInboxInboxTypeEnum {
  HTTP_INBOX = 'HTTP_INBOX',
  SMTP_INBOX = 'SMTP_INBOX',
}
/**
 * @export
 * @enum {string}
 */
export enum GetAllInboxesSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
/**
 * @export
 * @enum {string}
 */
export enum GetAllInboxesInboxTypeEnum {
  HTTP_INBOX = 'HTTP_INBOX',
  SMTP_INBOX = 'SMTP_INBOX',
}
/**
 * @export
 * @enum {string}
 */
export enum GetAllInboxesInboxFunctionEnum {
  ALIAS = 'ALIAS',
  THREAD = 'THREAD',
  CATCH_ALL = 'CATCH_ALL',
  CONNECTOR = 'CONNECTOR',
}
/**
 * @export
 * @enum {string}
 */
export enum GetAllScheduledJobsSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
/**
 * @export
 * @enum {string}
 */
export enum GetDeliveryStatusesByInboxIdSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
/**
 * @export
 * @enum {string}
 */
export enum GetEmailsSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
/**
 * @export
 * @enum {string}
 */
export enum GetInboxEmailsPaginatedSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
/**
 * @export
 * @enum {string}
 */
export enum GetInboxSentEmailsSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
/**
 * @export
 * @enum {string}
 */
export enum GetInboxesSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
/**
 * @export
 * @enum {string}
 */
export enum GetOrganizationInboxesSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
/**
 * @export
 * @enum {string}
 */
export enum GetScheduledJobsByInboxIdSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
/**
 * @export
 * @enum {string}
 */
export enum ListInboxRulesetsSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
/**
 * @export
 * @enum {string}
 */
export enum ListInboxTrackingPixelsSortEnum {
  ASC = 'ASC',
  DESC = 'DESC',
}
