@@ -31,15 +31,15 @@ extension Double {
31
31
}
32
32
}
33
33
34
- // Structure for request body of posting a message
34
+ /// Structure for request body of posting a message
35
35
struct PostMessageRequest : Codable {
36
36
let user_id : String
37
37
let text : String
38
38
let visibility : String
39
39
let location : GeoJSONPoint
40
40
}
41
41
42
- /// Structure for response of a message
42
+ //// Structure for response of a message
43
43
struct MessageResponse : Codable {
44
44
let _id : String
45
45
let user_id : String
@@ -48,17 +48,17 @@ struct MessageResponse: Codable {
48
48
let location : GeoJSONPoint
49
49
}
50
50
51
- /// Structure for response of adding a friend
51
+ //// Structure for response of adding a friend
52
52
struct AddFriendResponse : Codable {
53
53
let message : String
54
54
}
55
55
56
- /// Structure for request body of adding a friend
56
+ //// Structure for request body of adding a friend
57
57
struct FriendRequest : Codable {
58
58
let friendName : String
59
59
}
60
60
61
- /// Structure for user message data
61
+ //// Structure for user message data
62
62
struct UserMessage : Codable {
63
63
struct Location : Codable {
64
64
let type : String
@@ -74,7 +74,7 @@ struct UserMessage: Codable {
74
74
let replies : [ String ]
75
75
}
76
76
77
- /// Function to fetch user messages
77
+ //// Function to fetch user messages
78
78
func getUserMessages( userId: String , completion: @escaping ( Result < [ MessageResponse ] , Error > ) -> Void ) {
79
79
// API URL
80
80
let urlString = " https://here-swe.vercel.app/user/ \( userId) /messages "
@@ -127,6 +127,13 @@ func getUserMessages(userId: String, completion: @escaping (Result<[MessageRespo
127
127
128
128
}
129
129
130
+ /// Posts a message to a remote server.
131
+ /// - Parameters:
132
+ /// - user_id: A `String` representing the user's ID.
133
+ /// - text: The text content of the message.
134
+ /// - visibility: The visibility status of the message.
135
+ /// - locationDataManager: A `LocationDataManager` to provide the current location.
136
+ /// - completion: A completion handler that returns either `MessageResponse` or `Error`.
130
137
/// Posts a message to a remote server.
131
138
/// - Parameters:
132
139
/// - user_id: A `String` representing the user's ID.
@@ -182,6 +189,8 @@ func postMessage(user_id: String, text: String, visibility: String, locationData
182
189
183
190
// Function to get all friends of a user
184
191
func getAllUserFriends( userId: String , completion: @escaping ( Result < [ String : String ] , Error > ) -> Void ) {
192
+ /// Function to get all friends of a user
193
+ func getAllUserFriends( userId: String , completion: @escaping ( Result < [ String ] , Error > ) -> Void ) {
185
194
// API URL
186
195
let urlString = " https://here-swe.vercel.app/user/ \( userId) /friends "
187
196
0 commit comments