Skip to content

Commit

Permalink
fix object type
Browse files Browse the repository at this point in the history
  • Loading branch information
isaced committed Aug 13, 2022
1 parent 0cedd42 commit b9296e6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
22 changes: 11 additions & 11 deletions Sources/V2exAPI/Models/V2Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import Foundation
Token
*/
public struct V2Token: Decodable {
let token, scope: String
let expiration, goodForDays, totalUsed, lastUsed: Int
let created: Int

enum CodingKeys: String, CodingKey {
case token, scope, expiration
case goodForDays = "good_for_days"
case totalUsed = "total_used"
case lastUsed = "last_used"
case created
}
public let token, scope: String?
public let expiration, goodForDays, totalUsed, lastUsed: Int?
public let created: Int?
enum CodingKeys: String, CodingKey {
case token, scope, expiration
case goodForDays = "good_for_days"
case totalUsed = "total_used"
case lastUsed = "last_used"
case created
}
}
22 changes: 16 additions & 6 deletions Sources/V2exAPI/Models/V2Topic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

/// 话题
public struct V2Topic: Identifiable, Decodable {

public let id: Int
public let node: V2Node?
public let member: V2Member?
Expand All @@ -23,11 +23,21 @@ public struct V2Topic: Identifiable, Decodable {
public let contentRendered: String?
public let lastModified: Int?
public let replies: Int?

public init(
id: Int, node: V2Node? = nil, member: V2Member? = nil, lastReplyBy: String?, lastTouched: Int?,
title: String?, url: String?, created: Int?, deleted: Int?, content: String?,
contentRendered: String?, lastModified: Int?, replies: Int?
id: Int,
node: V2Node? = nil,
member: V2Member? = nil,
lastReplyBy: String? = nil,
lastTouched: Int? = nil,
title: String? = nil,
url: String? = nil,
created: Int? = nil,
deleted: Int? = nil,
content: String? = nil,
contentRendered: String? = nil,
lastModified: Int? = nil,
replies: Int? = nil
) {
self.id = id
self.node = node
Expand All @@ -43,7 +53,7 @@ public struct V2Topic: Identifiable, Decodable {
self.lastModified = lastModified
self.replies = replies
}

enum CodingKeys: String, CodingKey {
case node, member
case lastReplyBy = "last_reply_by"
Expand Down

0 comments on commit b9296e6

Please sign in to comment.