Name

sn_oe_sfs.VACommonPickerAdapter

Description

No description available

Script

var VACommonPickerAdapter = Class.create();
VACommonPickerAdapter.prototype = {
  initialize: function(channel) {
      this.channel = channel;
      this.inputBuilder = channel.inputBuilder;
      this.logger = new sn_oe_sfs.VACommonLogger(this.inputBuilder.getChannelLogger(), 'VACommonPickerAdapter');
      this.logger.debug("VACommonPickerAdapter channel: " + JSON.stringify(this.channel));
  },

  transform: function() {
      var result;

      var YOUTUBE_VIDEO_CARD = 'Youtube Video Card';
      var NOTIFICATION_CARD = 'Notification';
      var INFO_CARD_LARGE = 'Large image with text';
      var INFO_CARD_SMALL = 'Small image with text';
      try {

          if (this.inputBuilder.getScriptedData()) {
              var cardName = this.inputBuilder.getCardName();
              switch (cardName) {
                  case NOTIFICATION_CARD:
                      result = this.channel.buildNotificationCard();
                      break;
                  case INFO_CARD_LARGE:
                  case INFO_CARD_SMALL:
                  case YOUTUBE_VIDEO_CARD: //used in slack only. why info card building is named as Youtube Video Card ?
                      result = this.channel.buildVideoCard();
                      break;
                  default:
                      result = this.channel.buildDefaultCard();
                      break;
              }
          } else {
              result = this.channel.getPickerControl();
          }

          return result;
      } catch (e) {
          this.logger.error("Error in common picker adapter transform() : " + e.message);
          throw e;
      }
  },

  type: 'VACommonPickerAdapter'
};

Sys ID

bf88eb067323011065afe3d29f148bef

Offical Documentation

Official Docs: