Skip to content

Commit 0e40cf7

Browse files
committed
WIP
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
1 parent ccdad72 commit 0e40cf7

2 files changed

Lines changed: 30 additions & 10 deletions

File tree

Sources/NextcloudKit/Models/DeclarativeUI/NKClientIntegrationUIResponse.swift

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,37 @@
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

55
public struct NKClientIntegrationUIResponse: Codable {
6-
let version: Double
7-
let root: RootContainer
6+
public let ocs: OCSContainer
7+
}
8+
9+
public struct OCSContainer: Codable {
10+
public let meta: Meta
11+
public let data: ResponseData
12+
}
13+
14+
public struct Meta: Codable {
15+
public let status: String
16+
public let statuscode: Int
17+
public let message: String
18+
}
19+
20+
public struct ResponseData: Codable {
21+
// TODO: add after
22+
// public let version: String
23+
public let tooltip: String?
824
}
925

1026
public struct RootContainer: Codable {
11-
let orientation: String
12-
let rows: [Row]
27+
public let orientation: String
28+
public let rows: [Row]
1329
}
1430

1531
public struct Row: Codable {
16-
let children: [Child]
32+
public let children: [Child]
1733
}
1834

1935
public struct Child: Codable {
20-
let element: String
21-
let text: String?
22-
let url: String?
36+
public let element: String
37+
public let text: String?
38+
public let url: String?
2339
}

Sources/NextcloudKit/NextcloudKit+ClientIntegration.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,17 @@ public extension NextcloudKit {
134134
queryParams = qp
135135
}
136136

137-
guard let fullURL = URL(string: nkSession.urlBase + url) else {
137+
let fullURLString = nkSession.urlBase + url
138+
let finalURLString = fullURLString.replacingOccurrences(of: "{\(NKClientIntegration.Params.fileId.rawValue)}", with: fileId)
139+
.replacingOccurrences(of: "{\(NKClientIntegration.Params.filePath.rawValue)}", with: filePath)
140+
141+
guard let finalURL = URL(string: finalURLString) else {
138142
return (account, nil, NKError.urlError)
139143
}
140144

141145
let taskDescription = options.taskDescription
142146

143-
let request = unauthorizedSession.request(fullURL,
147+
let request = unauthorizedSession.request(finalURL,
144148
method: httpMethod,
145149
parameters: queryParams,
146150
encoding: URLEncoding.queryString,

0 commit comments

Comments
 (0)