//native
/**
* Updates an existing branch
* Update an existing branch in your ReadMe project.
>📘
> This route is only available to projects that are using [ReadMe Refactored](https://docs.readme.com/main/docs/welcome-to-readme-refactored).
*/
export async function main(auth: RT.Readme, branch: string, body: Body) {
const url = new URL(`https://api.readme.com/v2/branches/${branch}`)
const response = await fetch(url, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* Dependent upon the type of resource you are updating this is the representation for a branch or version.
*/
export type Body =
| {
/**
* A non-semver display name for the version.
*/
display_name?: string
/**
* The semver name for the version.
*/
name?: string
privacy?: {
/**
* Whether the version is public, hidden, or the stable version that's visible by default.
*/
view?: 'default' | 'hidden' | 'public'
}
release_stage?: 'beta' | 'release'
state?: 'current' | 'deprecated'
}
| {
/**
* The target rename of the branch and its version prefix.
*/
name: string
}
Submitted by hugo697 235 days ago