From 11070a4b2f15527afc56d03933e79fac7c2a4193 Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Sat, 16 Aug 2025 12:36:00 +0300 Subject: [PATCH] Sending avtocod data to backend --- AutoCatCore/Services/ApiService/ApiService.swift | 6 +++++- AutoCatCore/Services/ApiService/AvtocodResponse.swift | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AutoCatCore/Services/ApiService/ApiService.swift b/AutoCatCore/Services/ApiService/ApiService.swift index 777bccf..83943c2 100644 --- a/AutoCatCore/Services/ApiService/ApiService.swift +++ b/AutoCatCore/Services/ApiService/ApiService.swift @@ -276,6 +276,10 @@ public actor ApiService: ApiServiceProtocol { body["events"] = AnyEncodable(events) } + if let avtocodReport { + body["avtocodReport"] = AnyEncodable(avtocodReport) + } + return try await makeBodyRequest(api: "vehicles/check", body: body) } @@ -364,7 +368,7 @@ public actor ApiService: ApiServiceProtocol { } urlComponents.queryItems = [ - URLQueryItem(name: "number", value: number.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)), + URLQueryItem(name: "number", value: number), URLQueryItem(name: "type", value: numberType.value), URLQueryItem(name: "device_token", value: UUID().uuidString) ] diff --git a/AutoCatCore/Services/ApiService/AvtocodResponse.swift b/AutoCatCore/Services/ApiService/AvtocodResponse.swift index 530c892..4c782ae 100644 --- a/AutoCatCore/Services/ApiService/AvtocodResponse.swift +++ b/AutoCatCore/Services/ApiService/AvtocodResponse.swift @@ -11,4 +11,6 @@ import Foundation struct AvtocodResponse: Decodable { let report_uri: String? + let token: String? + let available_reports: Int? }