Class OmieApiClient
Default implementation of the Omie ERP API client.
public class OmieApiClient : IOmieApiClient
- Inheritance
-
OmieApiClient
- Implements
- Inherited Members
Constructors
OmieApiClient(IOptions<OmieApiClientConfig>, ILogger<OmieApiClient>)
Default implementation of the Omie ERP API client.
public OmieApiClient(IOptions<OmieApiClientConfig> options, ILogger<OmieApiClient> logger)
Parameters
optionsIOptions<OmieApiClientConfig>loggerILogger<OmieApiClient>
Methods
ChangeOSAsync(IncludeOSParam, CancellationToken)
Updates an existing Service Order (AlterarOS). Send the full item list — Omie replaces the OS items. The header must carry OsCode (nCodOS) or cCodIntOS.
public Task<IResult<IncludeOSResponse>> ChangeOSAsync(IncludeOSParam param, CancellationToken cancellationToken = default)
Parameters
paramIncludeOSParamcancellationTokenCancellationToken
Returns
ChangeOSStageAsync(ChangeOSStageParam, CancellationToken)
Moves a Service Order to another Kanban stage (TrocarEtapaOS). Feature-flag the "billing" stage.
public Task<IResult<ChangeOSStageResponse>> ChangeOSStageAsync(ChangeOSStageParam param, CancellationToken cancellationToken = default)
Parameters
paramChangeOSStageParamcancellationTokenCancellationToken
Returns
ConsultClientAsync(long, CancellationToken)
Checks whether a client exists in Omie by its code.
public Task<IResult<bool>> ConsultClientAsync(long omieClientCode, CancellationToken cancellationToken = default)
Parameters
omieClientCodelongcancellationTokenCancellationToken
Returns
ConsultContractAsync(long, CancellationToken)
Reads a Service Contract (ConsultarContrato) to obtain the negotiated unit price per service item. The contract is a price registry only — it must never be billed through.
public Task<IResult<ConsultContractResponse>> ConsultContractAsync(long omieContractCode, CancellationToken cancellationToken = default)
Parameters
omieContractCodelongcancellationTokenCancellationToken
Returns
ConsultOSAsync(long?, string?, CancellationToken)
Reads the current state/stage of a Service Order (ConsultarOS). Provide exactly one identifier.
public Task<IResult<ConsultOSResponse>> ConsultOSAsync(long? nCodOS = null, string? cCodIntOS = null, CancellationToken cancellationToken = default)
Parameters
nCodOSlong?cCodIntOSstringcancellationTokenCancellationToken
Returns
ConsultServiceRegistrationAsync(long, CancellationToken)
Retrieves the registration data of a service in Omie.
public Task<IResult<ConsultServiceRegistrationResponse>> ConsultServiceRegistrationAsync(long omieServiceCode, CancellationToken cancellationToken = default)
Parameters
omieServiceCodelongcancellationTokenCancellationToken
Returns
GenerateBilletAsync(long?, string?, CancellationToken)
Generates the billet of an existing Accounts Receivable entry in Omie. At least one of the two identifiers must be provided.
public Task<IResult<GenerateBilletResponse>> GenerateBilletAsync(long? nCodTitulo = null, string? cCodIntTitulo = null, CancellationToken cancellationToken = default)
Parameters
nCodTitulolong?cCodIntTitulostringcancellationTokenCancellationToken
Returns
GetBilletAsync(long?, string?, CancellationToken)
Retrieves the billet link/details for an existing Accounts Receivable entry in Omie. Use after GenerateBillet to fetch the actual download URL, barcode, etc.
public Task<IResult<GetBilletResponse>> GetBilletAsync(long? nCodTitulo = null, string? cCodIntTitulo = null, CancellationToken cancellationToken = default)
Parameters
nCodTitulolong?cCodIntTitulostringcancellationTokenCancellationToken
Returns
IncludeOSAsync(IncludeOSParam, CancellationToken)
Includes a Service Order (OS) in Omie.
public Task<IResult<IncludeOSResponse>> IncludeOSAsync(IncludeOSParam param, CancellationToken cancellationToken = default)
Parameters
paramIncludeOSParamcancellationTokenCancellationToken
Returns
IncludeReceivableAsync(IncludeReceivableParam, CancellationToken)
Includes an Accounts Receivable entry in Omie.
public Task<IResult<IncludeReceivableResponse>> IncludeReceivableAsync(IncludeReceivableParam param, CancellationToken cancellationToken = default)
Parameters
paramIncludeReceivableParamcancellationTokenCancellationToken
Returns
ListBillingStagesAsync(CancellationToken)
Lists the OS Kanban stage catalog (ListarEtapasFaturamento) to discover stage codes.
public Task<IResult<ListBillingStagesResponse>> ListBillingStagesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
ListCategoryRegistrationAsync(int, int, string, CancellationToken)
Lists registered categories (ListarCategorias) to resolve a service's cCodCateg to its category name.
public Task<IResult<ListCategoryRegistrationResponse>> ListCategoryRegistrationAsync(int page = 1, int recordsPerPage = 1000, string description = "", CancellationToken cancellationToken = default)
Parameters
pageintrecordsPerPageintdescriptionstringcancellationTokenCancellationToken
Returns
ListContractsAsync(int, int, CancellationToken)
Lists Service Contracts (ListarContratos) so a contract can be resolved by the number the user knows (cNumCtr) — Omie offers no search by contract number. List once and index in memory: consulting contract by contract is what trips Omie's "Consumo redundante" gate.
public Task<IResult<ListContractsResponse>> ListContractsAsync(int page = 1, int recordsPerPage = 100, CancellationToken cancellationToken = default)
Parameters
pageintrecordsPerPageintcancellationTokenCancellationToken
Returns
ListServiceRegistrationAsync(int, int, CancellationToken)
Lists registered services (ListarCadastroServico) to resolve/validate a nCodServico.
public Task<IResult<ListServiceRegistrationResponse>> ListServiceRegistrationAsync(int page = 1, int recordsPerPage = 50, CancellationToken cancellationToken = default)
Parameters
pageintrecordsPerPageintcancellationTokenCancellationToken