View Source Tentacat.Contents (Tentacat v2.5.0)

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

Link to this function

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

View Source
@spec create(Tentacat.Client.t(), binary(), binary(), binary(), 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

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
@spec 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

Link to this function

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

View Source
@spec 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

Link to this function

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

View Source
@spec remove(Tentacat.Client.t(), binary(), binary(), binary(), 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

Link to this function

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

View Source
@spec update(Tentacat.Client.t(), binary(), binary(), binary(), 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