Giter Club home page Giter Club logo

Comments (3)

MarkEdmondson1234 avatar MarkEdmondson1234 commented on June 13, 2024

Yes this is a bug I haven't documented yet.

I fix this by using a helper function that removes all NULL from a list, and pass that instead.

Here is my fix I used in a project recently.

I have two helper functions to help with NULLs:

#' A helper function that tests whether an object is either NULL _or_
#' a list of NULLs
#'
#' @keywords internal
is.NullOb <- function(x) is.null(x) | all(sapply(x, is.null))

#' Recursively step down into list, removing all such objects
#'
#' @keywords internal
rmNullObs <- function(x) {
  x <- Filter(Negate(is.NullOb), x)
  lapply(x, function(x) if (is.list(x)) rmNullObs(x) else x)
}

Then I use that like in this function for googleComputeEngineR:

  url <- sprintf("https://www.googleapis.com/compute/v1/projects/%s/aggregated/machineTypes", 
                 project)
  
  pars <- list(filter = filter, 
               maxResults = maxResults, 
               pageToken = pageToken)

## remove NULL obs as it breaks the API call
  pars <- rmNullObs(pars)

  # compute.machineTypes.aggregatedList
  f <- gar_api_generator(url, 
                         "GET", 
                         pars_args = pars, 
                         data_parse_function = function(x) x)
  f()

I will add this fix to googleAuthR and regenerate these libraries soon. Also be aware of another bug I found, the order of the parameters passed into the API can be in the wrong order. ( #2 )

from autogoogleapi.

samterfa avatar samterfa commented on June 13, 2024

Thanks for the fixes and heads-up on the other bug.

from autogoogleapi.

MarkEdmondson1234 avatar MarkEdmondson1234 commented on June 13, 2024

This is fixed from googleAuthR 0.5

from autogoogleapi.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.