Skip to content

Commit

Permalink
Merge pull request #232 from Ginkosama/patch-1
Browse files Browse the repository at this point in the history
Add ListEventsWithDomain
  • Loading branch information
thrawn01 authored Sep 17, 2020
2 parents 5d5f55c + 13d31b5 commit 31174b4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion events.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,20 @@ type EventIterator struct {
err error
}

// Create an new iterator to fetch a page of events from the events api with a specific domain
func (mg *MailgunImpl) ListEventsWithDomain(opts *ListEventOptions, domain string) *EventIterator {
url := generateApiUrlWithDomain(mg, eventsEndpoint, domain)
return mg.listEvents(url, opts)
}

// Create an new iterator to fetch a page of events from the events api
func (mg *MailgunImpl) ListEvents(opts *ListEventOptions) *EventIterator {
req := newHTTPRequest(generateApiUrl(mg, eventsEndpoint))
url := generateApiUrl(mg, eventsEndpoint)
return mg.listEvents(url, opts)
}

func (mg *MailgunImpl) listEvents(url string, opts *ListEventOptions) *EventIterator {
req := newHTTPRequest(url)
if opts != nil {
if opts.Limit > 0 {
req.addParameter("limit", fmt.Sprintf("%d", opts.Limit))
Expand Down

0 comments on commit 31174b4

Please sign in to comment.