Skip to content

Groupsv2 API Models

GroupQuery

Bases: BaseModel

NOTE: GroupQuery, as of Destiny 2, has essentially two totally different and incompatible "modes". If you are querying for a group, you can pass any of the properties below. If you are querying for a Clan, you MUST NOT pass any of the following properties (they must be null or undefined in your request, not just empty string/default values): - groupMemberCountFilter - localeFilter - tagText If you pass these, you will get a useless InvalidParameters error.

None Attributes: creation_date: No description given by bungie. current_page: No description given by bungie. group_member_count_filter: No description given by bungie. group_type: No description given by bungie. items_per_page: No description given by bungie. locale_filter: No description given by bungie. name: No description given by bungie. request_continuation_token: No description given by bungie. sort_by: No description given by bungie. tag_text: No description given by bungie.

Source code in src/bungio/models/overwrites/groupsv2.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@custom_define()
class GroupQuery(BaseModel):
    """
    NOTE: GroupQuery, as of Destiny 2, has essentially two totally different and incompatible "modes". If you are querying for a group, you can pass any of the properties below. If you are querying for a Clan, you MUST NOT pass any of the following properties (they must be null or undefined in your request, not just empty string/default values): - groupMemberCountFilter - localeFilter - tagText If you pass these, you will get a useless InvalidParameters error.

    None
    Attributes:
        creation_date: _No description given by bungie._
        current_page: _No description given by bungie._
        group_member_count_filter: _No description given by bungie._
        group_type: _No description given by bungie._
        items_per_page: _No description given by bungie._
        locale_filter: _No description given by bungie._
        name: _No description given by bungie._
        request_continuation_token: _No description given by bungie._
        sort_by: _No description given by bungie._
        tag_text: _No description given by bungie._
    """

    creation_date: Union["GroupDateRange", int] = custom_field(
        converter=enum_converter("GroupDateRange"), metadata={"type": "GroupDateRange"}, default=MISSING
    )
    current_page: int = custom_field(default=MISSING)
    group_member_count_filter: int = custom_field(default=MISSING)
    group_type: Union["GroupType", int] = custom_field(
        converter=enum_converter("GroupType"), metadata={"type": "GroupType"}, default=MISSING
    )
    items_per_page: int = custom_field(default=MISSING)
    locale_filter: str = custom_field(default=MISSING)
    name: str = custom_field(default=MISSING)
    request_continuation_token: str = custom_field(default=MISSING)
    sort_by: Union["GroupSortBy", int] = custom_field(
        converter=enum_converter("GroupSortBy"), metadata={"type": "GroupSortBy"}, default=MISSING
    )
    tag_text: str = custom_field(default=MISSING)

_client = custom_field(init=False) class-attribute instance-attribute

creation_date = custom_field(converter=enum_converter('GroupDateRange'), metadata={'type': 'GroupDateRange'}, default=MISSING) class-attribute instance-attribute

current_page = custom_field(default=MISSING) class-attribute instance-attribute

group_member_count_filter = custom_field(default=MISSING) class-attribute instance-attribute

group_type = custom_field(converter=enum_converter('GroupType'), metadata={'type': 'GroupType'}, default=MISSING) class-attribute instance-attribute

items_per_page = custom_field(default=MISSING) class-attribute instance-attribute

locale_filter = custom_field(default=MISSING) class-attribute instance-attribute

name = custom_field(default=MISSING) class-attribute instance-attribute

request_continuation_token = custom_field(default=MISSING) class-attribute instance-attribute

sort_by = custom_field(converter=enum_converter('GroupSortBy'), metadata={'type': 'GroupSortBy'}, default=MISSING) class-attribute instance-attribute

tag_text = custom_field(default=MISSING) class-attribute instance-attribute

__client_factory()

Source code in src/bungio/models/base.py
219
220
221
222
223
224
225
@_client.default
def __client_factory(self) -> "Client":
    from bungio.singleton import client

    if client is MISSING:
        raise ValueError("You have to set-up your 'Client' first")
    return client

_acquire_type(field_type, value_is_none) cached staticmethod

Source code in src/bungio/models/base.py
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
@staticmethod
@functools.cache
def _acquire_type(field_type: Any, value_is_none: bool) -> Any:
    if isinstance(field_type, _UnionGenericAlias):
        field_type = str(field_type)

        # catch optional
        if "Optional" in field_type:
            if value_is_none:
                raise NameError
            field_type = (
                field_type.removeprefix("typing.Optional[")
                .removesuffix("]")
                .replace("ForwardRef('", "")
                .replace("')", "")
            )

        # catch union
        if "Union" in field_type:
            field_type = (
                field_type.removeprefix("typing.Union[")
                .removesuffix(", int]")
                .replace("ForwardRef('", "")
                .replace("')", "")
            )

    return field_type

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_convert_to_type(field_type, field_metadata, value, client) async staticmethod

Source code in src/bungio/models/base.py
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
@staticmethod
async def _convert_to_type(field_type: Any, field_metadata: Optional[dict], value: Any, client: Client) -> Any:
    if value is None:
        return None

    try:
        field_type = BaseModel._acquire_type(field_type=field_type, value_is_none=value is None)
    except NameError:
        return None

    # catch build-ins
    try:
        return _enforce_type(field_type=field_type, value=value)
    except ValueError:
        # sometimes the field type is the attr class as a string
        if isinstance(field_type, str):
            try:
                field_type = getattr(models, field_type)
            except AttributeError:
                pass

    # convert models in models
    if hasattr(field_type, "from_dict"):
        value = await field_type.from_dict(data=value, client=client, recursive=True)

    # convert datetime
    elif field_type == datetime.datetime:
        # sometimes this includes milliseconds
        try:
            value = datetime.datetime.strptime(value, "%Y-%m-%dT%H:%M:%S%z")
        except ValueError:
            value = datetime.datetime.strptime(value, "%Y-%m-%dT%H:%M:%S.%f%z")

    # convert lists / dict
    elif field_metadata:
        field_type = field_metadata["type"]

        # iterables:
        if "dict" in field_metadata["type"] or "list" in field_metadata["type"]:
            # split the type into the subtypes
            split_types = field_metadata["type"].replace("]", "").split("[")

            match split_types[0]:
                case "dict":
                    # sometimes unknown dicts are returned
                    if field_type != "dict":
                        new_field_metadata = None
                        new_field_types = field_type.removeprefix("dict[").removesuffix("]").split(", ")
                        key_type = new_field_types[0]
                        value_type = ", ".join(new_field_types[1:])

                        # catch nested dicts
                        if "dict[" in value_type:
                            new_field_metadata = {"type": value_type}
                            value_type = None

                        ret = {}
                        for key, value in value.items():
                            key = await BaseModel._convert_to_type(
                                field_type=key_type,
                                field_metadata=new_field_metadata,
                                value=key,
                                client=client,
                            )
                            value = await BaseModel._convert_to_type(
                                field_type=value_type,
                                field_metadata=new_field_metadata,
                                value=value,
                                client=client,
                            )

                            ret[key] = value
                        value = ret

                case "list":
                    value = [
                        await BaseModel._convert_to_type(
                            field_type=split_types[1], field_metadata=None, value=entry, client=client
                        )
                        for entry in value
                    ]

                case _:
                    raise ValueError(f"Unexpected type {split_types[0]} in {split_types}")

        # enums
        else:
            value = await BaseModel._convert_to_type(
                field_type=field_metadata["type"].replace('"', ""),
                field_metadata=None,
                value=value,
                client=client,
            )

    return value

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

Capabilities

Bases: BaseFlagEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
class Capabilities(BaseFlagEnum):
    """
    _No description given by bungie._
    """

    NONE = 0
    """_No description given by bungie._ """
    LEADERBOARDS = 1
    """_No description given by bungie._ """
    CALLSIGN = 2
    """_No description given by bungie._ """
    OPTIONAL_CONVERSATIONS = 4
    """_No description given by bungie._ """
    CLAN_BANNER = 8
    """_No description given by bungie._ """
    D2_INVESTMENT_DATA = 16
    """_No description given by bungie._ """
    TAGS = 32
    """_No description given by bungie._ """
    ALLIANCES = 64
    """_No description given by bungie._ """

ALLIANCES = 64 class-attribute instance-attribute

No description given by bungie.

CALLSIGN = 2 class-attribute instance-attribute

No description given by bungie.

CLAN_BANNER = 8 class-attribute instance-attribute

No description given by bungie.

D2_INVESTMENT_DATA = 16 class-attribute instance-attribute

No description given by bungie.

LEADERBOARDS = 1 class-attribute instance-attribute

No description given by bungie.

NONE = 0 class-attribute instance-attribute

No description given by bungie.

OPTIONAL_CONVERSATIONS = 4 class-attribute instance-attribute

No description given by bungie.

TAGS = 32 class-attribute instance-attribute

No description given by bungie.

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

ChatSecuritySetting

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
177
178
179
180
181
182
183
184
185
class ChatSecuritySetting(BaseEnum):
    """
    _No description given by bungie._
    """

    GROUP = 0
    """_No description given by bungie._ """
    ADMINS = 1
    """_No description given by bungie._ """

ADMINS = 1 class-attribute instance-attribute

No description given by bungie.

GROUP = 0 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

ClanBanner

Bases: BaseModel

No description given by bungie.

None Attributes: decal_background_color_id: No description given by bungie. decal_color_id: No description given by bungie. decal_id: No description given by bungie. gonfalon_color_id: No description given by bungie. gonfalon_detail_color_id: No description given by bungie. gonfalon_detail_id: No description given by bungie. gonfalon_id: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
@custom_define()
class ClanBanner(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        decal_background_color_id: _No description given by bungie._
        decal_color_id: _No description given by bungie._
        decal_id: _No description given by bungie._
        gonfalon_color_id: _No description given by bungie._
        gonfalon_detail_color_id: _No description given by bungie._
        gonfalon_detail_id: _No description given by bungie._
        gonfalon_id: _No description given by bungie._
    """

    decal_background_color_id: int = custom_field()
    decal_color_id: int = custom_field()
    decal_id: int = custom_field()
    gonfalon_color_id: int = custom_field()
    gonfalon_detail_color_id: int = custom_field()
    gonfalon_detail_id: int = custom_field()
    gonfalon_id: int = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GetGroupsForMemberResponse

Bases: BaseModel

No description given by bungie.

None Attributes: are_all_memberships_inactive: A convenience property that indicates if every membership this user has that is a part of this group are part of an account that is considered inactive - for example, overridden accounts in Cross Save. The key is the Group ID for the group being checked, and the value is true if the users' memberships for that group are all inactive. has_more: No description given by bungie. query: No description given by bungie. replacement_continuation_token: No description given by bungie. results: No description given by bungie. total_results: No description given by bungie. use_total_results: If useTotalResults is true, then totalResults represents an accurate count. If False, it does not, and may be estimated/only the size of the current page. Either way, you should probably always only trust hasMore. This is a long-held historical throwback to when we used to do paging with known total results. Those queries toasted our database, and we were left to hastily alter our endpoints and create backward- compatible shims, of which useTotalResults is one.

Source code in src/bungio/models/bungie/groupsv2.py
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
@custom_define()
class GetGroupsForMemberResponse(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        are_all_memberships_inactive: A convenience property that indicates if every membership this user has that is a part of this group are part of an account that is considered inactive - for example, overridden accounts in Cross Save.  The key is the Group ID for the group being checked, and the value is true if the users' memberships for that group are all inactive.
        has_more: _No description given by bungie._
        query: _No description given by bungie._
        replacement_continuation_token: _No description given by bungie._
        results: _No description given by bungie._
        total_results: _No description given by bungie._
        use_total_results: If useTotalResults is true, then totalResults represents an accurate count. If False, it does not, and may be estimated/only the size of the current page. Either way, you should probably always only trust hasMore. This is a long-held historical throwback to when we used to do paging with known total results. Those queries toasted our database, and we were left to hastily alter our endpoints and create backward- compatible shims, of which useTotalResults is one.
    """

    are_all_memberships_inactive: dict[int, bool] = custom_field(metadata={"type": """dict[int, bool]"""})
    has_more: bool = custom_field()
    query: "PagedQuery" = custom_field()
    replacement_continuation_token: str = custom_field()
    results: list["GroupMembership"] = custom_field(metadata={"type": """list[GroupMembership]"""})
    total_results: int = custom_field()
    use_total_results: bool = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupAllianceStatus

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
418
419
420
421
422
423
424
425
426
427
428
class GroupAllianceStatus(BaseEnum):
    """
    _No description given by bungie._
    """

    UNALLIED = 0
    """_No description given by bungie._ """
    PARENT = 1
    """_No description given by bungie._ """
    CHILD = 2
    """_No description given by bungie._ """

CHILD = 2 class-attribute instance-attribute

No description given by bungie.

PARENT = 1 class-attribute instance-attribute

No description given by bungie.

UNALLIED = 0 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

GroupApplicationListRequest

Bases: BaseModel

No description given by bungie.

None Attributes: memberships: No description given by bungie. message: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
892
893
894
895
896
897
898
899
900
901
902
903
904
@custom_define()
class GroupApplicationListRequest(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        memberships: _No description given by bungie._
        message: _No description given by bungie._
    """

    memberships: list["UserMembership"] = custom_field(metadata={"type": """list[UserMembership]"""})
    message: str = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupApplicationRequest

Bases: BaseModel

No description given by bungie.

None Attributes: message: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
879
880
881
882
883
884
885
886
887
888
889
@custom_define()
class GroupApplicationRequest(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        message: _No description given by bungie._
    """

    message: str = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupApplicationResolveState

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
864
865
866
867
868
869
870
871
872
873
874
875
876
class GroupApplicationResolveState(BaseEnum):
    """
    _No description given by bungie._
    """

    UNRESOLVED = 0
    """_No description given by bungie._ """
    ACCEPTED = 1
    """_No description given by bungie._ """
    DENIED = 2
    """_No description given by bungie._ """
    RESCINDED = 3
    """_No description given by bungie._ """

ACCEPTED = 1 class-attribute instance-attribute

No description given by bungie.

DENIED = 2 class-attribute instance-attribute

No description given by bungie.

RESCINDED = 3 class-attribute instance-attribute

No description given by bungie.

UNRESOLVED = 0 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

GroupApplicationResponse

Bases: BaseModel

No description given by bungie.

None Attributes: resolution: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
@custom_define()
class GroupApplicationResponse(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        resolution: _No description given by bungie._
    """

    resolution: Union["GroupApplicationResolveState", int] = custom_field(
        converter=enum_converter("GroupApplicationResolveState")
    )

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupBan

Bases: BaseModel, DestinyClanMixin

No description given by bungie.

None Attributes: bungie_net_user_info: No description given by bungie. comment: No description given by bungie. created_by: No description given by bungie. date_banned: No description given by bungie. date_expires: No description given by bungie. destiny_user_info: No description given by bungie. group_id: No description given by bungie. last_modified_by: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
@custom_define()
class GroupBan(BaseModel, DestinyClanMixin):
    """
    _No description given by bungie._

    None
    Attributes:
        bungie_net_user_info: _No description given by bungie._
        comment: _No description given by bungie._
        created_by: _No description given by bungie._
        date_banned: _No description given by bungie._
        date_expires: _No description given by bungie._
        destiny_user_info: _No description given by bungie._
        group_id: _No description given by bungie._
        last_modified_by: _No description given by bungie._
    """

    bungie_net_user_info: "UserInfoCard" = custom_field()
    comment: str = custom_field()
    created_by: "UserInfoCard" = custom_field()
    date_banned: datetime = custom_field()
    date_expires: datetime = custom_field()
    destiny_user_info: "GroupUserInfoCard" = custom_field()
    group_id: int = custom_field(metadata={"int64": True})
    last_modified_by: "UserInfoCard" = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_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__()}`")

abdicate_foundership(founder_id_new, membership_type, auth=None) async

An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

Parameters:

Name Type Description Default
founder_id_new int

The new founder for this group. Must already be a group admin.

required
membership_type Union[BungieMembershipType, int]

Membership type of the provided founderIdNew.

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
bool

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

Source code in src/bungio/models/mixins/clan.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
async def abdicate_foundership(
    self,
    founder_id_new: int,
    membership_type: Union["BungieMembershipType", int],
    auth: Optional["AuthData"] = None,
) -> bool:
    """
    An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

    Args:
        founder_id_new: The new founder for this group. Must already be a group admin.
        membership_type: Membership type of the provided founderIdNew.
        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.abdicate_foundership(
        founder_id_new=founder_id_new,
        group_id=self._fuzzy_getattr("group_id"),
        membership_type=membership_type,
        auth=auth,
    )

add_optional_conversation(data, auth) async

Add a new optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationAddRequest

The required data for this request.

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/clan.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
async def add_optional_conversation(self, data: "GroupOptionalConversationAddRequest", auth: "AuthData") -> int:
    """
    Add a new optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.add_optional_conversation(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_all_pending(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
async def approve_all_pending(
    self, data: "GroupApplicationRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_all_pending(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_pending_for_list(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
async def approve_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

deny_all_pending(data, auth) async

Deny all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
async def deny_all_pending(self, data: "GroupApplicationRequest", auth: "AuthData") -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_all_pending(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

deny_pending_for_list(data, auth) async

Deny all of the pending users for the given group that match the passed-in .

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
async def deny_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group that match the passed-in .

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_clan_banner(data, auth) async

Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data ClanBanner

The required data for this request.

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/clan.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
async def edit_clan_banner(self, data: "ClanBanner", auth: "AuthData") -> int:
    """
    Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_clan_banner(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_founder_options(data, auth) async

Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionsEditAction

The required data for this request.

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/clan.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
async def edit_founder_options(self, data: "GroupOptionsEditAction", auth: "AuthData") -> int:
    """
    Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_founder_options(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_group(data, auth) async

Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupEditAction

The required data for this request.

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/clan.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
async def edit_group(self, data: "GroupEditAction", auth: "AuthData") -> int:
    """
    Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_group(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_optional_conversation(data, conversation_id, auth) async

Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationEditRequest

The required data for this request.

required
conversation_id int

Conversation Id of the channel being edited.

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/clan.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
async def edit_optional_conversation(
    self, data: "GroupOptionalConversationEditRequest", conversation_id: int, auth: "AuthData"
) -> int:
    """
    Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        conversation_id: Conversation Id of the channel being edited.
        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_optional_conversation(
        data=data, conversation_id=conversation_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

get_active_private_clan_fireteam_count(auth) async

Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
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/clan.py
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
async def get_active_private_clan_fireteam_count(self, auth: "AuthData") -> int:
    """
    Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    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_active_private_clan_fireteam_count(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_admins_and_founder_of_group(currentpage, auth=None) async

Get the list of members in a given group who are of admin level or higher.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
async def get_admins_and_founder_of_group(
    self, currentpage: int, auth: Optional["AuthData"] = None
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group who are of admin level or higher.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_admins_and_founder_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_available_clan_fireteams(activity_type, date_range, page, platform, public_only, slot_filter, auth, exclude_immediate, lang_filter) async

Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
activity_type int

The activity type to filter by.

required
date_range Union[FireteamDateRange, int]

The date range to grab available fireteams.

required
page int

Zero based page

required
platform Union[FireteamPlatform, int]

The platform filter.

required
public_only Union[FireteamPublicSearchOption, int]

Determines public/private filtering.

required
slot_filter Union[FireteamSlotSearch, int]

Filters based on available slots

required
auth AuthData

Authentication information.

required
exclude_immediate bool

If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamSummary

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

Source code in src/bungio/models/mixins/clan.py
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
509
510
511
512
513
514
async def get_available_clan_fireteams(
    self,
    activity_type: int,
    date_range: Union["FireteamDateRange", int],
    page: int,
    platform: Union["FireteamPlatform", int],
    public_only: Union["FireteamPublicSearchOption", int],
    slot_filter: Union["FireteamSlotSearch", int],
    auth: "AuthData",
    exclude_immediate: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamSummary":
    """
    Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        activity_type: The activity type to filter by.
        date_range: The date range to grab available fireteams.
        page: Zero based page
        platform: The platform filter.
        public_only: Determines public/private filtering.
        slot_filter: Filters based on available slots
        auth: Authentication information.
        exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
        lang_filter: An optional language filter.

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

    return await self._client.api.get_available_clan_fireteams(
        activity_type=activity_type,
        date_range=date_range,
        group_id=self._fuzzy_getattr("group_id"),
        page=page,
        platform=platform,
        public_only=public_only,
        slot_filter=slot_filter,
        auth=auth,
        exclude_immediate=exclude_immediate,
        lang_filter=lang_filter,
    )

get_banned_members_of_group(currentpage, auth) async

Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupBan

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

Source code in src/bungio/models/mixins/clan.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
async def get_banned_members_of_group(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupBan":
    """
    Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_banned_members_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_aggregate_stats(modes, auth=None) async

Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

Parameters:

Name Type Description Default
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
auth Optional[AuthData]

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

None

Returns:

Type Description
list[DestinyClanAggregateStat]

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

Source code in src/bungio/models/mixins/clan.py
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
async def get_clan_aggregate_stats(
    self, modes: str, auth: Optional["AuthData"] = None
) -> list["DestinyClanAggregateStat"]:
    """
    Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    Args:
        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.
        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_clan_aggregate_stats(
        group_id=self._fuzzy_getattr("group_id"), modes=modes, auth=auth
    )

get_clan_fireteam(fireteam_id, auth) async

Gets a specific fireteam.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
fireteam_id int

The unique id of the fireteam.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
FireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
async def get_clan_fireteam(self, fireteam_id: int, auth: "AuthData") -> "FireteamResponse":
    """
    Gets a specific fireteam.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        fireteam_id: The unique id of the fireteam.
        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_clan_fireteam(
        fireteam_id=fireteam_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

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/clan.py
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
async def get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    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_clan_leaderboards(
        group_id=self._fuzzy_getattr("group_id"), maxtop=maxtop, modes=modes, statid=statid, auth=auth
    )

get_clan_weekly_reward_state(auth=None) async

Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

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
DestinyMilestone

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

Source code in src/bungio/models/mixins/clan.py
401
402
403
404
405
406
407
408
409
410
411
412
async def get_clan_weekly_reward_state(self, auth: Optional["AuthData"] = None) -> "DestinyMilestone":
    """
    Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

    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_clan_weekly_reward_state(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group(auth=None) async

Get information about a specific group of the given ID.

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
GroupResponse

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

Source code in src/bungio/models/mixins/clan.py
46
47
48
49
50
51
52
53
54
55
56
57
async def get_group(self, auth: Optional["AuthData"] = None) -> "GroupResponse":
    """
    Get information about a specific group of the given ID.

    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_group(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group_edit_history(currentpage, auth) async

Get the list of edits made to a given group. Only accessible to group Admins and above.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupEditHistory

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

Source code in src/bungio/models/mixins/clan.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
async def get_group_edit_history(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupEditHistory":
    """
    Get the list of edits made to a given group. Only accessible to group Admins and above.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_group_edit_history(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_group_optional_conversations(auth=None) async

Gets a list of available optional conversation channels and their settings.

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
list[GroupOptionalConversation]

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

Source code in src/bungio/models/mixins/clan.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
async def get_group_optional_conversations(
    self, auth: Optional["AuthData"] = None
) -> list["GroupOptionalConversation"]:
    """
    Gets a list of available optional conversation channels and their settings.

    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_group_optional_conversations(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_invited_individuals(currentpage, auth) async

Get the list of users who have been invited into the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
async def get_invited_individuals(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who have been invited into the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_invited_individuals(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_members_of_group(currentpage, member_type, name_search, auth=None) async

Get the list of members in a given group.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
member_type Union[RuntimeGroupMemberType, int]

Filter out other member types. Use None for all members.

required
name_search str

The name fragment upon which a search should be executed for members with matching display or unique names.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
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
async def get_members_of_group(
    self,
    currentpage: int,
    member_type: Union["RuntimeGroupMemberType", int],
    name_search: str,
    auth: Optional["AuthData"] = None,
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        member_type: Filter out other member types. Use None for all members.
        name_search: The name fragment upon which a search should be executed for members with matching display or unique names.
        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_members_of_group(
        currentpage=currentpage,
        group_id=self._fuzzy_getattr("group_id"),
        member_type=member_type,
        name_search=name_search,
        auth=auth,
    )

get_my_clan_fireteams(include_closed, page, platform, auth, group_filter, lang_filter) async

Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
include_closed bool

If true, return fireteams that have been closed.

required
page int

Deprecated parameter, ignored.

required
platform Union[FireteamPlatform, int]

The platform filter.

required
auth AuthData

Authentication information.

required
group_filter bool

If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
async def get_my_clan_fireteams(
    self,
    include_closed: bool,
    page: int,
    platform: Union["FireteamPlatform", int],
    auth: "AuthData",
    group_filter: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamResponse":
    """
    Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        include_closed: If true, return fireteams that have been closed.
        page: Deprecated parameter, ignored.
        platform: The platform filter.
        auth: Authentication information.
        group_filter: If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.
        lang_filter: An optional language filter.

    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_my_clan_fireteams(
        group_id=self._fuzzy_getattr("group_id"),
        include_closed=include_closed,
        page=page,
        platform=platform,
        auth=auth,
        group_filter=group_filter,
        lang_filter=lang_filter,
    )

get_pending_memberships(currentpage, auth) async

Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
async def get_pending_memberships(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_pending_memberships(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupBanRequest

Bases: BaseModel

No description given by bungie.

None Attributes: comment: No description given by bungie. length: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
758
759
760
761
762
763
764
765
766
767
768
769
770
@custom_define()
class GroupBanRequest(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        comment: _No description given by bungie._
        length: _No description given by bungie._
    """

    comment: str = custom_field()
    length: Union["IgnoreLength", int] = custom_field(converter=enum_converter("IgnoreLength"))

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupDateRange

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
class GroupDateRange(BaseEnum):
    """
    _No description given by bungie._
    """

    ALL = 0
    """_No description given by bungie._ """
    PAST_DAY = 1
    """_No description given by bungie._ """
    PAST_WEEK = 2
    """_No description given by bungie._ """
    PAST_MONTH = 3
    """_No description given by bungie._ """
    PAST_YEAR = 4
    """_No description given by bungie._ """

ALL = 0 class-attribute instance-attribute

No description given by bungie.

PAST_DAY = 1 class-attribute instance-attribute

No description given by bungie.

PAST_MONTH = 3 class-attribute instance-attribute

No description given by bungie.

PAST_WEEK = 2 class-attribute instance-attribute

No description given by bungie.

PAST_YEAR = 4 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

GroupEditAction

Bases: BaseModel

No description given by bungie.

None Attributes: about: No description given by bungie. allow_chat: No description given by bungie. avatar_image_index: No description given by bungie. callsign: No description given by bungie. chat_security: No description given by bungie. default_publicity: No description given by bungie. enable_invitation_messaging_for_admins: No description given by bungie. homepage: No description given by bungie. is_public: No description given by bungie. is_public_topic_admin_only: No description given by bungie. locale: No description given by bungie. membership_option: No description given by bungie. motto: No description given by bungie. name: No description given by bungie. tags: No description given by bungie. theme: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
@custom_define()
class GroupEditAction(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        about: _No description given by bungie._
        allow_chat: _No description given by bungie._
        avatar_image_index: _No description given by bungie._
        callsign: _No description given by bungie._
        chat_security: _No description given by bungie._
        default_publicity: _No description given by bungie._
        enable_invitation_messaging_for_admins: _No description given by bungie._
        homepage: _No description given by bungie._
        is_public: _No description given by bungie._
        is_public_topic_admin_only: _No description given by bungie._
        locale: _No description given by bungie._
        membership_option: _No description given by bungie._
        motto: _No description given by bungie._
        name: _No description given by bungie._
        tags: _No description given by bungie._
        theme: _No description given by bungie._
    """

    about: str = custom_field()
    allow_chat: bool = custom_field()
    avatar_image_index: int = custom_field()
    callsign: str = custom_field()
    chat_security: Union["ChatSecuritySetting", int] = custom_field(converter=enum_converter("ChatSecuritySetting"))
    default_publicity: Union["GroupPostPublicity", int] = custom_field(converter=enum_converter("GroupPostPublicity"))
    enable_invitation_messaging_for_admins: bool = custom_field()
    homepage: Union["GroupHomepage", int] = custom_field(converter=enum_converter("GroupHomepage"))
    is_public: bool = custom_field()
    is_public_topic_admin_only: bool = custom_field()
    locale: str = custom_field()
    membership_option: Union["MembershipOption", int] = custom_field(converter=enum_converter("MembershipOption"))
    motto: str = custom_field()
    name: str = custom_field()
    tags: str = custom_field()
    theme: str = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupEditHistory

Bases: BaseModel, DestinyClanMixin

No description given by bungie.

None Attributes: about: No description given by bungie. about_editors: No description given by bungie. clan_callsign: No description given by bungie. clan_callsign_editors: No description given by bungie. edit_date: No description given by bungie. group_editors: No description given by bungie. group_id: No description given by bungie. motto: No description given by bungie. motto_editors: No description given by bungie. name: No description given by bungie. name_editors: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
@custom_define()
class GroupEditHistory(BaseModel, DestinyClanMixin):
    """
    _No description given by bungie._

    None
    Attributes:
        about: _No description given by bungie._
        about_editors: _No description given by bungie._
        clan_callsign: _No description given by bungie._
        clan_callsign_editors: _No description given by bungie._
        edit_date: _No description given by bungie._
        group_editors: _No description given by bungie._
        group_id: _No description given by bungie._
        motto: _No description given by bungie._
        motto_editors: _No description given by bungie._
        name: _No description given by bungie._
        name_editors: _No description given by bungie._
    """

    about: str = custom_field()
    about_editors: int = custom_field(metadata={"int64": True})
    clan_callsign: str = custom_field()
    clan_callsign_editors: int = custom_field(metadata={"int64": True})
    edit_date: datetime = custom_field()
    group_editors: list["UserInfoCard"] = custom_field(metadata={"type": """list[UserInfoCard]"""})
    group_id: int = custom_field(metadata={"int64": True})
    motto: str = custom_field()
    motto_editors: int = custom_field(metadata={"int64": True})
    name: str = custom_field()
    name_editors: int = custom_field(metadata={"int64": True})

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_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__()}`")

abdicate_foundership(founder_id_new, membership_type, auth=None) async

An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

Parameters:

Name Type Description Default
founder_id_new int

The new founder for this group. Must already be a group admin.

required
membership_type Union[BungieMembershipType, int]

Membership type of the provided founderIdNew.

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
bool

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

Source code in src/bungio/models/mixins/clan.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
async def abdicate_foundership(
    self,
    founder_id_new: int,
    membership_type: Union["BungieMembershipType", int],
    auth: Optional["AuthData"] = None,
) -> bool:
    """
    An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

    Args:
        founder_id_new: The new founder for this group. Must already be a group admin.
        membership_type: Membership type of the provided founderIdNew.
        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.abdicate_foundership(
        founder_id_new=founder_id_new,
        group_id=self._fuzzy_getattr("group_id"),
        membership_type=membership_type,
        auth=auth,
    )

add_optional_conversation(data, auth) async

Add a new optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationAddRequest

The required data for this request.

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/clan.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
async def add_optional_conversation(self, data: "GroupOptionalConversationAddRequest", auth: "AuthData") -> int:
    """
    Add a new optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.add_optional_conversation(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_all_pending(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
async def approve_all_pending(
    self, data: "GroupApplicationRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_all_pending(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_pending_for_list(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
async def approve_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

deny_all_pending(data, auth) async

Deny all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
async def deny_all_pending(self, data: "GroupApplicationRequest", auth: "AuthData") -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_all_pending(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

deny_pending_for_list(data, auth) async

Deny all of the pending users for the given group that match the passed-in .

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
async def deny_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group that match the passed-in .

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_clan_banner(data, auth) async

Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data ClanBanner

The required data for this request.

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/clan.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
async def edit_clan_banner(self, data: "ClanBanner", auth: "AuthData") -> int:
    """
    Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_clan_banner(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_founder_options(data, auth) async

Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionsEditAction

The required data for this request.

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/clan.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
async def edit_founder_options(self, data: "GroupOptionsEditAction", auth: "AuthData") -> int:
    """
    Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_founder_options(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_group(data, auth) async

Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupEditAction

The required data for this request.

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/clan.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
async def edit_group(self, data: "GroupEditAction", auth: "AuthData") -> int:
    """
    Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_group(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_optional_conversation(data, conversation_id, auth) async

Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationEditRequest

The required data for this request.

required
conversation_id int

Conversation Id of the channel being edited.

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/clan.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
async def edit_optional_conversation(
    self, data: "GroupOptionalConversationEditRequest", conversation_id: int, auth: "AuthData"
) -> int:
    """
    Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        conversation_id: Conversation Id of the channel being edited.
        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_optional_conversation(
        data=data, conversation_id=conversation_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

get_active_private_clan_fireteam_count(auth) async

Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
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/clan.py
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
async def get_active_private_clan_fireteam_count(self, auth: "AuthData") -> int:
    """
    Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    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_active_private_clan_fireteam_count(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_admins_and_founder_of_group(currentpage, auth=None) async

Get the list of members in a given group who are of admin level or higher.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
async def get_admins_and_founder_of_group(
    self, currentpage: int, auth: Optional["AuthData"] = None
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group who are of admin level or higher.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_admins_and_founder_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_available_clan_fireteams(activity_type, date_range, page, platform, public_only, slot_filter, auth, exclude_immediate, lang_filter) async

Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
activity_type int

The activity type to filter by.

required
date_range Union[FireteamDateRange, int]

The date range to grab available fireteams.

required
page int

Zero based page

required
platform Union[FireteamPlatform, int]

The platform filter.

required
public_only Union[FireteamPublicSearchOption, int]

Determines public/private filtering.

required
slot_filter Union[FireteamSlotSearch, int]

Filters based on available slots

required
auth AuthData

Authentication information.

required
exclude_immediate bool

If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamSummary

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

Source code in src/bungio/models/mixins/clan.py
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
509
510
511
512
513
514
async def get_available_clan_fireteams(
    self,
    activity_type: int,
    date_range: Union["FireteamDateRange", int],
    page: int,
    platform: Union["FireteamPlatform", int],
    public_only: Union["FireteamPublicSearchOption", int],
    slot_filter: Union["FireteamSlotSearch", int],
    auth: "AuthData",
    exclude_immediate: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamSummary":
    """
    Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        activity_type: The activity type to filter by.
        date_range: The date range to grab available fireteams.
        page: Zero based page
        platform: The platform filter.
        public_only: Determines public/private filtering.
        slot_filter: Filters based on available slots
        auth: Authentication information.
        exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
        lang_filter: An optional language filter.

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

    return await self._client.api.get_available_clan_fireteams(
        activity_type=activity_type,
        date_range=date_range,
        group_id=self._fuzzy_getattr("group_id"),
        page=page,
        platform=platform,
        public_only=public_only,
        slot_filter=slot_filter,
        auth=auth,
        exclude_immediate=exclude_immediate,
        lang_filter=lang_filter,
    )

get_banned_members_of_group(currentpage, auth) async

Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupBan

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

Source code in src/bungio/models/mixins/clan.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
async def get_banned_members_of_group(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupBan":
    """
    Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_banned_members_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_aggregate_stats(modes, auth=None) async

Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

Parameters:

Name Type Description Default
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
auth Optional[AuthData]

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

None

Returns:

Type Description
list[DestinyClanAggregateStat]

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

Source code in src/bungio/models/mixins/clan.py
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
async def get_clan_aggregate_stats(
    self, modes: str, auth: Optional["AuthData"] = None
) -> list["DestinyClanAggregateStat"]:
    """
    Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    Args:
        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.
        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_clan_aggregate_stats(
        group_id=self._fuzzy_getattr("group_id"), modes=modes, auth=auth
    )

get_clan_fireteam(fireteam_id, auth) async

Gets a specific fireteam.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
fireteam_id int

The unique id of the fireteam.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
FireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
async def get_clan_fireteam(self, fireteam_id: int, auth: "AuthData") -> "FireteamResponse":
    """
    Gets a specific fireteam.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        fireteam_id: The unique id of the fireteam.
        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_clan_fireteam(
        fireteam_id=fireteam_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

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/clan.py
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
async def get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    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_clan_leaderboards(
        group_id=self._fuzzy_getattr("group_id"), maxtop=maxtop, modes=modes, statid=statid, auth=auth
    )

get_clan_weekly_reward_state(auth=None) async

Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

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
DestinyMilestone

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

Source code in src/bungio/models/mixins/clan.py
401
402
403
404
405
406
407
408
409
410
411
412
async def get_clan_weekly_reward_state(self, auth: Optional["AuthData"] = None) -> "DestinyMilestone":
    """
    Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

    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_clan_weekly_reward_state(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group(auth=None) async

Get information about a specific group of the given ID.

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
GroupResponse

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

Source code in src/bungio/models/mixins/clan.py
46
47
48
49
50
51
52
53
54
55
56
57
async def get_group(self, auth: Optional["AuthData"] = None) -> "GroupResponse":
    """
    Get information about a specific group of the given ID.

    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_group(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group_edit_history(currentpage, auth) async

Get the list of edits made to a given group. Only accessible to group Admins and above.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupEditHistory

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

Source code in src/bungio/models/mixins/clan.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
async def get_group_edit_history(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupEditHistory":
    """
    Get the list of edits made to a given group. Only accessible to group Admins and above.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_group_edit_history(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_group_optional_conversations(auth=None) async

Gets a list of available optional conversation channels and their settings.

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
list[GroupOptionalConversation]

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

Source code in src/bungio/models/mixins/clan.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
async def get_group_optional_conversations(
    self, auth: Optional["AuthData"] = None
) -> list["GroupOptionalConversation"]:
    """
    Gets a list of available optional conversation channels and their settings.

    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_group_optional_conversations(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_invited_individuals(currentpage, auth) async

Get the list of users who have been invited into the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
async def get_invited_individuals(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who have been invited into the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_invited_individuals(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_members_of_group(currentpage, member_type, name_search, auth=None) async

Get the list of members in a given group.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
member_type Union[RuntimeGroupMemberType, int]

Filter out other member types. Use None for all members.

required
name_search str

The name fragment upon which a search should be executed for members with matching display or unique names.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
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
async def get_members_of_group(
    self,
    currentpage: int,
    member_type: Union["RuntimeGroupMemberType", int],
    name_search: str,
    auth: Optional["AuthData"] = None,
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        member_type: Filter out other member types. Use None for all members.
        name_search: The name fragment upon which a search should be executed for members with matching display or unique names.
        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_members_of_group(
        currentpage=currentpage,
        group_id=self._fuzzy_getattr("group_id"),
        member_type=member_type,
        name_search=name_search,
        auth=auth,
    )

get_my_clan_fireteams(include_closed, page, platform, auth, group_filter, lang_filter) async

Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
include_closed bool

If true, return fireteams that have been closed.

required
page int

Deprecated parameter, ignored.

required
platform Union[FireteamPlatform, int]

The platform filter.

required
auth AuthData

Authentication information.

required
group_filter bool

If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
async def get_my_clan_fireteams(
    self,
    include_closed: bool,
    page: int,
    platform: Union["FireteamPlatform", int],
    auth: "AuthData",
    group_filter: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamResponse":
    """
    Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        include_closed: If true, return fireteams that have been closed.
        page: Deprecated parameter, ignored.
        platform: The platform filter.
        auth: Authentication information.
        group_filter: If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.
        lang_filter: An optional language filter.

    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_my_clan_fireteams(
        group_id=self._fuzzy_getattr("group_id"),
        include_closed=include_closed,
        page=page,
        platform=platform,
        auth=auth,
        group_filter=group_filter,
        lang_filter=lang_filter,
    )

get_pending_memberships(currentpage, auth) async

Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
async def get_pending_memberships(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_pending_memberships(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupFeatures

Bases: BaseModel

No description given by bungie.

None Attributes: capabilities: No description given by bungie. host_guided_game_permission_override: Minimum Member Level allowed to host guided games Always Allowed: Founder, Acting Founder, Admin Allowed Overrides: None, Member, Beginner Default is Member for clans, None for groups, although this means nothing for groups. invite_permission_override: Minimum Member Level allowed to invite new members to group Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups. join_level: Level to join a member at when accepting an invite, application, or joining an open clan Default is Beginner. maximum_members: No description given by bungie. maximum_memberships_of_group_type: Maximum number of groups of this type a typical membership may join. For example, a user may join about 50 General groups with their Bungie.net account. They may join one clan per Destiny membership. membership_types: No description given by bungie. update_banner_permission_override: Minimum Member Level allowed to update banner Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups. update_culture_permission_override: Minimum Member Level allowed to update group culture Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups.

Source code in src/bungio/models/bungie/groupsv2.py
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
@custom_define()
class GroupFeatures(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        capabilities: _No description given by bungie._
        host_guided_game_permission_override: Minimum Member Level allowed to host guided games Always Allowed: Founder, Acting Founder, Admin Allowed Overrides: None, Member, Beginner Default is Member for clans, None for groups, although this means nothing for groups.
        invite_permission_override: Minimum Member Level allowed to invite new members to group Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups.
        join_level: Level to join a member at when accepting an invite, application, or joining an open clan Default is Beginner.
        maximum_members: _No description given by bungie._
        maximum_memberships_of_group_type: Maximum number of groups of this type a typical membership may join. For example, a user may join about 50 General groups with their Bungie.net account. They may join one clan per Destiny membership.
        membership_types: _No description given by bungie._
        update_banner_permission_override: Minimum Member Level allowed to update banner Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups.
        update_culture_permission_override: Minimum Member Level allowed to update group culture Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups.
    """

    capabilities: Union["Capabilities", int] = custom_field(converter=enum_converter("Capabilities"))
    host_guided_game_permission_override: Union["HostGuidedGamesPermissionLevel", int] = custom_field(
        converter=enum_converter("HostGuidedGamesPermissionLevel")
    )
    invite_permission_override: bool = custom_field()
    join_level: Union["RuntimeGroupMemberType", int] = custom_field(converter=enum_converter("RuntimeGroupMemberType"))
    maximum_members: int = custom_field()
    maximum_memberships_of_group_type: int = custom_field()
    membership_types: list[Union["BungieMembershipType", int]] = custom_field(
        converter=enum_converter("BungieMembershipType")
    )
    update_banner_permission_override: bool = custom_field()
    update_culture_permission_override: bool = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupHomepage

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
188
189
190
191
192
193
194
195
196
197
198
class GroupHomepage(BaseEnum):
    """
    _No description given by bungie._
    """

    WALL = 0
    """_No description given by bungie._ """
    FORUM = 1
    """_No description given by bungie._ """
    ALLIANCE_FORUM = 2
    """_No description given by bungie._ """

ALLIANCE_FORUM = 2 class-attribute instance-attribute

No description given by bungie.

FORUM = 1 class-attribute instance-attribute

No description given by bungie.

WALL = 0 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

GroupMember

Bases: BaseModel, DestinyClanMixin

No description given by bungie.

None Attributes: bungie_net_user_info: No description given by bungie. destiny_user_info: No description given by bungie. group_id: No description given by bungie. is_online: No description given by bungie. join_date: No description given by bungie. last_online_status_change: No description given by bungie. member_type: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
@custom_define()
class GroupMember(BaseModel, DestinyClanMixin):
    """
    _No description given by bungie._

    None
    Attributes:
        bungie_net_user_info: _No description given by bungie._
        destiny_user_info: _No description given by bungie._
        group_id: _No description given by bungie._
        is_online: _No description given by bungie._
        join_date: _No description given by bungie._
        last_online_status_change: _No description given by bungie._
        member_type: _No description given by bungie._
    """

    bungie_net_user_info: "UserInfoCard" = custom_field()
    destiny_user_info: "GroupUserInfoCard" = custom_field()
    group_id: int = custom_field(metadata={"int64": True})
    is_online: bool = custom_field()
    join_date: datetime = custom_field()
    last_online_status_change: int = custom_field(metadata={"int64": True})
    member_type: Union["RuntimeGroupMemberType", int] = custom_field(converter=enum_converter("RuntimeGroupMemberType"))

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_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__()}`")

abdicate_foundership(founder_id_new, membership_type, auth=None) async

An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

Parameters:

Name Type Description Default
founder_id_new int

The new founder for this group. Must already be a group admin.

required
membership_type Union[BungieMembershipType, int]

Membership type of the provided founderIdNew.

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
bool

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

Source code in src/bungio/models/mixins/clan.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
async def abdicate_foundership(
    self,
    founder_id_new: int,
    membership_type: Union["BungieMembershipType", int],
    auth: Optional["AuthData"] = None,
) -> bool:
    """
    An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

    Args:
        founder_id_new: The new founder for this group. Must already be a group admin.
        membership_type: Membership type of the provided founderIdNew.
        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.abdicate_foundership(
        founder_id_new=founder_id_new,
        group_id=self._fuzzy_getattr("group_id"),
        membership_type=membership_type,
        auth=auth,
    )

add_optional_conversation(data, auth) async

Add a new optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationAddRequest

The required data for this request.

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/clan.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
async def add_optional_conversation(self, data: "GroupOptionalConversationAddRequest", auth: "AuthData") -> int:
    """
    Add a new optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.add_optional_conversation(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_all_pending(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
async def approve_all_pending(
    self, data: "GroupApplicationRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_all_pending(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_pending_for_list(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
async def approve_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

deny_all_pending(data, auth) async

Deny all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
async def deny_all_pending(self, data: "GroupApplicationRequest", auth: "AuthData") -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_all_pending(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

deny_pending_for_list(data, auth) async

Deny all of the pending users for the given group that match the passed-in .

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
async def deny_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group that match the passed-in .

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_clan_banner(data, auth) async

Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data ClanBanner

The required data for this request.

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/clan.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
async def edit_clan_banner(self, data: "ClanBanner", auth: "AuthData") -> int:
    """
    Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_clan_banner(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_founder_options(data, auth) async

Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionsEditAction

The required data for this request.

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/clan.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
async def edit_founder_options(self, data: "GroupOptionsEditAction", auth: "AuthData") -> int:
    """
    Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_founder_options(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_group(data, auth) async

Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupEditAction

The required data for this request.

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/clan.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
async def edit_group(self, data: "GroupEditAction", auth: "AuthData") -> int:
    """
    Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_group(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_optional_conversation(data, conversation_id, auth) async

Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationEditRequest

The required data for this request.

required
conversation_id int

Conversation Id of the channel being edited.

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/clan.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
async def edit_optional_conversation(
    self, data: "GroupOptionalConversationEditRequest", conversation_id: int, auth: "AuthData"
) -> int:
    """
    Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        conversation_id: Conversation Id of the channel being edited.
        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_optional_conversation(
        data=data, conversation_id=conversation_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

get_active_private_clan_fireteam_count(auth) async

Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
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/clan.py
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
async def get_active_private_clan_fireteam_count(self, auth: "AuthData") -> int:
    """
    Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    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_active_private_clan_fireteam_count(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_admins_and_founder_of_group(currentpage, auth=None) async

Get the list of members in a given group who are of admin level or higher.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
async def get_admins_and_founder_of_group(
    self, currentpage: int, auth: Optional["AuthData"] = None
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group who are of admin level or higher.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_admins_and_founder_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_available_clan_fireteams(activity_type, date_range, page, platform, public_only, slot_filter, auth, exclude_immediate, lang_filter) async

Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
activity_type int

The activity type to filter by.

required
date_range Union[FireteamDateRange, int]

The date range to grab available fireteams.

required
page int

Zero based page

required
platform Union[FireteamPlatform, int]

The platform filter.

required
public_only Union[FireteamPublicSearchOption, int]

Determines public/private filtering.

required
slot_filter Union[FireteamSlotSearch, int]

Filters based on available slots

required
auth AuthData

Authentication information.

required
exclude_immediate bool

If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamSummary

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

Source code in src/bungio/models/mixins/clan.py
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
509
510
511
512
513
514
async def get_available_clan_fireteams(
    self,
    activity_type: int,
    date_range: Union["FireteamDateRange", int],
    page: int,
    platform: Union["FireteamPlatform", int],
    public_only: Union["FireteamPublicSearchOption", int],
    slot_filter: Union["FireteamSlotSearch", int],
    auth: "AuthData",
    exclude_immediate: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamSummary":
    """
    Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        activity_type: The activity type to filter by.
        date_range: The date range to grab available fireteams.
        page: Zero based page
        platform: The platform filter.
        public_only: Determines public/private filtering.
        slot_filter: Filters based on available slots
        auth: Authentication information.
        exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
        lang_filter: An optional language filter.

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

    return await self._client.api.get_available_clan_fireteams(
        activity_type=activity_type,
        date_range=date_range,
        group_id=self._fuzzy_getattr("group_id"),
        page=page,
        platform=platform,
        public_only=public_only,
        slot_filter=slot_filter,
        auth=auth,
        exclude_immediate=exclude_immediate,
        lang_filter=lang_filter,
    )

get_banned_members_of_group(currentpage, auth) async

Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupBan

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

Source code in src/bungio/models/mixins/clan.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
async def get_banned_members_of_group(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupBan":
    """
    Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_banned_members_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_aggregate_stats(modes, auth=None) async

Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

Parameters:

Name Type Description Default
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
auth Optional[AuthData]

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

None

Returns:

Type Description
list[DestinyClanAggregateStat]

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

Source code in src/bungio/models/mixins/clan.py
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
async def get_clan_aggregate_stats(
    self, modes: str, auth: Optional["AuthData"] = None
) -> list["DestinyClanAggregateStat"]:
    """
    Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    Args:
        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.
        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_clan_aggregate_stats(
        group_id=self._fuzzy_getattr("group_id"), modes=modes, auth=auth
    )

get_clan_fireteam(fireteam_id, auth) async

Gets a specific fireteam.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
fireteam_id int

The unique id of the fireteam.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
FireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
async def get_clan_fireteam(self, fireteam_id: int, auth: "AuthData") -> "FireteamResponse":
    """
    Gets a specific fireteam.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        fireteam_id: The unique id of the fireteam.
        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_clan_fireteam(
        fireteam_id=fireteam_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

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/clan.py
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
async def get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    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_clan_leaderboards(
        group_id=self._fuzzy_getattr("group_id"), maxtop=maxtop, modes=modes, statid=statid, auth=auth
    )

get_clan_weekly_reward_state(auth=None) async

Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

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
DestinyMilestone

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

Source code in src/bungio/models/mixins/clan.py
401
402
403
404
405
406
407
408
409
410
411
412
async def get_clan_weekly_reward_state(self, auth: Optional["AuthData"] = None) -> "DestinyMilestone":
    """
    Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

    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_clan_weekly_reward_state(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group(auth=None) async

Get information about a specific group of the given ID.

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
GroupResponse

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

Source code in src/bungio/models/mixins/clan.py
46
47
48
49
50
51
52
53
54
55
56
57
async def get_group(self, auth: Optional["AuthData"] = None) -> "GroupResponse":
    """
    Get information about a specific group of the given ID.

    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_group(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group_edit_history(currentpage, auth) async

Get the list of edits made to a given group. Only accessible to group Admins and above.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupEditHistory

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

Source code in src/bungio/models/mixins/clan.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
async def get_group_edit_history(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupEditHistory":
    """
    Get the list of edits made to a given group. Only accessible to group Admins and above.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_group_edit_history(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_group_optional_conversations(auth=None) async

Gets a list of available optional conversation channels and their settings.

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
list[GroupOptionalConversation]

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

Source code in src/bungio/models/mixins/clan.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
async def get_group_optional_conversations(
    self, auth: Optional["AuthData"] = None
) -> list["GroupOptionalConversation"]:
    """
    Gets a list of available optional conversation channels and their settings.

    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_group_optional_conversations(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_invited_individuals(currentpage, auth) async

Get the list of users who have been invited into the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
async def get_invited_individuals(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who have been invited into the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_invited_individuals(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_members_of_group(currentpage, member_type, name_search, auth=None) async

Get the list of members in a given group.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
member_type Union[RuntimeGroupMemberType, int]

Filter out other member types. Use None for all members.

required
name_search str

The name fragment upon which a search should be executed for members with matching display or unique names.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
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
async def get_members_of_group(
    self,
    currentpage: int,
    member_type: Union["RuntimeGroupMemberType", int],
    name_search: str,
    auth: Optional["AuthData"] = None,
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        member_type: Filter out other member types. Use None for all members.
        name_search: The name fragment upon which a search should be executed for members with matching display or unique names.
        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_members_of_group(
        currentpage=currentpage,
        group_id=self._fuzzy_getattr("group_id"),
        member_type=member_type,
        name_search=name_search,
        auth=auth,
    )

get_my_clan_fireteams(include_closed, page, platform, auth, group_filter, lang_filter) async

Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
include_closed bool

If true, return fireteams that have been closed.

required
page int

Deprecated parameter, ignored.

required
platform Union[FireteamPlatform, int]

The platform filter.

required
auth AuthData

Authentication information.

required
group_filter bool

If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
async def get_my_clan_fireteams(
    self,
    include_closed: bool,
    page: int,
    platform: Union["FireteamPlatform", int],
    auth: "AuthData",
    group_filter: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamResponse":
    """
    Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        include_closed: If true, return fireteams that have been closed.
        page: Deprecated parameter, ignored.
        platform: The platform filter.
        auth: Authentication information.
        group_filter: If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.
        lang_filter: An optional language filter.

    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_my_clan_fireteams(
        group_id=self._fuzzy_getattr("group_id"),
        include_closed=include_closed,
        page=page,
        platform=platform,
        auth=auth,
        group_filter=group_filter,
        lang_filter=lang_filter,
    )

get_pending_memberships(currentpage, auth) async

Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
async def get_pending_memberships(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_pending_memberships(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupMemberApplication

Bases: BaseModel, DestinyClanMixin

No description given by bungie.

None Attributes: bungie_net_user_info: No description given by bungie. creation_date: No description given by bungie. destiny_user_info: No description given by bungie. group_id: No description given by bungie. request_message: No description given by bungie. resolve_date: No description given by bungie. resolve_message: No description given by bungie. resolve_state: No description given by bungie. resolved_by_membership_id: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
@custom_define()
class GroupMemberApplication(BaseModel, DestinyClanMixin):
    """
    _No description given by bungie._

    None
    Attributes:
        bungie_net_user_info: _No description given by bungie._
        creation_date: _No description given by bungie._
        destiny_user_info: _No description given by bungie._
        group_id: _No description given by bungie._
        request_message: _No description given by bungie._
        resolve_date: _No description given by bungie._
        resolve_message: _No description given by bungie._
        resolve_state: _No description given by bungie._
        resolved_by_membership_id: _No description given by bungie._
    """

    bungie_net_user_info: "UserInfoCard" = custom_field()
    creation_date: datetime = custom_field()
    destiny_user_info: "GroupUserInfoCard" = custom_field()
    group_id: int = custom_field(metadata={"int64": True})
    request_message: str = custom_field()
    resolve_date: datetime = custom_field()
    resolve_message: str = custom_field()
    resolve_state: Union["GroupApplicationResolveState", int] = custom_field(
        converter=enum_converter("GroupApplicationResolveState")
    )
    resolved_by_membership_id: int = custom_field(metadata={"int64": True})

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_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__()}`")

abdicate_foundership(founder_id_new, membership_type, auth=None) async

An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

Parameters:

Name Type Description Default
founder_id_new int

The new founder for this group. Must already be a group admin.

required
membership_type Union[BungieMembershipType, int]

Membership type of the provided founderIdNew.

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
bool

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

Source code in src/bungio/models/mixins/clan.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
async def abdicate_foundership(
    self,
    founder_id_new: int,
    membership_type: Union["BungieMembershipType", int],
    auth: Optional["AuthData"] = None,
) -> bool:
    """
    An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

    Args:
        founder_id_new: The new founder for this group. Must already be a group admin.
        membership_type: Membership type of the provided founderIdNew.
        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.abdicate_foundership(
        founder_id_new=founder_id_new,
        group_id=self._fuzzy_getattr("group_id"),
        membership_type=membership_type,
        auth=auth,
    )

add_optional_conversation(data, auth) async

Add a new optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationAddRequest

The required data for this request.

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/clan.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
async def add_optional_conversation(self, data: "GroupOptionalConversationAddRequest", auth: "AuthData") -> int:
    """
    Add a new optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.add_optional_conversation(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_all_pending(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
async def approve_all_pending(
    self, data: "GroupApplicationRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_all_pending(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_pending_for_list(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
async def approve_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

deny_all_pending(data, auth) async

Deny all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
async def deny_all_pending(self, data: "GroupApplicationRequest", auth: "AuthData") -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_all_pending(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

deny_pending_for_list(data, auth) async

Deny all of the pending users for the given group that match the passed-in .

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
async def deny_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group that match the passed-in .

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_clan_banner(data, auth) async

Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data ClanBanner

The required data for this request.

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/clan.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
async def edit_clan_banner(self, data: "ClanBanner", auth: "AuthData") -> int:
    """
    Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_clan_banner(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_founder_options(data, auth) async

Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionsEditAction

The required data for this request.

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/clan.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
async def edit_founder_options(self, data: "GroupOptionsEditAction", auth: "AuthData") -> int:
    """
    Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_founder_options(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_group(data, auth) async

Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupEditAction

The required data for this request.

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/clan.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
async def edit_group(self, data: "GroupEditAction", auth: "AuthData") -> int:
    """
    Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_group(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_optional_conversation(data, conversation_id, auth) async

Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationEditRequest

The required data for this request.

required
conversation_id int

Conversation Id of the channel being edited.

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/clan.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
async def edit_optional_conversation(
    self, data: "GroupOptionalConversationEditRequest", conversation_id: int, auth: "AuthData"
) -> int:
    """
    Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        conversation_id: Conversation Id of the channel being edited.
        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_optional_conversation(
        data=data, conversation_id=conversation_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

get_active_private_clan_fireteam_count(auth) async

Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
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/clan.py
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
async def get_active_private_clan_fireteam_count(self, auth: "AuthData") -> int:
    """
    Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    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_active_private_clan_fireteam_count(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_admins_and_founder_of_group(currentpage, auth=None) async

Get the list of members in a given group who are of admin level or higher.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
async def get_admins_and_founder_of_group(
    self, currentpage: int, auth: Optional["AuthData"] = None
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group who are of admin level or higher.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_admins_and_founder_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_available_clan_fireteams(activity_type, date_range, page, platform, public_only, slot_filter, auth, exclude_immediate, lang_filter) async

Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
activity_type int

The activity type to filter by.

required
date_range Union[FireteamDateRange, int]

The date range to grab available fireteams.

required
page int

Zero based page

required
platform Union[FireteamPlatform, int]

The platform filter.

required
public_only Union[FireteamPublicSearchOption, int]

Determines public/private filtering.

required
slot_filter Union[FireteamSlotSearch, int]

Filters based on available slots

required
auth AuthData

Authentication information.

required
exclude_immediate bool

If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamSummary

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

Source code in src/bungio/models/mixins/clan.py
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
509
510
511
512
513
514
async def get_available_clan_fireteams(
    self,
    activity_type: int,
    date_range: Union["FireteamDateRange", int],
    page: int,
    platform: Union["FireteamPlatform", int],
    public_only: Union["FireteamPublicSearchOption", int],
    slot_filter: Union["FireteamSlotSearch", int],
    auth: "AuthData",
    exclude_immediate: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamSummary":
    """
    Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        activity_type: The activity type to filter by.
        date_range: The date range to grab available fireteams.
        page: Zero based page
        platform: The platform filter.
        public_only: Determines public/private filtering.
        slot_filter: Filters based on available slots
        auth: Authentication information.
        exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
        lang_filter: An optional language filter.

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

    return await self._client.api.get_available_clan_fireteams(
        activity_type=activity_type,
        date_range=date_range,
        group_id=self._fuzzy_getattr("group_id"),
        page=page,
        platform=platform,
        public_only=public_only,
        slot_filter=slot_filter,
        auth=auth,
        exclude_immediate=exclude_immediate,
        lang_filter=lang_filter,
    )

get_banned_members_of_group(currentpage, auth) async

Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupBan

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

Source code in src/bungio/models/mixins/clan.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
async def get_banned_members_of_group(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupBan":
    """
    Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_banned_members_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_aggregate_stats(modes, auth=None) async

Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

Parameters:

Name Type Description Default
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
auth Optional[AuthData]

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

None

Returns:

Type Description
list[DestinyClanAggregateStat]

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

Source code in src/bungio/models/mixins/clan.py
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
async def get_clan_aggregate_stats(
    self, modes: str, auth: Optional["AuthData"] = None
) -> list["DestinyClanAggregateStat"]:
    """
    Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    Args:
        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.
        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_clan_aggregate_stats(
        group_id=self._fuzzy_getattr("group_id"), modes=modes, auth=auth
    )

get_clan_fireteam(fireteam_id, auth) async

Gets a specific fireteam.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
fireteam_id int

The unique id of the fireteam.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
FireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
async def get_clan_fireteam(self, fireteam_id: int, auth: "AuthData") -> "FireteamResponse":
    """
    Gets a specific fireteam.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        fireteam_id: The unique id of the fireteam.
        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_clan_fireteam(
        fireteam_id=fireteam_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

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/clan.py
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
async def get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    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_clan_leaderboards(
        group_id=self._fuzzy_getattr("group_id"), maxtop=maxtop, modes=modes, statid=statid, auth=auth
    )

get_clan_weekly_reward_state(auth=None) async

Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

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
DestinyMilestone

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

Source code in src/bungio/models/mixins/clan.py
401
402
403
404
405
406
407
408
409
410
411
412
async def get_clan_weekly_reward_state(self, auth: Optional["AuthData"] = None) -> "DestinyMilestone":
    """
    Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

    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_clan_weekly_reward_state(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group(auth=None) async

Get information about a specific group of the given ID.

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
GroupResponse

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

Source code in src/bungio/models/mixins/clan.py
46
47
48
49
50
51
52
53
54
55
56
57
async def get_group(self, auth: Optional["AuthData"] = None) -> "GroupResponse":
    """
    Get information about a specific group of the given ID.

    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_group(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group_edit_history(currentpage, auth) async

Get the list of edits made to a given group. Only accessible to group Admins and above.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupEditHistory

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

Source code in src/bungio/models/mixins/clan.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
async def get_group_edit_history(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupEditHistory":
    """
    Get the list of edits made to a given group. Only accessible to group Admins and above.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_group_edit_history(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_group_optional_conversations(auth=None) async

Gets a list of available optional conversation channels and their settings.

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
list[GroupOptionalConversation]

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

Source code in src/bungio/models/mixins/clan.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
async def get_group_optional_conversations(
    self, auth: Optional["AuthData"] = None
) -> list["GroupOptionalConversation"]:
    """
    Gets a list of available optional conversation channels and their settings.

    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_group_optional_conversations(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_invited_individuals(currentpage, auth) async

Get the list of users who have been invited into the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
async def get_invited_individuals(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who have been invited into the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_invited_individuals(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_members_of_group(currentpage, member_type, name_search, auth=None) async

Get the list of members in a given group.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
member_type Union[RuntimeGroupMemberType, int]

Filter out other member types. Use None for all members.

required
name_search str

The name fragment upon which a search should be executed for members with matching display or unique names.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
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
async def get_members_of_group(
    self,
    currentpage: int,
    member_type: Union["RuntimeGroupMemberType", int],
    name_search: str,
    auth: Optional["AuthData"] = None,
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        member_type: Filter out other member types. Use None for all members.
        name_search: The name fragment upon which a search should be executed for members with matching display or unique names.
        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_members_of_group(
        currentpage=currentpage,
        group_id=self._fuzzy_getattr("group_id"),
        member_type=member_type,
        name_search=name_search,
        auth=auth,
    )

get_my_clan_fireteams(include_closed, page, platform, auth, group_filter, lang_filter) async

Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
include_closed bool

If true, return fireteams that have been closed.

required
page int

Deprecated parameter, ignored.

required
platform Union[FireteamPlatform, int]

The platform filter.

required
auth AuthData

Authentication information.

required
group_filter bool

If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
async def get_my_clan_fireteams(
    self,
    include_closed: bool,
    page: int,
    platform: Union["FireteamPlatform", int],
    auth: "AuthData",
    group_filter: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamResponse":
    """
    Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        include_closed: If true, return fireteams that have been closed.
        page: Deprecated parameter, ignored.
        platform: The platform filter.
        auth: Authentication information.
        group_filter: If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.
        lang_filter: An optional language filter.

    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_my_clan_fireteams(
        group_id=self._fuzzy_getattr("group_id"),
        include_closed=include_closed,
        page=page,
        platform=platform,
        auth=auth,
        group_filter=group_filter,
        lang_filter=lang_filter,
    )

get_pending_memberships(currentpage, auth) async

Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
async def get_pending_memberships(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_pending_memberships(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupMemberCountFilter

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
594
595
596
597
598
599
600
601
602
603
604
605
606
class GroupMemberCountFilter(BaseEnum):
    """
    _No description given by bungie._
    """

    ALL = 0
    """_No description given by bungie._ """
    ONE_TO_TEN = 1
    """_No description given by bungie._ """
    ELEVEN_TO_ONE_HUNDRED = 2
    """_No description given by bungie._ """
    GREATER_THAN_ONE_HUNDRED = 3
    """_No description given by bungie._ """

ALL = 0 class-attribute instance-attribute

No description given by bungie.

ELEVEN_TO_ONE_HUNDRED = 2 class-attribute instance-attribute

No description given by bungie.

GREATER_THAN_ONE_HUNDRED = 3 class-attribute instance-attribute

No description given by bungie.

ONE_TO_TEN = 1 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

GroupMemberLeaveResult

Bases: BaseModel

No description given by bungie.

None Attributes: group: No description given by bungie. group_deleted: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
743
744
745
746
747
748
749
750
751
752
753
754
755
@custom_define()
class GroupMemberLeaveResult(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        group: _No description given by bungie._
        group_deleted: _No description given by bungie._
    """

    group: "GroupV2" = custom_field()
    group_deleted: bool = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupMembership

Bases: BaseModel

No description given by bungie.

None Attributes: group: No description given by bungie. member: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
933
934
935
936
937
938
939
940
941
942
943
944
945
@custom_define()
class GroupMembership(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        group: _No description given by bungie._
        member: _No description given by bungie._
    """

    group: "GroupV2" = custom_field()
    member: "GroupMember" = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupMembershipBase

Bases: BaseModel

No description given by bungie.

None Attributes: group: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
920
921
922
923
924
925
926
927
928
929
930
@custom_define()
class GroupMembershipBase(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        group: _No description given by bungie._
    """

    group: "GroupV2" = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupMembershipSearchResponse

Bases: BaseModel

No description given by bungie.

None Attributes: has_more: No description given by bungie. query: No description given by bungie. replacement_continuation_token: No description given by bungie. results: No description given by bungie. total_results: No description given by bungie. use_total_results: If useTotalResults is true, then totalResults represents an accurate count. If False, it does not, and may be estimated/only the size of the current page. Either way, you should probably always only trust hasMore. This is a long-held historical throwback to when we used to do paging with known total results. Those queries toasted our database, and we were left to hastily alter our endpoints and create backward- compatible shims, of which useTotalResults is one.

Source code in src/bungio/models/bungie/groupsv2.py
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
@custom_define()
class GroupMembershipSearchResponse(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        has_more: _No description given by bungie._
        query: _No description given by bungie._
        replacement_continuation_token: _No description given by bungie._
        results: _No description given by bungie._
        total_results: _No description given by bungie._
        use_total_results: If useTotalResults is true, then totalResults represents an accurate count. If False, it does not, and may be estimated/only the size of the current page. Either way, you should probably always only trust hasMore. This is a long-held historical throwback to when we used to do paging with known total results. Those queries toasted our database, and we were left to hastily alter our endpoints and create backward- compatible shims, of which useTotalResults is one.
    """

    has_more: bool = custom_field()
    query: "PagedQuery" = custom_field()
    replacement_continuation_token: str = custom_field()
    results: list["GroupMembership"] = custom_field(metadata={"type": """list[GroupMembership]"""})
    total_results: int = custom_field()
    use_total_results: bool = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupNameSearchRequest

Bases: BaseModel

No description given by bungie.

None Attributes: group_name: No description given by bungie. group_type: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
609
610
611
612
613
614
615
616
617
618
619
620
621
@custom_define()
class GroupNameSearchRequest(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        group_name: _No description given by bungie._
        group_type: _No description given by bungie._
    """

    group_name: str = custom_field()
    group_type: Union["GroupType", int] = custom_field(converter=enum_converter("GroupType"))

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupOptionalConversation

Bases: BaseModel, DestinyClanMixin

No description given by bungie.

None Attributes: chat_enabled: No description given by bungie. chat_name: No description given by bungie. chat_security: No description given by bungie. conversation_id: No description given by bungie. group_id: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
@custom_define()
class GroupOptionalConversation(BaseModel, DestinyClanMixin):
    """
    _No description given by bungie._

    None
    Attributes:
        chat_enabled: _No description given by bungie._
        chat_name: _No description given by bungie._
        chat_security: _No description given by bungie._
        conversation_id: _No description given by bungie._
        group_id: _No description given by bungie._
    """

    chat_enabled: bool = custom_field()
    chat_name: str = custom_field()
    chat_security: Union["ChatSecuritySetting", int] = custom_field(converter=enum_converter("ChatSecuritySetting"))
    conversation_id: int = custom_field(metadata={"int64": True})
    group_id: int = custom_field(metadata={"int64": True})

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_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__()}`")

abdicate_foundership(founder_id_new, membership_type, auth=None) async

An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

Parameters:

Name Type Description Default
founder_id_new int

The new founder for this group. Must already be a group admin.

required
membership_type Union[BungieMembershipType, int]

Membership type of the provided founderIdNew.

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
bool

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

Source code in src/bungio/models/mixins/clan.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
async def abdicate_foundership(
    self,
    founder_id_new: int,
    membership_type: Union["BungieMembershipType", int],
    auth: Optional["AuthData"] = None,
) -> bool:
    """
    An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

    Args:
        founder_id_new: The new founder for this group. Must already be a group admin.
        membership_type: Membership type of the provided founderIdNew.
        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.abdicate_foundership(
        founder_id_new=founder_id_new,
        group_id=self._fuzzy_getattr("group_id"),
        membership_type=membership_type,
        auth=auth,
    )

add_optional_conversation(data, auth) async

Add a new optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationAddRequest

The required data for this request.

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/clan.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
async def add_optional_conversation(self, data: "GroupOptionalConversationAddRequest", auth: "AuthData") -> int:
    """
    Add a new optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.add_optional_conversation(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_all_pending(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
async def approve_all_pending(
    self, data: "GroupApplicationRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_all_pending(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_pending_for_list(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
async def approve_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

deny_all_pending(data, auth) async

Deny all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
async def deny_all_pending(self, data: "GroupApplicationRequest", auth: "AuthData") -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_all_pending(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

deny_pending_for_list(data, auth) async

Deny all of the pending users for the given group that match the passed-in .

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
async def deny_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group that match the passed-in .

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_clan_banner(data, auth) async

Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data ClanBanner

The required data for this request.

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/clan.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
async def edit_clan_banner(self, data: "ClanBanner", auth: "AuthData") -> int:
    """
    Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_clan_banner(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_founder_options(data, auth) async

Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionsEditAction

The required data for this request.

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/clan.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
async def edit_founder_options(self, data: "GroupOptionsEditAction", auth: "AuthData") -> int:
    """
    Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_founder_options(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_group(data, auth) async

Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupEditAction

The required data for this request.

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/clan.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
async def edit_group(self, data: "GroupEditAction", auth: "AuthData") -> int:
    """
    Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_group(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_optional_conversation(data, conversation_id, auth) async

Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationEditRequest

The required data for this request.

required
conversation_id int

Conversation Id of the channel being edited.

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/clan.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
async def edit_optional_conversation(
    self, data: "GroupOptionalConversationEditRequest", conversation_id: int, auth: "AuthData"
) -> int:
    """
    Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        conversation_id: Conversation Id of the channel being edited.
        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_optional_conversation(
        data=data, conversation_id=conversation_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

get_active_private_clan_fireteam_count(auth) async

Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
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/clan.py
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
async def get_active_private_clan_fireteam_count(self, auth: "AuthData") -> int:
    """
    Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    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_active_private_clan_fireteam_count(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_admins_and_founder_of_group(currentpage, auth=None) async

Get the list of members in a given group who are of admin level or higher.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
async def get_admins_and_founder_of_group(
    self, currentpage: int, auth: Optional["AuthData"] = None
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group who are of admin level or higher.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_admins_and_founder_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_available_clan_fireteams(activity_type, date_range, page, platform, public_only, slot_filter, auth, exclude_immediate, lang_filter) async

Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
activity_type int

The activity type to filter by.

required
date_range Union[FireteamDateRange, int]

The date range to grab available fireteams.

required
page int

Zero based page

required
platform Union[FireteamPlatform, int]

The platform filter.

required
public_only Union[FireteamPublicSearchOption, int]

Determines public/private filtering.

required
slot_filter Union[FireteamSlotSearch, int]

Filters based on available slots

required
auth AuthData

Authentication information.

required
exclude_immediate bool

If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamSummary

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

Source code in src/bungio/models/mixins/clan.py
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
509
510
511
512
513
514
async def get_available_clan_fireteams(
    self,
    activity_type: int,
    date_range: Union["FireteamDateRange", int],
    page: int,
    platform: Union["FireteamPlatform", int],
    public_only: Union["FireteamPublicSearchOption", int],
    slot_filter: Union["FireteamSlotSearch", int],
    auth: "AuthData",
    exclude_immediate: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamSummary":
    """
    Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        activity_type: The activity type to filter by.
        date_range: The date range to grab available fireteams.
        page: Zero based page
        platform: The platform filter.
        public_only: Determines public/private filtering.
        slot_filter: Filters based on available slots
        auth: Authentication information.
        exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
        lang_filter: An optional language filter.

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

    return await self._client.api.get_available_clan_fireteams(
        activity_type=activity_type,
        date_range=date_range,
        group_id=self._fuzzy_getattr("group_id"),
        page=page,
        platform=platform,
        public_only=public_only,
        slot_filter=slot_filter,
        auth=auth,
        exclude_immediate=exclude_immediate,
        lang_filter=lang_filter,
    )

get_banned_members_of_group(currentpage, auth) async

Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupBan

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

Source code in src/bungio/models/mixins/clan.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
async def get_banned_members_of_group(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupBan":
    """
    Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_banned_members_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_aggregate_stats(modes, auth=None) async

Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

Parameters:

Name Type Description Default
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
auth Optional[AuthData]

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

None

Returns:

Type Description
list[DestinyClanAggregateStat]

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

Source code in src/bungio/models/mixins/clan.py
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
async def get_clan_aggregate_stats(
    self, modes: str, auth: Optional["AuthData"] = None
) -> list["DestinyClanAggregateStat"]:
    """
    Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    Args:
        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.
        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_clan_aggregate_stats(
        group_id=self._fuzzy_getattr("group_id"), modes=modes, auth=auth
    )

get_clan_fireteam(fireteam_id, auth) async

Gets a specific fireteam.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
fireteam_id int

The unique id of the fireteam.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
FireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
async def get_clan_fireteam(self, fireteam_id: int, auth: "AuthData") -> "FireteamResponse":
    """
    Gets a specific fireteam.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        fireteam_id: The unique id of the fireteam.
        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_clan_fireteam(
        fireteam_id=fireteam_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

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/clan.py
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
async def get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    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_clan_leaderboards(
        group_id=self._fuzzy_getattr("group_id"), maxtop=maxtop, modes=modes, statid=statid, auth=auth
    )

get_clan_weekly_reward_state(auth=None) async

Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

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
DestinyMilestone

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

Source code in src/bungio/models/mixins/clan.py
401
402
403
404
405
406
407
408
409
410
411
412
async def get_clan_weekly_reward_state(self, auth: Optional["AuthData"] = None) -> "DestinyMilestone":
    """
    Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

    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_clan_weekly_reward_state(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group(auth=None) async

Get information about a specific group of the given ID.

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
GroupResponse

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

Source code in src/bungio/models/mixins/clan.py
46
47
48
49
50
51
52
53
54
55
56
57
async def get_group(self, auth: Optional["AuthData"] = None) -> "GroupResponse":
    """
    Get information about a specific group of the given ID.

    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_group(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group_edit_history(currentpage, auth) async

Get the list of edits made to a given group. Only accessible to group Admins and above.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupEditHistory

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

Source code in src/bungio/models/mixins/clan.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
async def get_group_edit_history(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupEditHistory":
    """
    Get the list of edits made to a given group. Only accessible to group Admins and above.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_group_edit_history(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_group_optional_conversations(auth=None) async

Gets a list of available optional conversation channels and their settings.

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
list[GroupOptionalConversation]

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

Source code in src/bungio/models/mixins/clan.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
async def get_group_optional_conversations(
    self, auth: Optional["AuthData"] = None
) -> list["GroupOptionalConversation"]:
    """
    Gets a list of available optional conversation channels and their settings.

    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_group_optional_conversations(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_invited_individuals(currentpage, auth) async

Get the list of users who have been invited into the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
async def get_invited_individuals(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who have been invited into the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_invited_individuals(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_members_of_group(currentpage, member_type, name_search, auth=None) async

Get the list of members in a given group.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
member_type Union[RuntimeGroupMemberType, int]

Filter out other member types. Use None for all members.

required
name_search str

The name fragment upon which a search should be executed for members with matching display or unique names.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
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
async def get_members_of_group(
    self,
    currentpage: int,
    member_type: Union["RuntimeGroupMemberType", int],
    name_search: str,
    auth: Optional["AuthData"] = None,
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        member_type: Filter out other member types. Use None for all members.
        name_search: The name fragment upon which a search should be executed for members with matching display or unique names.
        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_members_of_group(
        currentpage=currentpage,
        group_id=self._fuzzy_getattr("group_id"),
        member_type=member_type,
        name_search=name_search,
        auth=auth,
    )

get_my_clan_fireteams(include_closed, page, platform, auth, group_filter, lang_filter) async

Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
include_closed bool

If true, return fireteams that have been closed.

required
page int

Deprecated parameter, ignored.

required
platform Union[FireteamPlatform, int]

The platform filter.

required
auth AuthData

Authentication information.

required
group_filter bool

If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
async def get_my_clan_fireteams(
    self,
    include_closed: bool,
    page: int,
    platform: Union["FireteamPlatform", int],
    auth: "AuthData",
    group_filter: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamResponse":
    """
    Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        include_closed: If true, return fireteams that have been closed.
        page: Deprecated parameter, ignored.
        platform: The platform filter.
        auth: Authentication information.
        group_filter: If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.
        lang_filter: An optional language filter.

    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_my_clan_fireteams(
        group_id=self._fuzzy_getattr("group_id"),
        include_closed=include_closed,
        page=page,
        platform=platform,
        auth=auth,
        group_filter=group_filter,
        lang_filter=lang_filter,
    )

get_pending_memberships(currentpage, auth) async

Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
async def get_pending_memberships(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_pending_memberships(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupOptionalConversationAddRequest

Bases: BaseModel

No description given by bungie.

None Attributes: chat_name: No description given by bungie. chat_security: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
711
712
713
714
715
716
717
718
719
720
721
722
723
@custom_define()
class GroupOptionalConversationAddRequest(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        chat_name: _No description given by bungie._
        chat_security: _No description given by bungie._
    """

    chat_name: str = custom_field()
    chat_security: Union["ChatSecuritySetting", int] = custom_field(converter=enum_converter("ChatSecuritySetting"))

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupOptionalConversationEditRequest

Bases: BaseModel

No description given by bungie.

None Attributes: chat_enabled: No description given by bungie. chat_name: No description given by bungie. chat_security: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
@custom_define()
class GroupOptionalConversationEditRequest(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        chat_enabled: _No description given by bungie._
        chat_name: _No description given by bungie._
        chat_security: _No description given by bungie._
    """

    chat_enabled: bool = custom_field()
    chat_name: str = custom_field()
    chat_security: Union["ChatSecuritySetting", int] = custom_field(converter=enum_converter("ChatSecuritySetting"))

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupOptionsEditAction

Bases: BaseModel

No description given by bungie.

None Attributes: host_guided_game_permission_override: Minimum Member Level allowed to host guided games Always Allowed: Founder, Acting Founder, Admin Allowed Overrides: None, Member, Beginner Default is Member for clans, None for groups, although this means nothing for groups. invite_permission_override: Minimum Member Level allowed to invite new members to group Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups. join_level: Level to join a member at when accepting an invite, application, or joining an open clan Default is Beginner. update_banner_permission_override: Minimum Member Level allowed to update banner Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups. update_culture_permission_override: Minimum Member Level allowed to update group culture Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups.

Source code in src/bungio/models/bungie/groupsv2.py
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
@custom_define()
class GroupOptionsEditAction(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        host_guided_game_permission_override: Minimum Member Level allowed to host guided games Always Allowed: Founder, Acting Founder, Admin Allowed Overrides: None, Member, Beginner Default is Member for clans, None for groups, although this means nothing for groups.
        invite_permission_override: Minimum Member Level allowed to invite new members to group Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups.
        join_level: Level to join a member at when accepting an invite, application, or joining an open clan Default is Beginner.
        update_banner_permission_override: Minimum Member Level allowed to update banner Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups.
        update_culture_permission_override: Minimum Member Level allowed to update group culture Always Allowed: Founder, Acting Founder True means admins have this power, false means they don't Default is false for clans, true for groups.
    """

    host_guided_game_permission_override: Union["HostGuidedGamesPermissionLevel", int] = custom_field(
        converter=enum_converter("HostGuidedGamesPermissionLevel")
    )
    invite_permission_override: bool = custom_field()
    join_level: Union["RuntimeGroupMemberType", int] = custom_field(converter=enum_converter("RuntimeGroupMemberType"))
    update_banner_permission_override: bool = custom_field()
    update_culture_permission_override: bool = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupPostPublicity

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
214
215
216
217
218
219
220
221
222
223
224
class GroupPostPublicity(BaseEnum):
    """
    _No description given by bungie._
    """

    PUBLIC = 0
    """_No description given by bungie._ """
    ALLIANCE = 1
    """_No description given by bungie._ """
    PRIVATE = 2
    """_No description given by bungie._ """

ALLIANCE = 1 class-attribute instance-attribute

No description given by bungie.

PRIVATE = 2 class-attribute instance-attribute

No description given by bungie.

PUBLIC = 0 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

GroupPotentialMember

Bases: BaseModel, DestinyClanMixin

No description given by bungie.

None Attributes: bungie_net_user_info: No description given by bungie. destiny_user_info: No description given by bungie. group_id: No description given by bungie. join_date: No description given by bungie. potential_status: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
@custom_define()
class GroupPotentialMember(BaseModel, DestinyClanMixin):
    """
    _No description given by bungie._

    None
    Attributes:
        bungie_net_user_info: _No description given by bungie._
        destiny_user_info: _No description given by bungie._
        group_id: _No description given by bungie._
        join_date: _No description given by bungie._
        potential_status: _No description given by bungie._
    """

    bungie_net_user_info: "UserInfoCard" = custom_field()
    destiny_user_info: "GroupUserInfoCard" = custom_field()
    group_id: int = custom_field(metadata={"int64": True})
    join_date: datetime = custom_field()
    potential_status: Union["GroupPotentialMemberStatus", int] = custom_field(
        converter=enum_converter("GroupPotentialMemberStatus")
    )

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_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__()}`")

abdicate_foundership(founder_id_new, membership_type, auth=None) async

An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

Parameters:

Name Type Description Default
founder_id_new int

The new founder for this group. Must already be a group admin.

required
membership_type Union[BungieMembershipType, int]

Membership type of the provided founderIdNew.

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
bool

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

Source code in src/bungio/models/mixins/clan.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
async def abdicate_foundership(
    self,
    founder_id_new: int,
    membership_type: Union["BungieMembershipType", int],
    auth: Optional["AuthData"] = None,
) -> bool:
    """
    An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

    Args:
        founder_id_new: The new founder for this group. Must already be a group admin.
        membership_type: Membership type of the provided founderIdNew.
        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.abdicate_foundership(
        founder_id_new=founder_id_new,
        group_id=self._fuzzy_getattr("group_id"),
        membership_type=membership_type,
        auth=auth,
    )

add_optional_conversation(data, auth) async

Add a new optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationAddRequest

The required data for this request.

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/clan.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
async def add_optional_conversation(self, data: "GroupOptionalConversationAddRequest", auth: "AuthData") -> int:
    """
    Add a new optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.add_optional_conversation(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_all_pending(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
async def approve_all_pending(
    self, data: "GroupApplicationRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_all_pending(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_pending_for_list(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
async def approve_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

deny_all_pending(data, auth) async

Deny all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
async def deny_all_pending(self, data: "GroupApplicationRequest", auth: "AuthData") -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_all_pending(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

deny_pending_for_list(data, auth) async

Deny all of the pending users for the given group that match the passed-in .

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
async def deny_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group that match the passed-in .

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_clan_banner(data, auth) async

Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data ClanBanner

The required data for this request.

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/clan.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
async def edit_clan_banner(self, data: "ClanBanner", auth: "AuthData") -> int:
    """
    Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_clan_banner(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_founder_options(data, auth) async

Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionsEditAction

The required data for this request.

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/clan.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
async def edit_founder_options(self, data: "GroupOptionsEditAction", auth: "AuthData") -> int:
    """
    Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_founder_options(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_group(data, auth) async

Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupEditAction

The required data for this request.

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/clan.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
async def edit_group(self, data: "GroupEditAction", auth: "AuthData") -> int:
    """
    Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_group(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_optional_conversation(data, conversation_id, auth) async

Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationEditRequest

The required data for this request.

required
conversation_id int

Conversation Id of the channel being edited.

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/clan.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
async def edit_optional_conversation(
    self, data: "GroupOptionalConversationEditRequest", conversation_id: int, auth: "AuthData"
) -> int:
    """
    Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        conversation_id: Conversation Id of the channel being edited.
        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_optional_conversation(
        data=data, conversation_id=conversation_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

get_active_private_clan_fireteam_count(auth) async

Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
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/clan.py
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
async def get_active_private_clan_fireteam_count(self, auth: "AuthData") -> int:
    """
    Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    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_active_private_clan_fireteam_count(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_admins_and_founder_of_group(currentpage, auth=None) async

Get the list of members in a given group who are of admin level or higher.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
async def get_admins_and_founder_of_group(
    self, currentpage: int, auth: Optional["AuthData"] = None
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group who are of admin level or higher.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_admins_and_founder_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_available_clan_fireteams(activity_type, date_range, page, platform, public_only, slot_filter, auth, exclude_immediate, lang_filter) async

Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
activity_type int

The activity type to filter by.

required
date_range Union[FireteamDateRange, int]

The date range to grab available fireteams.

required
page int

Zero based page

required
platform Union[FireteamPlatform, int]

The platform filter.

required
public_only Union[FireteamPublicSearchOption, int]

Determines public/private filtering.

required
slot_filter Union[FireteamSlotSearch, int]

Filters based on available slots

required
auth AuthData

Authentication information.

required
exclude_immediate bool

If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamSummary

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

Source code in src/bungio/models/mixins/clan.py
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
509
510
511
512
513
514
async def get_available_clan_fireteams(
    self,
    activity_type: int,
    date_range: Union["FireteamDateRange", int],
    page: int,
    platform: Union["FireteamPlatform", int],
    public_only: Union["FireteamPublicSearchOption", int],
    slot_filter: Union["FireteamSlotSearch", int],
    auth: "AuthData",
    exclude_immediate: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamSummary":
    """
    Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        activity_type: The activity type to filter by.
        date_range: The date range to grab available fireteams.
        page: Zero based page
        platform: The platform filter.
        public_only: Determines public/private filtering.
        slot_filter: Filters based on available slots
        auth: Authentication information.
        exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
        lang_filter: An optional language filter.

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

    return await self._client.api.get_available_clan_fireteams(
        activity_type=activity_type,
        date_range=date_range,
        group_id=self._fuzzy_getattr("group_id"),
        page=page,
        platform=platform,
        public_only=public_only,
        slot_filter=slot_filter,
        auth=auth,
        exclude_immediate=exclude_immediate,
        lang_filter=lang_filter,
    )

get_banned_members_of_group(currentpage, auth) async

Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupBan

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

Source code in src/bungio/models/mixins/clan.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
async def get_banned_members_of_group(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupBan":
    """
    Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_banned_members_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_aggregate_stats(modes, auth=None) async

Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

Parameters:

Name Type Description Default
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
auth Optional[AuthData]

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

None

Returns:

Type Description
list[DestinyClanAggregateStat]

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

Source code in src/bungio/models/mixins/clan.py
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
async def get_clan_aggregate_stats(
    self, modes: str, auth: Optional["AuthData"] = None
) -> list["DestinyClanAggregateStat"]:
    """
    Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    Args:
        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.
        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_clan_aggregate_stats(
        group_id=self._fuzzy_getattr("group_id"), modes=modes, auth=auth
    )

get_clan_fireteam(fireteam_id, auth) async

Gets a specific fireteam.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
fireteam_id int

The unique id of the fireteam.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
FireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
async def get_clan_fireteam(self, fireteam_id: int, auth: "AuthData") -> "FireteamResponse":
    """
    Gets a specific fireteam.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        fireteam_id: The unique id of the fireteam.
        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_clan_fireteam(
        fireteam_id=fireteam_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

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/clan.py
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
async def get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    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_clan_leaderboards(
        group_id=self._fuzzy_getattr("group_id"), maxtop=maxtop, modes=modes, statid=statid, auth=auth
    )

get_clan_weekly_reward_state(auth=None) async

Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

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
DestinyMilestone

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

Source code in src/bungio/models/mixins/clan.py
401
402
403
404
405
406
407
408
409
410
411
412
async def get_clan_weekly_reward_state(self, auth: Optional["AuthData"] = None) -> "DestinyMilestone":
    """
    Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

    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_clan_weekly_reward_state(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group(auth=None) async

Get information about a specific group of the given ID.

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
GroupResponse

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

Source code in src/bungio/models/mixins/clan.py
46
47
48
49
50
51
52
53
54
55
56
57
async def get_group(self, auth: Optional["AuthData"] = None) -> "GroupResponse":
    """
    Get information about a specific group of the given ID.

    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_group(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group_edit_history(currentpage, auth) async

Get the list of edits made to a given group. Only accessible to group Admins and above.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupEditHistory

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

Source code in src/bungio/models/mixins/clan.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
async def get_group_edit_history(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupEditHistory":
    """
    Get the list of edits made to a given group. Only accessible to group Admins and above.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_group_edit_history(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_group_optional_conversations(auth=None) async

Gets a list of available optional conversation channels and their settings.

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
list[GroupOptionalConversation]

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

Source code in src/bungio/models/mixins/clan.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
async def get_group_optional_conversations(
    self, auth: Optional["AuthData"] = None
) -> list["GroupOptionalConversation"]:
    """
    Gets a list of available optional conversation channels and their settings.

    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_group_optional_conversations(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_invited_individuals(currentpage, auth) async

Get the list of users who have been invited into the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
async def get_invited_individuals(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who have been invited into the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_invited_individuals(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_members_of_group(currentpage, member_type, name_search, auth=None) async

Get the list of members in a given group.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
member_type Union[RuntimeGroupMemberType, int]

Filter out other member types. Use None for all members.

required
name_search str

The name fragment upon which a search should be executed for members with matching display or unique names.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
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
async def get_members_of_group(
    self,
    currentpage: int,
    member_type: Union["RuntimeGroupMemberType", int],
    name_search: str,
    auth: Optional["AuthData"] = None,
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        member_type: Filter out other member types. Use None for all members.
        name_search: The name fragment upon which a search should be executed for members with matching display or unique names.
        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_members_of_group(
        currentpage=currentpage,
        group_id=self._fuzzy_getattr("group_id"),
        member_type=member_type,
        name_search=name_search,
        auth=auth,
    )

get_my_clan_fireteams(include_closed, page, platform, auth, group_filter, lang_filter) async

Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
include_closed bool

If true, return fireteams that have been closed.

required
page int

Deprecated parameter, ignored.

required
platform Union[FireteamPlatform, int]

The platform filter.

required
auth AuthData

Authentication information.

required
group_filter bool

If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
async def get_my_clan_fireteams(
    self,
    include_closed: bool,
    page: int,
    platform: Union["FireteamPlatform", int],
    auth: "AuthData",
    group_filter: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamResponse":
    """
    Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        include_closed: If true, return fireteams that have been closed.
        page: Deprecated parameter, ignored.
        platform: The platform filter.
        auth: Authentication information.
        group_filter: If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.
        lang_filter: An optional language filter.

    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_my_clan_fireteams(
        group_id=self._fuzzy_getattr("group_id"),
        include_closed=include_closed,
        page=page,
        platform=platform,
        auth=auth,
        group_filter=group_filter,
        lang_filter=lang_filter,
    )

get_pending_memberships(currentpage, auth) async

Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
async def get_pending_memberships(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_pending_memberships(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupPotentialMemberStatus

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
454
455
456
457
458
459
460
461
462
463
464
class GroupPotentialMemberStatus(BaseEnum):
    """
    _No description given by bungie._
    """

    NONE = 0
    """_No description given by bungie._ """
    APPLICANT = 1
    """_No description given by bungie._ """
    INVITEE = 2
    """_No description given by bungie._ """

APPLICANT = 1 class-attribute instance-attribute

No description given by bungie.

INVITEE = 2 class-attribute instance-attribute

No description given by bungie.

NONE = 0 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

GroupPotentialMembership

Bases: BaseModel

No description given by bungie.

None Attributes: group: No description given by bungie. member: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
@custom_define()
class GroupPotentialMembership(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        group: _No description given by bungie._
        member: _No description given by bungie._
    """

    group: "GroupV2" = custom_field()
    member: "GroupPotentialMember" = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupPotentialMembershipSearchResponse

Bases: BaseModel

No description given by bungie.

None Attributes: has_more: No description given by bungie. query: No description given by bungie. replacement_continuation_token: No description given by bungie. results: No description given by bungie. total_results: No description given by bungie. use_total_results: If useTotalResults is true, then totalResults represents an accurate count. If False, it does not, and may be estimated/only the size of the current page. Either way, you should probably always only trust hasMore. This is a long-held historical throwback to when we used to do paging with known total results. Those queries toasted our database, and we were left to hastily alter our endpoints and create backward- compatible shims, of which useTotalResults is one.

Source code in src/bungio/models/bungie/groupsv2.py
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
@custom_define()
class GroupPotentialMembershipSearchResponse(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        has_more: _No description given by bungie._
        query: _No description given by bungie._
        replacement_continuation_token: _No description given by bungie._
        results: _No description given by bungie._
        total_results: _No description given by bungie._
        use_total_results: If useTotalResults is true, then totalResults represents an accurate count. If False, it does not, and may be estimated/only the size of the current page. Either way, you should probably always only trust hasMore. This is a long-held historical throwback to when we used to do paging with known total results. Those queries toasted our database, and we were left to hastily alter our endpoints and create backward- compatible shims, of which useTotalResults is one.
    """

    has_more: bool = custom_field()
    query: "PagedQuery" = custom_field()
    replacement_continuation_token: str = custom_field()
    results: list["GroupPotentialMembership"] = custom_field(metadata={"type": """list[GroupPotentialMembership]"""})
    total_results: int = custom_field()
    use_total_results: bool = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupResponse

Bases: BaseModel

No description given by bungie.

None Attributes: alliance_status: No description given by bungie. allied_ids: No description given by bungie. current_user_member_map: This property will be populated if the authenticated user is a member of the group. Note that because of account linking, a user can sometimes be part of a clan more than once. As such, this returns the highest member type available. current_user_memberships_inactive_for_destiny: A convenience property that indicates if every membership you (the current user) have that is a part of this group are part of an account that is considered inactive - for example, overridden accounts in Cross Save. current_user_potential_member_map: This property will be populated if the authenticated user is an applicant or has an outstanding invitation to join. Note that because of account linking, a user can sometimes be part of a clan more than once. detail: No description given by bungie. founder: No description given by bungie. group_join_invite_count: No description given by bungie. parent_group: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
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
@custom_define()
class GroupResponse(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        alliance_status: _No description given by bungie._
        allied_ids: _No description given by bungie._
        current_user_member_map: This property will be populated if the authenticated user is a member of the group. Note that because of account linking, a user can sometimes be part of a clan more than once. As such, this returns the highest member type available.
        current_user_memberships_inactive_for_destiny: A convenience property that indicates if every membership you (the current user) have that is a part of this group are part of an account that is considered inactive - for example, overridden accounts in Cross Save.
        current_user_potential_member_map: This property will be populated if the authenticated user is an applicant or has an outstanding invitation to join. Note that because of account linking, a user can sometimes be part of a clan more than once.
        detail: _No description given by bungie._
        founder: _No description given by bungie._
        group_join_invite_count: _No description given by bungie._
        parent_group: _No description given by bungie._
    """

    alliance_status: Union["GroupAllianceStatus", int] = custom_field(converter=enum_converter("GroupAllianceStatus"))
    allied_ids: list[int] = custom_field(metadata={"type": """list[int]"""})
    current_user_member_map: dict[Union["BungieMembershipType", int], "GroupMember"] = custom_field(
        metadata={"type": """dict[BungieMembershipType, GroupMember]"""}
    )
    current_user_memberships_inactive_for_destiny: bool = custom_field()
    current_user_potential_member_map: dict[Union["BungieMembershipType", int], "GroupPotentialMember"] = custom_field(
        metadata={"type": """dict[BungieMembershipType, GroupPotentialMember]"""}
    )
    detail: "GroupV2" = custom_field()
    founder: "GroupMember" = custom_field()
    group_join_invite_count: int = custom_field()
    parent_group: "GroupV2" = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupSearchResponse

Bases: BaseModel

No description given by bungie.

None Attributes: has_more: No description given by bungie. query: No description given by bungie. replacement_continuation_token: No description given by bungie. results: No description given by bungie. total_results: No description given by bungie. use_total_results: If useTotalResults is true, then totalResults represents an accurate count. If False, it does not, and may be estimated/only the size of the current page. Either way, you should probably always only trust hasMore. This is a long-held historical throwback to when we used to do paging with known total results. Those queries toasted our database, and we were left to hastily alter our endpoints and create backward- compatible shims, of which useTotalResults is one.

Source code in src/bungio/models/bungie/groupsv2.py
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
@custom_define()
class GroupSearchResponse(BaseModel):
    """
    _No description given by bungie._

    None
    Attributes:
        has_more: _No description given by bungie._
        query: _No description given by bungie._
        replacement_continuation_token: _No description given by bungie._
        results: _No description given by bungie._
        total_results: _No description given by bungie._
        use_total_results: If useTotalResults is true, then totalResults represents an accurate count. If False, it does not, and may be estimated/only the size of the current page. Either way, you should probably always only trust hasMore. This is a long-held historical throwback to when we used to do paging with known total results. Those queries toasted our database, and we were left to hastily alter our endpoints and create backward- compatible shims, of which useTotalResults is one.
    """

    has_more: bool = custom_field()
    query: "PagedQuery" = custom_field()
    replacement_continuation_token: str = custom_field()
    results: list["GroupV2Card"] = custom_field(metadata={"type": """list[GroupV2Card]"""})
    total_results: int = custom_field()
    use_total_results: bool = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupSortBy

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
579
580
581
582
583
584
585
586
587
588
589
590
591
class GroupSortBy(BaseEnum):
    """
    _No description given by bungie._
    """

    NAME = 0
    """_No description given by bungie._ """
    DATE = 1
    """_No description given by bungie._ """
    POPULARITY = 2
    """_No description given by bungie._ """
    ID = 3
    """_No description given by bungie._ """

DATE = 1 class-attribute instance-attribute

No description given by bungie.

ID = 3 class-attribute instance-attribute

No description given by bungie.

NAME = 0 class-attribute instance-attribute

No description given by bungie.

POPULARITY = 2 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

GroupType

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
166
167
168
169
170
171
172
173
174
class GroupType(BaseEnum):
    """
    _No description given by bungie._
    """

    GENERAL = 0
    """_No description given by bungie._ """
    CLAN = 1
    """_No description given by bungie._ """

CLAN = 1 class-attribute instance-attribute

No description given by bungie.

GENERAL = 0 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

GroupUserBase

Bases: BaseModel, DestinyClanMixin

No description given by bungie.

None Attributes: bungie_net_user_info: No description given by bungie. destiny_user_info: No description given by bungie. group_id: No description given by bungie. join_date: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
@custom_define()
class GroupUserBase(BaseModel, DestinyClanMixin):
    """
    _No description given by bungie._

    None
    Attributes:
        bungie_net_user_info: _No description given by bungie._
        destiny_user_info: _No description given by bungie._
        group_id: _No description given by bungie._
        join_date: _No description given by bungie._
    """

    bungie_net_user_info: "UserInfoCard" = custom_field()
    destiny_user_info: "GroupUserInfoCard" = custom_field()
    group_id: int = custom_field(metadata={"int64": True})
    join_date: datetime = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_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__()}`")

abdicate_foundership(founder_id_new, membership_type, auth=None) async

An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

Parameters:

Name Type Description Default
founder_id_new int

The new founder for this group. Must already be a group admin.

required
membership_type Union[BungieMembershipType, int]

Membership type of the provided founderIdNew.

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
bool

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

Source code in src/bungio/models/mixins/clan.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
async def abdicate_foundership(
    self,
    founder_id_new: int,
    membership_type: Union["BungieMembershipType", int],
    auth: Optional["AuthData"] = None,
) -> bool:
    """
    An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

    Args:
        founder_id_new: The new founder for this group. Must already be a group admin.
        membership_type: Membership type of the provided founderIdNew.
        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.abdicate_foundership(
        founder_id_new=founder_id_new,
        group_id=self._fuzzy_getattr("group_id"),
        membership_type=membership_type,
        auth=auth,
    )

add_optional_conversation(data, auth) async

Add a new optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationAddRequest

The required data for this request.

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/clan.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
async def add_optional_conversation(self, data: "GroupOptionalConversationAddRequest", auth: "AuthData") -> int:
    """
    Add a new optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.add_optional_conversation(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_all_pending(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
async def approve_all_pending(
    self, data: "GroupApplicationRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_all_pending(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_pending_for_list(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
async def approve_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

deny_all_pending(data, auth) async

Deny all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
async def deny_all_pending(self, data: "GroupApplicationRequest", auth: "AuthData") -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_all_pending(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

deny_pending_for_list(data, auth) async

Deny all of the pending users for the given group that match the passed-in .

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
async def deny_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group that match the passed-in .

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_clan_banner(data, auth) async

Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data ClanBanner

The required data for this request.

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/clan.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
async def edit_clan_banner(self, data: "ClanBanner", auth: "AuthData") -> int:
    """
    Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_clan_banner(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_founder_options(data, auth) async

Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionsEditAction

The required data for this request.

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/clan.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
async def edit_founder_options(self, data: "GroupOptionsEditAction", auth: "AuthData") -> int:
    """
    Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_founder_options(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_group(data, auth) async

Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupEditAction

The required data for this request.

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/clan.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
async def edit_group(self, data: "GroupEditAction", auth: "AuthData") -> int:
    """
    Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_group(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_optional_conversation(data, conversation_id, auth) async

Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationEditRequest

The required data for this request.

required
conversation_id int

Conversation Id of the channel being edited.

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/clan.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
async def edit_optional_conversation(
    self, data: "GroupOptionalConversationEditRequest", conversation_id: int, auth: "AuthData"
) -> int:
    """
    Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        conversation_id: Conversation Id of the channel being edited.
        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_optional_conversation(
        data=data, conversation_id=conversation_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

get_active_private_clan_fireteam_count(auth) async

Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
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/clan.py
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
async def get_active_private_clan_fireteam_count(self, auth: "AuthData") -> int:
    """
    Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    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_active_private_clan_fireteam_count(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_admins_and_founder_of_group(currentpage, auth=None) async

Get the list of members in a given group who are of admin level or higher.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
async def get_admins_and_founder_of_group(
    self, currentpage: int, auth: Optional["AuthData"] = None
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group who are of admin level or higher.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_admins_and_founder_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_available_clan_fireteams(activity_type, date_range, page, platform, public_only, slot_filter, auth, exclude_immediate, lang_filter) async

Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
activity_type int

The activity type to filter by.

required
date_range Union[FireteamDateRange, int]

The date range to grab available fireteams.

required
page int

Zero based page

required
platform Union[FireteamPlatform, int]

The platform filter.

required
public_only Union[FireteamPublicSearchOption, int]

Determines public/private filtering.

required
slot_filter Union[FireteamSlotSearch, int]

Filters based on available slots

required
auth AuthData

Authentication information.

required
exclude_immediate bool

If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamSummary

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

Source code in src/bungio/models/mixins/clan.py
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
509
510
511
512
513
514
async def get_available_clan_fireteams(
    self,
    activity_type: int,
    date_range: Union["FireteamDateRange", int],
    page: int,
    platform: Union["FireteamPlatform", int],
    public_only: Union["FireteamPublicSearchOption", int],
    slot_filter: Union["FireteamSlotSearch", int],
    auth: "AuthData",
    exclude_immediate: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamSummary":
    """
    Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        activity_type: The activity type to filter by.
        date_range: The date range to grab available fireteams.
        page: Zero based page
        platform: The platform filter.
        public_only: Determines public/private filtering.
        slot_filter: Filters based on available slots
        auth: Authentication information.
        exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
        lang_filter: An optional language filter.

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

    return await self._client.api.get_available_clan_fireteams(
        activity_type=activity_type,
        date_range=date_range,
        group_id=self._fuzzy_getattr("group_id"),
        page=page,
        platform=platform,
        public_only=public_only,
        slot_filter=slot_filter,
        auth=auth,
        exclude_immediate=exclude_immediate,
        lang_filter=lang_filter,
    )

get_banned_members_of_group(currentpage, auth) async

Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupBan

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

Source code in src/bungio/models/mixins/clan.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
async def get_banned_members_of_group(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupBan":
    """
    Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_banned_members_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_aggregate_stats(modes, auth=None) async

Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

Parameters:

Name Type Description Default
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
auth Optional[AuthData]

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

None

Returns:

Type Description
list[DestinyClanAggregateStat]

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

Source code in src/bungio/models/mixins/clan.py
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
async def get_clan_aggregate_stats(
    self, modes: str, auth: Optional["AuthData"] = None
) -> list["DestinyClanAggregateStat"]:
    """
    Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    Args:
        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.
        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_clan_aggregate_stats(
        group_id=self._fuzzy_getattr("group_id"), modes=modes, auth=auth
    )

get_clan_fireteam(fireteam_id, auth) async

Gets a specific fireteam.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
fireteam_id int

The unique id of the fireteam.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
FireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
async def get_clan_fireteam(self, fireteam_id: int, auth: "AuthData") -> "FireteamResponse":
    """
    Gets a specific fireteam.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        fireteam_id: The unique id of the fireteam.
        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_clan_fireteam(
        fireteam_id=fireteam_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

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/clan.py
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
async def get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    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_clan_leaderboards(
        group_id=self._fuzzy_getattr("group_id"), maxtop=maxtop, modes=modes, statid=statid, auth=auth
    )

get_clan_weekly_reward_state(auth=None) async

Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

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
DestinyMilestone

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

Source code in src/bungio/models/mixins/clan.py
401
402
403
404
405
406
407
408
409
410
411
412
async def get_clan_weekly_reward_state(self, auth: Optional["AuthData"] = None) -> "DestinyMilestone":
    """
    Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

    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_clan_weekly_reward_state(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group(auth=None) async

Get information about a specific group of the given ID.

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
GroupResponse

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

Source code in src/bungio/models/mixins/clan.py
46
47
48
49
50
51
52
53
54
55
56
57
async def get_group(self, auth: Optional["AuthData"] = None) -> "GroupResponse":
    """
    Get information about a specific group of the given ID.

    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_group(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group_edit_history(currentpage, auth) async

Get the list of edits made to a given group. Only accessible to group Admins and above.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupEditHistory

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

Source code in src/bungio/models/mixins/clan.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
async def get_group_edit_history(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupEditHistory":
    """
    Get the list of edits made to a given group. Only accessible to group Admins and above.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_group_edit_history(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_group_optional_conversations(auth=None) async

Gets a list of available optional conversation channels and their settings.

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
list[GroupOptionalConversation]

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

Source code in src/bungio/models/mixins/clan.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
async def get_group_optional_conversations(
    self, auth: Optional["AuthData"] = None
) -> list["GroupOptionalConversation"]:
    """
    Gets a list of available optional conversation channels and their settings.

    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_group_optional_conversations(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_invited_individuals(currentpage, auth) async

Get the list of users who have been invited into the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
async def get_invited_individuals(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who have been invited into the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_invited_individuals(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_members_of_group(currentpage, member_type, name_search, auth=None) async

Get the list of members in a given group.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
member_type Union[RuntimeGroupMemberType, int]

Filter out other member types. Use None for all members.

required
name_search str

The name fragment upon which a search should be executed for members with matching display or unique names.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
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
async def get_members_of_group(
    self,
    currentpage: int,
    member_type: Union["RuntimeGroupMemberType", int],
    name_search: str,
    auth: Optional["AuthData"] = None,
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        member_type: Filter out other member types. Use None for all members.
        name_search: The name fragment upon which a search should be executed for members with matching display or unique names.
        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_members_of_group(
        currentpage=currentpage,
        group_id=self._fuzzy_getattr("group_id"),
        member_type=member_type,
        name_search=name_search,
        auth=auth,
    )

get_my_clan_fireteams(include_closed, page, platform, auth, group_filter, lang_filter) async

Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
include_closed bool

If true, return fireteams that have been closed.

required
page int

Deprecated parameter, ignored.

required
platform Union[FireteamPlatform, int]

The platform filter.

required
auth AuthData

Authentication information.

required
group_filter bool

If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
async def get_my_clan_fireteams(
    self,
    include_closed: bool,
    page: int,
    platform: Union["FireteamPlatform", int],
    auth: "AuthData",
    group_filter: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamResponse":
    """
    Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        include_closed: If true, return fireteams that have been closed.
        page: Deprecated parameter, ignored.
        platform: The platform filter.
        auth: Authentication information.
        group_filter: If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.
        lang_filter: An optional language filter.

    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_my_clan_fireteams(
        group_id=self._fuzzy_getattr("group_id"),
        include_closed=include_closed,
        page=page,
        platform=platform,
        auth=auth,
        group_filter=group_filter,
        lang_filter=lang_filter,
    )

get_pending_memberships(currentpage, auth) async

Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
async def get_pending_memberships(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_pending_memberships(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupUserInfoCard

Bases: BaseModel, DestinyUserMixin

No description given by bungie.

None Attributes: applicable_membership_types: The list of Membership Types indicating the platforms on which this Membership can be used. Not in Cross Save = its original membership type. Cross Save Primary = Any membership types it is overridding, and its original membership type Cross Save Overridden = Empty list bungie_global_display_name: The bungie global display name, if set. bungie_global_display_name_code: The bungie global display name code, if set. cross_save_override: If there is a cross save override in effect, this value will tell you the type that is overridding this one. display_name: Display Name the player has chosen for themselves. The display name is optional when the data type is used as input to a platform API. icon_path: URL the Icon if available. is_public: If True, this is a public user membership. last_seen_display_name: This will be the display name the clan server last saw the user as. If the account is an active cross save override, this will be the display name to use. Otherwise, this will match the displayName property. last_seen_display_name_type: The platform of the LastSeenDisplayName membership_id: Membership ID as they user is known in the Accounts service membership_type: Type of the membership. Not necessarily the native type. supplemental_display_name: A platform specific additional display name - ex: psn Real Name, bnet Unique Name, etc.

Source code in src/bungio/models/bungie/groupsv2.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@custom_define()
class GroupUserInfoCard(BaseModel, DestinyUserMixin):
    """
    _No description given by bungie._

    None
    Attributes:
        applicable_membership_types: The list of Membership Types indicating the platforms on which this Membership can be used.  Not in Cross Save = its original membership type. Cross Save Primary = Any membership types it is overridding, and its original membership type Cross Save Overridden = Empty list
        bungie_global_display_name: The bungie global display name, if set.
        bungie_global_display_name_code: The bungie global display name code, if set.
        cross_save_override: If there is a cross save override in effect, this value will tell you the type that is overridding this one.
        display_name: Display Name the player has chosen for themselves. The display name is optional when the data type is used as input to a platform API.
        icon_path: URL the Icon if available.
        is_public: If True, this is a public user membership.
        last_seen_display_name: This will be the display name the clan server last saw the user as. If the account is an active cross save override, this will be the display name to use. Otherwise, this will match the displayName property.
        last_seen_display_name_type: The platform of the LastSeenDisplayName
        membership_id: Membership ID as they user is known in the Accounts service
        membership_type: Type of the membership. Not necessarily the native type.
        supplemental_display_name: A platform specific additional display name - ex: psn Real Name, bnet Unique Name, etc.
    """

    applicable_membership_types: list[Union["BungieMembershipType", int]] = custom_field(
        converter=enum_converter("BungieMembershipType")
    )
    bungie_global_display_name: str = custom_field()
    bungie_global_display_name_code: int = custom_field()
    cross_save_override: Union["BungieMembershipType", int] = custom_field(
        converter=enum_converter("BungieMembershipType")
    )
    display_name: str = custom_field()
    icon_path: str = custom_field()
    is_public: bool = custom_field()
    last_seen_display_name: str = custom_field()
    last_seen_display_name_type: Union["BungieMembershipType", int] = custom_field(
        converter=enum_converter("BungieMembershipType")
    )
    membership_id: int = custom_field(metadata={"int64": True})
    membership_type: Union["BungieMembershipType", int] = custom_field(converter=enum_converter("BungieMembershipType"))
    supplemental_display_name: str = custom_field()

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

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_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,
    )

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

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,
    )

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

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,
    )

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

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

GroupV2

Bases: BaseModel, DestinyClanMixin

No description given by bungie.

None Attributes: about: No description given by bungie. allow_chat: No description given by bungie. avatar_image_index: No description given by bungie. avatar_path: No description given by bungie. ban_expire_date: No description given by bungie. banner_path: No description given by bungie. chat_security: No description given by bungie. clan_info: No description given by bungie. conversation_id: No description given by bungie. creation_date: No description given by bungie. default_publicity: No description given by bungie. enable_invitation_messaging_for_admins: No description given by bungie. features: No description given by bungie. group_id: No description given by bungie. group_type: No description given by bungie. homepage: No description given by bungie. is_default_post_public: No description given by bungie. is_public: No description given by bungie. is_public_topic_admin_only: No description given by bungie. locale: No description given by bungie. member_count: No description given by bungie. membership_id_created: No description given by bungie. membership_option: No description given by bungie. modification_date: No description given by bungie. motto: No description given by bungie. name: No description given by bungie. remote_group_id: No description given by bungie. tags: No description given by bungie. theme: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
 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
@custom_define()
class GroupV2(BaseModel, DestinyClanMixin):
    """
    _No description given by bungie._

    None
    Attributes:
        about: _No description given by bungie._
        allow_chat: _No description given by bungie._
        avatar_image_index: _No description given by bungie._
        avatar_path: _No description given by bungie._
        ban_expire_date: _No description given by bungie._
        banner_path: _No description given by bungie._
        chat_security: _No description given by bungie._
        clan_info: _No description given by bungie._
        conversation_id: _No description given by bungie._
        creation_date: _No description given by bungie._
        default_publicity: _No description given by bungie._
        enable_invitation_messaging_for_admins: _No description given by bungie._
        features: _No description given by bungie._
        group_id: _No description given by bungie._
        group_type: _No description given by bungie._
        homepage: _No description given by bungie._
        is_default_post_public: _No description given by bungie._
        is_public: _No description given by bungie._
        is_public_topic_admin_only: _No description given by bungie._
        locale: _No description given by bungie._
        member_count: _No description given by bungie._
        membership_id_created: _No description given by bungie._
        membership_option: _No description given by bungie._
        modification_date: _No description given by bungie._
        motto: _No description given by bungie._
        name: _No description given by bungie._
        remote_group_id: _No description given by bungie._
        tags: _No description given by bungie._
        theme: _No description given by bungie._
    """

    about: str = custom_field()
    allow_chat: bool = custom_field()
    avatar_image_index: int = custom_field()
    avatar_path: str = custom_field()
    ban_expire_date: datetime = custom_field()
    banner_path: str = custom_field()
    chat_security: Union["ChatSecuritySetting", int] = custom_field(converter=enum_converter("ChatSecuritySetting"))
    clan_info: "GroupV2ClanInfoAndInvestment" = custom_field()
    conversation_id: int = custom_field(metadata={"int64": True})
    creation_date: datetime = custom_field()
    default_publicity: Union["GroupPostPublicity", int] = custom_field(converter=enum_converter("GroupPostPublicity"))
    enable_invitation_messaging_for_admins: bool = custom_field()
    features: "GroupFeatures" = custom_field()
    group_id: int = custom_field(metadata={"int64": True})
    group_type: Union["GroupType", int] = custom_field(converter=enum_converter("GroupType"))
    homepage: Union["GroupHomepage", int] = custom_field(converter=enum_converter("GroupHomepage"))
    is_default_post_public: bool = custom_field()
    is_public: bool = custom_field()
    is_public_topic_admin_only: bool = custom_field()
    locale: str = custom_field()
    member_count: int = custom_field()
    membership_id_created: int = custom_field(metadata={"int64": True})
    membership_option: Union["MembershipOption", int] = custom_field(converter=enum_converter("MembershipOption"))
    modification_date: datetime = custom_field()
    motto: str = custom_field()
    name: str = custom_field()
    remote_group_id: int = custom_field(metadata={"int64": True})
    tags: list[str] = custom_field(metadata={"type": """list[str]"""})
    theme: str = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_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__()}`")

abdicate_foundership(founder_id_new, membership_type, auth=None) async

An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

Parameters:

Name Type Description Default
founder_id_new int

The new founder for this group. Must already be a group admin.

required
membership_type Union[BungieMembershipType, int]

Membership type of the provided founderIdNew.

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
bool

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

Source code in src/bungio/models/mixins/clan.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
async def abdicate_foundership(
    self,
    founder_id_new: int,
    membership_type: Union["BungieMembershipType", int],
    auth: Optional["AuthData"] = None,
) -> bool:
    """
    An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

    Args:
        founder_id_new: The new founder for this group. Must already be a group admin.
        membership_type: Membership type of the provided founderIdNew.
        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.abdicate_foundership(
        founder_id_new=founder_id_new,
        group_id=self._fuzzy_getattr("group_id"),
        membership_type=membership_type,
        auth=auth,
    )

add_optional_conversation(data, auth) async

Add a new optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationAddRequest

The required data for this request.

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/clan.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
async def add_optional_conversation(self, data: "GroupOptionalConversationAddRequest", auth: "AuthData") -> int:
    """
    Add a new optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.add_optional_conversation(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_all_pending(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
async def approve_all_pending(
    self, data: "GroupApplicationRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_all_pending(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_pending_for_list(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
async def approve_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

deny_all_pending(data, auth) async

Deny all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
async def deny_all_pending(self, data: "GroupApplicationRequest", auth: "AuthData") -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_all_pending(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

deny_pending_for_list(data, auth) async

Deny all of the pending users for the given group that match the passed-in .

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
async def deny_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group that match the passed-in .

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_clan_banner(data, auth) async

Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data ClanBanner

The required data for this request.

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/clan.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
async def edit_clan_banner(self, data: "ClanBanner", auth: "AuthData") -> int:
    """
    Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_clan_banner(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_founder_options(data, auth) async

Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionsEditAction

The required data for this request.

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/clan.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
async def edit_founder_options(self, data: "GroupOptionsEditAction", auth: "AuthData") -> int:
    """
    Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_founder_options(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_group(data, auth) async

Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupEditAction

The required data for this request.

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/clan.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
async def edit_group(self, data: "GroupEditAction", auth: "AuthData") -> int:
    """
    Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_group(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_optional_conversation(data, conversation_id, auth) async

Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationEditRequest

The required data for this request.

required
conversation_id int

Conversation Id of the channel being edited.

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/clan.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
async def edit_optional_conversation(
    self, data: "GroupOptionalConversationEditRequest", conversation_id: int, auth: "AuthData"
) -> int:
    """
    Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        conversation_id: Conversation Id of the channel being edited.
        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_optional_conversation(
        data=data, conversation_id=conversation_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

get_active_private_clan_fireteam_count(auth) async

Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
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/clan.py
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
async def get_active_private_clan_fireteam_count(self, auth: "AuthData") -> int:
    """
    Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    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_active_private_clan_fireteam_count(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_admins_and_founder_of_group(currentpage, auth=None) async

Get the list of members in a given group who are of admin level or higher.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
async def get_admins_and_founder_of_group(
    self, currentpage: int, auth: Optional["AuthData"] = None
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group who are of admin level or higher.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_admins_and_founder_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_available_clan_fireteams(activity_type, date_range, page, platform, public_only, slot_filter, auth, exclude_immediate, lang_filter) async

Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
activity_type int

The activity type to filter by.

required
date_range Union[FireteamDateRange, int]

The date range to grab available fireteams.

required
page int

Zero based page

required
platform Union[FireteamPlatform, int]

The platform filter.

required
public_only Union[FireteamPublicSearchOption, int]

Determines public/private filtering.

required
slot_filter Union[FireteamSlotSearch, int]

Filters based on available slots

required
auth AuthData

Authentication information.

required
exclude_immediate bool

If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamSummary

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

Source code in src/bungio/models/mixins/clan.py
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
509
510
511
512
513
514
async def get_available_clan_fireteams(
    self,
    activity_type: int,
    date_range: Union["FireteamDateRange", int],
    page: int,
    platform: Union["FireteamPlatform", int],
    public_only: Union["FireteamPublicSearchOption", int],
    slot_filter: Union["FireteamSlotSearch", int],
    auth: "AuthData",
    exclude_immediate: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamSummary":
    """
    Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        activity_type: The activity type to filter by.
        date_range: The date range to grab available fireteams.
        page: Zero based page
        platform: The platform filter.
        public_only: Determines public/private filtering.
        slot_filter: Filters based on available slots
        auth: Authentication information.
        exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
        lang_filter: An optional language filter.

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

    return await self._client.api.get_available_clan_fireteams(
        activity_type=activity_type,
        date_range=date_range,
        group_id=self._fuzzy_getattr("group_id"),
        page=page,
        platform=platform,
        public_only=public_only,
        slot_filter=slot_filter,
        auth=auth,
        exclude_immediate=exclude_immediate,
        lang_filter=lang_filter,
    )

get_banned_members_of_group(currentpage, auth) async

Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupBan

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

Source code in src/bungio/models/mixins/clan.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
async def get_banned_members_of_group(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupBan":
    """
    Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_banned_members_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_aggregate_stats(modes, auth=None) async

Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

Parameters:

Name Type Description Default
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
auth Optional[AuthData]

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

None

Returns:

Type Description
list[DestinyClanAggregateStat]

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

Source code in src/bungio/models/mixins/clan.py
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
async def get_clan_aggregate_stats(
    self, modes: str, auth: Optional["AuthData"] = None
) -> list["DestinyClanAggregateStat"]:
    """
    Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    Args:
        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.
        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_clan_aggregate_stats(
        group_id=self._fuzzy_getattr("group_id"), modes=modes, auth=auth
    )

get_clan_fireteam(fireteam_id, auth) async

Gets a specific fireteam.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
fireteam_id int

The unique id of the fireteam.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
FireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
async def get_clan_fireteam(self, fireteam_id: int, auth: "AuthData") -> "FireteamResponse":
    """
    Gets a specific fireteam.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        fireteam_id: The unique id of the fireteam.
        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_clan_fireteam(
        fireteam_id=fireteam_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

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/clan.py
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
async def get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    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_clan_leaderboards(
        group_id=self._fuzzy_getattr("group_id"), maxtop=maxtop, modes=modes, statid=statid, auth=auth
    )

get_clan_weekly_reward_state(auth=None) async

Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

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
DestinyMilestone

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

Source code in src/bungio/models/mixins/clan.py
401
402
403
404
405
406
407
408
409
410
411
412
async def get_clan_weekly_reward_state(self, auth: Optional["AuthData"] = None) -> "DestinyMilestone":
    """
    Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

    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_clan_weekly_reward_state(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group(auth=None) async

Get information about a specific group of the given ID.

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
GroupResponse

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

Source code in src/bungio/models/mixins/clan.py
46
47
48
49
50
51
52
53
54
55
56
57
async def get_group(self, auth: Optional["AuthData"] = None) -> "GroupResponse":
    """
    Get information about a specific group of the given ID.

    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_group(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group_edit_history(currentpage, auth) async

Get the list of edits made to a given group. Only accessible to group Admins and above.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupEditHistory

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

Source code in src/bungio/models/mixins/clan.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
async def get_group_edit_history(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupEditHistory":
    """
    Get the list of edits made to a given group. Only accessible to group Admins and above.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_group_edit_history(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_group_optional_conversations(auth=None) async

Gets a list of available optional conversation channels and their settings.

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
list[GroupOptionalConversation]

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

Source code in src/bungio/models/mixins/clan.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
async def get_group_optional_conversations(
    self, auth: Optional["AuthData"] = None
) -> list["GroupOptionalConversation"]:
    """
    Gets a list of available optional conversation channels and their settings.

    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_group_optional_conversations(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_invited_individuals(currentpage, auth) async

Get the list of users who have been invited into the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
async def get_invited_individuals(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who have been invited into the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_invited_individuals(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_members_of_group(currentpage, member_type, name_search, auth=None) async

Get the list of members in a given group.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
member_type Union[RuntimeGroupMemberType, int]

Filter out other member types. Use None for all members.

required
name_search str

The name fragment upon which a search should be executed for members with matching display or unique names.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
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
async def get_members_of_group(
    self,
    currentpage: int,
    member_type: Union["RuntimeGroupMemberType", int],
    name_search: str,
    auth: Optional["AuthData"] = None,
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        member_type: Filter out other member types. Use None for all members.
        name_search: The name fragment upon which a search should be executed for members with matching display or unique names.
        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_members_of_group(
        currentpage=currentpage,
        group_id=self._fuzzy_getattr("group_id"),
        member_type=member_type,
        name_search=name_search,
        auth=auth,
    )

get_my_clan_fireteams(include_closed, page, platform, auth, group_filter, lang_filter) async

Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
include_closed bool

If true, return fireteams that have been closed.

required
page int

Deprecated parameter, ignored.

required
platform Union[FireteamPlatform, int]

The platform filter.

required
auth AuthData

Authentication information.

required
group_filter bool

If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
async def get_my_clan_fireteams(
    self,
    include_closed: bool,
    page: int,
    platform: Union["FireteamPlatform", int],
    auth: "AuthData",
    group_filter: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamResponse":
    """
    Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        include_closed: If true, return fireteams that have been closed.
        page: Deprecated parameter, ignored.
        platform: The platform filter.
        auth: Authentication information.
        group_filter: If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.
        lang_filter: An optional language filter.

    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_my_clan_fireteams(
        group_id=self._fuzzy_getattr("group_id"),
        include_closed=include_closed,
        page=page,
        platform=platform,
        auth=auth,
        group_filter=group_filter,
        lang_filter=lang_filter,
    )

get_pending_memberships(currentpage, auth) async

Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
async def get_pending_memberships(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_pending_memberships(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupV2Card

Bases: BaseModel, DestinyClanMixin

A small infocard of group information, usually used for when a list of groups are returned

None Attributes: about: No description given by bungie. avatar_path: No description given by bungie. capabilities: No description given by bungie. clan_info: No description given by bungie. creation_date: No description given by bungie. group_id: No description given by bungie. group_type: No description given by bungie. locale: No description given by bungie. member_count: No description given by bungie. membership_option: No description given by bungie. motto: No description given by bungie. name: No description given by bungie. remote_group_id: No description given by bungie. theme: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
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
509
510
511
512
513
514
515
516
517
518
519
520
@custom_define()
class GroupV2Card(BaseModel, DestinyClanMixin):
    """
    A small infocard of group information, usually used for when a list of groups are returned

    None
    Attributes:
        about: _No description given by bungie._
        avatar_path: _No description given by bungie._
        capabilities: _No description given by bungie._
        clan_info: _No description given by bungie._
        creation_date: _No description given by bungie._
        group_id: _No description given by bungie._
        group_type: _No description given by bungie._
        locale: _No description given by bungie._
        member_count: _No description given by bungie._
        membership_option: _No description given by bungie._
        motto: _No description given by bungie._
        name: _No description given by bungie._
        remote_group_id: _No description given by bungie._
        theme: _No description given by bungie._
    """

    about: str = custom_field()
    avatar_path: str = custom_field()
    capabilities: Union["Capabilities", int] = custom_field(converter=enum_converter("Capabilities"))
    clan_info: "GroupV2ClanInfo" = custom_field()
    creation_date: datetime = custom_field()
    group_id: int = custom_field(metadata={"int64": True})
    group_type: Union["GroupType", int] = custom_field(converter=enum_converter("GroupType"))
    locale: str = custom_field()
    member_count: int = custom_field()
    membership_option: Union["MembershipOption", int] = custom_field(converter=enum_converter("MembershipOption"))
    motto: str = custom_field()
    name: str = custom_field()
    remote_group_id: int = custom_field(metadata={"int64": True})
    theme: str = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

_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__()}`")

abdicate_foundership(founder_id_new, membership_type, auth=None) async

An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

Parameters:

Name Type Description Default
founder_id_new int

The new founder for this group. Must already be a group admin.

required
membership_type Union[BungieMembershipType, int]

Membership type of the provided founderIdNew.

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
bool

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

Source code in src/bungio/models/mixins/clan.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
async def abdicate_foundership(
    self,
    founder_id_new: int,
    membership_type: Union["BungieMembershipType", int],
    auth: Optional["AuthData"] = None,
) -> bool:
    """
    An administrative method to allow the founder of a group or clan to give up their position to another admin permanently.

    Args:
        founder_id_new: The new founder for this group. Must already be a group admin.
        membership_type: Membership type of the provided founderIdNew.
        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.abdicate_foundership(
        founder_id_new=founder_id_new,
        group_id=self._fuzzy_getattr("group_id"),
        membership_type=membership_type,
        auth=auth,
    )

add_optional_conversation(data, auth) async

Add a new optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationAddRequest

The required data for this request.

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/clan.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
async def add_optional_conversation(self, data: "GroupOptionalConversationAddRequest", auth: "AuthData") -> int:
    """
    Add a new optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.add_optional_conversation(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_all_pending(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
async def approve_all_pending(
    self, data: "GroupApplicationRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_all_pending(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

approve_pending_for_list(data, auth) async

Approve all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
async def approve_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Approve all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.approve_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

deny_all_pending(data, auth) async

Deny all of the pending users for the given group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
async def deny_all_pending(self, data: "GroupApplicationRequest", auth: "AuthData") -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_all_pending(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

deny_pending_for_list(data, auth) async

Deny all of the pending users for the given group that match the passed-in .

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupApplicationListRequest

The required data for this request.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
list[EntityActionResult]

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

Source code in src/bungio/models/mixins/clan.py
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
async def deny_pending_for_list(
    self, data: "GroupApplicationListRequest", auth: "AuthData"
) -> list["EntityActionResult"]:
    """
    Deny all of the pending users for the given group that match the passed-in .

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.deny_pending_for_list(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_clan_banner(data, auth) async

Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data ClanBanner

The required data for this request.

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/clan.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
async def edit_clan_banner(self, data: "ClanBanner", auth: "AuthData") -> int:
    """
    Edit an existing group's clan banner. You must have suitable permissions in the group to perform this operation. All fields are required.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_clan_banner(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_founder_options(data, auth) async

Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionsEditAction

The required data for this request.

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/clan.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
async def edit_founder_options(self, data: "GroupOptionsEditAction", auth: "AuthData") -> int:
    """
    Edit group options only available to a founder. You must have suitable permissions in the group to perform this operation.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_founder_options(
        data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

edit_group(data, auth) async

Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupEditAction

The required data for this request.

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/clan.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
async def edit_group(self, data: "GroupEditAction", auth: "AuthData") -> int:
    """
    Edit an existing group. You must have suitable permissions in the group to perform this operation. This latest revision will only edit the fields you pass in - pass null for properties you want to leave unaltered.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        auth: Authentication information.

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

    return await self._client.api.edit_group(data=data, group_id=self._fuzzy_getattr("group_id"), auth=auth)

edit_optional_conversation(data, conversation_id, auth) async

Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
data GroupOptionalConversationEditRequest

The required data for this request.

required
conversation_id int

Conversation Id of the channel being edited.

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/clan.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
async def edit_optional_conversation(
    self, data: "GroupOptionalConversationEditRequest", conversation_id: int, auth: "AuthData"
) -> int:
    """
    Edit the settings of an optional conversation/chat channel. Requires admin permissions to the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        data: The required data for this request.
        conversation_id: Conversation Id of the channel being edited.
        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_optional_conversation(
        data=data, conversation_id=conversation_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

get_active_private_clan_fireteam_count(auth) async

Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
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/clan.py
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
async def get_active_private_clan_fireteam_count(self, auth: "AuthData") -> int:
    """
    Gets a count of all active non-public fireteams for the specified clan. Maximum value returned is 25.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    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_active_private_clan_fireteam_count(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_admins_and_founder_of_group(currentpage, auth=None) async

Get the list of members in a given group who are of admin level or higher.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
async def get_admins_and_founder_of_group(
    self, currentpage: int, auth: Optional["AuthData"] = None
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group who are of admin level or higher.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_admins_and_founder_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_available_clan_fireteams(activity_type, date_range, page, platform, public_only, slot_filter, auth, exclude_immediate, lang_filter) async

Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
activity_type int

The activity type to filter by.

required
date_range Union[FireteamDateRange, int]

The date range to grab available fireteams.

required
page int

Zero based page

required
platform Union[FireteamPlatform, int]

The platform filter.

required
public_only Union[FireteamPublicSearchOption, int]

Determines public/private filtering.

required
slot_filter Union[FireteamSlotSearch, int]

Filters based on available slots

required
auth AuthData

Authentication information.

required
exclude_immediate bool

If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamSummary

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

Source code in src/bungio/models/mixins/clan.py
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
509
510
511
512
513
514
async def get_available_clan_fireteams(
    self,
    activity_type: int,
    date_range: Union["FireteamDateRange", int],
    page: int,
    platform: Union["FireteamPlatform", int],
    public_only: Union["FireteamPublicSearchOption", int],
    slot_filter: Union["FireteamSlotSearch", int],
    auth: "AuthData",
    exclude_immediate: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamSummary":
    """
    Gets a listing of all of this clan's fireteams that are have available slots. Caller is not checked for join criteria so caching is maximized.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        activity_type: The activity type to filter by.
        date_range: The date range to grab available fireteams.
        page: Zero based page
        platform: The platform filter.
        public_only: Determines public/private filtering.
        slot_filter: Filters based on available slots
        auth: Authentication information.
        exclude_immediate: If you wish the result to exclude immediate fireteams, set this to true. Immediate-only can be forced using the dateRange enum.
        lang_filter: An optional language filter.

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

    return await self._client.api.get_available_clan_fireteams(
        activity_type=activity_type,
        date_range=date_range,
        group_id=self._fuzzy_getattr("group_id"),
        page=page,
        platform=platform,
        public_only=public_only,
        slot_filter=slot_filter,
        auth=auth,
        exclude_immediate=exclude_immediate,
        lang_filter=lang_filter,
    )

get_banned_members_of_group(currentpage, auth) async

Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupBan

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

Source code in src/bungio/models/mixins/clan.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
async def get_banned_members_of_group(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupBan":
    """
    Get the list of banned members in a given group. Only accessible to group Admins and above. Not applicable to all groups. Check group features.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_banned_members_of_group(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_aggregate_stats(modes, auth=None) async

Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

Parameters:

Name Type Description Default
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
auth Optional[AuthData]

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

None

Returns:

Type Description
list[DestinyClanAggregateStat]

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

Source code in src/bungio/models/mixins/clan.py
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
async def get_clan_aggregate_stats(
    self, modes: str, auth: Optional["AuthData"] = None
) -> list["DestinyClanAggregateStat"]:
    """
    Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    Args:
        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.
        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_clan_aggregate_stats(
        group_id=self._fuzzy_getattr("group_id"), modes=modes, auth=auth
    )

get_clan_fireteam(fireteam_id, auth) async

Gets a specific fireteam.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
fireteam_id int

The unique id of the fireteam.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
FireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
async def get_clan_fireteam(self, fireteam_id: int, auth: "AuthData") -> "FireteamResponse":
    """
    Gets a specific fireteam.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        fireteam_id: The unique id of the fireteam.
        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_clan_fireteam(
        fireteam_id=fireteam_id, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

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/clan.py
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
async def get_clan_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 is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

    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_clan_leaderboards(
        group_id=self._fuzzy_getattr("group_id"), maxtop=maxtop, modes=modes, statid=statid, auth=auth
    )

get_clan_weekly_reward_state(auth=None) async

Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

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
DestinyMilestone

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

Source code in src/bungio/models/mixins/clan.py
401
402
403
404
405
406
407
408
409
410
411
412
async def get_clan_weekly_reward_state(self, auth: Optional["AuthData"] = None) -> "DestinyMilestone":
    """
    Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.

    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_clan_weekly_reward_state(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group(auth=None) async

Get information about a specific group of the given ID.

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
GroupResponse

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

Source code in src/bungio/models/mixins/clan.py
46
47
48
49
50
51
52
53
54
55
56
57
async def get_group(self, auth: Optional["AuthData"] = None) -> "GroupResponse":
    """
    Get information about a specific group of the given ID.

    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_group(group_id=self._fuzzy_getattr("group_id"), auth=auth)

get_group_edit_history(currentpage, auth) async

Get the list of edits made to a given group. Only accessible to group Admins and above.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 entries.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupEditHistory

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

Source code in src/bungio/models/mixins/clan.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
async def get_group_edit_history(self, currentpage: int, auth: "AuthData") -> "SearchResultOfGroupEditHistory":
    """
    Get the list of edits made to a given group. Only accessible to group Admins and above.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 entries.
        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_group_edit_history(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_group_optional_conversations(auth=None) async

Gets a list of available optional conversation channels and their settings.

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
list[GroupOptionalConversation]

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

Source code in src/bungio/models/mixins/clan.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
async def get_group_optional_conversations(
    self, auth: Optional["AuthData"] = None
) -> list["GroupOptionalConversation"]:
    """
    Gets a list of available optional conversation channels and their settings.

    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_group_optional_conversations(
        group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_invited_individuals(currentpage, auth) async

Get the list of users who have been invited into the group.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
async def get_invited_individuals(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who have been invited into the group.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_invited_individuals(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

get_members_of_group(currentpage, member_type, name_search, auth=None) async

Get the list of members in a given group.

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
member_type Union[RuntimeGroupMemberType, int]

Filter out other member types. Use None for all members.

required
name_search str

The name fragment upon which a search should be executed for members with matching display or unique names.

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
SearchResultOfGroupMember

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

Source code in src/bungio/models/mixins/clan.py
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
async def get_members_of_group(
    self,
    currentpage: int,
    member_type: Union["RuntimeGroupMemberType", int],
    name_search: str,
    auth: Optional["AuthData"] = None,
) -> "SearchResultOfGroupMember":
    """
    Get the list of members in a given group.

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        member_type: Filter out other member types. Use None for all members.
        name_search: The name fragment upon which a search should be executed for members with matching display or unique names.
        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_members_of_group(
        currentpage=currentpage,
        group_id=self._fuzzy_getattr("group_id"),
        member_type=member_type,
        name_search=name_search,
        auth=auth,
    )

get_my_clan_fireteams(include_closed, page, platform, auth, group_filter, lang_filter) async

Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

Requires Authentication.

Required oauth2 scopes: ReadGroups

Parameters:

Name Type Description Default
include_closed bool

If true, return fireteams that have been closed.

required
page int

Deprecated parameter, ignored.

required
platform Union[FireteamPlatform, int]

The platform filter.

required
auth AuthData

Authentication information.

required
group_filter bool

If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.

required
lang_filter str

An optional language filter.

required

Returns:

Type Description
SearchResultOfFireteamResponse

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

Source code in src/bungio/models/mixins/clan.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
async def get_my_clan_fireteams(
    self,
    include_closed: bool,
    page: int,
    platform: Union["FireteamPlatform", int],
    auth: "AuthData",
    group_filter: bool,
    lang_filter: str,
) -> "SearchResultOfFireteamResponse":
    """
    Gets a listing of all fireteams that caller is an applicant, a member, or an alternate of.

    Warning: Requires Authentication.
        Required oauth2 scopes: ReadGroups

    Args:
        include_closed: If true, return fireteams that have been closed.
        page: Deprecated parameter, ignored.
        platform: The platform filter.
        auth: Authentication information.
        group_filter: If true, filter by clan. Otherwise, ignore the clan and show all of the user's fireteams.
        lang_filter: An optional language filter.

    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_my_clan_fireteams(
        group_id=self._fuzzy_getattr("group_id"),
        include_closed=include_closed,
        page=page,
        platform=platform,
        auth=auth,
        group_filter=group_filter,
        lang_filter=lang_filter,
    )

get_pending_memberships(currentpage, auth) async

Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

Requires Authentication.

Required oauth2 scopes: AdminGroups

Parameters:

Name Type Description Default
currentpage int

Page number (starting with 1). Each page has a fixed size of 50 items per page.

required
auth AuthData

Authentication information.

required

Returns:

Type Description
SearchResultOfGroupMemberApplication

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

Source code in src/bungio/models/mixins/clan.py
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
async def get_pending_memberships(
    self, currentpage: int, auth: "AuthData"
) -> "SearchResultOfGroupMemberApplication":
    """
    Get the list of users who are awaiting a decision on their application to join a given group. Modified to include application info.

    Warning: Requires Authentication.
        Required oauth2 scopes: AdminGroups

    Args:
        currentpage: Page number (starting with 1). Each page has a fixed size of 50 items per page.
        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_pending_memberships(
        currentpage=currentpage, group_id=self._fuzzy_getattr("group_id"), auth=auth
    )

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupV2ClanInfo

Bases: BaseModel

This contract contains clan-specific group information. It does not include any investment data.

None Attributes: clan_banner_data: No description given by bungie. clan_callsign: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
315
316
317
318
319
320
321
322
323
324
325
326
327
@custom_define()
class GroupV2ClanInfo(BaseModel):
    """
    This contract contains clan-specific group information. It does not include any investment data.

    None
    Attributes:
        clan_banner_data: _No description given by bungie._
        clan_callsign: _No description given by bungie._
    """

    clan_banner_data: "ClanBanner" = custom_field()
    clan_callsign: str = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupV2ClanInfoAndInvestment

Bases: BaseModel

The same as GroupV2ClanInfo, but includes any investment data.

None Attributes: clan_banner_data: No description given by bungie. clan_callsign: No description given by bungie. d2_clan_progressions: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
@custom_define()
class GroupV2ClanInfoAndInvestment(BaseModel):
    """
    The same as GroupV2ClanInfo, but includes any investment data.

    None
    Attributes:
        clan_banner_data: _No description given by bungie._
        clan_callsign: _No description given by bungie._
        d2_clan_progressions: _No description given by bungie._
    """

    clan_banner_data: "ClanBanner" = custom_field()
    clan_callsign: str = custom_field()
    d2_clan_progressions: dict[int, "DestinyProgression"] = custom_field(
        metadata={"type": """dict[int, DestinyProgression]"""}
    )

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

GroupsForMemberFilter

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
907
908
909
910
911
912
913
914
915
916
917
class GroupsForMemberFilter(BaseEnum):
    """
    _No description given by bungie._
    """

    ALL = 0
    """_No description given by bungie._ """
    FOUNDED = 1
    """_No description given by bungie._ """
    NON_FOUNDED = 2
    """_No description given by bungie._ """

ALL = 0 class-attribute instance-attribute

No description given by bungie.

FOUNDED = 1 class-attribute instance-attribute

No description given by bungie.

NON_FOUNDED = 2 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

HostGuidedGamesPermissionLevel

Bases: BaseEnum

Used for setting the guided game permission level override (admins and founders can always host guided games).

Source code in src/bungio/models/bungie/groupsv2.py
283
284
285
286
287
288
289
290
291
292
293
class HostGuidedGamesPermissionLevel(BaseEnum):
    """
    Used for setting the guided game permission level override (admins and founders can always host guided games).
    """

    NONE = 0
    """_No description given by bungie._ """
    BEGINNER = 1
    """_No description given by bungie._ """
    MEMBER = 2
    """_No description given by bungie._ """

BEGINNER = 1 class-attribute instance-attribute

No description given by bungie.

MEMBER = 2 class-attribute instance-attribute

No description given by bungie.

NONE = 0 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

MembershipOption

Bases: BaseEnum

No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
201
202
203
204
205
206
207
208
209
210
211
class MembershipOption(BaseEnum):
    """
    _No description given by bungie._
    """

    REVIEWED = 0
    """_No description given by bungie._ """
    OPEN = 1
    """_No description given by bungie._ """
    CLOSED = 2
    """_No description given by bungie._ """

CLOSED = 2 class-attribute instance-attribute

No description given by bungie.

OPEN = 1 class-attribute instance-attribute

No description given by bungie.

REVIEWED = 0 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value

OverwrittenGroupQuery

Bases: BaseModel

NOTE: GroupQuery, as of Destiny 2, has essentially two totally different and incompatible "modes". If you are querying for a group, you can pass any of the properties below. If you are querying for a Clan, you MUST NOT pass any of the following properties (they must be null or undefined in your request, not just empty string/default values): - groupMemberCountFilter - localeFilter - tagText If you pass these, you will get a useless InvalidParameters error.

None Attributes: creation_date: No description given by bungie. current_page: No description given by bungie. group_member_count_filter: No description given by bungie. group_type: No description given by bungie. items_per_page: No description given by bungie. locale_filter: No description given by bungie. name: No description given by bungie. request_continuation_token: No description given by bungie. sort_by: No description given by bungie. tag_text: No description given by bungie.

Source code in src/bungio/models/bungie/groupsv2.py
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
@custom_define()
class OverwrittenGroupQuery(BaseModel):
    """
    NOTE: GroupQuery, as of Destiny 2, has essentially two totally different and incompatible "modes". If you are querying for a group, you can pass any of the properties below. If you are querying for a Clan, you MUST NOT pass any of the following properties (they must be null or undefined in your request, not just empty string/default values): - groupMemberCountFilter - localeFilter - tagText If you pass these, you will get a useless InvalidParameters error.

    None
    Attributes:
        creation_date: _No description given by bungie._
        current_page: _No description given by bungie._
        group_member_count_filter: _No description given by bungie._
        group_type: _No description given by bungie._
        items_per_page: _No description given by bungie._
        locale_filter: _No description given by bungie._
        name: _No description given by bungie._
        request_continuation_token: _No description given by bungie._
        sort_by: _No description given by bungie._
        tag_text: _No description given by bungie._
    """

    creation_date: Union["GroupDateRange", int] = custom_field(converter=enum_converter("GroupDateRange"))
    current_page: int = custom_field()
    group_member_count_filter: Union["GroupMemberCountFilter", int] = custom_field(
        converter=enum_converter("GroupMemberCountFilter")
    )
    group_type: Union["GroupType", int] = custom_field(converter=enum_converter("GroupType"))
    items_per_page: int = custom_field()
    locale_filter: str = custom_field()
    name: str = custom_field()
    request_continuation_token: str = custom_field()
    sort_by: Union["GroupSortBy", int] = custom_field(converter=enum_converter("GroupSortBy"))
    tag_text: str = custom_field()

_convert_to_bungie_case(string) cached staticmethod

Convert a string to how it is represented by bungie: my_name_string -> myNameString

Parameters:

Name Type Description Default
string str

The og string

required

Returns:

Type Description
str

The bungie string

Source code in src/bungio/models/base.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@staticmethod
@functools.cache
def _convert_to_bungie_case(string: str) -> str:
    """
    Convert a string to how it is represented by bungie: my_name_string -> myNameString

    Args:
        string: The og string

    Returns:
        The bungie string
    """

    if "_" not in string:
        return string
    else:
        split = string.split("_")
        return "".join((split[0], *(s.capitalize() for s in split[1:])))

fetch_manifest_information(include=None, exclude=None, _cache=None) async

Fill the model in-place with information from the manifest.

Example

Fill every attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information()
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is not None

Fill only some attribute

1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is not None
assert model.manifest_reference_id is None
1
2
3
4
model: DestinyHistoricalStatsActivity
await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
assert model.manifest_director_activity_hash is None
assert model.manifest_reference_id is not None

Parameters:

Name Type Description Default
include Optional[list[str]]

A list of attributes you want to include. Excludes everything not mentioned

None
exclude Optional[list[str]]

A list of attributes you want to exclude. Includes everything not mentioned

None
Source code in src/bungio/models/base.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
async def fetch_manifest_information(
    self, include: Optional[list[str]] = None, exclude: Optional[list[str]] = None, _cache: Optional[dict] = None
):
    """
    Fill the model in-place with information from the manifest.

    Example:
        Fill every attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information()
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is not None
        ```

        Fill only some attribute
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(include=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is not None
        assert model.manifest_reference_id is None
        ```
        ```py
        model: DestinyHistoricalStatsActivity
        await model.fetch_manifest_information(exclude=["manifest_director_activity_hash"])
        assert model.manifest_director_activity_hash is None
        assert model.manifest_reference_id is not None
        ```

    Args:
        include: A list of attributes you want to include. Excludes everything not mentioned
        exclude:  A list of attributes you want to exclude. Includes everything not mentioned
    """

    if not isinstance(self._client.manifest_storage, AsyncEngine):
        raise ValueError("Client.manifest_storage must be set up to use this")

    if not _cache:
        _cache = {}

    class_definition = attrs.fields_dict(type(self))  # noqa

    # loop through the class attributes
    for name in self.__dir__():
        if name.startswith("__"):
            continue

        if include and name not in include:
            continue
        if exclude and name in exclude:
            continue

        # manifest entries
        if name.startswith("manifest_"):
            striped_name = name.removeprefix("manifest_")
            value = getattr(self, striped_name)

            if value is MISSING:
                return

            # check the cache to avoid infinite recursion
            if cached := _cache.get(value, None):
                manifest_value = cached

            else:
                attr_definition = class_definition[name]
                manifest_class_name = attr_definition.type.__str__().removesuffix("')]").split("'")[-1]
                manifest_value = await self._client.manifest.fetch(
                    manifest_class=getattr(models, manifest_class_name), value=value
                )

                _cache[value] = manifest_value

                # check if the model has manifest models itself
                if manifest_value:
                    await manifest_value.fetch_manifest_information(_cache=_cache)

            setattr(self, name, manifest_value)

        # sub models which may have manifest entries too
        elif hasattr((value := getattr(self, name)), "fetch_manifest_information"):
            await value.fetch_manifest_information(_cache=_cache)

from_dict(data, client, recursive=False, *args, **kwargs) async classmethod

Convert json data to this model

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required
recursive bool

If this was called recursively

False

Returns:

Type Description
BaseModel

The model

Source code in src/bungio/models/base.py
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
@classmethod
async def from_dict(cls, data: dict, client: "Client", recursive: bool = False, *args, **kwargs) -> BaseModel:
    """
    Convert json data to this model

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj
        recursive: If this was called recursively

    Returns:
        The model
    """

    if isinstance(data, cls):
        return data

    if not isinstance(data, dict):
        raise ValueError

    if "Response" in data:
        data = data["Response"]

    # also use the kwargs as data
    data = kwargs | data
    data = cls.process_dict(data=data, client=client)

    prepared = {}
    for name, field in attrs.fields_dict(cls).items():
        if field.init and name != "_client":
            default = field.default

            # get the value we want. This also skips the manifest_... entries since they have no value and a default
            bungie_name = cls._convert_to_bungie_case(name)
            value = data.get(bungie_name, attrs.NOTHING)

            # bungie is veeery inconsistent and sometimes like to start their params with an upper case for some reason
            # only sometimes tho :)
            if value is attrs.NOTHING:
                value = data.get(f"{bungie_name[0].capitalize()}{bungie_name[1:]}", attrs.NOTHING)

            # sadly bungie sometimes does not return info without marking that fact in the api specs
            if value is attrs.NOTHING and default is attrs.NOTHING:
                default = MISSING

            if value is attrs.NOTHING:
                value = default

            else:
                value = await cls._convert_to_type(
                    field_type=field.type, field_metadata=field.metadata, value=value, client=client
                )

            # set the attr
            prepared[name] = value

    res = cls(**prepared)  # noqa

    # fill the manifest information
    if not recursive and res._client.always_return_manifest_information:
        await res.fetch_manifest_information()

    return res

process_dict(data, client, *args, **kwargs) staticmethod

Model specific cleanup

Parameters:

Name Type Description Default
data dict

The json representation of the model, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
dict

Clean json

Source code in src/bungio/models/base.py
260
261
262
263
264
265
266
267
268
269
270
271
272
@staticmethod
def process_dict(data: dict, client: "Client", *args, **kwargs) -> dict:
    """
    Model specific cleanup

    Args:
        data: The json representation of the model, usually received by bungie
        client: The client obj

    Returns:
        Clean json
    """
    return data

to_dict(_return_to_bungie_case=True)

Convert the model into a dict representation bungie accepts

Returns:

Type Description
dict

A dict which can be sent to bungie

Source code in src/bungio/models/base.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def to_dict(self, _return_to_bungie_case: bool = True) -> dict:
    """
    Convert the model into a dict representation bungie accepts

    Returns:
        A dict which can be sent to bungie
    """

    result = {}

    for name, field in attrs.fields_dict(type(self)).items():
        if name.startswith("_") or name.startswith("manifest_"):
            continue

        value = getattr(self, name)
        if _return_to_bungie_case:
            name = self._convert_to_bungie_case(name)

        if inspect.ismethod(value) or inspect.isfunction(value):
            continue

        elif isinstance(value, dict):
            raise NotImplementedError(
                "Nested dict conversion is not currently implemented, since bungie does never require that info"
            )

        elif isinstance(value, list):
            list_results = []
            for entry in value:
                if hasattr(entry, "to_dict"):
                    list_results.append(entry.to_dict())
                else:
                    list_results.append(entry)

            result[name] = list_results

        else:
            if hasattr(value, "to_dict"):
                result[name] = value.to_dict()
            else:
                # convert to string if they are int64
                if field.metadata.get("int64", None) is True:
                    value = str(value)

                result[name] = value

    return result

RuntimeGroupMemberType

Bases: BaseEnum

The member levels used by all V2 Groups API. Individual group types use their own mappings in their native storage (general uses BnetDbGroupMemberType and D2 clans use ClanMemberLevel), but they are all translated to this in the runtime api. These runtime values should NEVER be stored anywhere, so the values can be changed as necessary.

Source code in src/bungio/models/bungie/groupsv2.py
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
class RuntimeGroupMemberType(BaseEnum):
    """
    The member levels used by all V2 Groups API. Individual group types use their own mappings in their native storage (general uses BnetDbGroupMemberType and D2 clans use ClanMemberLevel), but they are all translated to this in the runtime api. These runtime values should NEVER be stored anywhere, so the values can be changed as necessary.
    """

    NONE = 0
    """_No description given by bungie._ """
    BEGINNER = 1
    """_No description given by bungie._ """
    MEMBER = 2
    """_No description given by bungie._ """
    ADMIN = 3
    """_No description given by bungie._ """
    ACTING_FOUNDER = 4
    """_No description given by bungie._ """
    FOUNDER = 5
    """_No description given by bungie._ """

ACTING_FOUNDER = 4 class-attribute instance-attribute

No description given by bungie.

ADMIN = 3 class-attribute instance-attribute

No description given by bungie.

BEGINNER = 1 class-attribute instance-attribute

No description given by bungie.

FOUNDER = 5 class-attribute instance-attribute

No description given by bungie.

MEMBER = 2 class-attribute instance-attribute

No description given by bungie.

NONE = 0 class-attribute instance-attribute

No description given by bungie.

display_name property

Format the instance name so that it looks like in-game.

Example

name="HAND_CANNON" -> "Hand Cannon"

Returns:

Type Description
str

The formatted name

from_dict(data, client, *args, **kwargs) async classmethod

Convert data to this enum

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
EnumMixin | UnknownEnumValue

The enum

Source code in src/bungio/models/base.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@classmethod
async def from_dict(cls, data: int | str, client: "Client", *args, **kwargs) -> EnumMixin | UnknownEnumValue:
    """
    Convert data to this enum

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        The enum
    """

    if isinstance(data, cls):
        return data

    data = cls.process_dict(data=data, client=client)

    # catch unknown values
    try:
        return cls(data)
    except ValueError:
        return UnknownEnumValue(value=data, enum=cls)

process_dict(data, client, *args, **kwargs) staticmethod

Enum specific cleanup

Parameters:

Name Type Description Default
data int | str

The int / str representation of the enum, usually received by bungie

required
client 'Client'

The client obj

required

Returns:

Type Description
int | str

Clean int / str representation

Source code in src/bungio/models/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
@staticmethod
def process_dict(data: int | str, client: "Client", *args, **kwargs) -> int | str:
    """
    Enum specific cleanup

    Args:
        data: The int / str representation of the enum, usually received by bungie
        client: The client obj

    Returns:
        Clean int / str representation
    """
    return data

to_dict()

Convert the enum into a representation bungie accepts

Returns:

Type Description
Any

The value which can be sent to bungie

Source code in src/bungio/models/base.py
172
173
174
175
176
177
178
179
180
def to_dict(self) -> Any:
    """
    Convert the enum into a representation bungie accepts

    Returns:
        The value which can be sent to bungie
    """

    return self.value