Skip to content

Commit

Permalink
document how to use perspectives with Sanity.query/3
Browse files Browse the repository at this point in the history
  • Loading branch information
balexand committed May 11, 2024
1 parent 55bd566 commit fa08a1b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/sanity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ defmodule Sanity do
Generates a request to the [Query](https://www.sanity.io/docs/http-query) endpoint. Requests to
this endpoint may be authenticated or unauthenticated. Unauthenticated requests to a dataset
with private visibility will succeed but will not return any documents.
[Perspectives](https://www.sanity.io/docs/perspectives) can be used by passing the `"perspective"`
query param like, `Sanity.query("*", %{}, perspective: "previewDrafts")`. This function does not
set a perspective by default, which is equivalent to a perspective of `"raw"`.
"""
@spec query(String.t(), keyword() | map(), keyword() | map()) :: Request.t()
def query(query, variables \\ %{}, query_params \\ []) do
Expand Down

0 comments on commit fa08a1b

Please sign in to comment.