import type { AxiosInstance } from 'contentful-sdk-core' ; import { CollectionProp , GetSnapshotForContentTypeParams , GetSnapshotForEntryParams , KeyValueMap , QueryParams , } from '../../../common-types' ; import { ContentTypeProps } from '../../../entities/content-type' ; import { EntryProps } from '../../../entities/entry' ; import { SnapshotProps } from '../../../entities/snapshot' ; import { RestEndpoint } from '../types' ; import * as raw from './raw' ; import { normalizeSelect } from './utils' ; const getBaseEntryUrl = ( params ) => `/spaces/${ params . spaceId }/environments/${ params . environmentId }/entries/${ params . entryId }/snapshots` ; const getEntryUrl = ( params ) => getBaseEntryUrl ( params ) + `/${ params . snapshotId }` ; export const getManyForEntry = < T extends KeyValueMap = KeyValueMap > ( http , params ) => { return raw . get < CollectionProp < SnapshotProps < EntryProps < T > > > > ( http , getBaseEntryUrl ( params ) , { params : normalizeSelect ( params . query ) , } ) ; } ; export const getForEntry = < T extends KeyValueMap = KeyValueMap > ( http , params ) => { return raw . get < SnapshotProps < EntryProps < T > > > ( http , getEntryUrl ( params ) ) ; } ; const getBaseContentTypeUrl = ( params ) => `/spaces/${ params . spaceId }/environments/${ params . environmentId }/content_types/${ params . contentTypeId }/snapshots` ; const getContentTypeUrl = ( params ) => getBaseContentTypeUrl ( params ) + `/${ params . snapshotId }` ; export const getManyForContentType = ( http , params ) => { return raw . get < CollectionProp < SnapshotProps < ContentTypeProps > > > ( http , getBaseContentTypeUrl ( params ) , { params : normalizeSelect ( params . query ) , } ) ; } ; export const getForContentType = ( http , params ) => { return raw . get < SnapshotProps < ContentTypeProps > > ( http , getContentTypeUrl ( params ) ) ; } ;