Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prev or previous relation in Links #159

Open
vincentsarago opened this issue Oct 10, 2024 · 0 comments
Open

prev or previous relation in Links #159

vincentsarago opened this issue Oct 10, 2024 · 0 comments

Comments

@vincentsarago
Copy link
Member

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant