Links Controller

@RestController
@RequestMapping(value = "BASE_EQUINOX_ENDPOINT + USERS_KEY + "/{" + USER_IDENTIFIER_KEY + "}/" + LINKS_KEY" )
open class LinksController : DefaultRefyController<I>

The LinksController class is useful to manage all the RefyLink operations

Author

N7ghtm4r3 - Tecknobit

See also

EquinoxController

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
private val CONTENT_KEY: String = "content"
CONTENT_KEY constant value for the content value
Link copied to clipboard
protected open var jsonHelper: JsonHelper
Link copied to clipboard
@Autowired
protected open var linksCollectionsService: LinksCollectionsService
linksCollectionsService helper to manage the LinksCollection database operations
Link copied to clipboard
@Autowired
protected open var linksService: LinksService
linksService helper to manage the RefyLink database operations
Link copied to clipboard
protected val mantis: Mantis
Link copied to clipboard
protected open var me: T
Link copied to clipboard
Link copied to clipboard
private val OG_IMAGE_METADATA: String = "meta[property=og:image]"
OG_IMAGE_METADATA constant value to extract from an HTML page the og:image metadata property
Link copied to clipboard
open var resourcesProvider: ResourcesProvider
Link copied to clipboard
val RESPONSE_SUCCESSFUL_MESSAGE: String = "operation_executed_successfully_key"
Link copied to clipboard
protected open var serverProtector: ServerProtector
Link copied to clipboard
@Autowired
protected open var teamsService: TeamsService
teamsService helper to manage the Team database operations
Link copied to clipboard
protected open var userItem: I
userItem the current item requested by the user
Link copied to clipboard
protected open var usersRepository: R
Link copied to clipboard
val WRONG_PROCEDURE_MESSAGE: String = "wrong_procedure_key"

Functions

Link copied to clipboard
@PostMapping(headers = "token" )
open fun create(    @RequestHeader(value = "token") token: String,     @PathVariable(value = "user_id") userId: String,     @RequestBody payload: Map<String, Any>): String
Method to create a new link
Link copied to clipboard
@DeleteMapping(headers = "token", path = "/{" + LINK_IDENTIFIER_KEY + "}" )
open fun delete(    @RequestHeader(value = "token") token: String,     @PathVariable(value = "user_id") userId: String,     @PathVariable(value = "link_id") linkId: String): String
Method to delete a link
Link copied to clipboard
@PatchMapping(headers = "token", path = "/{" + LINK_IDENTIFIER_KEY + "}" )
open fun edit(    @RequestHeader(value = "token") token: String,     @PathVariable(value = "user_id") userId: String,     @PathVariable(value = "link_id") linkId: String,     @RequestBody payload: Map<String, Any>): String
Method to edit an existing link
Link copied to clipboard
protected open fun failedResponse(error: String): String
Link copied to clipboard
Link copied to clipboard
@GetMapping(headers = "token", path = "/{" + LINK_IDENTIFIER_KEY + "}" )
open fun <T> getItem(    @RequestHeader(value = "token") token: String,     @PathVariable(value = "user_id") userId: String,     @PathVariable(value = "link_id") linkId: String): T
Method to get a team
Link copied to clipboard
private open fun getMetadata(referenceLink: String): Pair<String, String>
Method to extract from the reference link the metadata information such website title and OG_IMAGE_METADATA property
Link copied to clipboard
open fun initEquinoxEnvironment(    storagePath: String,     saveMessage: String,     context: Class<out Any>,     args: Array<String>,     customSubDirectories: Array<String>)
Link copied to clipboard
protected open fun isMe(id: String, token: String): Boolean
Link copied to clipboard
protected open fun isUserNotAuthorized(userId: String, token: String, linkId: String): Boolean
Method to get whether the user is or not authorized to operate with the link requested
Link copied to clipboard
@GetMapping(headers = "token" )
open fun <T> list(    @RequestHeader(value = "token") token: String,     @PathVariable(value = "user_id") userId: String,     @RequestParam(name = "owned_only", defaultValue = "false", required = false) ownedOnly: Boolean,     @RequestParam(name = "page", defaultValue = "0", required = false) page: Int,     @RequestParam(name = "pageSize", defaultValue = "10", required = false) pageSize: Int,     @RequestParam(name = "keywords", defaultValue = "", required = false) keywords: Set<String>): T
Method to get a list of links
Link copied to clipboard
protected open fun <V> loadJsonHelper(payload: Map<String, V>)
Link copied to clipboard
@PutMapping(headers = "token", path = ""/{" + LINK_IDENTIFIER_KEY + "}/" + COLLECTIONS_KEY" )
open fun shareLinkWithCollections(    @RequestHeader(value = "token") token: String,     @PathVariable(value = "user_id") userId: String,     @PathVariable(value = "link_id") linkId: String,     @RequestBody payload: Map<String, Any>): String
Method to manage the collections where the link is shared
Link copied to clipboard
@PutMapping(headers = "token", path = ""/{" + LINK_IDENTIFIER_KEY + "}/" + TEAMS_KEY" )
open fun shareLinkWithTeams(    @RequestHeader(value = "token") token: String,     @PathVariable(value = "user_id") userId: String,     @PathVariable(value = "link_id") linkId: String,     @RequestBody payload: Map<String, Any>): String
Method to manage the teams where the link is shared
Link copied to clipboard
protected open fun successResponse(): String
protected open fun <V> successResponse(value: V): HashMap<String, V>
Link copied to clipboard
protected open fun userIsNotTheItemOwner(userId: String, token: String, itemId: String): Boolean
Method to get whether the user is or not the owner of the item requested