Skip to content

Commit

Permalink
chore: code reorg and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mladibejn committed Mar 15, 2023
1 parent 1ffa8ca commit 810d5dd
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions grid/crm/contacts/maps/pipedrive.suma
Original file line number Diff line number Diff line change
Expand Up @@ -92,53 +92,6 @@ map Search {
}
}

// Pipedrive rate limits docs: https://pipedrive.readme.io/docs/core-api-concepts-rate-limiting
//
// Last checked 14th March 2023
// Essential - Enterprise plans - between 20 - 120 requests per 2 seconds per api_token

//
// Status codes docs: https://pipedrive.readme.io/docs/core-api-concepts-http-status-codes
operation MapError {
statusCode = args.statusCode
detail = args.body.error

return if (statusCode === 400) {
title = "Bad request"
detail = detail
}

return if (statusCode === 401) {
title = "Unauthenticated"
detail = detail
}

return if (statusCode === 402) {
title = "Payment required"
detail = detail
}

return if (statusCode === 403) {
title = "Unauthorized"
detail = detail
}

return if (statusCode === 404) {
title = "Not found"
detail = detail
}

return if (statusCode === 429) {
title = "Too many requests"
detail = detail
}

return {
title = "Unknown error"
detail = `Unknown error occurred. Status: ${statusCode}. IPData provider error info: ${detail}.`
}
}

operation UpsertOrganization {

data = call GetOrganizationByName(input = args.input)
Expand Down Expand Up @@ -195,3 +148,50 @@ operation GetOrganizationByName {

}
}

// Pipedrive rate limits docs: https://pipedrive.readme.io/docs/core-api-concepts-rate-limiting
//
// Last checked 14th March 2023
// Essential - Enterprise plans - between 20 - 120 requests per 2 seconds per api_token

//
// Status codes docs: https://pipedrive.readme.io/docs/core-api-concepts-http-status-codes
operation MapError {
statusCode = args.statusCode
detail = args.body.error

return if (statusCode === 400) {
title = "Bad request"
detail = detail
}

return if (statusCode === 401) {
title = "Unauthenticated"
detail = detail
}

return if (statusCode === 402) {
title = "Payment required"
detail = detail
}

return if (statusCode === 403) {
title = "Unauthorized"
detail = detail
}

return if (statusCode === 404) {
title = "Not found"
detail = detail
}

return if (statusCode === 429) {
title = "Too many requests"
detail = detail
}

return {
title = "Unknown error"
detail = `Unknown error occurred. Status: ${statusCode}. IPData provider error info: ${detail}.`
}
}

0 comments on commit 810d5dd

Please sign in to comment.