mirror of
https://github.com/nikoksr/notify.git
synced 2025-01-22 03:09:35 +02:00
Merge pull request #252 from nikoksr/feat/options
feat(notify): add options
This commit is contained in:
commit
5e2e224428
63
.cliff.toml
63
.cliff.toml
@ -1,63 +0,0 @@
|
||||
# configuration file for git-cliff (0.1.0)
|
||||
|
||||
[changelog]
|
||||
# changelog header
|
||||
header = """
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.\n
|
||||
"""
|
||||
# template for the changelog body
|
||||
# https://tera.netlify.app/docs/#introduction
|
||||
body = """
|
||||
{% if version %}\
|
||||
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||
{% else %}\
|
||||
## [unreleased]
|
||||
{% endif %}\
|
||||
{% for group, commits in commits | group_by(attribute="group") %}
|
||||
### {{ group | upper_first }}
|
||||
{% for commit in commits %}
|
||||
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
|
||||
{% endfor %}
|
||||
{% endfor %}\n
|
||||
"""
|
||||
# remove the leading and trailing whitespaces from the template
|
||||
trim = true
|
||||
# changelog footer
|
||||
footer = """
|
||||
<!-- generated by git-cliff -->
|
||||
"""
|
||||
|
||||
[git]
|
||||
# parse the commits based on https://www.conventionalcommits.org
|
||||
conventional_commits = true
|
||||
# filter out the commits that are not conventional
|
||||
filter_unconventional = false
|
||||
# regex for parsing and grouping commits
|
||||
commit_parsers = [
|
||||
{ message = "^feat", group = "Features"},
|
||||
{ message = "^(fix|chore|build)\\(deps\\): ", group = "Dependencies"},
|
||||
{ message = "^fix", group = "Bug Fixes"},
|
||||
{ message = "^doc", group = "Documentation"},
|
||||
{ message = "^perf", group = "Performance"},
|
||||
{ message = "^refactor", group = "Refactor"},
|
||||
{ message = "^style", group = "Styling"},
|
||||
{ message = "^test", group = "Testing"},
|
||||
{ message = "^ci", group = "CI"},
|
||||
{ message = "^build", group = "Build"},
|
||||
{ message = "^chore\\(release\\): prepare for", skip = true},
|
||||
{ message = "^chore", group = "Miscellaneous Tasks"},
|
||||
{ body = ".*security", group = "Security"},
|
||||
]
|
||||
# filter out the commits that are not matched by commit parsers
|
||||
filter_commits = false
|
||||
# glob pattern for matching git tags
|
||||
tag_pattern = "v[0-9]*"
|
||||
# regex for skipping tags
|
||||
skip_tags = "v0.1.0-beta.1"
|
||||
# regex for ignoring tags
|
||||
ignore_tags = ""
|
||||
# sort the tags chronologically
|
||||
date_order = true
|
||||
# sort the commits inside sections by oldest/newest order
|
||||
sort_commits = "oldest"
|
160
.golangci.yml
160
.golangci.yml
@ -1,123 +1,47 @@
|
||||
linters-settings:
|
||||
depguard:
|
||||
list-type: blacklist
|
||||
dupl:
|
||||
threshold: 100
|
||||
funlen:
|
||||
lines: 100
|
||||
statements: 50
|
||||
goconst:
|
||||
min-len: 2
|
||||
min-occurrences: 2
|
||||
gocritic:
|
||||
enabled-tags:
|
||||
- diagnostic
|
||||
- experimental
|
||||
- opinionated
|
||||
- performance
|
||||
- style
|
||||
disabled-checks:
|
||||
- dupImport # https://github.com/go-critic/go-critic/issues/845
|
||||
- ifElseChain
|
||||
- octalLiteral
|
||||
- whyNoLint
|
||||
- wrapperFunc
|
||||
gocyclo:
|
||||
min-complexity: 15
|
||||
goimports:
|
||||
local-prefixes: github.com/nikoksr/notify
|
||||
revive:
|
||||
min-confidence: 0
|
||||
gomnd:
|
||||
settings:
|
||||
mnd:
|
||||
# don't include the "operation" and "assign"
|
||||
checks: [argument,case,condition,return]
|
||||
govet:
|
||||
check-shadowing: true
|
||||
settings:
|
||||
printf:
|
||||
funcs:
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
|
||||
lll:
|
||||
line-length: 140
|
||||
maligned:
|
||||
suggest-new: true
|
||||
misspell:
|
||||
locale: US
|
||||
nolintlint:
|
||||
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
|
||||
allow-unused: false # report any unused nolint directives
|
||||
require-explanation: false # don't require an explanation for nolint directives
|
||||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
|
||||
run:
|
||||
timeout: '5m'
|
||||
skip-dirs:
|
||||
- 'assets'
|
||||
allow-parallel-runners: true
|
||||
modules-download-mode: 'readonly'
|
||||
|
||||
linters:
|
||||
# please, do not use `enable-all`: it's deprecated and will be removed soon.
|
||||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
||||
disable-all: true
|
||||
enable:
|
||||
- bodyclose
|
||||
- deadcode
|
||||
- depguard
|
||||
- dogsled
|
||||
- dupl
|
||||
- errcheck
|
||||
- exhaustive
|
||||
- funlen
|
||||
- gochecknoinits
|
||||
- goconst
|
||||
- gocritic
|
||||
- gocyclo
|
||||
- gofmt
|
||||
- goimports
|
||||
- revive
|
||||
- gomnd
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- lll
|
||||
- misspell
|
||||
- nakedret
|
||||
- noctx
|
||||
- nolintlint
|
||||
- rowserrcheck
|
||||
- exportloopref
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- stylecheck
|
||||
- typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
- varcheck
|
||||
- whitespace
|
||||
|
||||
# don't enable:
|
||||
# - asciicheck
|
||||
# - gochecknoglobals
|
||||
# - gocognit
|
||||
# - godot
|
||||
# - godox
|
||||
# - goerr113
|
||||
# - maligned
|
||||
# - nestif
|
||||
# - prealloc
|
||||
# - testpackage
|
||||
# - wsl
|
||||
- 'asciicheck'
|
||||
- 'bodyclose'
|
||||
- 'deadcode'
|
||||
- 'depguard'
|
||||
- 'dogsled'
|
||||
- 'errcheck'
|
||||
- 'errorlint'
|
||||
- 'exportloopref'
|
||||
- 'gofmt'
|
||||
- 'gofumpt'
|
||||
- 'goheader'
|
||||
- 'goimports'
|
||||
- 'gomodguard'
|
||||
- 'goprintffuncname'
|
||||
- 'gosec'
|
||||
- 'gosimple'
|
||||
- 'govet'
|
||||
- 'ineffassign'
|
||||
- 'makezero'
|
||||
- 'misspell'
|
||||
- 'noctx'
|
||||
- 'paralleltest'
|
||||
- 'prealloc'
|
||||
- 'predeclared'
|
||||
- 'revive'
|
||||
- 'sqlclosecheck'
|
||||
- 'staticcheck'
|
||||
- 'structcheck'
|
||||
- 'stylecheck'
|
||||
- 'typecheck'
|
||||
- 'unconvert'
|
||||
- 'unused'
|
||||
- 'varcheck'
|
||||
- 'whitespace'
|
||||
|
||||
issues:
|
||||
# Excluding configuration per-path, per-linter, per-text and per-source
|
||||
exclude-rules:
|
||||
- path: _test\.go
|
||||
linters:
|
||||
- gomnd
|
||||
|
||||
# golangci.com configuration
|
||||
# https://github.com/golangci/golangci/wiki/Configuration
|
||||
service:
|
||||
golangci-lint-version: 1.44.x # use the fixed version to not introduce new linters unexpectedly
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
|
601
CHANGELOG.md
601
CHANGELOG.md
@ -1,601 +0,0 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [0.23.0] - 2022-03-25
|
||||
|
||||
### Build
|
||||
|
||||
- Apply latest breaking changes to git-cliff config
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Update module github.com/plivo/plivo-go to v7.6.1
|
||||
- Update module github.com/silenceper/wechat/v2 to v2.1.2
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.14.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.14.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.13.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/sns to v1.16.0
|
||||
- Update module github.com/atc0005/go-teams-notify/v2 to v2.6.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.15.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.15.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.14.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/sns to v1.17.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/sns to v1.17.1
|
||||
- Update module github.com/textmagic/textmagic-rest-go-v2/v2 to v2.0.2457
|
||||
- Update module github.com/stretchr/testify to v1.7.1
|
||||
- Update github.com/dghubble/go-twitter digest to 995614a
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.15.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.14.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/sns to v1.17.2
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.16.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.14.2
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.15.2
|
||||
- Update golangci/golangci-lint-action action to v3 (#215)
|
||||
- Update actions/setup-go action to v3 (#222)
|
||||
- Update actions/checkout action to v3 (#223)
|
||||
- Update actions/cache action to v3 (#235)
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/sns to v1.17.3 (#243)
|
||||
- Update module github.com/plivo/plivo-go to v7.8.0 (#224)
|
||||
- Update module github.com/bwmarrin/discordgo to v0.24.0 (#225)
|
||||
|
||||
## [0.22.0] - 2022-02-13
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Update module github.com/slack-go/slack to v0.10.2
|
||||
|
||||
### Features
|
||||
|
||||
- Add syslog (#211)
|
||||
|
||||
## [0.21.0] - 2022-02-09
|
||||
|
||||
### Features
|
||||
|
||||
- Add package-level functions (#208)
|
||||
|
||||
## [0.20.1] - 2022-02-07
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Update and tidy dependencies (#206)
|
||||
|
||||
## [0.20.0] - 2022-02-07
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add credits for AWS SNS service
|
||||
|
||||
### Features
|
||||
|
||||
- Add AWS SNS (#110)
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- Fix minor typo
|
||||
|
||||
## [0.19.1] - 2022-02-07
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Update and tidy dependencies (#202)
|
||||
|
||||
## [0.19.0] - 2022-02-07
|
||||
|
||||
### CI
|
||||
|
||||
- Add new pull-request template
|
||||
- Fix goimports local prefix
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add build commit parser
|
||||
- Apply git-cliff's config update
|
||||
- Simplify contribution guide
|
||||
- Add DingTalk credits and remove FOSSA badge
|
||||
|
||||
### Features
|
||||
|
||||
- Add DingTalk (#183)
|
||||
|
||||
## [0.18.0] - 2022-02-07
|
||||
|
||||
### Build
|
||||
|
||||
- Fix linter command and add implicit install commands
|
||||
- Add commands to generate changelogs
|
||||
|
||||
### CI
|
||||
|
||||
- Reintroduce config for readme badge
|
||||
- Add git-cliff config
|
||||
- Change version signature of workflow 'ci'
|
||||
- Add workflow for git-cliff to auto-gen changelogs
|
||||
- Fix smaller issues and clean-up
|
||||
- Switch from config-flag to config option in action file
|
||||
- Drop changelog generating action
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.11.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.10.2
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.9.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.10.3
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.11.2
|
||||
- Update module github.com/aws/aws-sdk-go-v2/credentials to v1.6.4
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.9.2
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.11.0
|
||||
- Update module github.com/silenceper/wechat/v2 to v2.1.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.11.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.10.0
|
||||
- Update module github.com/slack-go/slack to v0.10.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.12.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.11.0
|
||||
- Update module github.com/dghubble/oauth1 to v0.7.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.12.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.13.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.13.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.12.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.13.1
|
||||
|
||||
## [0.17.4] - 2021-11-17
|
||||
|
||||
### CI
|
||||
|
||||
- Drop stale config & bot
|
||||
- Add codeql-analysis config
|
||||
- Remove dependabot and extend renovate config
|
||||
- Update github action
|
||||
- Remove config
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Update module github.com/go-telegram-bot-api/telegram-bot-api to v5
|
||||
- Update module github.com/line/line-bot-sdk-go to v7.10.0
|
||||
- Revert version updates for line and telegram
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.8.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.5.2
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.9.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.6.0
|
||||
- Update module github.com/mailgun/mailgun-go/v4 to v4.5.3
|
||||
- Update module github.com/silenceper/wechat/v2 to v2.0.9
|
||||
- Update module github.com/slack-go/slack to v0.9.5
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.9.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.6.1
|
||||
- Update module github.com/sendgrid/sendgrid-go to v3.10.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.7.0
|
||||
- Update github.com/dghubble/go-twitter commit hash to ad02880
|
||||
- Update module github.com/sendgrid/sendgrid-go to v3.10.3
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.9.0
|
||||
- Update github.com/dghubble/go-twitter commit hash to 93a8679
|
||||
- Update module github.com/aws/aws-sdk-go-v2 to v1.11.0
|
||||
- Update module github.com/aws/aws-sdk-go-v2/credentials to v1.6.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/config to v1.10.1
|
||||
- Update module github.com/aws/aws-sdk-go-v2/service/ses to v1.9.0
|
||||
- Update module github.com/mailgun/mailgun-go/v4 to v4.6.0
|
||||
- Update module github.com/slack-go/slack to v0.10.0
|
||||
- Update go mod version and run go mod tidy
|
||||
|
||||
## [0.17.3] - 2021-08-13
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bump github.com/aws/aws-sdk-go-v2/service/ses
|
||||
- Bump github.com/slack-go/slack from 0.9.2 to 0.9.4
|
||||
- Bump github.com/aws/aws-sdk-go-v2/config
|
||||
- Bump github.com/aws/aws-sdk-go-v2/credentials
|
||||
- Bump github.com/textmagic/textmagic-rest-go-v2/v2
|
||||
- Go get -u & go mod tidy
|
||||
|
||||
## [0.17.2] - 2021-07-14
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Go mod tidy
|
||||
|
||||
## [0.17.1] - 2021-07-14
|
||||
|
||||
### Build
|
||||
|
||||
- Simplify Makefile
|
||||
|
||||
### CI
|
||||
|
||||
- Refactor github action for linting, testing & building
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bump github.com/textmagic/textmagic-rest-go-v2/v2
|
||||
- Bump github.com/aws/aws-sdk-go-v2/service/ses
|
||||
- Bump github.com/aws/aws-sdk-go-v2/config
|
||||
- Bump github.com/atc0005/go-teams-notify/v2
|
||||
- Bump github.com/slack-go/slack from 0.9.1 to 0.9.2
|
||||
- Bump github.com/mailgun/mailgun-go/v4 from 4.5.1 to 4.5.2
|
||||
- Bump github.com/plivo/plivo-go
|
||||
|
||||
### Documentation
|
||||
|
||||
- Change calling order in notify example
|
||||
- Reorder supported services list alphabetically
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- Remove go generate directives for installing deps
|
||||
|
||||
## [0.17.0] - 2021-05-26
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix : resolved issues
|
||||
|
||||
|
||||
### Build
|
||||
|
||||
- Update golangci-lint config
|
||||
- Replaced deprecated linter
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bump github.com/aws/aws-sdk-go-v2 from 1.3.4 to 1.6.0
|
||||
- Bump github.com/aws/aws-sdk-go-v2/config
|
||||
- Bump github.com/aws/aws-sdk-go-v2/service/ses
|
||||
- Bump github.com/slack-go/slack from 0.9.0 to 0.9.1
|
||||
- Bump github.com/sendgrid/sendgrid-go
|
||||
- Bump github.com/silenceper/wechat/v2 from 2.0.5 to 2.0.6
|
||||
- Bump github.com/aws/aws-sdk-go-v2/service/ses
|
||||
- Update and tidy modules
|
||||
- Go mod tidy
|
||||
|
||||
### Features
|
||||
|
||||
- Add textmagic service
|
||||
- Formatted code
|
||||
- Formatted code
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- Run 'make fmt'
|
||||
|
||||
### Add
|
||||
|
||||
- Textmagic service
|
||||
|
||||
## [0.16.1] - 2021-04-27
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bump github.com/plivo/plivo-go
|
||||
- Bump github.com/atc0005/go-teams-notify/v2
|
||||
- Bump github.com/mailgun/mailgun-go/v4 from 4.4.1 to 4.5.1
|
||||
- Bump github.com/sendgrid/sendgrid-go
|
||||
- Go get -u ./... & go mod tidy
|
||||
|
||||
## [0.16.0] - 2021-04-27
|
||||
|
||||
### Build
|
||||
|
||||
- Build-passing commit
|
||||
|
||||
- Build-passing commit
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bump github.com/aws/aws-sdk-go-v2/service/ses
|
||||
- Bump actions/cache from v2.1.4 to v2.1.5
|
||||
- Bump github.com/aws/aws-sdk-go-v2/config
|
||||
- Bump github.com/aws/aws-sdk-go-v2/credentials
|
||||
- Bump github.com/slack-go/slack from 0.8.1 to 0.9.0
|
||||
- Bump github.com/aws/aws-sdk-go-v2 from 1.2.1 to 1.3.4
|
||||
|
||||
### Features
|
||||
|
||||
- Added support for WeChat
|
||||
|
||||
## [0.15.0] - 2021-03-16
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Lint code
|
||||
- Fix comments in code change variable name
|
||||
- Update variable names
|
||||
- Lint code
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bump github.com/aws/aws-sdk-go-v2/service/ses
|
||||
- Bump github.com/aws/aws-sdk-go-v2/credentials
|
||||
- Bump github.com/aws/aws-sdk-go-v2 from 1.2.0 to 1.2.1
|
||||
- Bump github.com/aws/aws-sdk-go-v2/config
|
||||
- Bump github.com/aws/aws-sdk-go-v2/config from 1.1.1 to 1.1.2 (#60)
|
||||
- Update and tidy go dependencies
|
||||
- Go mod tidy
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add rocketchat service to readme
|
||||
- Add rocketchat service usage example
|
||||
|
||||
### Features
|
||||
|
||||
- Add rocketchat service
|
||||
|
||||
## [0.14.0] - 2021-03-09
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Adjust code style
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bump github.com/mailgun/mailgun-go/v4 from 4.3.4 to 4.4.1
|
||||
- Bump github.com/mailgun/mailgun-go/v4 from 4.3.4 to 4.4.1 (#54)
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add line service to readme
|
||||
- Add line service example usage
|
||||
|
||||
### Features
|
||||
|
||||
- Add line service
|
||||
|
||||
## [0.13.0] - 2021-02-23
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Go get -u & go mod tidy
|
||||
|
||||
### Documentation
|
||||
|
||||
- Fix wrong type name in comment
|
||||
|
||||
### Refactor
|
||||
|
||||
- Add context.Context to parameter list of Send method
|
||||
- Return context.Err when context.IsDone
|
||||
- Fix faulty error return
|
||||
- Add context.Context to parameter list of Send method (#51)
|
||||
|
||||
## [0.12.0] - 2021-02-17
|
||||
|
||||
## [0.11.0] - 2021-02-17
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Go mod tidy
|
||||
- Bump github.com/slack-go/slack from 0.8.0 to 0.8.1
|
||||
- Bump github.com/slack-go/slack from 0.8.0 to 0.8.1 (#46)
|
||||
- Fix go.mod
|
||||
- Fix go.sum
|
||||
|
||||
### Documentation
|
||||
|
||||
- Reword some paragraphs and add missing libs to credits list
|
||||
- Update README with new supported Amazon SES service
|
||||
|
||||
### Features
|
||||
|
||||
- Add WhatsApp service
|
||||
- Add Amazon SES service
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- Make fmt
|
||||
|
||||
### Refactor
|
||||
|
||||
- Use newest version v2 of AWS Golang SDK
|
||||
- Separate out login into LoginWithQRCode and LoginWithSessionCredentials
|
||||
- Construct email input on a single initialization
|
||||
- Make changes as per review comments
|
||||
|
||||
## [0.10.0] - 2021-02-12
|
||||
|
||||
## [0.9.0] - 2021-02-12
|
||||
|
||||
### Refactor
|
||||
|
||||
- Proper variable naming
|
||||
- Split error checking to separate line
|
||||
|
||||
## [0.8.0] - 2021-02-12
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix comment typo on SendGrid struct
|
||||
|
||||
### Documentation
|
||||
|
||||
- Update README with new supported SendGrid service
|
||||
- Update README with new supported Mailgun service
|
||||
|
||||
### Features
|
||||
|
||||
- Add SendGrid service
|
||||
- Add Mailgun service
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- Add punctuation to function comment
|
||||
- Put actual type names into comments
|
||||
|
||||
### Refactor
|
||||
|
||||
- Simplify useService function
|
||||
- Remove AddReceivers function from notify.Notifier interface
|
||||
- Simplify telegram.AddReceivers function
|
||||
- Remove unnecessary variable assignments
|
||||
- Make code more compact
|
||||
|
||||
## [0.7.0] - 2021-02-09
|
||||
|
||||
### CI
|
||||
|
||||
- Change dependabot label
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bump actions/cache from v2 to v2.1.4
|
||||
- Bump github.com/bwmarrin/discordgo from 0.23.1 to 0.23.2
|
||||
- Bump actions/cache from v2 to v2.1.4 (#36)
|
||||
- Bump github.com/bwmarrin/discordgo from 0.23.1 to 0.23.2 (#37)
|
||||
|
||||
### Features
|
||||
|
||||
- Add Plivo service
|
||||
|
||||
### Refactor
|
||||
|
||||
- Remove unnecessary new-lines
|
||||
|
||||
## [0.6.0] - 2021-02-08
|
||||
|
||||
## [0.5.1] - 2021-02-07
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix miss-spell & run gofmt -s
|
||||
|
||||
|
||||
### Documentation
|
||||
|
||||
- Fix UseService usage
|
||||
|
||||
### Rename
|
||||
|
||||
- Notify.UseService to Notify.UseServices
|
||||
|
||||
## [0.5.0] - 2021-02-02
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix a small typo in function comment
|
||||
|
||||
### Build
|
||||
|
||||
- Add make file and go-generate directives
|
||||
- Remove deprecated config option
|
||||
- Add dependabot config
|
||||
|
||||
### CI
|
||||
|
||||
- Add action to test and lint any PRs
|
||||
- Add go build command to gh build-action
|
||||
- Add stale-bot config
|
||||
|
||||
### Documentation
|
||||
|
||||
- Update contribution guidelines
|
||||
- Add fossa badge to readme
|
||||
|
||||
### Features
|
||||
|
||||
- Added Pushbullet service (tested)
|
||||
- Feat(service) Pushbullet SMS - added new service and usage documentation to pushbullet package
|
||||
|
||||
|
||||
### Patch
|
||||
|
||||
- Renamed PushBullet to Pushbullet
|
||||
- Removed validation from pushbullet.go AddReceivers
|
||||
|
||||
## [0.4.0] - 2021-01-31
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Remove unused parameter from function New
|
||||
|
||||
### Build
|
||||
|
||||
- Make codacy ignore markdown files
|
||||
|
||||
## [0.3.1] - 2021-01-31
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Remove error return on method new
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add notes about Microsoft Teams support
|
||||
|
||||
### Features
|
||||
|
||||
- Add support for Microsoft Teams
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- Fix grammar in method comment
|
||||
- Apply changes suggested by golangci-lint
|
||||
|
||||
### Refactor
|
||||
|
||||
- Remove obsolete listener from Telegram struct
|
||||
- Remove underscore from package name (golint: var-naming)
|
||||
|
||||
### UNTESTED
|
||||
|
||||
- Twitter service
|
||||
|
||||
## [0.3.0] - 2021-01-27
|
||||
|
||||
### CI
|
||||
|
||||
- Add templates for PR, bug- and feature-request
|
||||
|
||||
### Documentation
|
||||
|
||||
- Refactor readme
|
||||
- Fix codacy badge
|
||||
- Add list of supported services
|
||||
- Add comments pointing to useful resources
|
||||
- Update description
|
||||
- Add notes about slack support
|
||||
|
||||
## [0.2.1] - 2021-01-26
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Add gateway intent to discord client
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Go mod tidy
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add missing comment to pseudo struct
|
||||
- Correct function name in comment
|
||||
|
||||
## [0.2.0] - 2021-01-25
|
||||
|
||||
### Documentation
|
||||
|
||||
- Correct faulty telegram chat id
|
||||
- Add wip note
|
||||
|
||||
### Features
|
||||
|
||||
- Add support for various authentication methods
|
||||
|
||||
## [0.1.0] - 2021-01-25
|
||||
|
||||
### Documentation
|
||||
|
||||
- Add readme, coc, and contrib guidelines
|
||||
- Replace gh release with tag shield
|
||||
|
||||
### Features
|
||||
|
||||
- Init project
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- Go mod tidy
|
||||
|
||||
### Refactor
|
||||
|
||||
- Comment and clean up code
|
||||
|
||||
<!-- generated by git-cliff -->
|
12
Makefile
12
Makefile
@ -40,18 +40,6 @@ lint:
|
||||
ci: lint test
|
||||
.PHONY: ci
|
||||
|
||||
###############################################################################
|
||||
# DEPENDENCIES
|
||||
###############################################################################
|
||||
|
||||
changelog-latest:
|
||||
@git cliff --config .cliff.toml --latest --strip header
|
||||
.PHONY: changelog-latest
|
||||
|
||||
changelog-file:
|
||||
@git cliff --config .cliff.toml -o CHANGELOG.md
|
||||
.PHONY: changelog-file
|
||||
|
||||
###############################################################################
|
||||
|
||||
.DEFAULT_GOAL := ci
|
||||
|
2
go.mod
2
go.mod
@ -33,6 +33,8 @@ require (
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
)
|
||||
|
||||
require github.com/google/go-cmp v0.5.7
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.9 // indirect
|
||||
|
32
go.sum
32
go.sum
@ -50,52 +50,28 @@ github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwc
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
github.com/atc0005/go-teams-notify/v2 v2.6.1 h1:t22ybzQuaQs4UJe4ceF5VYGsPhs6ir3nZOId/FBy6Go=
|
||||
github.com/atc0005/go-teams-notify/v2 v2.6.1/go.mod h1:xo6GejLDHn3tWBA181F8LrllIL0xC1uRsRxq7YNXaaY=
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.1 h1:udzee98w8H6ikRgtFdVN9JzzYEbi/quFfSvduZETJIU=
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.1/go.mod h1:ytwTPBG6fXTZLxxeeCCWj2/EMYp/xDUgX+OET6TLNNU=
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.2 h1:fqlCk6Iy3bnCumtrLz9r3mJ/2gUT0pJ0wLFVIdWh+JA=
|
||||
github.com/aws/aws-sdk-go-v2 v1.16.2/go.mod h1:ytwTPBG6fXTZLxxeeCCWj2/EMYp/xDUgX+OET6TLNNU=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.2 h1:4oGcm1yqqtTc2Z8YpwehwjSiBA3TR0iZbFCgNlXcVFQ=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.2/go.mod h1:S1p1xf7DGVp0srNq0BakyxfirOldPQeDVlx7+fllyok=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.3 h1:5AlQD0jhVXlGzwo+VORKiUuogkG7pQcLJNzIzK7eodw=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.15.3/go.mod h1:9YL3v07Xc/ohTsxFXzan9ZpFpdTOFl4X65BAKYaz8jg=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.11.1 h1:uR323+M7ca3v2GKXbFSwWbNA3kLjjFzaalL6W4rpB9s=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.11.1/go.mod h1:pYrHWfKUoWTmbr+xTf6ZoWeyyvLAQ5BPT3aL+nKlTpE=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.11.2 h1:RQQ5fzclAKJyY5TvF+fkjJEwzK4hnxQCLOu5JXzDmQo=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.11.2/go.mod h1:j8YsY9TXTm31k4eFhspiQicfXPLZ0gYXA50i4gxPE8g=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.2 h1:+AULPOLHEDjH2TcNKpixl4gt26hFOdlUuuisZUBFczA=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.2/go.mod h1:jmsqNRVo2XlUTNXG/NF7hM7o2gd2jhfg8vdJ135d4XA=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.3 h1:LWPg5zjHV9oz/myQr4wMs0gi4CjnDN/ILmyZUFYXZsU=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.3/go.mod h1:uk1vhHHERfSVCUnqSqz8O48LBYDSC+k6brng09jcMOk=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.8 h1:CDaO90VZVBAL1sK87S5oSPIrp7yZqORv1hPIi2UsTMk=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.8/go.mod h1:LnTQMTqbKsbtt+UI5+wPsB7jedW+2ZgozoPG8k6cMxg=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.9 h1:onz/VaaxZ7Z4V+WIN9Txly9XLTmoOh1oJ8XcAC3pako=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.9/go.mod h1:AnVH5pvai0pAF4lXRq0bmhbes1u9R8wTE+g+183bZNM=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.2 h1:XXR3cdOcKRCTZf6ctcqpMf+go1BdzTm6+T9Ul5zxcMI=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.2/go.mod h1:1x4ZP3Z8odssdhuLI+/1Tqw6Pt/VAaP4Tr8EUxHvPXE=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.3 h1:9stUQR/u2KXU6HkFJYlqnZEjBnbgrVbG6I5HN09xZh0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.3/go.mod h1:ssOhaLpRlh88H3UmEcsBoVKq309quMvm3Ds8e9d4eJM=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.9 h1:8umg6LSQ/b0+ZTq+Ro8K7VLGVwd7kiYQtIACpf2N/Yo=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.9/go.mod h1:kASRBzoVW4I8KUmGCjsowAqVor9QU9DuTUABVducrTY=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.10 h1:by9P+oy3P/CwggN4ClnW2D4oL91QV7pBzBICi1chZvQ=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.10/go.mod h1:8DcYQcz0+ZJaSxANlHIsbbi6S+zMwjwdDqwW3r9AzaE=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.2 h1:RrN7V0r8+lUUKZM4OAoCOIZqjPLZPOl6wuwMd2QIryI=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.2/go.mod h1:7hwSi01X5Yj9H0qLQljrn8OSdLwwSym1aQCfGn1tDQQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.3 h1:Gh1Gpyh01Yvn7ilO/b/hr01WgNpaszfbKMUgqM186xQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.3/go.mod h1:wlY6SVjuwvh3TVRpTqdy4I1JpBFLX4UGeKZdWntaocw=
|
||||
github.com/aws/aws-sdk-go-v2/service/ses v1.14.2 h1:K5hJGfMhU7g+3akLDJIZgpMzCwL1Q0P5gJmkIY169hw=
|
||||
github.com/aws/aws-sdk-go-v2/service/ses v1.14.2/go.mod h1:xPjwSTJ7+h57gQeTUbsrQ6hvr7wjhfNaf3oK1AWuRvA=
|
||||
github.com/aws/aws-sdk-go-v2/service/ses v1.14.3 h1:SNFIa2NvkZ46nkkUS6DlTjgQItjjYCjrh+UCpD5mF4Y=
|
||||
github.com/aws/aws-sdk-go-v2/service/ses v1.14.3/go.mod h1:VPOcsfmvq+FyaT47LT8ReFGD0NXnPEbcJGbxm7mC3yg=
|
||||
github.com/aws/aws-sdk-go-v2/service/sns v1.17.3 h1:c4Xz9g2OwXVS65vHmnOa5SFHZZ5QNkoSxInC7UMn2p4=
|
||||
github.com/aws/aws-sdk-go-v2/service/sns v1.17.3/go.mod h1:PrZELgNG6JtNfXie2v033h5LznOiaAcI6jF2Fx6JDZM=
|
||||
github.com/aws/aws-sdk-go-v2/service/sns v1.17.4 h1:7TdmoJJBwLFyakXjfrGztejwY5Ie1JEto7YFfznCmAw=
|
||||
github.com/aws/aws-sdk-go-v2/service/sns v1.17.4/go.mod h1:kElt+uCcXxcqFyc+bQqZPFD9DME/eC6oHBXvFzQ9Bcw=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.2 h1:8fVz1c9B/63w7O0kxbrCTT69iV4DgXnFumarPCZ3Cns=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.2/go.mod h1:GdCj3+FzI3D5tauOzz8n3YjN70XvgZz82PVVtJXmDds=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.3 h1:frW4ikGcxfAEDfmQqWgMLp+F1n4nRo9sF39OcIb5BkQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.3/go.mod h1:7UQ/e69kU7LDPtY40OyoHYgRmgfGM4mgsLYtcObdveU=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.2 h1:qgK5htfKByTiPxS/diZ/mTCfDwGAVuyjRdqu6VoCh80=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.2/go.mod h1:RoMljzynmRe3jyOsRgqIMTzyhpAv6XNxu549M1X4Mdo=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.3 h1:cJGRyzCSVwZC7zZZ1xbx9m32UnrKydRYhOvcD1NYP9Q=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.3/go.mod h1:bfBj0iVmsUyUg4weDB4NxktD9rDGeKSVWnjTnwbx9b8=
|
||||
github.com/aws/smithy-go v1.11.2 h1:eG/N+CcUMAvsdffgMvjMKwfyDzIkjM6pfxMJ8Mzc6mE=
|
||||
@ -105,12 +81,8 @@ github.com/blinkbean/dingtalk v0.0.0-20210905093040-7d935c0f7e19/go.mod h1:9BaLu
|
||||
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d h1:pVrfxiGfwelyab6n21ZBkbkmbevaf+WvMIiR7sr97hw=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
|
||||
github.com/bwmarrin/discordgo v0.24.0 h1:Gw4MYxqHdvhO99A3nXnSLy97z5pmIKHZVJ1JY5ZDPqY=
|
||||
github.com/bwmarrin/discordgo v0.24.0/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=
|
||||
github.com/bwmarrin/discordgo v0.25.0 h1:NXhdfHRNxtwso6FPdzW2i3uBvvU7UIQTghmV2T4nqAs=
|
||||
github.com/bwmarrin/discordgo v0.25.0/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=
|
||||
github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo=
|
||||
github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
||||
github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4=
|
||||
github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
@ -126,8 +98,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
|
||||
github.com/dghubble/go-twitter v0.0.0-20220319054129-995614af6514 h1:ddbCPZ9QZRZXVKONtHFEULOYo0gR5fvRGY/laH/3hWA=
|
||||
github.com/dghubble/go-twitter v0.0.0-20220319054129-995614af6514/go.mod h1:qPG2N91lrezEUoU/9eem10s7fVt+ohhDh0LFv2tq0Og=
|
||||
github.com/dghubble/go-twitter v0.0.0-20220413154426-14d8abde2e80 h1:pq636dbda5rkQyrFUOeADrGeKQGlCHBvcpGKqsVZ4ZQ=
|
||||
github.com/dghubble/go-twitter v0.0.0-20220413154426-14d8abde2e80/go.mod h1:7vl8uM4He/dTj20TDHBwvkKEBPUm60re8htWb7YRo+Q=
|
||||
github.com/dghubble/oauth1 v0.7.1 h1:JjbOVSVVkms9A4h/sTQy5Jb2nFuAAVb2qVYgenJPyrE=
|
||||
@ -251,8 +221,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/line/line-bot-sdk-go v7.8.0+incompatible h1:Uf9/OxV0zCVfqyvwZPH8CrdiHXXmMRa/L91G3btQblQ=
|
||||
github.com/line/line-bot-sdk-go v7.8.0+incompatible/go.mod h1:0RjLjJEAU/3GIcHkC3av6O4jInAbt25nnZVmOFUgDBg=
|
||||
github.com/mailgun/mailgun-go/v4 v4.6.0 h1:qSrgT3wP5fU7wF/tNUp4xeYe8wSUy+8V5NJPYnB6Hxo=
|
||||
github.com/mailgun/mailgun-go/v4 v4.6.0/go.mod h1:FJlF9rI5cQT+mrwujtJjPMbIVy3Ebor9bKTVsJ0QU40=
|
||||
github.com/mailgun/mailgun-go/v4 v4.6.1 h1:ETvvkcHd6I+FwFgAwZSf02RXKFA0Rg3djOFic//RAu0=
|
||||
github.com/mailgun/mailgun-go/v4 v4.6.1/go.mod h1:FJlF9rI5cQT+mrwujtJjPMbIVy3Ebor9bKTVsJ0QU40=
|
||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||
|
65
notify.go
65
notify.go
@ -1,10 +1,12 @@
|
||||
package notify
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
import "github.com/pkg/errors"
|
||||
|
||||
const defaultDisabled = false // Notifier is enabled by default
|
||||
// Compile-time check to ensure Notify implements Notifier.
|
||||
var _ Notifier = (*Notify)(nil)
|
||||
|
||||
// ErrSendNotification signals that the notifier failed to send a notification.
|
||||
var ErrSendNotification = errors.New("send notification")
|
||||
|
||||
// Notify is the central struct for managing notification services and sending messages to them.
|
||||
type Notify struct {
|
||||
@ -12,14 +14,59 @@ type Notify struct {
|
||||
notifiers []Notifier
|
||||
}
|
||||
|
||||
// ErrSendNotification signals that the notifier failed to send a notification.
|
||||
var ErrSendNotification = errors.New("send notification")
|
||||
// Option is a function that can be used to configure a Notify instance. It is used by the WithOptions and
|
||||
// NewWithOptions functions. It's a function because it's a bit more flexible than using a struct. The only required
|
||||
// parameter is the Notify instance itself.
|
||||
type Option func(*Notify)
|
||||
|
||||
// New returns a new instance of Notify. Defaulting to being not disabled.
|
||||
func New() *Notify {
|
||||
return &Notify{Disabled: defaultDisabled, notifiers: []Notifier{}}
|
||||
// Enable is an Option function that enables the Notify instance. This is the default behavior.
|
||||
func Enable(n *Notify) {
|
||||
if n != nil {
|
||||
n.Disabled = false
|
||||
}
|
||||
}
|
||||
|
||||
// Disable is an Option function that disables the Notify instance. It is enabled by default.
|
||||
func Disable(n *Notify) {
|
||||
if n != nil {
|
||||
n.Disabled = true
|
||||
}
|
||||
}
|
||||
|
||||
// WithOptions applies the given options to the Notify instance. If no options are provided, it returns the Notify
|
||||
// instance unchanged.
|
||||
func (n *Notify) WithOptions(options ...Option) *Notify {
|
||||
if options == nil {
|
||||
return n
|
||||
}
|
||||
|
||||
for _, option := range options {
|
||||
if option != nil {
|
||||
option(n)
|
||||
}
|
||||
}
|
||||
|
||||
return n
|
||||
}
|
||||
|
||||
// NewWithOptions returns a new instance of Notify with the given options. If no options are provided, it returns a new
|
||||
// Notify instance with default options. By default, the Notify instance is enabled.
|
||||
func NewWithOptions(options ...Option) *Notify {
|
||||
n := &Notify{
|
||||
Disabled: false, // Enabled by default.
|
||||
notifiers: make([]Notifier, 0), // Avoid nil list.
|
||||
}
|
||||
|
||||
return n.WithOptions(options...)
|
||||
}
|
||||
|
||||
// New returns a new instance of Notify. It returns a new Notify instance with default options. By default, the Notify
|
||||
// instance is enabled.
|
||||
func New() *Notify {
|
||||
return NewWithOptions()
|
||||
}
|
||||
|
||||
// Create the package level Notify instance.
|
||||
var std = New()
|
||||
|
||||
// Default returns the standard Notify instance used by the package-level send function.
|
||||
|
66
notify_test.go
Normal file
66
notify_test.go
Normal file
@ -0,0 +1,66 @@
|
||||
package notify
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n1 := New()
|
||||
if n1 == nil {
|
||||
t.Fatal("New() returned nil")
|
||||
}
|
||||
if n1.Disabled {
|
||||
t.Fatal("New() returned disabled Notifier")
|
||||
}
|
||||
|
||||
n2 := NewWithOptions()
|
||||
if n2 == nil {
|
||||
t.Fatal("NewWithOptions() returned nil")
|
||||
}
|
||||
diff := cmp.Diff(n1, n2, cmp.AllowUnexported(Notify{}))
|
||||
if diff != "" {
|
||||
t.Errorf("New() and NewWithOptions() returned different Notifiers:\n%s", diff)
|
||||
}
|
||||
|
||||
n3 := NewWithOptions(Disable)
|
||||
if !n3.Disabled {
|
||||
t.Error("NewWithOptions(Disable) did not disable Notifier")
|
||||
}
|
||||
|
||||
n3.WithOptions(Enable)
|
||||
if n3.Disabled {
|
||||
t.Error("WithOptions(Enable) did not enable Notifier")
|
||||
}
|
||||
|
||||
n3Copy := *n3
|
||||
n3.WithOptions()
|
||||
diff = cmp.Diff(n3, &n3Copy, cmp.AllowUnexported(Notify{}))
|
||||
if diff != "" {
|
||||
t.Errorf("WithOptions() altered the Notifier:\n%s", diff)
|
||||
}
|
||||
|
||||
n3.WithOptions(nil)
|
||||
if r := recover(); r != nil {
|
||||
t.Errorf("WithOptions(nil) panicked: %v", r)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefault(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := Default()
|
||||
if n == nil {
|
||||
t.Fatal("Default() returned nil")
|
||||
}
|
||||
if n.Disabled {
|
||||
t.Fatal("Default() returned disabled Notifier")
|
||||
}
|
||||
// Compare addresses on purpose.
|
||||
if n != std {
|
||||
t.Error("Default() did not return the default Notifier")
|
||||
}
|
||||
}
|
18
send.go
18
send.go
@ -12,16 +12,20 @@ func (n *Notify) send(ctx context.Context, subject, message string) error {
|
||||
if n.Disabled {
|
||||
return nil
|
||||
}
|
||||
if ctx == nil {
|
||||
ctx = context.Background()
|
||||
}
|
||||
|
||||
var eg errgroup.Group
|
||||
|
||||
for _, service := range n.notifiers {
|
||||
if service != nil {
|
||||
s := service
|
||||
eg.Go(func() error {
|
||||
return s.Send(ctx, subject, message)
|
||||
})
|
||||
if service == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
service := service
|
||||
eg.Go(func() error {
|
||||
return service.Send(ctx, subject, message)
|
||||
})
|
||||
}
|
||||
|
||||
err := eg.Wait()
|
||||
@ -39,5 +43,5 @@ func (n *Notify) Send(ctx context.Context, subject, message string) error {
|
||||
|
||||
// Send calls the underlying notification services to send the given subject and message to their respective endpoints.
|
||||
func Send(ctx context.Context, subject, message string) error {
|
||||
return std.send(ctx, subject, message)
|
||||
return std.Send(ctx, subject, message)
|
||||
}
|
||||
|
41
send_test.go
Normal file
41
send_test.go
Normal file
@ -0,0 +1,41 @@
|
||||
package notify
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/nikoksr/notify/service/mail"
|
||||
)
|
||||
|
||||
func TestNotifySend(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := New()
|
||||
if n == nil {
|
||||
t.Fatal("New() returned nil")
|
||||
}
|
||||
if n.Disabled {
|
||||
t.Fatal("New() returned disabled Notifier")
|
||||
}
|
||||
|
||||
// Nil context
|
||||
//nolint:staticcheck
|
||||
if err := n.Send(nil, "subject", "message"); err != nil {
|
||||
t.Errorf("Send() returned error: %v", err)
|
||||
}
|
||||
if r := recover(); r != nil {
|
||||
t.Errorf("Send() panicked: %v", r)
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
if err := n.Send(ctx, "subject", "message"); err != nil {
|
||||
t.Errorf("Send() returned error: %v", err)
|
||||
}
|
||||
|
||||
// This is not meant to test the mail service, but rather the general capability of the Send() function to catch
|
||||
// errors.
|
||||
n.UseServices(mail.New("", ""))
|
||||
if err := n.Send(ctx, "subject", "message"); err == nil {
|
||||
t.Errorf("Send() invalid mail returned no error: %v", err)
|
||||
}
|
||||
}
|
@ -25,7 +25,8 @@ type SNSSendMessageClient struct {
|
||||
// SendMessage Client specific for SNS using aws sdk v2.
|
||||
func (s SNSSendMessageClient) SendMessage(ctx context.Context,
|
||||
params *sns.PublishInput,
|
||||
optFns ...func(*sns.Options)) (*sns.PublishOutput, error) {
|
||||
optFns ...func(*sns.Options),
|
||||
) (*sns.PublishOutput, error) {
|
||||
return s.client.Publish(ctx, params, optFns...)
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,15 @@ type SNSSendMessageMock struct {
|
||||
|
||||
func (m *SNSSendMessageMock) SendMessage(ctx context.Context,
|
||||
params *sns.PublishInput,
|
||||
optFns ...func(*sns.Options)) (*sns.PublishOutput, error) {
|
||||
optFns ...func(*sns.Options),
|
||||
) (*sns.PublishOutput, error) {
|
||||
args := m.Called(ctx, params, optFns)
|
||||
return args.Get(0).(*sns.PublishOutput), args.Error(1)
|
||||
}
|
||||
|
||||
func TestAddReceivers(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
amazonSNS, err := New("", "", "")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@ -30,6 +33,8 @@ func TestAddReceivers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendMessageWithNoTopicsConfigured(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
mockSns := new(SNSSendMessageMock)
|
||||
amazonSNS := AmazonSNS{
|
||||
sendMessageClient: mockSns,
|
||||
@ -41,6 +46,8 @@ func TestSendMessageWithNoTopicsConfigured(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendMessageWithSucessAndOneTopicCOnfigured(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
mockSns := new(SNSSendMessageMock)
|
||||
output := sns.PublishOutput{}
|
||||
mockSns.On("SendMessage", mock.Anything, mock.Anything, mock.Anything).
|
||||
@ -58,6 +65,8 @@ func TestSendMessageWithSucessAndOneTopicCOnfigured(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendMessageWithSucessAndTwoTopicCOnfigured(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
mockSns := new(SNSSendMessageMock)
|
||||
output := sns.PublishOutput{}
|
||||
mockSns.On("SendMessage", mock.Anything, mock.Anything, mock.Anything).
|
||||
@ -78,6 +87,8 @@ func TestSendMessageWithSucessAndTwoTopicCOnfigured(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendMessageWithErrorAndOneQueueConfiguredShouldReturnError(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
mockSns := new(SNSSendMessageMock)
|
||||
output := sns.PublishOutput{}
|
||||
mockSns.On("SendMessage", mock.Anything, mock.Anything, mock.Anything).
|
||||
@ -97,6 +108,8 @@ func TestSendMessageWithErrorAndOneQueueConfiguredShouldReturnError(t *testing.T
|
||||
}
|
||||
|
||||
func TestSendMessageWithErrorAndTwoQueueConfiguredShouldReturnErrorOnFirst(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
mockSns := new(SNSSendMessageMock)
|
||||
output := sns.PublishOutput{}
|
||||
mockSns.On("SendMessage", mock.Anything, mock.Anything, mock.Anything).
|
||||
|
@ -5,11 +5,13 @@ import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
plivo "github.com/plivo/plivo-go/v7"
|
||||
"github.com/plivo/plivo-go/v7"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert := require.New(t)
|
||||
|
||||
// nil ClientOptions
|
||||
@ -34,6 +36,8 @@ func TestNew(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddReceivers(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert := require.New(t)
|
||||
|
||||
svc, err := New(&ClientOptions{}, &MessageOptions{Source: "12345"})
|
||||
@ -47,6 +51,8 @@ func TestAddReceivers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSend(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert := require.New(t)
|
||||
|
||||
svc, err := New(&ClientOptions{}, &MessageOptions{Source: "12345"})
|
||||
|
@ -10,6 +10,8 @@ import (
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert := require.New(t)
|
||||
|
||||
// Test creating a local writer with invalid log priority.
|
||||
@ -38,6 +40,8 @@ func TestNew(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSend(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert := require.New(t)
|
||||
|
||||
ctx := context.Background()
|
||||
|
@ -10,6 +10,8 @@ import (
|
||||
)
|
||||
|
||||
func TestAddReceivers(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert := require.New(t)
|
||||
|
||||
svc := &Service{
|
||||
@ -22,6 +24,8 @@ func TestAddReceivers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSend(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert := require.New(t)
|
||||
|
||||
svc := &Service{
|
||||
|
@ -60,13 +60,13 @@ func (s *Service) LoginWithSessionCredentials(clientID, clientToken, serverToken
|
||||
|
||||
session, err := s.client.RestoreWithSession(session)
|
||||
if err != nil {
|
||||
return fmt.Errorf("restoring session failed: %v", err)
|
||||
return fmt.Errorf("restoring session failed: %w", err)
|
||||
}
|
||||
|
||||
// Save the updated session for future use without login.
|
||||
err = writeSession(&session)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error saving session: %v", err)
|
||||
return fmt.Errorf("error saving session: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -79,7 +79,7 @@ func (s *Service) LoginWithQRCode() error {
|
||||
if err == nil {
|
||||
session, err = s.client.RestoreWithSession(session)
|
||||
if err != nil {
|
||||
return fmt.Errorf("restoring session failed: %v", err)
|
||||
return fmt.Errorf("restoring session failed: %w", err)
|
||||
}
|
||||
} else {
|
||||
// No saved session found; need to login again.
|
||||
@ -91,13 +91,13 @@ func (s *Service) LoginWithQRCode() error {
|
||||
|
||||
session, err = s.client.Login(qr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error during login: %v", err)
|
||||
return fmt.Errorf("error during login: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
err = writeSession(&session)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error saving session: %v", err)
|
||||
return fmt.Errorf("error saving session: %w", err)
|
||||
}
|
||||
|
||||
<-time.After(qrLoginWaitTime)
|
||||
|
@ -10,6 +10,8 @@ import (
|
||||
)
|
||||
|
||||
func TestAddReceivers(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert := require.New(t)
|
||||
|
||||
svc := &Service{
|
||||
@ -22,6 +24,8 @@ func TestAddReceivers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSend(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert := require.New(t)
|
||||
|
||||
svc := &Service{
|
||||
|
2
use.go
2
use.go
@ -21,5 +21,5 @@ func (n *Notify) UseServices(service ...Notifier) {
|
||||
|
||||
// UseServices adds the given service(s) to the Notifier's services list.
|
||||
func UseServices(service ...Notifier) {
|
||||
std.useServices(service...)
|
||||
std.UseServices(service...)
|
||||
}
|
||||
|
39
use_test.go
Normal file
39
use_test.go
Normal file
@ -0,0 +1,39 @@
|
||||
package notify
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/nikoksr/notify/service/mail"
|
||||
)
|
||||
|
||||
func TestUseServices(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
n := New()
|
||||
if n == nil {
|
||||
t.Fatal("New() returned nil")
|
||||
}
|
||||
if len(n.notifiers) != 0 {
|
||||
t.Fatalf("Expected len(n.notifiers) == 0, got %d", len(n.notifiers))
|
||||
}
|
||||
|
||||
n.UseServices(mail.New("", ""))
|
||||
|
||||
if len(n.notifiers) != 1 {
|
||||
t.Errorf("Expected len(n.notifiers) == 1, got %d", len(n.notifiers))
|
||||
}
|
||||
|
||||
n.UseServices(
|
||||
mail.New("", ""),
|
||||
mail.New("", ""),
|
||||
)
|
||||
|
||||
if len(n.notifiers) != 3 {
|
||||
t.Errorf("Expected len(n.notifiers) == 3, got %d", len(n.notifiers))
|
||||
}
|
||||
|
||||
n.UseServices(nil)
|
||||
if r := recover(); r != nil {
|
||||
t.Errorf("Expected no panic, got %v", r)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user