Overview
Thesiat.New() function creates and initializes a new instance of the SIAT services client. This is the entry point for interacting with all SIAT API services including operations, synchronization, codes, and sales.
Function Signature
Parameters
The base URL of the SIAT service. Use the appropriate URL for your environment:
- Testing:
https://pilotosiatservicios.impuestos.gob.bo - Production:
https://siatservicios.impuestos.gob.bo
Optional HTTP client for making requests. If
nil, a default client with a 15-second timeout is used.Provide a custom client to configure:- Custom timeouts
- Proxy settings
- TLS configuration
- Connection pooling
Return Values
A pointer to the initialized SIAT services client with access to all service modules.
An error if initialization fails (e.g., empty base URL or service initialization error).
Available Services
The returnedsiatServices struct provides access to four main service modules:
Service for managing operations like punto de venta (point of sale) and eventos significativos (significant events).See the Operaciones Service reference for details.
Service for synchronizing data from SIAT including activities, parametric tables, and product/service catalogs.See the Sincronizacion Service reference for details.
Service for managing codes like CUIS (Sistema Integrado Único), CUFD (Código Único de Factura Diaria), and NIT verification.See the Codigos Service reference for details.
Service for invoice operations including reception, cancellation, and building invoices.See the Compra Venta Service reference for details.
Examples
Basic Initialization
Initialize the client with default settings for the testing environment:Custom HTTP Client
Configure a custom HTTP client with specific timeout and transport settings:Production Environment
Initialize the client for production use:Error Handling
Handle initialization errors properly:Notes
- The base URL is trimmed of leading/trailing whitespace before validation
- If no HTTP client is provided, a default client with a 15-second timeout is created automatically
- All service modules (Operaciones, Sincronizacion, Codigos, CompraVenta) are initialized during client creation
- If any service fails to initialize, the entire client initialization fails and returns an error
- The client is thread-safe and can be reused across goroutines
Related
Codigos Service
Manage CUIS, CUFD, and NIT verification
Sincronizacion Service
Sync activities and parametric data
Operaciones Service
Manage punto de venta and events
Compra Venta Service
Handle invoice operations
