/* Generated by restful-react */

import React from 'react'
import { Get, GetProps, useGet, UseGetProps, Mutate, MutateProps, useMutate, UseMutateProps } from 'restful-react'

import { getConfig } from '../config'
export const SPEC_VERSION = '1.0.0'
export type EnumAccessGrant = number

export type EnumMergeMethod = 'merge' | 'squash' | 'rebase'

export type EnumParentResourceType = 'space' | 'repo'

export type EnumPathTargetType = string

export type EnumPullReqActivityKind = 'system' | 'comment' | 'code'

export type EnumPullReqActivityType = 'comment' | 'code-comment' | 'title-change' | 'review-submit' | 'merge'

export type EnumPullReqReviewDecision = 'pending' | 'reviewed' | 'approved' | 'changereq'

export type EnumPullReqState = 'open' | 'merged' | 'closed' | 'rejected'

export type EnumTokenType = string

export type EnumWebhookExecutionResult = 'success' | 'retriable_error' | 'fatal_error' | null

export type EnumWebhookParent = 'repo' | 'space'

export type EnumWebhookTrigger =
  | 'branch_created'
  | 'branch_updated'
  | 'branch_deleted'
  | 'tag_created'
  | 'tag_updated'
  | 'tag_deleted'

export interface FormDataOpenapiLoginRequest {
  password?: string
  username?: string
}

export interface FormDataOpenapiRegisterRequest {
  password?: string
  username?: string
}

export type GitrpcFileAction = 'CREATE' | 'UPDATE' | 'DELETE' | 'MOVE'

export interface OpenapiCalculateCommitDivergenceRequest {
  max_count?: number
  requests?: RepoCommitDivergenceRequest[] | null
}

export interface OpenapiCommentCreatePullReqRequest {
  parent_id?: number
  payload?: { [key: string]: any } | null
  text?: string
}

export interface OpenapiCommentUpdatePullReqRequest {
  payload?: { [key: string]: any } | null
  text?: string
}

export interface OpenapiCommitFilesRequest {
  actions?: RepoCommitFileAction[] | null
  branch?: string
  message?: string
  new_branch?: string
  title?: string
}

export type OpenapiContent = RepoFileContent | OpenapiDirContent | RepoSymlinkContent | RepoSubmoduleContent

export interface OpenapiContentInfo {
  latest_commit?: RepoCommit
  name?: string
  path?: string
  sha?: string
  type?: OpenapiContentType
}

export type OpenapiContentType = 'file' | 'dir' | 'symlink' | 'submodule'

export interface OpenapiCreateBranchRequest {
  name?: string
  target?: string | null
}

export interface OpenapiCreatePathRequest {
  path?: string
}

export interface OpenapiCreatePullReqRequest {
  description?: string
  source_branch?: string
  source_repo_ref?: string
  target_branch?: string
  title?: string
}

export interface OpenapiCreateRepoPathRequest {
  path?: string
}

export interface OpenapiCreateRepositoryRequest {
  default_branch?: string
  description?: string
  fork_id?: number
  git_ignore?: string
  is_public?: boolean
  license?: string
  parent_id?: number
  readme?: boolean
  uid?: string
}

export interface OpenapiCreateSpaceRequest {
  description?: string
  is_public?: boolean
  parent_id?: number
  uid?: string
}

export interface OpenapiCreateWebhookRequest {
  description?: string
  display_name?: string
  enabled?: boolean
  insecure?: boolean
  secret?: string
  triggers?: EnumWebhookTrigger[] | null
  url?: string
}

export interface OpenapiDirContent {
  entries?: OpenapiContentInfo[] | null
}

export interface OpenapiGetContentOutput {
  content?: OpenapiContent
  latest_commit?: RepoCommit
  name?: string
  path?: string
  sha?: string
  type?: OpenapiContentType
}

export interface OpenapiMergePullReq {
  delete_branch?: boolean
  force?: boolean
  method?: EnumMergeMethod
}

export interface OpenapiMoveRepoRequest {
  keep_as_alias?: boolean
  parent_id?: number | null
  uid?: string | null
}

export interface OpenapiMoveSpaceRequest {
  keep_as_alias?: boolean
  parent_id?: number | null
  uid?: string | null
}

export interface OpenapiReviewSubmitPullReqRequest {
  decision?: EnumPullReqReviewDecision
  message?: string
}

export interface OpenapiReviewerAddPullReqRequest {
  reviewer_id?: number
}

export interface OpenapiUpdatePullReqRequest {
  description?: string
  title?: string
}

export interface OpenapiUpdateRepoRequest {
  description?: string | null
  is_public?: boolean | null
}

export interface OpenapiUpdateSpaceRequest {
  description?: string | null
  is_public?: boolean | null
}

export interface OpenapiUpdateWebhookRequest {
  description?: string | null
  display_name?: string | null
  enabled?: boolean | null
  insecure?: boolean | null
  secret?: string | null
  triggers?: EnumWebhookTrigger[] | null
  url?: string | null
}

export interface OpenapiWebhookType {
  created?: number
  created_by?: number
  description?: string
  display_name?: string
  enabled?: boolean
  has_secret?: boolean
  id?: number
  insecure?: boolean
  latest_execution_result?: EnumWebhookExecutionResult
  parent_id?: number
  parent_type?: EnumWebhookParent
  triggers?: EnumWebhookTrigger[] | null
  updated?: number
  url?: string
  version?: number
}

export interface RepoBranch {
  commit?: RepoCommit
  name?: string
  sha?: string
}

export interface RepoCommit {
  author?: RepoSignature
  committer?: RepoSignature
  message?: string
  sha?: string
  title?: string
}

export interface RepoCommitDivergence {
  ahead?: number
  behind?: number
}

export interface RepoCommitDivergenceRequest {
  from?: string
  to?: string
}

export interface RepoCommitFileAction {
  action?: GitrpcFileAction
  encoding?: string
  path?: string
  payload?: string
  sha?: string
}

export interface RepoCommitFilesResponse {
  commit_id?: string
}

export interface RepoCommitTag {
  commit?: RepoCommit
  is_annotated?: boolean
  message?: string
  name?: string
  sha?: string
  tagger?: RepoSignature
  title?: string
}

// tslint:disable-next-line:no-empty-interface
export interface RepoContent {}

export interface RepoContentInfo {
  latest_commit?: RepoCommit
  name?: string
  path?: string
  sha?: string
  type?: RepoContentType
}

export type RepoContentType = string

export interface RepoFileContent {
  data?: string
  encoding?: RepoFileEncodingType
  size?: number
}

export type RepoFileEncodingType = string

export interface RepoIdentity {
  email?: string
  name?: string
}

export interface RepoSignature {
  identity?: RepoIdentity
  when?: string
}

export interface RepoSubmoduleContent {
  commit_sha?: string
  url?: string
}

export interface RepoSymlinkContent {
  size?: number
  target?: string
}

export interface TypesPath {
  created?: number
  created_by?: number
  id?: number
  is_alias?: boolean
  target_id?: number
  target_type?: EnumPathTargetType
  updated?: number
  value?: string
}

export type TypesPrincipalInfo = {
  display_name?: string
  email?: string
  id?: number
  uid?: string
} | null

export interface TypesPullReq {
  author?: TypesPrincipalInfo
  created?: number
  description?: string
  edited?: number
  merge_strategy?: EnumMergeMethod
  merged?: number | null
  merger?: TypesPrincipalInfo
  number?: number
  source_branch?: string
  source_repo_id?: number
  state?: EnumPullReqState
  target_branch?: string
  target_repo_id?: number
  title?: string
}

export interface TypesPullReqActivity {
  author?: TypesPrincipalInfo
  created?: number
  deleted?: number | null
  edited?: number
  id?: number
  kind?: EnumPullReqActivityKind
  metadata?: { [key: string]: any } | null
  order?: number
  parent_id?: number | null
  payload?: { [key: string]: any } | null
  pullreq_id?: number
  repo_id?: number
  resolved?: number | null
  resolver?: TypesPrincipalInfo
  sub_order?: number
  text?: string
  type?: EnumPullReqActivityType
}

export interface TypesRepository {
  created?: number
  created_by?: number
  default_branch?: string
  description?: string
  fork_id?: number
  git_url?: string
  id?: number
  is_public?: boolean
  num_closed_pulls?: number
  num_forks?: number
  num_open_pulls?: number
  num_pulls?: number
  parent_id?: number
  path?: string
  uid?: string
  updated?: number
  version?: number
}

export interface TypesServiceAccount {
  admin?: boolean
  blocked?: boolean
  created?: number
  display_name?: string
  email?: string
  parent_id?: number
  parent_type?: EnumParentResourceType
  uid?: string
  updated?: number
}

export interface TypesSpace {
  created?: number
  created_by?: number
  description?: string
  id?: number
  is_public?: boolean
  parent_id?: number
  path?: string
  uid?: string
  updated?: number
}

export interface TypesToken {
  created_by?: number
  expires_at?: number
  grants?: EnumAccessGrant
  issued_at?: number
  principal_id?: number
  type?: EnumTokenType
  uid?: string
}

export interface TypesTokenResponse {
  access_token?: string
  token?: TypesToken
}

export interface TypesUser {
  admin?: boolean
  blocked?: boolean
  created?: number
  display_name?: string
  email?: string
  uid?: string
  updated?: number
}

export interface TypesUserInput {
  admin?: boolean | null
  email?: string | null
  name?: string | null
  password?: string | null
}

export interface TypesWebhookExecution {
  created?: number
  duration?: number
  error?: string
  id?: number
  request?: TypesWebhookExecutionRequest
  response?: TypesWebhookExecutionResponse
  result?: EnumWebhookExecutionResult
  retrigger_of?: number | null
  retriggerable?: boolean
  trigger_type?: EnumWebhookTrigger
  webhook_id?: number
}

export interface TypesWebhookExecutionRequest {
  body?: string
  headers?: string
  url?: string
}

export interface TypesWebhookExecutionResponse {
  body?: string
  headers?: string
  status?: string
  status_code?: number
}

export interface UserUpdateInput {
  display_name?: string | null
  email?: string | null
  password?: string | null
}

export interface UsererrorError {
  message?: string
}

export type OnLoginProps = Omit<MutateProps<TypesTokenResponse, UsererrorError, void, void, void>, 'path' | 'verb'>

export const OnLogin = (props: OnLoginProps) => (
  <Mutate<TypesTokenResponse, UsererrorError, void, void, void>
    verb="POST"
    path={`/login`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseOnLoginProps = Omit<
  UseMutateProps<TypesTokenResponse, UsererrorError, void, void, void>,
  'path' | 'verb'
>

export const useOnLogin = (props: UseOnLoginProps) =>
  useMutate<TypesTokenResponse, UsererrorError, void, void, void>('POST', `/login`, {
    base: getConfig('code'),
    ...props
  })

export type OnRegisterProps = Omit<MutateProps<TypesTokenResponse, UsererrorError, void, void, void>, 'path' | 'verb'>

export const OnRegister = (props: OnRegisterProps) => (
  <Mutate<TypesTokenResponse, UsererrorError, void, void, void>
    verb="POST"
    path={`/register`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseOnRegisterProps = Omit<
  UseMutateProps<TypesTokenResponse, UsererrorError, void, void, void>,
  'path' | 'verb'
>

export const useOnRegister = (props: UseOnRegisterProps) =>
  useMutate<TypesTokenResponse, UsererrorError, void, void, void>('POST', `/register`, {
    base: getConfig('code'),
    ...props
  })

export interface CreateRepositoryQueryParams {
  /**
   * path of parent space (Not needed in standalone).
   */
  space_path?: string
}

export type CreateRepositoryProps = Omit<
  MutateProps<TypesRepository, UsererrorError, CreateRepositoryQueryParams, OpenapiCreateRepositoryRequest, void>,
  'path' | 'verb'
>

export const CreateRepository = (props: CreateRepositoryProps) => (
  <Mutate<TypesRepository, UsererrorError, CreateRepositoryQueryParams, OpenapiCreateRepositoryRequest, void>
    verb="POST"
    path={`/repos`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCreateRepositoryProps = Omit<
  UseMutateProps<TypesRepository, UsererrorError, CreateRepositoryQueryParams, OpenapiCreateRepositoryRequest, void>,
  'path' | 'verb'
>

export const useCreateRepository = (props: UseCreateRepositoryProps) =>
  useMutate<TypesRepository, UsererrorError, CreateRepositoryQueryParams, OpenapiCreateRepositoryRequest, void>(
    'POST',
    `/repos`,
    { base: getConfig('code'), ...props }
  )

export type DeleteRepositoryProps = Omit<MutateProps<void, UsererrorError, void, string, void>, 'path' | 'verb'>

export const DeleteRepository = (props: DeleteRepositoryProps) => (
  <Mutate<void, UsererrorError, void, string, void> verb="DELETE" path={`/repos`} base={getConfig('code')} {...props} />
)

export type UseDeleteRepositoryProps = Omit<UseMutateProps<void, UsererrorError, void, string, void>, 'path' | 'verb'>

export const useDeleteRepository = (props: UseDeleteRepositoryProps) =>
  useMutate<void, UsererrorError, void, string, void>('DELETE', `/repos`, { base: getConfig('code'), ...props })

export interface FindRepositoryPathParams {
  repo_ref: string
}

export type FindRepositoryProps = Omit<
  GetProps<TypesRepository, UsererrorError, void, FindRepositoryPathParams>,
  'path'
> &
  FindRepositoryPathParams

export const FindRepository = ({ repo_ref, ...props }: FindRepositoryProps) => (
  <Get<TypesRepository, UsererrorError, void, FindRepositoryPathParams>
    path={`/repos/${repo_ref}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseFindRepositoryProps = Omit<
  UseGetProps<TypesRepository, UsererrorError, void, FindRepositoryPathParams>,
  'path'
> &
  FindRepositoryPathParams

export const useFindRepository = ({ repo_ref, ...props }: UseFindRepositoryProps) =>
  useGet<TypesRepository, UsererrorError, void, FindRepositoryPathParams>(
    (paramsInPath: FindRepositoryPathParams) => `/repos/${paramsInPath.repo_ref}`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface UpdateRepositoryPathParams {
  repo_ref: string
}

export type UpdateRepositoryProps = Omit<
  MutateProps<TypesRepository, UsererrorError, void, OpenapiUpdateRepoRequest, UpdateRepositoryPathParams>,
  'path' | 'verb'
> &
  UpdateRepositoryPathParams

export const UpdateRepository = ({ repo_ref, ...props }: UpdateRepositoryProps) => (
  <Mutate<TypesRepository, UsererrorError, void, OpenapiUpdateRepoRequest, UpdateRepositoryPathParams>
    verb="PATCH"
    path={`/repos/${repo_ref}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseUpdateRepositoryProps = Omit<
  UseMutateProps<TypesRepository, UsererrorError, void, OpenapiUpdateRepoRequest, UpdateRepositoryPathParams>,
  'path' | 'verb'
> &
  UpdateRepositoryPathParams

export const useUpdateRepository = ({ repo_ref, ...props }: UseUpdateRepositoryProps) =>
  useMutate<TypesRepository, UsererrorError, void, OpenapiUpdateRepoRequest, UpdateRepositoryPathParams>(
    'PATCH',
    (paramsInPath: UpdateRepositoryPathParams) => `/repos/${paramsInPath.repo_ref}`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface ListBranchesQueryParams {
  /**
   * Indicates whether optional commit information should be included in the response.
   */
  include_commit?: boolean
  /**
   * The substring by which the branches are filtered.
   */
  query?: string
  /**
   * The order of the output.
   */
  order?: 'asc' | 'desc'
  /**
   * The data by which the branches are sorted.
   */
  sort?: 'name' | 'date'
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListBranchesPathParams {
  repo_ref: string
}

export type ListBranchesProps = Omit<
  GetProps<RepoBranch[], UsererrorError, ListBranchesQueryParams, ListBranchesPathParams>,
  'path'
> &
  ListBranchesPathParams

export const ListBranches = ({ repo_ref, ...props }: ListBranchesProps) => (
  <Get<RepoBranch[], UsererrorError, ListBranchesQueryParams, ListBranchesPathParams>
    path={`/repos/${repo_ref}/branches`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListBranchesProps = Omit<
  UseGetProps<RepoBranch[], UsererrorError, ListBranchesQueryParams, ListBranchesPathParams>,
  'path'
> &
  ListBranchesPathParams

export const useListBranches = ({ repo_ref, ...props }: UseListBranchesProps) =>
  useGet<RepoBranch[], UsererrorError, ListBranchesQueryParams, ListBranchesPathParams>(
    (paramsInPath: ListBranchesPathParams) => `/repos/${paramsInPath.repo_ref}/branches`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface CreateBranchPathParams {
  repo_ref: string
}

export type CreateBranchProps = Omit<
  MutateProps<RepoBranch, UsererrorError, void, OpenapiCreateBranchRequest, CreateBranchPathParams>,
  'path' | 'verb'
> &
  CreateBranchPathParams

export const CreateBranch = ({ repo_ref, ...props }: CreateBranchProps) => (
  <Mutate<RepoBranch, UsererrorError, void, OpenapiCreateBranchRequest, CreateBranchPathParams>
    verb="POST"
    path={`/repos/${repo_ref}/branches`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCreateBranchProps = Omit<
  UseMutateProps<RepoBranch, UsererrorError, void, OpenapiCreateBranchRequest, CreateBranchPathParams>,
  'path' | 'verb'
> &
  CreateBranchPathParams

export const useCreateBranch = ({ repo_ref, ...props }: UseCreateBranchProps) =>
  useMutate<RepoBranch, UsererrorError, void, OpenapiCreateBranchRequest, CreateBranchPathParams>(
    'POST',
    (paramsInPath: CreateBranchPathParams) => `/repos/${paramsInPath.repo_ref}/branches`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface DeleteBranchPathParams {
  repo_ref: string
}

export type DeleteBranchProps = Omit<
  MutateProps<void, UsererrorError, void, string, DeleteBranchPathParams>,
  'path' | 'verb'
> &
  DeleteBranchPathParams

export const DeleteBranch = ({ repo_ref, ...props }: DeleteBranchProps) => (
  <Mutate<void, UsererrorError, void, string, DeleteBranchPathParams>
    verb="DELETE"
    path={`/repos/${repo_ref}/branches`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseDeleteBranchProps = Omit<
  UseMutateProps<void, UsererrorError, void, string, DeleteBranchPathParams>,
  'path' | 'verb'
> &
  DeleteBranchPathParams

export const useDeleteBranch = ({ repo_ref, ...props }: UseDeleteBranchProps) =>
  useMutate<void, UsererrorError, void, string, DeleteBranchPathParams>(
    'DELETE',
    (paramsInPath: DeleteBranchPathParams) => `/repos/${paramsInPath.repo_ref}/branches`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface ListCommitsQueryParams {
  /**
   * The git reference (branch / tag / commitID) that will be used to retrieve the data. If no value is provided the default branch of the repository is used.
   */
  git_ref?: string
  /**
   * The result should only contain commits that occurred after the provided reference.
   */
  after?: string
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListCommitsPathParams {
  repo_ref: string
}

export type ListCommitsProps = Omit<
  GetProps<RepoCommit[], UsererrorError, ListCommitsQueryParams, ListCommitsPathParams>,
  'path'
> &
  ListCommitsPathParams

export const ListCommits = ({ repo_ref, ...props }: ListCommitsProps) => (
  <Get<RepoCommit[], UsererrorError, ListCommitsQueryParams, ListCommitsPathParams>
    path={`/repos/${repo_ref}/commits`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListCommitsProps = Omit<
  UseGetProps<RepoCommit[], UsererrorError, ListCommitsQueryParams, ListCommitsPathParams>,
  'path'
> &
  ListCommitsPathParams

export const useListCommits = ({ repo_ref, ...props }: UseListCommitsProps) =>
  useGet<RepoCommit[], UsererrorError, ListCommitsQueryParams, ListCommitsPathParams>(
    (paramsInPath: ListCommitsPathParams) => `/repos/${paramsInPath.repo_ref}/commits`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface CommitFilesPathParams {
  repo_ref: string
}

export type CommitFilesProps = Omit<
  MutateProps<RepoCommitFilesResponse, UsererrorError, void, OpenapiCommitFilesRequest, CommitFilesPathParams>,
  'path' | 'verb'
> &
  CommitFilesPathParams

export const CommitFiles = ({ repo_ref, ...props }: CommitFilesProps) => (
  <Mutate<RepoCommitFilesResponse, UsererrorError, void, OpenapiCommitFilesRequest, CommitFilesPathParams>
    verb="POST"
    path={`/repos/${repo_ref}/commits`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCommitFilesProps = Omit<
  UseMutateProps<RepoCommitFilesResponse, UsererrorError, void, OpenapiCommitFilesRequest, CommitFilesPathParams>,
  'path' | 'verb'
> &
  CommitFilesPathParams

export const useCommitFiles = ({ repo_ref, ...props }: UseCommitFilesProps) =>
  useMutate<RepoCommitFilesResponse, UsererrorError, void, OpenapiCommitFilesRequest, CommitFilesPathParams>(
    'POST',
    (paramsInPath: CommitFilesPathParams) => `/repos/${paramsInPath.repo_ref}/commits`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface CalculateCommitDivergencePathParams {
  repo_ref: string
}

export type CalculateCommitDivergenceProps = Omit<
  MutateProps<
    RepoCommitDivergence[],
    UsererrorError,
    void,
    OpenapiCalculateCommitDivergenceRequest,
    CalculateCommitDivergencePathParams
  >,
  'path' | 'verb'
> &
  CalculateCommitDivergencePathParams

export const CalculateCommitDivergence = ({ repo_ref, ...props }: CalculateCommitDivergenceProps) => (
  <Mutate<
    RepoCommitDivergence[],
    UsererrorError,
    void,
    OpenapiCalculateCommitDivergenceRequest,
    CalculateCommitDivergencePathParams
  >
    verb="POST"
    path={`/repos/${repo_ref}/commits/calculate-divergence`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCalculateCommitDivergenceProps = Omit<
  UseMutateProps<
    RepoCommitDivergence[],
    UsererrorError,
    void,
    OpenapiCalculateCommitDivergenceRequest,
    CalculateCommitDivergencePathParams
  >,
  'path' | 'verb'
> &
  CalculateCommitDivergencePathParams

export const useCalculateCommitDivergence = ({ repo_ref, ...props }: UseCalculateCommitDivergenceProps) =>
  useMutate<
    RepoCommitDivergence[],
    UsererrorError,
    void,
    OpenapiCalculateCommitDivergenceRequest,
    CalculateCommitDivergencePathParams
  >(
    'POST',
    (paramsInPath: CalculateCommitDivergencePathParams) =>
      `/repos/${paramsInPath.repo_ref}/commits/calculate-divergence`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface RawDiffPathParams {
  repo_ref: string
  range: string
}

export type RawDiffProps = Omit<GetProps<void, UsererrorError, void, RawDiffPathParams>, 'path'> & RawDiffPathParams

export const RawDiff = ({ repo_ref, range, ...props }: RawDiffProps) => (
  <Get<void, UsererrorError, void, RawDiffPathParams>
    path={`/repos/${repo_ref}/compare/${range}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseRawDiffProps = Omit<UseGetProps<void, UsererrorError, void, RawDiffPathParams>, 'path'> &
  RawDiffPathParams

export const useRawDiff = ({ repo_ref, range, ...props }: UseRawDiffProps) =>
  useGet<void, UsererrorError, void, RawDiffPathParams>(
    (paramsInPath: RawDiffPathParams) => `/repos/${paramsInPath.repo_ref}/compare/${paramsInPath.range}`,
    { base: getConfig('code'), pathParams: { repo_ref, range }, ...props }
  )

export interface GetContentQueryParams {
  /**
   * The git reference (branch / tag / commitID) that will be used to retrieve the data. If no value is provided the default branch of the repository is used.
   */
  git_ref?: string
  /**
   * Indicates whether optional commit information should be included in the response.
   */
  include_commit?: boolean
}

export interface GetContentPathParams {
  repo_ref: string
  path: string
}

export type GetContentProps = Omit<
  GetProps<OpenapiGetContentOutput, UsererrorError, GetContentQueryParams, GetContentPathParams>,
  'path'
> &
  GetContentPathParams

export const GetContent = ({ repo_ref, path, ...props }: GetContentProps) => (
  <Get<OpenapiGetContentOutput, UsererrorError, GetContentQueryParams, GetContentPathParams>
    path={`/repos/${repo_ref}/content/${path}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseGetContentProps = Omit<
  UseGetProps<OpenapiGetContentOutput, UsererrorError, GetContentQueryParams, GetContentPathParams>,
  'path'
> &
  GetContentPathParams

export const useGetContent = ({ repo_ref, path, ...props }: UseGetContentProps) =>
  useGet<OpenapiGetContentOutput, UsererrorError, GetContentQueryParams, GetContentPathParams>(
    (paramsInPath: GetContentPathParams) => `/repos/${paramsInPath.repo_ref}/content/${paramsInPath.path}`,
    { base: getConfig('code'), pathParams: { repo_ref, path }, ...props }
  )

export interface MoveRepositoryPathParams {
  repo_ref: string
}

export type MoveRepositoryProps = Omit<
  MutateProps<TypesRepository, UsererrorError, void, OpenapiMoveRepoRequest, MoveRepositoryPathParams>,
  'path' | 'verb'
> &
  MoveRepositoryPathParams

export const MoveRepository = ({ repo_ref, ...props }: MoveRepositoryProps) => (
  <Mutate<TypesRepository, UsererrorError, void, OpenapiMoveRepoRequest, MoveRepositoryPathParams>
    verb="POST"
    path={`/repos/${repo_ref}/move`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseMoveRepositoryProps = Omit<
  UseMutateProps<TypesRepository, UsererrorError, void, OpenapiMoveRepoRequest, MoveRepositoryPathParams>,
  'path' | 'verb'
> &
  MoveRepositoryPathParams

export const useMoveRepository = ({ repo_ref, ...props }: UseMoveRepositoryProps) =>
  useMutate<TypesRepository, UsererrorError, void, OpenapiMoveRepoRequest, MoveRepositoryPathParams>(
    'POST',
    (paramsInPath: MoveRepositoryPathParams) => `/repos/${paramsInPath.repo_ref}/move`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface ListRepositoryPathsQueryParams {
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListRepositoryPathsPathParams {
  repo_ref: string
}

export type ListRepositoryPathsProps = Omit<
  GetProps<TypesPath[], UsererrorError, ListRepositoryPathsQueryParams, ListRepositoryPathsPathParams>,
  'path'
> &
  ListRepositoryPathsPathParams

export const ListRepositoryPaths = ({ repo_ref, ...props }: ListRepositoryPathsProps) => (
  <Get<TypesPath[], UsererrorError, ListRepositoryPathsQueryParams, ListRepositoryPathsPathParams>
    path={`/repos/${repo_ref}/paths`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListRepositoryPathsProps = Omit<
  UseGetProps<TypesPath[], UsererrorError, ListRepositoryPathsQueryParams, ListRepositoryPathsPathParams>,
  'path'
> &
  ListRepositoryPathsPathParams

export const useListRepositoryPaths = ({ repo_ref, ...props }: UseListRepositoryPathsProps) =>
  useGet<TypesPath[], UsererrorError, ListRepositoryPathsQueryParams, ListRepositoryPathsPathParams>(
    (paramsInPath: ListRepositoryPathsPathParams) => `/repos/${paramsInPath.repo_ref}/paths`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface CreateRepositoryPathPathParams {
  repo_ref: string
}

export type CreateRepositoryPathProps = Omit<
  MutateProps<TypesPath, UsererrorError, void, OpenapiCreateRepoPathRequest, CreateRepositoryPathPathParams>,
  'path' | 'verb'
> &
  CreateRepositoryPathPathParams

export const CreateRepositoryPath = ({ repo_ref, ...props }: CreateRepositoryPathProps) => (
  <Mutate<TypesPath, UsererrorError, void, OpenapiCreateRepoPathRequest, CreateRepositoryPathPathParams>
    verb="POST"
    path={`/repos/${repo_ref}/paths`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCreateRepositoryPathProps = Omit<
  UseMutateProps<TypesPath, UsererrorError, void, OpenapiCreateRepoPathRequest, CreateRepositoryPathPathParams>,
  'path' | 'verb'
> &
  CreateRepositoryPathPathParams

export const useCreateRepositoryPath = ({ repo_ref, ...props }: UseCreateRepositoryPathProps) =>
  useMutate<TypesPath, UsererrorError, void, OpenapiCreateRepoPathRequest, CreateRepositoryPathPathParams>(
    'POST',
    (paramsInPath: CreateRepositoryPathPathParams) => `/repos/${paramsInPath.repo_ref}/paths`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface DeleteRepositoryPathPathParams {
  repo_ref: string
}

export type DeleteRepositoryPathProps = Omit<
  MutateProps<void, UsererrorError, void, string, DeleteRepositoryPathPathParams>,
  'path' | 'verb'
> &
  DeleteRepositoryPathPathParams

export const DeleteRepositoryPath = ({ repo_ref, ...props }: DeleteRepositoryPathProps) => (
  <Mutate<void, UsererrorError, void, string, DeleteRepositoryPathPathParams>
    verb="DELETE"
    path={`/repos/${repo_ref}/paths`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseDeleteRepositoryPathProps = Omit<
  UseMutateProps<void, UsererrorError, void, string, DeleteRepositoryPathPathParams>,
  'path' | 'verb'
> &
  DeleteRepositoryPathPathParams

export const useDeleteRepositoryPath = ({ repo_ref, ...props }: UseDeleteRepositoryPathProps) =>
  useMutate<void, UsererrorError, void, string, DeleteRepositoryPathPathParams>(
    'DELETE',
    (paramsInPath: DeleteRepositoryPathPathParams) => `/repos/${paramsInPath.repo_ref}/paths`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface ListPullReqQueryParams {
  /**
   * The state of the pull requests to include in the result.
   */
  state?: ('open' | 'merged' | 'closed' | 'rejected')[]
  /**
   * Source repository ref of the pull requests.
   */
  source_repo_ref?: string
  /**
   * Source branch of the pull requests.
   */
  source_branch?: string
  /**
   * Target branch of the pull requests.
   */
  target_branch?: string
  /**
   * The substring by which the pull requests are filtered.
   */
  query?: string
  /**
   * The principal ID who created pull requests.
   */
  created_by?: number
  /**
   * The order of the output.
   */
  order?: 'asc' | 'desc'
  /**
   * The data by which the pull requests are sorted.
   */
  sort?: 'number' | 'created' | 'edited'
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListPullReqPathParams {
  repo_ref: string
}

export type ListPullReqProps = Omit<
  GetProps<TypesPullReq[], UsererrorError, ListPullReqQueryParams, ListPullReqPathParams>,
  'path'
> &
  ListPullReqPathParams

export const ListPullReq = ({ repo_ref, ...props }: ListPullReqProps) => (
  <Get<TypesPullReq[], UsererrorError, ListPullReqQueryParams, ListPullReqPathParams>
    path={`/repos/${repo_ref}/pullreq`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListPullReqProps = Omit<
  UseGetProps<TypesPullReq[], UsererrorError, ListPullReqQueryParams, ListPullReqPathParams>,
  'path'
> &
  ListPullReqPathParams

export const useListPullReq = ({ repo_ref, ...props }: UseListPullReqProps) =>
  useGet<TypesPullReq[], UsererrorError, ListPullReqQueryParams, ListPullReqPathParams>(
    (paramsInPath: ListPullReqPathParams) => `/repos/${paramsInPath.repo_ref}/pullreq`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface CreatePullReqPathParams {
  repo_ref: string
}

export type CreatePullReqProps = Omit<
  MutateProps<TypesPullReq, UsererrorError, void, OpenapiCreatePullReqRequest, CreatePullReqPathParams>,
  'path' | 'verb'
> &
  CreatePullReqPathParams

export const CreatePullReq = ({ repo_ref, ...props }: CreatePullReqProps) => (
  <Mutate<TypesPullReq, UsererrorError, void, OpenapiCreatePullReqRequest, CreatePullReqPathParams>
    verb="POST"
    path={`/repos/${repo_ref}/pullreq`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCreatePullReqProps = Omit<
  UseMutateProps<TypesPullReq, UsererrorError, void, OpenapiCreatePullReqRequest, CreatePullReqPathParams>,
  'path' | 'verb'
> &
  CreatePullReqPathParams

export const useCreatePullReq = ({ repo_ref, ...props }: UseCreatePullReqProps) =>
  useMutate<TypesPullReq, UsererrorError, void, OpenapiCreatePullReqRequest, CreatePullReqPathParams>(
    'POST',
    (paramsInPath: CreatePullReqPathParams) => `/repos/${paramsInPath.repo_ref}/pullreq`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface GetPullReqPathParams {
  repo_ref: string
  pullreq_number: number
}

export type GetPullReqProps = Omit<GetProps<TypesPullReq, UsererrorError, void, GetPullReqPathParams>, 'path'> &
  GetPullReqPathParams

export const GetPullReq = ({ repo_ref, pullreq_number, ...props }: GetPullReqProps) => (
  <Get<TypesPullReq, UsererrorError, void, GetPullReqPathParams>
    path={`/repos/${repo_ref}/pullreq/${pullreq_number}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseGetPullReqProps = Omit<UseGetProps<TypesPullReq, UsererrorError, void, GetPullReqPathParams>, 'path'> &
  GetPullReqPathParams

export const useGetPullReq = ({ repo_ref, pullreq_number, ...props }: UseGetPullReqProps) =>
  useGet<TypesPullReq, UsererrorError, void, GetPullReqPathParams>(
    (paramsInPath: GetPullReqPathParams) => `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}`,
    { base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
  )

export interface UpdatePullReqPathParams {
  repo_ref: string
  pullreq_number: number
}

export type UpdatePullReqProps = Omit<
  MutateProps<TypesPullReq, UsererrorError, void, OpenapiUpdatePullReqRequest, UpdatePullReqPathParams>,
  'path' | 'verb'
> &
  UpdatePullReqPathParams

export const UpdatePullReq = ({ repo_ref, pullreq_number, ...props }: UpdatePullReqProps) => (
  <Mutate<TypesPullReq, UsererrorError, void, OpenapiUpdatePullReqRequest, UpdatePullReqPathParams>
    verb="PATCH"
    path={`/repos/${repo_ref}/pullreq/${pullreq_number}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseUpdatePullReqProps = Omit<
  UseMutateProps<TypesPullReq, UsererrorError, void, OpenapiUpdatePullReqRequest, UpdatePullReqPathParams>,
  'path' | 'verb'
> &
  UpdatePullReqPathParams

export const useUpdatePullReq = ({ repo_ref, pullreq_number, ...props }: UseUpdatePullReqProps) =>
  useMutate<TypesPullReq, UsererrorError, void, OpenapiUpdatePullReqRequest, UpdatePullReqPathParams>(
    'PATCH',
    (paramsInPath: UpdatePullReqPathParams) => `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}`,
    { base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
  )

export interface ListPullReqActivitiesQueryParams {
  /**
   * The kind of the pull request activity to include in the result.
   */
  kind?: ('system' | 'comment' | 'code')[]
  /**
   * The type of the pull request activity to include in the result.
   */
  type?: ('comment' | 'code-comment' | 'title-change' | 'review-submit' | 'merge')[]
  /**
   * The result should contain only entries created at and after this timestamp (unix millis).
   */
  after?: number
  /**
   * The result should contain only entries created before this timestamp (unix millis).
   */
  before?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListPullReqActivitiesPathParams {
  repo_ref: string
  pullreq_number: number
}

export type ListPullReqActivitiesProps = Omit<
  GetProps<TypesPullReqActivity[], UsererrorError, ListPullReqActivitiesQueryParams, ListPullReqActivitiesPathParams>,
  'path'
> &
  ListPullReqActivitiesPathParams

export const ListPullReqActivities = ({ repo_ref, pullreq_number, ...props }: ListPullReqActivitiesProps) => (
  <Get<TypesPullReqActivity[], UsererrorError, ListPullReqActivitiesQueryParams, ListPullReqActivitiesPathParams>
    path={`/repos/${repo_ref}/pullreq/${pullreq_number}/activities`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListPullReqActivitiesProps = Omit<
  UseGetProps<
    TypesPullReqActivity[],
    UsererrorError,
    ListPullReqActivitiesQueryParams,
    ListPullReqActivitiesPathParams
  >,
  'path'
> &
  ListPullReqActivitiesPathParams

export const useListPullReqActivities = ({ repo_ref, pullreq_number, ...props }: UseListPullReqActivitiesProps) =>
  useGet<TypesPullReqActivity[], UsererrorError, ListPullReqActivitiesQueryParams, ListPullReqActivitiesPathParams>(
    (paramsInPath: ListPullReqActivitiesPathParams) =>
      `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/activities`,
    { base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
  )

export interface CommentCreatePullReqPathParams {
  repo_ref: string
  pullreq_number: number
}

export type CommentCreatePullReqProps = Omit<
  MutateProps<
    TypesPullReqActivity,
    UsererrorError,
    void,
    OpenapiCommentCreatePullReqRequest,
    CommentCreatePullReqPathParams
  >,
  'path' | 'verb'
> &
  CommentCreatePullReqPathParams

export const CommentCreatePullReq = ({ repo_ref, pullreq_number, ...props }: CommentCreatePullReqProps) => (
  <Mutate<
    TypesPullReqActivity,
    UsererrorError,
    void,
    OpenapiCommentCreatePullReqRequest,
    CommentCreatePullReqPathParams
  >
    verb="POST"
    path={`/repos/${repo_ref}/pullreq/${pullreq_number}/comments`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCommentCreatePullReqProps = Omit<
  UseMutateProps<
    TypesPullReqActivity,
    UsererrorError,
    void,
    OpenapiCommentCreatePullReqRequest,
    CommentCreatePullReqPathParams
  >,
  'path' | 'verb'
> &
  CommentCreatePullReqPathParams

export const useCommentCreatePullReq = ({ repo_ref, pullreq_number, ...props }: UseCommentCreatePullReqProps) =>
  useMutate<
    TypesPullReqActivity,
    UsererrorError,
    void,
    OpenapiCommentCreatePullReqRequest,
    CommentCreatePullReqPathParams
  >(
    'POST',
    (paramsInPath: CommentCreatePullReqPathParams) =>
      `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/comments`,
    { base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
  )

export interface CommentDeletePullReqPathParams {
  repo_ref: string
  pullreq_number: number
}

export type CommentDeletePullReqProps = Omit<
  MutateProps<void, UsererrorError, void, number, CommentDeletePullReqPathParams>,
  'path' | 'verb'
> &
  CommentDeletePullReqPathParams

export const CommentDeletePullReq = ({ repo_ref, pullreq_number, ...props }: CommentDeletePullReqProps) => (
  <Mutate<void, UsererrorError, void, number, CommentDeletePullReqPathParams>
    verb="DELETE"
    path={`/repos/${repo_ref}/pullreq/${pullreq_number}/comments`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCommentDeletePullReqProps = Omit<
  UseMutateProps<void, UsererrorError, void, number, CommentDeletePullReqPathParams>,
  'path' | 'verb'
> &
  CommentDeletePullReqPathParams

export const useCommentDeletePullReq = ({ repo_ref, pullreq_number, ...props }: UseCommentDeletePullReqProps) =>
  useMutate<void, UsererrorError, void, number, CommentDeletePullReqPathParams>(
    'DELETE',
    (paramsInPath: CommentDeletePullReqPathParams) =>
      `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/comments`,
    { base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
  )

export interface CommentUpdatePullReqPathParams {
  repo_ref: string
  pullreq_number: number
  pullreq_comment_id: number
}

export type CommentUpdatePullReqProps = Omit<
  MutateProps<
    TypesPullReqActivity,
    UsererrorError,
    void,
    OpenapiCommentUpdatePullReqRequest,
    CommentUpdatePullReqPathParams
  >,
  'path' | 'verb'
> &
  CommentUpdatePullReqPathParams

export const CommentUpdatePullReq = ({
  repo_ref,
  pullreq_number,
  pullreq_comment_id,
  ...props
}: CommentUpdatePullReqProps) => (
  <Mutate<
    TypesPullReqActivity,
    UsererrorError,
    void,
    OpenapiCommentUpdatePullReqRequest,
    CommentUpdatePullReqPathParams
  >
    verb="PATCH"
    path={`/repos/${repo_ref}/pullreq/${pullreq_number}/comments/${pullreq_comment_id}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCommentUpdatePullReqProps = Omit<
  UseMutateProps<
    TypesPullReqActivity,
    UsererrorError,
    void,
    OpenapiCommentUpdatePullReqRequest,
    CommentUpdatePullReqPathParams
  >,
  'path' | 'verb'
> &
  CommentUpdatePullReqPathParams

export const useCommentUpdatePullReq = ({
  repo_ref,
  pullreq_number,
  pullreq_comment_id,
  ...props
}: UseCommentUpdatePullReqProps) =>
  useMutate<
    TypesPullReqActivity,
    UsererrorError,
    void,
    OpenapiCommentUpdatePullReqRequest,
    CommentUpdatePullReqPathParams
  >(
    'PATCH',
    (paramsInPath: CommentUpdatePullReqPathParams) =>
      `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/comments/${paramsInPath.pullreq_comment_id}`,
    { base: getConfig('code'), pathParams: { repo_ref, pullreq_number, pullreq_comment_id }, ...props }
  )

export interface MergePullReqOpPathParams {
  repo_ref: string
  pullreq_number: number
}

export type MergePullReqOpProps = Omit<
  MutateProps<void, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>,
  'path' | 'verb'
> &
  MergePullReqOpPathParams

export const MergePullReqOp = ({ repo_ref, pullreq_number, ...props }: MergePullReqOpProps) => (
  <Mutate<void, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>
    verb="POST"
    path={`/repos/${repo_ref}/pullreq/${pullreq_number}/merge`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseMergePullReqOpProps = Omit<
  UseMutateProps<void, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>,
  'path' | 'verb'
> &
  MergePullReqOpPathParams

export const useMergePullReqOp = ({ repo_ref, pullreq_number, ...props }: UseMergePullReqOpProps) =>
  useMutate<void, UsererrorError, void, OpenapiMergePullReq, MergePullReqOpPathParams>(
    'POST',
    (paramsInPath: MergePullReqOpPathParams) =>
      `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/merge`,
    { base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
  )

export interface ReviewerListPullReqPathParams {
  repo_ref: string
  pullreq_number: number
}

export type ReviewerListPullReqProps = Omit<
  GetProps<void, UsererrorError, void, ReviewerListPullReqPathParams>,
  'path'
> &
  ReviewerListPullReqPathParams

export const ReviewerListPullReq = ({ repo_ref, pullreq_number, ...props }: ReviewerListPullReqProps) => (
  <Get<void, UsererrorError, void, ReviewerListPullReqPathParams>
    path={`/repos/${repo_ref}/pullreq/${pullreq_number}/reviewers`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseReviewerListPullReqProps = Omit<
  UseGetProps<void, UsererrorError, void, ReviewerListPullReqPathParams>,
  'path'
> &
  ReviewerListPullReqPathParams

export const useReviewerListPullReq = ({ repo_ref, pullreq_number, ...props }: UseReviewerListPullReqProps) =>
  useGet<void, UsererrorError, void, ReviewerListPullReqPathParams>(
    (paramsInPath: ReviewerListPullReqPathParams) =>
      `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/reviewers`,
    { base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
  )

export interface ReviewerAddPullReqPathParams {
  repo_ref: string
  pullreq_number: number
}

export type ReviewerAddPullReqProps = Omit<
  MutateProps<void, UsererrorError, void, OpenapiReviewerAddPullReqRequest, ReviewerAddPullReqPathParams>,
  'path' | 'verb'
> &
  ReviewerAddPullReqPathParams

export const ReviewerAddPullReq = ({ repo_ref, pullreq_number, ...props }: ReviewerAddPullReqProps) => (
  <Mutate<void, UsererrorError, void, OpenapiReviewerAddPullReqRequest, ReviewerAddPullReqPathParams>
    verb="PUT"
    path={`/repos/${repo_ref}/pullreq/${pullreq_number}/reviewers`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseReviewerAddPullReqProps = Omit<
  UseMutateProps<void, UsererrorError, void, OpenapiReviewerAddPullReqRequest, ReviewerAddPullReqPathParams>,
  'path' | 'verb'
> &
  ReviewerAddPullReqPathParams

export const useReviewerAddPullReq = ({ repo_ref, pullreq_number, ...props }: UseReviewerAddPullReqProps) =>
  useMutate<void, UsererrorError, void, OpenapiReviewerAddPullReqRequest, ReviewerAddPullReqPathParams>(
    'PUT',
    (paramsInPath: ReviewerAddPullReqPathParams) =>
      `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/reviewers`,
    { base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
  )

export interface ReviewSubmitPullReqPathParams {
  repo_ref: string
  pullreq_number: number
}

export type ReviewSubmitPullReqProps = Omit<
  MutateProps<void, UsererrorError, void, OpenapiReviewSubmitPullReqRequest, ReviewSubmitPullReqPathParams>,
  'path' | 'verb'
> &
  ReviewSubmitPullReqPathParams

export const ReviewSubmitPullReq = ({ repo_ref, pullreq_number, ...props }: ReviewSubmitPullReqProps) => (
  <Mutate<void, UsererrorError, void, OpenapiReviewSubmitPullReqRequest, ReviewSubmitPullReqPathParams>
    verb="POST"
    path={`/repos/${repo_ref}/pullreq/${pullreq_number}/reviews`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseReviewSubmitPullReqProps = Omit<
  UseMutateProps<void, UsererrorError, void, OpenapiReviewSubmitPullReqRequest, ReviewSubmitPullReqPathParams>,
  'path' | 'verb'
> &
  ReviewSubmitPullReqPathParams

export const useReviewSubmitPullReq = ({ repo_ref, pullreq_number, ...props }: UseReviewSubmitPullReqProps) =>
  useMutate<void, UsererrorError, void, OpenapiReviewSubmitPullReqRequest, ReviewSubmitPullReqPathParams>(
    'POST',
    (paramsInPath: ReviewSubmitPullReqPathParams) =>
      `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/reviews`,
    { base: getConfig('code'), pathParams: { repo_ref, pullreq_number }, ...props }
  )

export interface ListRepositoryServiceAccountsPathParams {
  repo_ref: string
}

export type ListRepositoryServiceAccountsProps = Omit<
  GetProps<TypesServiceAccount[], UsererrorError, void, ListRepositoryServiceAccountsPathParams>,
  'path'
> &
  ListRepositoryServiceAccountsPathParams

export const ListRepositoryServiceAccounts = ({ repo_ref, ...props }: ListRepositoryServiceAccountsProps) => (
  <Get<TypesServiceAccount[], UsererrorError, void, ListRepositoryServiceAccountsPathParams>
    path={`/repos/${repo_ref}/service-accounts`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListRepositoryServiceAccountsProps = Omit<
  UseGetProps<TypesServiceAccount[], UsererrorError, void, ListRepositoryServiceAccountsPathParams>,
  'path'
> &
  ListRepositoryServiceAccountsPathParams

export const useListRepositoryServiceAccounts = ({ repo_ref, ...props }: UseListRepositoryServiceAccountsProps) =>
  useGet<TypesServiceAccount[], UsererrorError, void, ListRepositoryServiceAccountsPathParams>(
    (paramsInPath: ListRepositoryServiceAccountsPathParams) => `/repos/${paramsInPath.repo_ref}/service-accounts`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface ListTagsQueryParams {
  /**
   * Indicates whether optional commit information should be included in the response.
   */
  include_commit?: boolean
  /**
   * The substring by which the tags are filtered.
   */
  query?: string
  /**
   * The order of the output.
   */
  order?: 'asc' | 'desc'
  /**
   * The data by which the tags are sorted.
   */
  sort?: 'name' | 'date'
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListTagsPathParams {
  repo_ref: string
}

export type ListTagsProps = Omit<
  GetProps<RepoCommitTag[], UsererrorError, ListTagsQueryParams, ListTagsPathParams>,
  'path'
> &
  ListTagsPathParams

export const ListTags = ({ repo_ref, ...props }: ListTagsProps) => (
  <Get<RepoCommitTag[], UsererrorError, ListTagsQueryParams, ListTagsPathParams>
    path={`/repos/${repo_ref}/tags`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListTagsProps = Omit<
  UseGetProps<RepoCommitTag[], UsererrorError, ListTagsQueryParams, ListTagsPathParams>,
  'path'
> &
  ListTagsPathParams

export const useListTags = ({ repo_ref, ...props }: UseListTagsProps) =>
  useGet<RepoCommitTag[], UsererrorError, ListTagsQueryParams, ListTagsPathParams>(
    (paramsInPath: ListTagsPathParams) => `/repos/${paramsInPath.repo_ref}/tags`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface ListWebhooksQueryParams {
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListWebhooksPathParams {
  repo_ref: string
}

export type ListWebhooksProps = Omit<
  GetProps<OpenapiWebhookType[], UsererrorError, ListWebhooksQueryParams, ListWebhooksPathParams>,
  'path'
> &
  ListWebhooksPathParams

export const ListWebhooks = ({ repo_ref, ...props }: ListWebhooksProps) => (
  <Get<OpenapiWebhookType[], UsererrorError, ListWebhooksQueryParams, ListWebhooksPathParams>
    path={`/repos/${repo_ref}/webhooks`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListWebhooksProps = Omit<
  UseGetProps<OpenapiWebhookType[], UsererrorError, ListWebhooksQueryParams, ListWebhooksPathParams>,
  'path'
> &
  ListWebhooksPathParams

export const useListWebhooks = ({ repo_ref, ...props }: UseListWebhooksProps) =>
  useGet<OpenapiWebhookType[], UsererrorError, ListWebhooksQueryParams, ListWebhooksPathParams>(
    (paramsInPath: ListWebhooksPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface CreateWebhookPathParams {
  repo_ref: string
}

export type CreateWebhookProps = Omit<
  MutateProps<OpenapiWebhookType, UsererrorError, void, OpenapiCreateWebhookRequest, CreateWebhookPathParams>,
  'path' | 'verb'
> &
  CreateWebhookPathParams

export const CreateWebhook = ({ repo_ref, ...props }: CreateWebhookProps) => (
  <Mutate<OpenapiWebhookType, UsererrorError, void, OpenapiCreateWebhookRequest, CreateWebhookPathParams>
    verb="POST"
    path={`/repos/${repo_ref}/webhooks`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCreateWebhookProps = Omit<
  UseMutateProps<OpenapiWebhookType, UsererrorError, void, OpenapiCreateWebhookRequest, CreateWebhookPathParams>,
  'path' | 'verb'
> &
  CreateWebhookPathParams

export const useCreateWebhook = ({ repo_ref, ...props }: UseCreateWebhookProps) =>
  useMutate<OpenapiWebhookType, UsererrorError, void, OpenapiCreateWebhookRequest, CreateWebhookPathParams>(
    'POST',
    (paramsInPath: CreateWebhookPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface DeleteWebhookPathParams {
  repo_ref: string
}

export type DeleteWebhookProps = Omit<
  MutateProps<void, UsererrorError, void, number, DeleteWebhookPathParams>,
  'path' | 'verb'
> &
  DeleteWebhookPathParams

export const DeleteWebhook = ({ repo_ref, ...props }: DeleteWebhookProps) => (
  <Mutate<void, UsererrorError, void, number, DeleteWebhookPathParams>
    verb="DELETE"
    path={`/repos/${repo_ref}/webhooks`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseDeleteWebhookProps = Omit<
  UseMutateProps<void, UsererrorError, void, number, DeleteWebhookPathParams>,
  'path' | 'verb'
> &
  DeleteWebhookPathParams

export const useDeleteWebhook = ({ repo_ref, ...props }: UseDeleteWebhookProps) =>
  useMutate<void, UsererrorError, void, number, DeleteWebhookPathParams>(
    'DELETE',
    (paramsInPath: DeleteWebhookPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks`,
    { base: getConfig('code'), pathParams: { repo_ref }, ...props }
  )

export interface GetWebhookPathParams {
  repo_ref: string
  webhook_id: number
}

export type GetWebhookProps = Omit<GetProps<OpenapiWebhookType, UsererrorError, void, GetWebhookPathParams>, 'path'> &
  GetWebhookPathParams

export const GetWebhook = ({ repo_ref, webhook_id, ...props }: GetWebhookProps) => (
  <Get<OpenapiWebhookType, UsererrorError, void, GetWebhookPathParams>
    path={`/repos/${repo_ref}/webhooks/${webhook_id}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseGetWebhookProps = Omit<
  UseGetProps<OpenapiWebhookType, UsererrorError, void, GetWebhookPathParams>,
  'path'
> &
  GetWebhookPathParams

export const useGetWebhook = ({ repo_ref, webhook_id, ...props }: UseGetWebhookProps) =>
  useGet<OpenapiWebhookType, UsererrorError, void, GetWebhookPathParams>(
    (paramsInPath: GetWebhookPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks/${paramsInPath.webhook_id}`,
    { base: getConfig('code'), pathParams: { repo_ref, webhook_id }, ...props }
  )

export interface UpdateWebhookPathParams {
  repo_ref: string
  webhook_id: number
}

export type UpdateWebhookProps = Omit<
  MutateProps<OpenapiWebhookType, UsererrorError, void, OpenapiUpdateWebhookRequest, UpdateWebhookPathParams>,
  'path' | 'verb'
> &
  UpdateWebhookPathParams

export const UpdateWebhook = ({ repo_ref, webhook_id, ...props }: UpdateWebhookProps) => (
  <Mutate<OpenapiWebhookType, UsererrorError, void, OpenapiUpdateWebhookRequest, UpdateWebhookPathParams>
    verb="PATCH"
    path={`/repos/${repo_ref}/webhooks/${webhook_id}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseUpdateWebhookProps = Omit<
  UseMutateProps<OpenapiWebhookType, UsererrorError, void, OpenapiUpdateWebhookRequest, UpdateWebhookPathParams>,
  'path' | 'verb'
> &
  UpdateWebhookPathParams

export const useUpdateWebhook = ({ repo_ref, webhook_id, ...props }: UseUpdateWebhookProps) =>
  useMutate<OpenapiWebhookType, UsererrorError, void, OpenapiUpdateWebhookRequest, UpdateWebhookPathParams>(
    'PATCH',
    (paramsInPath: UpdateWebhookPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks/${paramsInPath.webhook_id}`,
    { base: getConfig('code'), pathParams: { repo_ref, webhook_id }, ...props }
  )

export interface ListWebhookExecutionsQueryParams {
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListWebhookExecutionsPathParams {
  repo_ref: string
  webhook_id: number
}

export type ListWebhookExecutionsProps = Omit<
  GetProps<TypesWebhookExecution[], UsererrorError, ListWebhookExecutionsQueryParams, ListWebhookExecutionsPathParams>,
  'path'
> &
  ListWebhookExecutionsPathParams

export const ListWebhookExecutions = ({ repo_ref, webhook_id, ...props }: ListWebhookExecutionsProps) => (
  <Get<TypesWebhookExecution[], UsererrorError, ListWebhookExecutionsQueryParams, ListWebhookExecutionsPathParams>
    path={`/repos/${repo_ref}/webhooks/${webhook_id}/executions`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListWebhookExecutionsProps = Omit<
  UseGetProps<
    TypesWebhookExecution[],
    UsererrorError,
    ListWebhookExecutionsQueryParams,
    ListWebhookExecutionsPathParams
  >,
  'path'
> &
  ListWebhookExecutionsPathParams

export const useListWebhookExecutions = ({ repo_ref, webhook_id, ...props }: UseListWebhookExecutionsProps) =>
  useGet<TypesWebhookExecution[], UsererrorError, ListWebhookExecutionsQueryParams, ListWebhookExecutionsPathParams>(
    (paramsInPath: ListWebhookExecutionsPathParams) =>
      `/repos/${paramsInPath.repo_ref}/webhooks/${paramsInPath.webhook_id}/executions`,
    { base: getConfig('code'), pathParams: { repo_ref, webhook_id }, ...props }
  )

export interface GetWebhookExecutionQueryParams {
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface GetWebhookExecutionPathParams {
  repo_ref: string
  webhook_id: number
  webhook_execution_id: number
}

export type GetWebhookExecutionProps = Omit<
  GetProps<TypesWebhookExecution, UsererrorError, GetWebhookExecutionQueryParams, GetWebhookExecutionPathParams>,
  'path'
> &
  GetWebhookExecutionPathParams

export const GetWebhookExecution = ({
  repo_ref,
  webhook_id,
  webhook_execution_id,
  ...props
}: GetWebhookExecutionProps) => (
  <Get<TypesWebhookExecution, UsererrorError, GetWebhookExecutionQueryParams, GetWebhookExecutionPathParams>
    path={`/repos/${repo_ref}/webhooks/${webhook_id}/executions/${webhook_execution_id}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseGetWebhookExecutionProps = Omit<
  UseGetProps<TypesWebhookExecution, UsererrorError, GetWebhookExecutionQueryParams, GetWebhookExecutionPathParams>,
  'path'
> &
  GetWebhookExecutionPathParams

export const useGetWebhookExecution = ({
  repo_ref,
  webhook_id,
  webhook_execution_id,
  ...props
}: UseGetWebhookExecutionProps) =>
  useGet<TypesWebhookExecution, UsererrorError, GetWebhookExecutionQueryParams, GetWebhookExecutionPathParams>(
    (paramsInPath: GetWebhookExecutionPathParams) =>
      `/repos/${paramsInPath.repo_ref}/webhooks/${paramsInPath.webhook_id}/executions/${paramsInPath.webhook_execution_id}`,
    { base: getConfig('code'), pathParams: { repo_ref, webhook_id, webhook_execution_id }, ...props }
  )

export type ListGitignoreProps = Omit<GetProps<string[], UsererrorError, void, void>, 'path'>

export const ListGitignore = (props: ListGitignoreProps) => (
  <Get<string[], UsererrorError, void, void> path={`/resources/gitignore`} base={getConfig('code')} {...props} />
)

export type UseListGitignoreProps = Omit<UseGetProps<string[], UsererrorError, void, void>, 'path'>

export const useListGitignore = (props: UseListGitignoreProps) =>
  useGet<string[], UsererrorError, void, void>(`/resources/gitignore`, { base: getConfig('code'), ...props })

export interface ListLicensesResponse {
  label?: string
  value?: string
}
;[]

export type ListLicensesProps = Omit<GetProps<ListLicensesResponse, UsererrorError, void, void>, 'path'>

export const ListLicenses = (props: ListLicensesProps) => (
  <Get<ListLicensesResponse, UsererrorError, void, void>
    path={`/resources/license`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListLicensesProps = Omit<UseGetProps<ListLicensesResponse, UsererrorError, void, void>, 'path'>

export const useListLicenses = (props: UseListLicensesProps) =>
  useGet<ListLicensesResponse, UsererrorError, void, void>(`/resources/license`, { base: getConfig('code'), ...props })

export type CreateSpaceProps = Omit<
  MutateProps<TypesSpace, UsererrorError, void, OpenapiCreateSpaceRequest, void>,
  'path' | 'verb'
>

export const CreateSpace = (props: CreateSpaceProps) => (
  <Mutate<TypesSpace, UsererrorError, void, OpenapiCreateSpaceRequest, void>
    verb="POST"
    path={`/spaces`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCreateSpaceProps = Omit<
  UseMutateProps<TypesSpace, UsererrorError, void, OpenapiCreateSpaceRequest, void>,
  'path' | 'verb'
>

export const useCreateSpace = (props: UseCreateSpaceProps) =>
  useMutate<TypesSpace, UsererrorError, void, OpenapiCreateSpaceRequest, void>('POST', `/spaces`, {
    base: getConfig('code'),
    ...props
  })

export type DeleteSpaceProps = Omit<MutateProps<void, UsererrorError, void, string, void>, 'path' | 'verb'>

export const DeleteSpace = (props: DeleteSpaceProps) => (
  <Mutate<void, UsererrorError, void, string, void>
    verb="DELETE"
    path={`/spaces`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseDeleteSpaceProps = Omit<UseMutateProps<void, UsererrorError, void, string, void>, 'path' | 'verb'>

export const useDeleteSpace = (props: UseDeleteSpaceProps) =>
  useMutate<void, UsererrorError, void, string, void>('DELETE', `/spaces`, { base: getConfig('code'), ...props })

export interface GetSpacePathParams {
  space_ref: string
}

export type GetSpaceProps = Omit<GetProps<TypesSpace, UsererrorError, void, GetSpacePathParams>, 'path'> &
  GetSpacePathParams

export const GetSpace = ({ space_ref, ...props }: GetSpaceProps) => (
  <Get<TypesSpace, UsererrorError, void, GetSpacePathParams>
    path={`/spaces/${space_ref}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseGetSpaceProps = Omit<UseGetProps<TypesSpace, UsererrorError, void, GetSpacePathParams>, 'path'> &
  GetSpacePathParams

export const useGetSpace = ({ space_ref, ...props }: UseGetSpaceProps) =>
  useGet<TypesSpace, UsererrorError, void, GetSpacePathParams>(
    (paramsInPath: GetSpacePathParams) => `/spaces/${paramsInPath.space_ref}`,
    { base: getConfig('code'), pathParams: { space_ref }, ...props }
  )

export interface UpdateSpacePathParams {
  space_ref: string
}

export type UpdateSpaceProps = Omit<
  MutateProps<TypesSpace, UsererrorError, void, OpenapiUpdateSpaceRequest, UpdateSpacePathParams>,
  'path' | 'verb'
> &
  UpdateSpacePathParams

export const UpdateSpace = ({ space_ref, ...props }: UpdateSpaceProps) => (
  <Mutate<TypesSpace, UsererrorError, void, OpenapiUpdateSpaceRequest, UpdateSpacePathParams>
    verb="PATCH"
    path={`/spaces/${space_ref}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseUpdateSpaceProps = Omit<
  UseMutateProps<TypesSpace, UsererrorError, void, OpenapiUpdateSpaceRequest, UpdateSpacePathParams>,
  'path' | 'verb'
> &
  UpdateSpacePathParams

export const useUpdateSpace = ({ space_ref, ...props }: UseUpdateSpaceProps) =>
  useMutate<TypesSpace, UsererrorError, void, OpenapiUpdateSpaceRequest, UpdateSpacePathParams>(
    'PATCH',
    (paramsInPath: UpdateSpacePathParams) => `/spaces/${paramsInPath.space_ref}`,
    { base: getConfig('code'), pathParams: { space_ref }, ...props }
  )

export interface MoveSpacePathParams {
  space_ref: string
}

export type MoveSpaceProps = Omit<
  MutateProps<TypesSpace, UsererrorError, void, OpenapiMoveSpaceRequest, MoveSpacePathParams>,
  'path' | 'verb'
> &
  MoveSpacePathParams

export const MoveSpace = ({ space_ref, ...props }: MoveSpaceProps) => (
  <Mutate<TypesSpace, UsererrorError, void, OpenapiMoveSpaceRequest, MoveSpacePathParams>
    verb="POST"
    path={`/spaces/${space_ref}/move`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseMoveSpaceProps = Omit<
  UseMutateProps<TypesSpace, UsererrorError, void, OpenapiMoveSpaceRequest, MoveSpacePathParams>,
  'path' | 'verb'
> &
  MoveSpacePathParams

export const useMoveSpace = ({ space_ref, ...props }: UseMoveSpaceProps) =>
  useMutate<TypesSpace, UsererrorError, void, OpenapiMoveSpaceRequest, MoveSpacePathParams>(
    'POST',
    (paramsInPath: MoveSpacePathParams) => `/spaces/${paramsInPath.space_ref}/move`,
    { base: getConfig('code'), pathParams: { space_ref }, ...props }
  )

export interface ListPathsQueryParams {
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListPathsPathParams {
  space_ref: string
}

export type ListPathsProps = Omit<
  GetProps<TypesPath[], UsererrorError, ListPathsQueryParams, ListPathsPathParams>,
  'path'
> &
  ListPathsPathParams

export const ListPaths = ({ space_ref, ...props }: ListPathsProps) => (
  <Get<TypesPath[], UsererrorError, ListPathsQueryParams, ListPathsPathParams>
    path={`/spaces/${space_ref}/paths`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListPathsProps = Omit<
  UseGetProps<TypesPath[], UsererrorError, ListPathsQueryParams, ListPathsPathParams>,
  'path'
> &
  ListPathsPathParams

export const useListPaths = ({ space_ref, ...props }: UseListPathsProps) =>
  useGet<TypesPath[], UsererrorError, ListPathsQueryParams, ListPathsPathParams>(
    (paramsInPath: ListPathsPathParams) => `/spaces/${paramsInPath.space_ref}/paths`,
    { base: getConfig('code'), pathParams: { space_ref }, ...props }
  )

export interface CreatePathPathParams {
  space_ref: string
}

export type CreatePathProps = Omit<
  MutateProps<TypesPath, UsererrorError, void, OpenapiCreatePathRequest, CreatePathPathParams>,
  'path' | 'verb'
> &
  CreatePathPathParams

export const CreatePath = ({ space_ref, ...props }: CreatePathProps) => (
  <Mutate<TypesPath, UsererrorError, void, OpenapiCreatePathRequest, CreatePathPathParams>
    verb="POST"
    path={`/spaces/${space_ref}/paths`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCreatePathProps = Omit<
  UseMutateProps<TypesPath, UsererrorError, void, OpenapiCreatePathRequest, CreatePathPathParams>,
  'path' | 'verb'
> &
  CreatePathPathParams

export const useCreatePath = ({ space_ref, ...props }: UseCreatePathProps) =>
  useMutate<TypesPath, UsererrorError, void, OpenapiCreatePathRequest, CreatePathPathParams>(
    'POST',
    (paramsInPath: CreatePathPathParams) => `/spaces/${paramsInPath.space_ref}/paths`,
    { base: getConfig('code'), pathParams: { space_ref }, ...props }
  )

export interface DeletePathPathParams {
  space_ref: string
}

export type DeletePathProps = Omit<
  MutateProps<void, UsererrorError, void, string, DeletePathPathParams>,
  'path' | 'verb'
> &
  DeletePathPathParams

export const DeletePath = ({ space_ref, ...props }: DeletePathProps) => (
  <Mutate<void, UsererrorError, void, string, DeletePathPathParams>
    verb="DELETE"
    path={`/spaces/${space_ref}/paths`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseDeletePathProps = Omit<
  UseMutateProps<void, UsererrorError, void, string, DeletePathPathParams>,
  'path' | 'verb'
> &
  DeletePathPathParams

export const useDeletePath = ({ space_ref, ...props }: UseDeletePathProps) =>
  useMutate<void, UsererrorError, void, string, DeletePathPathParams>(
    'DELETE',
    (paramsInPath: DeletePathPathParams) => `/spaces/${paramsInPath.space_ref}/paths`,
    { base: getConfig('code'), pathParams: { space_ref }, ...props }
  )

export interface ListReposQueryParams {
  /**
   * The substring which is used to filter the repositories by their path name.
   */
  query?: string
  /**
   * The data by which the repositories are sorted.
   */
  sort?: 'uid' | 'path' | 'created' | 'updated'
  /**
   * The order of the output.
   */
  order?: 'asc' | 'desc'
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListReposPathParams {
  space_ref: string
}

export type ListReposProps = Omit<
  GetProps<TypesRepository[], UsererrorError, ListReposQueryParams, ListReposPathParams>,
  'path'
> &
  ListReposPathParams

export const ListRepos = ({ space_ref, ...props }: ListReposProps) => (
  <Get<TypesRepository[], UsererrorError, ListReposQueryParams, ListReposPathParams>
    path={`/spaces/${space_ref}/repos`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListReposProps = Omit<
  UseGetProps<TypesRepository[], UsererrorError, ListReposQueryParams, ListReposPathParams>,
  'path'
> &
  ListReposPathParams

export const useListRepos = ({ space_ref, ...props }: UseListReposProps) =>
  useGet<TypesRepository[], UsererrorError, ListReposQueryParams, ListReposPathParams>(
    (paramsInPath: ListReposPathParams) => `/spaces/${paramsInPath.space_ref}/repos`,
    { base: getConfig('code'), pathParams: { space_ref }, ...props }
  )

export interface ListServiceAccountsPathParams {
  space_ref: string
}

export type ListServiceAccountsProps = Omit<
  GetProps<TypesServiceAccount[], UsererrorError, void, ListServiceAccountsPathParams>,
  'path'
> &
  ListServiceAccountsPathParams

export const ListServiceAccounts = ({ space_ref, ...props }: ListServiceAccountsProps) => (
  <Get<TypesServiceAccount[], UsererrorError, void, ListServiceAccountsPathParams>
    path={`/spaces/${space_ref}/service-accounts`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListServiceAccountsProps = Omit<
  UseGetProps<TypesServiceAccount[], UsererrorError, void, ListServiceAccountsPathParams>,
  'path'
> &
  ListServiceAccountsPathParams

export const useListServiceAccounts = ({ space_ref, ...props }: UseListServiceAccountsProps) =>
  useGet<TypesServiceAccount[], UsererrorError, void, ListServiceAccountsPathParams>(
    (paramsInPath: ListServiceAccountsPathParams) => `/spaces/${paramsInPath.space_ref}/service-accounts`,
    { base: getConfig('code'), pathParams: { space_ref }, ...props }
  )

export interface ListSpacesQueryParams {
  /**
   * The substring which is used to filter the spaces by their path name.
   */
  query?: string
  /**
   * The data by which the spaces are sorted.
   */
  sort?: 'uid' | 'path' | 'created' | 'updated'
  /**
   * The order of the output.
   */
  order?: 'asc' | 'desc'
  /**
   * The page to return.
   */
  page?: number
  /**
   * The maximum number of results to return.
   */
  limit?: number
}

export interface ListSpacesPathParams {
  space_ref: string
}

export type ListSpacesProps = Omit<
  GetProps<TypesSpace[], UsererrorError, ListSpacesQueryParams, ListSpacesPathParams>,
  'path'
> &
  ListSpacesPathParams

export const ListSpaces = ({ space_ref, ...props }: ListSpacesProps) => (
  <Get<TypesSpace[], UsererrorError, ListSpacesQueryParams, ListSpacesPathParams>
    path={`/spaces/${space_ref}/spaces`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseListSpacesProps = Omit<
  UseGetProps<TypesSpace[], UsererrorError, ListSpacesQueryParams, ListSpacesPathParams>,
  'path'
> &
  ListSpacesPathParams

export const useListSpaces = ({ space_ref, ...props }: UseListSpacesProps) =>
  useGet<TypesSpace[], UsererrorError, ListSpacesQueryParams, ListSpacesPathParams>(
    (paramsInPath: ListSpacesPathParams) => `/spaces/${paramsInPath.space_ref}/spaces`,
    { base: getConfig('code'), pathParams: { space_ref }, ...props }
  )

export type GetUserProps = Omit<GetProps<TypesUser, UsererrorError, void, void>, 'path'>

export const GetUser = (props: GetUserProps) => (
  <Get<TypesUser, UsererrorError, void, void> path={`/user`} base={getConfig('code')} {...props} />
)

export type UseGetUserProps = Omit<UseGetProps<TypesUser, UsererrorError, void, void>, 'path'>

export const useGetUser = (props: UseGetUserProps) =>
  useGet<TypesUser, UsererrorError, void, void>(`/user`, { base: getConfig('code'), ...props })

export type UpdateUserProps = Omit<MutateProps<TypesUser, UsererrorError, void, UserUpdateInput, void>, 'path' | 'verb'>

export const UpdateUser = (props: UpdateUserProps) => (
  <Mutate<TypesUser, UsererrorError, void, UserUpdateInput, void>
    verb="PATCH"
    path={`/user`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseUpdateUserProps = Omit<
  UseMutateProps<TypesUser, UsererrorError, void, UserUpdateInput, void>,
  'path' | 'verb'
>

export const useUpdateUser = (props: UseUpdateUserProps) =>
  useMutate<TypesUser, UsererrorError, void, UserUpdateInput, void>('PATCH', `/user`, {
    base: getConfig('code'),
    ...props
  })

export type CreateTokenProps = Omit<
  MutateProps<TypesUser, UsererrorError, void, TypesTokenResponse, void>,
  'path' | 'verb'
>

export const CreateToken = (props: CreateTokenProps) => (
  <Mutate<TypesUser, UsererrorError, void, TypesTokenResponse, void>
    verb="POST"
    path={`/user/token`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCreateTokenProps = Omit<
  UseMutateProps<TypesUser, UsererrorError, void, TypesTokenResponse, void>,
  'path' | 'verb'
>

export const useCreateToken = (props: UseCreateTokenProps) =>
  useMutate<TypesUser, UsererrorError, void, TypesTokenResponse, void>('POST', `/user/token`, {
    base: getConfig('code'),
    ...props
  })

export interface ListUsersQueryParams {
  sort?: 'id' | 'email' | 'created' | 'updated'
  order?: 'asc' | 'desc'
  page?: number
  limit?: number
}

export type ListUsersProps = Omit<GetProps<TypesUser[], UsererrorError, ListUsersQueryParams, void>, 'path'>

export const ListUsers = (props: ListUsersProps) => (
  <Get<TypesUser[], UsererrorError, ListUsersQueryParams, void> path={`/users`} base={getConfig('code')} {...props} />
)

export type UseListUsersProps = Omit<UseGetProps<TypesUser[], UsererrorError, ListUsersQueryParams, void>, 'path'>

export const useListUsers = (props: UseListUsersProps) =>
  useGet<TypesUser[], UsererrorError, ListUsersQueryParams, void>(`/users`, { base: getConfig('code'), ...props })

export type CreateUserProps = Omit<MutateProps<TypesUser, UsererrorError, void, TypesUserInput, void>, 'path' | 'verb'>

export const CreateUser = (props: CreateUserProps) => (
  <Mutate<TypesUser, UsererrorError, void, TypesUserInput, void>
    verb="POST"
    path={`/users`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseCreateUserProps = Omit<
  UseMutateProps<TypesUser, UsererrorError, void, TypesUserInput, void>,
  'path' | 'verb'
>

export const useCreateUser = (props: UseCreateUserProps) =>
  useMutate<TypesUser, UsererrorError, void, TypesUserInput, void>('POST', `/users`, {
    base: getConfig('code'),
    ...props
  })

export type DeleteUserProps = Omit<MutateProps<void, UsererrorError, void, string, void>, 'path' | 'verb'>

export const DeleteUser = (props: DeleteUserProps) => (
  <Mutate<void, UsererrorError, void, string, void> verb="DELETE" path={`/users`} base={getConfig('code')} {...props} />
)

export type UseDeleteUserProps = Omit<UseMutateProps<void, UsererrorError, void, string, void>, 'path' | 'verb'>

export const useDeleteUser = (props: UseDeleteUserProps) =>
  useMutate<void, UsererrorError, void, string, void>('DELETE', `/users`, { base: getConfig('code'), ...props })

export interface GetUserEmailPathParams {
  email: string
}

export type GetUserEmailProps = Omit<GetProps<TypesUser, UsererrorError, void, GetUserEmailPathParams>, 'path'> &
  GetUserEmailPathParams

export const GetUserEmail = ({ email, ...props }: GetUserEmailProps) => (
  <Get<TypesUser, UsererrorError, void, GetUserEmailPathParams>
    path={`/users/${email}`}
    base={getConfig('code')}
    {...props}
  />
)

export type UseGetUserEmailProps = Omit<UseGetProps<TypesUser, UsererrorError, void, GetUserEmailPathParams>, 'path'> &
  GetUserEmailPathParams

export const useGetUserEmail = ({ email, ...props }: UseGetUserEmailProps) =>
  useGet<TypesUser, UsererrorError, void, GetUserEmailPathParams>(
    (paramsInPath: GetUserEmailPathParams) => `/users/${paramsInPath.email}`,
    { base: getConfig('code'), pathParams: { email }, ...props }
  )
