/// <summary> /// Wrapper to send image message E2E <see cref="Threema.MsgApi.E2EHelper.SendImageMessage"/> /// </summary> /// <param name="to">Recipient id</param> /// <param name="from">Sender id</param> /// <param name="secret">Sender sercret</param> /// <param name="privateKey">Sender private key</param> /// <param name="imageFilePath">File path to image</param> /// <param name="apiUrl">Optional api url</param> /// <returns>Message id</returns> public string SendImageMessage(string to, string from, string secret, string privateKey, string imageFilePath, string apiUrl = APIConnector.DEFAULTAPIURL) { byte[] privateKeyBytes = GetKey(privateKey, Key.KeyType.PRIVATE); E2EHelper e2EHelper = new E2EHelper(this.CreateConnector(from, secret, apiUrl), privateKeyBytes); return(e2EHelper.SendImageMessage(to, imageFilePath)); }
protected override void Execute() { string to = this.toField.Value; string from = this.fromField.Value; string secret = this.secretField.Value; byte[] privateKey = this.privateKeyField.GetValue(); string imageFilePath = this.imageFilePath.GetValue(); E2EHelper e2EHelper = new E2EHelper(this.CreateConnector(from, secret), privateKey); string messageId = e2EHelper.SendImageMessage(to, imageFilePath); System.Console.WriteLine("MessageId: " + messageId); }