Skip to content

Module stac_fastapi.pgstac.models.links

link helpers.

Variables

INFERRED_LINK_RELS

Functions

def filter_links(
    links: List[Dict]
) -> List[Dict]

Remove inferred links.

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.pgstac.models.links.PagingLinks
  • stac_fastapi.pgstac.models.links.CollectionLinksBase

Instance variables

base_url

Get the base url.

url

Get the current request url.

Methods

def create_links(
    self
) -> List[Dict[str, Any]]

Return all inferred links.

def get_links(
    self,
    extra_links: Optional[List[Dict[str, Any]]] = None
) -> List[Dict[str, 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
)

Create inferred links specific to collections.

Ancestors (in MRO)

  • stac_fastapi.pgstac.models.links.CollectionLinksBase
  • stac_fastapi.pgstac.models.links.BaseLinks

Instance variables

base_url

Get the base url.

url

Get the current request url.

Methods

def collection_link(
    self,
    rel: str = 'collection'
) -> Dict

Create a link to a collection.

def create_links(
    self
) -> List[Dict[str, Any]]

Return all inferred links.

def get_links(
    self,
    extra_links: Optional[List[Dict[str, Any]]] = None
) -> List[Dict[str, 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_items(
    self
) -> Dict

Create the item link.

def link_parent(
    self
) -> Dict

Create the parent 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.

CollectionLinksBase

class CollectionLinksBase(
    request: starlette.requests.Request,
    collection_id: str
)

Create inferred links specific to collections.

Ancestors (in MRO)

  • stac_fastapi.pgstac.models.links.BaseLinks

Descendants

  • stac_fastapi.pgstac.models.links.CollectionLinks
  • stac_fastapi.pgstac.models.links.ItemCollectionLinks
  • stac_fastapi.pgstac.models.links.ItemLinks

Instance variables

base_url

Get the base url.

url

Get the current request url.

Methods

def collection_link(
    self,
    rel: str = 'collection'
) -> Dict

Create a link to a collection.

def create_links(
    self
) -> List[Dict[str, Any]]

Return all inferred links.

def get_links(
    self,
    extra_links: Optional[List[Dict[str, Any]]] = None
) -> List[Dict[str, 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 ItemCollectionLinks(
    request: starlette.requests.Request,
    collection_id: str
)

Create inferred links specific to collections.

Ancestors (in MRO)

  • stac_fastapi.pgstac.models.links.CollectionLinksBase
  • stac_fastapi.pgstac.models.links.BaseLinks

Instance variables

base_url

Get the base url.

url

Get the current request url.

Methods

def collection_link(
    self,
    rel: str = 'collection'
) -> Dict

Create a link to a collection.

def create_links(
    self
) -> List[Dict[str, Any]]

Return all inferred links.

def get_links(
    self,
    extra_links: Optional[List[Dict[str, Any]]] = None
) -> List[Dict[str, 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_collection(
    self
) -> Dict

Create the collection link.

def link_parent(
    self
) -> Dict

Create the parent 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 ItemLinks(
    request: starlette.requests.Request,
    collection_id: str,
    item_id: str
)

Create inferred links specific to items.

Ancestors (in MRO)

  • stac_fastapi.pgstac.models.links.CollectionLinksBase
  • stac_fastapi.pgstac.models.links.BaseLinks

Instance variables

base_url

Get the base url.

url

Get the current request url.

Methods

def collection_link(
    self,
    rel: str = 'collection'
) -> Dict

Create a link to a collection.

def create_links(
    self
) -> List[Dict[str, Any]]

Return all inferred links.

def get_links(
    self,
    extra_links: Optional[List[Dict[str, Any]]] = None
) -> List[Dict[str, 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_collection(
    self
) -> Dict

Create the collection link.

def link_parent(
    self
) -> Dict

Create the parent link.

def link_root(
    self
) -> Dict

Return the catalog root.

def link_self(
    self
) -> Dict

Create the self link.

resolve

def resolve(
    self,
    url
)

Resolve url to the current request url.

class PagingLinks(
    request: starlette.requests.Request,
    *,
    next: Optional[str] = None,
    prev: Optional[str] = None
)

Create links for paging.

Ancestors (in MRO)

  • stac_fastapi.pgstac.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, Any]]

Return all inferred links.

def get_links(
    self,
    extra_links: Optional[List[Dict[str, Any]]] = None
) -> List[Dict[str, 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
) -> Optional[Dict[str, Any]]

Create link for next page.

def link_prev(
    self
) -> Optional[Dict[str, Any]]

Create link for previous 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.