-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Matcher: Get Package Metadata from TMDb
- Loading branch information
1 parent
2770cfa
commit 42c50d0
Showing
10 changed files
with
245 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,11 @@ | ||
module Matcher.API.Dto (ArtistExternalId (..), BaseExternalId (..)) where | ||
|
||
import Data.Aeson.Types | ||
|
||
data BaseExternalId = BaseExternalId | ||
{ url :: String, | ||
value :: String, | ||
description :: Maybe String, | ||
rating :: Maybe Int, | ||
providerName :: String | ||
} | ||
|
||
jsonPairs :: BaseExternalId -> [Pair] | ||
jsonPairs i = | ||
[ "url" .= url i, | ||
"value" .= value i, | ||
"description" .= description i, | ||
"rating" .= rating i, | ||
"provider_name" .= providerName i | ||
] | ||
|
||
data ArtistExternalId = ArtistExternalId | ||
{ artistId :: String, | ||
externalId :: BaseExternalId | ||
} | ||
|
||
instance ToJSON ArtistExternalId where | ||
toJSON (ArtistExternalId i d) = object $ ("artist_id" .= i) : jsonPairs d | ||
module Matcher.API.Dto ( | ||
ArtistExternalId (..), | ||
BaseExternalId (..), | ||
Artist (..), | ||
Package (..), | ||
PackageExternalId (..), | ||
) where | ||
|
||
import Matcher.API.Dto.Artist | ||
import Matcher.API.Dto.BaseExternalId | ||
import Matcher.API.Dto.Package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Matcher.API.Dto.Artist (ArtistExternalId (..), Artist (..)) where | ||
|
||
import Data.Aeson.Types | ||
import GHC.Generics (Generic) | ||
import Matcher.API.Dto.BaseExternalId | ||
|
||
data ArtistExternalId = ArtistExternalId | ||
{ artistId :: String, | ||
artistExternalId :: BaseExternalId | ||
} | ||
|
||
instance ToJSON ArtistExternalId where | ||
toJSON (ArtistExternalId i d) = object $ ("artist_id" .= i) : jsonPairs d | ||
|
||
data Artist = Artist | ||
Check warning on line 15 in matcher/src/Matcher/API/Dto/Artist.hs GitHub Actions / Lint
|
||
{ id :: String | ||
} | ||
deriving (Generic, Show) | ||
|
||
instance FromJSON Artist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Matcher.API.Dto.BaseExternalId (BaseExternalId (..), jsonPairs) where | ||
|
||
import Data.Aeson.Types | ||
|
||
data BaseExternalId = BaseExternalId | ||
{ url :: String, | ||
value :: String, | ||
description :: Maybe String, | ||
rating :: Maybe Int, | ||
providerName :: String | ||
} | ||
|
||
jsonPairs :: BaseExternalId -> [Pair] | ||
jsonPairs i = | ||
[ "url" .= url i, | ||
"value" .= value i, | ||
"description" .= description i, | ||
"rating" .= rating i, | ||
"provider_name" .= providerName i | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Matcher.API.Dto.Package (Package (..), PackageExternalId (..)) where | ||
|
||
import Data.Aeson.Types | ||
import GHC.Generics (Generic) | ||
import Matcher.API.Dto.BaseExternalId | ||
|
||
data Package = Package | ||
{ artist_name :: Maybe String, | ||
poster_id :: Maybe String | ||
} | ||
deriving (Generic, Show) | ||
|
||
instance FromJSON Package | ||
|
||
data PackageExternalId = PackageExternalId | ||
{ packageId :: String, | ||
packageExternalId :: BaseExternalId | ||
} | ||
|
||
instance ToJSON PackageExternalId where | ||
toJSON (PackageExternalId i d) = object $ ("package_id" .= i) : jsonPairs d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters