Skip to content

Commit

Permalink
chore: move to v2 for user queue request and user agent in headers (#834
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Shahroz16 authored Nov 5, 2024
1 parent dd0200d commit dfece69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum QueueEndpoint: GistNetworkRequest {
var path: String {
switch self {
case .getUserQueue:
return "/api/v1/users"
return "/api/v2/users"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions Sources/MessagingInApp/Gist/Network/GistQueueNetwork.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit dfece69

Please sign in to comment.