diff --git a/.codeclimate.yml b/.codeclimate.yml
deleted file mode 100644
index c84b2ee..0000000
--- a/.codeclimate.yml
+++ /dev/null
@@ -1,88 +0,0 @@
-# This is a sample .codeclimate.yml configured for Engine analysis on Code
-# Climate Platform. For an overview of the Code Climate Platform, see here:
-# http://docs.codeclimate.com/article/300-the-codeclimate-platform
-
-# Under the engines key, you can configure which engines will analyze your repo.
-# Each key is an engine name. For each value, you need to specify enabled: true
-# to enable the engine as well as any other engines-specific configuration.
-
-# For more details, see here:
-# http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
-
-# For a list of all available engines, see here:
-# http://docs.codeclimate.com/article/296-engines-available-engines
-
-#engines:
-# to turn on an engine, add it here and set enabled to `true`
-# to turn off an engine, set enabled to `false` or remove it
-# rubocop:
-# enabled: true
-# golint:
-# enabled: true
-# gofmt:
-# enabled: true
-# eslint:
-# enabled: true
-# csslint:
-# enabled: true
-
-# Engines can analyze files and report issues on them, but you can separately
-# decide which files will receive ratings based on those issues. This is
-# specified by path patterns under the ratings key.
-
-# For more details see here:
-# http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
-
-# ratings:
-# paths:
-# - app/**
-# - lib/**
-# - "**.rb"
-# - "**.go"
-
-# You can globally exclude files from being analyzed by any engine using the
-# exclude_paths key.
-
-#All maintainability checks are enabled by default with the following configurations.
-#checks,
-# argument-count:
-# config:
-# threshold: 4
-# complex-logic:
-# config:
-# threshold: 4
-# file-lines:
-# config:
-# threshold: 250
-# method-complexity:
-# config:
-# threshold: 5
-# method-count:
-# config:
-# threshold: 20
-# method-lines:
-# config:
-# threshold: 25
-# nested-control-flow:
-# config:
-# threshold: 4
-# return-statements:
-# config:
-# threshold: 4
-# similar-code:
-# config:
-# threshold: # language-specific defaults. an override will affect all languages.
-# identical-code:
-# config:
-# threshold: # language-specific defaults. an override will affect all languages.
-
-engines:
- sonar-java:
- enabled: true
- channel: beta
-
-exclude_paths:
-- "scripts/"
-- ".github/"
-- "gradle/"
-- "**/test/"
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
deleted file mode 100644
index 221c533..0000000
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-contact_links:
- - name: Twilio SendGrid Support
- url: https://support.sendgrid.com
- about: Get Support
- - name: Stack Overflow
- url: https://stackoverflow.com/questions/tagged/java-http-client+or+sendgrid+java
- about: Ask questions on Stack Overflow
- - name: Documentation
- url: https://sendgrid.com/docs/for-developers/
- about: View Reference Documentation
diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml
new file mode 100644
index 0000000..2f5232b
--- /dev/null
+++ b/.github/workflows/pr-lint.yml
@@ -0,0 +1,15 @@
+name: Lint PR
+on:
+ pull_request_target:
+ types: [ opened, edited, synchronize, reopened ]
+
+jobs:
+ validate:
+ name: Validate title
+ runs-on: ubuntu-latest
+ steps:
+ - uses: amannn/action-semantic-pull-request@v4
+ with:
+ types: chore docs fix feat test misc
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml
new file mode 100644
index 0000000..9abc8c2
--- /dev/null
+++ b/.github/workflows/test-and-deploy.yml
@@ -0,0 +1,93 @@
+name: Test and Deploy
+on:
+ push:
+ branches: [ '*' ]
+ tags: [ '*' ]
+ pull_request:
+ branches: [ main ]
+ schedule:
+ # Run automatically at 8AM PST Monday-Friday
+ - cron: '0 15 * * 1-5'
+ workflow_dispatch:
+
+jobs:
+ test:
+ name: Test
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ strategy:
+ matrix:
+ java: [ 8, 11, 17 ]
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Java
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: ${{ matrix.java }}
+ cache: 'maven'
+
+ - run: mvn install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
+ - name: Run Unit Tests
+ run: mvn test -B
+
+ deploy:
+ name: Deploy
+ if: success() && github.ref_type == 'tag'
+ needs: [ test ]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Sonatype Maven
+ uses: actions/setup-java@v2
+ with:
+ java-version: 8
+ distribution: temurin
+ server-id: ossrh
+ server-username: MAVEN_USERNAME
+ server-password: MAVEN_PASSWORD
+ gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
+ gpg-passphrase: GPG_PASSPHRASE
+
+ - name: Install Dependencies
+ run: make install
+
+ - name: Create GitHub Release
+ uses: sendgrid/dx-automator/actions/release@main
+ with:
+ assets: java-http-client.jar
+ footer: '**[Maven](https://mvnrepository.com/artifact/com.sendgrid/java-http-client/${version})**'
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Publish to Maven
+ env:
+ MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
+ GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
+ run: mvn clean deploy -DskipTests=true -B -U -Prelease
+
+ - name: Submit metric to Datadog
+ uses: sendgrid/dx-automator/actions/datadog-release-metric@main
+ env:
+ DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
+
+ notify-on-failure:
+ name: Slack notify on failure
+ if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
+ needs: [ test, deploy ]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: failure
+ SLACK_ICON_EMOJI: ':github:'
+ SLACK_MESSAGE: ${{ format('Test *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
+ SLACK_TITLE: Action Failure - ${{ github.repository }}
+ SLACK_USERNAME: GitHub Actions
+ SLACK_MSG_AUTHOR: twilio-dx
+ SLACK_FOOTER: Posted automatically using GitHub Actions
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
+ MSG_MINIMAL: true
diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml
new file mode 100644
index 0000000..35ec8ed
--- /dev/null
+++ b/.github/workflows/update-dependencies.yml
@@ -0,0 +1,60 @@
+name: Update dependencies
+on:
+ schedule:
+ # Run automatically at 7AM PST Tuesday
+ - cron: '0 14 * * 2'
+ workflow_dispatch:
+
+jobs:
+ update-dependencies-and-test:
+ name: Update Dependencies & Test
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ strategy:
+ max-parallel: 1
+ matrix:
+ java: [ 8, 11, 17 ]
+
+ steps:
+ - name: Checkout java-http-client
+ uses: actions/checkout@v2
+
+ - name: Set up Java
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: ${{ matrix.java }}
+ cache: 'maven'
+
+ - name: Updating semver dependencies
+ run: make update-deps
+
+ - run: mvn install -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
+
+ - name: Add & Commit
+ if: matrix.java == '17'
+ uses: EndBug/add-and-commit@v8.0.2
+ env:
+ GITHUB_TOKEN: ${{ secrets.SG_JAVA_GITHUB_TOKEN }}
+ with:
+ add: 'pom.xml'
+ default_author: 'github_actions'
+ message: 'chore: update java-http-client dependencies'
+
+ notify-on-failure:
+ name: Slack notify on failure
+ if: failure()
+ needs: [ update-dependencies-and-test ]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: failure
+ SLACK_ICON_EMOJI: ':github:'
+ SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, {1}/{2}/actions/runs/{3}', needs.update-dependencies-and-test.result, github.server_url, github.repository, github.run_id) }}
+ SLACK_TITLE: Action Failure - ${{ github.repository }}
+ SLACK_USERNAME: GitHub Actions
+ SLACK_MSG_AUTHOR: twilio-dx
+ SLACK_FOOTER: Posted automatically using GitHub Actions
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
+ MSG_MINIMAL: true
diff --git a/.maven.xml b/.maven.xml
deleted file mode 100644
index bef1ab6..0000000
--- a/.maven.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
- ossrh
- ${env.SONATYPE_USERNAME}
- ${env.SONATYPE_PASSWORD}
-
-
-
-
-
- ossrh
-
- true
-
-
- ${env.GPG_EXECUTABLE}
- ${env.GPG_PASSPHRASE}
-
-
-
-
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 3fa7c29..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-language: java
-before_install:
-- echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import --batch || true
-- echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust --batch || true
-jdk:
-- openjdk8
-- openjdk11
-install:
-- mvn --settings .maven.xml install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true
- -B -V
-after_success:
-- bash <(curl -s https://codecov.io/bash) -t $CODECOV_KEY
-deploy:
-- provider: script
- script: mvn clean deploy --settings .maven.xml -DskipTests=true -B -U -Prelease
- skip_cleanup: true
- on:
- tags: true
- jdk: openjdk8
- branch: main
-notifications:
- slack:
- if: branch = main
- on_pull_requests: false
- on_success: never
- on_failure: change
- rooms:
- secure: jnmSBE28sD/3ZFMDtnBtrxpB4h8aOPmqXJXv7rUQMUflf5+9slbaj8des72QpNAWOJnHjY0MasfKCuQlau9b5iPllJEF3aVswCORFErsLT3U5UW4qolC0MeTygj3g6RQUsrgFxuUxOrDW6OSkFV4gASyrFIqeI+pBj8Xu0YAdxnIJGTAKYQ+c8wLL4uiUgle3id0QRTv6BArezROjAlFpE7S40BCN/ulgVOT1X0gD3HtuXkSscnmnqmWY2UurbHQ3yPcR2xJo75tY6Hf4CxTJAqioVH8ygbboMMFYbzhlfZyGofbz01g5mUNRB6s39AnoxoOhkDJRJY6J3i+xhJBufLN8XxiFyq176ngZJDjCF/pjg5sWDdlmG8pHZawrBEecMOrg29CnuuBzNZpWz1+93cOD4Ak1UtZC5m04+X8oMUx1Q+pjRPdFJYSHXStBBYNV1/aNCNIOFVm6tAN+JgpO6I3aEKI2PMJaxeqUtU931pEzz/48DJYCHIsL7ZSDopPjenPck6UfhrwE4fubzwfac8JVnwTGKqENlVChPP7jMTb8tK2a2RpMel7PMrriTUm+RMoEFi8x2wntPm9CdqQ+bn8VsOppQ2IIOj85d4prcPxfTJMUsKAQh5WRHHT472WxH+OOOFYo6fZLEam+toTmW/zeK8+oCefVy+1SQR8hHk=
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c22cfe7..e4a94c6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,48 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
+[2022-05-18] Version 4.5.1
+--------------------------
+**Library - Docs**
+- [PR #144](https://github.com/sendgrid/java-http-client/pull/144): Update to align with SendGrid Support. Thanks to [@garethpaul](https://github.com/garethpaul)!
+
+**Library - Fix**
+- [PR #143](https://github.com/sendgrid/java-http-client/pull/143): override default gh token. Thanks to [@beebzz](https://github.com/beebzz)!
+
+
+[2022-03-09] Version 4.5.0
+--------------------------
+**Library - Chore**
+- [PR #142](https://github.com/sendgrid/java-http-client/pull/142): push Datadog Release Metric upon deploy success. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
+
+**Library - Feature**
+- [PR #141](https://github.com/sendgrid/java-http-client/pull/141): add GH action to update dependencies. Thanks to [@JenniferMah](https://github.com/JenniferMah)!
+
+
+[2022-02-09] Version 4.4.0
+--------------------------
+**Library - Chore**
+- [PR #139](https://github.com/sendgrid/java-http-client/pull/139): upgrade supported language versions. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
+- [PR #138](https://github.com/sendgrid/java-http-client/pull/138): add gh release to workflow. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)!
+- [PR #137](https://github.com/sendgrid/java-http-client/pull/137): merge test and deploy workflows. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)!
+
+**Library - Feature**
+- [PR #134](https://github.com/sendgrid/java-http-client/pull/134): Support multiple duplicate queryparams. Thanks to [@mjjs](https://github.com/mjjs)!
+
+
+[2022-01-12] Version 4.3.9
+--------------------------
+**Library - Chore**
+- [PR #136](https://github.com/sendgrid/java-http-client/pull/136): update license year. Thanks to [@JenniferMah](https://github.com/JenniferMah)!
+
+
+[2021-12-01] Version 4.3.8
+--------------------------
+**Library - Chore**
+- [PR #135](https://github.com/sendgrid/java-http-client/pull/135): fix pom for release. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
+- [PR #133](https://github.com/sendgrid/java-http-client/pull/133): migrate to github actions. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
+
+
[2021-05-19] Version 4.3.7
--------------------------
**Library - Chore**
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7069100..ff28f44 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,7 +1,5 @@
Hello! Thank you for choosing to help contribute to one of the SendGrid open source projects. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies.
-- [Feature Request](#feature-request)
-- [Submit a Bug Report](#submit-a-bug-report)
- [Improvements to the Codebase](#improvements-to-the-codebase)
- [Understanding the Code Base](#understanding-the-codebase)
- [Testing](#testing)
@@ -9,33 +7,6 @@ Hello! Thank you for choosing to help contribute to one of the SendGrid open sou
- [Creating a Pull Request](#creating-a-pull-request)
- [Code Reviews](#code-reviews)
-
-## Feature Request
-
-If you'd like to make a feature request, please read this section.
-
-The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions:
-
-- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
-- Please be respectful and considerate of others when commenting on issues
-
-
-## Submit a Bug Report
-
-Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
-
-A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report.
-
-Before you decide to create a new issue, please try the following:
-
-1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
-2. Update to the latest version of this code and check if the issue has already been fixed
-3. Copy and fill in the Bug Report Template we have provided below
-
-### Please use our Bug Report Template
-
-In order to make the process easier, we've included a [sample bug report template](ISSUE_TEMPLATE.md).
-
## Improvements to the Codebase
diff --git a/FIRST_TIMERS.md b/FIRST_TIMERS.md
index fe354fe..ab29f04 100644
--- a/FIRST_TIMERS.md
+++ b/FIRST_TIMERS.md
@@ -51,29 +51,3 @@ git push origin
## Important notice
Before creating a pull request, make sure that you respect the repository's constraints regarding contributions. You can find them in the [CONTRIBUTING.md](CONTRIBUTING.md) file.
-
-## Repositories with Open, Easy, Help Wanted, Issue Filters
-
-* [Python SDK](https://github.com/sendgrid/sendgrid-python/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [PHP SDK](https://github.com/sendgrid/sendgrid-php/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [C# SDK](https://github.com/sendgrid/sendgrid-csharp/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Ruby SDK](https://github.com/sendgrid/sendgrid-ruby/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Node.js SDK](https://github.com/sendgrid/sendgrid-nodejs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Java SDK](https://github.com/sendgrid/sendgrid-java/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Go SDK](https://github.com/sendgrid/sendgrid-go/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Python SMTPAPI Client](https://github.com/sendgrid/smtpapi-python/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [PHP SMTPAPI Client](https://github.com/sendgrid/smtpapi-php/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [C# SMTPAPI Client](https://github.com/sendgrid/smtpapi-csharp/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Ruby SMTPAPI Client](https://github.com/sendgrid/smtpapi-ruby/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Node.js SMTPAPI Client](https://github.com/sendgrid/smtpapi-nodejs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Java SMTPAPI Client](https://github.com/sendgrid/smtpapi-java/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Go SMTPAPI Client](https://github.com/sendgrid/smtpapi-go/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Python HTTP Client](https://github.com/sendgrid/python-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [PHP HTTP Client](https://github.com/sendgrid/php-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [C# HTTP Client](https://github.com/sendgrid/csharp-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Java HTTP Client](https://github.com/sendgrid/java-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Ruby HTTP Client](https://github.com/sendgrid/ruby-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Go HTTP Client](https://github.com/sendgrid/rest/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Open API Definition](https://github.com/sendgrid/sendgrid-oai/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [DX Automator](https://github.com/sendgrid/dx-automator/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
-* [Documentation](https://github.com/sendgrid/docs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
deleted file mode 100644
index b05b163..0000000
--- a/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-### Issue Summary
-A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, or code examples.
-
-### Steps to Reproduce
-1. This is the first step
-2. This is the second step
-3. Further steps, etc.
-
-### Code Snippet
-```java
-# paste code here
-```
-
-### Exception/Log
-```
-# paste exception/log here
-```
-
-### Technical details:
-* java-http-client version:
-* java version:
-
diff --git a/LICENSE b/LICENSE
index e5439a9..3154774 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (C) 2021, Twilio SendGrid, Inc.
+Copyright (C) 2023, Twilio SendGrid, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
diff --git a/Makefile b/Makefile
index 3d76197..851986a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: install package test test-integration clean
+.PHONY: install package test update-deps test-integration clean
VERSION := $(shell mvn help:evaluate -Dexpression=project.version --batch-mode | grep -e '^[^\[]')
install:
@@ -13,5 +13,8 @@ package:
test:
mvn test
+update-deps:
+ mvn versions:use-latest-releases versions:commit -DallowMajorUpdates=false
+
clean:
mvn clean
diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md
index 593da34..bc85492 100644
--- a/PULL_REQUEST_TEMPLATE.md
+++ b/PULL_REQUEST_TEMPLATE.md
@@ -3,7 +3,7 @@ We appreciate the effort for this pull request but before that please make sure
Please format the PR title appropriately based on the type of change:
[!]:
-Where is one of: docs, chore, feat, fix, test.
+Where is one of: docs, chore, feat, fix, test, misc.
Add a '!' after the type for breaking changes (e.g. feat!: new breaking feature).
**All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.**
diff --git a/README.md b/README.md
index f7bee96..0f646b8 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@

-[](https://travis-ci.com/sendgrid/java-http-client)
+[](https://github.com/sendgrid/java-http-client/actions/workflows/test-and-deploy.yml)
[](http://mvnrepository.com/artifact/com.sendgrid/java-http-client)
[](LICENSE)
[](https://twitter.com/sendgrid)
@@ -18,11 +18,11 @@ If you are looking for the SendGrid API client library, please see [this repo](h
* [Usage](./USAGE.md)
* [How to Contribute](#contribute)
* [About](#about)
+* [Support](#support)
* [License](#license)
# Announcements
-**The default branch name for this repository has been changed to `main` as of 07/27/2020.**
All updates to this project are documented in our [CHANGELOG](CHANGELOG.md).
@@ -31,7 +31,7 @@ All updates to this project are documented in our [CHANGELOG](CHANGELOG.md).
## Prerequisites
-- Java 8 or 11
+- Java 8, 11, or 17
## Install via Maven w/ Gradle
@@ -39,7 +39,7 @@ All updates to this project are documented in our [CHANGELOG](CHANGELOG.md).
...
dependencies {
...
- compile 'com.sendgrid:java-http-client:4.3.7'
+ compile 'com.sendgrid:java-http-client:4.5.1'
}
repositories {
@@ -54,16 +54,12 @@ repositories {
com.sendgrid
java-http-client
- 4.3.7
+ 4.5.1
```
`mvn install`
-## Install via Fat Jar
-
-[sendgrid-java-latest.jar](http://dx.sendgrid.com/downloads/java-http-client/java-http-client-latest.jar)
-
## Dependencies
- Please see the [pom.xml file](pom.xml)
@@ -100,6 +96,8 @@ try {
request.addHeader("Authorization", "Bearer YOUR_API_KEY");
request.addQueryParam("limit", "100");
request.addQueryParam("offset", "0");
+// Will be parsed to categories=cake&categories=pie&categories=baking
+request.addQueryParam("categories", "cake&pie&baking");
request.setBody("{\"name\": \"My Request Body\"}");
request.setMethod(Method.POST);
String param = "param";
@@ -132,7 +130,10 @@ Quick links:
java-http-client is maintained and funded by Twilio SendGrid, Inc. The names and logos for java-http-client are trademarks of Twilio SendGrid, Inc.
-If you need help installing or using the library, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).
+
+# Support
+
+If you need help using SendGrid, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).
If you've instead found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo!
diff --git a/pom.xml b/pom.xml
index 6ace9b5..efcc8d7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
jar
A simple HTTP client
HTTP REST client, simplified for Java
- 4.3.7
+ 4.5.1
https://github.com/sendgrid/java-http-client
@@ -24,41 +24,9 @@
https://github.com/sendgrid/java-http-client
scm:git:git@github.com:sendgrid/java-http-client.git
scm:git:git@github.com:sendgrid/java-http-client.git
- 4.3.7
+ 4.5.1
-
- gpg
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.6
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
- ${gpg.keyname}
- ${gpg.passphrase}
-
- --pinentry-mode
- loopback
-
-
-
-
-
-
release
@@ -116,6 +84,14 @@
sign
+
+ ${gpg.keyname}
+ ${gpg.passphrase}
+
+ --pinentry-mode
+ loopback
+
+
@@ -143,7 +119,7 @@
org.apache.httpcomponents
httpcore
- 4.4.14
+ 4.4.15
org.apache.httpcomponents
diff --git a/src/main/java/com/sendgrid/Client.java b/src/main/java/com/sendgrid/Client.java
index 340f12c..d0865fd 100644
--- a/src/main/java/com/sendgrid/Client.java
+++ b/src/main/java/com/sendgrid/Client.java
@@ -9,6 +9,8 @@
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
+import java.util.Arrays;
+import java.util.List;
import org.apache.http.Header;
import org.apache.http.HttpMessage;
@@ -129,8 +131,19 @@ public URI buildUri(String baseUri, String endpoint, Map queryPa
builder.setPath(endpoint);
if (queryParams != null) {
+ String multiValueDelimiter = "&";
+
for (Map.Entry entry : queryParams.entrySet()) {
- builder.setParameter(entry.getKey(), entry.getValue());
+ String value = entry.getValue();
+
+ if (value.indexOf(multiValueDelimiter) != -1) {
+ List values = Arrays.asList(value.split(multiValueDelimiter));
+ for (String val : values) {
+ builder.addParameter(entry.getKey(), val);
+ }
+ } else {
+ builder.setParameter(entry.getKey(), entry.getValue());
+ }
}
}
diff --git a/src/test/java/com/sendgrid/ClientTest.java b/src/test/java/com/sendgrid/ClientTest.java
index 9367379..0425199 100644
--- a/src/test/java/com/sendgrid/ClientTest.java
+++ b/src/test/java/com/sendgrid/ClientTest.java
@@ -33,8 +33,10 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -62,6 +64,7 @@ public void testbuildUri() {
Map queryParams = new HashMap();
queryParams.put("test1", "1");
queryParams.put("test2", "2");
+ queryParams.put("test3", "3&4&5");
try {
uri = client.buildUri(baseUri, endpoint, queryParams);
} catch (URISyntaxException ex) {
@@ -70,10 +73,23 @@ public void testbuildUri() {
Assert.assertTrue(errors.toString(), false);
}
- String url = uri.toString();
- System.out.println(url);
- Assert.assertTrue(url.equals("https://api.test.com/endpoint?test2=2&test1=1") ||
- url.equals("https://api.test.com/endpoint?test1=1&test2=2"));
+ URL url = null;
+ try {
+ url = uri.toURL();
+ } catch (MalformedURLException ex) {
+ StringWriter errors = new StringWriter();
+ ex.printStackTrace(new PrintWriter(errors));
+ Assert.assertTrue(errors.toString(), false);
+ }
+
+ Assert.assertTrue(url.getProtocol().equals("https"));
+ Assert.assertTrue(url.getHost().equals("api.test.com"));
+ Assert.assertTrue(url.getPath().equals("/endpoint"));
+ Assert.assertTrue(this.queryParamHasCorrectValue(url, "test1", "1"));
+ Assert.assertTrue(this.queryParamHasCorrectValue(url, "test2", "2"));
+ Assert.assertTrue(this.queryParamHasCorrectValue(url, "test3", "3"));
+ Assert.assertTrue(this.queryParamHasCorrectValue(url, "test3", "4"));
+ Assert.assertTrue(this.queryParamHasCorrectValue(url, "test3", "5"));
}
@Test
@@ -174,4 +190,8 @@ public void testPut() {
public void testDelete() {
testMethod(Method.DELETE, 204);
}
+
+ private boolean queryParamHasCorrectValue(URL url, String key, String value) {
+ return url.getQuery().indexOf(key + "=" + value) != -1;
+ }
}
diff --git a/src/test/java/com/sendgrid/TestRequiredFilesExist.java b/src/test/java/com/sendgrid/TestRequiredFilesExist.java
index fa73126..02e3d35 100644
--- a/src/test/java/com/sendgrid/TestRequiredFilesExist.java
+++ b/src/test/java/com/sendgrid/TestRequiredFilesExist.java
@@ -29,15 +29,6 @@ public class TestRequiredFilesExist {
assertTrue(new File("./.gitignore").exists());
}
- // ./.travis.yml
- @Test public void checkTravisExists() {
- assertTrue(new File("./.travis.yml").exists());
- }
-
- // ./.codeclimate.yml
- @Test public void checkCodeClimateExists() {
- assertTrue(new File("./.codeclimate.yml").exists());
- }
// ./CHANGELOG.md
@Test public void checkChangelogExists() {
@@ -54,11 +45,6 @@ public class TestRequiredFilesExist {
assertTrue(new File("./CONTRIBUTING.md").exists());
}
- // ./ISSUE_TEMPLATE.md
- @Test public void checkIssuesTemplateExists() {
- assertTrue(new File("./ISSUE_TEMPLATE.md").exists());
- }
-
// ./LICENSE
@Test public void checkLicenseExists() {
assertTrue(new File("./LICENSE").exists());