summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2020-10-29 12:21:03 +0100
committerAndrej Mihajlov <and@mullvad.net>2021-02-24 11:19:07 +0100
commitc25245302974e7534fbc665420e294e0effcaf80 (patch)
treeea641904f15738327e714a8f44203bd4d845b6d0
parentcbf5a1ce71893522af5e79ed4e655ae7e487dd30 (diff)
downloadmullvadvpn-c25245302974e7534fbc665420e294e0effcaf80.tar.xz
mullvadvpn-c25245302974e7534fbc665420e294e0effcaf80.zip
Add endpoint to send problem reports
-rw-r--r--ios/MullvadVPN/MullvadRest.swift18
1 files changed, 18 insertions, 0 deletions
diff --git a/ios/MullvadVPN/MullvadRest.swift b/ios/MullvadVPN/MullvadRest.swift
index b7c4600de2..1afe08e923 100644
--- a/ios/MullvadVPN/MullvadRest.swift
+++ b/ios/MullvadVPN/MullvadRest.swift
@@ -348,6 +348,10 @@ struct MullvadRest {
func createApplePayment() -> RestSessionEndpoint<TokenPayload<CreateApplePaymentRequest>, CreateApplePaymentResponse> {
return RestSessionEndpoint(session: session, endpoint: Self.createApplePayment())
}
+
+ func sendProblemReport() -> RestSessionEndpoint<ProblemReportRequest, EmptyResponse> {
+ return RestSessionEndpoint(session: session, endpoint: Self.sendProblemReport())
+ }
}
extension MullvadRest {
@@ -414,6 +418,13 @@ extension MullvadRest {
)
}
+ static func sendProblemReport() -> RestEndpoint<ProblemReportRequest, EmptyResponse> {
+ return RestEndpoint(
+ endpointURL: kRestBaseURL.appendingPathComponent("problem-report"),
+ httpMethod: .post
+ )
+ }
+
/// Returns a JSON encoder used by REST API
static func makeJSONEncoder() -> JSONEncoder {
let encoder = JSONEncoder()
@@ -551,3 +562,10 @@ struct CreateApplePaymentResponse: Decodable, RestResponse {
return formatter.string(from: TimeInterval(timeAdded))
}
}
+
+struct ProblemReportRequest: Encodable, RestPayload {
+ let address: String
+ let message: String
+ let log: String
+ let metadata: [String: String]
+}