Sha256: 5eb9ad1fe6f9e024e9342b8f92f75018e31c857e8e9f412e176a89a268023d4f

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

module DroneCI
  module ReposAPI
    # https://docs.drone.io/api/repos/repo_chown/
    def repo_chown(owner, repo)
      api.post("repos/#{owner}/#{repo}/chown")
    end

    # https://docs.drone.io/api/repos/repo_delete/
    def repo_delete(owner, repo)
      api.delete("repos/#{owner}/#{repo}")
    end

    alias repo_disable repo_delete

    # https://docs.drone.io/api/repos/repo_create/
    def repo_create(owner, _name)
      api.post("repos/#{owner}/#{repo}")
    end

    alias repo_enable repo_create

    # https://docs.drone.io/api/repos/repo_info/
    def repo_info(owner, repo)
      api.get("repos/#{owner}/#{repo}")
    end

    # https://docs.drone.io/api/repos/repo_list/
    # the docs are wrong, they say this is at api/user/repos, but the source code says...
    # https://github.com/harness/drone/blob/2d45d90cdd5cf2ec0e8dbcce2ea6bc340ce1e67e/handler/api/api.go#L173-L182
    def repo_list(_owner)
      api.get('repos')
    end

    # https://docs.drone.io/api/repos/repo_repair/
    def repo_repair(owner, repo)
      api.post("repos/#{owner}/#{repo}/repair")
    end

    # https://docs.drone.io/api/repos/repo_update/
    def repo_update(owner, repo, **body)
      api.patch("repos/#{owner}/#{repo}", body)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
drone-ci-0.1.0 lib/drone-ci/api/repos.rb