todo: add todo api types and empty client

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-03-09 19:58:54 +01:00
parent fbf10445af
commit 72f59d5528
4 changed files with 92 additions and 0 deletions
+1
View File
@@ -20,6 +20,7 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/catalog-model": "^0.7.3",
"@backstage/core": "^0.7.0",
"@backstage/theme": "^0.2.3",
"@material-ui/core": "^4.11.0",
+23
View File
@@ -0,0 +1,23 @@
/*
* Copyright 2021 Spotify AB
*
* 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 { TodoApi, TodoListOptions, TodoListResult } from './types';
export class TodoClient implements TodoApi {
listTodos(_options: TodoListOptions): Promise<TodoListResult> {
throw new Error('Method not implemented.');
}
}
+19
View File
@@ -0,0 +1,19 @@
/*
* Copyright 2021 Spotify AB
*
* 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.
*/
export { TodoClient } from './TodoClient';
export { todoApiRef } from './types';
export type { TodoApi } from './types';
+49
View File
@@ -0,0 +1,49 @@
/*
* Copyright 2021 Spotify AB
*
* 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 { createApiRef } from '@backstage/core';
import { Entity } from '@backstage/catalog-model';
export type TodoItem = {
text: string;
author?: string;
viewUrl?: string;
editUrl?: string;
};
export type TodoListOptions = {
entity?: Entity;
cursor?: string;
};
export type TodoListResult = {
items: TodoItem[];
totalCount: number;
cursors: {
prev: string;
self: string;
next: string;
};
};
export interface TodoApi {
listTodos(options: TodoListOptions): Promise<TodoListResult>;
}
export const todoApiRef = createApiRef<TodoApi>({
id: 'plugin.todo.api',
description: 'Lists TODOs',
});