Skip to content

Commit

Permalink
feat: renamed some existing functions that start with get to use `f…
Browse files Browse the repository at this point in the history
…etch` instead
  • Loading branch information
SlayerOrnstein committed Jan 23, 2024
1 parent f473dbc commit d68ef79
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Future<void> main() async {
final marketWebsocket = MarketWebsocket.openWebsocket(httpClient.platform);

final client = MarketClient(httpClient, marketWebsocket);
final recentOrders = await client.orders.fetchMostRecentOrders();
final recentOrders = await client.orders.fetchRecentOrders();

for (final order in recentOrders.sellOrders) {
// ignore: avoid_print
Expand Down
8 changes: 4 additions & 4 deletions lib/src/endpoints/items.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ItemsEndpoint {
final MarketHttpClient _client;

/// Get a list of all tradable items.
Future<List<ItemShort>> getItems() async {
Future<List<ItemShort>> fetchItems() async {
final response = await _client.get('/items');
final payload = HttpHelpers.parseResponse(response.body);

Expand All @@ -24,8 +24,8 @@ class ItemsEndpoint {
/// Get information about a specific item.
///
/// Warframe market url name are in snake case. If you are unsure of an
/// item's url name you can pull and cache [ItemsEndpoint.getItems].
Future<List<ItemFull>> getItem(String urlName) async {
/// item's url name you can pull and cache [ItemsEndpoint.fetchItems].
Future<List<ItemFull>> fetchItem(String urlName) async {
final response = await _client.get('/items/$urlName');
final payload = HttpHelpers.parseResponse(response.body);
final item = payload['item'] as Map<String, dynamic>;
Expand All @@ -38,7 +38,7 @@ class ItemsEndpoint {
/// Get a list of orders for an item.
///
/// [includeItem] will include the item itself.
Future<(List<OrderRow>, List<ItemFull>?)> getItemOrders(
Future<(List<OrderRow>, List<ItemFull>?)> fetchItemOrders(
String urlName, {
bool includeItem = false,
}) async {
Expand Down
8 changes: 4 additions & 4 deletions test/src/endpoints/items_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void main() {
when(() => mockClient.get('/items'))
.thenAnswer((_) async => Response(itemsFixture, 200));

final items = await itemsEndpoint.getItems();
final items = await itemsEndpoint.fetchItems();
final itemsJson = {
'payload': {
'items': items.map((i) => i.toJson()).toList(),
Expand All @@ -41,7 +41,7 @@ void main() {
when(() => mockClient.get('/items/secura_dual_cestra'))
.thenAnswer((_) async => Response(itemFullFixture, 200));

final itemsInSet = await itemsEndpoint.getItem('secura_dual_cestra');
final itemsInSet = await itemsEndpoint.fetchItem('secura_dual_cestra');
final itemJson = {
'payload': {
'item': {
Expand All @@ -67,7 +67,7 @@ void main() {
).thenAnswer((_) async => Response(ordersFixture, 200));

final ordersWithItem = await itemsEndpoint
.getItemOrders('secura_dual_cestra', includeItem: true);
.fetchItemOrders('secura_dual_cestra', includeItem: true);

final ordersJson = {
'payload': {
Expand All @@ -94,7 +94,7 @@ void main() {
).thenAnswer((_) async => Response(ordersFixture, 200));

final ordersWithItem =
await itemsEndpoint.getItemOrders('secura_dual_cestra');
await itemsEndpoint.fetchItemOrders('secura_dual_cestra');

final ordersJson = {
'payload': {
Expand Down

0 comments on commit d68ef79

Please sign in to comment.