Skip to content

Module stac_fastapi.core.models.links

link helpers.

Variables

INFERRED_LINK_RELS

Functions

merge_params

def merge_params(
    url: str,
    newparams: dict
) -> str

Merge url parameters.

Classes

class BaseLinks(
    request: starlette.requests.Request
)

Create inferred links common to collections and items.

Descendants

  • stac_fastapi.core.models.links.CollectionLinks
  • stac_fastapi.core.models.links.PagingLinks

Instance variables

base_url

Get the base url.

url

Get the current request url.

Methods

def create_links(
    self
) -> list[dict[str, typing.Any]]

Return all inferred links.

def get_links(
    self,
    extra_links: list[dict[str, typing.Any]] | None = None
) -> list[dict[str, typing.Any]]

Generate all the links.

Get the links object for a stac resource by iterating through available methods on this class that start with link_.

def link_root(
    self
) -> dict

Return the catalog root.

def link_self(
    self
) -> dict

Return the self link.

resolve

def resolve(
    self,
    url
)

Resolve url to the current request url.

class CollectionLinks(
    request: starlette.requests.Request,
    collection_id: str,
    extensions: list[str] = NOTHING,
    *,
    parent_url: str | None = None
)

Create inferred links specific to collections.

Ancestors (in MRO)

  • stac_fastapi.core.models.links.BaseLinks

Instance variables

base_url

Get the base url.

url

Get the current request url.

Methods

def create_links(
    self
) -> list[dict[str, typing.Any]]

Return all inferred links.

def get_links(
    self,
    extra_links: list[dict[str, typing.Any]] | None = None
) -> list[dict[str, typing.Any]]

Generate all the links.

Get the links object for a stac resource by iterating through available methods on this class that start with link_.

def link_aggregate(
    self
) -> dict[str, typing.Any]

Create the aggregate link.

def link_aggregations(
    self
) -> dict[str, typing.Any]

Create the aggregations link.

def link_items(
    self
) -> dict[str, typing.Any]

Create the items link.

def link_parent(
    self
) -> dict[str, typing.Any]

Create the parent link.

The parent link represents the structural parent (the path the user is traversing): - If accessed via /catalogs/{id}/collections/{id}, parent is the catalog - If accessed via /collections/{id}, parent is the root landing page

def link_queryables(
    self
) -> dict[str, typing.Any]

Create the queryables link.

def link_root(
    self
) -> dict

Return the catalog root.

def link_self(
    self
) -> dict

Return the self link.

resolve

def resolve(
    self,
    url
)

Resolve url to the current request url.

class PagingLinks(
    request: starlette.requests.Request,
    *,
    next: str | None = None
)

Create links for paging.

Ancestors (in MRO)

  • stac_fastapi.core.models.links.BaseLinks

Instance variables

base_url

Get the base url.

url

Get the current request url.

Methods

def create_links(
    self
) -> list[dict[str, typing.Any]]

Return all inferred links.

def get_links(
    self,
    extra_links: list[dict[str, typing.Any]] | None = None
) -> list[dict[str, typing.Any]]

Generate all the links.

Get the links object for a stac resource by iterating through available methods on this class that start with link_.

def link_next(
    self
) -> dict[str, typing.Any] | None

Create link for next page.

def link_root(
    self
) -> dict

Return the catalog root.

def link_self(
    self
) -> dict

Return the self link.

resolve

def resolve(
    self,
    url
)

Resolve url to the current request url.