Skip to content

Conversation

@willm
Copy link
Contributor

Skeleton typescript typings. Apart from Basket and Release, which has been done manually with proper types, these were generated from the script below:

'use strict';varschema=require('./assets/7digital-api-schema');constresources=schema.resources;for(varclassNameinresources){letmethods=resources[className].actions.map((x)=>x.methodName);constfnDefs=methods.map((m)=>{return`\t${m}: ( params: any, callback: ( err:Error, response:any ) => void ) => void;`});console.log(`export class ${className}{${fnDefs.join('\n')}}\n`);}

@raoulmillais
Copy link
Contributor

Nice :) This could be useful for typescript ppl. For it to be really useful, I think it's necessary to cover the whole API schema with proper types (as you have for basket and release) before merging and releasing.

@willm
Copy link
ContributorAuthor

agreed, I'm also wondering/looking at if I can put in some tests/checks to make sure it doesn't get out of date.

There's an issue that the new usage types parameter actually affects the schema. Seeing as this is the future of the api, maybe we should think about forcing the usageTypes=download parameter by default.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@willm@raoulmillais