git_store

Types

pub type GitHubConfig {
  GitHubConfig(
    owner: String,
    repo: String,
    token: String,
    base_url: String,
  )
}

Constructors

  • GitHubConfig(
      owner: String,
      repo: String,
      token: String,
      base_url: String,
    )

Values

pub fn create_file(
  config: GitHubConfig,
  filename: String,
  content: String,
) -> Result(@internal GitHubResponse, @internal GitStoreError)

Create a file from a file object on a GitHub repository at the given path https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents

pub fn delete_file(
  config: GitHubConfig,
  filename: String,
) -> Result(@internal GitHubResponse, @internal GitStoreError)

Get a file object from a GitHub repositiory and, if it exists, delete it https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#delete-a-file

pub fn empty_config() -> GitHubConfig

Create an empty GitHubConfig (for testing or manual construction)

pub fn get_file(
  config: GitHubConfig,
  path: String,
) -> Result(@internal GitHubResponse, @internal GitStoreError)

Get a file object from a GitHub repository at the given path Path should be a ‘/’ separated String, e.g: ‘foo/bar/baz’ https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#get-repository-content

pub fn new_config(
  owner: String,
  repo: String,
  token: String,
) -> GitHubConfig

Create a new GitHubConfig with default GitHub.com API base URL

pub fn new_enterprise_config(
  owner: String,
  repo: String,
  token: String,
  base_url: String,
) -> GitHubConfig

Create a new GitHubConfig for GitHub Enterprise with custom base URL

pub fn update_file(
  config: GitHubConfig,
  filename: String,
  content: String,
) -> Result(@internal GitHubResponse, @internal GitStoreError)

Get a file object from a GitHub repositiory and, if it exists, replace the content with the given content https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents

Search Document