Tentacat v0.7.2 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

Deletes a file in a repository

Functions

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

Specs

create(binary, binary, binary, list | map, Tentacat.Client.t) :: 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 "elixir-lang", "elixir", "lib/elixir.ex", body, client

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

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

Specs

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

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

Example

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

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

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

Specs

find_in(binary, binary, binary, binary, Tentacat.Client.t) :: 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 "elixir-lang", "elixir", "lib", "ref-name", client

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

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

Specs

remove(binary, binary, binary, list | map, Tentacat.Client.t) :: 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 "elixir-lang", "elixir", "lib/elixir.ex", body, client

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

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

Specs

update(binary, binary, binary, list | map, Tentacat.Client.t) :: 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 "elixir-lang", "elixir", "lib/elixir.ex", body, client

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