diff --git a/event.go b/event.go index be09989..439aa05 100644 --- a/event.go +++ b/event.go @@ -91,34 +91,32 @@ func (e *Event) All(ctx context.Context, query *EventParams) (*ListEventResponse return respPtr, nil } -func (e *Event) Create(ctx context.Context, body *CreateEventRequest) (*EventResponse, error) { +func (e *Event) Create(ctx context.Context, body *CreateEventRequest) error { url, err := addOptions(e.generateUrl(), nil) if err != nil { - return nil, err + return err } - respPtr := &EventResponse{} - err = postJSON(ctx, e.client, url, body, respPtr) + err = postJSON(ctx, e.client, url, body, nil) if err != nil { - return nil, err + return err } - return respPtr, nil + return nil } -func (e *Event) FanoutEvent(ctx context.Context, body *CreateFanoutEventRequest) (*EventResponse, error) { +func (e *Event) FanoutEvent(ctx context.Context, body *CreateFanoutEventRequest) error { url, err := addOptions(e.generateUrl()+"/fanout", nil) if err != nil { - return nil, err + return err } - respPtr := &EventResponse{} - err = postJSON(ctx, e.client, url, body, respPtr) + err = postJSON(ctx, e.client, url, body, nil) if err != nil { - return nil, err + return err } - return respPtr, nil + return nil } func (e *Event) Find(ctx context.Context, eventID string) (*EventResponse, error) { diff --git a/subscription.go b/subscription.go index cda49d2..fdf9646 100644 --- a/subscription.go +++ b/subscription.go @@ -37,8 +37,14 @@ type RetryConfiguration struct { RetryCount int `json:"retry_count"` } +type Filter struct { + Body map[string]interface{} `json:"body"` + Headers map[string]interface{} `json:"headers"` +} + type FilterConfiguration struct { EventTypes []string `json:"event_types" bson:"event_types,omitempty"` + Filter Filter `json:"filter" bson:"filter,omitempty"` } type SubscriptionResponse struct {