Tentacat v1.2.0 Tentacat.Contents

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

Functions

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

Specs

create(Tentacat.Client.t, binary, binary, binary, list | map) :: Tentacat.response

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

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

Specs

find(Tentacat.Client.t, binary, binary, binary) :: Tentacat.response

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

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

Specs

find_in(Tentacat.Client.t, binary, binary, binary, binary) :: Tentacat.response

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

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

Specs

readme(Tentacat.Client.t, binary, binary) :: Tentacat.response

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

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

Specs

remove(Tentacat.Client.t, binary, binary, binary, list | map) :: Tentacat.response

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

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

Specs

update(Tentacat.Client.t, binary, binary, binary, list | map) :: Tentacat.response

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