Speakeasy.Context (Speakeasy v0.3.2)
Speakeasy current context. Consists of a :resource
and a :user
Link to this section Summary
Link to this section Functions
Link to this function
add_resource(ctx, resource)
Specs
add_resource( %Absinthe.Resolution{ acc: term(), adapter: term(), arguments: term(), context: term(), definition: term(), errors: term(), extensions: term(), fields_cache: term(), fragments: term(), middleware: term(), parent_type: term(), path: term(), private: term(), root_value: term(), schema: term(), source: term(), state: term(), value: term() } | %Speakeasy.Context{resource: term(), user: term()}, any() ) :: %Absinthe.Resolution{ acc: term(), adapter: term(), arguments: term(), context: term(), definition: term(), errors: term(), extensions: term(), fields_cache: term(), fragments: term(), middleware: term(), parent_type: term(), path: term(), private: term(), root_value: term(), schema: term(), source: term(), state: term(), value: term() } | %Speakeasy.Context{resource: term(), user: term()}
Adds a resource to the Speakeasy.Context
Examples
iex> Speakeasy.Context.add_resource(%Absinthe.Resolution{}, "kittens")
%Absinthe.Resolution{context: %{speakeasy: %Speakeasy.Context{user: nil, resource: "kittens"}}}
iex> Speakeasy.Context.add_resource(%Speakeasy.Context{}, "kittens")
%Speakeasy.Context{user: nil, resource: "kittens"}
Link to this function
add_user(ctx, user)
Specs
add_user( %Absinthe.Resolution{ acc: term(), adapter: term(), arguments: term(), context: term(), definition: term(), errors: term(), extensions: term(), fields_cache: term(), fragments: term(), middleware: term(), parent_type: term(), path: term(), private: term(), root_value: term(), schema: term(), source: term(), state: term(), value: term() } | %Speakeasy.Context{resource: term(), user: term()}, any() ) :: %Absinthe.Resolution{ acc: term(), adapter: term(), arguments: term(), context: term(), definition: term(), errors: term(), extensions: term(), fields_cache: term(), fragments: term(), middleware: term(), parent_type: term(), path: term(), private: term(), root_value: term(), schema: term(), source: term(), state: term(), value: term() } | %Speakeasy.Context{resource: term(), user: term()}
Adds a user to the Speakeasy.Context
Examples
iex> Speakeasy.Context.add_user(%Absinthe.Resolution{}, "chauncy")
%Absinthe.Resolution{context: %{speakeasy: %Speakeasy.Context{user: "chauncy", resource: nil}}}
iex> Speakeasy.Context.add_user(%Speakeasy.Context{}, "chauncy")
%Speakeasy.Context{user: "chauncy", resource: nil}