@@ -75,6 +75,24 @@ export class Branches extends APIResource {
7575 ...options ,
7676 } ) ;
7777 }
78+
79+ /**
80+ * Reset a project branch.
81+ *
82+ * If `branch` === `main`, the branch is reset to `target_config_sha`. Otherwise,
83+ * the branch is reset to `main`.
84+ */
85+ reset (
86+ branch : string ,
87+ params : BranchResetParams | null | undefined = { } ,
88+ options ?: RequestOptions ,
89+ ) : APIPromise < ProjectBranch > {
90+ const { project = this . _client . project , target_config_sha } = params ?? { } ;
91+ return this . _client . put ( path `/v0/projects/${ project } /branches/${ branch } /reset` , {
92+ query : { target_config_sha } ,
93+ ...options ,
94+ } ) ;
95+ }
7896}
7997
8098export type BranchListResponsesPage = Page < BranchListResponse > ;
@@ -236,6 +254,19 @@ export interface BranchRebaseParams {
236254 base ?: string ;
237255}
238256
257+ export interface BranchResetParams {
258+ /**
259+ * Path param:
260+ */
261+ project ?: string ;
262+
263+ /**
264+ * Query param: The commit SHA to reset the main branch to. Required if resetting
265+ * the main branch; disallowed otherwise.
266+ */
267+ target_config_sha ?: string ;
268+ }
269+
239270export declare namespace Branches {
240271 export {
241272 type ProjectBranch as ProjectBranch ,
@@ -247,5 +278,6 @@ export declare namespace Branches {
247278 type BranchListParams as BranchListParams ,
248279 type BranchDeleteParams as BranchDeleteParams ,
249280 type BranchRebaseParams as BranchRebaseParams ,
281+ type BranchResetParams as BranchResetParams ,
250282 } ;
251283}
0 commit comments