Skip to content

Commit

Permalink
feat: lightfall api specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kigstn committed Feb 27, 2023
1 parent 8a518f7 commit 424a496
Show file tree
Hide file tree
Showing 16 changed files with 461 additions and 45 deletions.
74 changes: 74 additions & 0 deletions bungio/api/bungie/destiny2.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,80 @@ async def equip_items(self, data: DestinyItemSetActionRequest, auth: AuthData) -
response = await self._client.http.equip_items(auth=auth, **data.to_dict(_return_to_bungie_case=False))
return await DestinyEquipItemResults.from_dict(data=response, client=self._client, auth=auth)

async def equip_loadout(self, data: dict, auth: AuthData) -> int:
"""
Equip a loadout. You must have a valid Destiny Account, and either be in a social space, in orbit, or offline.
Warning: Requires Authentication.
Required oauth2 scopes: MoveEquipDestinyItems
Args:
data: The required data for this request.
auth: Authentication information.
Returns:
The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
"""

response = await self._client.http.equip_loadout(auth=auth, **data.to_dict(_return_to_bungie_case=False))
return response["Response"]

async def snapshot_loadout(self, data: dict, auth: AuthData) -> int:
"""
Snapshot a loadout with the currently equipped items.
Warning: Requires Authentication.
Required oauth2 scopes: MoveEquipDestinyItems
Args:
data: The required data for this request.
auth: Authentication information.
Returns:
The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
"""

response = await self._client.http.snapshot_loadout(auth=auth, **data.to_dict(_return_to_bungie_case=False))
return response["Response"]

async def update_loadout_identifiers(self, data: dict, auth: AuthData) -> int:
"""
Update the color, icon, and name of a loadout.
Warning: Requires Authentication.
Required oauth2 scopes: MoveEquipDestinyItems
Args:
data: The required data for this request.
auth: Authentication information.
Returns:
The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
"""

response = await self._client.http.update_loadout_identifiers(
auth=auth, **data.to_dict(_return_to_bungie_case=False)
)
return response["Response"]

async def clear_loadout(self, data: dict, auth: AuthData) -> int:
"""
Clear the identifiers and items of a loadout.
Warning: Requires Authentication.
Required oauth2 scopes: MoveEquipDestinyItems
Args:
data: The required data for this request.
auth: Authentication information.
Returns:
The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
"""

response = await self._client.http.clear_loadout(auth=auth, **data.to_dict(_return_to_bungie_case=False))
return response["Response"]

async def set_item_lock_state(self, data: DestinyItemStateRequest, auth: AuthData) -> int:
"""
Set the Lock State for an instanced item. You must have a valid Destiny Account.
Expand Down
8 changes: 8 additions & 0 deletions bungio/api/bungie/fireteam.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async def get_available_clan_fireteams(
public_only: Union[FireteamPublicSearchOption, int],
slot_filter: Union[FireteamSlotSearch, int],
auth: AuthData,
exclude_immediate: Optional[bool] = None,
lang_filter: Optional[str] = None,
) -> SearchResultOfFireteamSummary:
"""
Expand All @@ -64,6 +65,7 @@ async def get_available_clan_fireteams(
public_only: Determines public/private filtering.
slot_filter: Filters based on available slots
auth: Authentication information.
exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
lang_filter: An optional language filter.
Returns:
Expand All @@ -79,6 +81,7 @@ async def get_available_clan_fireteams(
public_only=getattr(public_only, "value", public_only),
slot_filter=getattr(slot_filter, "value", slot_filter),
auth=auth,
exclude_immediate=exclude_immediate if exclude_immediate is not None else None,
lang_filter=lang_filter if lang_filter is not None else None,
)
return await SearchResultOfFireteamSummary.from_dict(
Expand All @@ -92,6 +95,7 @@ async def get_available_clan_fireteams(
public_only=public_only,
slot_filter=slot_filter,
auth=auth,
exclude_immediate=exclude_immediate,
lang_filter=lang_filter,
)

Expand All @@ -103,6 +107,7 @@ async def search_public_available_clan_fireteams(
platform: Union[FireteamPlatform, int],
slot_filter: Union[FireteamSlotSearch, int],
auth: AuthData,
exclude_immediate: Optional[bool] = None,
lang_filter: Optional[str] = None,
) -> SearchResultOfFireteamSummary:
"""
Expand All @@ -118,6 +123,7 @@ async def search_public_available_clan_fireteams(
platform: The platform filter.
slot_filter: Filters based on available slots
auth: Authentication information.
exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
lang_filter: An optional language filter.
Returns:
Expand All @@ -131,6 +137,7 @@ async def search_public_available_clan_fireteams(
platform=getattr(platform, "value", platform),
slot_filter=getattr(slot_filter, "value", slot_filter),
auth=auth,
exclude_immediate=exclude_immediate if exclude_immediate is not None else None,
lang_filter=lang_filter if lang_filter is not None else None,
)
return await SearchResultOfFireteamSummary.from_dict(
Expand All @@ -142,6 +149,7 @@ async def search_public_available_clan_fireteams(
platform=platform,
slot_filter=slot_filter,
auth=auth,
exclude_immediate=exclude_immediate,
lang_filter=lang_filter,
)

Expand Down
182 changes: 182 additions & 0 deletions bungio/http/routes/destiny2.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,188 @@ async def equip_items(
Route(path=f"/Destiny2/Actions/Items/EquipItems/", method="POST", data=data, auth=auth)
)

async def equip_loadout(
self, loadout_index: int, character_id: int, membership_type: Union[Any, int], auth: AuthData, *args, **kwargs
) -> dict:
"""
Equip a loadout. You must have a valid Destiny Account, and either be in a social space, in orbit, or offline.
Warning: Requires Authentication.
Required oauth2 scopes: MoveEquipDestinyItems
Args:
loadout_index: The index of the loadout for this action request.
character_id: _No description given by bungie._
membership_type: _No description given by bungie._
auth: Authentication information.
Raises:
NotFound: 404 request
BadRequest: 400 request
InvalidAuthentication: If authentication is invalid
TimeoutException: If no connection could be made
BungieDead: Servers are down
AuthenticationTooSlow: The authentication key has expired
BungieException: Relaying the bungie error
Returns:
The json response
"""

data = {
"loadoutIndex": loadout_index,
"characterId": character_id,
"membershipType": membership_type,
}

return await self.request(
Route(path=f"/Destiny2/Actions/Loadouts/EquipLoadout/", method="POST", data=data, auth=auth)
)

async def snapshot_loadout(
self,
color_hash: int,
icon_hash: int,
name_hash: int,
loadout_index: int,
character_id: int,
membership_type: Union[Any, int],
auth: AuthData,
*args,
**kwargs,
) -> dict:
"""
Snapshot a loadout with the currently equipped items.
Warning: Requires Authentication.
Required oauth2 scopes: MoveEquipDestinyItems
Args:
color_hash: _No description given by bungie._
icon_hash: _No description given by bungie._
name_hash: _No description given by bungie._
loadout_index: The index of the loadout for this action request.
character_id: _No description given by bungie._
membership_type: _No description given by bungie._
auth: Authentication information.
Raises:
NotFound: 404 request
BadRequest: 400 request
InvalidAuthentication: If authentication is invalid
TimeoutException: If no connection could be made
BungieDead: Servers are down
AuthenticationTooSlow: The authentication key has expired
BungieException: Relaying the bungie error
Returns:
The json response
"""

data = {
"colorHash": color_hash,
"iconHash": icon_hash,
"nameHash": name_hash,
"loadoutIndex": loadout_index,
"characterId": character_id,
"membershipType": membership_type,
}

return await self.request(
Route(path=f"/Destiny2/Actions/Loadouts/SnapshotLoadout/", method="POST", data=data, auth=auth)
)

async def update_loadout_identifiers(
self,
color_hash: int,
icon_hash: int,
name_hash: int,
loadout_index: int,
character_id: int,
membership_type: Union[Any, int],
auth: AuthData,
*args,
**kwargs,
) -> dict:
"""
Update the color, icon, and name of a loadout.
Warning: Requires Authentication.
Required oauth2 scopes: MoveEquipDestinyItems
Args:
color_hash: _No description given by bungie._
icon_hash: _No description given by bungie._
name_hash: _No description given by bungie._
loadout_index: The index of the loadout for this action request.
character_id: _No description given by bungie._
membership_type: _No description given by bungie._
auth: Authentication information.
Raises:
NotFound: 404 request
BadRequest: 400 request
InvalidAuthentication: If authentication is invalid
TimeoutException: If no connection could be made
BungieDead: Servers are down
AuthenticationTooSlow: The authentication key has expired
BungieException: Relaying the bungie error
Returns:
The json response
"""

data = {
"colorHash": color_hash,
"iconHash": icon_hash,
"nameHash": name_hash,
"loadoutIndex": loadout_index,
"characterId": character_id,
"membershipType": membership_type,
}

return await self.request(
Route(path=f"/Destiny2/Actions/Loadouts/UpdateLoadoutIdentifiers/", method="POST", data=data, auth=auth)
)

async def clear_loadout(
self, loadout_index: int, character_id: int, membership_type: Union[Any, int], auth: AuthData, *args, **kwargs
) -> dict:
"""
Clear the identifiers and items of a loadout.
Warning: Requires Authentication.
Required oauth2 scopes: MoveEquipDestinyItems
Args:
loadout_index: The index of the loadout for this action request.
character_id: _No description given by bungie._
membership_type: _No description given by bungie._
auth: Authentication information.
Raises:
NotFound: 404 request
BadRequest: 400 request
InvalidAuthentication: If authentication is invalid
TimeoutException: If no connection could be made
BungieDead: Servers are down
AuthenticationTooSlow: The authentication key has expired
BungieException: Relaying the bungie error
Returns:
The json response
"""

data = {
"loadoutIndex": loadout_index,
"characterId": character_id,
"membershipType": membership_type,
}

return await self.request(
Route(path=f"/Destiny2/Actions/Loadouts/ClearLoadout/", method="POST", data=data, auth=auth)
)

async def set_item_lock_state(
self,
state: bool,
Expand Down
6 changes: 6 additions & 0 deletions bungio/http/routes/fireteam.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async def get_available_clan_fireteams(
public_only: int,
slot_filter: int,
auth: AuthData,
exclude_immediate: Optional[bool] = None,
lang_filter: Optional[str] = None,
*args,
**kwargs,
Expand All @@ -62,6 +63,7 @@ async def get_available_clan_fireteams(
public_only: Determines public/private filtering.
slot_filter: Filters based on available slots
auth: Authentication information.
exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
lang_filter: An optional language filter.
Raises:
Expand All @@ -82,6 +84,7 @@ async def get_available_clan_fireteams(
path=f"/Fireteam/Clan/{group_id}/Available/{platform}/{activity_type}/{date_range}/{slot_filter}/{public_only}/{page}/",
method="GET",
auth=auth,
exclude_immediate=exclude_immediate,
lang_filter=lang_filter,
)
)
Expand All @@ -94,6 +97,7 @@ async def search_public_available_clan_fireteams(
platform: int,
slot_filter: int,
auth: AuthData,
exclude_immediate: Optional[bool] = None,
lang_filter: Optional[str] = None,
*args,
**kwargs,
Expand All @@ -111,6 +115,7 @@ async def search_public_available_clan_fireteams(
platform: The platform filter.
slot_filter: Filters based on available slots
auth: Authentication information.
exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
lang_filter: An optional language filter.
Raises:
Expand All @@ -131,6 +136,7 @@ async def search_public_available_clan_fireteams(
path=f"/Fireteam/Search/Available/{platform}/{activity_type}/{date_range}/{slot_filter}/{page}/",
method="GET",
auth=auth,
exclude_immediate=exclude_immediate,
lang_filter=lang_filter,
)
)
Expand Down
Loading

0 comments on commit 424a496

Please sign in to comment.