mattroumaya / surveymonkey

Access your SurveyMonkey data directly from R!
https://mattroumaya.github.io/surveymonkey/
Other
42 stars 10 forks source link

add periodic when-your-limit-resets announcement to all API calls #34

Closed sfirke closed 2 years ago

sfirke commented 5 years ago

I added this to browse_surveys():

if (as.numeric(out$headers$`x-ratelimit-app-global-day-remaining`)%%20 == 
        0) {
        message(paste0("Your daily request limit will reset in ", 
            out$headers$`X-Ratelimit-App-Global-Day-Reset`, 
            " seconds"))
    }

but it's missing from the other API calls. Add it. Maybe there's a universal place to add it, or if not, wrap it in a function?

sfirke commented 5 years ago

check how other packages approach this. Someone must cache the rate limit results of the latest call somewhere accessible?

mattroumaya commented 2 years ago

I think this has been added in most places where it's relevant, e.g., browse_surveys(), fetch_survey_obj(), parse_survey(), etc.