From 7e6e75e0193a887bc83e48a7787d18c28cb9f447 Mon Sep 17 00:00:00 2001 From: dssecret Date: Mon, 25 May 2026 08:42:46 +0000 Subject: [PATCH] [torngen] Generated v5.9.0 --- torngen/VERSION | 2 +- torngen/base_query.py | 2 +- torngen/path/__init__.py | 46 ++++++++++--------- torngen/path/company.py | 31 +++++++++++++ torngen/path/company_typeId.py | 39 ++++++++++++++++ torngen/path/faction.py | 4 +- torngen/schema/companies_response.py | 31 +++++++++++++ torngen/schema/company_news_category.py | 3 ++ torngen/schema/company_selection_name.py | 2 +- torngen/schema/faction_territory_ownership.py | 2 + torngen/schema/news.py | 23 ++++++++++ torngen/schema/news_response.py | 23 ++++++++++ torngen/schema/torn_bounties_response.py | 6 +-- 13 files changed, 183 insertions(+), 31 deletions(-) create mode 100644 torngen/path/company_typeId.py create mode 100644 torngen/schema/companies_response.py create mode 100644 torngen/schema/company_news_category.py create mode 100644 torngen/schema/news.py create mode 100644 torngen/schema/news_response.py diff --git a/torngen/VERSION b/torngen/VERSION index 1802e77..b3d91f9 100644 --- a/torngen/VERSION +++ b/torngen/VERSION @@ -1 +1 @@ -5.8.1 +5.9.0 diff --git a/torngen/base_query.py b/torngen/base_query.py index 7df18c8..f79fec5 100644 --- a/torngen/base_query.py +++ b/torngen/base_query.py @@ -6,7 +6,7 @@ from .base_path import Path from .base_schema import BaseSchema -VERSION = "5.8.1" +VERSION = "5.9.0" class _URLComponents(typing.NamedTuple): diff --git a/torngen/path/__init__.py b/torngen/path/__init__.py index 5971f08..9e5a960 100644 --- a/torngen/path/__init__.py +++ b/torngen/path/__init__.py @@ -1,5 +1,6 @@ from .company import Company from .company_id import CompanyId +from .company_typeId import CompanyTypeId from .faction import Faction from .faction_chainId import FactionChainId from .faction_crimeId import FactionCrimeId @@ -31,35 +32,36 @@ from .user_tradeId import UserTradeId __all__ = [ - "Company", - "CompanyId", + "Forum", + "RacingRaceId", + "FactionTerritoryWarId", "Faction", - "FactionChainId", + "FactionRankedWarId", + "Market", + "UserCrimeId", + "PropertyId", + "Company", + "TornIds", + "MarketId", "FactionCrimeId", + "FactionChainId", "FactionId", + "User", "FactionRaidWarId", - "FactionRankedWarId", - "FactionTerritoryWarId", - "Forum", + "TornId", + "Racing", + "CompanyId", "ForumCategoryIds", + "TornCrimeId", + "UserTradeId", + "Property", + "TornLogCategoryId", "ForumThreadId", - "Key", - "Market", - "MarketId", + "UserId", "MarketPropertyTypeId", - "Property", - "PropertyId", - "Racing", - "RacingRaceId", - "RacingTrackId", + "Key", "Torn", - "TornCrimeId", - "TornId", - "TornIds", - "TornLogCategoryId", "TornStockId", - "User", - "UserCrimeId", - "UserId", - "UserTradeId", + "RacingTrackId", + "CompanyTypeId", ] diff --git a/torngen/path/company.py b/torngen/path/company.py index 6be9f46..180d6ae 100644 --- a/torngen/path/company.py +++ b/torngen/path/company.py @@ -6,6 +6,7 @@ from ..schema.company_lookup_response import CompanyLookupResponse from ..schema.company_profile_response_mixed import CompanyProfileResponseMixed from ..schema.company_stock_response import CompanyStockResponse +from ..schema.news_response import NewsResponse from ..schema.timestamp_response import TimestampResponse @@ -52,6 +53,36 @@ class Company(BaseQuery): """ + news = Path( + "/company/news", + NewsResponse, + striptags=Parameter("striptags", "query", required=False, deprecated=False), + limit=Parameter("limit", "query", required=False, deprecated=False), + sort=Parameter("sort", "query", required=False, deprecated=False), + to=Parameter("to", "query", required=False, deprecated=False), + from_=Parameter("from", "query", required=False, deprecated=False), + cat=Parameter("cat", "query", required=True, deprecated=False), + timestamp=Parameter("timestamp", "query", required=False, deprecated=False), + comment=Parameter("comment", "query", required=False, deprecated=False), + key=Parameter("key", "query", required=False, deprecated=False), + ) + """ + `/company/news`: Get your company's news details + Requires minimal access key. + + # Parameters + - striptags : Determines if fields include HTML or not ('Hospitalized by <a href=...>user</a>' vs 'Hospitalized by user'). + - limit : N/A + - sort : Sorted by the greatest timestamps + - to : Timestamp that sets the upper limit for the data returned. Data returned will be up to and including this time + - from_ : Timestamp that sets the lower limit for the data returned. Data returned will be after this time + - cat : News category type + - timestamp : Timestamp to bypass cache + - comment : Comment for your tool/service/bot/website to be visible in the logs. + - key : API key (Minimal). It's not required to use this parameter when passing the API key via the Authorization header. + + """ + timestamp = Path( "/company/timestamp", TimestampResponse, diff --git a/torngen/path/company_typeId.py b/torngen/path/company_typeId.py new file mode 100644 index 0000000..a8bcb19 --- /dev/null +++ b/torngen/path/company_typeId.py @@ -0,0 +1,39 @@ +from ..base_path import Path +from ..base_query import BaseQuery +from ..parameter import Parameter +from ..schema.companies_response import CompaniesResponse + + +class CompanyTypeId(BaseQuery): + """ + A collection of paths representing `CompanyTypeId`. + """ + + companies = Path( + "/company/{typeId}/companies", + CompaniesResponse, + typeId=Parameter("typeId", "path", required=True, deprecated=False), + limit=Parameter("limit", "query", required=False, deprecated=False), + offset=Parameter("offset", "query", required=False, deprecated=False), + striptags=Parameter("striptags", "query", required=False, deprecated=False), + timestamp=Parameter("timestamp", "query", required=False, deprecated=False), + comment=Parameter("comment", "query", required=False, deprecated=False), + key=Parameter("key", "query", required=False, deprecated=False), + ) + """ + `/company/{typeId}/companies`: Get a list of companies for a specific company type + Requires public access key. + + # Parameters + - typeId : Company type id + - limit : N/A + - offset : N/A + - striptags : Determines if fields include HTML or not ('Hospitalized by <a href=...>user</a>' vs 'Hospitalized by user'). + - timestamp : Timestamp to bypass cache + - comment : Comment for your tool/service/bot/website to be visible in the logs. + - key : API key (Public). It's not required to use this parameter when passing the API key via the Authorization header. + + """ + + def __init__(self): + super().__init__(base_path="company/{typeId}") diff --git a/torngen/path/faction.py b/torngen/path/faction.py index 0602311..1493a71 100644 --- a/torngen/path/faction.py +++ b/torngen/path/faction.py @@ -13,7 +13,6 @@ from ..schema.faction_hof_response import FactionHofResponse from ..schema.faction_lookup_response import FactionLookupResponse from ..schema.faction_members_response import FactionMembersResponse -from ..schema.faction_news_response import FactionNewsResponse from ..schema.faction_ongoing_chain_response import FactionOngoingChainResponse from ..schema.faction_positions_response import FactionPositionsResponse from ..schema.faction_rackets_response import FactionRacketsResponse @@ -31,6 +30,7 @@ from ..schema.faction_upgrades_response import FactionUpgradesResponse from ..schema.faction_warfare_response import FactionWarfareResponse from ..schema.faction_wars_response import FactionWarsResponse +from ..schema.news_response import NewsResponse from ..schema.reports_response import ReportsResponse from ..schema.revives_full_response import RevivesFullResponse from ..schema.revives_response import RevivesResponse @@ -100,7 +100,7 @@ class Faction(BaseQuery): news = Path( "/faction/news", - FactionNewsResponse, + NewsResponse, striptags=Parameter("striptags", "query", required=False, deprecated=False), limit=Parameter("limit", "query", required=False, deprecated=False), sort=Parameter("sort", "query", required=False, deprecated=False), diff --git a/torngen/schema/companies_response.py b/torngen/schema/companies_response.py new file mode 100644 index 0000000..d68c6a9 --- /dev/null +++ b/torngen/schema/companies_response.py @@ -0,0 +1,31 @@ +import typing +from dataclasses import dataclass + +from ..base_schema import BaseSchema +from .company_profile import CompanyProfile +from .request_metadata_with_links_and_total import RequestMetadataWithLinksAndTotal + + +@dataclass +class CompaniesResponse(BaseSchema): + """ + JSON object of `CompaniesResponse`. + """ + + companies_timestamp: int + companies_delay: int + companies: typing.List[CompanyProfile] + _metadata: RequestMetadataWithLinksAndTotal + + @staticmethod + def parse(data): + return CompaniesResponse( + companies_timestamp=BaseSchema.parse(data.get("companies_timestamp"), int), + companies_delay=BaseSchema.parse(data.get("companies_delay"), int), + companies=BaseSchema.parse( + data.get("companies"), typing.List[CompanyProfile] + ), + _metadata=BaseSchema.parse( + data.get("_metadata"), RequestMetadataWithLinksAndTotal + ), + ) diff --git a/torngen/schema/company_news_category.py b/torngen/schema/company_news_category.py new file mode 100644 index 0000000..505ab2a --- /dev/null +++ b/torngen/schema/company_news_category.py @@ -0,0 +1,3 @@ +import typing + +CompanyNewsCategory = typing.Literal["main", "funds", "training", "employees", "all"] diff --git a/torngen/schema/company_selection_name.py b/torngen/schema/company_selection_name.py index b145b0f..b4882b9 100644 --- a/torngen/schema/company_selection_name.py +++ b/torngen/schema/company_selection_name.py @@ -6,11 +6,11 @@ "applications", "employees", "lookup", + "news", "profile", "stock", "timestamp", "companies", - "news", "search", ] ) diff --git a/torngen/schema/faction_territory_ownership.py b/torngen/schema/faction_territory_ownership.py index 32afeb2..eb96d14 100644 --- a/torngen/schema/faction_territory_ownership.py +++ b/torngen/schema/faction_territory_ownership.py @@ -12,6 +12,7 @@ class FactionTerritoryOwnership(BaseSchema): """ owned_by: None | FactionId + irradiated: bool id: str acquired_at: None | int @@ -19,6 +20,7 @@ class FactionTerritoryOwnership(BaseSchema): def parse(data): return FactionTerritoryOwnership( owned_by=BaseSchema.parse(data.get("owned_by"), None | FactionId), + irradiated=BaseSchema.parse(data.get("irradiated"), bool), id=BaseSchema.parse(data.get("id"), str), acquired_at=BaseSchema.parse(data.get("acquired_at"), None | int), ) diff --git a/torngen/schema/news.py b/torngen/schema/news.py new file mode 100644 index 0000000..dbb2316 --- /dev/null +++ b/torngen/schema/news.py @@ -0,0 +1,23 @@ +import typing +from dataclasses import dataclass + +from ..base_schema import BaseSchema + + +@dataclass +class News(BaseSchema): + """ + JSON object of `News`. + """ + + timestamp: int + text: str + id: str + + @staticmethod + def parse(data): + return News( + timestamp=BaseSchema.parse(data.get("timestamp"), int), + text=BaseSchema.parse(data.get("text"), str), + id=BaseSchema.parse(data.get("id"), str), + ) diff --git a/torngen/schema/news_response.py b/torngen/schema/news_response.py new file mode 100644 index 0000000..0ecfcdd --- /dev/null +++ b/torngen/schema/news_response.py @@ -0,0 +1,23 @@ +import typing +from dataclasses import dataclass + +from ..base_schema import BaseSchema +from .news import News +from .request_metadata_with_links import RequestMetadataWithLinks + + +@dataclass +class NewsResponse(BaseSchema): + """ + JSON object of `NewsResponse`. + """ + + news: typing.List[News] + _metadata: RequestMetadataWithLinks + + @staticmethod + def parse(data): + return NewsResponse( + news=BaseSchema.parse(data.get("news"), typing.List[News]), + _metadata=BaseSchema.parse(data.get("_metadata"), RequestMetadataWithLinks), + ) diff --git a/torngen/schema/torn_bounties_response.py b/torngen/schema/torn_bounties_response.py index f433c33..df8882c 100644 --- a/torngen/schema/torn_bounties_response.py +++ b/torngen/schema/torn_bounties_response.py @@ -13,7 +13,7 @@ class TornBountiesResponse(BaseSchema): """ bounties_timestamp: int - bounties_delay: typing.Optional[int] + bounties_delay: int bounties: typing.List[Bounty] _metadata: RequestMetadataWithLinksAndTotal @@ -21,9 +21,7 @@ class TornBountiesResponse(BaseSchema): def parse(data): return TornBountiesResponse( bounties_timestamp=BaseSchema.parse(data.get("bounties_timestamp"), int), - bounties_delay=BaseSchema.parse( - data.get("bounties_delay"), typing.Optional[int] - ), + bounties_delay=BaseSchema.parse(data.get("bounties_delay"), int), bounties=BaseSchema.parse(data.get("bounties"), typing.List[Bounty]), _metadata=BaseSchema.parse( data.get("_metadata"), RequestMetadataWithLinksAndTotal