Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
Fixed bug with GET / POST commands not using the right parameters or …
Browse files Browse the repository at this point in the history
…limits
  • Loading branch information
coltoneshaw committed Jun 13, 2021
1 parent 2e0dfbc commit 55ee080
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/apiHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async function query3cRateLimiter_(url, method, apikey, signature, timeout = 0,
* @param {string} endpoint - The url endpoint from 3C. Do NOT include the '/public/api/' into this. It should be '/ver1/bots' for example.
* @param {string} params - If additional params are needed to be passed in, do not include the offset or limit.
*/
async function query3cLoop_(method, endpoint, params = '', apiKeys) {
async function query3cLoop_(method, endpoint, params = '', apiKeys, limit) {

let { apikey, apisecret } = apiKeys

Expand Down Expand Up @@ -233,15 +233,17 @@ async function API_(apiKeys, method, endpoint, params = '', loop, payload, limit
}
} else if (method === "POST") {
try {
signature = get3cSignature_(queryString + payload, apisecret)
let body = (payload) ? queryString + payload : queryString
signature = get3cSignature_(body, apisecret)
apiCall = await fetchCall_(url, method, apikey, signature, payload);
console.log('POSTED to single URL- ' + url)
} catch (error) {
console.log(error)
}
} else if (method === "PATCH") {
try {
signature = get3cSignature_(queryString + payload, apisecret)
let body = (payload) ? queryString + payload : queryString
signature = get3cSignature_(body, apisecret)
apiCall = await fetchCall_(url, method, apikey, signature, payload);
console.log('PATCHED to single URL- ' + url)
} catch (error) {
Expand Down Expand Up @@ -281,7 +283,7 @@ async function API_(apiKeys, method, endpoint, params = '', loop, payload, limit
async function GET(apiKeys, endpoint, params = '', loop = false, limit = '') {
payload = null
method = "GET"
return await API_(apiKeys, method, endpoint, params = '', loop, payload, limit = '')
return await API_(apiKeys, method, endpoint, params, loop, payload, limit)
}

/**
Expand Down

0 comments on commit 55ee080

Please sign in to comment.