/nfe_io-csharp

C# Client for NFe.io API

Primary LanguageC#MIT LicenseMIT

IO.Swagger - the C# library for the Service Invoice API (api.nfe.io)

This C# SDK is automatically generated by the Swagger Codegen project:

  • API version: v1
  • SDK version: 1.0.0
  • Build package: io.swagger.codegen.languages.CSharpClientCodegen

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)

Dependencies

The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out IO.Swagger.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {
            
            // Configure API key authorization: apiKey
            Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("Authorization", "Bearer");

            var apiInstance = new CompaniesApi();
            var companyId = companyId_example;  // string | ID da empresa
            var file = new System.IO.Stream(); // System.IO.Stream | Arquivo do certificado digital com extensao PFX ou P12
            var password = password_example;  // string | Senha do arquivo do certificado digital

            try
            {
                // Upload do certificado digital da empresa usando o codificação multipart/form-data.
                string result = apiInstance.CompaniesCertificateUpload(companyId, file, password);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CompaniesApi.CompaniesCertificateUpload: " + e.Message );
            }
        }
    }
}

Documentation for API Endpoints

All URIs are relative to http://api.nfe.io

Class Method HTTP request Description
CompaniesApi CompaniesCertificateUpload POST /v1/companies/{company_id}/certificate Upload do certificado digital da empresa usando o codificação multipart/form-data.
CompaniesApi CompaniesDelete DELETE /v1/companies/{company_id} Excluir uma empresa
CompaniesApi CompaniesGet GET /v1/companies Listar as empresas ativas de uma conta
CompaniesApi CompaniesGet_0 GET /v1/companies/{company_id_or_tax_number} Obter os detalhes de uma empresa
CompaniesApi CompaniesPost POST /v1/companies Criar uma empresa
CompaniesApi CompaniesPut PUT /v1/companies/{company_id} Atualizar uma empresa
LegalPeopleApi LegalPeopleGet GET /v1/companies/{company_id}/legalpeople Listar as pessoas jurídicas ativas
LegalPeopleApi LegalPeopleGet_0 GET /v1/companies/{company_id}/legalpeople/{id} Obter os detalhes de uma pessoa jurídica
NaturalPeopleApi NaturalPeopleGet GET /v1/companies/{company_id}/naturalpeople Listar as pessoas físicas ativas
NaturalPeopleApi NaturalPeopleGet_0 GET /v1/companies/{company_id}/naturalpeople/{id} Obter os detalhes de uma pessoa física
ServiceInvoicesApi ServiceInvoicesDelete DELETE /v1/companies/{company_id}/serviceinvoices/{id} Cancelar uma Nota Fiscal de Serviços (NFSE)
ServiceInvoicesApi ServiceInvoicesGet GET /v1/companies/{company_id}/serviceinvoices Listar as Notas Fiscais de Serviço (NFSE)
ServiceInvoicesApi ServiceInvoicesGetDocumentPdf GET /v1/companies/{company_id}/serviceinvoices/{id}/pdf Download do PDF da Nota Fiscal de Serviço (NFSE)
ServiceInvoicesApi ServiceInvoicesGetDocumentXml GET /v1/companies/{company_id}/serviceinvoices/{id}/xml Download do XML da Nota Fiscal de Serviço (NFSE)
ServiceInvoicesApi ServiceInvoicesGet_0 GET /v1/companies/{company_id}/serviceinvoices/{id} Obter os detalhes de uma Nota Fiscal de Serviço (NFSE)
ServiceInvoicesApi ServiceInvoicesPost POST /v1/companies/{company_id}/serviceinvoices Emitir uma Nota Fiscal de Serviço (NFSE)
ServiceInvoicesApi ServiceInvoicesPullProcess PUT /v1/companies/{company_id}/serviceinvoices/pull Consulta Notas Fiscais de Serviço (NFSE) da Prefeitura
ServiceInvoicesApi ServiceInvoicesSendEmail PUT /v1/companies/{company_id}/serviceinvoices/{id}/sendemail Enviar email para o Tomador com a Nota Fiscal de Serviço (NFSE)
WebhooksApi WebhooksDelete DELETE /v1/hooks/{hook_id} Excluir um webhook da conta
WebhooksApi WebhooksGet GET /v1/hooks Listar os webhooks da conta
WebhooksApi WebhooksGet_0 GET /v1/hooks/{hook_id} Obter os detalhes de um webhook da conta
WebhooksApi WebhooksPost POST /v1/hooks Criar um webhook da conta
WebhooksApi WebhooksPut PUT /v1/hooks/{hook_id} Atualizar um webhook da conta

Documentation for Models

Documentation for Authorization

apiKey

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header