forked from sorare/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetBaseballCard.js
More file actions
37 lines (32 loc) · 793 Bytes
/
getBaseballCard.js
File metadata and controls
37 lines (32 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const { GraphQLClient, gql } = require("graphql-request");
const GetBaseballCardByAssetId = gql`
query GetBaseballCardByAssetId($slugs: [String!]) {
baseballCards(slugs: $slugs) {
assetId
slug
rarity
season
serialNumber
positions
team {
name
}
player {
displayName
}
}
}
`;
const slug = "aaron-judge-19920426-2022-unique-1"; // FIXME
async function main() {
const graphQLClient = new GraphQLClient("https://api.sorare.com/federation/graphql", {
headers: {
// AUTHENTICATION NOT SUPPORTED FOR NOW
},
});
const data = await graphQLClient.request(GetBaseballCardByAssetId, {
slugs: [slug]
});
console.log(data.baseballCards);
}
main().catch((error) => console.error(error));