Client.images¤
detail ¤
detail(
pk: Optional[str] = None,
api_url: Optional[str] = None,
**params: Any
) -> gcapi.models.HyperlinkedImage
Retrieve a specific resource by primary key, URL, or search parameters.
Parameters:
-
pk(Optional[str], default:None) –Primary key of the resource to retrieve.
-
api_url(Optional[str], default:None) –Direct API URL of the resource to retrieve.
-
**params(Any, default:{}) –Search parameters to find a unique resource, such as
slug="your-slug".
Returns:
-
HyperlinkedImage–The requested resource instance.
Raises:
-
ValueError–If more than one or none of pk, api_url, or params are specified.
-
ObjectNotFound–If no resource is found matching the criteria.
-
MultipleObjectsReturned–If multiple resources match the search parameters.
download ¤
download(
*,
filename: Union[str, Path],
image_type: Optional[str] = None,
pk: Optional[str] = None,
url: Optional[str] = None,
files: Optional[list] = None,
**params: Any
) -> list[Path]
Download image files to local filesystem.
Parameters:
-
filename(Union[str, Path]) –Base filename for downloaded files. Extension is added automatically.
-
image_type(Optional[str], default:None) –Restrict download to a particular image type.
-
pk(Optional[str], default:None) –Primary key of the image to download.
-
url(Optional[str], default:None) –API URL of the image to download.
-
files(Optional[list], default:None) –List of file objects to download directly.
-
**params(Any, default:{}) –Additional parameters for image detail lookup.
Returns:
-
list[Path]–List of Path objects for downloaded files.
Raises:
-
ValueError–If not exactly one of pk, url, files, or params is specified.
iterate_all ¤
Iterate through all resources from the API endpoint across all pages.
This method automatically handles pagination and yields individual resources from all pages until all resources have been retrieved.
Parameters:
-
params(Optional[dict[str, Any]], default:None) –Query parameters to include in the API requests.
Yields:
-
HyperlinkedImage–Individual resources from the API endpoint.
list ¤
Retrieve a raw list of resources from the API endpoint.
Parameters:
-
params(Optional[dict[str, Any]], default:None) –Query parameters to include in the API request.
Returns:
-
list[HyperlinkedImage]–Raw JSON response from the API containing the list of resources.
page ¤
page(
offset: int = 0,
limit: int = 100,
params: Optional[dict[str, Any]] = None,
) -> PageResult[gcapi.models.HyperlinkedImage]
Retrieve a paginated set of resources from the API endpoint.
Parameters:
-
offset(int, default:0) –The starting index for pagination (zero-based).
-
limit(int, default:100) –The maximum number of results to return in this page.
-
params(Optional[dict[str, Any]], default:None) –Additional query parameters to include in the API request.
Returns:
-
PageResult[HyperlinkedImage]–A paginated result containing the requested resources and metadata.