# ink.resenha.shop.take

> Requires the caller's service token. The first take of a version may take up to a minute while the server copies it from its source.

- Kind: procedure
- Authority: shop.resenha.ink
- Lexicon: 1
- Published by [resenha.ink](https://lexicon.garden/identity/did:plc:v7itjf4h3sb5zuegiiskctqb), not the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:v7itjf4h3sb5zuegiiskctqb/ink.resenha.shop.take)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:v7itjf4h3sb5zuegiiskctqb/ink.resenha.shop.take/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:v7itjf4h3sb5zuegiiskctqb/ink.resenha.shop.take/analytics)

## Procedure (`ink.resenha.shop.take`)

Type: procedure · POST

### Input (application/json)

- `edition` (string, required)
  - Constraints: maxLength: 128

### Output (application/json)

- `contentCID` (string, required): CIDv1 (raw, sha2-256, base32) of the file's bytes.
  - Constraints: maxLength: 128
- `expiresAt` (string · datetime, required)
- `filename` (string, required)
  - Constraints: maxLength: 256
- `id` (string, required)
  - Constraints: maxLength: 128
- `size` (integer, required)
  - Constraints: minimum: 0
- `source` (string, required)
  - Constraints: knownValues: se | pg
- `url` (string · uri, required): Pre-signed; good for 15 minutes.
- `version` (string, required)
  - Constraints: maxLength: 64

### Errors

- `ShopOff`: The Shop is paused.
- `DailyCap`: The account has taken 20 books today (UTC).
- `SourceBusy`: The Shop has copied all it may from its sources today.
- `SourceFailed`: The source refused or the file didn't arrive.
- `NotFound`: No such edition, or it is hidden.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Requires the caller's service token. The first take of a version may take up to a minute while the server copies it from its source.",
      "errors": [
        {
          "description": "The Shop is paused.",
          "name": "ShopOff"
        },
        {
          "description": "The account has taken 20 books today (UTC).",
          "name": "DailyCap"
        },
        {
          "description": "The Shop has copied all it may from its sources today.",
          "name": "SourceBusy"
        },
        {
          "description": "The source refused or the file didn't arrive.",
          "name": "SourceFailed"
        },
        {
          "description": "No such edition, or it is hidden.",
          "name": "NotFound"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "edition": {
              "maxLength": 128,
              "type": "string"
            }
          },
          "required": [
            "edition"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "contentCID": {
              "description": "CIDv1 (raw, sha2-256, base32) of the file's bytes.",
              "maxLength": 128,
              "type": "string"
            },
            "expiresAt": {
              "format": "datetime",
              "type": "string"
            },
            "filename": {
              "maxLength": 256,
              "type": "string"
            },
            "id": {
              "maxLength": 128,
              "type": "string"
            },
            "size": {
              "minimum": 0,
              "type": "integer"
            },
            "source": {
              "knownValues": [
                "se",
                "pg"
              ],
              "type": "string"
            },
            "url": {
              "description": "Pre-signed; good for 15 minutes.",
              "format": "uri",
              "type": "string"
            },
            "version": {
              "maxLength": 64,
              "type": "string"
            }
          },
          "required": [
            "url",
            "expiresAt",
            "size",
            "contentCID",
            "version",
            "source",
            "id",
            "filename"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Get: a short-lived address for an edition's current file, which the app downloads, checks against contentCID and saves as an uploaded eBook. The server counts takes per edition without the account, and per account without the book.",
  "id": "ink.resenha.shop.take",
  "lexicon": 1
}
```
