Skip to content

Commit

Permalink
move pagination models to extensions submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Jun 25, 2024
1 parent f311dc6 commit b4951d4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import attr
from fastapi import FastAPI

from stac_fastapi.api.models import GETPagination, POSTPagination
from stac_fastapi.types.extension import ApiExtension

from .request import GETPagination, POSTPagination


@attr.s
class PaginationExtension(ApiExtension):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Pagination extension request models."""

from typing import Optional

import attr
from pydantic import BaseModel

from stac_fastapi.types.search import APIRequest


@attr.s
class GETTokenPagination(APIRequest):
"""Token pagination for GET requests."""

token: Optional[str] = attr.ib(default=None)


class POSTTokenPagination(BaseModel):
"""Token pagination model for POST requests."""

token: Optional[str] = None


@attr.s
class GETPagination(APIRequest):
"""Page based pagination for GET requests."""

page: Optional[str] = attr.ib(default=None)


class POSTPagination(BaseModel):
"""Page based pagination for POST requests."""

page: Optional[str] = None
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import attr
from fastapi import FastAPI

from stac_fastapi.api.models import GETTokenPagination, POSTTokenPagination
from stac_fastapi.types.extension import ApiExtension

from .request import GETTokenPagination, POSTTokenPagination


@attr.s
class TokenPaginationExtension(ApiExtension):
Expand Down

0 comments on commit b4951d4

Please sign in to comment.