RefyRequester

class RefyRequester(host: String, userId: String? = null, userToken: String? = null) : EquinoxRequester

The RefyRequester class is useful to communicate with Refy's backend

Author

N7ghtm4r3 - Tecknobit

Parameters

host

: the host address where is running the backend

userId

: the user identifier

userToken

: the user token

Constructors

Link copied to clipboard
constructor(host: String, userId: String? = null, userToken: String? = null)

Properties

Link copied to clipboard
protected val apiRequest: APIRequest
Link copied to clipboard
Link copied to clipboard
protected val connectionTimeout: Int
Link copied to clipboard
protected var debugMode: Boolean
Link copied to clipboard
Link copied to clipboard
protected val headers: APIRequest.Headers
Link copied to clipboard
protected var host: String
Link copied to clipboard
private val initHost: () -> Unit
Link copied to clipboard
Link copied to clipboard
protected val timeFormatter: TimeFormatter
Link copied to clipboard
protected var userId: String?
Link copied to clipboard
protected var userToken: String?

Functions

Link copied to clipboard
private fun assembleCollectionsEndpointPath(subEndpoint: String = "", query: String = ""): String

Function to assemble the endpoint to make the request to the collections controller

Link copied to clipboard
private fun assembleCustomEndpointPath(customEndpoint: String, subEndpoint: String = "", query: String = ""): String

Function to assemble the endpoint to make the request to the custom controllers

Link copied to clipboard
private fun assembleCustomLinksEndpointPath(subEndpoint: String = "", query: String = ""): String

Function to assemble the endpoint to make the request to the custom links controller

Link copied to clipboard
private fun assembleLinksEndpointPath(subEndpoint: String = "", query: String = ""): String

Function to assemble the endpoint to make the request to the links controller

Link copied to clipboard
private fun assembleTeamsEndpointPath(subEndpoint: String = "", query: String = ""): String

Function to assemble the endpoint to make the request to the teams controller

Link copied to clipboard
protected fun assembleUsersEndpointPath(endpoint: String): String
Link copied to clipboard
open fun changeEmail(newEmail: String): JSONObject
Link copied to clipboard
open override fun changeHost(host: String)
Link copied to clipboard
open fun changeLanguage(newLanguage: String): JSONObject
Link copied to clipboard
fun changeMemberRole(teamId: String, memberId: String, role: Team.RefyTeamMember.TeamRole): JSONObject

Function to execute the request to change the role of a member

Link copied to clipboard
open fun changePassword(newPassword: String): JSONObject
Link copied to clipboard
open fun changeProfilePic(profilePic: File): JSONObject
Link copied to clipboard
protected fun connectionErrorMessage(): JSONObject
Link copied to clipboard
fun createCollection(color: String, title: String, description: String, links: List<String>): JSONObject

Function to execute the request to create a collection

Link copied to clipboard
private fun createCollectionPayload(color: String, title: String, description: String, links: List<String>): APIRequest.Params

Function to create a payload for the collection creation/edit actions

Link copied to clipboard
fun createCustomLink(title: String, description: String, resources: Map<String, String>, fields: Map<String, String>, hasUniqueAccess: Boolean = false, expiredTime: CustomRefyLink.ExpiredTime = ExpiredTime.NO_EXPIRATION): JSONObject

Function to execute the request to create a custom link

Link copied to clipboard
private fun createCustomLinkPayload(title: String, description: String, resources: Map<String, String>, fields: Map<String, String>, hasUniqueAccess: Boolean, expiredTime: CustomRefyLink.ExpiredTime): APIRequest.Params

Function to create a payload for the custom link creation/edit actions

Link copied to clipboard
fun createLink(referenceLink: String, description: String): JSONObject

Function to execute the request to create a new link

Link copied to clipboard
private fun createLinkPayload(referenceLink: String, description: String): APIRequest.Params

Function to create a payload for the link creation/edit actions

Link copied to clipboard
private fun createOwnedOnlyQuery(ownedOnly: Boolean): String

Function to assemble the query to manage the owned only query

Link copied to clipboard
fun createTeam(title: String, logoPic: String, description: String, members: List<String>): JSONObject

Function to execute the request to create a team

Link copied to clipboard
private fun createTeamPayload(title: String, logoPic: File?, description: String, members: List<String>): MultipartBody

Function to create a payload for the team creation/edit actions

Link copied to clipboard
open fun deleteAccount(): JSONObject
Link copied to clipboard
fun deleteCollection(collection: LinksCollection): JSONObject
fun deleteCollection(collectionId: String): JSONObject

Function to execute the request to delete a collection

Link copied to clipboard
fun deleteCustomLink(link: CustomRefyLink): JSONObject
fun deleteCustomLink(linkId: String): JSONObject

Function to execute the request to delete a custom link

Link copied to clipboard
fun deleteLink(link: RefyLink): JSONObject
fun deleteLink(linkId: String): JSONObject

Function to execute the request to delete a link

Link copied to clipboard
fun deleteTeam(team: Team): JSONObject
fun deleteTeam(teamId: String): JSONObject

Function to execute the request to delete a team

Link copied to clipboard
fun editCollection(collection: LinksCollection, color: String, title: String, description: String, links: List<String>): JSONObject
fun editCollection(collectionId: String, color: String, title: String, description: String, links: List<String>): JSONObject

Function to execute the request to edit a collection

Link copied to clipboard
fun editCustomLink(link: CustomRefyLink, title: String, description: String, resources: Map<String, String>, fields: Map<String, String>, hasUniqueAccess: Boolean = false, expiredTime: CustomRefyLink.ExpiredTime = ExpiredTime.NO_EXPIRATION): JSONObject
fun editCustomLink(linkId: String, title: String, description: String, resources: Map<String, String>, fields: Map<String, String>, hasUniqueAccess: Boolean = false, expiredTime: CustomRefyLink.ExpiredTime = ExpiredTime.NO_EXPIRATION): JSONObject

Function to execute the request to edit a custom link

Link copied to clipboard
fun editLink(link: RefyLink, referenceLink: String, description: String): JSONObject
fun editLink(linkId: String, referenceLink: String, description: String): JSONObject

Function to execute the request to edit a link

Link copied to clipboard
fun editTeam(team: Team, title: String, logoPic: String, description: String, members: List<String>): JSONObject
fun editTeam(teamId: String, title: String, logoPic: String, description: String, members: List<String>): JSONObject

Function to execute the request to edit a team

Link copied to clipboard
protected fun execDelete(endpoint: String, payload: APIRequest.Params?): JSONObject
Link copied to clipboard
protected fun execGet(endpoint: String): JSONObject
Link copied to clipboard
protected fun execMultipartRequest(endpoint: String, body: MultipartBody): JSONObject
Link copied to clipboard
protected fun execPatch(endpoint: String, payload: APIRequest.Params): JSONObject
Link copied to clipboard
protected fun execPost(endpoint: String, payload: APIRequest.Params): JSONObject
Link copied to clipboard
protected fun execPut(endpoint: String, payload: APIRequest.Params): JSONObject
Link copied to clipboard
private fun execRequest(method: APIRequest.RequestMethod, endpoint: String, payload: APIRequest.Params?): JSONObject
Link copied to clipboard
fun getCollection(collection: LinksCollection): JSONObject
fun getCollection(collectionId: String): JSONObject

Function to execute the request to get a collection

Link copied to clipboard
fun getCollections(ownedOnly: Boolean = false): JSONObject

Function to execute the request to get the collections of the user

Link copied to clipboard
fun getCustomLink(link: CustomRefyLink): JSONObject
fun getCustomLink(linkId: String): JSONObject

Function to execute the request to get a custom link

Link copied to clipboard
fun getCustomLinks(): JSONObject

Function to execute the request to get the custom links of the user

Link copied to clipboard
fun getLinks(ownedOnly: Boolean = false): JSONObject

Function to execute the request to get the links of the user

Link copied to clipboard
fun getPotentialMembers(): JSONObject

Function to execute the request to get the potential members to add in a team

Link copied to clipboard
fun getTeam(team: Team): JSONObject
fun getTeam(teamId: String): JSONObject

Function to execute the request to get a team

Link copied to clipboard
fun getTeams(ownedOnly: Boolean = false): JSONObject

Function to execute the request to get the teams where the user is a member

Link copied to clipboard
private fun isSuccessfulResponse(response: JSONObject?): SocketManager.StandardResponseCode
Link copied to clipboard
fun leave(team: Team): JSONObject
fun leave(teamId: String): JSONObject

Function to execute the request to leave from a team

Link copied to clipboard
private fun logError(exception: Exception)
Link copied to clipboard
private fun logRequestInfo(requestUrl: String, requestPayloadInfo: () -> Unit, response: JSONObject?)
Link copied to clipboard
fun manageCollectionLinks(collection: LinksCollection, links: List<String>): JSONObject
fun manageCollectionLinks(collectionId: String, links: List<String>): JSONObject

Function to execute the request to manage the links shared with the collection

Link copied to clipboard
fun manageCollectionTeams(collection: LinksCollection, teams: List<String>): JSONObject
fun manageCollectionTeams(collectionId: String, teams: List<String>): JSONObject

Function to execute the request to manage the teams where the collection is shared

Link copied to clipboard
fun manageLinkCollections(link: RefyLink, collections: List<String>): JSONObject
fun manageLinkCollections(linkId: String, collections: List<String>): JSONObject

Function to execute the request to manage the collections where the link is shared

Link copied to clipboard
fun manageLinkTeams(link: RefyLink, teams: List<String>): JSONObject
fun manageLinkTeams(linkId: String, teams: List<String>): JSONObject

Function to execute the request to manage the teams where the link is shared

Link copied to clipboard
fun manageTeamCollections(team: Team, collections: List<String>): JSONObject
fun manageTeamCollections(teamId: String, collections: List<String>): JSONObject

Function to execute the request to manage the collections shared with the team

Link copied to clipboard
fun manageTeamLinks(team: Team, links: List<String>): JSONObject
fun manageTeamLinks(teamId: String, links: List<String>): JSONObject

Function to execute the request to manage the links shared with the team

Link copied to clipboard
fun removeMember(team: Team, member: Team.RefyTeamMember): JSONObject
fun removeMember(teamId: String, memberId: String): JSONObject

Function to execute the request to remove a member from the team

Link copied to clipboard
fun sendRequest(request: () -> JSONObject, onResponse: (JsonHelper) -> Unit, onConnectionError: (JsonHelper) -> Unit?)
fun sendRequest(request: () -> JSONObject, onSuccess: (JsonHelper) -> Unit, onFailure: (JsonHelper) -> Unit, onConnectionError: (JsonHelper) -> Unit?)
Link copied to clipboard
fun setConnectionTimeout(connectionTimeout: Int)
Link copied to clipboard
fun setUserCredentials(userId: String?, userToken: String?)
Link copied to clipboard
open fun signIn(email: String, password: String): JSONObject
Link copied to clipboard
open fun signUp(serverSecret: String, name: String, surname: String, email: String, password: String, language: String): JSONObject

fun signUp(serverSecret: String, tagName: String, name: String, surname: String, email: String, password: String, language: String): JSONObject

Function to execute the request to sign up in the Refy's system

Link copied to clipboard
private fun validateSelfSignedCertificate(okHttpClient: OkHttpClient): OkHttpClient