-
-
Notifications
You must be signed in to change notification settings - Fork 0
Endpoints
Peter Araujo edited this page Jul 28, 2024
·
1 revision
Each service exposes endpoints as functions depending on the resource.
The default functions return a parsed response as a model object.
You can access the base endpoint (for example: /artworks
) like this:
{yourService}.getItems()
For example:
val artworkService = ArtworkService()
val response = artworkService.getItems(limit = 2)
You can access the search endpoint (for example: /artworks/search
) like this:
{yourService}.search()
For example:
val artworkService = ArtworkService()
val response = artworkService.search(search = "monet")
You can access the "get by id" endpoint (for example: /artworks/4
) like this:
{yourService}.getById()
For example:
val artworkService = ArtworkService()
val response = artworkService.getById(id = 4)
This is an artwork-exclusive endpoint (artworks/4/manifest.json
). You can access it like this:
{yourArtworkService}.getArtworkManifest(id = 4)
For example:
val artworkService = ArtworkService()
val response = artworkService.getArtworkManifest(id = 4)
All endpoints are supported.
You can also obtain the response as HttpResponse
.
To get HttpResponse
as response:
{yourService}.{NormalEndpoint} + AsHttpResponse()
For example:
val artworkService = ArtworkService()
val response = artworkService.getItemsAsHttpResponse(limit = 2)
For every regular endpoint there is a complementary "AsHttpResponse" endpoint.