From 2c33d481694a9a82f83c2a54b7a0e9ba4333721a Mon Sep 17 00:00:00 2001 From: naglepuff Date: Tue, 31 Aug 2021 15:28:28 -0400 Subject: [PATCH 1/2] Add GET endpoint for a network's tables --- src/axios.ts | 6 ++++++ src/index.ts | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/axios.ts b/src/axios.ts index 3b71cf7..50849b4 100644 --- a/src/axios.ts +++ b/src/axios.ts @@ -15,6 +15,7 @@ import { TableRow, TablesOptionsSpec, Table, + TableType, SingleUserWorkspacePermissionSpec, UserSpec, WorkspacePermissionsSpec, @@ -52,6 +53,7 @@ export interface MultinetAxiosInstance extends AxiosInstance { network(workspace: string, network: string): AxiosPromise; nodes(workspace: string, network: string, options: OffsetLimitSpec): AxiosPromise>; edges(workspace: string, network: string, options: EdgesOptionsSpec): AxiosPromise>; + networkTables(workspace: string, network: string, type: TableType): AxiosPromise createWorkspace(workspace: string): AxiosPromise; deleteWorkspace(workspace: string): AxiosPromise; renameWorkspace(workspace: string, name: string): AxiosPromise; @@ -135,6 +137,10 @@ export function multinetAxiosInstance(config: AxiosRequestConfig): MultinetAxios }); }; + Proto.networkTables = function(workspace: string, network: string, type: TableType = 'all'): AxiosPromise { + return this.get(`workspaces/${workspace}/networks/${network}/tables/`, { params: { type: type } }); + } + Proto.createWorkspace = function(workspace: string): AxiosPromise { return this.post(`/workspaces/`, { name: workspace, diff --git a/src/index.ts b/src/index.ts index 9e0ffa9..6a5690a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -223,6 +223,10 @@ class MultinetAPI { return (await this.axios.edges(workspace, network, options)).data; } + public async networkTables(workspace: string, network: string, type: TableType = 'all'): Promise { + return (await this.axios.networkTables(workspace, network, type)).data; + } + public async createWorkspace(workspace: string): Promise { return (await this.axios.createWorkspace(workspace)).data; } From 5bb33c0767f80b7fc0017d6d6253d03852fa04f4 Mon Sep 17 00:00:00 2001 From: naglepuff Date: Wed, 1 Sep 2021 09:37:51 -0400 Subject: [PATCH 2/2] Fix linting issues --- src/axios.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/axios.ts b/src/axios.ts index 50849b4..22ee9e0 100644 --- a/src/axios.ts +++ b/src/axios.ts @@ -53,7 +53,7 @@ export interface MultinetAxiosInstance extends AxiosInstance { network(workspace: string, network: string): AxiosPromise; nodes(workspace: string, network: string, options: OffsetLimitSpec): AxiosPromise>; edges(workspace: string, network: string, options: EdgesOptionsSpec): AxiosPromise>; - networkTables(workspace: string, network: string, type: TableType): AxiosPromise + networkTables(workspace: string, network: string, type: TableType): AxiosPromise; createWorkspace(workspace: string): AxiosPromise; deleteWorkspace(workspace: string): AxiosPromise; renameWorkspace(workspace: string, name: string): AxiosPromise; @@ -138,8 +138,8 @@ export function multinetAxiosInstance(config: AxiosRequestConfig): MultinetAxios }; Proto.networkTables = function(workspace: string, network: string, type: TableType = 'all'): AxiosPromise { - return this.get(`workspaces/${workspace}/networks/${network}/tables/`, { params: { type: type } }); - } + return this.get(`workspaces/${workspace}/networks/${network}/tables/`, { params: {type} }); + }; Proto.createWorkspace = function(workspace: string): AxiosPromise { return this.post(`/workspaces/`, {