Coverage for fio_wrapper/urls.py: 100%
119 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-11-16 11:50 +0100
« prev ^ index » next coverage.py v7.3.2, created at 2023-11-16 11:50 +0100
1from fio_wrapper.config import Config
4class URLs:
5 """FIO API URLs
7 Attributes:
8 base_url (str): FIO Base URL
9 """
11 def __init__(self, config: Config) -> None:
12 self.config = config
14 self.base_url = config.base_url
16 # material
17 self.material_base = config.get_url("material_base")
18 self.material_allmaterials = config.get_url("material_all")
20 # exchange
21 self.exchange_base = config.get_url("exchange_base")
22 self.exchange_orders = config.get_url("exchange_orders")
23 self.exchange_all = config.get_url("exchange_all")
24 self.exchange_full = config.get_url("exchange_full")
26 # building
27 self.building_base = config.get_url("building_base")
28 self.building_all = config.get_url("building_all")
30 # recipe
31 self.recipe_base = config.get_url("recipe_base")
32 self.recipe_all = config.get_url("recipe_all")
34 # planet
35 self.planet_base = config.get_url("planet_base")
36 self.planet_all = config.get_url("planet_all")
37 self.planet_full = config.get_url("planet_full")
38 self.planet_sites = config.get_url("planet_sites")
39 self.planet_search = config.get_url("planet_search")
41 # localmarket
42 self.localmarket_base = config.get_url("localmarket_base")
43 self.localmarket_planet = config.get_url("localmarket_planet")
44 self.localmarket_shipping_source = config.get_url("localmarket_shipping_source")
45 self.localmarket_shipping_destination = config.get_url(
46 "localmarket_shipping_destination"
47 )
48 self.localmarket_company = config.get_url("localmarket_company")
50 # sites
51 self.sites_base = config.get_url("sites_base")
52 self.sites_planets = config.get_url("sites_planets")
53 self.sites_warehouses = config.get_url("sites_warehouses")
55 # storage
56 self.storage_base = config.get_url("storage_base")
57 self.storage_planets = config.get_url("storage_planets")
59 # groups
60 self.groups = config.get_url("groups")
61 self.groups_group = config.get_url("groups_group")
62 self.groups_groupmemberships = config.get_url("groups_groupmemberships")
63 self.groups_hub = config.get_url("groups_hub")
64 self.groups_burn = config.get_url("groups_burn")
66 # Material
67 def material_url(self) -> str:
68 return self.base_url + self.material_base
70 def material_get_url(self, material_ticker: str) -> str:
71 return self.material_url() + "/" + material_ticker
73 def material_allmaterials_url(self) -> str:
74 return self.material_url() + self.material_allmaterials
76 def material_get_category(self, category_name: str) -> str:
77 return self.material_url() + "/category/" + category_name
79 # Exchange
80 def exchange_url(self) -> str:
81 return self.base_url + self.exchange_base
83 def exchange_get_url(self, exchange_ticker: str) -> str:
84 return self.exchange_url() + "/" + exchange_ticker
86 def exchange_get_all_url(self) -> str:
87 return self.exchange_url() + self.exchange_all
89 def exchange_get_full_url(self) -> str:
90 return self.exchange_url() + self.exchange_full
92 def exchange_get_orders_companycode(self, company_code: str) -> str:
93 return self.exchange_url() + self.exchange_orders + "/" + company_code
95 def exchange_get_orders_companycode_exchange(
96 self, company_code: str, exchange_code: str
97 ) -> str:
98 return (
99 self.exchange_url()
100 + self.exchange_orders
101 + "/"
102 + company_code
103 + "/"
104 + exchange_code
105 )
107 # Building
108 def building_url(self) -> str:
109 return f"{self.base_url}{self.building_base}"
111 def building_get_url(self, building_ticker: str) -> str:
112 return f"{self.building_url()}/{building_ticker}"
114 def building_get_all_url(self) -> str:
115 return f"{self.building_url()}{self.building_all}"
117 # Recipe
118 def recipe_url(self) -> str:
119 return f"{self.base_url}{self.recipe_base}"
121 def recipe_get_url(self, material_ticker: str) -> str:
122 return f"{self.recipe_url()}/{material_ticker}"
124 def recipe_get_all_url(self) -> str:
125 return f"{self.recipe_url()}{self.recipe_all}"
127 # Planet
129 def planet_url(self) -> str:
130 return f"{self.base_url}{self.planet_base}"
132 def planet_get_url(self, planet: str) -> str:
133 return f"{self.planet_url()}/{planet}"
135 def planet_all_url(self) -> str:
136 return f"{self.planet_url()}{self.planet_all}"
138 def planet_full_url(self) -> str:
139 return f"{self.planet_url()}{self.planet_full}"
141 def planet_sites_url(self, planet: str) -> str:
142 return f"{self.planet_url()}{self.planet_sites}/{planet}"
144 def planet_search_url(self) -> str:
145 return f"{self.planet_url()}{self.planet_search}"
147 # LocalMarket
149 def localmarket_url(self) -> str:
150 return f"{self.base_url}{self.localmarket_base}"
152 def localmarket_planet_url(self, planet: str) -> str:
153 return f"{self.localmarket_url()}{self.localmarket_planet}/{planet}"
155 def localmarket_planet_type_url(self, planet: str, adtype: str) -> str:
156 return f"{self.localmarket_url()}{self.localmarket_planet}/{planet}/{adtype}"
158 def localmarket_shipping_source_url(self, planet: str) -> str:
159 return f"{self.localmarket_url()}{self.localmarket_shipping_source}/{planet}"
161 def localmarket_shipping_destination_url(self, planet: str) -> str:
162 return (
163 f"{self.localmarket_url()}{self.localmarket_shipping_destination}/{planet}"
164 )
166 def localmarket_company_url(self, companycode: str) -> str:
167 return f"{self.localmarket_url()}{self.localmarket_company}/{companycode}"
169 # Sites
171 def sites_url(self) -> str:
172 return f"{self.base_url}{self.sites_base}"
174 def sites_get_url(self, username: str) -> str:
175 return f"{self.sites_url()}/{username}"
177 def sites_planets_get_url(self, username: str) -> str:
178 return f"{self.sites_url()}{self.sites_planets}/{username}"
180 def sites_planets_get_planet_url(self, username: str, planet: str) -> str:
181 return f"{self.sites_url()}/{username}/{planet}"
183 def sites_warehouses_get(self, username: str) -> str:
184 return f"{self.sites_url()}{self.sites_warehouses}/{username}"
186 # Storage
187 def storage_url(self) -> str:
188 return f"{self.base_url}{self.storage_base}"
190 def storage_get_url(self, username: str) -> str:
191 return f"{self.storage_url()}/{username}"
193 def storage_planets_get_url(self, username: str) -> str:
194 return f"{self.storage_url()}{self.storage_planets}/{username}"
196 def storage_get_specific_url(self, username: str, specific: str) -> str:
197 return f"{self.storage_url()}/{username}/{specific}"
199 # Groups
201 def group_all_url(self) -> str:
202 return f"{self.base_url}{self.groups}"
204 def group_get_url(self, groupid: int) -> str:
205 return f"{self.base_url}{self.groups_group}/{groupid}"
207 def group_memberships_url(self) -> str:
208 return f"{self.base_url}{self.groups_groupmemberships}"
210 def group_hub_url(self) -> str:
211 return f"{self.base_url}{self.groups_hub}"
213 def group_burn_url(self, groupid: int) -> str:
214 return f"{self.base_url}{self.groups_burn}/{groupid}"