Skip to content

Commit

Permalink
feat: final shape API update
Browse files Browse the repository at this point in the history
  • Loading branch information
Kigstn committed Jul 13, 2024
1 parent 4ca05f0 commit 60413be
Show file tree
Hide file tree
Showing 112 changed files with 6,558 additions and 2,103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,14 @@
- DestinyObjectiveDefinition
- DestinyObjectivePerkEntryDefinition
- DestinySandboxPerkDefinition
- DestinyTalentNodeStepGroups
- DestinyTalentNodeStepWeaponPerformances
- DestinyTalentNodeStepImpactEffects
- DestinyTalentNodeStepGuardianAttributes
- DestinyTalentNodeStepLightAbilities
- DestinyTalentNodeStepDamageTypes
- DestinyDamageTypeDefinition
- DestinyObjectiveStatEntryDefinition
- DestinyItemInvestmentStatDefinition
- DestinyLocationDefinition
- DestinyLocationReleaseDefinition
- DestinyActivityUnlockStringDefinition
- DestinyActivityRequirementsBlock
- DestinyActivityRequirementLabel
- DestinyActivityPlaylistItemDefinition
- DestinyActivityModeDefinition
- DestinyActivityMatchmakingBlockDefinition
Expand Down Expand Up @@ -121,6 +117,12 @@
- DestinyTalentNodeDefinition
- DestinyNodeActivationRequirement
- DestinyNodeStepDefinition
- DestinyTalentNodeStepGroups
- DestinyTalentNodeStepWeaponPerformances
- DestinyTalentNodeStepImpactEffects
- DestinyTalentNodeStepGuardianAttributes
- DestinyTalentNodeStepLightAbilities
- DestinyTalentNodeStepDamageTypes
- DestinyNodeSocketReplaceResponse
- DestinyTalentNodeExclusiveSetDefinition
- DestinyTalentExclusiveGroup
Expand Down
18 changes: 18 additions & 0 deletions docs/src/API Reference/Models/Bungie API Models/destiny/destiny.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@
- DestinyVendorItemState
- DestinyEquipItemResults
- DestinyEquipItemResult
- FireteamFinderCodeOptionType
- FireteamFinderOptionAvailability
- FireteamFinderOptionVisibility
- FireteamFinderOptionControlType
- FireteamFinderOptionSearchFilterType
- FireteamFinderOptionDisplayFormat
- FireteamFinderOptionValueProviderType
- FireteamFinderOptionValueFlags
- FireteamFinderLabelFieldType
::: bungio.models.bungie.destiny
options:
members:
Expand Down Expand Up @@ -161,3 +170,12 @@
- DestinyVendorItemState
- DestinyEquipItemResults
- DestinyEquipItemResult
- FireteamFinderCodeOptionType
- FireteamFinderOptionAvailability
- FireteamFinderOptionVisibility
- FireteamFinderOptionControlType
- FireteamFinderOptionSearchFilterType
- FireteamFinderOptionDisplayFormat
- FireteamFinderOptionValueProviderType
- FireteamFinderOptionValueFlags
- FireteamFinderLabelFieldType
40 changes: 21 additions & 19 deletions generate_api_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def generate_mixins(folder_path: str):
with open(file_path, "w", encoding="utf-8") as file:
file.write(text)

os.system(f"""black "{base_path}\"""")
os.system(f"""ruff format "{base_path}\"""")
os.system(f"""git add "{base_path}\"""")


Expand Down Expand Up @@ -158,7 +158,7 @@ class {name}(ClientMixin):
relative_path = os.path.relpath(file_path, ROOT_DIR).replace(".py", "").replace(os.sep, ".")
names[name] = relative_path

actual_docs_path = os.path.join(ROOT_DIR, f"{docs_path}/{capital_case_to_snake_case(topic)}.md")
actual_docs_path = os.path.join(ROOT_DIR, "..", f"{docs_path}/{capital_case_to_snake_case(topic)}.md")
if create_raw_http:
docs_name = f"{topic} HTTP Routes"
else:
Expand Down Expand Up @@ -227,8 +227,8 @@ class AllRouteInterfacesOverwrites({", ".join(overwrite_names)}):
with open(overwrite_path, "w", encoding="utf-8") as file:
file.write(overwrite_init_text)

os.system(f"""autoflake --ignore-init-module-imports --remove-all-unused-imports -i -r "{base_path}\"""")
os.system(f"""black "{base_path}\"""")
os.system(f"""ruff check "{base_path}\"""")
os.system(f"""ruff format "{base_path}\"""")
os.system(f"""git add "{base_path}\"""")


Expand Down Expand Up @@ -263,19 +263,21 @@ async def {func_name}(self"""
if "$ref" in schema_data:
schema_name = schema_data["$ref"]
schema_name = schema_name.split("/")[-1]
schema_data = full_data["components"]["schemas"][schema_name]["properties"]

for name, value in schema_data.items():
arg_type = convert_to_typing(value).name
body.append(
{
"name": capital_case_to_snake_case(name),
"og_name": name,
"description": clean_desc(value),
"type": arg_type,
"append": "",
}
)
schema_data = full_data["components"]["schemas"][schema_name]

if "properties" in schema_data:
schema_data = schema_data["properties"]
for name, value in schema_data.items():
arg_type = convert_to_typing(value).name
body.append(
{
"name": capital_case_to_snake_case(name),
"og_name": name,
"description": clean_desc(value),
"type": arg_type,
"append": "",
}
)

else:
arg_type = convert_to_typing(schema_data).name
Expand Down Expand Up @@ -936,8 +938,8 @@ def generate_models(api_schema: dict):
with open(init_path, "w", encoding="utf-8") as file:
file.write("")

os.system(f"""autoflake --ignore-init-module-imports --remove-all-unused-imports -i -r "{base_path}\"""")
os.system(f"""black "{base_path}\"""")
os.system(f"""ruff check "{base_path}\"""")
os.system(f"""ruff format "{base_path}\"""")
os.system(f"""git add "{base_path}\"""")


Expand Down
16 changes: 9 additions & 7 deletions src/bungio/api/bungie/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from bungio.api.bungie.app import AppRouteInterface
from bungio.api.bungie.community_content import CommunityContentRouteInterface
from bungio.api.bungie.user import UserRouteInterface
from bungio.api.bungie.content import ContentRouteInterface
from bungio.api.bungie.fireteam import FireteamRouteInterface
from bungio.api.bungie.forum import ForumRouteInterface
from bungio.api.bungie.get_available_locales import GetAvailableLocalesRouteInterface
from bungio.api.bungie.global_alerts import GlobalAlertsRouteInterface
from bungio.api.bungie.group_v2 import GroupV2RouteInterface
from bungio.api.bungie.settings import SettingsRouteInterface
from bungio.api.bungie.social import SocialRouteInterface
from bungio.api.bungie.tokens import TokensRouteInterface
from bungio.api.bungie.community_content import CommunityContentRouteInterface
from bungio.api.bungie.trending import TrendingRouteInterface
from bungio.api.bungie.user import UserRouteInterface
from bungio.api.bungie.fireteam import FireteamRouteInterface
from bungio.api.bungie.fireteam_finder import FireteamFinderRouteInterface
from bungio.api.bungie.social import SocialRouteInterface
from bungio.api.bungie.get_available_locales import GetAvailableLocalesRouteInterface
from bungio.api.bungie.settings import SettingsRouteInterface
from bungio.api.bungie.user_system_overrides import UserSystemOverridesRouteInterface
from bungio.api.bungie.global_alerts import GlobalAlertsRouteInterface


class AllRouteInterfaces(
Expand All @@ -24,6 +25,7 @@ class AllRouteInterfaces(
CommunityContentRouteInterface,
TrendingRouteInterface,
FireteamRouteInterface,
FireteamFinderRouteInterface,
SocialRouteInterface,
GetAvailableLocalesRouteInterface,
SettingsRouteInterface,
Expand Down
6 changes: 4 additions & 2 deletions src/bungio/api/bungie/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
from datetime import datetime
from typing import Optional

from bungio.models import ApiUsage, Application
from bungio.models.auth import AuthData
from bungio.models.base import ClientMixin, custom_define
from bungio.models.auth import AuthData

from bungio.models import Application
from bungio.models import ApiUsage


@custom_define()
Expand Down
11 changes: 5 additions & 6 deletions src/bungio/api/bungie/community_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

from typing import Optional, Union

from bungio.models import (
CommunityContentSortMode,
ForumTopicsCategoryFiltersEnum,
PostSearchResponse,
)
from bungio.models.auth import AuthData
from bungio.models.base import ClientMixin, custom_define
from bungio.models.auth import AuthData

from bungio.models import CommunityContentSortMode
from bungio.models import ForumTopicsCategoryFiltersEnum
from bungio.models import PostSearchResponse


@custom_define()
Expand Down
17 changes: 8 additions & 9 deletions src/bungio/api/bungie/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
# This file is generated automatically by `generate_api_schema.py` and will be overwritten
# Instead, change functions / models by subclassing them in the `./overwrites/` folder. They will be used instead.

from typing import Any, Optional

from bungio.models import (
ContentItemPublicContract,
ContentTypeDescription,
NewsArticleRssResponse,
SearchResultOfContentItemPublicContract,
)
from bungio.models.auth import AuthData
from typing import Optional, Any

from bungio.models.base import ClientMixin, custom_define
from bungio.models.auth import AuthData

from bungio.models import ContentItemPublicContract
from bungio.models import ContentTypeDescription
from bungio.models import SearchResultOfContentItemPublicContract
from bungio.models import NewsArticleRssResponse


@custom_define()
Expand Down
99 changes: 49 additions & 50 deletions src/bungio/api/bungie/destiny2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,58 @@
from datetime import datetime
from typing import Optional, Union

from bungio.models import (
AwaAuthorizationResult,
AwaInitializeResponse,
AwaPermissionRequested,
AwaUserResponse,
BungieMembershipType,
DestinyActivityHistoryResults,
DestinyActivityModeType,
DestinyAggregateActivityResults,
DestinyCharacterResponse,
DestinyClanAggregateStat,
DestinyCollectibleNodeDetailResponse,
DestinyComponentType,
DestinyDefinition,
DestinyEntitySearchResult,
DestinyEquipItemResults,
DestinyHistoricalStatsAccountResult,
DestinyHistoricalStatsByPeriod,
DestinyHistoricalStatsDefinition,
DestinyHistoricalWeaponStatsData,
DestinyInsertPlugsActionRequest,
DestinyInsertPlugsFreeActionRequest,
DestinyItemActionRequest,
DestinyItemChangeResponse,
DestinyItemResponse,
DestinyItemSetActionRequest,
DestinyItemStateRequest,
DestinyItemTransferRequest,
DestinyLeaderboard,
DestinyLinkedProfilesResponse,
DestinyLoadoutActionRequest,
DestinyLoadoutUpdateActionRequest,
DestinyManifest,
DestinyMilestone,
DestinyMilestoneContent,
DestinyPostGameCarnageReportData,
DestinyPostmasterTransferRequest,
DestinyProfileResponse,
DestinyPublicMilestone,
DestinyPublicVendorsResponse,
DestinyReportOffensePgcrRequest,
DestinyStatsGroupType,
DestinyVendorFilter,
DestinyVendorResponse,
DestinyVendorsResponse,
ExactSearchRequest,
PeriodType,
UserInfoCard,
)
from bungio.models.auth import AuthData
from bungio.models.base import ClientMixin, custom_define
from bungio.models.auth import AuthData
from bungio.utils import AllowAsyncIteration

from bungio.models import DestinyItemTransferRequest
from bungio.models import DestinyItemActionRequest
from bungio.models import DestinyMilestoneContent
from bungio.models import DestinyHistoricalStatsAccountResult
from bungio.models import DestinyItemStateRequest
from bungio.models import DestinyDefinition
from bungio.models import DestinyLeaderboard
from bungio.models import DestinyClanAggregateStat
from bungio.models import DestinyPublicVendorsResponse
from bungio.models import DestinyPostmasterTransferRequest
from bungio.models import ExactSearchRequest
from bungio.models import AwaPermissionRequested
from bungio.models import DestinyEntitySearchResult
from bungio.models import DestinyVendorResponse
from bungio.models import DestinyLoadoutActionRequest
from bungio.models import DestinyHistoricalStatsByPeriod
from bungio.models import DestinyHistoricalWeaponStatsData
from bungio.models import DestinyLinkedProfilesResponse
from bungio.models import DestinyInsertPlugsFreeActionRequest
from bungio.models import AwaUserResponse
from bungio.models import DestinyPublicMilestone
from bungio.models import AwaAuthorizationResult
from bungio.models import DestinyCharacterResponse
from bungio.models import DestinyReportOffensePgcrRequest
from bungio.models import AwaInitializeResponse
from bungio.models import BungieMembershipType
from bungio.models import DestinyEquipItemResults
from bungio.models import PeriodType
from bungio.models import DestinyActivityModeType
from bungio.models import DestinyPostGameCarnageReportData
from bungio.models import DestinyVendorFilter
from bungio.models import DestinyInsertPlugsActionRequest
from bungio.models import DestinyStatsGroupType
from bungio.models import DestinyManifest
from bungio.models import DestinyVendorsResponse
from bungio.models import DestinyCollectibleNodeDetailResponse
from bungio.models import DestinyLoadoutUpdateActionRequest
from bungio.models import DestinyItemChangeResponse
from bungio.models import DestinyActivityHistoryResults
from bungio.models import DestinyMilestone
from bungio.models import DestinyItemSetActionRequest
from bungio.models import DestinyComponentType
from bungio.models import DestinyItemResponse
from bungio.models import DestinyProfileResponse
from bungio.models import UserInfoCard
from bungio.models import DestinyAggregateActivityResults
from bungio.models import DestinyHistoricalStatsDefinition


@custom_define()
class Destiny2RouteInterface(ClientMixin):
Expand Down
19 changes: 9 additions & 10 deletions src/bungio/api/bungie/fireteam.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@

from typing import Optional, Union

from bungio.models import (
FireteamDateRange,
FireteamPlatform,
FireteamPublicSearchOption,
FireteamResponse,
FireteamSlotSearch,
SearchResultOfFireteamResponse,
SearchResultOfFireteamSummary,
)
from bungio.models.auth import AuthData
from bungio.models.base import ClientMixin, custom_define
from bungio.models.auth import AuthData

from bungio.models import SearchResultOfFireteamResponse
from bungio.models import FireteamPlatform
from bungio.models import FireteamSlotSearch
from bungio.models import FireteamResponse
from bungio.models import FireteamDateRange
from bungio.models import SearchResultOfFireteamSummary
from bungio.models import FireteamPublicSearchOption


@custom_define()
Expand Down
Loading

0 comments on commit 60413be

Please sign in to comment.