From 0afa540d44f2204ac509462a53c6f8449f5f159c Mon Sep 17 00:00:00 2001 From: justinpolygon <123573436+justinpolygon@users.noreply.github.com> Date: Mon, 24 Jun 2024 07:52:01 -0700 Subject: [PATCH] Added WithPayDate method to ListDividendsParams (#430) Co-authored-by: GitHub Action --- README.md | 2 +- rest/models/dividends.go | 16 ++++++++++++++++ rest/models/dividends_test.go | 10 ++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ba44ef24..7fa5e445 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Polygon Go Client -![Coverage](https://img.shields.io/badge/Coverage-76.5%25-brightgreen) +![Coverage](https://img.shields.io/badge/Coverage-76.7%25-brightgreen) diff --git a/rest/models/dividends.go b/rest/models/dividends.go index b2512e45..c5cfa398 100644 --- a/rest/models/dividends.go +++ b/rest/models/dividends.go @@ -111,6 +111,22 @@ func (p ListDividendsParams) WithDeclarationDate(c Comparator, q Date) *ListDivi return &p } +func (p ListDividendsParams) WithPayDate(c Comparator, q Date) *ListDividendsParams { + switch c { + case EQ: + p.PayDateEQ = &q + case LT: + p.PayDateLT = &q + case LTE: + p.PayDateLTE = &q + case GT: + p.PayDateGT = &q + case GTE: + p.PayDateGTE = &q + } + return &p +} + func (p ListDividendsParams) WithFrequency(q Frequency) *ListDividendsParams { p.Frequency = &q return &p diff --git a/rest/models/dividends_test.go b/rest/models/dividends_test.go index e46645cd..bfabb381 100644 --- a/rest/models/dividends_test.go +++ b/rest/models/dividends_test.go @@ -32,6 +32,11 @@ func TestListDividendsParams(t *testing.T) { DeclarationDateLTE: &date, DeclarationDateGT: &date, DeclarationDateGTE: &date, + PayDateEQ: &date, + PayDateLT: &date, + PayDateLTE: &date, + PayDateGT: &date, + PayDateGTE: &date, CashAmountEQ: &cash, CashAmountLT: &cash, CashAmountLTE: &cash, @@ -59,6 +64,11 @@ func TestListDividendsParams(t *testing.T) { WithDeclarationDate(models.LTE, date). WithDeclarationDate(models.GT, date). WithDeclarationDate(models.GTE, date). + WithPayDate(models.EQ, date). + WithPayDate(models.LT, date). + WithPayDate(models.LTE, date). + WithPayDate(models.GT, date). + WithPayDate(models.GTE, date). WithCashAmount(models.EQ, cash). WithCashAmount(models.LT, cash). WithCashAmount(models.LTE, cash).