Sake.Resource.Spec (Sake v0.4.3)

Copy Markdown View Source

The compiled definition of a resource.

mount is nil for a resource the server declares itself, and {server, prefix, spec} for one it mounted (Sake.Server.mount/2): the server it came from, the mount's prefix, and the spec as that server has it. proxy is the Sake.Proxy whose upstream serves a proxied resource; it has no module.

Summary

Functions

The wire entry of a concrete resource produced by list/1.

The spec at another URI, with its template pattern compiled again: a mounted server's resources move under the mount's prefix.

Types

t()

@type t() :: %Sake.Resource.Spec{
  annotations: term(),
  authentication: term(),
  description: term(),
  icons: term(),
  meta: term(),
  mime_type: term(),
  module: term(),
  mount: term(),
  name: term(),
  params: term(),
  proxy: term(),
  regex: term(),
  scopes: term(),
  subscribe: term(),
  template: term(),
  title: term(),
  ttl: term(),
  ui: term(),
  uri: term()
}

Functions

listed_to_wire(s, uri, revision)

@spec listed_to_wire(t(), String.t() | map(), String.t()) :: map()

The wire entry of a concrete resource produced by list/1.

match(spec, uri)

@spec match(t(), String.t()) :: {:ok, map()} | :error

put_uri(s, uri)

@spec put_uri(t(), String.t()) :: t()

The spec at another URI, with its template pattern compiled again: a mounted server's resources move under the mount's prefix.

template_to_wire(s, revision)

@spec template_to_wire(t(), String.t()) :: map()

to_wire(s, revision)

@spec to_wire(t(), String.t()) :: map()