Home Reference Source Test
import RedashClient from 'redash-client/src/RedashClient.js'
public class | source

RedashClient

Redash Client

Test:

Constructor Summary

Public Constructor
public

constructor(options: {endPoint: string, apiToken: string, agent: ?http.Agent, authHeaderName: ?string})

Member Summary

Private Members
private

fetchJson_(path: string, body: Object=, options: Object=): Promise<Response>: *

Method Summary

Public Methods
public

getDataSource(id: number): Promise<DataSource>

public

getDataSources(): Promise<Array<DataSource>>

public

getJob(id: number): Promise<{job: Job}>

public

getQueries(): Promise<{count: number, page: number, page_size: number, results: Array<Query>}>

public

getQuery(id: number): Promise<Query>

public

getQueryResult(queryResultId: number): Promise<{query_result: QueryResult}>

public

postQuery(query: {query: string, data_source_id: number, name: string, description: string}): Promise<Query>

public

postQueryResult(query: {data_source_id: number, max_age: number, query: string, query_id: number}): Promise<{job: Job}|{query_result: QueryResult}>

public

async queryAndWaitResult(query: {data_source_id: number, query: string, query_id: number}, timeout: number=): Promise<{query_result: QueryResult}>

public

updateQuery(query: {id: number, query: string, data_source_id: number, name: string, description: string}): Promise<Query>

Private Methods
private

get_(path: string): Promise<Response>

private

post_(path: string, body: Object=): Promise<Response>

Public Constructors

public constructor(options: {endPoint: string, apiToken: string, agent: ?http.Agent, authHeaderName: ?string}) source

Params:

NameTypeAttributeDescription
options {endPoint: string, apiToken: string, agent: ?http.Agent, authHeaderName: ?string}

Private Members

private fetchJson_(path: string, body: Object=, options: Object=): Promise<Response>: * source

Return:

Promise<Response>

Public Methods

public getDataSource(id: number): Promise<DataSource> source

Params:

NameTypeAttributeDescription
id number

Return:

Promise<DataSource>

Test:

public getDataSources(): Promise<Array<DataSource>> source

Return:

Promise<Array<DataSource>>

Test:

public getJob(id: number): Promise<{job: Job}> source

Params:

NameTypeAttributeDescription
id number

Return:

Promise<{job: Job}>

Test:

public getQueries(): Promise<{count: number, page: number, page_size: number, results: Array<Query>}> source

Return:

Promise<{count: number, page: number, page_size: number, results: Array<Query>}>

Test:

public getQuery(id: number): Promise<Query> source

Params:

NameTypeAttributeDescription
id number

Return:

Promise<Query>

Test:

public getQueryResult(queryResultId: number): Promise<{query_result: QueryResult}> source

Params:

NameTypeAttributeDescription
queryResultId number

Return:

Promise<{query_result: QueryResult}>

Test:

public postQuery(query: {query: string, data_source_id: number, name: string, description: string}): Promise<Query> source

Params:

NameTypeAttributeDescription
query {query: string, data_source_id: number, name: string, description: string}

Return:

Promise<Query>

Test:

public postQueryResult(query: {data_source_id: number, max_age: number, query: string, query_id: number}): Promise<{job: Job}|{query_result: QueryResult}> source

Params:

NameTypeAttributeDescription
query {data_source_id: number, max_age: number, query: string, query_id: number}

Return:

Promise<{job: Job}|{query_result: QueryResult}>

Test:

public async queryAndWaitResult(query: {data_source_id: number, query: string, query_id: number}, timeout: number=): Promise<{query_result: QueryResult}> source

Params:

NameTypeAttributeDescription
query {data_source_id: number, query: string, query_id: number}
timeout number=

Return:

Promise<{query_result: QueryResult}>

Test:

public updateQuery(query: {id: number, query: string, data_source_id: number, name: string, description: string}): Promise<Query> source

Params:

NameTypeAttributeDescription
query {id: number, query: string, data_source_id: number, name: string, description: string}

Return:

Promise<Query>

Test:

Private Methods

private get_(path: string): Promise<Response> source

Params:

NameTypeAttributeDescription
path string

Return:

Promise<Response>

private post_(path: string, body: Object=): Promise<Response> source

Params:

NameTypeAttributeDescription
path string
body Object=

Return:

Promise<Response>