Skip to content

Commit 565ee40

Browse files
committed
feat: add widgets
1 parent 9cabb37 commit 565ee40

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

docs/client.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Client reference
44
.. autoclass:: topgg.client.Client
55
:members:
66

7+
.. automodule:: topgg.widget
8+
:members:
9+
710
.. autoclass:: topgg.models.SortBy()
811
:members:
912

topgg/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from .webhooks import Vote, Webhooks
2929
from .version import VERSION
3030
from .client import Client
31+
from . import widget
3132

3233

3334
__title__ = 'topggpy'
@@ -49,4 +50,5 @@
4950
'Vote',
5051
'Voter',
5152
'Webhooks',
53+
'widget',
5254
)

topgg/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from .version import VERSION
4141

4242

43-
BASE_URL = 'https://top.gg/api'
43+
BASE_URL = 'https://top.gg/api/v1'
4444
MAXIMUM_DELAY_THRESHOLD = 5.0
4545

4646

topgg/widget.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from .client import BASE_URL
2+
3+
def servers(id: int) -> str:
4+
"""
5+
Generates a large widget URL.
6+
7+
:param id: The requested ID.
8+
:type id: :py:class:`int`
9+
10+
:returns: The widget URL.
11+
:rtype: :py:class:`str`
12+
"""
13+
14+
return f'{BASE_URL}/widgets/large/{id}'

0 commit comments

Comments
 (0)