{"id":13514958,"url":"https://github.com/nested-tech/closex","last_synced_at":"2025-03-31T04:36:07.029Z","repository":{"id":25686240,"uuid":"106009828","full_name":"nested-tech/closex","owner":"nested-tech","description":"🔥 Blazing-fast 🚀 Elixir library 👻️ for the Close.io API 🤖","archived":true,"fork":false,"pushed_at":"2022-10-31T14:24:48.000Z","size":317,"stargazers_count":15,"open_issues_count":7,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-10T19:17:32.840Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://developer.close.io","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nested-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-06T13:48:55.000Z","updated_at":"2025-02-14T14:19:42.000Z","dependencies_parsed_at":"2022-07-27T05:32:02.448Z","dependency_job_id":null,"html_url":"https://github.com/nested-tech/closex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nested-tech%2Fclosex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nested-tech%2Fclosex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nested-tech%2Fclosex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nested-tech%2Fclosex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nested-tech","download_url":"https://codeload.github.com/nested-tech/closex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246418658,"owners_count":20773934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-01T05:01:04.499Z","updated_at":"2025-03-31T04:36:06.469Z","avatar_url":"https://github.com/nested-tech.png","language":"Elixir","funding_links":[],"categories":["Elixir"],"sub_categories":[],"readme":"# Closex ✨\n\n[![CircleCI](https://img.shields.io/circleci/project/github/nested-tech/closex.svg)](https://circleci.com/gh/nested-tech/closex/tree/master)\n[![Coverage Status](https://img.shields.io/coveralls/nested-tech/closex.svg)](https://coveralls.io/github/nested-tech/closex.svg)\n[![Package Version](https://img.shields.io/hexpm/v/closex.svg)](https://hex.pm/packages/closex)\n[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://hexdocs.pm/closex/)\n\n🔥 Blazing-fast 🚀 Elixir library 👻️ for the Close.io API 🤖\n\n📔 Learn more about the Close.io API: [http://developer.close.io](http://developer.close.io)\n\n📖 Documentation for this package is available on [HexDocs](https://hexdocs.pm/closex).\n\n## Installation\n\nAdd `closex` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:closex, \"\u003e= 0.0.0\"} # or the current stable version\n  ]\nend\n```\n\n## Configuration\n\nIn your config.exs:\n\n```elixir\nconfig :closex,\n  # This should be accessible from your user's account page in close.io\n  api_key: \"YOUR_API_KEY\",\n\n  # This is a beta feature which will wait and retry `find_lead` and\n  # `find_opportunity` requests *once* if you hit your rate limit. The intention\n  # is that this will be gradually rolled out across other requests as needed.\n  rate_limit_retry: true # Defaults to `false` (don't retry)\n```\n\nYou can also read the API key from an environment variable, such as:\n\n```elixir\nconfig :closex,\n  api_key: {:system, \"MY_ENV_VAR\"}\n```\n\n## Usage\n\nThe client is essentially a wrapper around the Close.IO [REST API](https://developer.close.io/).\n\nIt follows the Close.IO API naming conventions as closely as possible. It supports almost everything that the REST API supports including querying leads, opportunities, users, organizations, statuses and more.\n\nExample usage:\n\n```elixir\n# Get a lead\nClosex.HTTPClient.get_lead(\"my_lead_id\")\n{:ok, %{\"id\" =\u003e \"my_lead_id\", \"status_id\" =\u003e \"my_status_id\", ...}}\n\n# Update a lead\nClosex.HTTPClient.update_lead(\"my_lead_id\", %{status_id: \"new_status_id\"})\n{:ok, %{\"id\" =\u003e \"my_lead_id\", \"status_id\" =\u003e \"new_status_id\", ...}}\n\n# many more ...\n```\n\nSee [the docs](https://hexdocs.pm/closex) for more examples.\n\nYou may also want to set the default client you want to use in your applicaton via your config:\n\n```\n# your_app/config/config.exs\n\nconfig :yourapp,\n  closeio_client: Closex.HTTPClient,\n  ...other configuration...\n```\n\nNext, use it in your code:\n\n```\n# your_app/lib/module_which_uses_closeio.ex\n\ndefmodule YourApp.ModuleWhichUsesCloseIO do\n\n  @closeio_client Application.fetch_env!(:your_app, :closeio_client)\n\n  def do_things_with_a_close_io_lead(id) do\n    @closeio_client.get_lead(id)\n    # do things\n  end\nend\n```\n\n## Mock Client\n\nWe have provided a mock client for testing purposes in your application.\n\nUsing the above configuration will allow you to override and use the `Closex.MockClient` in test mode.\n\n```\n# your_app/config/test.exs\n\nconfig :yourapp,\n  closeio_client: Closex.MockClient,\n  ...other configuration...\n```\n\nFor more details on the mock client please see [the docs](https://hexdocs.pm/closex).\n\n## Options\n\nOptions will be passed through to [HTTPoison](https://github.com/edgurgel/httpoison#options). For example, to set a shorter timeout:\n\n```elixir\nClosex.HTTPClient.get_lead(\"my_lead_id\", timeout: 500, recv_timeout: 1_000)\n```\n\n### Rate limit retry\n\nWhen we hit a rate limit on certain requests, there's a beta configuration to get the client to take this into account, wait a second longer than the remaining rate limit window then retry again. This can be enabled for all affected requests (see [Configuration](#configuration)) or on a per-request basis:\n\n```elixir\nClosex.HTTPClient.get_lead(\"my_lead_id\", rate_limit_retry: true)\n```\n\nThis is only limited to certain requests as it's being trialled, if useful then we'll roll it out across other requests. The requests are:\n\n- `find_leads`\n- `find_opportunities`\n- `find_all_opportunities`\n- `get_users`\n\n## Contributing\n\nEveryone is encouraged to help improve this project. Here are a few ways you can help:\n\n- Report bugs\n- Fix bugs and submit pull requests\n- Write, clarify, or fix documentation\n- Suggest or add new features\n- Please use the git hooks provided in the hooks directory. Use the following command to set these hooks up.\n\n```\nln -s ../../hooks/pre-commit.sh .git/hooks/pre-commit\n```\n\n## License\n\nMIT\n\n## Copyright\n\nCopyright NextDayProperty Ltd (see LICENSE for details)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnested-tech%2Fclosex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnested-tech%2Fclosex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnested-tech%2Fclosex/lists"}