Exemplo n.º 1
0
        public void Read(BinaryReader reader)
        {
            int num = reader.ReadInt32();

            this._messageText = reader.ReadString();
            List <OutboundAttachmentContainer> source = reader.ReadList <OutboundAttachmentContainer>();

            this._attachments.Clear();
            foreach (IOutboundAttachment outboundAttachment in source.Select <OutboundAttachmentContainer, IOutboundAttachment>((Func <OutboundAttachmentContainer, IOutboundAttachment>)(c => c.OutboundAttachment)))
            {
                this._attachments.Add(outboundAttachment);
            }
            this._outboundMessageStatus = (OutboundMessageStatus)reader.ReadInt32();
            if (this._outboundMessageStatus == OutboundMessageStatus.SendingNow)
            {
                this._outboundMessageStatus = OutboundMessageStatus.Failed;
            }
            this._deliveredMessageId = reader.ReadInt64();
            this._isChat             = reader.ReadBoolean();
            this._userOrChatId       = reader.ReadInt64();
            this._deliveryDateTime   = reader.ReadDateTime();
            this.StickerItem         = reader.ReadGeneric <StickerItemData>();
            if (num >= 2)
            {
                this.StickerReferrer = reader.ReadString();
            }
            if (num < 3)
            {
                return;
            }
            this.GraffitiAttachmentItem = reader.ReadGeneric <GraffitiAttachmentItem>();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Return a listing of Outbound sent messages using the filters supported by the API.
        /// </summary>
        /// <param name="recipient">Filter by the recipient(s) of the message.</param>
        /// <param name="fromemail">Filter by the email address the message is sent from.</param>
        /// <param name="tag">Filter by a tag used for the message (messages sent directly through the API only)</param>
        /// <param name="subject">Filter by message subject.</param>
        /// <param name="count">Number of messages to return per call. (required)</param>
        /// <param name="offset">Number of messages to offset/page per call. (required)</param>
        /// <param name="status">The status of the outbound message.</param>
        /// <param name="fromDate">Get messages on or after YYYY-MM-DD.</param>
        /// <param name="toDate">Get messages on or before YYYY-MM-DD.</param>
        /// <returns>PostmarkOutboundMessageList</returns>
        public async Task <PostmarkOutboundMessageList> GetOutboundMessagesAsync(int offset                   = 0, int count = 100,
                                                                                 string recipient             = null, string fromemail = null, string tag = null, string subject = null,
                                                                                 OutboundMessageStatus status = OutboundMessageStatus.Sent, string toDate = null, string fromDate = null, IDictionary <string, string> metadata = null)
        {
            var parameters = new Dictionary <string, object>();

            parameters["count"]     = count;
            parameters["offset"]    = offset;
            parameters["recipient"] = recipient;
            parameters["fromemail"] = fromemail;
            parameters["tag"]       = tag;
            parameters["subject"]   = subject;
            parameters["todate"]    = toDate;
            parameters["fromdate"]  = fromDate;
            parameters["status"]    = status.ToString().ToLower();

            if (metadata != null)
            {
                foreach (var a in metadata)
                {
                    parameters[$"metadata_{a.Key}"] = a.Value;
                }
            }

            return(await ProcessNoBodyRequestAsync <PostmarkOutboundMessageList>("/messages/outbound", parameters));
        }
Exemplo n.º 3
0
 public void Send()
 {
     if (this._outboundMessageStatus == OutboundMessageStatus.Delivered || this._outboundMessageStatus == OutboundMessageStatus.SendingNow)
     {
         // ISSUE: reference to a compiler-generated field
         if (this.UploadFinished == null)
         {
             return;
         }
         // ISSUE: reference to a compiler-generated field
         this.UploadFinished((object)this, EventArgs.Empty);
     }
     else
     {
         this._outboundMessageStatus = OutboundMessageStatus.SendingNow;
         this._uploadJobId           = Guid.NewGuid();
         this.UploadProgress         = 0.0;
         this.StartSendingByAttachmentInd(0, this._uploadJobId);
     }
 }