# `JSONAPIPlug.Resource.Links`
[🔗](https://github.com/lucacorti/jsonapi_plug/blob/main/lib/jsonapi_plug/resource/links.ex#L1)

Resource Links

Implement this protocol to generate JSON:API links for individual resources.
Links returned will be included for each resource `links` in JSON:API responses.

This example implementation generates a link for each `MyApp.Post` resource.

```elixir
defimpl JSONAPIPlug.Resource.Links, for: MyApp.Post do
  def links(%@for{} = post, _conn), do: %{some-link: "http://myapp.com/post/#{post.id}/other-stuff"}
end
```

# `t`

```elixir
@type t() :: term()
```

All the types that implement this protocol.

# `links`

```elixir
@spec links(JSONAPIPlug.Resource.t(), Plug.Conn.t() | nil) ::
  JSONAPIPlug.Document.links()
```

Resource links

Returns the resource links to be returned for resources by the resource.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
