Skip to content

Commit

Permalink
chore: initial repo setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Jul 18, 2022
1 parent 040c0a9 commit 67db071
Show file tree
Hide file tree
Showing 96 changed files with 810 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*.sh]
indent_style = space
indent_size = 2
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI

on:
push:
branches: [ master ]
pull_request: ~

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Run sh-checker
uses: luizm/action-sh-checker@master
env:
SHFMT_OPTS: -i 2 -d
SHELLCHECK_OPTS: -e SC2148
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
.idea
16 changes: 16 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Code of Conduct

> Remember the golden rule? Treat others as you'd like to be treated
## Standards

- Create a welcoming and safe community for `everyone`
- Demonstrate empathy towards others, realize that everyone has a different `level of experience`
- Be respectful of others opinions, viewpoints, and experiences
- Give and receive respectful constructive feedback
- Accept responsibility and apologize when necessary
- Focus on what is best for the overall community

## Failure to Follow Standards

If there is a failure to follow the standards laid out above, the user will first be warned. If the offending behavior continues, the user may be blocked entirely.
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing Guide

Please read this document in its entirety.

## General

- Be nice and respectful of maintainers’ and contributors’ time and viewpoints
- Be as descriptive as possible! More info is always better than not enough
- Be patient, there may be a lot of in-flight work, some of it across multiple projects not related to the repo being contributed to
- Have fun!

## Contributing

Contributing comes in many forms! We are incredibly grateful to anyone who can do any of the following:

- Add new features
- Fix bugs
- Fix typos
- Improve docs
- Improve tests
- Triage issues
- Review pull requests
- Share opinions and viewpoints on issues

## Issues

- If your issue is security related, please follow the [SECURITY guide](https://github.com/easypost/.github/SECURITY.md)
- Before opening a new issue, check for existing issues that are related, including closed ones
- Provide as much information as possible about the issue, including how to reproduce the problem and the expected behavior
- Don't needlessly bump issues (eg: if there hasn’t been progress for more than a few weeks, feel free to reach back out)

## Pull Requests

- All Pull Requests should be accompanied first by an issue describing the reason why the Pull Request is needed
- Be as descriptive as possible in your PR description about why the changes are being made and what the changes contain
- Pull Requests should be as small as possible
- Don't make unrelated changes in your Pull Request
- Don't open a Pull Request if you don't plan to see it through. PRs submitted by individuals that cannot complete additional work to get a PR merged may be closed without completion
- Adhere to the existing code style of the repo, even if it differs from your personal preference
- When applicable, add tests that provide ample coverage of the logic added or changed
- Pull Requests should come from branches and never the default `master` branch
- Pull Requests must pass CI, including linting and testing
- Pull Requests must go through code review before they can be merged to the main branch
- Do not include "version bump" changes in the same PR as your code changes; these will be handled as a separate PR and releasing process
- Make sure the `Allow edits from maintainers` checkbox is checked. That way EasyPost engineers can make certain minor changes as needed, allowing your pull request to be merged sooner.

You agree and acknowledge that you have necessary intellectual property rights to provide your Contribution and hereby assign to EasyPost all right, title and interest in such Contribution.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2022 EasyPost (Simpler Postage, 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 the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## help - Display help about make targets for this Makefile
help:
@cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t

lint-shell:
shellcheck official/docs/curl/**/*.sh -e SC2148
shellcheck official/guides/curl/**/*.sh -e SC2148
shfmt -i 2 -d official/docs/curl
shfmt -i 2 -d official/guides/curl

format-shell:
shfmt -i 2 -w official/docs/curl
shfmt -i 2 -w official/guides/curl

.PHONY: help lint-shell format-shell
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
This repository holds examples for the EasyPost API.
# EasyPost API Examples

[![CI](https://github.com/EasyPost/examples/workflows/CI/badge.svg)](https://github.com/EasyPost/examples/actions?query=workflow%3ACI)

This repository holds hundreds of code examples for using the EasyPost API across 7+ programming languages.

## Folder Structure

- `official` holds all the official code snippets that populate on the EasyPost website
- `docs` holds all the code snippets that populate on our API docs page. Each language will have its own subdirectory
- `guides` holds all the code snippets that populate on our guides page. Each language will have its own subdirectory
- `community` holds code snippets contributed from the community. These may include custom workflows, how to integrate EasyPost with other software, etc
7 changes: 7 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Security Guide

We take security seriously at EasyPost. If you find a security issue or vulnerability in our open source projects, please abide by the following guidelines:

- Please read our [Responsible Disclosure Policy](https://www.easypost.com/privacy#disclosure-policy).
- Do not open an issue on GitHub about the security vulnerability. Doing so draws attention to the issue and exposes it to the public.
- Send an email to `[email protected]` including as many details as possible.
3 changes: 3 additions & 0 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Support Guide

Looking for support for one of our projects? If your question is related to our API, please contact our support team at `[email protected]`. If you need support regarding this project, create an issue on GitHub with as many details as possible and we’ll take a look.
3 changes: 3 additions & 0 deletions community/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Community Examples

This directory contains examples contributed by the community.
3 changes: 3 additions & 0 deletions official/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Docs Examples

This directory contains official client library examples that populate on the [EasyPost Docs page](https://www.easypost.com/docs/api).
15 changes: 15 additions & 0 deletions official/docs/curl/addresses/create-address.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
curl -X POST https://api.easypost.com/v2/addresses \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"address": {
"street1": "417 MONTGOMERY ST",
"street2": "FLOOR 5",
"city": "SAN FRANCISCO",
"state": "CA",
"zip": "94104",
"country": "US",
"company": "EasyPost",
"phone": "415-123-4567"
}
}'
15 changes: 15 additions & 0 deletions official/docs/curl/addresses/create-and-verify-address.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
curl -X POST https://api.easypost.com/v2/addresses/create_and_verify \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"address": {
"street1": "417 Montgomery Street",
"street2": "FL 5",
"city": "San Francisco",
"state": "CA",
"zip": "94104",
"country": "US",
"company": "EasyPost",
"phone": "415-123-4567"
}
}'
2 changes: 2 additions & 0 deletions official/docs/curl/addresses/retrieve-address.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X GET https://api.easypost.com/v2/addresses/adr_... \
-u "$EASYPOST_API_KEY":
2 changes: 2 additions & 0 deletions official/docs/curl/addresses/retrieve-addresses.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X GET https://api.easypost.com/v2/addresses?page_size=5 \
-u "$EASYPOST_API_KEY":
16 changes: 16 additions & 0 deletions official/docs/curl/addresses/strict-verify-address-on-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
curl -X POST https://api.easypost.com/v2/addresses \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"address": {
"street1": "417 MONTGOMERY ST",
"street2": "FLOOR 5",
"city": "SAN FRANCISCO",
"state": "CA",
"zip": "94104",
"country": "US",
"company": "EasyPost",
"phone": "415-123-4567"
},
"verify_strict": ["delivery"]
}'
16 changes: 16 additions & 0 deletions official/docs/curl/addresses/verify-address-on-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
curl -X POST https://api.easypost.com/v2/addresses \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"address": {
"street1": "417 MONTGOMERY ST",
"street2": "FLOOR 5",
"city": "SAN FRANCISCO",
"state": "CA",
"zip": "94104",
"country": "US",
"company": "EasyPost",
"phone": "415-123-4567"
},
"verify": ["delivery"]
}'
2 changes: 2 additions & 0 deletions official/docs/curl/addresses/verify-existing-address.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X POST https://api.easypost.com/v2/addresses/adr_.../verify \
-u "$EASYPOST_API_KEY":
6 changes: 6 additions & 0 deletions official/docs/curl/api_keys/create-api-key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
curl -X POST https://api.easypost.com/v2/api_keys \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"mode": "test"
}'
2 changes: 2 additions & 0 deletions official/docs/curl/api_keys/delete-api-key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X DELETE https://api.easypost.com/v2/api_keys/ak_... \
-u "$EASYPOST_API_KEY":
2 changes: 2 additions & 0 deletions official/docs/curl/api_keys/disable-api-key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X POST https://api.easypost.com/v2/api_keys/ak_.../disable \
-u "$EASYPOST_API_KEY":
2 changes: 2 additions & 0 deletions official/docs/curl/api_keys/enable-api-key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X POST https://api.easypost.com/v2/api_keys/ak_.../enable \
-u "$EASYPOST_API_KEY":
2 changes: 2 additions & 0 deletions official/docs/curl/api_keys/retrieve-api-keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X GET https://api.easypost.com/v2/api_keys \
-u "$EASYPOST_API_KEY":
15 changes: 15 additions & 0 deletions official/docs/curl/batches/add-shipments-to-batch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
curl -X POST https://api.easypost.com/v2/batches/batch_.../add_shipments \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"batch": {
"shipments": [
{
"id": "shp_..."
},
{
"id": "shp_..."
}
]
}
}'
6 changes: 6 additions & 0 deletions official/docs/curl/batches/batch-labels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
curl -X POST https://api.easypost.com/v2/batches/batch_.../label \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"file_format": "PDF"
}'
2 changes: 2 additions & 0 deletions official/docs/curl/batches/buy-batch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X POST https://api.easypost.com/v2/batches/batch_.../buy \
-u "$EASYPOST_API_KEY":
15 changes: 15 additions & 0 deletions official/docs/curl/batches/create-batch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
curl -X POST https://api.easypost.com/v2/batches \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"batch": {
"shipments": [
{
"id": "shp_..."
},
{
"id": "shp_..."
}
]
}
}'
2 changes: 2 additions & 0 deletions official/docs/curl/batches/manifest-batch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X POST https://api.easypost.com/v2/batches/batch_.../scan_form \
-u "$EASYPOST_API_KEY":
12 changes: 12 additions & 0 deletions official/docs/curl/batches/remove-shipments-from-batch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
curl -X POST https://api.easypost.com/v2/batches/batch_.../remove_shipments \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"batch": {
"shipments": [
{
"id": "shp_..."
}
]
}
}'
2 changes: 2 additions & 0 deletions official/docs/curl/batches/retrieve-batch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X GET https://api.easypost.com/v2/batches/batch_... \
-u "$EASYPOST_API_KEY":
2 changes: 2 additions & 0 deletions official/docs/curl/batches/retrieve-batches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X GET https://api.easypost.com/v2/batches \
-u "$EASYPOST_API_KEY":
2 changes: 2 additions & 0 deletions official/docs/curl/billing/delete-credit-card.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X DELETE https://api.easypost.com/v2/credit_cards/card_... \
-u "$EASYPOST_API_KEY":
6 changes: 6 additions & 0 deletions official/docs/curl/billing/fund-wallet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
curl -X POST https://api.easypost.com/v2/credit_cards/card_.../charges \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"amount": "20"
}'
2 changes: 2 additions & 0 deletions official/docs/curl/billing/retrieve-payment-methods.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X GET https://api.easypost.com/v2/payment_methods \
-u "$EASYPOST_API_KEY":
14 changes: 14 additions & 0 deletions official/docs/curl/brand/update-brand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
curl -X PATCH https://api.easypost.com/v2/users/user_.../brand \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"brand": {
"background_color": "#FFFFFF",
"color": "#303F9F",
"logo": "data:image/png;base64,iVBORw0K...",
"logo_href": "https://easypost.com",
"ad": "null",
"ad_href": "null",
"theme": "theme1"
}
}'
16 changes: 16 additions & 0 deletions official/docs/curl/carrier_accounts/create-carrier-account.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
curl -X POST https://api.easypost.com/v2/carrier_accounts \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"carrier_account": {
"type": "UpsAccount",
"description": "NY Location UPS Account",
"reference": "my-reference",
"credentials": {
"account_number": "A1A1A1",
"user_id": "USERID",
"password": "PASSWORD",
"access_license_number": "ALN"
}
}
}'
2 changes: 2 additions & 0 deletions official/docs/curl/carrier_accounts/delete-carrier-account.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X DELETE https://api.easypost.com/v2/carrier_accounts/ca_... \
-u "$EASYPOST_API_KEY":
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X GET https://api.easypost.com/v2/carrier_accounts/ca_... \
-u "$EASYPOST_API_KEY":
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X GET https://api.easypost.com/v2/carrier_accounts \
-u "$EASYPOST_API_KEY":
11 changes: 11 additions & 0 deletions official/docs/curl/carrier_accounts/update-carrier-account.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
curl -X PATCH https://api.easypost.com/v2/carrier_accounts/ca_... \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"carrier_account": {
"description": "FL Location UPS Account",
"credentials": {
"account_number": "B2B2B2",
}
}
}'
2 changes: 2 additions & 0 deletions official/docs/curl/carrier_types/retrieve-carrier-types.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X GET https://api.easypost.com/v2/carrier_types \
-u "$EASYPOST_API_KEY":
Loading

0 comments on commit 67db071

Please sign in to comment.