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

Typings #82

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Typings #82

wants to merge 4 commits into from

Conversation

willm
Copy link
Contributor

@willm willm commented Mar 21, 2016

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';
var schema = require('./assets/7digital-api-schema');

const resources = schema.resources;

for (var className in resources) {
    let methods = resources[className].actions.map((x) => x.methodName);
    const fnDefs = 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
Contributor Author

willm commented Mar 22, 2016

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 free to 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