Skip to content

Commit

Permalink
fix: restore deprecated interceptor modules (#292)
Browse files Browse the repository at this point in the history
Since PR #289, the `GRPC.ServerInterceptor` and
`GRPC.ClientInterceptor` is suddenly remove. This could make breaking
changes. This changes restore it and add deprecated to `@moduledoc` to
those interceptors.
  • Loading branch information
thanabodee-c authored Jan 11, 2023
1 parent f5f5fab commit bf2ad0e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/grpc/client/interceptor.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
defmodule GRPC.ClientInterceptor do
@moduledoc """
Interceptor on client side. See `GRPC.Stub.connect/2`.
"""

@moduledoc deprecated: "Use `GRPC.Client.Interceptor` instead"

alias GRPC.Client.Stream

@type options :: any()
@type req :: struct() | nil
@type next :: (Stream.t(), req -> GRPC.Stub.rpc_return())

@callback init(options) :: options
@callback call(stream :: Stream.t(), req, next, options) :: GRPC.Stub.rpc_return()
end

defmodule GRPC.Client.Interceptor do
@moduledoc """
Interceptor on client side. See `GRPC.Stub.connect/2`.
Expand Down
18 changes: 18 additions & 0 deletions lib/grpc/server/interceptor.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
defmodule GRPC.ServerInterceptor do
@moduledoc """
Interceptor on server side. See `GRPC.Endpoint`.
"""

@moduledoc deprecated: "Use `GRPC.Server.Interceptor` instead"

alias GRPC.Server.Stream

@type options :: any()
@type rpc_return ::
{:ok, Stream.t(), struct()} | {:ok, Stream.t()} | {:error, GRPC.RPCError.t()}
@type next :: (GRPC.Server.rpc_req(), Stream.t() -> rpc_return())

@callback init(options) :: options
@callback call(GRPC.Server.rpc_req(), stream :: Stream.t(), next, options) :: rpc_return
end

defmodule GRPC.Server.Interceptor do
@moduledoc """
Interceptor on server side. See `GRPC.Endpoint`.
Expand Down

0 comments on commit bf2ad0e

Please sign in to comment.