Lokalise APIv2 Elixir SDK

Elixir interface for the Lokalise APIv2.

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




Changelog

3.3.0 (27-Nov-2024)

config :elixir_lokalise_api, base_url_api: "YOUR_API_BASE_URL"
config :elixir_lokalise_api, base_url_oauth2: "YOUR_OAUTH2_BASE_URL"

3.2.0 (15-Oct-2024)

{:ok, %PermissionTemplatesCollection{} = templates} = PermissionTemplates.all(team_id)

template = hd(templates)

template.id # => 1
template.role # => "Manager"
template.permissions # => ['branches_main_modify', ...]
template.description # => 'Manage project settings ...'
template.tag # => 'Full access'
template.tagColor # => 'green'
template.tagInfo # => ''
template.doesEnableAllReadOnlyLanguages # => true
group = TeamUserGroups.find(team_id, group_id)
group.role_id # => 5
contributor = Contributors.find(project_id, contributor_id)
contributor.role_id # => 5

3.1.0 (14-May-2024)

{:ok, %KeysCollection{} = keys} = Keys.all(@project_id, limit: 2, pagination: "cursor", cursor: "eyIxIjozNzk3ODEzODh9")

keys.per_page_limit # => 2
keys.next_cursor # => "eyIxIjo0NTc4NDUxMDd9"

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)