Skip to content
This repository has been archived by the owner on Jan 20, 2020. It is now read-only.

Add pageArgs to the getProductTrades definition #307

Merged
merged 1 commit into from
Apr 14, 2018

Conversation

wilwade
Copy link
Contributor

@wilwade wilwade commented Apr 13, 2018

Fix for issue: #306

wilwade referenced this pull request in wilwade/gdax-node Apr 13, 2018
index.d.ts Outdated
@@ -162,8 +162,8 @@ declare module 'gdax' {
getProductTicker(productID: string, callback: callback<ProductTicker>): void;
getProductTicker(productID: string, ): Promise<ProductTicker>;

getProductTrades(productID: string, callback: callback<any>): void;
getProductTrades(productID: string, ): Promise<any>;
getProductTrades(productID: string, pageArgs: PageArgs, callback: callback<any>): void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be marked as optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it needs a second set of defs. I'll get that fixed up

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need both lines, since one returns a Promise and the other returns void and has a callback arg. All the gdax-node functions take a callback arg and use it if provided. If there is no callback then the functions return a Promise.

This works, however, the optional isn't consistent with the rest of the file. Maybe make options optional for all the other ones that return a Promise.

        getProductTrades(productID: string, options: PageArgs, callback: callback<any>): void;
        getProductTrades(productID: string, options?: PageArgs): Promise<any>;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blair I pushed up a match to how the rest of the file does it. There are others on the PublicClient that are still missing types for the options. If you would like, I can in a different pr go back through and add more types and switch the promises over to use the ? syntax.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commit LGTM. How much work you want to put into updating all the calls up to you, but this looks fine for me.

@wilwade wilwade force-pushed the fix-getProductTrades-ts-def branch from 8a046d7 to 2c723f0 Compare April 13, 2018 20:29
@fb55 fb55 merged commit 5f2a11f into coinbase:master Apr 14, 2018
@fb55
Copy link
Contributor

fb55 commented Apr 14, 2018

Thanks @wilwade and @blair!

@wilwade wilwade deleted the fix-getProductTrades-ts-def branch April 20, 2018 13:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants