Skip to content

Commit f2e5c05

Browse files
committed
Added Docs + setup.py for building lib
1 parent ae91b21 commit f2e5c05

File tree

5 files changed

+441
-7
lines changed

5 files changed

+441
-7
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,33 @@
11
# XPA (Xbox Python API)
2-
Xbox Python API wrapper based on https://xbl.io.
2+
Xbox Python API wrapper based on https://xbl.io.
3+
4+
## Installation
5+
```bash
6+
pip install xbox-python-api
7+
```
8+
9+
## Usage
10+
Create an instance of the `XPA` class with your API key.
11+
```python
12+
from xpa import XPA
13+
14+
xpa = XPA(api_key="YOUR_API_KEY")
15+
```
16+
17+
## Code example
18+
```python
19+
from xpa import XPA
20+
21+
xpa = XPA(api_key="YOUR_API_KEY")
22+
23+
# Get account gamertag
24+
account_info = xpa.get_account_info_xuid(xuid="xuid")
25+
print(account_info.Gamertag)
26+
27+
28+
# Get user presence
29+
presence = xpa.get_presence(xuid="xuid")
30+
print(presence.state)
31+
```
32+
33+
Full documentation can be found [here](docs).

docs/XPA.md

Lines changed: 338 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
# XPA Class Documentation
2+
3+
## Overview
4+
The `XPA` class provides methods for accessing Xbox Live API endpoints to retrieve various information related to Xbox Live users, achievements, clubs, Game Pass, marketplace, sessions, groups, etc.
5+
6+
## Constructor
7+
### `__init__(self, api_key)`
8+
- **Description:** Initializes the XPA class with the provided API key.
9+
- **Parameters:**
10+
- `api_key` (str): The API key used for authentication.
11+
12+
## Methods
13+
### `get_account_info_xuid(xuid: str) -> ACCOUNT_INFO_XUID`
14+
- **Description:** Get someone's profile information using their XUID (Xbox User ID).
15+
- **Parameters:**
16+
- `xuid` (str): XUID of the specified user.
17+
- **Returns:** An instance of `ACCOUNT_INFO_XUID` with the following attributes:
18+
- `GameDisplayPicRaw` (str): URL of the user's profile picture.
19+
- `Gamerscore` (str): User's gamerscore.
20+
- `Gamertag` (str): User's gamertag.
21+
- `AccountTier` (str): User's account tier.
22+
- `XboxOneRep` (str): User's Xbox One reputation.
23+
- `PreferredColor` (str): User's preferred color.
24+
- `RealName` (str): User's real name.
25+
- `Bio (str)`: User's bio.
26+
- `Location (str)`: User's location.
27+
28+
### `get_account_info_gamertag(gamertag: str) -> ACCOUNT_INFO_GAMERTAG`
29+
- **Description:** Get someone's profile information using their Gamertag.
30+
- **Parameters:**
31+
- `gamertag` (str): Gamertag of the specified user.
32+
- **Returns:** An instance of `ACCOUNT_INFO_GAMERTAG` with the following attributes:
33+
- `xuid` (str): User's XUID.
34+
- `displayName` (str): User's display name.
35+
- `realName` (str): User's real name.
36+
- `displayPicRaw` (str): URL of the user's profile picture.
37+
- `showUserAsAvatar` (bool): Whether to show the user as an avatar.
38+
- `gamertag` (str): User's gamertag.
39+
- `gamerScore` (str): User's gamerscore.
40+
- `modernGamertag` (str): User's modern gamertag.
41+
- `modernGamertagSuffix` (str): User's modern gamertag suffix.
42+
- `uniqueModernGamertag` (str): User's unique modern gamertag.
43+
- `xboxOneRep` (str): User's Xbox One reputation.
44+
- `presenceState` (str): User's presence state.
45+
- `presenceText` (str): User's presence text.
46+
- `presenceDevices` (list): List of devices the user is present on.
47+
- `isBroadcasting` (bool): Whether the user is broadcasting.
48+
- `isCloaked` (bool): Whether the user is cloaked.
49+
- `isQuarantined` (bool): Whether the user is quarantined.
50+
- `isXbox360Gamerpic` (bool): Whether the user has an Xbox 360 gamerpic.
51+
- `lastSeenDateTimeUTC` (str): Last seen date and time in UTC.
52+
- `preferredColor` (str): User's preferred color.
53+
- `presenceDetails` (str): User's presence details.
54+
- `titlePresence` (str): User's title presence.
55+
- `titleSummaries` (list): List of title summaries.
56+
- `accountTier` (str): User's account tier.
57+
- `bio` (str): User's bio.
58+
- `isVerified` (bool): Whether the user is verified.
59+
- `location` (str): User's location.
60+
- `tenure` (str): User's tenure.
61+
- `watermarks` (list): List of watermarks.
62+
- `blocked` (bool): Whether the user is blocked.
63+
- `mute` (bool): Whether the user is muted.
64+
- `followerCount` (int): Number of followers.
65+
- `followingCount` (int): Number of users the user is following.
66+
- `hasGamePass` (bool): Whether the user has Game Pass.
67+
- `socialManager` (str): User's social manager.
68+
- `broadcast` (str): User's broadcast.
69+
- `avatar` (str): User's avatar.
70+
- `linkedAccounts` (list): List of linked accounts.
71+
- `colorTheme` (str): User's color theme.
72+
- `preferredPlatforms` (list): List of preferred platforms.
73+
74+
### `get_presence(xuid: str) -> XUID_PRESENCE`
75+
- **Description:** Get user presence information using their XUID.
76+
- **Parameters:**
77+
- `xuid` (str): XUID of the specified user.
78+
- **Returns:** An instance of `XUID_PRESENCE` with the following attributes:
79+
- `state` (str): User's state.
80+
- `last_seen_device_type` (str): User's last seen device type.
81+
- `last_seen_title_id` (str): User's last seen title ID.
82+
- `last_seen_title_name` (str): User's last seen title name.
83+
- `last_seen_timestamp` (str): User's last seen timestamp.
84+
85+
### `get_user_achievements(xuid: str) -> list`
86+
- **Description:** Get user achievements using their XUID.
87+
- **Parameters:**
88+
- `xuid` (str): XUID of the specified user.
89+
- **Returns:** A list of user achievements.
90+
91+
### `get_title_achievements(xuid: str, titleId: str) -> list`
92+
- **Description:** Get user achievements for a specific title using their XUID and the title ID.
93+
- **Parameters:**
94+
- `xuid` (str): XUID of the specified user.
95+
- `titleId` (str): Title ID of the specified title.
96+
- **Returns:** A list of user achievements for the specified title.
97+
98+
### `get_title360_achievements(xuid: str, titleId: str) -> list`
99+
- **Description:** Get user achievements for a specific Xbox 360 title using their XUID and the title ID.
100+
- **Parameters:**
101+
- `xuid` (str): XUID of the specified user.
102+
- `titleId` (str): Title ID of the specified Xbox 360 title.
103+
- **Returns:** A list of user achievements for the specified Xbox 360 title.
104+
105+
### `get_player360_achievements(xuid: str, titleId: str) -> list`
106+
- **Description:** Get player achievements for a specific Xbox 360 title using their XUID and the title ID.
107+
- **Parameters:**
108+
- `xuid` (str): XUID of the specified user.
109+
- `titleId` (str): Title ID of the specified Xbox 360 title.
110+
- **Returns:** A list of player achievements for the specified Xbox 360 title.
111+
112+
### `get_club_details(clubId: str) -> CLUB_DETAILS`
113+
- **Description:** Get club details using the club ID.
114+
- **Parameters:**
115+
- `clubId` (str): Club ID of the specified club.
116+
- **Returns:** An instance of `CLUB_DETAILS` with the following attributes:
117+
- `identificator` (str): Club's identificator.
118+
- `clubType` (str): Club's type.
119+
- `creationDateUtc` (str): Club's creation date in UTC.
120+
- `settings` (list): Club's settings.
121+
- `followersCount` (int): Number of followers.
122+
- `membersCount` (int): Number of members.
123+
- `moderatorsCount` (int): Number of moderators.
124+
- `recommendedCount` (int): Number of recommended.
125+
- `requestedToJoinCount` (int): Number of requested to join.
126+
- `clubPresenceCount` (int): Number of club presence.
127+
- `clubPresenceTodayCount` (int): Number of club presence today.
128+
- `clubPresenceInGameCount` (int): Number of club presence in-game.
129+
- `roster` (list): Club's roster.
130+
- `targetRoles` (list): Club's target roles.
131+
- `recommendation` (list): Club's recommendations.
132+
- `clubPresence` (list): Club's presence.
133+
- `state` (str): Club's state.
134+
- `suspendedUntilUtc` (str): Club's suspended until in UTC.
135+
- `reportCount` (int): Number of reports.
136+
- `reportedItemsCount` (int): Number of reported items.
137+
- `maxMembersPerClub` (int): Maximum number of members per club.
138+
- `ownerXuid` (str): Club's owner XUID.
139+
- `founderXuid` (str): Club's founder XUID.
140+
- `description` (str): Club's description.
141+
- `rules` (str): Club's rules.
142+
- `name` (str): Club's name.
143+
- `shortName` (str): Club's short name.
144+
- `isSearchable` (bool): Whether the club is searchable.
145+
- `isRecommendable` (bool): Whether the club is recommendable.
146+
- `requestToJoinEnabled` (bool): Whether request to join is enabled.
147+
- `openJoinEnabled` (bool): Whether open join is enabled.
148+
- `leaveEnabled` (bool): Whether leave is enabled.
149+
- `tranferOwnershipEnabled` (bool): Whether transfer ownership is enabled.
150+
- `matureContentEnabled` (bool): Whether mature content is enabled.
151+
- `watchClubTitlesOnly` (bool): Whether to watch club titles only.
152+
- `displayImageUrl` (str): Club's display image URL.
153+
- `backgroundImageUrl` (str): Club's background image URL.
154+
- `preferredLocale` (str): Club's preferred locale.
155+
- `tags` (list): Club's tags.
156+
- `associatedTitles` (list): Club's associated titles.
157+
- `primaryColor` (str): Club's primary color.
158+
- `secondaryColor` (str): Club's secondary color.
159+
- `tertiaryColor` (str): Club's tertiary color.
160+
161+
### `get_friends_xuid(xuid: str) -> ACCOUNT_INFO_GAMERTAG`
162+
- **Description:** Get user friends using their XUID.
163+
- **Parameters:**
164+
- `xuid` (str): XUID of the specified user.
165+
- **Returns:** An instance of `ACCOUNT_INFO_GAMERTAG` with following attributes:
166+
- `xuid` (str): User's XUID.
167+
- `displayName` (str): User's display name.
168+
- `realName` (str): User's real name.
169+
- `displayPicRaw` (str): URL of the user's profile picture.
170+
- `showUserAsAvatar` (bool): Whether to show the user as an avatar.
171+
- `gamertag` (str): User's gamertag.
172+
- `gamerScore` (str): User's gamerscore.
173+
- `modernGamertag` (str): User's modern gamertag.
174+
- `modernGamertagSuffix` (str): User's modern gamertag suffix.
175+
- `uniqueModernGamertag` (str): User's unique modern gamertag.
176+
- `xboxOneRep` (str): User's Xbox One reputation.
177+
- `presenceState` (str): User's presence state.
178+
- `presenceText` (str): User's presence text.
179+
- `presenceDevices` (list): List of devices the user is present on.
180+
- `isBroadcasting` (bool): Whether the user is broadcasting.
181+
- `isCloaked` (bool): Whether the user is cloaked.
182+
- `isQuarantined` (bool): Whether the user is quarantined.
183+
- `isXbox360Gamerpic` (bool): Whether the user has an Xbox 360 gamerpic.
184+
- `lastSeenDateTimeUTC` (str): Last seen date and time in UTC.
185+
- `preferredColor` (str): User's preferred color.
186+
- `presenceDetails` (str): User's presence details.
187+
- `titlePresence` (str): User's title presence.
188+
- `titleSummaries` (list): List of title summaries.
189+
- `accountTier` (str): User's account tier.
190+
- `bio` (str): User's bio.
191+
- `isVerified` (bool): Whether the user is verified.
192+
- `location` (str): User's location.
193+
- `tenure` (str): User's tenure.
194+
- `watermarks` (list): List of watermarks.
195+
- `blocked` (bool): Whether the user is blocked.
196+
- `mute` (bool): Whether the user is muted.
197+
- `followerCount` (int): Number of followers.
198+
- `followingCount` (int): Number of users the user is following.
199+
- `hasGamePass` (bool): Whether the user has Game Pass.
200+
- `socialManager` (str): User's social manager.
201+
- `broadcast` (str): User's broadcast.
202+
- `avatar` (str): User's avatar.
203+
- `linkedAccounts` (list): List of linked accounts.
204+
- `colorTheme` (str): User's color theme.
205+
- `preferredPlatforms` (list): List of preferred platforms.
206+
207+
### `search_friend_list(gamertag: str) -> FRIEND_INFO_GAMERTAG`
208+
- **Description:** Search for a friend using their Gamertag.
209+
- **Parameters:**
210+
- `gamertag` (str): Gamertag of the specified user.
211+
- **Returns:** An instance of `FRIEND_INFO_GAMERTAG` with the following attributes:
212+
- `GameDisplayPicRaw` (str): URL of the user's profile picture.
213+
- `Gamerscore` (str): User's gamerscore.
214+
- `Gamertag` (str): User's gamertag.
215+
- `AccountTier` (str): User's account tier.
216+
- `XboxOneRep` (str): User's Xbox One reputation.
217+
- `RealName` (str): User's real name.
218+
- `Bio` (str): User's bio.
219+
- `TenureLevel` (str): User's tenure level.
220+
- `Watermarks` (list): List of watermarks.
221+
- `Location` (str): User's location.
222+
- `ShowUserAsAvatar` (bool): Whether to show the user as an avatar.
223+
224+
### `get_gamepass_all_games() -> list`
225+
- **Description:** Get all games available on Game Pass.
226+
- **Returns:** A list of Game Pass games.
227+
228+
### `get_gamepass_pc_games() -> list`
229+
- **Description:** Get all games available on Game Pass for PC.
230+
- **Returns:** A list of Game Pass PC games.
231+
232+
### `get_gamepass_eaplay_games() -> list`
233+
- **Description:** Get all games available on EA Play.
234+
- **Returns:** A list of EA Play games.
235+
236+
### `get_gamepass_nocontroller_games() -> list`
237+
- **Description:** Get all games available on Game Pass that don't require a controller.
238+
- **Returns:** A list of Game Pass games that don't require a controller.
239+
240+
### `get_new_marketplace_games() -> list`
241+
- **Description:** Get all new games available on the marketplace.
242+
- **Returns:** A list of new marketplace games.
243+
244+
### `get_toppaid_marketplace_games() -> list`
245+
- **Description:** Get all top paid games available on the marketplace.
246+
- **Returns:** A list of top paid marketplace games.
247+
248+
### `get_bestrated_marketplace_games() -> list`
249+
- **Description:** Get all best rated games available on the marketplace.
250+
- **Returns:** A list of best rated marketplace games.
251+
252+
### `get_comingsoon_marketplace_games() -> list`
253+
- **Description:** Get all coming soon games available on the marketplace.
254+
- **Returns:** A list of coming soon marketplace games.
255+
256+
### `get_deals_marketplace_games() -> list`
257+
- **Description:** Get all deals available on the marketplace.
258+
- **Returns:** A list of deals marketplace games.
259+
260+
### `get_topfree_marketplace_games() -> list`
261+
- **Description:** Get all top free games available on the marketplace.
262+
- **Returns:** A list of top free marketplace games.
263+
264+
### `get_mostplayed_marketplace_games() -> list`
265+
- **Description:** Get all most played games available on the marketplace.
266+
- **Returns:** A list of most played marketplace games.
267+
268+
### `search_marketplace_game(titleId: str) -> list`
269+
- **Description:** Search for a game on the marketplace using its title ID.
270+
- **Parameters:**
271+
- `titleId` (str): Title ID of the specified game.
272+
- **Returns:** A list of marketplace games.
273+
274+
### `get_player_summary(xuid: str) -> PLAYER_SUMMARY`
275+
- **Description:** Get player summary using their XUID.
276+
- **Parameters:**
277+
- `xuid` (str): XUID of the specified user.
278+
- **Returns:** An instance of `PLAYER_SUMMARY` with following attributes:
279+
- `xuid` (str): User's XUID.
280+
- `isFavorite` (bool): Whether the user is a favorite.
281+
- `isFollowingCaller` (bool): Whether the user is following the caller.
282+
- `isFollowedByCaller` (bool): Whether the user is followed by the caller.
283+
- `isIdentityShared` (bool): Whether the user's identity is shared.
284+
- `addedDateTimeUtc` (str): Added date and time in UTC.
285+
- `displayName` (str): User's display name.
286+
- `realName` (str): User's real name.
287+
- `displayPicRaw` (str): URL of the user's profile picture.
288+
- `useAvatar` (bool): Whether to use the avatar.
289+
- `gamertag` (str): User's gamertag.
290+
- `gamerScore` (str): User's gamerscore.
291+
- `xboxOneRep` (str): User's Xbox One reputation.
292+
- `presenceState` (str): User's presence state.
293+
- `presenceText` (str): User's presence text.
294+
- `presenceDevices` (list): List of devices the user is present on.
295+
- `isBroadcasting` (bool): Whether the user is broadcasting.
296+
- `isCloaked` (bool): Whether the user is cloaked.
297+
- `isQuarantined` (bool): Whether the user is quarantined.
298+
- `suggestion` (str): User's suggestion.
299+
- `recommendation` (str): User's recommendation.
300+
- `titleHistory` (list): List of title history.
301+
- `multiplayerSummary` (dict): Multiplayer summary.
302+
- `recentPlayer` (list): List of recent players. // check
303+
- `follower` (list): List of followers.
304+
- `preferredColor` (str): User's preferred color.
305+
- `presenceDetails` (dict): Presence details.
306+
- `titlePresence` (dict): Title presence.
307+
- `titleSummaries` (list): List of title summaries.
308+
- `presenceTitleIds` (list): List of presence title IDs.
309+
- `detail` (dict): User's detail.
310+
- `communityManagerTitles` (list): List of community manager titles.
311+
- `socialManager` (str): User's social manager.
312+
- `broadcast` (str): User's broadcast.
313+
- `tournamentSummary` (dict): Tournament summary.
314+
- `avatar` (str): User's avatar.
315+
316+
### `get_player_title_history(xuid: str) -> list`
317+
- **Description:** Get player title history using their XUID.
318+
- **Parameters:**
319+
- `xuid` (str): XUID of the specified user.
320+
- **Returns:** A list of player title history.
321+
322+
### `get_session_details(sessionName: str) -> dict`
323+
- **Description:** Get session details using the session name.
324+
- **Parameters:**
325+
- `sessionName` (str): Name of the specified session.
326+
- **Returns:** A dictionary containing session details.
327+
328+
### `get_group_summary(groupId: str) -> dict`
329+
- **Description:** Get group summary using the group ID.
330+
- **Parameters:**
331+
- `groupId` (str): Group ID of the specified group.
332+
- **Returns:** A dictionary containing group summary.
333+
334+
### `get_group_messages(groupId: str) -> list`
335+
- **Description:** Get group messages using the group ID.
336+
- **Parameters:**
337+
- `groupId` (str): Group ID of the specified group.
338+
- **Returns:** A list of group messages.

requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
requests==2.31.0
2+
setuptools
3+
wheel
4+
twine
5+
sphinx

0 commit comments

Comments
 (0)