Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
a156dc67
Commit
a156dc67
authored
Sep 21, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update RestApiHelper.kt
parent
93a0e9ca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
19 deletions
+31
-19
RestApiHelper.kt
...c/main/java/chat/rocket/android/api/rest/RestApiHelper.kt
+31
-19
No files found.
app/src/main/java/chat/rocket/android/api/rest/RestApiHelper.kt
View file @
a156dc67
...
@@ -20,17 +20,20 @@ object RestApiHelper {
...
@@ -20,17 +20,20 @@ object RestApiHelper {
* @param hostname The server hostname.
* @param hostname The server hostname.
* @param token The token.
* @param token The token.
* @param userId The user Id.
* @param userId The user Id.
* @param offset The offset to paging which specifies the first entry to return from a collection.
* @return An OkHttp3 request.
* @return An OkHttp3 request.
*/
*/
fun
getRequestForPinnedMessages
(
roomId
:
String
,
fun
getRequestForPinnedMessages
(
roomId
:
String
,
roomType
:
String
,
roomType
:
String
,
hostname
:
String
,
hostname
:
String
,
token
:
String
,
token
:
String
,
userId
:
String
):
Request
{
userId
:
String
,
offset
:
String
):
Request
{
val
parsedHttpUrl
=
HttpUrl
.
parse
(
getEndpointUrlForMessages
(
roomType
,
hostname
))
val
parsedHttpUrl
=
HttpUrl
.
parse
(
getEndpointUrlForMessages
(
roomType
,
hostname
))
?.
newBuilder
()
?.
newBuilder
()
?.
addQueryParameter
(
"roomId"
,
roomId
)
?.
addQueryParameter
(
"roomId"
,
roomId
)
?.
addQueryParameter
(
"query"
,
"{\"pinned\":true}"
)
?.
addQueryParameter
(
"query"
,
"{\"pinned\":true}"
)
?.
addQueryParameter
(
"offset"
,
offset
)
?.
build
()
?.
build
()
return
Request
.
Builder
()
return
Request
.
Builder
()
...
@@ -49,17 +52,20 @@ object RestApiHelper {
...
@@ -49,17 +52,20 @@ object RestApiHelper {
* @param hostname The server hostname.
* @param hostname The server hostname.
* @param token The token.
* @param token The token.
* @param userId The user Id.
* @param userId The user Id.
* @param offset The offset to paging which specifies the first entry to return from a collection.
* @return An OkHttp3 request.
* @return An OkHttp3 request.
*/
*/
fun
getRequestForFavoriteMessages
(
roomId
:
String
,
fun
getRequestForFavoriteMessages
(
roomId
:
String
,
roomType
:
String
,
roomType
:
String
,
hostname
:
String
,
hostname
:
String
,
token
:
String
,
token
:
String
,
userId
:
String
):
Request
{
userId
:
String
,
offset
:
String
):
Request
{
val
parsedHttpUrl
=
HttpUrl
.
parse
(
getEndpointUrlForMessages
(
roomType
,
hostname
))
val
parsedHttpUrl
=
HttpUrl
.
parse
(
getEndpointUrlForMessages
(
roomType
,
hostname
))
?.
newBuilder
()
?.
newBuilder
()
?.
addQueryParameter
(
"roomId"
,
roomId
)
?.
addQueryParameter
(
"roomId"
,
roomId
)
?.
addQueryParameter
(
"query"
,
"{\"starred._id\":{\"\$in\":[\"$userId\"] } }"
)
?.
addQueryParameter
(
"query"
,
"{\"starred._id\":{\"\$in\":[\"$userId\"] } }"
)
?.
addQueryParameter
(
"offset"
,
offset
)
?.
build
()
?.
build
()
return
Request
.
Builder
()
return
Request
.
Builder
()
...
@@ -78,16 +84,19 @@ object RestApiHelper {
...
@@ -78,16 +84,19 @@ object RestApiHelper {
* @param hostname The server hostname.
* @param hostname The server hostname.
* @param token The token.
* @param token The token.
* @param userId The user Id.
* @param userId The user Id.
* @param offset The offset to paging which specifies the first entry to return from a collection.
* @return An OkHttp3 request.
* @return An OkHttp3 request.
*/
*/
fun
getRequestForFileList
(
roomId
:
String
,
fun
getRequestForFileList
(
roomId
:
String
,
roomType
:
String
,
roomType
:
String
,
hostname
:
String
,
hostname
:
String
,
token
:
String
,
token
:
String
,
userId
:
String
):
Request
{
userId
:
String
,
offset
:
String
):
Request
{
val
parsedHttpUrl
=
HttpUrl
.
parse
(
getEndpointUrlForFileList
(
roomType
,
hostname
))
val
parsedHttpUrl
=
HttpUrl
.
parse
(
getEndpointUrlForFileList
(
roomType
,
hostname
))
?.
newBuilder
()
?.
newBuilder
()
?.
addQueryParameter
(
"roomId"
,
roomId
)
?.
addQueryParameter
(
"roomId"
,
roomId
)
?.
addQueryParameter
(
"offset"
,
offset
)
?.
build
()
?.
build
()
return
Request
.
Builder
()
return
Request
.
Builder
()
...
@@ -106,16 +115,19 @@ object RestApiHelper {
...
@@ -106,16 +115,19 @@ object RestApiHelper {
* @param hostname The server hostname.
* @param hostname The server hostname.
* @param token The token.
* @param token The token.
* @param userId The user Id.
* @param userId The user Id.
* @param offset The offset to paging which specifies the first entry to return from a collection.
* @return An OkHttp3 request.
* @return An OkHttp3 request.
*/
*/
fun
getRequestForMemberList
(
roomId
:
String
,
fun
getRequestForMemberList
(
roomId
:
String
,
roomType
:
String
,
roomType
:
String
,
hostname
:
String
,
hostname
:
String
,
token
:
String
,
token
:
String
,
userId
:
String
):
Request
{
userId
:
String
,
offset
:
String
):
Request
{
val
parsedHttpUrl
=
HttpUrl
.
parse
(
getEndpointUrlForMemberList
(
roomType
,
hostname
))
val
parsedHttpUrl
=
HttpUrl
.
parse
(
getEndpointUrlForMemberList
(
roomType
,
hostname
))
?.
newBuilder
()
?.
newBuilder
()
?.
addQueryParameter
(
"roomId"
,
roomId
)
?.
addQueryParameter
(
"roomId"
,
roomId
)
?.
addQueryParameter
(
"offset"
,
offset
)
?.
build
()
?.
build
()
return
Request
.
Builder
()
return
Request
.
Builder
()
...
@@ -166,7 +178,7 @@ object RestApiHelper {
...
@@ -166,7 +178,7 @@ object RestApiHelper {
var
restApiUrl
:
String
?
=
null
var
restApiUrl
:
String
?
=
null
when
(
roomType
)
{
when
(
roomType
)
{
Room
.
TYPE_CHANNEL
->
restApiUrl
=
"/api/v1/channels.messages"
Room
.
TYPE_CHANNEL
->
restApiUrl
=
"/api/v1/channels.messages"
Room
.
TYPE_PRIVATE
->
restApiUrl
=
"/api/v1/groups.messages"
Room
.
TYPE_PRIVATE
->
restApiUrl
=
"/api/v1/groups.messages"
Room
.
TYPE_DIRECT_MESSAGE
->
restApiUrl
=
"/api/v1/dm.messages"
Room
.
TYPE_DIRECT_MESSAGE
->
restApiUrl
=
"/api/v1/dm.messages"
}
}
return
restApiUrl
return
restApiUrl
...
@@ -182,7 +194,7 @@ object RestApiHelper {
...
@@ -182,7 +194,7 @@ object RestApiHelper {
var
restApiUrl
:
String
?
=
null
var
restApiUrl
:
String
?
=
null
when
(
roomType
)
{
when
(
roomType
)
{
Room
.
TYPE_CHANNEL
->
restApiUrl
=
"/api/v1/channels.files"
Room
.
TYPE_CHANNEL
->
restApiUrl
=
"/api/v1/channels.files"
Room
.
TYPE_PRIVATE
->
restApiUrl
=
"/api/v1/groups.files"
Room
.
TYPE_PRIVATE
->
restApiUrl
=
"/api/v1/groups.files"
Room
.
TYPE_DIRECT_MESSAGE
->
restApiUrl
=
"/api/v1/dm.files"
Room
.
TYPE_DIRECT_MESSAGE
->
restApiUrl
=
"/api/v1/dm.files"
}
}
return
restApiUrl
return
restApiUrl
...
@@ -198,7 +210,7 @@ object RestApiHelper {
...
@@ -198,7 +210,7 @@ object RestApiHelper {
var
restApiUrl
:
String
?
=
null
var
restApiUrl
:
String
?
=
null
when
(
roomType
)
{
when
(
roomType
)
{
Room
.
TYPE_CHANNEL
->
restApiUrl
=
"/api/v1/channels.members"
Room
.
TYPE_CHANNEL
->
restApiUrl
=
"/api/v1/channels.members"
Room
.
TYPE_PRIVATE
->
restApiUrl
=
"/api/v1/groups.members"
Room
.
TYPE_PRIVATE
->
restApiUrl
=
"/api/v1/groups.members"
Room
.
TYPE_DIRECT_MESSAGE
->
restApiUrl
=
"/api/v1/dm.members"
Room
.
TYPE_DIRECT_MESSAGE
->
restApiUrl
=
"/api/v1/dm.members"
}
}
return
restApiUrl
return
restApiUrl
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment