import { factory } from 'factory-bot' import { datatype, date, internet, random } from 'faker' factory.define( 'youtube_playlist_data', function(attrs) { Object.assign(this, attrs) }, { kind: () => 'youtube#playlist', etag: datatype.uuid, id: datatype.uuid, snippet: () => ({ publishedAt: date.past(1).toISOString(), channelId: datatype.uuid(), title: random.word(), description: random.words(), thumbnails: { default: { url: internet.url(), width: 120, height: 90, }, medium: { url: internet.url(), width: 320, height: 180, }, high: { url: internet.url(), width: 480, height: 360, }, standard: { url: internet.url(), width: 640, height: 480, }, maxres: { url: internet.url(), width: 1280, height: 720, }, }, channelTitle: random.words(), localized: { title: random.word(), description: random.words(), }, }), }, ) factory.define( 'youtube_video_data', function(attrs) { Object.assign(this, attrs) }, { kind: () => 'youtube#video', etag: datatype.uuid, id: datatype.uuid, snippet: () => ({ publishedAt: date.past(1).toISOString(), channelId: datatype.uuid(), title: random.word(), description: random.words(), thumbnails: { default: { url: internet.url(), width: 120, height: 90, }, medium: { url: internet.url(), width: 320, height: 180, }, high: { url: internet.url(), width: 480, height: 360, }, standard: { url: internet.url(), width: 640, height: 480, }, maxres: { url: internet.url(), width: 1280, height: 720, }, }, channelTitle: random.words(), localized: { title: random.word(), description: random.words(), }, categoryId: datatype.number(30), liveBroadcastContent: 'none', defaultAudioLanguage: 'pt', tags: [random.word()], }), }, ) factory.define( 'youtube_playlistitem_data', function(attrs) { Object.assign(this, attrs) }, { kind: () => 'youtube#playlistItem', etag: datatype.uuid, id: datatype.uuid, snippet: () => ({ publishedAt: date.past(1).toISOString(), channelId: datatype.uuid(), title: random.word(), description: random.words(), thumbnails: { default: { url: internet.url(), width: 120, height: 90, }, medium: { url: internet.url(), width: 320, height: 180, }, high: { url: internet.url(), width: 480, height: 360, }, standard: { url: internet.url(), width: 640, height: 480, }, maxres: { url: internet.url(), width: 1280, height: 720, }, }, channelTitle: random.words(), playlistId: datatype.uuid(), position: datatype.number(10), resourceId: { kind: 'youtube#video', videoId: datatype.uuid(), }, videoOwnerChannelTitle: random.words(), videoOwnerChannelId: datatype.uuid(), }), }, ) factory.define( 'youtube_playlists_list_data', function(attrs) { Object.assign(this, attrs) }, { kind: () => 'youtube#playlistListResponse', etag: datatype.uuid, nextPageToken: random.word, pageInfo: { totalResults: datatype.number(30), resultsPerPage: datatype.number(10), }, items: factory.assocAttrsMany('youtube_playlist_data', 2), }, ) factory.define( 'youtube_videos_list_data', function(attrs) { Object.assign(this, attrs) }, { kind: () => 'youtube#videoListResponse', etag: datatype.uuid, nextPageToken: random.word, pageInfo: { totalResults: datatype.number(30), resultsPerPage: datatype.number(10), }, items: factory.assocAttrsMany('youtube_video_data', 2), }, ) factory.define( 'youtube_playlistitems_list_data', function(attrs) { Object.assign(this, attrs) }, { kind: () => 'youtube#playlistItemListResponse', etag: datatype.uuid, nextPageToken: random.word, pageInfo: { totalResults: datatype.number(30), resultsPerPage: datatype.number(10), }, items: factory.assocAttrsMany('youtube_playlistitem_data', 2), }, ) export { factory }