# NOTE: This file is auto generated by OpenAPI Generator 7.22.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule Spatio.Api.Repo do
@moduledoc """
API calls for all endpoints tagged `Repo`.
"""
alias Spatio.Connection
import Spatio.RequestBuilder
@doc """
Create a branch (from a base sha).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_repo_branch(Tesla.Env.client, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_repo_branch(connection, owner, repo, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/repos/repositories/#{owner}/#{repo}/branches")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Open a pull request.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_repo_pull_request(Tesla.Env.client, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_repo_pull_request(connection, owner, repo, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/repos/repositories/#{owner}/#{repo}/pulls")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Create a repository.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_repo_repository(Tesla.Env.client, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_repo_repository(connection, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/repos/repositories")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Fetch a single commit.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `sha` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_repo_commit(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_repo_commit(connection, owner, repo, sha, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/repos/repositories/#{owner}/#{repo}/commits/#{sha}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Fetch a single repository.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_repo_repository(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_repo_repository(connection, owner, repo, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/repos/repositories/#{owner}/#{repo}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Link an existing Spatio task to this repo, allocating a per-repo number.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `link_repo_task_request` (LinkRepoTaskRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec link_repo_task(Tesla.Env.client, String.t, String.t, Spatio.Model.LinkRepoTaskRequest.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def link_repo_task(connection, owner, repo, link_repo_task_request, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/repos/repositories/#{owner}/#{repo}/tasks/link")
|> add_param(:body, :body, link_repo_task_request)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{201, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List branches on a repository.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_repo_branches(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_repo_branches(connection, owner, repo, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/repos/repositories/#{owner}/#{repo}/branches")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List commits on a repository.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
- `:branch` (String.t):
- `:limit` (integer()):
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_repo_commits(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_repo_commits(connection, owner, repo, opts \\ []) do
optional_params = %{
:branch => :query,
:limit => :query
}
request =
%{}
|> method(:get)
|> url("/v1/repos/repositories/#{owner}/#{repo}/commits")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List pull requests on a repository.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_repo_pull_requests(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_repo_pull_requests(connection, owner, repo, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/repos/repositories/#{owner}/#{repo}/pulls")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List the caller's accessible repositories.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:visibility` (String.t):
- `:limit` (integer()):
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_repo_repositories(Tesla.Env.client, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_repo_repositories(connection, opts \\ []) do
optional_params = %{
:visibility => :query,
:limit => :query
}
request =
%{}
|> method(:get)
|> url("/v1/repos/repositories")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List tasks linked to this repo (the \"issues\" surface).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
- `:state` (String.t):
- `:per_page` (integer()):
- `:page` (integer()):
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_repo_tasks(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_repo_tasks(connection, owner, repo, opts \\ []) do
optional_params = %{
:state => :query,
:per_page => :query,
:page => :query
}
request =
%{}
|> method(:get)
|> url("/v1/repos/repositories/#{owner}/#{repo}/tasks")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
List CI workflows.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_repo_workflows(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_repo_workflows(connection, owner, repo, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/repos/repositories/#{owner}/#{repo}/workflows")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Merge a pull request.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `number` (integer()):
- `opts` (keyword): Optional parameters
- `:body` (%{optional(String.t) => any()}):
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec merge_repo_pull_request(Tesla.Env.client, String.t, String.t, integer(), keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def merge_repo_pull_request(connection, owner, repo, number, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v1/repos/repositories/#{owner}/#{repo}/pulls/#{number}/merge")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Trigger a workflow_dispatch run.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `owner` (String.t):
- `repo` (String.t):
- `id` (String.t):
- `opts` (keyword): Optional parameters
- `:body` (%{optional(String.t) => any()}):
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec trigger_repo_workflow(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def trigger_repo_workflow(connection, owner, repo, id, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v1/repos/repositories/#{owner}/#{repo}/workflows/#{id}/trigger")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_create_repo_branch(Tesla.Env.client, String.t, String.t, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_create_repo_branch(connection, org, workspace, owner, repo, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/branches")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_create_repo_pull_request(Tesla.Env.client, String.t, String.t, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_create_repo_pull_request(connection, org, workspace, owner, repo, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/pulls")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_create_repo_repository(Tesla.Env.client, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_create_repo_repository(connection, org, workspace, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `sha` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_get_repo_commit(Tesla.Env.client, String.t, String.t, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_get_repo_commit(connection, org, workspace, owner, repo, sha, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/commits/#{sha}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_get_repo_repository(Tesla.Env.client, String.t, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_get_repo_repository(connection, org, workspace, owner, repo, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_link_repo_task(Tesla.Env.client, String.t, String.t, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_link_repo_task(connection, org, workspace, owner, repo, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/tasks/link")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{201, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_list_repo_branches(Tesla.Env.client, String.t, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_list_repo_branches(connection, org, workspace, owner, repo, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/branches")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_list_repo_commits(Tesla.Env.client, String.t, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_list_repo_commits(connection, org, workspace, owner, repo, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/commits")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_list_repo_pull_requests(Tesla.Env.client, String.t, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_list_repo_pull_requests(connection, org, workspace, owner, repo, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/pulls")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_list_repo_repositories(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_list_repo_repositories(connection, org, workspace, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_list_repo_tasks(Tesla.Env.client, String.t, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_list_repo_tasks(connection, org, workspace, owner, repo, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/tasks")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_list_repo_workflows(Tesla.Env.client, String.t, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_list_repo_workflows(connection, org, workspace, owner, repo, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/workflows")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `number` (integer()):
- `opts` (keyword): Optional parameters
- `:body` (%{optional(String.t) => any()}):
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_merge_repo_pull_request(Tesla.Env.client, String.t, String.t, String.t, String.t, integer(), keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_merge_repo_pull_request(connection, org, workspace, owner, repo, number, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/pulls/#{number}/merge")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `owner` (String.t):
- `repo` (String.t):
- `id` (String.t):
- `opts` (keyword): Optional parameters
- `:body` (%{optional(String.t) => any()}):
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_trigger_repo_workflow(Tesla.Env.client, String.t, String.t, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_trigger_repo_workflow(connection, org, workspace, owner, repo, id, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/repos/repositories/#{owner}/#{repo}/workflows/#{id}/trigger")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
end