One-time link - java/groovy api examples
Basic interface for creating and retrieving data
package com.jibrok.atlassian.jira.plugins.onetimelink;
/*
Methods "Create" return key for url (http://localhost:2990/jira/rest/jibrok/onetimelink/1.0/get/${key}).
If 'deleteAfter' is null - the default is 7 days.
*/
public interface MessageManager {
String getData(String key, String password)
String getData(String key)
//encode with base64 string in DB
String createMessage(String body, boolean publicAccess, boolean delAfterReading, Date deleteAfter);
String createMessage(String body, boolean publicAccess, String userName, boolean delAfterReading, Date deleteAfter);
String createMessage(String body, boolean publicAccess, ApplicationUser user, boolean delAfterReading, Date deleteAfter);
//encode with AES-256 string in DB
String createMessageEncrypt(String body, boolean publicAccess, boolean delAfterReading, Date deleteAfter);
String createMessageEncrypt(String body, boolean publicAccess, String userName, boolean delAfterReading, Date deleteAfter);
String createMessageEncrypt(String body, boolean publicAccess, ApplicationUser user, boolean delAfterReading, Date deleteAfter);
//encode with AES-256 string in DB
String createMessageWithPassword(String body, String password, boolean publicAccess, boolean delAfterReading, Date deleteAfter);
String createMessageWithPassword(String body, String password, boolean publicAccess, String userName, boolean delAfterReading, Date deleteAfter);
String createMessageWithPassword(String body, String password, boolean publicAccess, ApplicationUser user, boolean delAfterReading, Date deleteAfter);
}
import com.jibrok.atlassian.jira.plugins.onetimelink.MessageManager
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin('com.jibrok.atlassian.jira.plugins.one-time-link')
@PluginModule
MessageManager messageManager;
messageManager.createMessage('body', false, false, null)
messageManager.createMessageWithPassword('body', "123", false, false, null)
messageManager.createMessageEncrypt('body', false, false, null)