{"id":19139902,"url":"https://github.com/arcblock/grpc-builder","last_synced_at":"2025-05-06T23:15:25.094Z","repository":{"id":57503642,"uuid":"201126909","full_name":"ArcBlock/grpc-builder","owner":"ArcBlock","description":"GRPC client and server builder for simplifying the code","archived":false,"fork":false,"pushed_at":"2019-12-20T00:12:27.000Z","size":29,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-06T23:15:17.307Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArcBlock.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-08-07T20:57:06.000Z","updated_at":"2019-12-20T00:12:20.000Z","dependencies_parsed_at":"2022-08-30T01:30:27.784Z","dependency_job_id":null,"html_url":"https://github.com/ArcBlock/grpc-builder","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fgrpc-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fgrpc-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fgrpc-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fgrpc-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArcBlock","download_url":"https://codeload.github.com/ArcBlock/grpc-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782835,"owners_count":21803410,"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-11-09T07:15:37.303Z","updated_at":"2025-05-06T23:15:25.073Z","avatar_url":"https://github.com/ArcBlock.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GrpcBuilder\n\nGenerate GRPC client and server code.\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:grpc_builder, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Usage\n\nIn your GRPC client SDK application code, add `GrpcBuilder.Client.ConnSupervisor` into the children:\n\n```elixir\ndefmodule YourSdk.Application do\n  @moduledoc false\n\n  use Application\n  alias GrpcBuilder.Client.ConnSupervisor\n\n  def start(_type, _args) do\n    children = [\n      {ConnSupervisor, strategy: :one_for_one, name: ConnSupervisor}\n    ]\n\n    opts = [strategy: :one_for_one, name: YourSdk.Supervisor]\n    Supervisor.start_link(children, opts)\n  end\nend\n```\n\nAdd your RPC definitions like this:\n\n```elixir\ndefmodule YourSdk.Rpc do\n  @moduledoc \"\"\"\n  RPC client definition\n  \"\"\"\n  import GrpcBuilder.Client.Builder, only: [rpc: 2, rpc: 3]\n\n  # here the `res` is the response GRPC server returned to you. You can write code to process the response here.\n  rpc :get_job, prefix: YourProtoAbi, do: res.job\nend\n```\n\nYou also need to define a Stub:\n\n```elixir\ndefmodule GrpcBuilder.Client.Stub do\n  use GrpcBuilder.Client.StubGen, services: %{\n    get_job: YourProtoAbi.GrpcService.Stub\n  }\nend\n```\n\nThat's it! Then you can use your SDK like this:\n\n```elixir\nGrpcBuilder.Client.connect(\"tcp://127.0.0.1:12345\", name: \"your_conn_name\", default: true)\nYourSdk.Rpc.get_job(request) # this is to use the default connection\nYourSdk.Rpc.get_job(request, \"your_conn_name\") # this is the same as previous call\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcblock%2Fgrpc-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farcblock%2Fgrpc-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcblock%2Fgrpc-builder/lists"}