Lokalise APIv2 Elixir SDK

Elixir interface for the Lokalise APIv2.

View the Project on GitHub lokalise/elixir-lokalise-api




Changelog

3.0.0 (02-Feb-2023)

config :elixir_lokalise_api, oauth2_client_id: {:system, "OAUTH_CLIENT_ID"}
# 1. Generate an authentication URL:

uri = ElixirLokaliseApi.OAuth2.Auth.auth(
  ["read_projects", "write_tasks"], # scopes
  "http://example.com/callback", # redirect uri
  "secret state" # state
)

# 2. The user should visit this URL. They'll be redirected to the callback along with a secret code.

# 3. Use the secret code to obtain an access token:

{:ok, response} = ElixirLokaliseApi.OAuth2.Auth.token("secret code")

response.access_token # => 123abc
response.refresh_token # => 345xyz

# 4. Use the refresh token to obtain a new access token:

{:ok, response} = ElixirLokaliseApi.OAuth2.Auth.refresh("OAUTH2_REFRESH_TOKEN")

response.access_token # => 789xyz

2.3.0 (28-Jul-2022)

{:ok, %{} = resp} = Files.delete(project_id, file_id)

resp.file_deleted # => true
resp.project_id # => "123.abc"

2.2.0 (17-Dec-2021)

config :elixir_lokalise_api, oauth2_token: "YOUR_API_OAUTH2_TOKEN"
:oauth2_token |> ElixirLokaliseApi.Config.put_env(oauth2_token)

2.1.0 (27-Sep-2021)

2.0.0 (20-Sep-2021)

config :elixir_lokalise_api, api_token: "LOKALISE_API_TOKEN"

# OR

config :elixir_lokalise_api, api_token: {:system, "ENV_VARIABLE_NAME"} # for env variables

1.0.0

config :elixir_lokalise_api,
  api_token: {:system, "LOKALISE_API_TOKEN"},
  request_options: [
    timeout: 5000,
    recv_timeout: 5000
  ]

1.0.0-rc.1 (18-Mar-2021)