Skip to content

Module stac_fastapi.core.models.links

link helpers.

Variables

python3 INFERRED_LINK_RELS

Functions

merge_params

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

Merge url parameters.

Classes

python3 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

python3 base_url

Get the base url.

python3 url

Get the current request url.

Methods

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

Return all inferred links.

python3 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_.

python3 def link_root( self ) -> dict

Return the catalog root.

python3 def link_self( self ) -> dict

Return the self link.

resolve

python3 def resolve( self, url )

Resolve url to the current request url.

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

Create inferred links specific to collections.

Ancestors (in MRO)

  • stac_fastapi.core.models.links.BaseLinks

Instance variables

python3 base_url

Get the base url.

python3 url

Get the current request url.

Methods

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

Return all inferred links.

python3 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_.

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

Create the aggregate link.

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

Create the aggregations link.

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

Create the items link.

python3 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

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

Create the queryables link.

python3 def link_root( self ) -> dict

Return the catalog root.

python3 def link_self( self ) -> dict

Return the self link.

The self link points to the current location of the resource: - If self_url is provided (scoped context), use it - Otherwise, use the global collections endpoint

resolve

python3 def resolve( self, url )

Resolve url to the current request url.

python3 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

python3 base_url

Get the base url.

python3 url

Get the current request url.

Methods

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

Return all inferred links.

python3 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_.

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

Create link for next page.

python3 def link_root( self ) -> dict

Return the catalog root.

python3 def link_self( self ) -> dict

Return the self link.

resolve

python3 def resolve( self, url )

Resolve url to the current request url.