# Google.Apis.Storage.v1

**Kind:** Service

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

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

NuGet package dependency

`Google.Apis.Storage.v1` is a NuGet dependency declared by `Pams.Storage`. The .NET storage layer uses it to send requests to Google Cloud Storage, while application clients should access storage operations through application endpoints.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant StorageApi as Application Storage API
    participant PamsStorage as Pams.Storage
    participant GoogleStorage as Google Cloud Storage

    Client->>StorageApi: Request storage operation
    StorageApi->>PamsStorage: Invoke storage service
    PamsStorage->>GoogleStorage: Send request through Google.Apis.Storage.v1
    GoogleStorage-->>PamsStorage: Return storage response
    PamsStorage-->>StorageApi: Return result
    StorageApi-->>Client: Return response
```

## Usage

```ts
type StorageObject = {
  name: string;
  contentType?: string;
};

async function listStorageObjects(bucket: string): Promise<StorageObject[]> {
  const response = await fetch(
    `/api/storage/objects?bucket=${encodeURIComponent(bucket)}`,
    {
      headers: {
        Accept: "application/json",
      },
    },
  );

  if (!response.ok) {
    throw new Error("Unable to load storage objects");
  }

  return response.json();
}

const objects = await listStorageObjects("application-files");

for (const object of objects) {
  console.log(object.name);
}
```

## AI Coding Instructions

- Keep `Google.Apis.Storage.v1` usage inside the .NET `Pams.Storage` layer rather than exposing Google Cloud Storage credentials to clients.
- Route browser and TypeScript calls through application storage endpoints.
- Handle Google API failures and map them to application-level errors before returning responses.
- Keep bucket names, object paths, and credentials in configuration rather than hardcoding them.

## 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.Storage` — `Pams/Logic/Pams.Storage/Pams.Storage.csproj`:1
