{"id":50769797,"url":"https://github.com/sgerrand/ex_plain","last_synced_at":"2026-06-29T08:00:17.989Z","repository":{"id":352608953,"uuid":"1215759907","full_name":"sgerrand/ex_plain","owner":"sgerrand","description":"Elixir client for the Plain GraphQL API","archived":false,"fork":false,"pushed_at":"2026-06-01T02:32:22.000Z","size":124,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-11T17:28:27.730Z","etag":null,"topics":["api-client","api-client-elixir","elixir-library","graphql-client","hex-package","plain-api"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/ex_plain","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sgerrand.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"sgerrand","patreon":"sgerrand"}},"created_at":"2026-04-20T08:22:10.000Z","updated_at":"2026-05-04T07:50:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sgerrand/ex_plain","commit_stats":null,"previous_names":["sgerrand/ex_plain"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sgerrand/ex_plain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgerrand%2Fex_plain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgerrand%2Fex_plain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgerrand%2Fex_plain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgerrand%2Fex_plain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgerrand","download_url":"https://codeload.github.com/sgerrand/ex_plain/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgerrand%2Fex_plain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34918101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","api-client-elixir","elixir-library","graphql-client","hex-package","plain-api"],"created_at":"2026-06-11T17:01:46.937Z","updated_at":"2026-06-29T08:00:17.982Z","avatar_url":"https://github.com/sgerrand.png","language":"Elixir","funding_links":["https://github.com/sponsors/sgerrand","https://patreon.com/sgerrand"],"categories":[],"sub_categories":[],"readme":"# ExPlain\n\n[![Test Status](https://github.com/sgerrand/ex_plain/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sgerrand/ex_plain/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/sgerrand/ex_plain/badge.svg?branch=main)](https://coveralls.io/github/sgerrand/ex_plain?branch=main)\n[![Hex Version](https://img.shields.io/hexpm/v/ex_plain.svg)](https://hex.pm/packages/ex_plain)\n[![Hex Docs](https://img.shields.io/badge/docs-hexpm-blue.svg)](https://hexdocs.pm/ex_plain/)\n\nAn Elixir client for the [Plain GraphQL API](https://www.plain.com/docs/graphql/introduction).\n\n## Installation\n\nAdd `ex_plain` to your dependencies in `mix.exs`:\n\n\u003c!-- x-release-please-start-version --\u003e\n\n```elixir\ndef deps do\n  [\n    {:ex_plain, \"~\u003e 0.3.1\"}\n  ]\nend\n```\n\n\u003c!-- x-release-please-end --\u003e\n\n## Quick start\n\n```elixir\nclient = ExPlain.new(api_key: System.fetch_env!(\"PLAIN_API_KEY\"))\n\n# Look up a customer\n{:ok, customer} = ExPlain.Customers.get_by_email(client, \"alice@example.com\")\n\n# Create a thread\n{:ok, thread} = ExPlain.Threads.create(client, %{\n  customer_identifier: %{customer_id: customer.id},\n  title: \"Cannot log in\"\n})\n```\n\n## Domains covered\n\n| Module | Operations |\n| ------ | ---------- |\n| `ExPlain.Customers` | upsert, get, list, delete, manage groups |\n| `ExPlain.Threads` | create, assign, label, reply, change status |\n| `ExPlain.Companies` | upsert, get, list |\n| `ExPlain.Tenants` | upsert, get, list, manage customers |\n| `ExPlain.Tiers` | upsert, get, list |\n| `ExPlain.Labels` | list label types, add/remove labels on threads |\n| `ExPlain.Events` | create customer and thread timeline events |\n| `ExPlain.Users` | list users, get current user |\n| `ExPlain.Webhooks` | list, create, update, delete webhook targets |\n\n## Pagination\n\nList operations follow the Relay cursor pagination convention. Pass `first:` and\n`after:` (or `last:` and `before:`) keyword options; the response is a map with\n`:nodes` and `:page_info`.\n\n```elixir\n{:ok, page} = ExPlain.Customers.list(client, first: 50)\nnext_cursor = page.page_info.end_cursor\n{:ok, page2} = ExPlain.Customers.list(client, first: 50, after: next_cursor)\n```\n\n## Error handling\n\nAll functions return `{:ok, result}` or `{:error, %ExPlain.Error{}}`. Mutation\nerrors from Plain (validation failures, permission errors) come back as\n`{:error, %ExPlain.Error{type: :mutation_error}}` with field-level detail when\navailable.\n\n```elixir\ncase ExPlain.Customers.upsert(client, input) do\n  {:ok, %{result: :created, customer: customer}} -\u003e customer\n  {:error, %ExPlain.Error{type: :mutation_error, message: msg}} -\u003e {:error, msg}\n  {:error, %ExPlain.Error{type: :forbidden}} -\u003e {:error, :unauthorized}\nend\n```\n\n## Testing\n\nPass a `plug:` option to use `Req.Test` for HTTP stubbing without real network calls:\n\n```elixir\nclient = ExPlain.new(api_key: \"test_key\", plug: {Req.Test, __MODULE__})\n\nReq.Test.stub(__MODULE__, fn conn -\u003e\n  Req.Test.json(conn, %{\"data\" =\u003e %{\"customer\" =\u003e %{\"id\" =\u003e \"c_01\", ...}}})\nend)\n```\n\n## Documentation\n\nFull API documentation is available on [HexDocs](https://hexdocs.pm/ex_plain).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgerrand%2Fex_plain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgerrand%2Fex_plain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgerrand%2Fex_plain/lists"}