mirror of
https://github.com/jlengrand/adyen-node-api-library.git
synced 2026-03-10 08:01:20 +00:00
PW-6881: Generate more models (#915)
* PW-6881: Base generation on checked out branch * Base the new PR on the current PR's branch * PW-6881: Set base on checkout * PW-6881: Generate Stored Value models * PW-6881: Permission issue * PW-6881: Run container without root * PW-6881: Supporting files are required * PW-6881: Remove debugging event * PW-6881: Add POS Terminal Management * PW-6881: Add Classic integration * PW-6881: Generate Recurring models * Update README.md Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>
This commit is contained in:
9
.github/workflows/models.yml
vendored
9
.github/workflows/models.yml
vendored
@@ -7,14 +7,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
name: Generate Models
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v3
|
||||
- name: Generate models
|
||||
run: make models
|
||||
- name: Overwrite current models
|
||||
run: |
|
||||
rm -rf src/typings/checkout
|
||||
cp -r build/model src/typings/checkout
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
@@ -26,4 +21,4 @@ jobs:
|
||||
title: Update models
|
||||
body: OpenAPI spec or templates produced new models.
|
||||
add-paths: |
|
||||
src/typings/checkout
|
||||
src/typings
|
||||
|
||||
52
Makefile
52
Makefile
@@ -1,26 +1,38 @@
|
||||
generator=typescript-node
|
||||
openapi-generator-cli=docker run --rm -v ${PWD}:/local -w /local openapitools/openapi-generator-cli:v5.4.0
|
||||
generator:=typescript-node
|
||||
openapi-generator-cli:=docker run --user $(shell id -u):$(shell id -g) --rm -v ${PWD}:/local -w /local openapitools/openapi-generator-cli:v5.4.0
|
||||
services:=checkout storedValue terminalManagement payments recurring
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
# Generate models (for each service)
|
||||
models: $(services)
|
||||
|
||||
# Extract templates (copy them for modifications)
|
||||
.PHONY: templates
|
||||
templates:
|
||||
$(openapi-generator-cli) author template -g ${generator} -o build/templates/typescript
|
||||
checkout: spec=CheckoutService-v69
|
||||
storedValue: spec=StoredValueService-v46
|
||||
terminalManagement: spec=TfmAPIService-v1
|
||||
payments: spec=PaymentService-v68
|
||||
recurring: spec=RecurringService-v68
|
||||
|
||||
build/spec:
|
||||
mkdir -p build/spec
|
||||
|
||||
# Fetch spec files (git clone/submodule?)
|
||||
build/spec/CheckoutService-v69.json: build/spec
|
||||
wget https://raw.githubusercontent.com/Adyen/adyen-openapi/main/json/CheckoutService-v69.json -O build/spec/CheckoutService-v69.json
|
||||
sed -i 's/"openapi" : "3.[0-9].[0-9]"/"openapi" : "3.0.0"/' build/spec/CheckoutService-v69.json
|
||||
|
||||
models: build/spec/CheckoutService-v69.json
|
||||
$(services): build/spec
|
||||
rm -rf src/typings/$@ build/model
|
||||
$(openapi-generator-cli) generate \
|
||||
-i build/spec/CheckoutService-v69.json \
|
||||
-g ${generator} \
|
||||
-i build/spec/json/$(spec).json \
|
||||
-g $(generator) \
|
||||
-t templates/typescript \
|
||||
-o build \
|
||||
--global-property models,supportingFiles
|
||||
--global-property models,supportingFiles
|
||||
mv build/model src/typings/$@
|
||||
|
||||
# Checkout spec (and patch version)
|
||||
build/spec:
|
||||
git clone https://github.com/Adyen/adyen-openapi.git build/spec
|
||||
sed -i 's/"openapi" : "3.[0-9].[0-9]"/"openapi" : "3.0.0"/' build/spec/json/*.json
|
||||
|
||||
# Extract templates (copy them for modifications)
|
||||
templates:
|
||||
$(openapi-generator-cli) author template -g $(generator) -o build/templates/typescript
|
||||
|
||||
# Discard generated artifacts and changed models
|
||||
clean:
|
||||
git checkout src/typings
|
||||
git clean -f -d src/typings
|
||||
|
||||
.PHONY: templates models $(services)
|
||||
@@ -14,8 +14,8 @@ This is the officially supported NodeJS library for using Adyen's APIs.
|
||||
The Library supports all APIs under the following services:
|
||||
|
||||
* [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v69/overview): Our latest integration for accepting online payments. Current supported version: **v69**
|
||||
* [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v64/overview): Our classic integration for online payments. Current supported version: **v64**
|
||||
* [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v49/overview): Endpoints for managing saved payment details. Current supported version: **68**
|
||||
* [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v68/overview): Our classic integration for online payments. Current supported version: **v68**
|
||||
* [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v68/overview): Endpoints for managing saved payment details. Current supported version: **v68**
|
||||
* [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v64/overview): Endpoints for sending funds to your customers. Current supported version: **v64**
|
||||
* [Platforms APIs](https://docs.adyen.com/platforms/api): Set of APIs when using Adyen for Platforms.
|
||||
* [Account API](https://docs.adyen.com/api-explorer/#/Account/v6/overview) Current supported version: **v6**
|
||||
|
||||
Reference in New Issue
Block a user