# generated by update to not change manually
import dataclasses as dt
import typing as t
from enum import Enum
from bungieapi.json import to_json
[docs]class ApplicationScopes(Enum):
READ_BASIC_USER_PROFILE = 1 # Read basic user profile information such as the user's handle, avatar icon, etc.
READ_GROUPS = 2 # Read Group/Clan Forums, Wall, and Members for groups and clans that the user has joined.
WRITE_GROUPS = 4 # Write Group/Clan Forums, Wall, and Members for groups and clans that the user has joined.
ADMIN_GROUPS = 8 # Administer Group/Clan Forums, Wall, and Members for groups and clans that the user is a founder or an administrator.
BNET_WRITE = 16 # Create new groups, clans, and forum posts, along with other actions that are reserved for Bungie.net elevated scope: not meant to be used by third party applications.
MOVE_EQUIP_DESTINY_ITEMS = 32 # Move or equip Destiny items
READ_DESTINY_INVENTORY_AND_VAULT = 64 # Read Destiny 1 Inventory and Vault contents. For Destiny 2, this scope is needed to read anything regarded as private. This is the only scope a Destiny 2 app needs for read operations against Destiny 2 data such as inventory, vault, currency, vendors, milestones, progression, etc.
READ_USER_DATA = 128 # Read user data such as who they are web notifications, clan/group memberships, recent activity, muted users.
EDIT_USER_DATA = 256 # Edit user data such as preferred language, status, motto, avatar selection and theme.
READ_DESTINY_VENDORS_AND_ADVISORS = 512 # Access vendor and advisor data specific to a user. OBSOLETE. This scope is only used on the Destiny 1 API.
READ_AND_APPLY_TOKENS = (
1024 # Read offer history and claim and apply tokens for the user.
)
ADVANCED_WRITE_ACTIONS = 2048 # Can perform actions that will result in a prompt to the user via the Destiny app.
PARTNER_OFFER_GRANT = (
4096 # Can user the partner offer api to claim rewards defined for a partner
)
DESTINY_UNLOCK_VALUE_QUERY = 8192 # Allows an app to query sensitive information like unlock flags and values not available through normal methods.
USER_PII_READ = 16384 # Allows an app to query sensitive user PII, most notably email information.
[docs]@dt.dataclass(frozen=True)
class ApiUsage:
api_calls: t.Optional[
t.Sequence["Series"]
] = None # Counts for on API calls made for the time range.
throttled_requests: t.Optional[
t.Sequence["Series"]
] = None # Instances of blocked requests or requests that crossed the warn threshold during the time range.
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"apiCalls": to_json(self.api_calls),
"throttledRequests": to_json(self.throttled_requests),
}
[docs]@dt.dataclass(frozen=True)
class Series:
datapoints: t.Optional[
t.Sequence["Datapoint"]
] = None # Collection of samples with time and value.
target: t.Optional[str] = None # Target to which to datapoints apply.
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"datapoints": to_json(self.datapoints),
"target": to_json(self.target),
}
[docs]@dt.dataclass(frozen=True)
class Datapoint:
count: t.Optional[float] = None # Count associated with timestamp
time: t.Optional[str] = None # Timestamp for the related count.
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"time": to_json(self.time),
"count": to_json(self.count),
}
[docs]@dt.dataclass(frozen=True)
class Application:
application_id: t.Optional[int] = None # Unique ID assigned to the application
creation_date: t.Optional[
str
] = None # Date the application was first added to our database.
first_published: t.Optional[
str
] = None # Date the first time the application status entered the 'Public' status.
link: t.Optional[
str
] = None # Link to website for the application where a user can learn more about the app.
name: t.Optional[str] = None # Name of the application
origin: t.Optional[
str
] = None # Value of the Origin header sent in requests generated by this application.
override_authorize_view_name: t.Optional[
str
] = None # An optional override for the Authorize view name.
redirect_url: t.Optional[
str
] = None # URL used to pass the user's authorization code to the application
scope: t.Optional[int] = None # Permissions the application needs to work
status: t.Optional["ApplicationStatus"] = None # Current status of the application.
status_changed: t.Optional[str] = None # Date the application status last changed.
team: t.Optional[
t.Sequence["ApplicationDeveloper"]
] = None # List of team members who manage this application on Bungie.net. Will always consist of at least the application owner.
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"applicationId": to_json(self.application_id),
"name": to_json(self.name),
"redirectUrl": to_json(self.redirect_url),
"link": to_json(self.link),
"scope": to_json(self.scope),
"origin": to_json(self.origin),
"status": to_json(self.status),
"creationDate": to_json(self.creation_date),
"statusChanged": to_json(self.status_changed),
"firstPublished": to_json(self.first_published),
"team": to_json(self.team),
"overrideAuthorizeViewName": to_json(self.override_authorize_view_name),
}
[docs]class ApplicationStatus(Enum):
NONE = 0 # No value assigned
PRIVATE = 1 # Application exists and works but will not appear in any public catalog. New applications start in this state, test applications will remain in this state.
PUBLIC = 2 # Active applications that can appear in an catalog.
DISABLED = 3 # Application disabled by the owner. All authorizations will be treated as terminated while in this state. Owner can move back to private or public state.
BLOCKED = 4 # Application has been blocked by Bungie. It cannot be transitioned out of this state by the owner. Authorizations are terminated when an application is in this state.
[docs]@dt.dataclass(frozen=True)
class ApplicationDeveloper:
api_eula_version: t.Optional[int] = None
role: t.Optional["DeveloperRole"] = None
user: t.Optional["UserInfoCard"] = None
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"role": to_json(self.role),
"apiEulaVersion": to_json(self.api_eula_version),
"user": to_json(self.user),
}
[docs]class DeveloperRole(Enum):
NONE = 0
OWNER = 1
TEAM_MEMBER = 2
# imported at the end to do not case circular imports for type annotations
from bungieapi.generated.components.schemas.user import UserInfoCard # noqa: E402