@icosense/connect
v0.2.17
Published
weclapp REST API client for nodejs
Downloads
35
Readme
weclapp-connect provides a way to communicate with the weclapp/rest api through a simple and easy-to-use nodejs module.
Installation
Install via npm:
$ npm install @weclapp/connect
Install via yarn:
$ yarn add @weclapp/connect
Quickstart
const weclapp = require('@icosense/connect')
(async () => {
// Authenticate
const user = weclapp({
username: '<string>',
apikey: '<string>',
// One of the following
tenant: '<string>', // Example: myapp
domain: '<string>', // Example: app.company.com
})
// Prints the current user to the console
console.log(user)
})()
Example: Request time records
const weclapp = require('@weclapp/connect')
(async () => {
const user = weclapp(<config>)
// Prints time-records to the console
console.log(await user.fetch('timeRecord'))
})()
API
weclapp({
username: String, // Your weclapp username
apikey: String, // Weclapp token / apikey. Keep this private.
tenant: String, // Your weclapp sub-domain. eg. in hello.weclapp.com the tenant is hello
})
Instance functions
async fetch(endpoint, {method = 'GET', body} = {}) // Customized request
async convertLeadToCustomer(fetch, id)
async createAdvancePaymentRequestSalesOrderForId(fetch, id, body)
async createArticle(fetch, body)
async createArticleCategory(fetch, body)
async createArticleSupplySource(fetch, body)
async createBookIncomingMovement(fetch, body)
async createBookOutgoingMovement(fetch, body)
async createBookTransferMovement(fetch, body)
async createCampaign(fetch, body)
async createCampaignParticipant(fetch, body)
async createCancelOrManualSalesOrderForId(fetch, id, body)
async createComment(fetch, body)
async createCompanySize(fetch, body)
async createCompensationShipmentForIncomingGood(fetch, id, body)
async createContact(fetch, body)
async createContactImageForId(fetch, id, body)
async createContract(fetch, body)
async createContractImageForId(fetch, id, body)
async createCreditNoteForIncomingGood(fetch, id, body)
async createCustomer(fetch, body)
async createCustomerCategory(fetch, body)
async createCustomerForId(fetch, id, body)
async createCustomerLeadLossReason(fetch, body)
async createCustomerReturnForId(fetch, id, body)
async createCustomerTopic(fetch, body)
async createCustomsTariffNumber(fetch, body)
async createDocument(fetch, {id, comment}, body)
async createEntityDocument(fetch, {entityName, entityId, name, description}, body)
async createIncomingGoods(fetch, body)
async createLead(fetch, body)
async createLeadImageForId(fetch, id, body)
async createLeadSource(fetch, body)
async createManualCloseSalesOrderForId(fetch, id, body)
async createManufacturer(fetch, body)
async createOpportunityWinLossReason(fetch, body)
async createPartPaymentInvoiceForId(fetch, id, body)
async createPaymentMethod(fetch, body)
async createPrepaymentInvoiceForId(fetch, id, body)
async createProductionOrder(fetch, body)
async createPurchaseOrder(fetch, id, body)
async createQuotation(fetch, body)
async createSalesInvoice(fetch, body)
async createSalesInvoiceForId(fetch, id, body)
async createSalesOrder(fetch, body)
async createSalesStage(fetch, body)
async createSector(fetch, body)
async createShipment(fetch, body)
async createShipmentForId(fetch, id, body)
async createShipmentMethod(fetch, body)
async createSupplier(fetch, body)
async createSupplierImageForId(fetch, id, body)
async createTax(fetch, body)
async createTermOfPayment(fetch, body)
async createTicket(fetch, body)
async createTicketExtraInfoForAppForId(fetch, id, body)
async createUnit(fetch, body)
async createVariantArticle(fetch, body)
async createVariantArticleAttribute(fetch, body)
async deleteArchievedEmailById(fetch, id)
async deleteArticleById(fetch, id)
async deleteArticleCategoryById(fetch, id)
async deleteCampaignById(fetch, id)
async deleteCampaignParticipantById(fetch, id)
async deleteCommentById(fetch, id)
async deleteCompanySizeById(fetch, id)
async deleteContactById(fetch, id)
async deleteContractById(fetch, id)
async deleteCustomerById(fetch, id)
async deleteCustomerCategoryById(fetch, id)
async deleteCustomerLeadLossReasonById(fetch, id)
async deleteCustomerTopicById(fetch, id)
async deleteCustomsTariffNumberById(fetch, id)
async deleteDocumentById(fetch, id)
async deleteLeadById(fetch, id)
async deleteLeadSourceById(fetch, id)
async deleteManufacturerById(fetch, id)
async deleteOpportunityWinLossReasonById(fetch, id)
async deletePaymentMethodById(fetch, id)
async deleteProductionOrderById(fetch, id)
async deleteQuotationById(fetch, id)
async deleteSalesStageById(fetch, id)
async deleteSectorById(fetch, id)
async deleteShipmentMethodById(fetch, id)
async deleteSupplierById(fetch, id)
async deleteTaxById(fetch, id)
async deleteTermOfPaymentById(fetch, id)
async deleteUnitById(fetch, id)
async deleteVariantArticleAttributeById(fetch, id)
async deleteVariantArticleById(fetch, id)
async getArchievedEmailById(fetch, id)
async getArchievedEmailCount(fetch)
async getArchievedEmails(fetch)
async getArticleById(fetch, id)
async getArticleCategories(fetch, {page, pageSize, sort})
async getArticleCategoryById(fetch, id)
async getArticleCategoryCount(fetch)
async getArticleCount(fetch)
async getArticleImage(fetch, {id, articleImageId, preview = false, scaleWidth, scaleHeight})
async getArticlePriceById(fetch, id)
async getArticlePriceCount(fetch)
async getArticlePrices(fetch, {page, pageSize, sort})
async getArticleSupplySourceById(fetch, id)
async getArticleSupplySourceCount(fetch)
async getArticleSupplySources(fetch, {page, pageSize, sort})
async getArticles(fetch, {page, pageSize = 50, sort})
async getBatchNumberById(fetch, id)
async getBatchNumberCount(fetch)
async getBatchNumbers(fetch, {page, pageSize, sort})
async getCampaignById(fetch, id)
async getCampaignParticipantById(fetch, id)
async getCampaignParticipantCount(fetch)
async getCampaignParticipants(fetch, {page, pageSize, sort})
async getCampaigns(fetch, {page, pageSize, sort})
async getCampaignsCount(fetch)
async getCommentById(fetch, id)
async getCommentCount(fetch)
async getComments(fetch, {page, pageSize, sort})
async getCommercialLanguageById(fetch, id)
async getCommercialLanguageCount(fetch)
async getCommercialLanguages(fetch, {page, pageSize, sort})
async getCompanyCurrency(fetch)
async getCompanySizeById(fetch, id)
async getCompanySizeCount(fetch)
async getCompanySizes(fetch, {page, pageSize, sort})
async getContactById(fetch, id)
async getContactCount(fetch)
async getContactImageById(fetch, {id, scaleWidth, scaleHeight})
async getContacts(fetch, {page, pageSize, sort})
async getContractById(fetch, id)
async getContractImageById(fetch, {id, scaleWidth, scaleHeight})
async getContracts(fetch, {page, pageSize, sort})
async getCurrencies(fetch, {page, pageSize, sort})
async getCurrencyById(fetch, id)
async getCurrencyCount(fetch)
async getCustomAttributeDefinitionById(fetch, id)
async getCustomAttributeDefinitionByIds(fetch, ids)
async getCustomAttributeDefinitionCount(fetch)
async getCustomAttributeDefinitions(fetch, {page, pageSize, sort})
async getCustomerById(fetch, id)
async getCustomerCategories(fetch, {page, pageSize, sort})
async getCustomerCategoryById(fetch, id)
async getCustomerCategoryCount(fetch)
async getCustomerCount(fetch)
async getCustomerImageById(fetch, {id, scaleWidth, scaleHeight})
async getCustomerLeadLossReasonById(fetch, id)
async getCustomerLeadLossReasonCount(fetch)
async getCustomerLeadLossReasons(fetch, {page, pageSize, sort})
async getCustomerTopicById(fetch, id)
async getCustomerTopicCount(fetch)
async getCustomerTopics(fetch, {page, pageSize, sort})
async getCustomers(fetch, {page, pageSize, sort})
async getCustomsTariffNumberById(fetch, id)
async getCustomsTariffNumberCount(fetch)
async getCustomsTariffNumbers(fetch, {page, pageSize, sort})
async getDocument(fetch)
async getDocumentAsDownloadById(fetch, id)
async getDocumentById(fetch, id)
async getDocumentCount(fetch)
async getDocumentVersion(fetch, id)
async getFulfillmentProviderById(fetch, id)
async getFulfillmentProviderCount(fetch)
async getFulfillmentProviders(fetch, {page, pageSize, sort})
async getIncomingGoods(fetch, {page, pageSize, sort})
async getIncomingGoodsById(fetch, id)
async getIncomingGoodsCount(fetch)
async getLatestDeliveryNotePdfId(fetch, id)
async getLatestOrderConfirmationPdfId(fetch, id)
async getLatestPickingListPdfById(fetch, id)
async getLatestProductionOrderPdfProductionOrderById(fetch, id)
async getLatestQuotationPdfById(fetch, id)
async getLatestSalesInvoicePdfById(fetch, id)
async getLatestShippingLabelPdfById(fetch, id)
async getLeadById(fetch, id)
async getLeadCount(fetch)
async getLeadImage(fetch, {id, scaleWidth, scaleHeight})
async getLeadSourceById(fetch, id)
async getLeadSourceCount(fetch)
async getLeadSources(fetch, {page, pageSize, sort})
async getLeads(fetch, {page, pageSize, sort})
async getManufacturerById(fetch, id)
async getManufacturerCount(fetch)
async getManufacturers(fetch, {page, pageSize, sort})
async getMetaQueryFilterProperties(fetch, resource)
async getMetaQuerySortProperties(fetch, resource)
async getMetaRessources(fetch)
async getOpportunityWinLossReasonById(fetch, id)
async getOpportunityWinLossReasonCount(fetch)
async getOpportunityWinLossReasons(fetch, {page, pageSize, sort})
async getParties(fetch, {page, pageSize, sort})
async getPartyById(fetch, id)
async getPartyCount(fetch)
async getPaymentMethodById(fetch, id)
async getPaymentMethodCount(fetch)
async getPaymentMethods(fetch, {page, pageSize, sort})
async getProductionOrderById(fetch, id)
async getProductionOrderCount(fetch)
async getProductionOrders(fetch, {page, pageSize, sort})
async getPurchaseOrderById(fetch, id)
async getPurchaseOrderCount(fetch)
async getPurchaseOrders(fetch, {page, pageSize, sort})
async getQuotationById(fetch, id)
async getQuotationCount(fetch)
async getQuotations(fetch, {page, pageSize, sort})
async getSalesChannel(fetch)
async getSalesInvoiceById(fetch, id)
async getSalesInvoiceCount(fetch)
async getSalesInvoices(fetch, {page, pageSize, sort})
async getSalesOrderById(fetch, id)
async getSalesOrderCount(fetch)
async getSalesOrderForCustomer(fetch, {customerId, responsibleUserId})
async getSalesOrders(fetch, {page, pageSize, sort})
async getSalesStageById(fetch, id)
async getSalesStageCount(fetch)
async getSalesStages(fetch, {page, pageSize, sort})
async getSectorById(fetch, id)
async getSectorCount(fetch)
async getSectors(fetch, {page, pageSize, sort})
async getSerialNumberById(fetch, id)
async getSerialNumberCount(fetch)
async getSerialNumbers(fetch, {page, pageSize, sort})
async getShipmentById(fetch, id)
async getShipmentCount(fetch)
async getShipmentMethodById(fetch, id)
async getShipmentMethodCount(fetch)
async getShipmentMethods(fetch, {page, pageSize, sort})
async getShipments(fetch, {page, pageSize, sort})
async getSupplierById(fetch, id)
async getSupplierImage(fetch, {id, scaleWidth, scaleHeight})
async getSuppliers(fetch)
async getTaxById(fetch, id)
async getTaxCount(fetch)
async getTaxFor(fetch, {dispatchCountryCode, recipientCountryCode, taxRateType, partyType})
async getTaxes(fetch, {page, pageSize, sort})
async getTermOfPaymentById(fetch, id)
async getTermOfPaymentCount(fetch)
async getTermsOfPayment(fetch, {page, pageSize, sort})
async getTicketById(fetch, id)
async getTicketCount(fetch)
async getTicketExtraInfoForAppById(fetch, {id})
async getTickets(fetch, {page, pageSize, sort})
async getUnitById(fetch, id)
async getUnitCount(fetch)
async getUnits(fetch, {page, pageSize, sort})
async getUser(fetch)
async getUserById(fetch, id)
async getUserCount(fetch)
async getUserImageById(fetch, id)
async getUserImageThumbnailById(fetch, id)
async getUsers(fetch, {page, pageSize, sort})
async getVariantArticleAttributeById(fetch, id)
async getVariantArticleAttributeCount(fetch)
async getVariantArticleAttributes(fetch, {page, pageSize, sort})
async getVariantArticleById(fetch, id)
async getVariantArticleCount(fetch)
async getVariantArticleVariantById(fetch, id)
async getVariantArticleVariantCount(fetch)
async getVariantArticleVariants(fetch, {page, pageSize, sort})
async getVariantArticles(fetch, {page, pageSize, sort})
async getWarehouseById(fetch, id)
async getWarehouseCount(fetch)
async getWarehouseLevelById(fetch, id)
async getWarehouseLevelCount(fetch)
async getWarehouseLevels(fetch, {page, pageSize, sort})
async getWarehouseStockById(fetch, id)
async getWarehouseStockCount(fetch)
async getWarehouseStockMovementById(fetch, id)
async getWarehouseStockMovementCount(fetch)
async getWarehouseStockMovements(fetch, {page, pageSize, sort})
async getWarehouseStocks(fetch, {page, pageSize, sort})
async getWarehouses(fetch, {page, pageSize, sort})
async updateArticleById(fetch, {id, body})
async updateArticleCategoryForId(fetch, id, body)
async updateArticleSupplySourceForId(fetch, id, body)
async updateCampaignForId(fetch, id, body)
async updateCampaignParticipantForId(fetch, id, body)
async updateCommentForId(fetch, id, body)
async updateCompanySizeForId(fetch, id, body)
async updateContactForId(fetch, id, body)
async updateContractForId(fetch, id, body)
async updateCustomerCategoryForId(fetch, id, body)
async updateCustomerForId(fetch, id, body)
async updateCustomerLeadLossReasonForId(fetch, id, body)
async updateCustomerTopicForId(fetch, id, body)
async updateCustomsTariffNumberForId(fetch, id, body)
async updateDocumentForId(fetch, id, body)
async updateIncomingGoodsForId(fetch, id, body)
async updateLeadForId(fetch, id, body)
async updateLeadSourceForId(fetch, id, body)
async updateManufacturerForId(fetch, id, body)
async updateOpportunityWinLossReasonForId(fetch, id, body)
async updatePaymentMethodForId(fetch, id, body)
async updateProductionOrderForId(fetch, id, body)
async updatePurchaseOrder(fetch, id, body)
async updateQuotationForId(fetch, id, body)
async updateSalesInvoiceForId(fetch, id, body)
async updateSalesOrderForId(fetch, id, body)
async updateSalesStageForId(fetch, id, body)
async updateSectorForId(fetch, id, body)
async updateShipmentForId(fetch, id, body)
async updateShipmentMethodForId(fetch, id, body)
async updateSupplierForId(fetch, id, body)
async updateTaxForId(fetch, id, body)
async updateTermOfPaymentForId(fetch, id, body)
async updateTicketForId(fetch, id, body)
async updateUnitForId(fetch, id, body)
async updateVariantArticleAttributeForId(fetch, id, body)
async updateVariantArticleForId(fetch, id, body)
async uploadArticleImage(fetch, {id, name, mainImage}, body)
License
This project is available under the MIT license.