# Owin.Extensions

**Kind:** Service

**Source:** `Pams/API/Pams.API/Pams.API.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`Owin.Extensions` is a NuGet package reference in `Pams.API.csproj` that adds extension middleware for an OWIN application pipeline. The API uses it within its legacy OWIN hosting setup for request handling features exposed by the package.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant API as Pams.API
    participant OWIN as OWIN Pipeline
    participant Extensions as Owin.Extensions

    Client->>API: HTTP request
    API->>OWIN: Process request
    OWIN->>Extensions: Run extension middleware
    Extensions-->>OWIN: Continue pipeline or create response
    OWIN-->>API: Response
    API-->>Client: HTTP response
```

## Usage

```ts
const response = await fetch("/api/patients", {
  headers: {
    Accept: "application/json",
  },
});

if (!response.ok) {
  const error = await response.text();
  throw new Error(`API request failed: ${error}`);
}

const patients = await response.json();
console.log(patients);
```

## AI Coding Instructions

- Treat `Owin.Extensions` as an API-host dependency configured in the .NET OWIN pipeline, not as a JavaScript package.
- Check the OWIN startup configuration before adding or changing extension middleware.
- Keep middleware ordering consistent because earlier middleware can handle a request before later middleware runs.
- Update the NuGet package reference in `Pams.API.csproj` when changing the dependency version.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (1)

- `Pams.API` — `Pams/API/Pams.API/Pams.API.csproj`:1
