GitHubBlobModel

pydantic model safir.github.models.GitHubBlobModel

A Pydantic model for a blob, returned by the GitHub blob endpoint.

See https://docs.github.com/en/rest/git/blobs#get-a-blob

Parameters:

data (Any)

Show JSON schema
{
   "title": "GitHubBlobModel",
   "description": "A Pydantic model for a blob, returned by the GitHub blob endpoint.\n\nSee https://docs.github.com/en/rest/git/blobs#get-a-blob",
   "type": "object",
   "properties": {
      "content": {
         "description": "The blob's encoded content. Use the `decode` method to decode.",
         "title": "Content",
         "type": "string"
      },
      "encoding": {
         "description": "Content encoding (typically base64).",
         "title": "Encoding",
         "type": "string"
      },
      "url": {
         "description": "API URL of this resource.",
         "format": "uri",
         "maxLength": 2083,
         "minLength": 1,
         "title": "Url",
         "type": "string"
      },
      "sha": {
         "description": "Git SHA of tree object.",
         "title": "Sha",
         "type": "string"
      },
      "size": {
         "description": "Size of the content in bytes.",
         "title": "Size",
         "type": "integer"
      }
   },
   "required": [
      "content",
      "encoding",
      "url",
      "sha",
      "size"
   ]
}

Fields:
field content: str [Required]

The blob’s encoded content. Use the decode method to decode.

field encoding: str [Required]

Content encoding (typically base64).

field sha: str [Required]

Git SHA of tree object.

field size: int [Required]

Size of the content in bytes.

field url: HttpUrl [Required]

API URL of this resource.

Constraints:
  • max_length = 2083

  • allowed_schemes = [‘http’, ‘https’]

decode()

Decode the content field.

Currently supports these encodings:

  • base64

Returns:

The decoded content.

Return type:

str