Leaderboard canvas dilengkapi dengan rank image display, cocok untuk game RPG bot chat. Berikut code example tutorial penggunaannya.
https://editor.vreden.my.id/topglobal
Header | Type | Description |
---|---|---|
Content-Type | String | image/png |
Berikut adalah contoh URLSearchParams request yang bisa dipakai untuk mendapatkan image topglobal template.
{ "background": "url background", "rank1": "bronze", "rank2": "silver", "rank3": "gold", "point1": 12345, "point2": 67890, "point3": 11223, "users1": "Name User1", "users2": "Name User2", "users3": "Name User3", "rankid1": 1, "rankid2": 2, "rankid3": 3, "profile1": "url profile 1", "profile2": "url profile 2", "profile3": "url profile 3" }
Berikut adalah contoh code yang bisa di pakai untuk mendapatkan image tersebut.
const apiUrl = 'url endpoint' const params = new URLSearchParams({ background: 'url background', rank1: 'bronze', rank2: 'silver', rank3: 'gold', point1: 12345, point2: 67890, point3: 11223, users1: 'Name User1', users2: 'Name User2', users3: 'Name User3', rankid1: 1, rankid2: 2, rankid3: 3, profile1: 'url profile 1', profile2: 'url profile 2', profile3: 'url profile 3' }).toString(); const fullUrl = `${apiUrl}?${params}`
Keterangan untuk const yang ada di code tersebut.
Field | Type | Description |
---|---|---|
apiUrl | URL | Berisi URL endpoint web api |
params | JSON | Isi JSON data yang di convert ke params URL |
fullUrl | URL | Hasil akhir dari search params, ini yang digunakan untuk get buffer |
Keterangan untuk params request URLSearchParams.
Field | Type | Description |
---|---|---|
background | URL | (800x300) URL gambar latar belakang leaderboard. |
rank1 | String | Rank untuk user pertama. Pilihan: bronze, silver, gold, platinum, diamond, heroic, master, grandmaster. |
rank2 | String | Rank untuk user kedua. Pilihan: bronze, silver, gold, platinum, diamond, heroic, master, grandmaster. |
rank3 | String | Rank untuk user ketiga. Pilihan: bronze, silver, gold, platinum, diamond, heroic, master, grandmaster. |
point1 | Number | Poin yang dimiliki oleh user pertama. |
point2 | Number | Poin yang dimiliki oleh user kedua. |
point3 | Number | Poin yang dimiliki oleh user ketiga. |
users1 | String | Nama user pertama. |
users2 | String | Nama user kedua. |
users3 | String | Nama user ketiga. |
rankid1 | Number | ID rank untuk user pertama sesuai rank yang dipilih. Valid ID untuk setiap rank:
|
rankid2 | Number | ID rank untuk user kedua sesuai rank yang dipilih. Valid ID untuk setiap rank:
|
rankid3 | Number | ID rank untuk user ketiga sesuai rank yang dipilih. Valid ID untuk setiap rank:
|
profile1 | URL | URL foto profil user pertama. |
profile2 | URL | URL foto profil user kedua. |
profile3 | URL | URL foto profil user ketiga. |