Skip to content

User Model

DestinyUser

Bases: DestinyUserMixin

A representation of a Destiny 2 user

Attributes:

Name Type Description
membership_id int

The user's id

membership_type Union[BungieMembershipType, int]

The user's type, aka platform

Source code in src/bungio/models/basic/user.py
13
14
15
16
17
18
19
20
21
22
23
24
@custom_define()
class DestinyUser(DestinyUserMixin):
    """
    A representation of a Destiny 2 user

    Attributes:
        membership_id: The user's id
        membership_type: The user's type, aka platform
    """

    membership_id: int = custom_field()
    membership_type: Union["BungieMembershipType", int] = custom_field(converter=enum_converter("BungieMembershipType"))

full_bungie_name property

Return the formatted bungie name like it is seen in-game. This includes the four numbers

Returns:

Type Description
str

The full bungie name

_fuzzy_getattr(name)

Returns the objs attribute that fully matches the name, or if that does not exist, the first attribute that includes the name

Parameters:

Name Type Description Default
name str

The name to match

required

Raises:

Type Description
KeyError

If no match is found

Returns:

Type Description
Any

The attribute value

Source code in src/bungio/models/base.py
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
def _fuzzy_getattr(self, name: str) -> Any:
    """
    Returns the objs attribute that fully matches the name, or if that does not exist, the first attribute that includes the name

    Args:
        name: The name to match

    Raises:
        KeyError: If no match is found

    Returns:
        The attribute value
    """

    try:
        found_attr = getattr(self, name)
        return found_attr
    except AttributeError:
        for attr_name in self.__dir__():
            if name in attr_name:
                return getattr(self, attr_name)
        raise KeyError(f"`{name}` not found in `{self.__dir__()}`")

approve_pending(data, group_id, auth) async

Approve the given membershipId to join the group/clan as long as they have applied.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
group_id int

ID of the group.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
bool

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
async def approve_pending(self, data: "GroupApplicationRequest", group_id: int, auth: "AuthData") -> bool:
    """
    Approve the given membershipId to join the group/clan as long as they have applied.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        group_id: ID of the group.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.approve_pending(
        data=data,
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

ban_member(data, group_id, auth) async

Bans the requested member from the requested group for the specified period of time.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupBanRequest

The required data for this request.

required
group_id int

Group ID that has the member to ban.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
int

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
async def ban_member(self, data: "GroupBanRequest", group_id: int, auth: "AuthData") -> int:
    """
    Bans the requested member from the requested group for the specified period of time.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        group_id: Group ID that has the member to ban.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.ban_member(
        data=data,
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

edit_group_membership(group_id, member_type, auth) async

Edit the membership type of a given member. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
group_id int

ID of the group to which the member belongs.

required
member_type Union[RuntimeGroupMemberType, int]

New membertype for the specified member.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
int

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
async def edit_group_membership(
    self, group_id: int, member_type: Union["RuntimeGroupMemberType", int], auth: "AuthData"
) -> int:
    """
    Edit the membership type of a given member. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        group_id: ID of the group to which the member belongs.
        member_type: New membertype for the specified member.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.edit_group_membership(
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        member_type=member_type,
        auth=auth,
    )

get_bungie_rewards_for_platform_user(auth) async

Returns the bungie rewards for the targeted user when a platform membership Id and Type are used.

Requires Authentication.

Required oauth2 scopes: ReadAndApplyTokens

Parameters:

Name Type Description Default
auth AuthData

Authentication information.

required

Returns:

Type Description
dict[str, BungieRewardDisplay]

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
async def get_bungie_rewards_for_platform_user(self, auth: "AuthData") -> dict[str, "BungieRewardDisplay"]:
    """
    Returns the bungie rewards for the targeted user when a platform membership Id and Type are used.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadAndApplyTokens

    Args:
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_bungie_rewards_for_platform_user(
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

get_groups_for_member(filter, group_type, auth=None) async

Get information about the groups that a given member has joined.

Parameters:

Name Type Description Default
filter Union[GroupsForMemberFilter, int]

Filter apply to list of joined groups.

required
group_type Union[GroupType, int]

Type of group the supplied member founded.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
GetGroupsForMemberResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
async def get_groups_for_member(
    self,
    filter: Union["GroupsForMemberFilter", int],
    group_type: Union["GroupType", int],
    auth: Optional["AuthData"] = None,
) -> "GetGroupsForMemberResponse":
    """
    Get information about the groups that a given member has joined.

    Args:
        filter: Filter apply to list of joined groups.
        group_type: Type of group the supplied member founded.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_groups_for_member(
        filter=filter,
        group_type=group_type,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

get_historical_stats_for_account(groups, auth=None) async

Gets aggregate historical stats organized around each character for a given account.

Parameters:

Name Type Description Default
groups list[Union[DestinyStatsGroupType, int]]

Groups of stats to include, otherwise only general stats are returned. Comma separated list is allowed. Values: General, Weapons, Medals.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
DestinyHistoricalStatsAccountResult

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
async def get_historical_stats_for_account(
    self, groups: list[Union["DestinyStatsGroupType", int]], auth: Optional["AuthData"] = None
) -> "DestinyHistoricalStatsAccountResult":
    """
    Gets aggregate historical stats organized around each character for a given account.

    Args:
        groups: Groups of stats to include, otherwise only general stats are returned. Comma separated list is allowed. Values: General, Weapons, Medals.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_historical_stats_for_account(
        destiny_membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        groups=groups,
        auth=auth,
    )

get_item(item_instance_id, components, auth=None) async

Retrieve the details of an instanced Destiny Item. An instanced Destiny item is one with an ItemInstanceId. Non-instanced items, such as materials, have no useful instance-specific details and thus are not queryable here.

Parameters:

Name Type Description Default
item_instance_id int

The Instance ID of the destiny item.

required
components list[Union[DestinyComponentType, int]]

A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
DestinyItemResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
async def get_item(
    self,
    item_instance_id: int,
    components: list[Union["DestinyComponentType", int]],
    auth: Optional["AuthData"] = None,
) -> "DestinyItemResponse":
    """
    Retrieve the details of an instanced Destiny Item. An instanced Destiny item is one with an ItemInstanceId. Non-instanced items, such as materials, have no useful instance-specific details and thus are not queryable here.

    Args:
        item_instance_id: The Instance ID of the destiny item.
        components: A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_item(
        destiny_membership_id=self._fuzzy_getattr("membership_id"),
        item_instance_id=item_instance_id,
        membership_type=self._fuzzy_getattr("membership_type"),
        components=components,
        auth=auth,
    )

get_leaderboards(maxtop, modes, statid, auth=None) async

Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint has not yet been implemented. It is being returned for a preview of future functionality, and for public comment/suggestion/preparation.

Parameters:

Name Type Description Default
maxtop int

Maximum number of top players to return. Use a large number to get entire leaderboard.

required
modes str

List of game modes for which to get leaderboards. See the documentation for DestinyActivityModeType for valid values, and pass in string representation, comma delimited.

required
statid str

ID of stat to return rather than returning all Leaderboard stats.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
dict[str, dict[str, DestinyLeaderboard]]

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
async def get_leaderboards(
    self, maxtop: int, modes: str, statid: str, auth: Optional["AuthData"] = None
) -> dict[str, dict[str, "DestinyLeaderboard"]]:
    """
    Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint has not yet been implemented. It is being returned for a preview of future functionality, and for public comment/suggestion/preparation.

    Args:
        maxtop: Maximum number of top players to return. Use a large number to get entire leaderboard.
        modes: List of game modes for which to get leaderboards. See the documentation for DestinyActivityModeType for valid values, and pass in string representation, comma delimited.
        statid: ID of stat to return rather than returning all Leaderboard stats.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_leaderboards(
        destiny_membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        maxtop=maxtop,
        modes=modes,
        statid=statid,
        auth=auth,
    )

get_linked_profiles(get_all_memberships, auth=None) async

Returns a summary information about all profiles linked to the requesting membership type/membership ID that have valid Destiny information. The passed-in Membership Type/Membership ID may be a Bungie.Net membership or a Destiny membership. It only returns the minimal amount of data to begin making more substantive requests, but will hopefully serve as a useful alternative to UserServices for people who just care about Destiny data. Note that it will only return linked accounts whose linkages you are allowed to view.

Parameters:

Name Type Description Default
get_all_memberships bool

(optional) if set to 'true', all memberships regardless of whether they're obscured by overrides will be returned. Normal privacy restrictions on account linking will still apply no matter what.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
DestinyLinkedProfilesResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
async def get_linked_profiles(
    self, get_all_memberships: bool, auth: Optional["AuthData"] = None
) -> "DestinyLinkedProfilesResponse":
    """
    Returns a summary information about all profiles linked to the requesting membership type/membership ID that have valid Destiny information. The passed-in Membership Type/Membership ID may be a Bungie.Net membership or a Destiny membership. It only returns the minimal amount of data to begin making more substantive requests, but will hopefully serve as a useful alternative to UserServices for people who just care about Destiny data. Note that it will only return linked accounts whose linkages you are allowed to view.

    Args:
        get_all_memberships: (optional) if set to 'true', all memberships regardless of whether they're obscured by overrides will be returned. Normal privacy restrictions on account linking will still apply no matter what.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_linked_profiles(
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        get_all_memberships=get_all_memberships,
        auth=auth,
    )

get_membership_data_by_id(auth=None) async

Returns a list of accounts associated with the supplied membership ID and membership type. This will include all linked accounts (even when hidden) if supplied credentials permit it.

Parameters:

Name Type Description Default
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
UserMembershipData

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
async def get_membership_data_by_id(self, auth: Optional["AuthData"] = None) -> "UserMembershipData":
    """
    Returns a list of accounts associated with the supplied membership ID and membership type. This will include all linked accounts (even when hidden) if supplied credentials permit it.

    Args:
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_membership_data_by_id(
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

get_potential_groups_for_member(filter, group_type, auth=None) async

Get information about the groups that a given member has applied to or been invited to.

Parameters:

Name Type Description Default
filter Union[GroupPotentialMemberStatus, int]

Filter apply to list of potential joined groups.

required
group_type Union[GroupType, int]

Type of group the supplied member applied.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
GroupPotentialMembershipSearchResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
async def get_potential_groups_for_member(
    self,
    filter: Union["GroupPotentialMemberStatus", int],
    group_type: Union["GroupType", int],
    auth: Optional["AuthData"] = None,
) -> "GroupPotentialMembershipSearchResponse":
    """
    Get information about the groups that a given member has applied to or been invited to.

    Args:
        filter: Filter apply to list of potential joined groups.
        group_type: Type of group the supplied member applied.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_potential_groups_for_member(
        filter=filter,
        group_type=group_type,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

get_profile(components, auth=None) async

Returns Destiny Profile information for the supplied membership.

Parameters:

Name Type Description Default
components list[Union[DestinyComponentType, int]]

A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
DestinyProfileResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
async def get_profile(
    self, components: list[Union["DestinyComponentType", int]], auth: Optional["AuthData"] = None
) -> "DestinyProfileResponse":
    """
    Returns Destiny Profile information for the supplied membership.

    Args:
        components: A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_profile(
        destiny_membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        components=components,
        auth=auth,
    )

individual_group_invite(data, group_id, auth) async

Invite a user to join this group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
group_id int

ID of the group you would like to join.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
GroupApplicationResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
async def individual_group_invite(
    self, data: "GroupApplicationRequest", group_id: int, auth: "AuthData"
) -> "GroupApplicationResponse":
    """
    Invite a user to join this group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        group_id: ID of the group you would like to join.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.individual_group_invite(
        data=data,
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

individual_group_invite_cancel(group_id, auth) async

Cancels a pending invitation to join a group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
group_id int

ID of the group you would like to join.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
GroupApplicationResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
async def individual_group_invite_cancel(self, group_id: int, auth: "AuthData") -> "GroupApplicationResponse":
    """
    Cancels a pending invitation to join a group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        group_id: ID of the group you would like to join.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.individual_group_invite_cancel(
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

kick_member(group_id, auth) async

Kick a member from the given group, forcing them to reapply if they wish to re-join the group. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
group_id int

Group ID to kick the user from.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
GroupMemberLeaveResult

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
async def kick_member(self, group_id: int, auth: "AuthData") -> "GroupMemberLeaveResult":
    """
    Kick a member from the given group, forcing them to reapply if they wish to re-join the group. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        group_id: Group ID to kick the user from.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.kick_member(
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

recover_group_for_founder(group_type, auth=None) async

Allows a founder to manually recover a group they can see in game but not on bungie.net

Parameters:

Name Type Description Default
group_type Union[GroupType, int]

Type of group the supplied member founded.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
GroupMembershipSearchResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
async def recover_group_for_founder(
    self, group_type: Union["GroupType", int], auth: Optional["AuthData"] = None
) -> "GroupMembershipSearchResponse":
    """
    Allows a founder to manually recover a group they can see in game but not on bungie.net

    Args:
        group_type: Type of group the supplied member founded.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.recover_group_for_founder(
        group_type=group_type,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

unban_member(group_id, auth) async

Unbans the requested member, allowing them to re-apply for membership.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
group_id int
required
auth AuthData

Authentication information.

required

Returns:

Type Description
int

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
async def unban_member(self, group_id: int, auth: "AuthData") -> int:
    """
    Unbans the requested member, allowing them to re-apply for membership.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        group_id:
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.unban_member(
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

yield_activity_history(mode, earliest_allowed_datetime=None, latest_allowed_datetime=None, auth=None) async

Yields account activity history, no matter the character. Sorted by date descending, the latest one first.

Parameters:

Name Type Description Default
mode Union[DestinyActivityModeType, int]

A filter for the activity mode to be returned. None returns all activities. See the documentation for DestinyActivityModeType for valid values, and pass in string representation.

required
earliest_allowed_datetime Optional[datetime]

The earliest time the activity is allowed to have, fe. only entries after the 1/1/2020.

None
latest_allowed_datetime Optional[datetime]

The latest time the activity is allowed to have, fe. only entries before the 1/1/2020.

None
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
AsyncGenerator[DestinyHistoricalStatsPeriodGroup, None]

A generator for the model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
async def yield_activity_history(
    self,
    mode: Union["DestinyActivityModeType", int],
    earliest_allowed_datetime: Optional[datetime] = None,
    latest_allowed_datetime: Optional[datetime] = None,
    auth: Optional["AuthData"] = None,
) -> AsyncGenerator["DestinyHistoricalStatsPeriodGroup", None]:
    """
    Yields account activity history, no matter the character. Sorted by date descending, the latest one first.

    Args:
        mode: A filter for the activity mode to be returned. None returns all activities. See the documentation for DestinyActivityModeType for valid values, and pass in string representation.
        earliest_allowed_datetime: The earliest time the activity is allowed to have, fe. only entries after the 1/1/2020.
        latest_allowed_datetime: The latest time the activity is allowed to have, fe. only entries before the 1/1/2020.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        A generator for the model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """
    from bungio.models.basic import DestinyCharacter

    # get character ids and gen functions
    # use the stats page to also get deleted chars
    data = await self.get_historical_stats_for_account(groups=[0], auth=auth)

    characters = [
        DestinyCharacter(
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            character_id=character.character_id,
        )
        for character in data.characters
    ]

    funcs = {
        i: character.yield_activity_history(
            mode=mode,
            earliest_allowed_datetime=earliest_allowed_datetime,
            latest_allowed_datetime=latest_allowed_datetime,
            auth=auth,
        )
        for i, character in enumerate(characters)
    }

    # gen the first values
    entries = {i: await anext(func, None) for i, func in funcs.items()}

    # loop through all generators and return the newest values
    while True:
        # calculate the newest entry
        newest: Optional["DestinyHistoricalStatsPeriodGroup"] = None
        newest_index: int = 0
        for i, entry in entries.items():
            if entry is not None and (newest is None or entry.period > newest.period):
                newest = entry
                newest_index = i

        if newest:
            yield newest

            # get a new value from the func that just yielded
            entries[newest_index] = await anext(funcs[newest_index], None)
        else:
            break

DestinyUserMixin

Bases: ClientMixin, FuzzyAttrFinder

Source code in src/bungio/models/mixins/user.py
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
@custom_define()
class DestinyUserMixin(ClientMixin, FuzzyAttrFinder):
    @property
    def full_bungie_name(self) -> str:
        """
        Return the formatted bungie name like it is seen in-game. This includes the four numbers

        Returns:
            The full bungie name
        """

        return f"""{self.bungie_global_display_name}#{str(self.bungie_global_display_name_code).zfill(4)}"""

    async def yield_activity_history(
        self,
        mode: Union["DestinyActivityModeType", int],
        earliest_allowed_datetime: Optional[datetime] = None,
        latest_allowed_datetime: Optional[datetime] = None,
        auth: Optional["AuthData"] = None,
    ) -> AsyncGenerator["DestinyHistoricalStatsPeriodGroup", None]:
        """
        Yields account activity history, no matter the character. Sorted by date descending, the latest one first.

        Args:
            mode: A filter for the activity mode to be returned. None returns all activities. See the documentation for DestinyActivityModeType for valid values, and pass in string representation.
            earliest_allowed_datetime: The earliest time the activity is allowed to have, fe. only entries after the 1/1/2020.
            latest_allowed_datetime: The latest time the activity is allowed to have, fe. only entries before the 1/1/2020.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Returns:
            A generator for the model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """
        from bungio.models.basic import DestinyCharacter

        # get character ids and gen functions
        # use the stats page to also get deleted chars
        data = await self.get_historical_stats_for_account(groups=[0], auth=auth)

        characters = [
            DestinyCharacter(
                membership_id=self._fuzzy_getattr("membership_id"),
                membership_type=self._fuzzy_getattr("membership_type"),
                character_id=character.character_id,
            )
            for character in data.characters
        ]

        funcs = {
            i: character.yield_activity_history(
                mode=mode,
                earliest_allowed_datetime=earliest_allowed_datetime,
                latest_allowed_datetime=latest_allowed_datetime,
                auth=auth,
            )
            for i, character in enumerate(characters)
        }

        # gen the first values
        entries = {i: await anext(func, None) for i, func in funcs.items()}

        # loop through all generators and return the newest values
        while True:
            # calculate the newest entry
            newest: Optional["DestinyHistoricalStatsPeriodGroup"] = None
            newest_index: int = 0
            for i, entry in entries.items():
                if entry is not None and (newest is None or entry.period > newest.period):
                    newest = entry
                    newest_index = i

            if newest:
                yield newest

                # get a new value from the func that just yielded
                entries[newest_index] = await anext(funcs[newest_index], None)
            else:
                break

    # DO NOT CHANGE ANY CODE BELOW. Automatically generated and overwritten

    async def get_membership_data_by_id(self, auth: Optional["AuthData"] = None) -> "UserMembershipData":
        """
        Returns a list of accounts associated with the supplied membership ID and membership type. This will include all linked accounts (even when hidden) if supplied credentials permit it.

        Args:
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.get_membership_data_by_id(
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def edit_group_membership(
        self, group_id: int, member_type: Union["RuntimeGroupMemberType", int], auth: "AuthData"
    ) -> int:
        """
        Edit the membership type of a given member. You must have suitable permissions in the group to perform this operation.

        Warning: Requires Authentication.
            Required oauth2 scopes: AdminGroups

        Args:
            group_id: ID of the group to which the member belongs.
            member_type: New membertype for the specified member.
            auth: Authentication information.

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.edit_group_membership(
            group_id=group_id,
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            member_type=member_type,
            auth=auth,
        )

    async def kick_member(self, group_id: int, auth: "AuthData") -> "GroupMemberLeaveResult":
        """
        Kick a member from the given group, forcing them to reapply if they wish to re-join the group. You must have suitable permissions in the group to perform this operation.

        Warning: Requires Authentication.
            Required oauth2 scopes: AdminGroups

        Args:
            group_id: Group ID to kick the user from.
            auth: Authentication information.

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.kick_member(
            group_id=group_id,
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def ban_member(self, data: "GroupBanRequest", group_id: int, auth: "AuthData") -> int:
        """
        Bans the requested member from the requested group for the specified period of time.

        Warning: Requires Authentication.
            Required oauth2 scopes: AdminGroups

        Args:
            data: The required data for this request.
            group_id: Group ID that has the member to ban.
            auth: Authentication information.

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.ban_member(
            data=data,
            group_id=group_id,
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def unban_member(self, group_id: int, auth: "AuthData") -> int:
        """
        Unbans the requested member, allowing them to re-apply for membership.

        Warning: Requires Authentication.
            Required oauth2 scopes: AdminGroups

        Args:
            group_id:
            auth: Authentication information.

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.unban_member(
            group_id=group_id,
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def approve_pending(self, data: "GroupApplicationRequest", group_id: int, auth: "AuthData") -> bool:
        """
        Approve the given membershipId to join the group/clan as long as they have applied.

        Warning: Requires Authentication.
            Required oauth2 scopes: AdminGroups

        Args:
            data: The required data for this request.
            group_id: ID of the group.
            auth: Authentication information.

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.approve_pending(
            data=data,
            group_id=group_id,
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def get_groups_for_member(
        self,
        filter: Union["GroupsForMemberFilter", int],
        group_type: Union["GroupType", int],
        auth: Optional["AuthData"] = None,
    ) -> "GetGroupsForMemberResponse":
        """
        Get information about the groups that a given member has joined.

        Args:
            filter: Filter apply to list of joined groups.
            group_type: Type of group the supplied member founded.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.get_groups_for_member(
            filter=filter,
            group_type=group_type,
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def recover_group_for_founder(
        self, group_type: Union["GroupType", int], auth: Optional["AuthData"] = None
    ) -> "GroupMembershipSearchResponse":
        """
        Allows a founder to manually recover a group they can see in game but not on bungie.net

        Args:
            group_type: Type of group the supplied member founded.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.recover_group_for_founder(
            group_type=group_type,
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def get_potential_groups_for_member(
        self,
        filter: Union["GroupPotentialMemberStatus", int],
        group_type: Union["GroupType", int],
        auth: Optional["AuthData"] = None,
    ) -> "GroupPotentialMembershipSearchResponse":
        """
        Get information about the groups that a given member has applied to or been invited to.

        Args:
            filter: Filter apply to list of potential joined groups.
            group_type: Type of group the supplied member applied.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.get_potential_groups_for_member(
            filter=filter,
            group_type=group_type,
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def individual_group_invite(
        self, data: "GroupApplicationRequest", group_id: int, auth: "AuthData"
    ) -> "GroupApplicationResponse":
        """
        Invite a user to join this group.

        Warning: Requires Authentication.
            Required oauth2 scopes: AdminGroups

        Args:
            data: The required data for this request.
            group_id: ID of the group you would like to join.
            auth: Authentication information.

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.individual_group_invite(
            data=data,
            group_id=group_id,
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def individual_group_invite_cancel(self, group_id: int, auth: "AuthData") -> "GroupApplicationResponse":
        """
        Cancels a pending invitation to join a group.

        Warning: Requires Authentication.
            Required oauth2 scopes: AdminGroups

        Args:
            group_id: ID of the group you would like to join.
            auth: Authentication information.

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.individual_group_invite_cancel(
            group_id=group_id,
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def get_bungie_rewards_for_platform_user(self, auth: "AuthData") -> dict[str, "BungieRewardDisplay"]:
        """
        Returns the bungie rewards for the targeted user when a platform membership Id and Type are used.

        Warning: Requires Authentication.
            Required oauth2 scopes: ReadAndApplyTokens

        Args:
            auth: Authentication information.

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.get_bungie_rewards_for_platform_user(
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            auth=auth,
        )

    async def get_linked_profiles(
        self, get_all_memberships: bool, auth: Optional["AuthData"] = None
    ) -> "DestinyLinkedProfilesResponse":
        """
        Returns a summary information about all profiles linked to the requesting membership type/membership ID that have valid Destiny information. The passed-in Membership Type/Membership ID may be a Bungie.Net membership or a Destiny membership. It only returns the minimal amount of data to begin making more substantive requests, but will hopefully serve as a useful alternative to UserServices for people who just care about Destiny data. Note that it will only return linked accounts whose linkages you are allowed to view.

        Args:
            get_all_memberships: (optional) if set to 'true', all memberships regardless of whether they're obscured by overrides will be returned. Normal privacy restrictions on account linking will still apply no matter what.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.get_linked_profiles(
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            get_all_memberships=get_all_memberships,
            auth=auth,
        )

    async def get_profile(
        self, components: list[Union["DestinyComponentType", int]], auth: Optional["AuthData"] = None
    ) -> "DestinyProfileResponse":
        """
        Returns Destiny Profile information for the supplied membership.

        Args:
            components: A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.get_profile(
            destiny_membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            components=components,
            auth=auth,
        )

    async def get_item(
        self,
        item_instance_id: int,
        components: list[Union["DestinyComponentType", int]],
        auth: Optional["AuthData"] = None,
    ) -> "DestinyItemResponse":
        """
        Retrieve the details of an instanced Destiny Item. An instanced Destiny item is one with an ItemInstanceId. Non-instanced items, such as materials, have no useful instance-specific details and thus are not queryable here.

        Args:
            item_instance_id: The Instance ID of the destiny item.
            components: A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.get_item(
            destiny_membership_id=self._fuzzy_getattr("membership_id"),
            item_instance_id=item_instance_id,
            membership_type=self._fuzzy_getattr("membership_type"),
            components=components,
            auth=auth,
        )

    async def get_leaderboards(
        self, maxtop: int, modes: str, statid: str, auth: Optional["AuthData"] = None
    ) -> dict[str, dict[str, "DestinyLeaderboard"]]:
        """
        Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint has not yet been implemented. It is being returned for a preview of future functionality, and for public comment/suggestion/preparation.

        Args:
            maxtop: Maximum number of top players to return. Use a large number to get entire leaderboard.
            modes: List of game modes for which to get leaderboards. See the documentation for DestinyActivityModeType for valid values, and pass in string representation, comma delimited.
            statid: ID of stat to return rather than returning all Leaderboard stats.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.get_leaderboards(
            destiny_membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            maxtop=maxtop,
            modes=modes,
            statid=statid,
            auth=auth,
        )

    async def get_historical_stats_for_account(
        self, groups: list[Union["DestinyStatsGroupType", int]], auth: Optional["AuthData"] = None
    ) -> "DestinyHistoricalStatsAccountResult":
        """
        Gets aggregate historical stats organized around each character for a given account.

        Args:
            groups: Groups of stats to include, otherwise only general stats are returned. Comma separated list is allowed. Values: General, Weapons, Medals.
            auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

        Returns:
            The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
        """

        return await self._client.api.get_historical_stats_for_account(
            destiny_membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            groups=groups,
            auth=auth,
        )

full_bungie_name property

Return the formatted bungie name like it is seen in-game. This includes the four numbers

Returns:

Type Description
str

The full bungie name

_fuzzy_getattr(name)

Returns the objs attribute that fully matches the name, or if that does not exist, the first attribute that includes the name

Parameters:

Name Type Description Default
name str

The name to match

required

Raises:

Type Description
KeyError

If no match is found

Returns:

Type Description
Any

The attribute value

Source code in src/bungio/models/base.py
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
def _fuzzy_getattr(self, name: str) -> Any:
    """
    Returns the objs attribute that fully matches the name, or if that does not exist, the first attribute that includes the name

    Args:
        name: The name to match

    Raises:
        KeyError: If no match is found

    Returns:
        The attribute value
    """

    try:
        found_attr = getattr(self, name)
        return found_attr
    except AttributeError:
        for attr_name in self.__dir__():
            if name in attr_name:
                return getattr(self, attr_name)
        raise KeyError(f"`{name}` not found in `{self.__dir__()}`")

approve_pending(data, group_id, auth) async

Approve the given membershipId to join the group/clan as long as they have applied.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
group_id int

ID of the group.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
bool

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
async def approve_pending(self, data: "GroupApplicationRequest", group_id: int, auth: "AuthData") -> bool:
    """
    Approve the given membershipId to join the group/clan as long as they have applied.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        group_id: ID of the group.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.approve_pending(
        data=data,
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

ban_member(data, group_id, auth) async

Bans the requested member from the requested group for the specified period of time.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupBanRequest

The required data for this request.

required
group_id int

Group ID that has the member to ban.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
int

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
async def ban_member(self, data: "GroupBanRequest", group_id: int, auth: "AuthData") -> int:
    """
    Bans the requested member from the requested group for the specified period of time.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        group_id: Group ID that has the member to ban.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.ban_member(
        data=data,
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

edit_group_membership(group_id, member_type, auth) async

Edit the membership type of a given member. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
group_id int

ID of the group to which the member belongs.

required
member_type Union[RuntimeGroupMemberType, int]

New membertype for the specified member.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
int

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
async def edit_group_membership(
    self, group_id: int, member_type: Union["RuntimeGroupMemberType", int], auth: "AuthData"
) -> int:
    """
    Edit the membership type of a given member. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        group_id: ID of the group to which the member belongs.
        member_type: New membertype for the specified member.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.edit_group_membership(
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        member_type=member_type,
        auth=auth,
    )

get_bungie_rewards_for_platform_user(auth) async

Returns the bungie rewards for the targeted user when a platform membership Id and Type are used.

Requires Authentication.

Required oauth2 scopes: ReadAndApplyTokens

Parameters:

Name Type Description Default
auth AuthData

Authentication information.

required

Returns:

Type Description
dict[str, BungieRewardDisplay]

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
async def get_bungie_rewards_for_platform_user(self, auth: "AuthData") -> dict[str, "BungieRewardDisplay"]:
    """
    Returns the bungie rewards for the targeted user when a platform membership Id and Type are used.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadAndApplyTokens

    Args:
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_bungie_rewards_for_platform_user(
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

get_groups_for_member(filter, group_type, auth=None) async

Get information about the groups that a given member has joined.

Parameters:

Name Type Description Default
filter Union[GroupsForMemberFilter, int]

Filter apply to list of joined groups.

required
group_type Union[GroupType, int]

Type of group the supplied member founded.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
GetGroupsForMemberResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
async def get_groups_for_member(
    self,
    filter: Union["GroupsForMemberFilter", int],
    group_type: Union["GroupType", int],
    auth: Optional["AuthData"] = None,
) -> "GetGroupsForMemberResponse":
    """
    Get information about the groups that a given member has joined.

    Args:
        filter: Filter apply to list of joined groups.
        group_type: Type of group the supplied member founded.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_groups_for_member(
        filter=filter,
        group_type=group_type,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

get_historical_stats_for_account(groups, auth=None) async

Gets aggregate historical stats organized around each character for a given account.

Parameters:

Name Type Description Default
groups list[Union[DestinyStatsGroupType, int]]

Groups of stats to include, otherwise only general stats are returned. Comma separated list is allowed. Values: General, Weapons, Medals.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
DestinyHistoricalStatsAccountResult

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
async def get_historical_stats_for_account(
    self, groups: list[Union["DestinyStatsGroupType", int]], auth: Optional["AuthData"] = None
) -> "DestinyHistoricalStatsAccountResult":
    """
    Gets aggregate historical stats organized around each character for a given account.

    Args:
        groups: Groups of stats to include, otherwise only general stats are returned. Comma separated list is allowed. Values: General, Weapons, Medals.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_historical_stats_for_account(
        destiny_membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        groups=groups,
        auth=auth,
    )

get_item(item_instance_id, components, auth=None) async

Retrieve the details of an instanced Destiny Item. An instanced Destiny item is one with an ItemInstanceId. Non-instanced items, such as materials, have no useful instance-specific details and thus are not queryable here.

Parameters:

Name Type Description Default
item_instance_id int

The Instance ID of the destiny item.

required
components list[Union[DestinyComponentType, int]]

A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
DestinyItemResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
async def get_item(
    self,
    item_instance_id: int,
    components: list[Union["DestinyComponentType", int]],
    auth: Optional["AuthData"] = None,
) -> "DestinyItemResponse":
    """
    Retrieve the details of an instanced Destiny Item. An instanced Destiny item is one with an ItemInstanceId. Non-instanced items, such as materials, have no useful instance-specific details and thus are not queryable here.

    Args:
        item_instance_id: The Instance ID of the destiny item.
        components: A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_item(
        destiny_membership_id=self._fuzzy_getattr("membership_id"),
        item_instance_id=item_instance_id,
        membership_type=self._fuzzy_getattr("membership_type"),
        components=components,
        auth=auth,
    )

get_leaderboards(maxtop, modes, statid, auth=None) async

Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint has not yet been implemented. It is being returned for a preview of future functionality, and for public comment/suggestion/preparation.

Parameters:

Name Type Description Default
maxtop int

Maximum number of top players to return. Use a large number to get entire leaderboard.

required
modes str

List of game modes for which to get leaderboards. See the documentation for DestinyActivityModeType for valid values, and pass in string representation, comma delimited.

required
statid str

ID of stat to return rather than returning all Leaderboard stats.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
dict[str, dict[str, DestinyLeaderboard]]

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
async def get_leaderboards(
    self, maxtop: int, modes: str, statid: str, auth: Optional["AuthData"] = None
) -> dict[str, dict[str, "DestinyLeaderboard"]]:
    """
    Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint has not yet been implemented. It is being returned for a preview of future functionality, and for public comment/suggestion/preparation.

    Args:
        maxtop: Maximum number of top players to return. Use a large number to get entire leaderboard.
        modes: List of game modes for which to get leaderboards. See the documentation for DestinyActivityModeType for valid values, and pass in string representation, comma delimited.
        statid: ID of stat to return rather than returning all Leaderboard stats.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_leaderboards(
        destiny_membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        maxtop=maxtop,
        modes=modes,
        statid=statid,
        auth=auth,
    )

get_linked_profiles(get_all_memberships, auth=None) async

Returns a summary information about all profiles linked to the requesting membership type/membership ID that have valid Destiny information. The passed-in Membership Type/Membership ID may be a Bungie.Net membership or a Destiny membership. It only returns the minimal amount of data to begin making more substantive requests, but will hopefully serve as a useful alternative to UserServices for people who just care about Destiny data. Note that it will only return linked accounts whose linkages you are allowed to view.

Parameters:

Name Type Description Default
get_all_memberships bool

(optional) if set to 'true', all memberships regardless of whether they're obscured by overrides will be returned. Normal privacy restrictions on account linking will still apply no matter what.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
DestinyLinkedProfilesResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
async def get_linked_profiles(
    self, get_all_memberships: bool, auth: Optional["AuthData"] = None
) -> "DestinyLinkedProfilesResponse":
    """
    Returns a summary information about all profiles linked to the requesting membership type/membership ID that have valid Destiny information. The passed-in Membership Type/Membership ID may be a Bungie.Net membership or a Destiny membership. It only returns the minimal amount of data to begin making more substantive requests, but will hopefully serve as a useful alternative to UserServices for people who just care about Destiny data. Note that it will only return linked accounts whose linkages you are allowed to view.

    Args:
        get_all_memberships: (optional) if set to 'true', all memberships regardless of whether they're obscured by overrides will be returned. Normal privacy restrictions on account linking will still apply no matter what.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_linked_profiles(
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        get_all_memberships=get_all_memberships,
        auth=auth,
    )

get_membership_data_by_id(auth=None) async

Returns a list of accounts associated with the supplied membership ID and membership type. This will include all linked accounts (even when hidden) if supplied credentials permit it.

Parameters:

Name Type Description Default
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
UserMembershipData

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
async def get_membership_data_by_id(self, auth: Optional["AuthData"] = None) -> "UserMembershipData":
    """
    Returns a list of accounts associated with the supplied membership ID and membership type. This will include all linked accounts (even when hidden) if supplied credentials permit it.

    Args:
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_membership_data_by_id(
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

get_potential_groups_for_member(filter, group_type, auth=None) async

Get information about the groups that a given member has applied to or been invited to.

Parameters:

Name Type Description Default
filter Union[GroupPotentialMemberStatus, int]

Filter apply to list of potential joined groups.

required
group_type Union[GroupType, int]

Type of group the supplied member applied.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
GroupPotentialMembershipSearchResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
async def get_potential_groups_for_member(
    self,
    filter: Union["GroupPotentialMemberStatus", int],
    group_type: Union["GroupType", int],
    auth: Optional["AuthData"] = None,
) -> "GroupPotentialMembershipSearchResponse":
    """
    Get information about the groups that a given member has applied to or been invited to.

    Args:
        filter: Filter apply to list of potential joined groups.
        group_type: Type of group the supplied member applied.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_potential_groups_for_member(
        filter=filter,
        group_type=group_type,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

get_profile(components, auth=None) async

Returns Destiny Profile information for the supplied membership.

Parameters:

Name Type Description Default
components list[Union[DestinyComponentType, int]]

A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
DestinyProfileResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
async def get_profile(
    self, components: list[Union["DestinyComponentType", int]], auth: Optional["AuthData"] = None
) -> "DestinyProfileResponse":
    """
    Returns Destiny Profile information for the supplied membership.

    Args:
        components: A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.get_profile(
        destiny_membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        components=components,
        auth=auth,
    )

individual_group_invite(data, group_id, auth) async

Invite a user to join this group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
group_id int

ID of the group you would like to join.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
GroupApplicationResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
async def individual_group_invite(
    self, data: "GroupApplicationRequest", group_id: int, auth: "AuthData"
) -> "GroupApplicationResponse":
    """
    Invite a user to join this group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        group_id: ID of the group you would like to join.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.individual_group_invite(
        data=data,
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

individual_group_invite_cancel(group_id, auth) async

Cancels a pending invitation to join a group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
group_id int

ID of the group you would like to join.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
GroupApplicationResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
async def individual_group_invite_cancel(self, group_id: int, auth: "AuthData") -> "GroupApplicationResponse":
    """
    Cancels a pending invitation to join a group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        group_id: ID of the group you would like to join.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.individual_group_invite_cancel(
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

kick_member(group_id, auth) async

Kick a member from the given group, forcing them to reapply if they wish to re-join the group. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
group_id int

Group ID to kick the user from.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
GroupMemberLeaveResult

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
async def kick_member(self, group_id: int, auth: "AuthData") -> "GroupMemberLeaveResult":
    """
    Kick a member from the given group, forcing them to reapply if they wish to re-join the group. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        group_id: Group ID to kick the user from.
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.kick_member(
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

recover_group_for_founder(group_type, auth=None) async

Allows a founder to manually recover a group they can see in game but not on bungie.net

Parameters:

Name Type Description Default
group_type Union[GroupType, int]

Type of group the supplied member founded.

required
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
GroupMembershipSearchResponse

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
async def recover_group_for_founder(
    self, group_type: Union["GroupType", int], auth: Optional["AuthData"] = None
) -> "GroupMembershipSearchResponse":
    """
    Allows a founder to manually recover a group they can see in game but not on bungie.net

    Args:
        group_type: Type of group the supplied member founded.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.recover_group_for_founder(
        group_type=group_type,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

unban_member(group_id, auth) async

Unbans the requested member, allowing them to re-apply for membership.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
group_id int
required
auth AuthData

Authentication information.

required

Returns:

Type Description
int

The model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
async def unban_member(self, group_id: int, auth: "AuthData") -> int:
    """
    Unbans the requested member, allowing them to re-apply for membership.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        group_id:
        auth: Authentication information.

    Returns:
        The model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """

    return await self._client.api.unban_member(
        group_id=group_id,
        membership_id=self._fuzzy_getattr("membership_id"),
        membership_type=self._fuzzy_getattr("membership_type"),
        auth=auth,
    )

yield_activity_history(mode, earliest_allowed_datetime=None, latest_allowed_datetime=None, auth=None) async

Yields account activity history, no matter the character. Sorted by date descending, the latest one first.

Parameters:

Name Type Description Default
mode Union[DestinyActivityModeType, int]

A filter for the activity mode to be returned. None returns all activities. See the documentation for DestinyActivityModeType for valid values, and pass in string representation.

required
earliest_allowed_datetime Optional[datetime]

The earliest time the activity is allowed to have, fe. only entries after the 1/1/2020.

None
latest_allowed_datetime Optional[datetime]

The latest time the activity is allowed to have, fe. only entries before the 1/1/2020.

None
auth Optional[AuthData]

Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

None

Returns:

Type Description
AsyncGenerator[DestinyHistoricalStatsPeriodGroup, None]

A generator for the model which is returned by bungie. General endpoint information.

Source code in src/bungio/models/mixins/user.py
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
async def yield_activity_history(
    self,
    mode: Union["DestinyActivityModeType", int],
    earliest_allowed_datetime: Optional[datetime] = None,
    latest_allowed_datetime: Optional[datetime] = None,
    auth: Optional["AuthData"] = None,
) -> AsyncGenerator["DestinyHistoricalStatsPeriodGroup", None]:
    """
    Yields account activity history, no matter the character. Sorted by date descending, the latest one first.

    Args:
        mode: A filter for the activity mode to be returned. None returns all activities. See the documentation for DestinyActivityModeType for valid values, and pass in string representation.
        earliest_allowed_datetime: The earliest time the activity is allowed to have, fe. only entries after the 1/1/2020.
        latest_allowed_datetime: The latest time the activity is allowed to have, fe. only entries before the 1/1/2020.
        auth: Authentication information. Required when users with a private profile are queried, or when Bungie feels like it

    Returns:
        A generator for the model which is returned by bungie. [General endpoint information.](https://bungie-net.github.io/multi/index.html)
    """
    from bungio.models.basic import DestinyCharacter

    # get character ids and gen functions
    # use the stats page to also get deleted chars
    data = await self.get_historical_stats_for_account(groups=[0], auth=auth)

    characters = [
        DestinyCharacter(
            membership_id=self._fuzzy_getattr("membership_id"),
            membership_type=self._fuzzy_getattr("membership_type"),
            character_id=character.character_id,
        )
        for character in data.characters
    ]

    funcs = {
        i: character.yield_activity_history(
            mode=mode,
            earliest_allowed_datetime=earliest_allowed_datetime,
            latest_allowed_datetime=latest_allowed_datetime,
            auth=auth,
        )
        for i, character in enumerate(characters)
    }

    # gen the first values
    entries = {i: await anext(func, None) for i, func in funcs.items()}

    # loop through all generators and return the newest values
    while True:
        # calculate the newest entry
        newest: Optional["DestinyHistoricalStatsPeriodGroup"] = None
        newest_index: int = 0
        for i, entry in entries.items():
            if entry is not None and (newest is None or entry.period > newest.period):
                newest = entry
                newest_index = i

        if newest:
            yield newest

            # get a new value from the func that just yielded
            entries[newest_index] = await anext(funcs[newest_index], None)
        else:
            break