Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: patch-technology/patch-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.4.0
Choose a base ref
...
head repository: patch-technology/patch-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 11,572 additions and 1,669 deletions.
  1. BIN .DS_Store
  2. +2 −1 .flake8
  3. +1 −0 .github/PULL_REQUEST_TEMPLATE.md
  4. +0 −13 .github/workflows/black.yml
  5. +33 −0 .github/workflows/health_check.yml
  6. +32 −4 .github/workflows/publish.yml
  7. +10 −5 .github/workflows/test.yml
  8. +4 −1 .gitignore
  9. +0 −23 .openapi-generator-ignore
  10. +0 −1 .openapi-generator/VERSION
  11. +14 −8 .pre-commit-config.yaml
  12. +182 −0 CHANGELOG.md
  13. +32 −0 Dockerfile
  14. +11 −7 Makefile
  15. +74 −58 README.md
  16. +4 −4 patch_api/__init__.py
  17. +2 −1 patch_api/api/__init__.py
  18. +1,257 −82 patch_api/api/estimates_api.py
  19. +726 −0 patch_api/api/order_line_items_api.py
  20. +561 −28 patch_api/api/orders_api.py
  21. +0 −563 patch_api/api/preferences_api.py
  22. +181 −11 patch_api/api/projects_api.py
  23. +260 −0 patch_api/api/technology_types_api.py
  24. +21 −8 patch_api/api_client.py
  25. +9 −9 patch_api/configuration.py
  26. +3 −3 patch_api/exceptions.py
  27. +38 −7 patch_api/models/__init__.py
  28. +347 −0 patch_api/models/create_air_shipping_estimate_request.py
  29. +232 −0 patch_api/models/create_bitcoin_estimate_request.py
  30. +294 −0 patch_api/models/create_ecommerce_estimate_request.py
  31. +326 −0 patch_api/models/create_flight_estimate_request.py
  32. +322 −0 patch_api/models/create_hotel_estimate_request.py
  33. +79 −68 patch_api/models/{allocation.py → create_mass_estimate_request.py}
  34. +393 −0 patch_api/models/create_order_line_item_request.py
  35. +481 −0 patch_api/models/create_order_request.py
  36. +425 −0 patch_api/models/create_rail_shipping_estimate_request.py
  37. +601 −0 patch_api/models/create_road_shipping_estimate_request.py
  38. +520 −0 patch_api/models/create_sea_shipping_estimate_request.py
  39. +157 −0 patch_api/models/create_success_response.py
  40. +27 −25 patch_api/models/{preference_response.py → delete_order_response.py}
  41. +254 −0 patch_api/models/disclaimer.py
  42. +8 −6 patch_api/models/error_response.py
  43. +12 −10 patch_api/models/estimate.py
  44. +8 −6 patch_api/models/estimate_list_response.py
  45. +8 −6 patch_api/models/estimate_response.py
  46. +192 −0 patch_api/models/highlight.py
  47. +344 −0 patch_api/models/inventory.py
  48. +8 −6 patch_api/models/meta_index_object.py
  49. +255 −129 patch_api/models/order.py
  50. +149 −0 patch_api/models/order_issued_to.py
  51. +406 −0 patch_api/models/order_line_item.py
  52. +157 −0 patch_api/models/order_line_item_project.py
  53. +180 −0 patch_api/models/order_line_item_response.py
  54. +8 −6 patch_api/models/order_list_response.py
  55. +8 −6 patch_api/models/order_response.py
  56. +151 −0 patch_api/models/parent_technology_type.py
  57. +8 −6 patch_api/models/photo.py
  58. +121 −0 patch_api/models/place_order_request.py
  59. +0 −197 patch_api/models/preference.py
  60. +348 −121 patch_api/models/project.py
  61. +8 −6 patch_api/models/project_list_response.py
  62. +8 −6 patch_api/models/project_response.py
  63. +8 −6 patch_api/models/sdg.py
  64. +8 −6 patch_api/models/standard.py
  65. +197 −0 patch_api/models/technology_type.py
  66. +29 −67 patch_api/models/{preference_list_response.py → technology_type_list_response.py}
  67. +366 −0 patch_api/models/update_order_line_item_request.py
  68. +65 −11 patch_api/rest.py
  69. +7 −8 setup.py
  70. +35 −0 test/projects/test_technology_types_api.py
  71. +226 −50 test/test_estimates_api.py
  72. +207 −5 test/test_orders_api.py
  73. +0 −65 test/test_preferences_api.py
  74. +64 −10 test/test_projects_api.py
  75. +58 −0 test/test_rest.py
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -3,4 +3,5 @@
# W504 is the "line break before binary operator" error and is disabled since we use
# the black code formatter.
# W503 is disabled by default, but must be disabled explicitly when using `ignore`.
ignore = E501, W503, W504
# F401 is "unused import", which is hard to fix without modifying the templates
ignore = E501, W503, W504, F401
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -12,4 +12,5 @@
- [ ] Have you built the library locally and made queries against it successfully?
- [ ] Did you update the changelog?
- [ ] Did you bump the package version?
- [ ] If endpoints were removed, did you manually remove the corresponding files? (this should be rare)
- [ ] For breaking changes, did you plan for the release of the new SDK versions and deploy the API to production?
13 changes: 0 additions & 13 deletions .github/workflows/black.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/health_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Health check
on:
schedule:
- cron: '0 17 * * *'

jobs:
build-and-test:
runs-on: ubuntu-latest
name: Run tests
strategy:
matrix:
python: ['3.12']
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ matrix.python }}

- name: Run tests
env:
SANDBOX_API_KEY: ${{ secrets.SANDBOX_API_KEY }}
run: make test

- name: Notify slack
if: failure()
uses: kpritam/slack-job-status-action@54eea0dd141dd572d7fbbe96416e9c5d8ba57976 # v0.1.2
with:
job-status: ${{ job.status }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel: eng-notifications
36 changes: 32 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -7,14 +7,24 @@ jobs:
publish:
name: Publish
runs-on: ubuntu-latest
env:
TARGET_URL: https://pypi.org/project/patch-api/
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0

- uses: chrnorm/deployment-action@releases/v1
name: Create GitHub deployment
id: deployment
with:
token: "${{ github.token }}"
target_url: ${{ env.TARGET_URL }}
environment: production

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@e9aba2c848f5ebd159c070c61ea2c4e2b122355e # v2.3.4
with:
python-version: '3.6'
python-version: "3.12"

- name: Run tests
env:
@@ -38,7 +48,25 @@ jobs:
.
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: ${{ env.TARGET_URL }}
state: "success"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}

- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: ${{ env.TARGET_URL }}
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
15 changes: 10 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -6,17 +6,22 @@ on:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- uses: actions/setup-python@e9aba2c848f5ebd159c070c61ea2c4e2b122355e # v2.3.4
- uses: psf/black@stable
with:
version: "24.10.0"

build-and-test:
runs-on: ubuntu-latest
name: Python Library tests
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.6'
- name: Run tests
env:
SANDBOX_API_KEY: ${{ secrets.SANDBOX_API_KEY }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -64,4 +64,7 @@ target/
#Ipython Notebook
.ipynb_checkpoints

git_push.sh
# Ignore openapi-generator artifacts
.openapi-generator-ignore
/.openapi-generator/
git_push.sh
23 changes: 0 additions & 23 deletions .openapi-generator-ignore

This file was deleted.

1 change: 0 additions & 1 deletion .openapi-generator/VERSION

This file was deleted.

22 changes: 14 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: black
language_version: python3.6
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: name-tests-test
- repo: https://github.com/pycqa/flake8
rev: "4.0.1"
hooks:
- id: flake8
args: ['--config=.flake8']
- id: flake8
args: ["--config=.flake8"]
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
182 changes: 182 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,6 +5,188 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.1] - 2023-04-18

### Added

- Adds `issuance_type` to `project` responses
- Adds `disclaimers` to `project` responses

## [2.1.0] - 2023-04-04

### Added

- Adds optional `vintage_start_year` and `vintage_end_year` fields to `order` creation
- Adds optional `vintage_start_year` and `vintage_end_year` fields to `order_line_item` create and update
- Adds optional `vintage_start_year` and `vintage_end_year` fields to `inventory` creation
- Adds `vintage_start_year` and `vintage_end_year` fields to `order` response
- Adds `vintage_start_year` and `vintage_end_year` fields to `order_line_item` response
- Adds optional `carrier_scac` field to `patch.estimates.create_road_shipping_estimate`
- Deprecates `create_shipping_estimate` in favor of `create_ecommerce_estimate`

## [1.24.2] - 2022-08-10

### Added

- Adds `patch.estimates.create_ecommerce_estimate` method

## [1.24.0] - 2022-07-22

### Added

- Adds `patch.estimates.create_air_shipping_estimate` method
- Adds `patch.estimates.create_rail_shipping_estimate` method
- Adds `patch.estimates.create_road_shipping_estimate` method
- Adds `patch.estimates.create_sea_shipping_estimate` method

## [1.23.0] - 2022-06-03

### Added

- Adds support for the `issued_to` parameter on `orders`, to add support for creating and placing orders on behalf of another party.

## [1.22.0] - 2022-05-16

### Added

- Adds support for the `accept_language` option on `projects`, to add support for the `Accept-Language` header.

## [1.21.0] - 2022-05-03

### Added

- Adds optional `total_price` and `currency` field to `order` creation
- Adds optional `amount` and `unit` field to `order` creation
- Adds inventory to `project` responses
- Adds inventory to `order` responses

### Changed

- Deprecates `mass_g` and `total_price_cents_usd` fields for create `order` requests
- Deprecates `average_price_per_tonne_cents_usd` and `remaining_mass_g` from `project` responses
- Deprecates `price_cents_usd`, `patch_fee_cents_usd`, and `mass_g` from `order` responses

## [1.20.0] - 2022-04-18

### Added

- Adds optional `vintage_year` field to `order` creation

## [1.19.0] - 2022-04-11
### Added

- Adds ability to create hotel estimates via `api_client.estimates.create_hotel_estimate()`

## [1.18.0] - 2022-03-22
### Changed

- Adds optional `state` field to `order` creation

## [1.17.0] - 2022-01-11

### Changed

- Set the order allocatations array as optional.

## [1.16.0] - 2021-12-07

### Removed

- Removes the `preferences` endpoints (deprecated)

## [1.15.2] - 2021-11-08

### Added

- Adds highlights to project responses

## [1.15.1] - 2021-11-04

### Added

- Adds verifier to project responses

## [1.15.0] - 2021-10-04

### Added

- Added the ability to fetch project technology types via `api_client.technology_types.retrieve_technology_types()`

## [1.14.0] - 2021-09-27

### Added

- Adds mechanism, tagline, state, latitude, longitude, and technology_type to project responses

## [1.13.0] - 2021-09-10

### Added

- Adds ability to create Bitcoin and Ethereum estimates using the daily balance held.

## [1.12.0] - 2021-09-08

### Added

- Adds a `created_at` attribute in all order responses

## [1.11.0] - 2021-09-07

### Added

- Adds support for airports, aircrafts, cabin class and passenger count in flight estimates

## [1.10.0] - 2021-08-27

### Added

- Adds a custom User-Agent header

## [1.9.0] - 2021-08-17

### Added

- Fixed ability to create Orders with `metadata`
- Add support for querying Orders by `metadata`
- Added `transaction_value_eth_gwei` as an alternative way to compute transaction level emissions for ethereum

## [1.8.0] - 2021-07-20

### Added

- Add support for Ethereum estimates

## [1.7.0] - 2021-07-14

### Changed

- [BREAKING] Changed `order.price_cents_usd` and `order.patch_fee_cents_usd` from string to integer.

## [1.6.0] - 2021-07-14

### Added

- Order responses return a `registry_url` field
- Add support for Bitcoin estimates

## [1.5.2] - 2021-03-30

### Fixed

- Fixes [#23](https://github.com/patch-technology/patch-python/issues/23) by allowing the expected parameter `total_price_cents_usd`

## [1.5.1] - 2021-03-02

### Fixed

- Fixed an `AttributeError` that was thrown when Projects with Sustainable Development Goals were retrieved.

## [1.5.0] - 2021-03-01

### Changed

- Changed base URL from https://api.usepatch.com to https://api.patch.io

## [1.4.0] - 2021-02-15

### Added
Loading