Skip to content

prev or previous relation in Links #159

Description

@vincentsarago

right now stac-fastapi-pgstac uses previous, while pgstac use prev
https://github.com/stac-utils/pgstac/blob/8a37c997f31439d203ee586fa8fdeb60d10b2f4b/src/pgstac/sql/004a_collectionsearch.sql#L121
https://github.com/stac-utils/pgstac/blob/8a37c997f31439d203ee586fa8fdeb60d10b2f4b/src/pgstac/sql/004_search.sql#L1029

def link_prev(self) -> Optional[Dict[str, Any]]:
"""Create link for previous page."""
if self.prev is not None:
method = self.request.method
if method == "GET":
href = merge_params(self.url, {"token": f"prev:{self.prev}"})
return {
"rel": Relations.previous.value,
"type": MimeTypes.geojson.value,
"method": method,
"href": href,
}
if method == "POST":
return {
"rel": Relations.previous,
"type": MimeTypes.geojson,
"method": method,
"href": f"{self.request.url}",
"body": {**self.request.postbody, "token": f"prev:{self.prev}"},
}
return None

In the stac specs it's not specified which one to use but I feel we should at least use the same one as pgstac

from https://www.iana.org/assignments/link-relations/link-relations.xml

prev Indicates that the link's context is a part of a series, and that the previous in the series is the link target. [HTML]
previous Refers to the previous resource in an ordered series of resources. Synonym for "prev". [HTML 4.01 Specification]

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions