Skip to content

Resource CompanyResource

CrucifiedPain edited this page Jun 26, 2026 · 10 revisions

CompanyResource (client.company)

Endpoints: • company.getById • company.getCompanies (cursor-paginated, filter by userId) • company.getRecommendedRegionIdsByItemCode • company.getProductionBonus

.collect_all()

Convenience: fetch all companies globally (or by country if passed) using parallel slicing. This is much faster than fetching sequentially.

Signature

await client.company.collect_all(oldest_date: 'datetime | str | None' = None, time_slice_days: 'int' = 30, concurrency: 'int' = 500, **kwargs: 'Any') -> 'list[Company]'

Parameters

Name Type Default
oldest_date `datetime str
time_slice_days int 30
concurrency int 500
kwargs Any *Required*

Return Models

Company

Field Type Required Description
_id `string null` No
__v `integer null` No
name `string null` No
owner `string null` No
country `string null` No
region `string null` No
type `string null` No
quality `integer null` No
size `integer null` No
employees `integer null` No
production `number null` No
wealth `number null` No
image `string null` No
isHiring `boolean null` No
activeUpgradeLevels `CompanyActiveUpgradeLevels null` No
concreteInvested `integer number null`
dates `CompanyDates null` No
estimatedValue `integer number null`
isFull `boolean null` No
itemCode `string null` No
movedUpAt `string null` No
user `string null` No
workerCount `integer null` No
workers `array null` No
createdAt `string null` No
updatedAt `string null` No

CompanyActiveUpgradeLevels

Field Type Required Description
_id `string null` No
__v `integer null` No

CompanyDates

Field Type Required Description
_id `string null` No
__v `integer null` No

.collect_by_users()

Fetch all companies owned by a list of users. Uses native tRPC batching to group up to 50 user queries per HTTP request, making it extremely fast and rate-limit friendly.

Args: user_ids: List of user ID strings to fetch companies for. concurrency: Max concurrent requests.

Returns: A flat list of all :class:Company objects across every user.

Signature

await client.company.collect_by_users(user_ids: 'list[str]', *, concurrency: 'int' = 500) -> 'list[Company]'

Parameters

Name Type Default
user_ids list[str] *Required*
concurrency int 500

Return Models

Company

Field Type Required Description
_id `string null` No
__v `integer null` No
name `string null` No
owner `string null` No
country `string null` No
region `string null` No
type `string null` No
quality `integer null` No
size `integer null` No
employees `integer null` No
production `number null` No
wealth `number null` No
image `string null` No
isHiring `boolean null` No
activeUpgradeLevels `CompanyActiveUpgradeLevels null` No
concreteInvested `integer number null`
dates `CompanyDates null` No
estimatedValue `integer number null`
isFull `boolean null` No
itemCode `string null` No
movedUpAt `string null` No
user `string null` No
workerCount `integer null` No
workers `array null` No
createdAt `string null` No
updatedAt `string null` No

CompanyActiveUpgradeLevels

Field Type Required Description
_id `string null` No
__v `integer null` No

CompanyDates

Field Type Required Description
_id `string null` No
__v `integer null` No

.get()

Get a single company by ID.

Signature

await client.company.get(company_id: 'str') -> 'Company'

Parameters

Name Type Default
company_id str *Required*

Return Models

Company

Field Type Required Description
_id `string null` No
__v `integer null` No
name `string null` No
owner `string null` No
country `string null` No
region `string null` No
type `string null` No
quality `integer null` No
size `integer null` No
employees `integer null` No
production `number null` No
wealth `number null` No
image `string null` No
isHiring `boolean null` No
activeUpgradeLevels `CompanyActiveUpgradeLevels null` No
concreteInvested `integer number null`
dates `CompanyDates null` No
estimatedValue `integer number null`
isFull `boolean null` No
itemCode `string null` No
movedUpAt `string null` No
user `string null` No
workerCount `integer null` No
workers `array null` No
createdAt `string null` No
updatedAt `string null` No

CompanyActiveUpgradeLevels

Field Type Required Description
_id `string null` No
__v `integer null` No

CompanyDates

Field Type Required Description
_id `string null` No
__v `integer null` No

.get_by_user()

Convenience: fetch all companies owned by a user (collects all pages).

Signature

await client.company.get_by_user(user_id: 'str', **kwargs: 'Any') -> 'list[Company]'

Parameters

Name Type Default
user_id str *Required*
kwargs Any *Required*

Return Models

Company

Field Type Required Description
_id `string null` No
__v `integer null` No
name `string null` No
owner `string null` No
country `string null` No
region `string null` No
type `string null` No
quality `integer null` No
size `integer null` No
employees `integer null` No
production `number null` No
wealth `number null` No
image `string null` No
isHiring `boolean null` No
activeUpgradeLevels `CompanyActiveUpgradeLevels null` No
concreteInvested `integer number null`
dates `CompanyDates null` No
estimatedValue `integer number null`
isFull `boolean null` No
itemCode `string null` No
movedUpAt `string null` No
user `string null` No
workerCount `integer null` No
workers `array null` No
createdAt `string null` No
updatedAt `string null` No

CompanyActiveUpgradeLevels

Field Type Required Description
_id `string null` No
__v `integer null` No

CompanyDates

Field Type Required Description
_id `string null` No
__v `integer null` No

.get_companies()

Get companies, optionally filtered by owner user ID (cursor-paginated).

Signature

await client.company.get_companies(*, user_id: 'str | None' = None, per_page: 'int' = 10, cursor: 'str | None' = None, auto_items: 'bool' = False, max_pages: 'int | float' = inf, cursor_end: 'str | None' = None) -> 'CursorPage[Company] | AsyncIterator[Company]'

Parameters

Name Type Default
user_id `str None`
per_page int 10
cursor `str None`
auto_items bool False
max_pages `int float`
cursor_end `str None`

Return Models

Company

Field Type Required Description
_id `string null` No
__v `integer null` No
name `string null` No
owner `string null` No
country `string null` No
region `string null` No
type `string null` No
quality `integer null` No
size `integer null` No
employees `integer null` No
production `number null` No
wealth `number null` No
image `string null` No
isHiring `boolean null` No
activeUpgradeLevels `CompanyActiveUpgradeLevels null` No
concreteInvested `integer number null`
dates `CompanyDates null` No
estimatedValue `integer number null`
isFull `boolean null` No
itemCode `string null` No
movedUpAt `string null` No
user `string null` No
workerCount `integer null` No
workers `array null` No
createdAt `string null` No
updatedAt `string null` No

CompanyActiveUpgradeLevels

Field Type Required Description
_id `string null` No
__v `integer null` No

CompanyDates

Field Type Required Description
_id `string null` No
__v `integer null` No

CursorPage[Company]

Field Type Required Description
_id `string null` No
__v `integer null` No
items array Yes
nextCursor `string null` No
hasMore boolean No

.get_many()

Fetch multiple companies by ID concurrently using the auto-batcher.

Signature

await client.company.get_many(company_ids: 'list[str]', *, concurrency: 'int' = 500) -> 'list[Company | None]'

Parameters

Name Type Default
company_ids list[str] *Required*
concurrency int 500

Return Models

Company

Field Type Required Description
_id `string null` No
__v `integer null` No
name `string null` No
owner `string null` No
country `string null` No
region `string null` No
type `string null` No
quality `integer null` No
size `integer null` No
employees `integer null` No
production `number null` No
wealth `number null` No
image `string null` No
isHiring `boolean null` No
activeUpgradeLevels `CompanyActiveUpgradeLevels null` No
concreteInvested `integer number null`
dates `CompanyDates null` No
estimatedValue `integer number null`
isFull `boolean null` No
itemCode `string null` No
movedUpAt `string null` No
user `string null` No
workerCount `integer null` No
workers `array null` No
createdAt `string null` No
updatedAt `string null` No

CompanyActiveUpgradeLevels

Field Type Required Description
_id `string null` No
__v `integer null` No

CompanyDates

Field Type Required Description
_id `string null` No
__v `integer null` No

.get_production_bonus()

Get the full production bonus breakdown for a company.

Returns a :class:CompanyProductionBonus with strategic_bonus, deposit_bonus, ethic_specialization_bonus, ethic_deposit_bonus, and total.

Signature

await client.company.get_production_bonus(company_id: 'str') -> 'CompanyProductionBonus'

Parameters

Name Type Default
company_id str *Required*

.get_recommended_regions()

Get recommended regions for producing a given item, ranked by total bonus.

Args: item_code: Item code to check (e.g. "iron", "weapon_q1"). include_deposit: Whether to include deposit bonuses in the ranking.

Returns: A list of :class:RecommendedRegion objects sorted by bonus (best first).

Signature

await client.company.get_recommended_regions(item_code: 'str', *, include_deposit: 'bool' = True) -> 'list[RecommendedRegion]'

Parameters

Name Type Default
item_code str *Required*
include_deposit bool True

.invalidate_cache()

Clear the SWR cache for all resources.

Signature

await client.company.invalidate_cache() -> 'None'

Clone this wiki locally