LexOffice (lexoffice.de API v0.1.9) View Source
Documentation for LexOffice
which provides an API for lexoffice.de.
Installation
This package can be installed by adding lexoffice
to your list of dependencies in mix.exs
:
def deps do
[
{:lexoffice, "~> 0.1"}
]
end
Configuration
Put the following lines into your config.exs
or better, into your environment configuration files like test.exs
, dev.exs
or prod.exs
.
config :lexoffice, api_key: "<your api key>"
WebHooks in Phoenix
Put the following lines in a file called lexoffice_controller.ex
inside your controllers directory.
defmodule YourAppWeb.LexOfficeController do
use LexOffice.PhoenixController
def handle_event(org_id, "payment.changed", resource_id, date) do
id
|> Documents.get_by_pandadoc_id!()
|> Documents.update_document(%{status: status})
end
def handle_event(org_id, type, resource_id, date) do
IO.puts "i do not handle LexOffice requests of type #{type} yet."
end
end
Put the following lines into your router.ex
and configure the WebHook in the lexoffice portal.
post "/callbacks/lexoffice", YourAppWeb.LexOfficeController, :webhook
Usage
Link to this section Summary
Functions
Create a new contact.
Create a new credit-note.
Create a new invoice.
Downloads a single invoice
Gets a single credit-note.
Gets a single invoice
List vouchers.
Link to this section Functions
Specs
create_contact(LexOffice.Model.CreateContact.t(), Tesla.Env.client() | nil) :: {:ok, LexOffice.Model.ContactResponse.t()} | {:error, Tesla.Env.t()}
Create a new contact.
Parameters
- contact (LexOffice.Model.CreateContact): Contact data
- connection (LexOffice.Connection): [optional] Connection to server
Returns
{:ok, %LexOffice.Model.ContactResponse{}}
on success{:error, info}
on failure
create_credit_note(credit_note, query \\ [], client \\ Connection.new())
View SourceSpecs
create_credit_note( LexOffice.Model.CreateCreditNote.t(), keyword(), Tesla.Env.client() ) :: {:ok, LexOffice.Model.CreditNoteResponse.t()} | {:error, Tesla.Env.t()}
Create a new credit-note.
Parameters
- credit_note (LexOffice.Model.CreateCreditNote): Credit-Note data
- opts (KeywordList): [optional] Optional parameters
- connection (LexOffice.Connection): [optional] Connection to server
Returns
{:ok, %LexOffice.Model.CreditNoteResponse{}}
on success{:error, info}
on failure
Specs
create_invoice( LexOffice.Model.CreateInvoice.t(), keyword(), Tesla.Env.client() | nil ) :: {:ok, LexOffice.Model.InvoiceResponse.t()} | {:error, Tesla.Env.t()}
Create a new invoice.
Parameters
- invoice (LexOffice.Model.CreateInvoice): Invoice data
- opts (KeywordList): [optional] Optional parameters
- connection (LexOffice.Connection): [optional] Connection to server
Returns
{:ok, %LexOffice.Model.InvoiceResponse{}}
on success{:error, info}
on failure
Specs
download_invoice(String.t(), Tesla.Env.client() | nil) :: {:ok, LexOffice.Model.InvoiceResponse.t()} | {:error, Tesla.Env.t()}
Downloads a single invoice
Parameters
- id (String): Invoice ID
- connection (LexOffice.Connection): [optional] Connection to server
Returns
{:ok, %LexOffice.Model.InvoiceResponse{}}
on success{:error, info}
on failure
Specs
get_credit_note(String.t(), Tesla.Env.client() | nil) :: {:ok, LexOffice.Model.CreditNoteResponse.t()} | {:error, Tesla.Env.t()}
Gets a single credit-note.
Parameters
- id (String): CreditNote ID
- connection (LexOffice.Connection): [optional] Connection to server
Returns
{:ok, %LexOffice.Model.CreditNoteResponse{}}
on success{:error, info}
on failure
Specs
get_invoice(String.t(), Tesla.Env.client() | nil) :: {:ok, LexOffice.Model.InvoiceDetailsResponse.t()} | {:error, Tesla.Env.t()}
Gets a single invoice
Parameters
- id (String): Invoice ID
- connection (LexOffice.Connection): [optional] Connection to server
Returns
{:ok, %LexOffice.Model.InvoiceResponse{}}
on success{:error, info}
on failure
Specs
list_vouchers(keyword(), Tesla.Env.client() | nil) :: {:ok, LexOffice.Model.VoucherListResponse.t()} | {:error, Tesla.Env.t()}
List vouchers.
Parameters
- opts (KeywordList): [optional] Optional parameters
- :voucherType (String.t): Comma separated list of voucher-types, e.g. purchaseinvoice,invoice.
- :voucherStatus (String.t): Find vouchers by their voucherStatus, e.g. open.
- :page (integer()): The page to access..
- :size (integer()): The number of items to return per page.
- connection (LexOffice.Connection): [optional] Connection to server
Returns
{:ok, %LexOffice.Model.VoucherListResponse{}}
on success{:error, info}
on failure