mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
fix api data decoding
This commit is contained in:
3 files changed
+9
-9
No files matched your search
@@ -38,10 +38,10 @@ class GifHoarder: Hoarder, ObservableObject {
|
||||
Task {
|
||||
do {
|
||||
async let (data, _) = try URLSession.shared.data(from: components!.url!)
|
||||
let object =
|
||||
print(try JSONDecoder().decode(Trending.self, from: await data))
|
||||
let object: Trending = try JSONDecoder().decode(Trending.self, from: await data)
|
||||
print(object.data.count)
|
||||
} catch {
|
||||
print(error.localizedDescription)
|
||||
print(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ struct GifObject: Codable, Identifiable {
|
||||
var source: String
|
||||
var rating: String
|
||||
var content_url: String?
|
||||
var user: GiphyUser
|
||||
var user: GiphyUser?
|
||||
var source_tld: String
|
||||
var source_post_url: String
|
||||
var update_datetime: Date
|
||||
var create_datetime: Date
|
||||
var import_datetime: Date
|
||||
var trending_datetime: Date
|
||||
var update_datetime: String?
|
||||
var create_datetime: String?
|
||||
var import_datetime: String
|
||||
var trending_datetime: String?
|
||||
var images: GiphyImages
|
||||
var title: String
|
||||
var alt_text: String
|
||||
|
||||
@@ -47,7 +47,7 @@ struct GiphyImages: Codable {
|
||||
var original_still: still
|
||||
|
||||
//15s looping version
|
||||
var looping: looping
|
||||
// var looping: looping
|
||||
//mp4 format 50kb, first 1-2s of the gif
|
||||
var preview: video
|
||||
//50kb first 1-2s of the gif
|
||||
|
||||