feat(events,catalog/bitbucketCloud): handle repo:push events

Relates-to: #10866
Signed-off-by: Patrick Jungermann <Patrick.Jungermann@gmail.com>
This commit is contained in:
Patrick Jungermann
2022-09-17 02:01:00 +02:00
parent b8f913096c
commit d089fbe7dc
15 changed files with 571 additions and 31 deletions
@@ -0,0 +1,56 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Models } from '../models';
// source: https://support.atlassian.com/bitbucket-cloud/docs/event-payloads
/** @public */
export namespace Events {
/** @public */
export interface RepoEvent {
repository: Models.Repository & { workspace: Models.Workspace };
actor: Models.Account;
}
/** @public */
export interface RepoPushEvent extends RepoEvent {
push: RepoPush;
}
/** @public */
export interface RepoPush {
changes: Change[];
}
/** @public */
export interface Change {
old: Models.Branch;
new: Models.Branch;
truncated: boolean;
created: boolean;
forced: boolean;
closed: boolean;
links: ChangeLinks;
commits: Models.Commit[];
}
/** @public */
export interface ChangeLinks {
commits: Models.Link;
diff: Models.Link;
html: Models.Link;
}
}
@@ -21,6 +21,7 @@
*/
export * from './BitbucketCloudClient';
export * from './events';
export * from './models';
export * from './pagination';
export * from './types';
@@ -518,4 +518,46 @@ export namespace Models {
repositories?: Link;
self?: Link;
}
/**
* A Bitbucket workspace.
* Workspaces are used to organize repositories.
* @public
*/
export interface Workspace extends ModelObject {
created_on?: string;
/**
* Indicates whether the workspace is publicly accessible, or whether it is
* private to the members and consequently only visible to members.
*/
is_private?: boolean;
links?: WorkspaceLinks;
/**
* The name of the workspace.
*/
name?: string;
/**
* The short label that identifies this workspace.
*/
slug?: string;
updated_on?: string;
/**
* The workspace's immutable id.
*/
uuid?: string;
}
/**
* @public
*/
export interface WorkspaceLinks {
avatar?: Link;
html?: Link;
members?: Link;
owners?: Link;
projects?: Link;
repositories?: Link;
self?: Link;
snippets?: Link;
}
}