Compare commits
No commits in common. "3e8eb1e2542efb0d5ec3adccdd16539f909adff2" and "29b6801e53182e01e56f051752f9f6e4f299fb8f" have entirely different histories.
3e8eb1e254
...
29b6801e53
2 changed files with 1 additions and 12 deletions
3
src/index.d.ts
vendored
3
src/index.d.ts
vendored
|
@ -49,8 +49,7 @@ export class WireKVSDatabase extends EventEmitter {
|
||||||
disconnect(): void;
|
disconnect(): void;
|
||||||
|
|
||||||
getAllEntries(): Promise<DatabaseEntry[]>;
|
getAllEntries(): Promise<DatabaseEntry[]>;
|
||||||
get(key: string): Promise<string>;
|
get(key: string): Promise<any>;
|
||||||
json<T extends object>(key: string): Promise<T>;
|
|
||||||
set(key: string, value: any): Promise<void>;
|
set(key: string, value: any): Promise<void>;
|
||||||
update(key: string, value: any): Promise<void>;
|
update(key: string, value: any): Promise<void>;
|
||||||
delete(key: string): Promise<void>;
|
delete(key: string): Promise<void>;
|
||||||
|
|
10
src/index.js
10
src/index.js
|
@ -130,16 +130,6 @@ class WireKVSDatabase extends EventEmitter {
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async json(key) {
|
|
||||||
const response = await axios.get(
|
|
||||||
`${API_BASE_URL}/database/${this.id}/${key}`,
|
|
||||||
{
|
|
||||||
headers: { Authorization: this.accessKey },
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return JSON.parse(response.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async set(key, value) {
|
async set(key, value) {
|
||||||
await axios.post(`${API_BASE_URL}/database/${this.id}/${key}`, value, {
|
await axios.post(`${API_BASE_URL}/database/${this.id}/${key}`, value, {
|
||||||
headers: { Authorization: this.accessKey },
|
headers: { Authorization: this.accessKey },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue