From dfece697f2a545f8d5be161be9deb240201e0ee2 Mon Sep 17 00:00:00 2001 From: Shahroz Khan Date: Wed, 6 Nov 2024 02:38:22 +0500 Subject: [PATCH] chore: move to v2 for user queue request and user agent in headers (#834) --- .../MessagingInApp/Gist/Network/Endpoints/QueueEndpoint.swift | 2 +- .../Gist/Network/Endpoints/Utilities/Headers.swift | 2 ++ Sources/MessagingInApp/Gist/Network/GistQueueNetwork.swift | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/MessagingInApp/Gist/Network/Endpoints/QueueEndpoint.swift b/Sources/MessagingInApp/Gist/Network/Endpoints/QueueEndpoint.swift index b2296dbca..a396c556a 100644 --- a/Sources/MessagingInApp/Gist/Network/Endpoints/QueueEndpoint.swift +++ b/Sources/MessagingInApp/Gist/Network/Endpoints/QueueEndpoint.swift @@ -17,7 +17,7 @@ enum QueueEndpoint: GistNetworkRequest { var path: String { switch self { case .getUserQueue: - return "/api/v1/users" + return "/api/v2/users" } } } diff --git a/Sources/MessagingInApp/Gist/Network/Endpoints/Utilities/Headers.swift b/Sources/MessagingInApp/Gist/Network/Endpoints/Utilities/Headers.swift index 16527a427..869e1324e 100644 --- a/Sources/MessagingInApp/Gist/Network/Endpoints/Utilities/Headers.swift +++ b/Sources/MessagingInApp/Gist/Network/Endpoints/Utilities/Headers.swift @@ -3,6 +3,8 @@ enum HTTPHeader: String { case siteId = "X-CIO-Site-Id" case cioDataCenter = "X-CIO-Datacenter" case userToken = "X-Gist-Encoded-User-Token" + case cioClientVersion = "X-CIO-Client-Version" + case cioClientPlatform = "X-CIO-Client-Platform" } enum ContentTypes: String { diff --git a/Sources/MessagingInApp/Gist/Network/GistQueueNetwork.swift b/Sources/MessagingInApp/Gist/Network/GistQueueNetwork.swift index 4a7d82486..5673f9479 100644 --- a/Sources/MessagingInApp/Gist/Network/GistQueueNetwork.swift +++ b/Sources/MessagingInApp/Gist/Network/GistQueueNetwork.swift @@ -22,10 +22,14 @@ class GistQueueNetworkImpl: GistQueueNetwork { throw GistNetworkRequestError.invalidBaseURL } + let sdkClient = DIGraphShared.shared.sdkClient + var urlRequest = URLRequest(url: baseURL.appendingPathComponent(request.path)) urlRequest.httpMethod = request.method.rawValue urlRequest.addValue(state.siteId, forHTTPHeaderField: HTTPHeader.siteId.rawValue) urlRequest.addValue(state.dataCenter, forHTTPHeaderField: HTTPHeader.cioDataCenter.rawValue) + urlRequest.addValue(sdkClient.sdkVersion, forHTTPHeaderField: HTTPHeader.cioClientVersion.rawValue) + urlRequest.addValue(sdkClient.source.lowercased(), forHTTPHeaderField: HTTPHeader.cioClientPlatform.rawValue) if let userToken = state.userId { urlRequest.addValue(Data(userToken.utf8).base64EncodedString(), forHTTPHeaderField: HTTPHeader.userToken.rawValue) }