File tree Expand file tree Collapse file tree 7 files changed +37
-9
lines changed Expand file tree Collapse file tree 7 files changed +37
-9
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,6 @@ public extension xivapiClient {
38
38
return response? . rows
39
39
}
40
40
41
- struct MultiRows < T: Codable > : Codable {
42
- let schema : String
43
- let rows : [ T ]
44
- }
45
-
46
41
/// get the recipe(s) for an item from the local dictionary
47
42
/// - Parameter itemId: itemId
48
43
/// - Returns: the RecipeID(s) for the provided Item
@@ -70,14 +65,17 @@ public extension xivapiClient {
70
65
return response
71
66
}
72
67
73
- func listVersions( ) async -> [ String ] ? {
68
+ func listVersions( ) async -> [ String ] ? { await listVersionsFull ( ) ? . versionNames }
69
+ func listSheets( ) async -> [ String ] ? { await listSheetsFull ( ) ? . sheetNames }
70
+
71
+ func listVersionsFull( ) async -> VersionResponse ? {
74
72
let url = URLComponents ( string: " \( baseUrl) /version " ) !. url!
75
- return await loadData ( url) as [ String ] ?
73
+ return await loadData ( url) as VersionResponse ?
76
74
}
77
75
78
- func listSheets ( ) async -> [ String ] ? {
76
+ func listSheetsFull ( ) async -> SheetResponse ? {
79
77
let url = URLComponents ( string: " \( baseUrl) /sheet " ) !. url!
80
- return await loadData ( url) as [ String ] ?
78
+ return await loadData ( url) as SheetResponse ?
81
79
}
82
80
}
83
81
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ import Foundation
2
+
3
+ struct MultiRows < T: Codable > : Codable {
4
+ let schema : String
5
+ let rows : [ T ]
6
+ }
7
+
8
+ public struct SheetResponse : Codable {
9
+ let sheets : [ SheetEntry ]
10
+
11
+ var sheetNames : [ String ] {
12
+ sheets. map ( \. name)
13
+ }
14
+ }
15
+
16
+ public struct SheetEntry : Codable {
17
+ let name : String
18
+ }
19
+
20
+ public struct VersionResponse : Codable {
21
+ let versions : [ VersionEntry ]
22
+
23
+ var versionNames : [ String ] {
24
+ versions. flatMap ( \. names)
25
+ }
26
+ }
27
+
28
+ public struct VersionEntry : Codable {
29
+ let names : [ String ]
30
+ }
File renamed without changes.
You can’t perform that action at this time.
0 commit comments