ActiveCampaign / postmark-dotnet

A .NET library for the Postmark API
http://developer.postmarkapp.com/
Other
50 stars 46 forks source link

Please, add messagestream parameter to GetOutboundMessagesAsync method. #127

Closed jgomila closed 8 months ago

jgomila commented 8 months ago

The GetOutboundMessagesAsync do not have messagestream parameter, so retrieve messages from broadcast stream is not possible now.

I had to change it in a cloned version. Can I create a PR?

    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, string messagestream = 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 (messagestream != null)
            {
                parameters["messagestream"] = messagestream;
            } 

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

            return await ProcessNoBodyRequestAsync<PostmarkOutboundMessageList>("/messages/outbound", parameters);
        }
MariuszTrybus commented 8 months ago

@jgomila Thank you! The change is released as 4.7.12.