From 8c9c3548a5ad8631237c10ba7b06fa544dff1396 Mon Sep 17 00:00:00 2001 From: Aleksey Klimenko Date: Sun, 24 Mar 2019 03:46:21 +0300 Subject: [PATCH 1/2] [lyricist] added new definitions and tests (cherry picked from commit 79773d45b14e6e60ae76530cdb13ab7728afd22c) --- types/lyricist/index.d.ts | 333 +++++++++++++++++++++++++++++++ types/lyricist/lyricist-tests.ts | 38 ++++ types/lyricist/tsconfig.json | 24 +++ types/lyricist/tslint.json | 79 ++++++++ 4 files changed, 474 insertions(+) create mode 100644 types/lyricist/index.d.ts create mode 100644 types/lyricist/lyricist-tests.ts create mode 100644 types/lyricist/tsconfig.json create mode 100644 types/lyricist/tslint.json diff --git a/types/lyricist/index.d.ts b/types/lyricist/index.d.ts new file mode 100644 index 0000000000..b3bd659fff --- /dev/null +++ b/types/lyricist/index.d.ts @@ -0,0 +1,333 @@ +// Type definitions for lyricist 2.2.2 +// Project: https://github.com/scf4/lyricist, https://www.npmjs.com/package/lyricist +// Definitions by: Aleksei Klimenko +// Definitions: https://github.com/DefinitelyTyped/ +// TypeScript Version: 2.7 + +declare module 'lyricist'; + +export default class Lyricist { + constructor(accessToken: string); + + album(id: number, opts?: { fetchTracklist?: boolean, textFormat?: LyricistTextFormat }): Promise; + + artist(id: number, opts: { textFormat?: LyricistTextFormat }): Promise; + + artistByName(name: string, opts: { textFormat?: LyricistTextFormat }): Promise; + + search(query: string): Promise; + + song(id: number, opts?: { fetchLyrics?: boolean, textFormat?: LyricistTextFormat }): Promise; + + songsByArtist(id: number, opts?: { page?: number, perPage?: number, sort?: 'asc' | 'desc' }): Promise; + +} + +export enum LyricistTextFormat { + DOM = 'dom', + PLAIN = 'plain', + HTML = 'html', +} + +export interface IDescription { + [LyricistTextFormat.DOM]?: object; + [LyricistTextFormat.PLAIN]?: string; + [LyricistTextFormat.HTML]?: string; +} + + +// Song ============================================================================================ +export interface ISong { + annotation_count: number; + api_path: string; + apple_music_id?: any; + apple_music_player_url: string; + description: IDescription; + embed_content: string; + featured_video: boolean; + full_title: string; + header_image_thumbnail_url: string; + header_image_url: string; + id: number; + lyrics: string; + lyrics_owner_id: number; + lyrics_state: string; + path: string; + pyongs_count?: any; + recording_location?: any; + release_date: string; + song_art_image_thumbnail_url: string; + song_art_image_url: string; + stats: { + accepted_annotations: number; + contributors: number; + hot: boolean; + iq_earners: number; + transcribers: number; + unreviewed_annotations: number; + verified_annotations: number; + pageviews: number; + }; + title: string; + title_with_featured: string; + url: string; + current_user_metadata: { + permissions: string[]; + excluded_permissions: string[]; + interactions: { + pyong: boolean; + following: boolean; + }; + relationships: any; + iq_by_action: any; + }; + album?: any; + custom_performances: any[]; + description_annotation: IDescriptionAnnotation; + featured_artists: any[]; + lyrics_marked_complete_by?: any; + media: IMedia[]; + primary_artist: IArtistBrief; + producer_artists: IArtistBrief[]; + song_relationships: Array<{ + type: string; + songs: any[]; + }>; + verified_annotations_by: any[]; + verified_contributors: any[]; + verified_lyrics_by: any[]; + writer_artists: IArtistBrief[]; +} + +export interface IClientTimestamps { + updated_by_human_at: number; + lyrics_updated_at: number; +} + +export interface IAvatarConfig { + url: string; + bounding_box: { + width: number; + height: number; + }; +} + +export interface IAvatar { + tiny: IAvatarConfig; + thumb: IAvatarConfig; + small: IAvatarConfig; + medium: IAvatarConfig; +} + +export interface IUser { + api_path: string; + avatar: IAvatar; + header_image_url: string; + human_readable_role_for_display: string; + id: number; + iq: number; + login: string; + name: string; + role_for_display: string; + url: string; + current_user_metadata: { + permissions: any[]; + excluded_permissions: string[]; + interactions: { + following: boolean; + }; + features: any[]; + }; +} + +export interface IAuthor { + attribution: number; + pinned_role?: any; + user: IUser; +} + +export interface IAnnotation { + api_path: string; + body: IDescription; + comment_count: number; + community: boolean; + custom_preview?: any; + has_voters: boolean; + id: number; + pinned: boolean; + share_url: string; + source?: any; + state: string; + url: string; + verified: boolean; + votes_total: number; + current_user_metadata: { + permissions: string[]; + excluded_permissions: string[]; + interactions: { + cosign: boolean; + pyong: boolean; + vote?: any; + }; + iq_by_action: any; + }; + authors: IAuthor[]; + cosigned_by: any[]; + rejection_comment?: any; + verified_by?: any; +} + +export interface IDescriptionAnnotation { + _type: string; + annotator_id: number; + annotator_login: string; + api_path: string; + classification: string; + fragment: string; + id: number; + is_description: boolean; + path: string; + range: { + content: string; + }; + song_id: number; + url: string; + verified_annotator_ids: any[]; + annotatable: { + api_path: string; + client_timestamps: IClientTimestamps; + context: string; + id: number; + image_url: string; + link_title: string; + title: string; + type: string; + url: string; + }; + annotations: IAnnotation[]; +} + +export interface IMedia { + provider: string; + start: number; + type: string; + url: string; +} + +export interface IArtistBrief { + api_path: string; + header_image_url: string; + id: number; + image_url: string; + is_meme_verified: boolean; + is_verified: boolean; + name: string; + url: string; +} + +// Artist ========================================================================================= +export interface IArtist { + alternate_names: any[]; + api_path: string; + description: IDescription; + facebook_name: string; + followers_count: number; + header_image_url: string; + id: number; + image_url: string; + instagram_name: string; + is_meme_verified: boolean; + is_verified: boolean; + name: string; + translation_artist: boolean; + twitter_name: string; + url: string; + current_user_metadata: { + permissions: string[]; + excluded_permissions: string[]; + interactions: { + following: boolean; + }; + }; + description_annotation: IDescriptionAnnotation; + user?: any; +} + +// Search ================================================ +export interface ISearchResult { + annotation_count: number; + api_path: string; + full_title: string; + header_image_thumbnail_url: string; + header_image_url: string; + id: number; + lyrics_owner_id: number; + lyrics_state: string; + path: string; + pyongs_count?: any; + song_art_image_thumbnail_url: string; + stats: { + hot: boolean; + unreviewed_annotations: number; + pageviews: number; + }; + title: string; + title_with_featured: string; + url: string; + primary_artist: IArtistBrief; +} + +// Song by Artist ========================================= +export interface ISongByArtist { + annotation_count: number; + api_path: string; + full_title: string; + header_image_thumbnail_url: string; + header_image_url: string; + id: number; + lyrics_owner_id: number; + lyrics_state: string; + path: string; + pyongs_count: number; + song_art_image_thumbnail_url: string; + stats: { + hot: boolean; + unreviewed_annotations: number; + pageviews: number; + }; + title: string; + title_with_featured: string; + url: string; + primary_artist: IArtistBrief; +} + +// Album ================================================= +export interface IAlbum { + api_path: string; + comment_count: number; + cover_art_url: string; + custom_header_image_url?: any; + full_title: string; + header_image_url: string; + id: number; + lock_state: string; + name: string; + pyongs_count: number; + release_date?: any; + release_date_components?: any; + url: string; + current_user_metadata: { + permissions: string[]; + excluded_permissions: string[]; + interactions: { + pyong: boolean; + }; + }; + song_pageviews: number; + artist: IArtistBrief; + cover_arts: any[]; + description_annotation: IDescriptionAnnotation; + performance_groups: any[]; + song_performances: any[]; +} + diff --git a/types/lyricist/lyricist-tests.ts b/types/lyricist/lyricist-tests.ts new file mode 100644 index 0000000000..57fa6367b8 --- /dev/null +++ b/types/lyricist/lyricist-tests.ts @@ -0,0 +1,38 @@ +// Type definitions for lyricist 2.2.2 +// Project: https://github.com/scf4/lyricist, https://www.npmjs.com/package/lyricist +// Definitions by: Aleksei Klimenko +// Definitions: https://github.com/DefinitelyTyped/ +// TypeScript Version: 2.7 + +import Lyricist, { IAlbum, IArtist, ISearchResult, ISong, ISongByArtist, LyricistTextFormat } from 'lyricist'; + +const lyricist = new Lyricist('access_token'); + +Promise + .all([ + lyricist.album(1, { fetchTracklist: true, textFormat: LyricistTextFormat.PLAIN }), + lyricist.artist(1, { textFormat: LyricistTextFormat.PLAIN }), + lyricist.artistByName('any_artist', { textFormat: LyricistTextFormat.PLAIN }), + lyricist.search('any_song'), + lyricist.song(1, { fetchLyrics: true, textFormat: LyricistTextFormat.PLAIN }), + lyricist.songsByArtist(1, { page: 1, perPage: 10, sort: 'asc' }), + ]) + .then((results) => { + const album: IAlbum = results[0]; + const artist: IArtist = results[1]; + const artistByName: IArtist = results[2]; + const searchResult: ISearchResult[] = results[3]; + const song: ISong = results[4]; + const songsByArtist: ISongByArtist[] = results[5]; + + console.log('album', album.name); + console.log('artist', artist.name); + console.log('artistByName', artistByName.name); + console.log('searchResult length', searchResult.length); + console.log('song', song.title); + console.log('songsByArtist length', songsByArtist.length); + }); + + + + diff --git a/types/lyricist/tsconfig.json b/types/lyricist/tsconfig.json new file mode 100644 index 0000000000..a2d4cd11b4 --- /dev/null +++ b/types/lyricist/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "lyricist-tests.ts" + ] +} diff --git a/types/lyricist/tslint.json b/types/lyricist/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/lyricist/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} From e81d6013b401555d6783150760a9d1b96d60c773 Mon Sep 17 00:00:00 2001 From: Aleksey Klimenko Date: Tue, 26 Mar 2019 00:08:55 +0300 Subject: [PATCH 2/2] [lyricist] removed additional tslint rules, updated export (cherry picked from commit ab214e91bdd8c47a14d3aaa41c28c9e5cc17b205) --- types/lyricist/index.d.ts | 607 +++++++++++++++---------------- types/lyricist/lyricist-tests.ts | 22 +- types/lyricist/tslint.json | 78 +--- 3 files changed, 313 insertions(+), 394 deletions(-) diff --git a/types/lyricist/index.d.ts b/types/lyricist/index.d.ts index b3bd659fff..1e378e6a0a 100644 --- a/types/lyricist/index.d.ts +++ b/types/lyricist/index.d.ts @@ -1,333 +1,332 @@ -// Type definitions for lyricist 2.2.2 +// Type definitions for lyricist 2.2 // Project: https://github.com/scf4/lyricist, https://www.npmjs.com/package/lyricist // Definitions by: Aleksei Klimenko // Definitions: https://github.com/DefinitelyTyped/ // TypeScript Version: 2.7 -declare module 'lyricist'; +declare class Lyricist { + constructor(accessToken: string); -export default class Lyricist { - constructor(accessToken: string); + album(id: number, opts?: { fetchTracklist?: boolean, textFormat?: Lyricist.LyricistTextFormat }): Promise; - album(id: number, opts?: { fetchTracklist?: boolean, textFormat?: LyricistTextFormat }): Promise; + artist(id: number, opts: { textFormat?: Lyricist.LyricistTextFormat }): Promise; - artist(id: number, opts: { textFormat?: LyricistTextFormat }): Promise; + artistByName(name: string, opts: { textFormat?: Lyricist.LyricistTextFormat }): Promise; - artistByName(name: string, opts: { textFormat?: LyricistTextFormat }): Promise; + search(query: string): Promise; - search(query: string): Promise; - - song(id: number, opts?: { fetchLyrics?: boolean, textFormat?: LyricistTextFormat }): Promise; - - songsByArtist(id: number, opts?: { page?: number, perPage?: number, sort?: 'asc' | 'desc' }): Promise; + song(id: number, opts?: { fetchLyrics?: boolean, textFormat?: Lyricist.LyricistTextFormat }): Promise; + songsByArtist(id: number, opts?: { page?: number, perPage?: number, sort?: 'asc' | 'desc' }): Promise; } -export enum LyricistTextFormat { - DOM = 'dom', - PLAIN = 'plain', - HTML = 'html', -} +declare namespace Lyricist { + enum LyricistTextFormat { + DOM = 'dom', + PLAIN = 'plain', + HTML = 'html', + } -export interface IDescription { - [LyricistTextFormat.DOM]?: object; - [LyricistTextFormat.PLAIN]?: string; - [LyricistTextFormat.HTML]?: string; -} + interface Description { + [LyricistTextFormat.DOM]?: object; + [LyricistTextFormat.PLAIN]?: string; + [LyricistTextFormat.HTML]?: string; + } + // Song ============================================================================================ + interface Song { + annotation_count: number; + api_path: string; + apple_music_id?: any; + apple_music_player_url: string; + description: Description; + embed_content: string; + featured_video: boolean; + full_title: string; + header_image_thumbnail_url: string; + header_image_url: string; + id: number; + lyrics: string; + lyrics_owner_id: number; + lyrics_state: string; + path: string; + pyongs_count?: any; + recording_location?: any; + release_date: string; + song_art_image_thumbnail_url: string; + song_art_image_url: string; + stats: { + accepted_annotations: number; + contributors: number; + hot: boolean; + iq_earners: number; + transcribers: number; + unreviewed_annotations: number; + verified_annotations: number; + pageviews: number; + }; + title: string; + title_with_featured: string; + url: string; + current_user_metadata: { + permissions: string[]; + excluded_permissions: string[]; + interactions: { + pyong: boolean; + following: boolean; + }; + relationships: any; + iq_by_action: any; + }; + album?: any; + custom_performances: any[]; + description_annotation: DescriptionAnnotation; + featured_artists: any[]; + lyrics_marked_complete_by?: any; + media: Media[]; + primary_artist: ArtistBrief; + producer_artists: ArtistBrief[]; + song_relationships: Array<{ + type: string; + songs: any[]; + }>; + verified_annotations_by: any[]; + verified_contributors: any[]; + verified_lyrics_by: any[]; + writer_artists: ArtistBrief[]; + } -// Song ============================================================================================ -export interface ISong { - annotation_count: number; - api_path: string; - apple_music_id?: any; - apple_music_player_url: string; - description: IDescription; - embed_content: string; - featured_video: boolean; - full_title: string; - header_image_thumbnail_url: string; - header_image_url: string; - id: number; - lyrics: string; - lyrics_owner_id: number; - lyrics_state: string; - path: string; - pyongs_count?: any; - recording_location?: any; - release_date: string; - song_art_image_thumbnail_url: string; - song_art_image_url: string; - stats: { - accepted_annotations: number; - contributors: number; - hot: boolean; - iq_earners: number; - transcribers: number; - unreviewed_annotations: number; - verified_annotations: number; - pageviews: number; - }; - title: string; - title_with_featured: string; - url: string; - current_user_metadata: { - permissions: string[]; - excluded_permissions: string[]; - interactions: { - pyong: boolean; - following: boolean; - }; - relationships: any; - iq_by_action: any; - }; - album?: any; - custom_performances: any[]; - description_annotation: IDescriptionAnnotation; - featured_artists: any[]; - lyrics_marked_complete_by?: any; - media: IMedia[]; - primary_artist: IArtistBrief; - producer_artists: IArtistBrief[]; - song_relationships: Array<{ - type: string; - songs: any[]; - }>; - verified_annotations_by: any[]; - verified_contributors: any[]; - verified_lyrics_by: any[]; - writer_artists: IArtistBrief[]; -} + interface ClientTimestamps { + updated_by_human_at: number; + lyrics_updated_at: number; + } -export interface IClientTimestamps { - updated_by_human_at: number; - lyrics_updated_at: number; -} + interface AvatarConfig { + url: string; + bounding_box: { + width: number; + height: number; + }; + } -export interface IAvatarConfig { - url: string; - bounding_box: { - width: number; - height: number; - }; -} + interface Avatar { + tiny: AvatarConfig; + thumb: AvatarConfig; + small: AvatarConfig; + medium: AvatarConfig; + } -export interface IAvatar { - tiny: IAvatarConfig; - thumb: IAvatarConfig; - small: IAvatarConfig; - medium: IAvatarConfig; -} + interface User { + api_path: string; + avatar: Avatar; + header_image_url: string; + human_readable_role_for_display: string; + id: number; + iq: number; + login: string; + name: string; + role_for_display: string; + url: string; + current_user_metadata: { + permissions: any[]; + excluded_permissions: string[]; + interactions: { + following: boolean; + }; + features: any[]; + }; + } -export interface IUser { - api_path: string; - avatar: IAvatar; - header_image_url: string; - human_readable_role_for_display: string; - id: number; - iq: number; - login: string; - name: string; - role_for_display: string; - url: string; - current_user_metadata: { - permissions: any[]; - excluded_permissions: string[]; - interactions: { - following: boolean; - }; - features: any[]; - }; -} + interface Author { + attribution: number; + pinned_role?: any; + user: User; + } -export interface IAuthor { - attribution: number; - pinned_role?: any; - user: IUser; -} + interface Annotation { + api_path: string; + body: Description; + comment_count: number; + community: boolean; + custom_preview?: any; + has_voters: boolean; + id: number; + pinned: boolean; + share_url: string; + source?: any; + state: string; + url: string; + verified: boolean; + votes_total: number; + current_user_metadata: { + permissions: string[]; + excluded_permissions: string[]; + interactions: { + cosign: boolean; + pyong: boolean; + vote?: any; + }; + iq_by_action: any; + }; + authors: Author[]; + cosigned_by: any[]; + rejection_comment?: any; + verified_by?: any; + } -export interface IAnnotation { - api_path: string; - body: IDescription; - comment_count: number; - community: boolean; - custom_preview?: any; - has_voters: boolean; - id: number; - pinned: boolean; - share_url: string; - source?: any; - state: string; - url: string; - verified: boolean; - votes_total: number; - current_user_metadata: { - permissions: string[]; - excluded_permissions: string[]; - interactions: { - cosign: boolean; - pyong: boolean; - vote?: any; - }; - iq_by_action: any; - }; - authors: IAuthor[]; - cosigned_by: any[]; - rejection_comment?: any; - verified_by?: any; -} + interface DescriptionAnnotation { + _type: string; + annotator_id: number; + annotator_login: string; + api_path: string; + classification: string; + fragment: string; + id: number; + is_description: boolean; + path: string; + range: { + content: string; + }; + song_id: number; + url: string; + verified_annotator_ids: any[]; + annotatable: { + api_path: string; + client_timestamps: ClientTimestamps; + context: string; + id: number; + image_url: string; + link_title: string; + title: string; + type: string; + url: string; + }; + annotations: Annotation[]; + } -export interface IDescriptionAnnotation { - _type: string; - annotator_id: number; - annotator_login: string; - api_path: string; - classification: string; - fragment: string; - id: number; - is_description: boolean; - path: string; - range: { - content: string; - }; - song_id: number; - url: string; - verified_annotator_ids: any[]; - annotatable: { - api_path: string; - client_timestamps: IClientTimestamps; - context: string; - id: number; - image_url: string; - link_title: string; - title: string; - type: string; - url: string; - }; - annotations: IAnnotation[]; -} + interface Media { + provider: string; + start: number; + type: string; + url: string; + } -export interface IMedia { - provider: string; - start: number; - type: string; - url: string; -} + interface ArtistBrief { + api_path: string; + header_image_url: string; + id: number; + image_url: string; + is_meme_verified: boolean; + is_verified: boolean; + name: string; + url: string; + } -export interface IArtistBrief { - api_path: string; - header_image_url: string; - id: number; - image_url: string; - is_meme_verified: boolean; - is_verified: boolean; - name: string; - url: string; -} - -// Artist ========================================================================================= -export interface IArtist { - alternate_names: any[]; - api_path: string; - description: IDescription; - facebook_name: string; - followers_count: number; - header_image_url: string; - id: number; - image_url: string; - instagram_name: string; - is_meme_verified: boolean; - is_verified: boolean; - name: string; - translation_artist: boolean; - twitter_name: string; - url: string; - current_user_metadata: { - permissions: string[]; - excluded_permissions: string[]; - interactions: { - following: boolean; - }; - }; - description_annotation: IDescriptionAnnotation; - user?: any; -} + // Artist ========================================================================================= + interface Artist { + alternate_names: any[]; + api_path: string; + description: Description; + facebook_name: string; + followers_count: number; + header_image_url: string; + id: number; + image_url: string; + instagram_name: string; + is_meme_verified: boolean; + is_verified: boolean; + name: string; + translation_artist: boolean; + twitter_name: string; + url: string; + current_user_metadata: { + permissions: string[]; + excluded_permissions: string[]; + interactions: { + following: boolean; + }; + }; + description_annotation: DescriptionAnnotation; + user?: any; + } // Search ================================================ -export interface ISearchResult { - annotation_count: number; - api_path: string; - full_title: string; - header_image_thumbnail_url: string; - header_image_url: string; - id: number; - lyrics_owner_id: number; - lyrics_state: string; - path: string; - pyongs_count?: any; - song_art_image_thumbnail_url: string; - stats: { - hot: boolean; - unreviewed_annotations: number; - pageviews: number; - }; - title: string; - title_with_featured: string; - url: string; - primary_artist: IArtistBrief; -} - -// Song by Artist ========================================= -export interface ISongByArtist { - annotation_count: number; - api_path: string; - full_title: string; - header_image_thumbnail_url: string; - header_image_url: string; - id: number; - lyrics_owner_id: number; - lyrics_state: string; - path: string; - pyongs_count: number; - song_art_image_thumbnail_url: string; - stats: { - hot: boolean; - unreviewed_annotations: number; - pageviews: number; - }; - title: string; - title_with_featured: string; - url: string; - primary_artist: IArtistBrief; -} - -// Album ================================================= -export interface IAlbum { - api_path: string; - comment_count: number; - cover_art_url: string; - custom_header_image_url?: any; - full_title: string; - header_image_url: string; - id: number; - lock_state: string; - name: string; - pyongs_count: number; - release_date?: any; - release_date_components?: any; - url: string; - current_user_metadata: { - permissions: string[]; - excluded_permissions: string[]; - interactions: { - pyong: boolean; - }; - }; - song_pageviews: number; - artist: IArtistBrief; - cover_arts: any[]; - description_annotation: IDescriptionAnnotation; - performance_groups: any[]; - song_performances: any[]; + interface SearchResult { + annotation_count: number; + api_path: string; + full_title: string; + header_image_thumbnail_url: string; + header_image_url: string; + id: number; + lyrics_owner_id: number; + lyrics_state: string; + path: string; + pyongs_count?: any; + song_art_image_thumbnail_url: string; + stats: { + hot: boolean; + unreviewed_annotations: number; + pageviews: number; + }; + title: string; + title_with_featured: string; + url: string; + primary_artist: ArtistBrief; + } + + // Song by Artist ========================================= + interface SongByArtist { + annotation_count: number; + api_path: string; + full_title: string; + header_image_thumbnail_url: string; + header_image_url: string; + id: number; + lyrics_owner_id: number; + lyrics_state: string; + path: string; + pyongs_count: number; + song_art_image_thumbnail_url: string; + stats: { + hot: boolean; + unreviewed_annotations: number; + pageviews: number; + }; + title: string; + title_with_featured: string; + url: string; + primary_artist: ArtistBrief; + } + + // Album ================================================= + interface Album { + api_path: string; + comment_count: number; + cover_art_url: string; + custom_header_image_url?: any; + full_title: string; + header_image_url: string; + id: number; + lock_state: string; + name: string; + pyongs_count: number; + release_date?: any; + release_date_components?: any; + url: string; + current_user_metadata: { + permissions: string[]; + excluded_permissions: string[]; + interactions: { + pyong: boolean; + }; + }; + song_pageviews: number; + artist: ArtistBrief; + cover_arts: any[]; + description_annotation: DescriptionAnnotation; + performance_groups: any[]; + song_performances: any[]; + } } +export = Lyricist; diff --git a/types/lyricist/lyricist-tests.ts b/types/lyricist/lyricist-tests.ts index 57fa6367b8..7320cac4c5 100644 --- a/types/lyricist/lyricist-tests.ts +++ b/types/lyricist/lyricist-tests.ts @@ -1,10 +1,10 @@ -// Type definitions for lyricist 2.2.2 // Project: https://github.com/scf4/lyricist, https://www.npmjs.com/package/lyricist // Definitions by: Aleksei Klimenko // Definitions: https://github.com/DefinitelyTyped/ -// TypeScript Version: 2.7 -import Lyricist, { IAlbum, IArtist, ISearchResult, ISong, ISongByArtist, LyricistTextFormat } from 'lyricist'; +import { Album, Artist, SearchResult, Song, SongByArtist, LyricistTextFormat } from 'lyricist'; + +import Lyricist = require('lyricist'); const lyricist = new Lyricist('access_token'); @@ -18,12 +18,12 @@ Promise lyricist.songsByArtist(1, { page: 1, perPage: 10, sort: 'asc' }), ]) .then((results) => { - const album: IAlbum = results[0]; - const artist: IArtist = results[1]; - const artistByName: IArtist = results[2]; - const searchResult: ISearchResult[] = results[3]; - const song: ISong = results[4]; - const songsByArtist: ISongByArtist[] = results[5]; + const album: Album = results[0]; + const artist: Artist = results[1]; + const artistByName: Artist = results[2]; + const searchResult: SearchResult[] = results[3]; + const song: Song = results[4]; + const songsByArtist: SongByArtist[] = results[5]; console.log('album', album.name); console.log('artist', artist.name); @@ -32,7 +32,3 @@ Promise console.log('song', song.title); console.log('songsByArtist length', songsByArtist.length); }); - - - - diff --git a/types/lyricist/tslint.json b/types/lyricist/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/lyricist/tslint.json +++ b/types/lyricist/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" }