mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-09 10:28:32 +00:00
generalized the boards and the libraries views.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { ArduinoComponent } from "./arduino-component";
|
||||
import { JsonRpcServer } from "@theia/core";
|
||||
import { JsonRpcServer } from '@theia/core';
|
||||
import { Searchable } from './searchable';
|
||||
import { Installable } from './installable';
|
||||
import { ArduinoComponent } from './arduino-component';
|
||||
|
||||
export interface AttachedBoardsChangeEvent {
|
||||
readonly oldState: Readonly<{ boards: Board[] }>;
|
||||
@@ -18,10 +20,8 @@ export interface BoardsServiceClient {
|
||||
|
||||
export const BoardsServicePath = '/services/boards-service';
|
||||
export const BoardsService = Symbol('BoardsService');
|
||||
export interface BoardsService extends JsonRpcServer<BoardsServiceClient> {
|
||||
export interface BoardsService extends Installable<BoardPackage>, Searchable<BoardPackage>, JsonRpcServer<BoardsServiceClient> {
|
||||
getAttachedBoards(): Promise<{ boards: Board[] }>;
|
||||
search(options: { query?: string }): Promise<{ items: BoardPackage[] }>;
|
||||
install(item: BoardPackage): Promise<void>;
|
||||
}
|
||||
|
||||
export interface BoardPackage extends ArduinoComponent {
|
||||
|
||||
3
arduino-ide-extension/src/common/protocol/installable.ts
Normal file
3
arduino-ide-extension/src/common/protocol/installable.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export interface Installable<T> {
|
||||
install(item: T): Promise<void>;
|
||||
}
|
||||
@@ -1,20 +1,13 @@
|
||||
import { ArduinoComponent } from "./arduino-component";
|
||||
import { Searchable } from './searchable';
|
||||
import { Installable } from './installable';
|
||||
import { ArduinoComponent } from './arduino-component';
|
||||
|
||||
export const LibraryServicePath = '/services/library-service';
|
||||
export const LibraryService = Symbol('LibraryService');
|
||||
export interface LibraryService {
|
||||
search(options: { query?: string, props?: LibraryService.Search.Props }): Promise<{ items: Library[] }>;
|
||||
export interface LibraryService extends Installable<Library>, Searchable<Library> {
|
||||
install(library: Library): Promise<void>;
|
||||
}
|
||||
|
||||
export namespace LibraryService {
|
||||
export namespace Search {
|
||||
export interface Props {
|
||||
[key: string]: string | undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface Library extends ArduinoComponent {
|
||||
readonly builtIn?: boolean;
|
||||
}
|
||||
|
||||
11
arduino-ide-extension/src/common/protocol/searchable.ts
Normal file
11
arduino-ide-extension/src/common/protocol/searchable.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export interface Searchable<T> {
|
||||
search(options: Searchable.Options): Promise<{ items: T[] }>;
|
||||
}
|
||||
export namespace Searchable {
|
||||
export interface Options {
|
||||
/**
|
||||
* Defaults to empty an empty string.
|
||||
*/
|
||||
readonly query?: string;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user