-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
- Loading branch information
Tyler Smalley
committed
May 26, 2021
1 parent
c9099db
commit 6cfa026
Showing
37 changed files
with
1,997 additions
and
4,102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { KbnClientRequester, uriencode } from './kbn_client_requester'; | ||
|
||
interface UpdateBody { | ||
name: string; | ||
description?: string; | ||
disabledFeatures?: string | string[]; | ||
initials?: string; | ||
color?: string; | ||
imageUrl?: string; | ||
} | ||
|
||
interface CreateBody extends UpdateBody { | ||
id: string; | ||
} | ||
|
||
export class KbnClientSpaces { | ||
constructor(private readonly requester: KbnClientRequester) {} | ||
|
||
async create(body: CreateBody) { | ||
await this.requester.request({ | ||
method: 'POST', | ||
path: '/api/spaces/space', | ||
body, | ||
}); | ||
} | ||
|
||
async update(id: string, body: UpdateBody) { | ||
await this.requester.request({ | ||
method: 'PUT', | ||
path: uriencode`/api/spaces/space/${id}`, | ||
body, | ||
}); | ||
} | ||
|
||
async get(id: string) { | ||
const { data } = await this.requester.request({ | ||
method: 'GET', | ||
path: uriencode`/api/spaces/space/${id}`, | ||
}); | ||
|
||
return data; | ||
} | ||
|
||
async list() { | ||
const { data } = await this.requester.request({ | ||
method: 'GET', | ||
path: '/api/spaces/space', | ||
}); | ||
|
||
return data; | ||
} | ||
|
||
async delete(id: string) { | ||
await this.requester.request({ | ||
method: 'DELETE', | ||
path: uriencode`/api/spaces/space/${id}`, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.