"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cards = void 0;
const FormData = require("form-data");
class Cards {
    constructor(client) {
        this.client = client;
    }
    async createCard(parameters, callback) {
        const config = {
            url: '/cards',
            method: 'POST',
            params: {
                name: parameters.name,
                desc: parameters.desc,
                pos: parameters.pos,
                due: parameters.due,
                dueComplete: parameters.dueComplete,
                idList: parameters.idList,
                idMembers: parameters.idMembers,
                idLabels: parameters.idLabels,
                urlSource: parameters.urlSource,
                fileSource: parameters.fileSource,
                mimeType: parameters.mimeType,
                idCardSource: parameters.idCardSource,
                keepFromSource: parameters.keepFromSource,
                address: parameters.address,
                locationName: parameters.locationName,
                coordinates: parameters.coordinates,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async getCard(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}`,
            method: 'GET',
            params: {
                fields: parameters.fields,
                actions: parameters.actions,
                attachments: parameters.attachments,
                attachment_fields: parameters.attachmentFields,
                members: parameters.members,
                member_fields: parameters.memberFields,
                membersVoted: parameters.membersVoted,
                memberVoted_fields: parameters.memberVotedFields,
                checkItemStates: parameters.checkItemStates,
                checklists: parameters.checklists,
                checklist_fields: parameters.checklistFields,
                board: parameters.board,
                board_fields: parameters.boardFields,
                list: parameters.list,
                pluginData: parameters.pluginData,
                stickers: parameters.stickers,
                sticker_fields: parameters.stickerFields,
                customFieldItems: parameters.customFieldItems,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async updateCard(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}`,
            method: 'PUT',
            params: {
                name: parameters.name,
                desc: parameters.desc,
                closed: parameters.closed,
                idMembers: parameters.idMembers,
                idAttachmentCover: parameters.idAttachmentCover,
                idList: parameters.idList,
                idLabels: parameters.idLabels,
                idBoard: parameters.idBoard,
                pos: parameters.pos,
                due: parameters.due,
                dueComplete: parameters.dueComplete,
                subscribed: parameters.subscribed,
                address: parameters.address,
                locationName: parameters.locationName,
                coordinates: parameters.coordinates,
                cover: parameters.cover,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async deleteCard(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}`,
            method: 'DELETE',
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardField(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/${parameters.field}`,
            method: 'GET',
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardActions(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/actions`,
            method: 'GET',
            params: {
                filter: parameters.filter,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardAttachments(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/attachments`,
            method: 'GET',
        };
        return this.client.sendRequest(config, callback);
    }
    async createCardAttachment(parameters, callback) {
        var _a, _b;
        let formData;
        if (parameters.file) {
            formData = new FormData();
            formData.append('file', parameters.file, parameters.name);
            formData.append('name', parameters.name);
            formData.append('mimeType', parameters.mimeType);
        }
        const config = {
            url: `/cards/${parameters.id}/attachments`,
            method: 'POST',
            headers: Object.assign({}, (_a = formData === null || formData === void 0 ? void 0 : formData.getHeaders) === null || _a === void 0 ? void 0 : _a.call(formData)),
            params: {
                name: parameters.name,
                mimeType: parameters.mimeType,
                url: parameters.url,
                setCover: parameters.setCover,
            },
            data: formData,
        };
        if (formData) {
            config.headers['Content-Length'] = (_b = formData.getLengthSync) === null || _b === void 0 ? void 0 : _b.call(formData);
        }
        return this.client.sendRequest(config, callback);
    }
    async getCardAttachment(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/attachments/${parameters.idAttachment}`,
            method: 'GET',
            params: {
                fields: parameters.fields,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async deleteCardAttachment(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/attachments/${parameters.idAttachment}`,
            method: 'DELETE',
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardBoard(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/board`,
            method: 'GET',
            params: {
                fields: parameters.fields,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardCompletedChecklists(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/checkItemStates`,
            method: 'GET',
            params: {
                fields: parameters.fields,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardChecklists(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/checklists`,
            method: 'GET',
            params: {
                checkItems: parameters.checkItems,
                checkItem_fields: parameters.checkItemFields,
                filter: parameters.filter,
                fields: parameters.fields,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async createCardChecklist(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/checklists`,
            method: 'POST',
            params: {
                name: parameters.name,
                idChecklistSource: parameters.idChecklistSource,
                pos: parameters.pos,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardChecklistItem(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/checkItem/${parameters.idCheckItem}`,
            method: 'GET',
            params: {
                fields: parameters.fields,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async updateCardCheckItem(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/checkItem/${parameters.idCheckItem}`,
            method: 'PUT',
            params: {
                name: parameters.name,
                state: parameters.state,
                idChecklist: parameters.idChecklist,
                pos: parameters.pos,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async deleteCardChecklistItem(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/checkItem/${parameters.idCheckItem}`,
            method: 'DELETE',
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardList(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/list`,
            method: 'GET',
            params: {
                fields: parameters.fields,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardMembers(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/members`,
            method: 'GET',
            params: {
                fields: parameters.fields,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardMembersVoted(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/membersVoted`,
            method: 'GET',
            params: {
                fields: parameters.fields,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async voteOnCardForGivenMember(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/membersVoted`,
            method: 'POST',
            params: {
                value: parameters.value,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardPluginData(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/pluginData`,
            method: 'GET',
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardStickers(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/stickers`,
            method: 'GET',
            params: {
                fields: parameters.fields,
            },
            data: parameters.body,
        };
        return this.client.sendRequest(config, callback);
    }
    async addStickerToCard(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/stickers`,
            method: 'POST',
            params: {
                image: parameters.image,
                top: parameters.top,
                left: parameters.left,
                zIndex: parameters.zIndex,
                rotate: parameters.rotate,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardSticker(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/stickers/${parameters.idSticker}`,
            method: 'GET',
            params: {
                fields: parameters.fields,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async updateCardSticker(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/stickers/${parameters.idSticker}`,
            method: 'PUT',
            params: {
                top: parameters.top,
                left: parameters.left,
                zIndex: parameters.zIndex,
                rotate: parameters.rotate,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async deleteCardSticker(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/stickers/${parameters.idSticker}`,
            method: 'DELETE',
        };
        return this.client.sendRequest(config, callback);
    }
    async updateCardComment(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/actions/${parameters.idAction}/comments`,
            method: 'PUT',
            params: {
                text: parameters.text,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async deleteCardComment(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/actions/${parameters.idAction}/comments`,
            method: 'DELETE',
        };
        return this.client.sendRequest(config, callback);
    }
    async updateCardCustomField(parameters, callback) {
        const config = {
            url: `/cards/${parameters.idCard}/customField/${parameters.idCustomField}/item`,
            method: 'PUT',
        };
        return this.client.sendRequest(config, callback);
    }
    async getCardCustomFields(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/customFieldItems`,
            method: 'GET',
        };
        return this.client.sendRequest(config, callback);
    }
    async addCardComment(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/actions/comments`,
            method: 'POST',
            params: {
                text: parameters.text,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async addCardLabel(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/idLabels`,
            method: 'POST',
            params: {
                value: parameters.value,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async addCardMember(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/idMembers`,
            method: 'POST',
            params: {
                value: parameters.value,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async createCardLabel(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/labels`,
            method: 'POST',
            params: {
                color: parameters.color,
                name: parameters.name,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async markCardNotificationAsRead(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/markAssociatedNotificationsRead`,
            method: 'POST',
        };
        return this.client.sendRequest(config, callback);
    }
    async deleteCardLabel(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/idLabels/${parameters.idLabel}`,
            method: 'DELETE',
        };
        return this.client.sendRequest(config, callback);
    }
    async deleteCardMember(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/idMembers/${parameters.idMember}`,
            method: 'DELETE',
        };
        return this.client.sendRequest(config, callback);
    }
    async deleteCardMemberVote(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/membersVoted/${parameters.idMember}`,
            method: 'DELETE',
        };
        return this.client.sendRequest(config, callback);
    }
    async updateCardChecklistItem(parameters, callback) {
        const config = {
            url: `/cards/${parameters.idCard}/checklist/${parameters.idChecklist}/checkItem/${parameters.idCheckItem}`,
            method: 'PUT',
            params: {
                pos: parameters.pos,
            },
        };
        return this.client.sendRequest(config, callback);
    }
    async deleteCardChecklist(parameters, callback) {
        const config = {
            url: `/cards/${parameters.id}/checklists/${parameters.idChecklist}`,
            method: 'DELETE',
        };
        return this.client.sendRequest(config, callback);
    }
}
exports.Cards = Cards;
