Added random photo/video request
This commit is contained in:
@@ -164,6 +164,26 @@ class VideoSearchQueryEmptyError(HTTPException):
|
||||
)
|
||||
|
||||
|
||||
class SearchLimitInvalidError(HTTPException):
|
||||
"""Raises HTTP 400 if search results limit not in valid range."""
|
||||
|
||||
def __init__(self):
|
||||
self.openapi = {
|
||||
"description": "Invalid Limit",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"example": {
|
||||
"detail": "Parameter 'limit' must be greater or equal to 1."
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
super().__init__(
|
||||
status_code=400,
|
||||
detail=self.openapi["content"]["application/json"]["example"]["detail"],
|
||||
)
|
||||
|
||||
|
||||
class SearchPageInvalidError(HTTPException):
|
||||
"""Raises HTTP 400 if page or page size are not in valid range."""
|
||||
|
||||
|
@@ -72,3 +72,11 @@ class SearchResultsPhoto(BaseModel):
|
||||
class SearchResultsVideo(BaseModel):
|
||||
results: List[VideoSearch]
|
||||
next_page: Union[str, None]
|
||||
|
||||
|
||||
class RandomSearchResultsPhoto(BaseModel):
|
||||
results: List[PhotoSearch]
|
||||
|
||||
|
||||
class RandomSearchResultsVideo(BaseModel):
|
||||
results: List[VideoSearch]
|
||||
|
Reference in New Issue
Block a user