Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move to v2 for user queue request and user agent in headers #834

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as for Android. Did you verify if React Native Data Pipelines support is sending expected source and version correctly? If yes, then we're good with the change.

if let userToken = state.userId {
urlRequest.addValue(Data(userToken.utf8).base64EncodedString(), forHTTPHeaderField: HTTPHeader.userToken.rawValue)
}
Expand Down
Loading