### Document Data Models (Examples) Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/README.md Provides examples of data models used for various financial entities within the Fatture in Cloud SDK. These models represent structures for products, receipts, received documents, and suppliers. ```typescript export interface Product { id?: number; name?: string; description?: string; code?: string; default_price?: number; default_vat?: VatType; in_stock?: boolean; // ... other properties } export interface Receipt { id?: number; date?: string; number?: number; // ... other properties } export interface ReceivedDocument { id?: number; date?: string; description?: string; // ... other properties } export interface Supplier { id?: number; name?: string; // ... other properties } ``` -------------------------------- ### Install FattureInCloud JavaScript SDK with yarn Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/README.md Install the FattureInCloud JavaScript SDK for Node.js using yarn. This provides an alternative package manager for installing the SDK. ```shell yarn add @fattureincloud/fattureincloud-js-sdk ``` -------------------------------- ### Install FattureInCloud JavaScript SDK with npm Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/README.md Install the FattureInCloud JavaScript SDK for Node.js using npm. This is the primary method for integrating the SDK into your Node.js projects. ```shell npm install @fattureincloud/fattureincloud-js-sdk ``` -------------------------------- ### GET /info/currencies Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md Lists all supported currencies. ```APIDOC ## GET /info/currencies ### Description Lists the supported currencies. ### Method GET ### Endpoint /info/currencies ### Parameters This endpoint does not need any parameters. ### Request Example ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.InfoApi(); apiInstance.listCurrencies().then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` ### Response #### Success Response (200) - **ListCurrenciesResponse** (Object) - The response object containing a list of currencies. #### Response Example (Refer to the SDK's ListCurrenciesResponse model for exact structure) ``` -------------------------------- ### GET /info/templates Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md Retrieves a list of available templates. ```APIDOC ## GET /info/templates ### Description Lists the templates. ### Method GET ### Endpoint /info/templates ### Request Example ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.InfoApi(); apiInstance.listTemplates().then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` ### Response #### Success Response (200) - **ListTemplatesResponse** (Object) - Details of the templates. #### Response Example ```json { "data": [ { "template_name": "Modello base" }, { "template_name": "Modello moderno" } ] } ``` ``` -------------------------------- ### Upload Document Attachment with Fatture in Cloud JS SDK Source: https://context7.com/fattureincloud/fattureincloud-js-sdk/llms.txt This example demonstrates how to upload a file as an attachment to an issued document using the Fatture in Cloud JavaScript SDK. It first reads a local PDF file, converts it to base64, uploads it to get an attachment token, and then uses this token when creating a new invoice. Error handling for both upload and creation is included. ```javascript const fattureInCloudSdk = require('@fattureincloud/fattureincloud-js-sdk'); const fs = require('fs'); const defaultClient = fattureInCloudSdk.ApiClient.instance; const OAuth2 = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2.accessToken = 'YOUR_ACCESS_TOKEN'; const issuedDocumentsApi = new fattureInCloudSdk.IssuedDocumentsApi(); const companyId = 12345; // First, upload the attachment to get a token const fileContent = fs.readFileSync('./contract.pdf'); const base64Content = fileContent.toString('base64'); const uploadOptions = { filename: 'contract.pdf', attachment: base64Content }; issuedDocumentsApi.uploadIssuedDocumentAttachment(companyId, uploadOptions) .then((uploadResult) => { console.log('Attachment uploaded, token:', uploadResult.attachment_token); // Now create or update document with the attachment token const documentData = { createIssuedDocumentRequest: { data: { type: "invoice", date: "2024-01-15", entity: { id: 54321 }, attachment_token: uploadResult.attachment_token, items_list: [ { name: "Service", qty: 1, net_price: 1000 } ] } } }; return issuedDocumentsApi.createIssuedDocument(companyId, documentData); }) .then((result) => { console.log('Invoice created with attachment'); console.log('Document ID:', result.data.id); console.log('Attachment URL:', result.data.attachment_url); }) .catch((error) => { console.error('Error:', error.status, error.message); }); ``` -------------------------------- ### GET /info/countries Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md Lists all supported countries. ```APIDOC ## GET /info/countries ### Description Lists the supported countries. ### Method GET ### Endpoint /info/countries ### Parameters This endpoint does not need any parameters. ### Request Example ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.InfoApi(); apiInstance.listCountries().then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` ### Response #### Success Response (200) - **ListCountriesResponse** (Object) - The response object containing a list of countries. #### Response Example (Refer to the SDK's ListCountriesResponse model for exact structure) ``` -------------------------------- ### GET /info/currencies Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md Retrieves a list of available currencies. ```APIDOC ## GET /info/currencies ### Description Lists the currencies. ### Method GET ### Endpoint /info/currencies ### Request Example ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.InfoApi(); apiInstance.listCurrencies().then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` ### Response #### Success Response (200) - **ListCurrenciesResponse** (Object) - Details of the currencies. #### Response Example ```json { "data": [ { "id": "EUR", "name": "Euro", "symbol": "€" } ] } ``` ``` -------------------------------- ### GET /info/languages Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md Retrieves a list of available languages. ```APIDOC ## GET /info/languages ### Description Lists the languages. ### Method GET ### Endpoint /info/languages ### Request Example ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.InfoApi(); apiInstance.listLanguages().then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` ### Response #### Success Response (200) - **ListLanguagesResponse** (Object) - Details of the languages. #### Response Example ```json { "data": [ { "id": "it", "name": "Italiano" } ] } ``` ``` -------------------------------- ### GET /settings/tax_profiles Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/SettingsApi.md Retrieves the Tax Profile details for the company. ```APIDOC ## getTaxProfile ### Description Gets the Tax Profile. ### Method GET ### Endpoint `/settings/tax_profiles` ### Parameters #### Path Parameters - **companyId** (Number) - Required - The ID of the company. ### Request Example ```javascript // Example for using the SDK to call getTaxProfile let apiInstance = new fattureInCloudSdk.SettingsApi(); let companyId = 12345; apiInstance.getTaxProfile(companyId).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` ### Response #### Success Response (200) - **GetTaxProfileResponse** - Details of the tax profile. #### Response Example ```json { "data": { "default_id": 1, "default_country": "IT", "apply_withholding_tax": false, "default_eu_sovrice": "0000000" } } ``` ### Authorization OAuth2AuthenticationCodeFlow ``` -------------------------------- ### GET /info/measures Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md Retrieves a list of units of measure. ```APIDOC ## GET /info/measures ### Description Lists the units of measure. ### Method GET ### Endpoint /info/measures ### Request Example ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.InfoApi(); apiInstance.listUnitsOfMeasure().then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` ### Response #### Success Response (200) - **ListUnitsOfMeasureResponse** (Object) - Details of the units of measure. #### Response Example ```json { "data": [ { "id": "cm", "name": "Centimetro" } ] } ``` ``` -------------------------------- ### Products API - Get Product Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/ProductsApi.md Retrieves the details of a specific product. ```APIDOC ## GET /c/{company_id}/products/{product_id} ### Description Gets the specified product. ### Method GET ### Endpoint /c/{company_id}/products/{product_id} ### Parameters #### Path Parameters - **company_id** (Number) - Required - The ID of the company. - **product_id** (Number) - Required - The ID of the product. #### Query Parameters - **fields** (String) - Optional - List of comma-separated fields to include in the response. - **fieldset** (String) - Optional - Name of the fieldset to include in the response. ### Response #### Success Response (200) - **GetProductResponse** (GetProductResponse) - The response object containing the product details. #### Response Example ```json { "data": { "id": 56, "name": "Prodotto di esempio", "code": "PROD001", "description": "Descrizione del prodotto di esempio", "category": "Elettronica", "default_price": null, "net_price": 100, "net_cost": 0, "measure": "", "in_stock": true, "default_stock": null, "weight": null, "volume": null, "sku": null, "ean": null, "notes": null, "created_at": "2023-01-01T10:00:00Z", "updated_at": "2023-01-01T10:00:00Z", "default_vat": { "id": 1, "value": 22, "name": "IVA 22%", "is_disabled": false }, "hide_dimensions": false } } ``` ``` -------------------------------- ### Create Product Source: https://context7.com/fattureincloud/fattureincloud-js-sdk/llms.txt Add a new product to the catalog. Requires product details such as name, price, and category. ```APIDOC ## Create Product ### Description Add a new product to the catalog. Requires product details such as name, price, and category. ### Method POST ### Endpoint `/companies/{company_id}/products` ### Parameters #### Path Parameters - **company_id** (integer) - Required - The ID of the company. #### Request Body - **createProductRequest** (object) - Required - The request object containing product data. - **data** (object) - Required - The product data. - **name** (string) - Required - The name of the product. - **code** (string) - Optional - The product code. - **net_price** (number) - Required - The net price of the product. - **net_cost** (number) - Optional - The net cost of the product. - **measure** (string) - Optional - The unit of measure (e.g., 'pz', 'kg'). - **description** (string) - Optional - A description of the product. - **category** (string) - Optional - The product category. - **in_stock** (boolean) - Optional - Whether the product is in stock. - **default_vat** (object) - Optional - The default VAT for the product. - **id** (integer) - Required - The VAT ID. - **value** (number) - Required - The VAT percentage. - **description** (string) - Optional - The VAT description. - **is_disabled** (boolean) - Optional - Whether the VAT is disabled. ### Request Example ```json { "createProductRequest": { "data": { "name": "Tavolo di marmo", "code": "TAVOLO003", "net_price": 240.00, "net_cost": 150.00, "measure": "pz", "description": "Tavolo in marmo pregiato", "category": "arredamento", "in_stock": true, "default_vat": { "id": 3, "value": 22, "description": "Aliquota ordinaria", "is_disabled": false } } } } ``` ### Response #### Success Response (200) - **data** (object) - The created product object. - **id** (integer) - The ID of the created product. - **code** (string) - The code of the created product. - **name** (string) - The name of the created product. #### Response Example ```json { "data": { "id": 98765, "code": "TAVOLO003", "name": "Tavolo di marmo" } } ``` ``` -------------------------------- ### Get Issued Document with Fatture in Cloud JS SDK Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/IssuedDocumentsApi.md Retrieves a specific issued document using its company ID and document ID. Optional parameters allow filtering by fields or fieldsets. The example demonstrates setting up OAuth2 authentication and making the API call. ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; // Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.IssuedDocumentsApi(); let companyId = 12345; // Number | The ID of the company. let documentId = 56; // Number | The ID of the document. let opts = { 'fields': "fields_example", // String | List of comma-separated fields. 'fieldset': "fieldset_example" // String | Name of the fieldset. }; apiInstance.getIssuedDocument(companyId, documentId, opts).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` -------------------------------- ### Get Issued Document Pre-Create Info with Fatture in Cloud JS SDK Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/IssuedDocumentsApi.md Obtains information necessary for creating a new issued document, such as available document types. This function requires the company ID and the document type. The example shows how to configure OAuth2 authentication before making the call. ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; // Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.IssuedDocumentsApi(); let companyId = 12345; // Number | The ID of the company. let type = "type_example"; // String | The type of the issued document. apiInstance.getIssuedDocumentPreCreateInfo(companyId, type).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` -------------------------------- ### Get Issued Document Totals with Fatture in Cloud JS SDK Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/IssuedDocumentsApi.md Fetches the totals for an existing issued document, allowing for modifications like updating 'rivalsa'. It requires company ID, document ID, and optionally a request body to specify changes. The example uses OAuth2 authentication. ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; // Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.IssuedDocumentsApi(); let companyId = 12345; // Number | The ID of the company. let documentId = 56; // Number | The ID of the document. let opts = { 'getExistingIssuedDocumentTotalsRequest': {"data":{"rivalsa":20}} // GetExistingIssuedDocumentTotalsRequest | }; apiInstance.getExistingIssuedDocumentTotals(companyId, documentId, opts).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` -------------------------------- ### Get Supplier using Fatture in Cloud JS SDK Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/SuppliersApi.md This code example demonstrates how to retrieve details of a specific supplier using the Fatture in Cloud JavaScript SDK. It requires the company ID and supplier ID, and uses OAuth2 for authentication. The function returns a GetSupplierResponse object containing the supplier's information. ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; // Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.SuppliersApi(); let companyId = 12345; // Number | The ID of the company. let supplierId = 56; // Number | The ID of the supplier. let opts = { // The 'Fields' parameter can be used to specify a comma-separated list of fields to include in the response. // For example: 'details,notes' }; apiInstance.getSupplier(companyId, supplierId, opts).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` -------------------------------- ### List Receipts with Fatture in Cloud JS SDK Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/ReceiptsApi.md This snippet demonstrates how to list receipts using the Fatture in Cloud JavaScript SDK. It includes authentication setup with OAuth2, instantiates the ReceiptsApi, and makes a call to list receipts with optional query parameters for filtering and pagination. Ensure you have the SDK installed and replace 'YOUR ACCESS TOKEN' with a valid token. ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; // Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.ReceiptsApi(); let companyId = 12345; // Number | The ID of the company. let opts = { 'fields': "fields_example", // String | List of comma-separated fields. 'fieldset': "fieldset_example", // String | Name of the fieldset. 'page': 1, // Number | The page to retrieve. 'perPage': 5, // Number | The size of the page. 'sort': "sort_example", // String | List of comma-separated fields for result sorting (minus for desc sorting). 'q': "q_example" // String | Query for filtering the results. }; apiInstance.listReceipts(companyId, opts).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` -------------------------------- ### List and Filter Clients Source: https://context7.com/fattureincloud/fattureincloud-js-sdk/llms.txt Retrieve and filter clients using query parameters. Allows for flexible filtering based on client attributes. ```APIDOC ## List and Filter Clients ### Description Retrieve and filter clients using query parameters. Allows for flexible filtering based on client attributes. ### Method GET ### Endpoint `/companies/{company_id}/clients` ### Parameters #### Path Parameters - **company_id** (integer) - Required - The ID of the company. #### Query Parameters - **fields** (string) - Optional - Comma-separated list of fields to include in the response. - **fieldset** (string) - Optional - Specifies a predefined set of fields (e.g., 'basic'). - **sort** (string) - Optional - Field to sort the results by (e.g., 'name'). - **page** (integer) - Optional - The page number for pagination. - **perPage** (integer) - Optional - The number of results per page. - **q** (string) - Optional - Query string for filtering clients (can be a complex filter). ### Request Example (See Javascript SDK example for constructing the 'q' parameter) ### Response #### Success Response (200) - **data** (array) - An array of client objects. - **info** (object) - Pagination and result information. #### Response Example ```json { "data": [ { "id": 123, "name": "Acme Corp", "email": "contact@acme.com", "city": "Milano" } ], "info": { "current_page": 1, "total_pages": 5 } } ``` ``` -------------------------------- ### List Fatture in Cloud Templates using JavaScript Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md This snippet demonstrates how to list templates from Fatture in Cloud using the JavaScript SDK. It includes configuring the OAuth2 access token and making a call to the `listTemplates` endpoint with optional parameters for filtering by type and grouping. The result is logged to the console, or an error is caught. ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; // Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.InfoApi(); let opts = { 'type': "'all'", // String | Type of the templates. 'byType': false // Boolean | [Only if type=all] If true, splits the list in objects, grouping templates by type. }; apiInstance.listTemplates(opts).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` -------------------------------- ### Modify Received Document with Fatture in Cloud JS SDK Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/ReceivedDocumentsApi.md This snippet shows how to modify a received document using the Fatture in Cloud JavaScript SDK. It covers API client setup, OAuth2 authentication, and the use of the `modifyReceivedDocument` method. The example includes passing a `modifyReceivedDocumentRequest` object with updated document details. Success or error messages are logged to the console. ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; // Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.ReceivedDocumentsApi(); let companyId = 12345; // Number | The ID of the company. let documentId = 56; // Number | The ID of the document. let opts = { 'modifyReceivedDocumentRequest': {"data":{"type":"expense","description":"Soggiorno di lavoro","amortization":1,"rc_center":"","invoice_number":"","is_marked":false,"is_detailed":false,"e_invoice":false,"entity":{"id":111,"name":"Hotel Rubino Palace"},"date":"2021-08-15","next_due_date":"2021-08-15","currency":{"id":"EUR","exchange_rate":"1.00000","symbol":"€"},"amount_net":592,"amount_vat":0,"amount_gross":592,"amount_withholding_tax":0,"amount_other_withwithholding_tax":0,"tax_deductibility":50,"vat_deductibility":100,"payments_list":[{"amount":592,"due_date":"2021-08-15","paid_date":"2021-08-15","id":777,"payment_terms":{"days":0,"type":"standard"},"status":"paid","payment_account":{"id":222,"name":"Contanti","virtual":false}}]}} }; apiInstance.modifyReceivedDocument(companyId, documentId, opts).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` -------------------------------- ### Create Product with FattureInCloud JavaScript SDK Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/ProductsApi.md This snippet demonstrates how to create a new product using the FattureInCloud JavaScript SDK. It requires authentication and provides an example of the `createProductRequest` object. The function returns a `CreateProductResponse` on success or an error. ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; // Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.ProductsApi(); let companyId = 12345; // Number | The ID of the company. let opts = { 'createProductRequest': {"data":{"name":"Tavolo di marmo","code":"TAVOLO003","net_price":240,"net_cost":0,"measure":"","description":"Tavolo in marmo pregiato","category":"arredamento","in_stock":true,"default_vat":{"id":3,"value":22,"description":"Non imponibile art. 123","notes":"IVA non imponibile ai sensi dell'articolo 123, comma 2","is_disabled":false}}} }; apiInstance.createProduct(companyId, opts).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` -------------------------------- ### GET /c/{company_id}/settings/tax_profile Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/SettingsApi.md Get Tax Profile: Retrieves the tax profile settings for the company. ```APIDOC ## GET /c/{company_id}/settings/tax_profile ### Description Retrieves the tax profile settings for the company. ### Method GET ### Endpoint /c/{company_id}/settings/tax_profile ### Parameters #### Path Parameters - **company_id** (Number) - Required - The ID of the company. ### Response #### Success Response (200) - **GetTaxProfileResponse** (GetTaxProfileResponse) - The response object containing the tax profile details. #### Response Example ```json { "data": { "default_country": "IT", "default_country_iso": "IT", "default_vat": { "id": 123, "name": "IVA 22%", "rate": 22, "description": "IVA Standard", "is_default": true, "house_billing": false }, "use_tax_deduction": false, "apply_withholding_tax": false, "taxable_default": "gross" } } ``` ``` -------------------------------- ### Products API Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/README.md Endpoints for managing products, including creation, retrieval, modification, and deletion. ```APIDOC ## POST /c/{company_id}/products ### Description Create a new product. ### Method POST ### Endpoint /c/{company_id}/products ### Parameters #### Path Parameters - **company_id** (integer) - Required - The ID of the company. #### Request Body - **name** (string) - Required - The name of the product. - **code** (string) - Optional - The product code. ### Request Example ```json { "name": "New Widget", "code": "WIDGET-001" } ``` ### Response #### Success Response (200) - **id** (integer) - The ID of the created product. - **name** (string) - The name of the product. #### Response Example ```json { "id": 101, "name": "New Widget" } ``` ``` ```APIDOC ## DELETE /c/{company_id}/products/{product_id} ### Description Delete a product by its ID. ### Method DELETE ### Endpoint /c/{company_id}/products/{product_id} ### Parameters #### Path Parameters - **company_id** (integer) - Required - The ID of the company. - **product_id** (integer) - Required - The ID of the product to delete. ### Request Example (No request body for DELETE requests) ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Product deleted successfully." } ``` ``` ```APIDOC ## GET /c/{company_id}/products/{product_id} ### Description Get details of a specific product by its ID. ### Method GET ### Endpoint /c/{company_id}/products/{product_id} ### Parameters #### Path Parameters - **company_id** (integer) - Required - The ID of the company. - **product_id** (integer) - Required - The ID of the product. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **id** (integer) - The product ID. - **name** (string) - The product name. #### Response Example ```json { "id": 101, "name": "Example Product" } ``` ``` ```APIDOC ## GET /c/{company_id}/products ### Description List all products for a company. ### Method GET ### Endpoint /c/{company_id}/products ### Parameters #### Path Parameters - **company_id** (integer) - Required - The ID of the company. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **products** (array) - A list of product objects. #### Response Example ```json { "products": [ { "id": 101, "name": "Example Product 1" }, { "id": 102, "name": "Example Product 2" } ] } ``` ``` ```APIDOC ## PUT /c/{company_id}/products/{product_id} ### Description Modify an existing product. ### Method PUT ### Endpoint /c/{company_id}/products/{product_id} ### Parameters #### Path Parameters - **company_id** (integer) - Required - The ID of the company. - **product_id** (integer) - Required - The ID of the product to modify. #### Request Body - **name** (string) - Optional - The new name of the product. - **code** (string) - Optional - The new product code. ### Request Example ```json { "name": "Updated Widget Name" } ``` ### Response #### Success Response (200) - **id** (integer) - The ID of the updated product. - **name** (string) - The updated name of the product. #### Response Example ```json { "id": 101, "name": "Updated Widget Name" } ``` ``` -------------------------------- ### GET /c/{company_id}/settings/vat_types/{vat_type_id} Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/SettingsApi.md Get Vat Type: Retrieves details of a specific VAT type. ```APIDOC ## GET /c/{company_id}/settings/vat_types/{vat_type_id} ### Description Retrieves details of a specific VAT type. ### Method GET ### Endpoint /c/{company_id}/settings/vat_types/{vat_type_id} ### Parameters #### Path Parameters - **company_id** (Number) - Required - The ID of the company. - **vat_type_id** (Number) - Required - The ID of the VAT type to retrieve. ### Response #### Success Response (200) - **GetVatTypeResponse** (GetVatTypeResponse) - The response object containing the VAT type details. #### Response Example ```json { "data": { "id": 123, "name": "IVA 22%", "rate": 22, "description": "IVA Standard", "is_default": true, "house_billing": false } } ``` ``` -------------------------------- ### List Payment Methods using Fatture in Cloud JS SDK Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md This example provides code to list the available payment methods for a company using the Fatture in Cloud JS SDK. It requires OAuth2 authentication and the company ID. Optional parameters for fields, fieldset, and sorting are also shown. ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; // Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.InfoApi(); let companyId = 12345; // Number | The ID of the company. let opts = { 'fields': "fields_example", // String | List of comma-separated fields. 'fieldset': "fieldset_example", // String | Name of the fieldset. 'sort': "sort_example" // String | List of comma-separated fields for result sorting (minus for desc sorting). }; apiInstance.listPaymentMethods(companyId, opts).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` -------------------------------- ### GET /c/{company_id}/info/product_categories Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/InfoApi.md Retrieves a list of product categories for a specified company. ```APIDOC ## GET /c/{company_id}/info/product_categories ### Description Lists the product categories. ### Method GET ### Endpoint /c/{company_id}/info/product_categories ### Parameters #### Path Parameters - **company_id** (Number) - Required - The ID of the company. ### Request Example ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInCloudSdk.ApiClient.instance; let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.InfoApi(); let companyId = 12345; apiInstance.listProductCategories(companyId).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` ### Response #### Success Response (200) - **ListProductCategoriesResponse** (Object) - Details of the product categories. #### Response Example ```json { "data": [ { "id": 1, "name": "Product Category Name", "default": true } ] } ``` ``` -------------------------------- ### GET /c/{company_id}/settings/payment_methods/{payment_method_id} Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/SettingsApi.md Get Payment Method: Retrieves details of a specific payment method. ```APIDOC ## GET /c/{company_id}/settings/payment_methods/{payment_method_id} ### Description Retrieves details of a specific payment method. ### Method GET ### Endpoint /c/{company_id}/settings/payment_methods/{payment_method_id} ### Parameters #### Path Parameters - **company_id** (Number) - Required - The ID of the company. - **payment_method_id** (Number) - Required - The ID of the payment method to retrieve. ### Response #### Success Response (200) - **GetPaymentMethodResponse** (GetPaymentMethodResponse) - The response object containing the payment method details. #### Response Example ```json { "data": { "id": 386683, "name": "Bonifico bancario", "is_default": true, "type": "standard", "details": [ { "title": "Banca", "description": "Sao Paulo" } ], "default_payment_account": { "id": 12345, "name": "conto banca SP" } } } ``` ``` -------------------------------- ### GET /c/{company_id}/settings/payment_accounts/{payment_account_id} Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/SettingsApi.md Get Payment Account: Retrieves details of a specific payment account. ```APIDOC ## GET /c/{company_id}/settings/payment_accounts/{payment_account_id} ### Description Retrieves details of a specific payment account. ### Method GET ### Endpoint /c/{company_id}/settings/payment_accounts/{payment_account_id} ### Parameters #### Path Parameters - **company_id** (Number) - Required - The ID of the company. - **payment_account_id** (Number) - Required - The ID of the payment account to retrieve. ### Response #### Success Response (200) - **GetPaymentAccountResponse** (GetPaymentAccountResponse) - The response object containing the payment account details. #### Response Example ```json { "data": { "id": 12345, "name": "Indesa", "type": "bank", "iban": "IT17Q0051343200000003497636", "sia": "T1234", "virtual": false } } ``` ``` -------------------------------- ### GET /entities/clients/info Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/ClientsApi.md Retrieves pre-creation information for a new client within a specified company. ```APIDOC ## GET /entities/clients/info ### Description Retrieves the information useful while creating a new Client. ### Method GET ### Endpoint `/entities/clients/info` ### Parameters #### Query Parameters - **companyId** (Number) - Required - The ID of the company. ### Request Example ```javascript import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk'; let defaultClient = fattureInSdk.ApiClient.instance; let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow']; OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN'; let apiInstance = new fattureInCloudSdk.ClientsApi(); let companyId = 12345; apiInstance.getClientInfo(companyId).then((result) => { console.log('API called successfully. Returned result: ' + JSON.stringify(result)); }, (error) => { console.error(error); }); ``` ### Response #### Success Response (200) - **GetEntityClientPreCreateInfoResponse** (Object) - Contains pre-creation information for clients. #### Response Example (See SDK for full response structure, typically returned as a JSON object) ``` -------------------------------- ### Get Tax Profile Response Object Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/GetTaxProfileResponse.md This object represents the response structure for the Get Tax Profile API call. It includes a 'data' field which holds the TaxProfile object if available. ```APIDOC ## Get Tax Profile Response ### Description Represents the response object for retrieving tax profile information. ### Properties #### data (TaxProfile) - Optional - **data** (TaxProfile) - The tax profile details. This field is optional. ### Response Example ```json { "data": { "id": 12345, "name": "VAT Standard", "perceived_turnover_condition": 10000, "include_in_auto_matching": true, "use_for_pensions": false, "vat_deductibility_id": 1, "apply_invoicing_without_tax": false, "apply_withholding_tax_id": 1 } } ``` ``` -------------------------------- ### GET /c/{company_id}/cashbook/{document_id} Source: https://github.com/fattureincloud/fattureincloud-js-sdk/blob/master/docs/CashbookApi.md Gets the specified cashbook entry. Retrieves detailed information about a single cashbook entry identified by its document ID. ```APIDOC ## GET /c/{company_id}/cashbook/{document_id} ### Description Gets the specified cashbook entry. ### Method GET ### Endpoint /c/{company_id}/cashbook/{document_id} ### Parameters #### Path Parameters - **company_id** (Number) - Required - The ID of the company. - **document_id** (String) - Required - The ID of the cashbook entry. #### Query Parameters - **fields** (String) - Optional - Comma-separated list of fields to retrieve. - **exclude_totals** (Boolean) - Optional - Whether to exclude totals from the response. ### Response #### Success Response (200) - **GetCashbookEntryResponse** (object) - Details of the requested cashbook entry. #### Response Example ```json { "data": { "id": "cbk_entry_id", "date": "2021-08-24", "amount_in": 122, "amount_out": null, "payment_account_in": { "id": 333, "name": "Conto Corrente" }, "payment_account_out": null, "description": "Fattura n. 201/2021", "entity_name": "Rossi S.r.l.", "entity_id": 98765, "category": "Fatture Ricevute", "kind": "issued_document", "document": { "id": 54321, "type": "f", "year": 2021, "position": 201 }, "created_at": "2023-10-27T10:30:00.000Z", "updated_at": "2023-10-27T10:30:00.000Z" } } ``` ```