Implemented the Me and Item models.
This commit is contained in:
parent
db11dfa31d
commit
eb5d25dc90
@ -7,16 +7,14 @@ let package = Package(
|
|||||||
products: [
|
products: [
|
||||||
.library(
|
.library(
|
||||||
name: "Libraries",
|
name: "Libraries",
|
||||||
targets: ["Libraries"]),
|
targets: ["APIService"]),
|
||||||
],
|
|
||||||
dependencies: [
|
|
||||||
],
|
],
|
||||||
|
dependencies: [],
|
||||||
targets: [
|
targets: [
|
||||||
.target(
|
.target(name: "APIService"),
|
||||||
name: "Libraries",
|
|
||||||
dependencies: []),
|
|
||||||
.testTarget(
|
.testTarget(
|
||||||
name: "LibrariesTests",
|
name: "APIServiceTests",
|
||||||
dependencies: ["Libraries"]),
|
dependencies: ["APIService"]
|
||||||
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
33
Libraries/Sources/APIService/Models/Item.swift
Normal file
33
Libraries/Sources/APIService/Models/Item.swift
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// Item.swift
|
||||||
|
// APIService
|
||||||
|
//
|
||||||
|
// Created by Javier Cicchelli on 03/12/2022.
|
||||||
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct Item {
|
||||||
|
let idParent: String?
|
||||||
|
let id: String
|
||||||
|
let name: String
|
||||||
|
let isDirectory: Bool
|
||||||
|
let lastModifiedAt: Date
|
||||||
|
let size: Int?
|
||||||
|
let contentType: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Decodable
|
||||||
|
|
||||||
|
extension Item: Decodable {
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
|
case idParent = "parentId"
|
||||||
|
case name
|
||||||
|
case isDirectory = "isDir"
|
||||||
|
case lastModifiedAt = "modificationDate"
|
||||||
|
case size
|
||||||
|
case contentType
|
||||||
|
}
|
||||||
|
}
|
17
Libraries/Sources/APIService/Models/Me.swift
Normal file
17
Libraries/Sources/APIService/Models/Me.swift
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// Me.swift
|
||||||
|
// APIService
|
||||||
|
//
|
||||||
|
// Created by Javier Cicchelli on 03/12/2022.
|
||||||
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
public struct Me {
|
||||||
|
let firstName: String
|
||||||
|
let lastName: String
|
||||||
|
let rootItem: Item
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Decodable
|
||||||
|
|
||||||
|
extension Me: Decodable {}
|
@ -1,6 +0,0 @@
|
|||||||
public struct Libraries {
|
|
||||||
public private(set) var text = "Hello, World!"
|
|
||||||
|
|
||||||
public init() {
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
import XCTest
|
|
||||||
@testable import Libraries
|
|
||||||
|
|
||||||
final class LibrariesTests: XCTestCase {
|
|
||||||
func testExample() throws {
|
|
||||||
// This is an example of a functional test case.
|
|
||||||
// Use XCTAssert and related functions to verify your tests produce the correct
|
|
||||||
// results.
|
|
||||||
XCTAssertEqual(Libraries().text, "Hello, World!")
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user