Tentacat v2.2.0 Tentacat.Contents View Source

Link to this section Summary

Functions

Get the contents of a file or directory in a repository.

Get the contents of a file or directory in a repository for a provided reference

Get the contents of README.md.

Deletes a file in a repository

Link to this section Functions

Link to this function

create(client, owner, repo, path, body)

View Source

Create a file

Create body example:

%{
  "message" => "my commit message",
  "committer" => %{
    "name"  =>  "Grigory Starinkin",
    "email" =>  "starinkin@gmail.com"
  },
  "content" => "bXkgbmV3IGZpbGUgY29udGVudHM=",
  "branch"  => "cool-feature"
}

Example

Tentacat.Contents.create client, "elixir-lang", "elixir", "lib/elixir.ex", body

More info at: https://developer.github.com/v3/repos/contents/#create-a-file

Link to this function

find(client \\ %Client{}, owner, repo, path)

View Source

Get the contents of a file or directory in a repository.

Example

Tentacat.Contents.find "elixir-lang", "elixir", "lib"
Tentacat.Contents.find client, "elixir-lang", "elixir", "lib"

More info at: https://developer.github.com/v3/repos/contents/#get-contents

Link to this function

find_in(client \\ %Client{}, owner, repo, path, ref)

View Source

Get the contents of a file or directory in a repository for a provided reference

Example

Tentacat.Contents.find_in "elixir-lang", "elixir", "lib", "ref-name"
Tentacat.Contents.find_in client, "elixir-lang", "elixir", "lib", "ref-name"

More info at: https://developer.github.com/v3/repos/contents/#get-contents

Link to this function

readme(client \\ %Client{}, owner, repo)

View Source

Get the contents of README.md.

Example

Tentacat.Contents.readme "elixir-lang", "elixir"
Tentacat.Contents.readme client, "elixir-lang", "elixir"

More info at: https://developer.github.com/v3/repos/contents/#get-the-readme

Link to this function

remove(client, owner, repo, path, body)

View Source

Deletes a file in a repository

Delete body example:

%{
  "message" => "my commit message",
  "committer" => %{
    "name"  => "Grigory Starinkin",
    "email" => "starinkin@gmail.com"
  },
  "sha"    => "329688480d39049927147c162b9d2deaf885005f",
  "branch" => "cool-feature"
}

Example

Tentacat.Contents.remove client, "elixir-lang", "elixir", "lib/elixir.ex", body

More info at: https://developer.github.com/v3/repos/contents/#delete-a-file

Link to this function

update(client, owner, repo, path, body)

View Source

Update a file

Update body example:

%{
  "message" => "my commit message",
  "committer" => %{
    "name"  => "Grigory Starinkin",
    "email" => "starinkin@gmail.com"
  },
  "content" => "bXkgdXBkYXRlZCBmaWxlIGNvbnRlbnRz",
  "sha"     => "329688480d39049927147c162b9d2deaf885005f",
  "branch"  => "cool-feature"
}

Example

Tentacat.Contents.update client, "elixir-lang", "elixir", "lib/elixir.ex", body

More info at: https://developer.github.com/v3/repos/contents/#update-a-file