Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to specify additional request params to slides.presentations.get with typescript #1363

Closed
peternewnham opened this issue Sep 26, 2018 · 3 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@peternewnham
Copy link

I need to fetch all the URLs of images in a presentation using the slides API and want to use the fields parameter in my request so that only the image urls are returned and not the entire presentation data.

Using plain javascript the following works fine:

const slides = google.slides({
  version: 'v1',
  auth: oauth2Client
});
const presentation = await slides.presentations.get({
  presentationId,
  fields: 'slides(pageElements(image(contentUrl)))'
});

However, doing the same this with Typescript does not compile because the params argument for this call is defined by Params$Resource$Presentations$Get which only includes an auth and presentationId key so I'm unable to add fields here.

If i try to use the additional Axios options parameter (as suggested in the docs) this compiles but the axios params are ignored and fields is not included in the request:

const presentation = await slides.presentations.get(
  { presentationId },
  { 
    params: {
      fields: 'slides(pageElements(image(contentUrl)))'
    }
  }
});

I can get around the issue by casting the original params to any but there seems to either be an issue with either the Typescript definitions or the Axios option params merging depending on what the desired way to use this API is.

Environment details

  • OS: Ubuntu
  • Node.js version: v10.5
  • npm version: 6.4.1
  • googleapis version: 33.0.0
@JustinBeckwith JustinBeckwith added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Sep 26, 2018
@neckaros
Copy link

neckaros commented Nov 5, 2018

Same problem with Drive API i have to cast to any everytime.
Ex: Params$Resource$Files$List
Maybe those object should extend a basic type with common properties?

@ajaaym
Copy link
Contributor

ajaaym commented Nov 5, 2018

This is fixed in this pr 1390

@ajaaym
Copy link
Contributor

ajaaym commented Nov 14, 2018

Fix is released in this version v35.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants