Skip to content

Commit 7434e08

Browse files
committed
fix after rebase
1 parent da1e74f commit 7434e08

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

Examples/SupaDrive/AppView.swift

+11
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,17 @@ struct PanelView: View {
183183
Text("-")
184184
}
185185
}
186+
187+
TableColumn("Metadata") { item in
188+
Text(
189+
{
190+
let encoder = JSONEncoder()
191+
encoder.outputFormatting = [.sortedKeys]
192+
let data = try! encoder.encode(item.metadata ?? [:])
193+
return String(decoding: data, as: UTF8.self)
194+
}()
195+
)
196+
}
186197
}
187198
.contextMenu(
188199
forSelectionType: FileObject.ID.self,

Sources/Storage/Types.swift

+12-16
Original file line numberDiff line numberDiff line change
@@ -133,26 +133,24 @@ public struct DestinationOptions: Sendable {
133133
}
134134

135135
public struct FileObject: Identifiable, Hashable, Codable, Sendable {
136-
public var name: String
136+
public var name: String?
137137
public var bucketId: String?
138138
public var owner: String?
139139
public var id: UUID?
140140
public var updatedAt: Date?
141141
public var createdAt: Date?
142142
public var lastAccessedAt: Date?
143143
public var metadata: [String: AnyJSON]?
144-
public var buckets: Bucket?
145144

146145
public init(
147-
name: String,
146+
name: String? = nil,
148147
bucketId: String? = nil,
149148
owner: String? = nil,
150-
id: UUID? = nil,
149+
id: UUID?,
151150
updatedAt: Date? = nil,
152151
createdAt: Date? = nil,
153152
lastAccessedAt: Date? = nil,
154-
metadata: [String: AnyJSON]? = nil,
155-
buckets: Bucket? = nil
153+
metadata: [String: AnyJSON]? = nil
156154
) {
157155
self.name = name
158156
self.bucketId = bucketId
@@ -162,7 +160,6 @@ public struct FileObject: Identifiable, Hashable, Codable, Sendable {
162160
self.createdAt = createdAt
163161
self.lastAccessedAt = lastAccessedAt
164162
self.metadata = metadata
165-
self.buckets = buckets
166163
}
167164

168165
enum CodingKeys: String, CodingKey {
@@ -174,7 +171,6 @@ public struct FileObject: Identifiable, Hashable, Codable, Sendable {
174171
case createdAt = "created_at"
175172
case lastAccessedAt = "last_accessed_at"
176173
case metadata
177-
case buckets
178174
}
179175
}
180176

@@ -213,20 +209,20 @@ public struct FileObjectV2: Identifiable, Hashable, Decodable, Sendable {
213209
public struct Bucket: Identifiable, Hashable, Codable, Sendable {
214210
public var id: String
215211
public var name: String
216-
public var owner: String
217-
public var isPublic: Bool
218-
public var createdAt: Date
219-
public var updatedAt: Date
212+
public var owner: String?
213+
public var isPublic: Bool?
214+
public var createdAt: Date?
215+
public var updatedAt: Date?
220216
public var allowedMimeTypes: [String]?
221217
public var fileSizeLimit: Int64?
222218

223219
public init(
224220
id: String,
225221
name: String,
226-
owner: String,
227-
isPublic: Bool,
228-
createdAt: Date,
229-
updatedAt: Date,
222+
owner: String? = nil,
223+
isPublic: Bool? = nil,
224+
createdAt: Date? = nil,
225+
updatedAt: Date? = nil,
230226
allowedMimeTypes: [String]? = nil,
231227
fileSizeLimit: Int64? = nil
232228
) {

0 commit comments

Comments
 (0)