mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
changes in search paths & type
This commit is contained in:
parent
8c4ba81589
commit
af376eb7ee
@ -36,7 +36,7 @@ export default class Aquarius {
|
|||||||
public async queryMetadata(query): Promise<any[]> {
|
public async queryMetadata(query): Promise<any[]> {
|
||||||
|
|
||||||
const result = await AquariusConnectorProvider.getConnector().post(
|
const result = await AquariusConnectorProvider.getConnector().post(
|
||||||
this.url + "/api/v1/aquarius/assets/metadata/query",
|
this.url + "/api/v1/aquarius/assets/ddo/query",
|
||||||
JSON.stringify(query))
|
JSON.stringify(query))
|
||||||
.then((response: any) => {
|
.then((response: any) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
@ -45,7 +45,25 @@ export default class Aquarius {
|
|||||||
Logger.log("Failed: ", response.status, response.statusText)
|
Logger.log("Failed: ", response.status, response.statusText)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
Logger.error("Error fetching querying metdata: ", error)
|
Logger.error("Error fetching querying metadata: ", error)
|
||||||
|
})
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
public async queryMetadataByText(query): Promise<any[]> {
|
||||||
|
|
||||||
|
const result = await AquariusConnectorProvider.getConnector().get(
|
||||||
|
this.url + "/api/v1/aquarius/assets/ddo/query",
|
||||||
|
JSON.stringify(query))
|
||||||
|
.then((response: any) => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json()
|
||||||
|
}
|
||||||
|
Logger.log("Failed: ", response.status, response.statusText)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
Logger.error("Error fetching querying metadata: ", error)
|
||||||
})
|
})
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import fetch from "node-fetch"
|
import fetch from "node-fetch"
|
||||||
|
import URL from "url"
|
||||||
|
|
||||||
export default class AquariusConnector {
|
export default class AquariusConnector {
|
||||||
|
|
||||||
@ -11,4 +12,18 @@ export default class AquariusConnector {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get(url, payload) {
|
||||||
|
const fullUrl = new URL(url)
|
||||||
|
for (const key of Object.keys(payload)) {
|
||||||
|
fullUrl.searchParams.append(key, payload[key])
|
||||||
|
}
|
||||||
|
return fetch(fullUrl, {
|
||||||
|
method: "GET",
|
||||||
|
body: null,
|
||||||
|
headers: {
|
||||||
|
"Content-type": "application/json",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user