Skip to content

Commit

Permalink
Added WithPayDate method to ListDividendsParams (#430)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Action <[email protected]>
  • Loading branch information
justinpolygon and actions-user authored Jun 24, 2024
1 parent ec83a35 commit 0afa540
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)

<!-- todo: add a codecov badge -->
<!-- todo: figure out a way to show all build statuses -->
Expand Down
16 changes: 16 additions & 0 deletions rest/models/dividends.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions rest/models/dividends_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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).
Expand Down

0 comments on commit 0afa540

Please sign in to comment.