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

Allow to specify fields with each request #107

Open
pke opened this issue Nov 11, 2021 · 0 comments
Open

Allow to specify fields with each request #107

pke opened this issue Nov 11, 2021 · 0 comments

Comments

@pke
Copy link

pke commented Nov 11, 2021

I'd like this kind of signature to be supported:

getCardById("id", { checklists: "all" })

This could be implemented in a backward compatible way, as a new argument right before the callback.

The createQuery could be extended to accept an object as argument, which it mixes with key and token.

Trello.prototype.createQuery = function (options = {}) {
    return { ...options, key: this.key, token: this.token};
};
Trello.prototype.getCard = function (boardId, cardId, fields, callback) {
    // Back compatible: If last argument is a callback, then no fields are given
    if (typeof fields === "function") {
        callback = fields
    }
    if(boardId === null)
        return makeRequest(rest.get, this.uri + '/1/cards/' + cardId, fields, callback);
    return makeRequest(rest.get, this.uri + '/1/boards/' + boardId + '/cards/' + cardId, fields, callback);
};

Does this make sense?

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

No branches or pull requests

1 participant