validateOptions function

void validateOptions(
  1. SendNotificationInputOptions options
)

Implementation

void validateOptions(SendNotificationInputOptions options) {
  if (!isValidETHAddress(options.channel)) {
    throw '[Push SDK] - Error - sendNotification() - "channel" is invalid!';
  }
  if (options.senderType == 0 && options.signer == null) {
    throw '[Push SDK] - Error - sendNotification() - "signer" is mandatory for this signerType!';
  }
  if (options.senderType == 1 && options.pgpPrivateKey == null) {
    throw '[Push SDK] - Error - sendNotification() - "pgpPrivateKey" is mandatory for this signerType!';
  }

  if (options.identityType == IDENTITY_TYPE.DIRECT_PAYLOAD ||
      options.identityType == IDENTITY_TYPE.MINIMAL) {
    if (options.notification == null) {
      throw '[Push SDK] - Error - sendNotification() - "notification" mandatory for Identity Type: Direct Payload, Minimal!';
    }
    if (options.payload == null) {
      throw '[Push SDK] - Error - sendNotification() - "payload" mandatory for Identity Type: Direct Payload, Minimal!';
    }
  }
}