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

Link to this section Functions

Link to this function

create_contact(contact, client \\ Connection.new())

View Source

Specs

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
Link to this function

create_credit_note(credit_note, query \\ [], client \\ Connection.new())

View Source

Specs

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
Link to this function

create_invoice(invoice, query \\ [], client \\ Connection.new())

View Source

Specs

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
Link to this function

download_invoice(id, client \\ Connection.new())

View Source

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
Link to this function

get_credit_note(id, client \\ Connection.new())

View Source

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
Link to this function

get_invoice(id, client \\ Connection.new())

View Source

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
Link to this function

list_vouchers(opts \\ [], client \\ Connection.new())

View Source

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