# `ExAcme.Order`
[🔗](https://github.com/jtdowney/ex_acme/blob/main/lib/ex_acme/order.ex#L1)

Represents an [ACME Order object](https://datatracker.ietf.org/doc/html/rfc8555#section-7.1.3).

Provides functionalities to fetch, finalize, and parse order details from the ACME server.

### Attributes

  - `url` - The URL of the order.
  - `status` - The current status of the order.
  - `expires` - Expiration datetime of the order.
  - `identifiers` - List of domain identifiers associated with the order.
  - `profile` - The profile associated with the order.
  - `not_before` - Start datetime of the order's validity.
  - `not_after` - End datetime of the order's validity.
  - `error` - Any error associated with the order.
  - `authorizations` - List of authorization URLs.
  - `finalize_url` - URL to finalize the order.
  - `certificate_url` - URL to retrieve the issued certificate.

# `t`

```elixir
@type t() :: %ExAcme.Order{
  authorizations: [String.t()],
  certificate_url: String.t() | nil,
  error: map() | nil,
  expires: DateTime.t() | nil,
  finalize_url: String.t(),
  identifiers: [map()],
  not_after: DateTime.t() | nil,
  not_before: DateTime.t() | nil,
  profile: String.t(),
  status: String.t(),
  url: String.t()
}
```

ACME Order object

# `to_csr`

```elixir
@spec to_csr(t(), X509.PrivateKey.t()) ::
  {:ok, X509.CSR.t()} | {:error, :empty_identifiers}
```

Generates a Certificate Signing Request (CSR) from an order and a private key.

## Parameters

  - `order` - The ACME order.
  - `private_key` - The private key to sign the CSR and associate with the certificate.

## Returns

  - `{:ok, X509.CSR.t()}` - The generated CSR.
  - `{:error, :empty_identifiers}` - If the order has no identifiers.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
