Skip to content

Commit

Permalink
feat: Cursored APIResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed Jan 24, 2024
1 parent ae60c32 commit ae03a37
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/InfomaniakCore/Networking/ApiResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ open class ApiResponse<ResponseContent: Decodable>: Decodable {
public let page: Int?
public let itemsPerPage: Int?
public let responseAt: Int?
public let cursor: String?

enum CodingKeys: String, CodingKey {
case result
Expand All @@ -46,6 +47,7 @@ open class ApiResponse<ResponseContent: Decodable>: Decodable {
case page
case itemsPerPage = "items_per_page"
case responseAt = "response_at"
case cursor
}

public required init(from decoder: Decoder) throws {
Expand All @@ -64,5 +66,6 @@ open class ApiResponse<ResponseContent: Decodable>: Decodable {
page = try container.decodeIfPresent(Int.self, forKey: .page)
itemsPerPage = try container.decodeIfPresent(Int.self, forKey: .itemsPerPage)
responseAt = try container.decodeIfPresent(Int.self, forKey: .responseAt)
cursor = try container.decodeIfPresent(String.self, forKey: .cursor)
}
}

0 comments on commit ae03a37

Please sign in to comment.