Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5453a69
initial commit
findms Jul 25, 2025
8ccfcba
Merge branch 'develop' into chore/set-up-testservicesclient-functions…
findms Jul 25, 2025
fc44d64
changes related fetching convoId and domain
findms Jul 25, 2025
92fc0e1
testserviceclient file
findms Jul 28, 2025
18e75b3
removed comment
findms Jul 28, 2025
e2d423e
Merge branch 'develop' into chore/set-up-testservicesclient-functions…
findms Jul 28, 2025
c1ce219
draft changes
findms Jul 29, 2025
db3e724
Merge branch 'develop' into chore/set-up-testservicesclient-functions…
findms Jul 29, 2025
8d56839
merge conflicts
findms Aug 4, 2025
8e2d56b
deleted files
findms Aug 4, 2025
c659efe
handling merge conflicts
findms Aug 4, 2025
671e653
Merge branch 'develop' into chore/set-up-testservicesclient-functions…
findms Aug 4, 2025
6eae44d
files updated according to testservice
findms Aug 4, 2025
c1beb5e
draft changeset
findms Aug 4, 2025
29a515b
create group conversation
findms Aug 6, 2025
4a0dbf9
sendFile function
findms Aug 6, 2025
08387f3
send file in test
findms Aug 6, 2025
2f08e3a
added a comment to work further
findms Aug 6, 2025
097e444
Merge branch 'develop' into chore/set-up-testservicesclient-functions…
findms Aug 8, 2025
56c0328
test verification added
findms Aug 11, 2025
6adf0da
fixed some failure
findms Aug 11, 2025
c443b91
merge conflict changes
findms Aug 11, 2025
85e93ad
conflicts
findms Aug 11, 2025
d576783
Merge branch 'develop' into chore/set-up-testservicesclient-functions…
findms Aug 11, 2025
37044bd
added a wait till last message is received on appside from testservice
findms Aug 11, 2025
29231bd
merge conflicts and handling accessToken
findms Aug 11, 2025
92245a6
added test video file and added comment
findms Aug 13, 2025
580b97e
build assets revert
findms Aug 14, 2025
1c157c9
Merge branch 'develop' into chore/set-up-testservicesclient-functions…
findms Aug 14, 2025
211be22
parameter corrected in function for send audio
findms Aug 15, 2025
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 @@ -125,7 +125,7 @@ public protocol AuthenticationAPI: Sendable {
password: String,
name: String,
teamName: String
) async throws -> (teamId: UUID, id: String)
) async throws -> (teamId: UUID?, qualifiedId: QualifiedID)
#endif

/// Get invitation code from invitation ID
Expand All @@ -150,6 +150,6 @@ public protocol AuthenticationAPI: Sendable {
password: String,
name: String,
invitationCode: String
) async throws -> String
) async throws -> QualifiedID
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ class AuthenticationAPIV0: AuthenticationAPI, VersionedAPI {
password: String,
name: String,
teamName: String
) async throws -> (teamId: UUID, id: String) {
) async throws -> (teamId: UUID?, qualifiedId: QualifiedID) {
let path = "\(pathPrefix)/register"

let body = try JSONEncoder.defaultEncoder.encode(
Expand All @@ -432,19 +432,19 @@ class AuthenticationAPIV0: AuthenticationAPI, VersionedAPI {

let (data, response) = try await networkService.executeRequest(request)

let payload = try ResponseParser()
let apiResponse = try ResponseParser()
.success(code: .created, type: RegisterUserResponseV0.self)
.parse(code: response.statusCode, data: data)

return (payload.team, payload.id)
return (apiResponse.teamID, apiResponse.qualifiedID)
}

func registerTeamMember(
email: String,
password: String,
name: String,
invitationCode: String
) async throws -> String {
) async throws -> QualifiedID {
let path = "\(pathPrefix)/register"

let body = try JSONEncoder.defaultEncoder.encode(
Expand All @@ -463,11 +463,11 @@ class AuthenticationAPIV0: AuthenticationAPI, VersionedAPI {

let (data, response) = try await networkService.executeRequest(request)

let payload = try ResponseParser()
let apiResponse = try ResponseParser()
.success(code: .created, type: RegisterUserResponseV0.self)
.parse(code: response.statusCode, data: data)

return payload.id
return apiResponse.qualifiedID
}

func getInvitationCode(teamID: UUID, invitationID: UUID) async throws -> String {
Expand All @@ -486,37 +486,80 @@ class AuthenticationAPIV0: AuthenticationAPI, VersionedAPI {

return payload.code
}
}

private struct RegisterAccountRequestBodyV0: Encodable {
var email: String
var name: String
var password: String
}
private struct RegisterAccountRequestBodyV0: Encodable {
var email: String
var name: String
var password: String
}

private struct ActivateRequestBodyV0: Encodable {
var key: String
var code: String
var email: String
var dryrun: Bool
}
private struct ActivateRequestBodyV0: Encodable {
var key: String
var code: String
var email: String
var dryrun: Bool
}

private struct RegisterTeamOwnerBodyV0: Encodable {
var email: String
var password: String
var name: String
var team: TeamInfo

private struct RegisterTeamOwnerBodyV0: Encodable {
var email: String
var password: String
struct TeamInfo: Encodable {
var name: String
var team: TeamInfo
var icon: String
var binding: Bool
}
}

struct TeamInfo: Encodable {
var name: String
var icon: String
var binding: Bool
}
private struct RegisterTeamMemberBodyV0: Encodable {
var email: String
var password: String
var name: String
var team_code: String
}

struct RegisterUserResponseV0: Decodable, ToAPIModelConvertible {

let accentID: Int
let assets: [UserAssetV0]?
let email: String?
let id: String
let locale: String
let managedBy: ManagedByV0?
let name: String
let picture: [String]?
let qualifiedID: QualifiedIDV0
let status: String?
let teamID: UUID?

enum CodingKeys: String, CodingKey {
case accentID = "accent_id"
case assets, email
case id
case locale
case managedBy = "managed_by"
case name, picture
case qualifiedID = "qualified_id"
case status
case teamID = "team"
}

private struct RegisterTeamMemberBodyV0: Encodable {
var email: String
var password: String
var name: String
var team_code: String
func toAPIModel() -> RegisterUserResponse {
RegisterUserResponse(
id: id,
qualifiedID: qualifiedID.toAPIModel(),
name: name,
teamID: teamID,
accentID: accentID,
managedBy: managedBy?.toAPIModel(),
assets: assets?.map { $0.toAPIModel() },
picture: picture,
email: email,
status: status,
supportedProtocols: [.proteus]
)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public protocol ConversationsAPI {
func getLegacyConversationIdentifiers() async throws -> PayloadPager<[UUID]>

/// Fetch all conversation identifiers in batches available from ``APIVersion`` v1.
func getConversationIdentifiers() async throws -> PayloadPager<[QualifiedID]>
#if DEBUG
func getConversationIdentifiers() async throws -> PayloadPager<[QualifiedID]>
#endif

/// Fetch conversation list with qualified identifiers.
func getConversations(for identifiers: [QualifiedID]) async throws -> ConversationList
Expand All @@ -52,10 +54,11 @@ public protocol ConversationsAPI {
/// Creates a group conversation given provided parameters.
/// - parameter parameters: API body parameters required to create the group.
/// - returns: The created group conversation.

func createGroupConversation(
parameters: CreateGroupConversationParameters
) async throws -> Conversation
#if DEBUG
func createGroupConversation(
parameters: CreateGroupConversationParameters
) async throws -> Conversation
#endif

/// Add channel permission.
/// - parameter conversationID: The conversation ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ import Foundation

class ConversationsAPIV8: ConversationsAPIV7 {
override var apiVersion: APIVersion { .v8 }
override var basePath: String {
"/conversations"
}

// MARK: - Constants

enum Constants {
static let batchSize = 500
}

override func getConversations(for identifiers: [QualifiedID]) async throws -> ConversationList {
guard 1 ... 1000 ~= identifiers.count else {
Expand Down Expand Up @@ -158,6 +167,30 @@ class ConversationsAPIV8: ConversationsAPIV7 {
}

}

override func getConversationIdentifiers() async throws -> PayloadPager<[QualifiedID]> {
let path = "\(pathPrefix)\(basePath)/list-ids"

return PayloadPager<[QualifiedID]> { start in
let params = PaginationRequest(pagingState: start, size: Constants.batchSize)
let body = try JSONEncoder.defaultEncoder.encode(params)

let request = try URLRequestBuilder(path: path)
.withMethod(.post)
.withBody(body, contentType: .json)
.build()

let (data, response) = try await self.apiService.executeRequest(
request,
requiringAccessToken: true
)

return try ResponseParser()
.success(code: .ok, type: PaginatedConversationIDsV8.self)
.parse(code: response.statusCode, data: data)
}
}

}

// MARK: - Encodables
Expand Down Expand Up @@ -268,7 +301,6 @@ struct CreateGroupConversationParametersV8: Encodable {
self.messageProtocol = parameters.messageProtocol.toNetworkModel().rawValue
self.conversationGroupType = parameters.groupType.toNetworkModel()
}

}

// MARK: - Decodables
Expand Down Expand Up @@ -346,3 +378,24 @@ struct ConversationV8: Decodable, ToAPIModelConvertible {
)
}
}

private struct PaginatedConversationIDsV8: Decodable, ToAPIModelConvertible {

enum CodingKeys: String, CodingKey {
case conversationIDs = "qualified_conversations"
case pagingState = "paging_state"
case hasMore = "has_more"
}

let conversationIDs: [QualifiedIDV0]
let pagingState: String
let hasMore: Bool

func toAPIModel() -> PayloadPager<[QualifiedID]>.Page {
PayloadPager<[QualifiedID]>.Page(
element: conversationIDs.map { $0.toAPIModel() },
hasMore: hasMore,
nextStart: pagingState
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,79 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
import Foundation

class SelfUserAPIV8: SelfUserAPIV7 {
override var apiVersion: APIVersion { .v8 }

override func getSelfUser() async throws -> SelfUser {
let request = try URLRequestBuilder(path: resourcePath)
.withMethod(.get)
.build()

let (data, response) = try await apiService.executeRequest(
request,
requiringAccessToken: true
)

return try ResponseParser()
.success(code: .ok, type: SelfUserV8.self)
.parse(code: response.statusCode, data: data)
}
}

struct SelfUserV8: Decodable, ToAPIModelConvertible {

let accentID: Int
let assets: [UserAssetV0]?
let deleted: Bool?
let email: String?
let expiresAt: UTCTime?
let handle: String?
let id: UUID
let locale: String
let managedBy: ManagedByV0?
let name: String
let phone: String?
let picture: [String]?
let qualifiedID: QualifiedIDV0
let service: ServiceResponseV0?
let ssoID: SSOIDV0?
let supportedProtocols: Set<MessageProtocolV0>?
let teamID: UUID?

enum CodingKeys: String, CodingKey {
case accentID = "accent_id"
case assets, deleted, email
case expiresAt = "expires_at"
case handle, id, locale
case managedBy = "managed_by"
case name, phone, picture
case qualifiedID = "qualified_id"
case service
case ssoID = "sso_id"
case teamID = "team"
case supportedProtocols = "supported_protocols"
}

func toAPIModel() -> SelfUser {
let supportedProtocols = supportedProtocols?.map { $0.toAPIModel() } ?? [.proteus]
return SelfUser(
id: id,
qualifiedID: qualifiedID.toAPIModel(),
ssoID: ssoID?.toAPIModel(),
name: name,
handle: handle,
teamID: teamID,
phone: phone,
accentID: accentID,
managedBy: managedBy?.toAPIModel(),
assets: assets?.map { $0.toAPIModel() },
deleted: deleted,
email: email,
expiresAt: expiresAt?.date,
service: service?.toAPIModel(),
supportedProtocols: Set(supportedProtocols)
)
}
}
Loading