import qs from 'qs' import { GraphData, GraphRequestParams } from '../../interfaces/graph.interface' import { Api } from '../api' export const serializer = (queryParams: Record) => { return qs.stringify(queryParams, { arrayFormat: 'brackets' }) } export class Graph { api: Api constructor(api: Api) { this.api = api } getReferences(hash: string, params: GraphRequestParams) { return this.api.apisauce.post( `/service/graph/elements/${hash}/references`, undefined, { params, paramsSerializer: serializer, }, ) } getRelations(hash: string, params: GraphRequestParams) { return this.api.apisauce.post( `/service/graph/elements/${hash}/relations`, undefined, { params, paramsSerializer: serializer, }, ) } }