-
Notifications
You must be signed in to change notification settings - Fork 0
Pass items endpoint data into item model [DR-3855] #453
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "uuid": "1df2df50-c32b-0133-e4e8-60f81dd2b63c", | ||
| "buyable": false, | ||
| "isRestricted": false, | ||
| "permittedLocationText": null, | ||
| "contentType": "audio", | ||
| "yearStart": null, | ||
| "yearEnd": null, | ||
| "citationResourceType": "Sound Recording", | ||
| "captures": [ | ||
| { | ||
| "uuid": "abcd", | ||
| "imageId": null, | ||
| "orderInSequence": 1 | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| { | ||
| "uuid": "d6799d40-c0bf-0139-b046-0242ac110004", | ||
| "buyable": false, | ||
| "isRestricted": false, | ||
| "permittedLocationText": null, | ||
| "contentType": "image", | ||
| "yearStart": null, | ||
| "yearEnd": null, | ||
| "citationResourceType": "Three Dimensional Object", | ||
| "captures": [ | ||
| { | ||
| "uuid": "abcd", | ||
| "imageId": "58317977", | ||
| "orderInSequence": 1 | ||
| }, | ||
| { | ||
| "uuid": "abcd", | ||
| "imageId": "58317978", | ||
| "orderInSequence": 2 | ||
| }, | ||
| { | ||
| "uuid": "abcd", | ||
| "imageId": "58317979", | ||
| "orderInSequence": 3 | ||
| }, | ||
| { | ||
| "uuid": "abcd", | ||
| "imageId": "58317980", | ||
| "orderInSequence": 4 | ||
| }, | ||
| { | ||
| "uuid": "abcd", | ||
| "imageId": "58317981", | ||
| "orderInSequence": 5 | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "uuid": "a9c43f00-c600-012f-59c3-58d385a7bc34", | ||
| "buyable": false, | ||
| "isRestricted": false, | ||
| "permittedLocationText": null, | ||
| "contentType": "image", | ||
| "yearStart": null, | ||
| "yearEnd": null, | ||
| "citationResourceType": "Still Image", | ||
| "captures": [ | ||
| { | ||
| "uuid": "abcd", | ||
| "imageId": "1107651", | ||
| "orderInSequence": 1 | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "uuid": "/33e3aab0-16fc-013d-c413-0242ac110002", | ||
| "buyable": false, | ||
| "isRestricted": true, | ||
| "permittedLocationText": null, | ||
| "contentType": "video", | ||
| "yearStart": null, | ||
| "yearEnd": null, | ||
| "citationResourceType": "Moving Image", | ||
| "captures": [] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "uuid": "794fcf20-b822-0133-7afc-60f81dd2b63c", | ||
| "buyable": false, | ||
| "isRestricted": true, | ||
| "permittedLocationText": null, | ||
| "contentType": "audio", | ||
| "yearStart": null, | ||
| "yearEnd": null, | ||
| "citationResourceType": "Sound Recording", | ||
| "captures": [] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "uuid": "0b850640-e377-0130-8565-3c075448cc4b", | ||
| "buyable": false, | ||
| "isRestricted": false, | ||
| "permittedLocationText": null, | ||
| "contentType": "video", | ||
| "yearStart": null, | ||
| "yearEnd": null, | ||
| "citationResourceType": "Moving Image", | ||
| "captures": [] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "uuid": "fd2f5090-0381-0131-a95f-3c075448cc4b", | ||
| "buyable": false, | ||
| "isRestricted": false, | ||
| "permittedLocationText": null, | ||
| "contentType": "video", | ||
| "yearStart": null, | ||
| "yearEnd": null, | ||
| "citationResourceType": "Moving Image", | ||
| "captures": [ | ||
| { | ||
| "uuid": "abcd", | ||
| "imageId": null, | ||
| "orderInSequence": 1 | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| export interface APICapture { | ||
| uuid: string; | ||
| imageId: string | null; | ||
| orderInSequence: number; | ||
| } | ||
|
|
||
| export interface APIItem { | ||
| uuid: string; | ||
| buyable: boolean; | ||
| isRestricted: boolean; | ||
| permittedLocationText: string | null; | ||
| contentType: string | null; | ||
| yearStart: string | null; | ||
| yearEnd: string | null; | ||
| citationResourceType: string | null; | ||
| captures: APICapture[]; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ import { | |
| } from "../../config/constants"; | ||
| import { fetchApi } from "../fetchApi/fetchApi"; | ||
| import { Filter } from "../../types/FilterType"; | ||
| import { APIItem } from "@/src/types/CollectionsAPI"; | ||
|
|
||
| export class CollectionsApi { | ||
| static async getCaptureMetadata(uuid: string) { | ||
|
|
@@ -153,7 +154,7 @@ export class CollectionsApi { | |
| }); | ||
| } | ||
|
|
||
| static async getItemData(uuid: string) { | ||
| static async getItemData(uuid: string): Promise<APIItem> { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. like it ... just wondering if we're SURE we have ALL the fields we need in the ApiItem interface
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't yet! The page is still getting hydrated with both this and the manifest, this PR was just preliminary to split up some of the work. Once https://github.com/NYPL/collections-api/pull/243, I'll add a followup to this PR to completely cut out the manifest calls. |
||
| return await fetchApi({ | ||
| apiUrl: `${process.env.COLLECTIONS_API_URL}/items/${uuid}`, | ||
| options: { isRepoApi: false }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice