diff --git a/.github/clean.rb b/.github/clean.rb index dacc03d..189d4b5 100644 --- a/.github/clean.rb +++ b/.github/clean.rb @@ -3,8 +3,14 @@ ALLOW_LIST = [ ".git", ".github", + ".gitignore", + ".npmignore", ".openapi-generator-ignore", + "CHANGELOG.md", "LICENSE", + "MIGRATION.md", + "README.md", + "node_modules", "openapi", "openapitools.json", "tmp" diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 4ec7986..1c4f2bc 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -27,7 +27,7 @@ jobs: run: echo "::set-output name=version::$(ruby .github/version.rb ${{ github.event.inputs.version_level }})" - name: Clean repo run: ruby .github/clean.rb - - name: Install openapi-generator-cli + - name: Install openapi-generator-cli and Generate SDK run: | npm install @openapitools/openapi-generator-cli -g - run: | @@ -35,7 +35,13 @@ jobs: -i https://raw.githubusercontent.com/mxenabled/openapi/master/openapi/mx_platform_api.yml \ -g typescript-axios \ -c ./openapi/config.yml \ - -t ./openapi/templates + -t ./openapi/templates \ + -o ./latest + - name: Copy documentation to latest + run: | + cp LICENSE ./latest/LICENSE + cp CHANGELOG.md ./latest/CHANGELOG.md + cp MIGRATION.md ./latest/MIGRATION.md - name: Create branch run: git checkout -b "openapi-generator-${{ steps.bump_version.outputs.version }}" - name: Create commit diff --git a/.github/workflows/generate_publish_release.yml b/.github/workflows/generate_publish_release.yml index e61f376..10832e6 100644 --- a/.github/workflows/generate_publish_release.yml +++ b/.github/workflows/generate_publish_release.yml @@ -28,7 +28,13 @@ jobs: -i https://raw.githubusercontent.com/mxenabled/openapi/master/openapi/mx_platform_api.yml \ -g typescript-axios \ -c ./openapi/config.yml \ - -t ./openapi/templates + -t ./openapi/templates \ + -o ./latest + - name: Copy documentation to latest + run: | + cp LICENSE ./latest/LICENSE + cp CHANGELOG.md ./latest/CHANGELOG.md + cp MIGRATION.md ./latest/MIGRATION.md - name: Checkout master run: git checkout master - name: Create commit diff --git a/.github/workflows/on-push-master.yml b/.github/workflows/on-push-master.yml index c8b8fb6..d064f38 100644 --- a/.github/workflows/on-push-master.yml +++ b/.github/workflows/on-push-master.yml @@ -4,18 +4,8 @@ on: push: branches: [master] paths: - # Root-level SDK files (current structure) - # Only trigger publish/release when SDK code changes - - 'api.ts' - - 'base.ts' - - 'common.ts' - - 'configuration.ts' - - 'index.ts' - - 'package.json' - - 'tsconfig.json' - - 'tsconfig.esm.json' - - 'dist/**' - - '.openapi-generator/**' + # Latest version SDK files + - 'latest/**' jobs: Publish: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0962935..26e32f4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,8 +15,11 @@ jobs: with: node-version: "20.x" registry-url: "https://registry.npmjs.org" - - run: npm install - - run: npm publish + - name: Install and Publish + working-directory: ./latest + run: | + npm install + npm publish --tag next env: NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} - name: Slack notification diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2e4a17..35ae98a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: ruby-version: 3.1 - name: Read version id: read_version - run: echo "::set-output name=version::$(ruby .github/version.rb)" + run: echo "::set-output name=version::$(jq -r '.version' ./latest/package.json)" - name: Create tag and release run: | gh release create "v${{ steps.read_version.outputs.version }}" diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore index 056a14c..3530143 100644 --- a/.openapi-generator-ignore +++ b/.openapi-generator-ignore @@ -1 +1,2 @@ git_push.sh +.gitignore \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..330816d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,53 @@ +# Changelog + +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.0.0] - 1/7/2026 + +### Changed +- **Versioning Correction:** Re-released as v2.0.0 to properly indicate breaking changes that were inadvertently introduced in v1.10.1 +- No code changes from v1.12.1 - this is a versioning correction to follow semantic versioning +- Versions v1.10.1 through v1.12.1 are now deprecated on npm in favor of this properly versioned v2.0.0 release + +### ⚠️ BREAKING CHANGES (from v1.10.0) + +**API Class Restructure:** The unified `MxPlatformApi` class has been replaced with granular, domain-specific API classes (e.g., `UsersApi`, `MembersApi`, `AccountsApi`) to better align with the OpenAPI specification structure. This change improves code organization and maintainability but requires migration of existing code. + +**Note:** This breaking change was originally introduced in v1.10.1 but should have been released as v2.0.0. If you are currently using v1.10.1 through v1.12.1, the code is functionally identical to v2.0.0. + +**See [MIGRATION.md](MIGRATION.md) for detailed upgrade instructions.** + +### Changed +- Restructured API classes from single `MxPlatformApi` to domain-specific classes + +## [1.12.1] - 11/25/2025 + +### Fixed +- Updated package template (`package.mustache`) to fix recurring dependency regression + - axios: ^0.21.4 → ^1.6.8 (fixes CVE GHSA-wf5p-g6vw-rhxx) + - typescript: ^3.6.4 → ^5.4.5 + - @types/node: ^12.11.5 → ^20.12.7 +- Added automated validation workflow to prevent template/package.json drift + +### ⚠️ DEPRECATED +This version contains breaking API changes that should have been released as v2.0.0. Please upgrade to v2.0.0 (code is functionally identical, just properly versioned). + +## [1.12.0] and earlier (1.10.1 - 1.12.0) - Various dates + +### ⚠️ DEPRECATED +These versions (v1.10.1 through v1.12.0) contain the breaking API restructure but were incorrectly published as minor/patch releases instead of a major version. They have been deprecated on npm in favor of v2.0.0. + +**If you are on any of these versions:** Please upgrade to v2.0.0. + +## [1.10.0] - 11/5/2025 + +### Note +- Last stable version with unified `MxPlatformApi` class +- Upgrade from this version to v2.0.0 requires code changes (see [MIGRATION.md](MIGRATION.md)) + +--- + +**Note:** This CHANGELOG was created retroactively. For detailed version history prior to v2.0.0, please refer to the [commit history](https://github.com/mxenabled/mx-platform-node/commits/master). diff --git a/MIGRATION.md b/MIGRATION.md new file mode 100644 index 0000000..c77937e --- /dev/null +++ b/MIGRATION.md @@ -0,0 +1,82 @@ +# Migration Guide + +## Upgrading to v2.0.0 from v1.10.0 or earlier + +### Breaking Change: API Class Restructure + +**Important:** Starting with version 2.0.0 (originally introduced in v1.10.1, now properly versioned), the unified `MxPlatformApi` class has been replaced with domain-specific API classes. If you're upgrading from v1.10.0 or earlier, you'll need to update your imports and API instantiation. + +**Note:** Versions v1.10.1 through v1.12.1 are deprecated. If you're on any of these versions, please upgrade to v2.0.0 (functionally identical to v1.12.1, just properly versioned). + +### What Changed + +The library now provides granular API classes organized by domain (Users, Members, Accounts, Transactions, etc.) instead of a single `MxPlatformApi` class. This aligns with the OpenAPI specification structure and provides better code organization. + +### How to Migrate + +**Before (v1.10.0 and earlier):** +```javascript +import { Configuration, MxPlatformApi } from 'mx-platform-node'; + +const client = new MxPlatformApi(configuration); +await client.createUser(requestBody); +await client.listMembers(userGuid); +await client.listAccounts(userGuid); +``` + +**After (v2.0.0+):** +```javascript +import { Configuration, UsersApi, MembersApi, AccountsApi } from 'mx-platform-node'; + +const usersApi = new UsersApi(configuration); +const membersApi = new MembersApi(configuration); +const accountsApi = new AccountsApi(configuration); + +await usersApi.createUser(requestBody); +await membersApi.listMembers(userGuid); +await accountsApi.listAccounts(userGuid); +``` + +### Available API Classes + +The new structure includes the following API classes: + +- `AccountsApi` - Account operations +- `AuthorizationApi` - Authorization operations +- `BudgetsApi` - Budget operations +- `CategoriesApi` - Category operations +- `GoalsApi` - Goal operations +- `InsightsApi` - Insight operations +- `InstitutionsApi` - Institution operations +- `InvestmentHoldingsApi` - Investment holding operations +- `ManagedDataApi` - Managed data operations +- `MembersApi` - Member operations +- `MerchantsApi` - Merchant operations +- `MicrodepositsApi` - Microdeposit operations +- `MonthlyCashFlowProfileApi` - Monthly cash flow profile operations +- `NotificationsApi` - Notification operations +- `ProcessorTokenApi` - Processor token operations +- `RewardsApi` - Rewards operations +- `SpendingPlanApi` - Spending plan operations +- `StatementsApi` - Statement operations +- `TaggingsApi` - Tagging operations +- `TagsApi` - Tag operations +- `TransactionRulesApi` - Transaction rule operations +- `TransactionsApi` - Transaction operations +- `UsersApi` - User operations +- `VerifiableCredentialsApi` - Verifiable credential operations +- `WidgetsApi` - Widget operations + +For the complete list of available methods, please refer to the [API documentation](https://docs.mx.com/api). + +### Migration Checklist + +1. **Update your imports**: Replace `MxPlatformApi` with the specific API classes you need +2. **Update instantiation**: Create separate instances for each API class instead of a single client +3. **Update method calls**: Call methods on the appropriate API class instance +4. **Test thoroughly**: Verify all API calls work as expected with the new structure +5. **Update documentation**: If you have internal docs referencing the old API, update them + +### Need Help? + +If you encounter any issues during migration, please [open an issue](https://github.com/mxenabled/mx-platform-node/issues) on GitHub. diff --git a/README.md b/README.md index d6d1c3a..777ca83 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ In order to make requests, you will need to [sign up](https://dashboard.mx.com/s Please follow the [installation](#installation) procedure and then run the following code to create your first User: ```javascript -import { Configuration, MxPlatformApi } from 'mx-platform-node'; +import { Configuration, UsersApi } from 'mx-platform-node'; const configuration = new Configuration({ // Configure with your Client ID/API Key from https://dashboard.mx.com @@ -57,7 +57,7 @@ const configuration = new Configuration({ } }); -const client = new MxPlatformApi(configuration); +const usersApi = new UsersApi(configuration); const requestBody = { user: { @@ -65,11 +65,15 @@ const requestBody = { } }; -const response = await client.createUser(requestBody); +const response = await usersApi.createUser(requestBody); console.log(response.data); ``` +## Upgrading from v1.x? + +> **⚠️ Breaking Changes in v2.0.0:** If you're upgrading from v1.10.0 or earlier, the API structure has changed significantly. See the [Migration Guide](MIGRATION.md) for detailed instructions on updating your code. + ## Development This project was generated by the [OpenAPI Generator](https://openapi-generator.tech). To generate this library, verify you have the latest version of the `openapi-generator-cli` found [here.](https://github.com/OpenAPITools/openapi-generator#17---npm) diff --git a/latest/.gitignore b/latest/.gitignore new file mode 100644 index 0000000..149b576 --- /dev/null +++ b/latest/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/.npmignore b/latest/.npmignore similarity index 100% rename from .npmignore rename to latest/.npmignore diff --git a/latest/.openapi-generator-ignore b/latest/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/latest/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/FILES b/latest/.openapi-generator/FILES similarity index 77% rename from .openapi-generator/FILES rename to latest/.openapi-generator/FILES index 8a11f47..b616f87 100644 --- a/.openapi-generator/FILES +++ b/latest/.openapi-generator/FILES @@ -1,10 +1,12 @@ .gitignore .npmignore +.openapi-generator-ignore README.md api.ts base.ts common.ts configuration.ts +git_push.sh index.ts package.json tsconfig.esm.json diff --git a/.openapi-generator/VERSION b/latest/.openapi-generator/VERSION similarity index 100% rename from .openapi-generator/VERSION rename to latest/.openapi-generator/VERSION diff --git a/latest/CHANGELOG.md b/latest/CHANGELOG.md new file mode 100644 index 0000000..330816d --- /dev/null +++ b/latest/CHANGELOG.md @@ -0,0 +1,53 @@ +# Changelog + +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.0.0] - 1/7/2026 + +### Changed +- **Versioning Correction:** Re-released as v2.0.0 to properly indicate breaking changes that were inadvertently introduced in v1.10.1 +- No code changes from v1.12.1 - this is a versioning correction to follow semantic versioning +- Versions v1.10.1 through v1.12.1 are now deprecated on npm in favor of this properly versioned v2.0.0 release + +### ⚠️ BREAKING CHANGES (from v1.10.0) + +**API Class Restructure:** The unified `MxPlatformApi` class has been replaced with granular, domain-specific API classes (e.g., `UsersApi`, `MembersApi`, `AccountsApi`) to better align with the OpenAPI specification structure. This change improves code organization and maintainability but requires migration of existing code. + +**Note:** This breaking change was originally introduced in v1.10.1 but should have been released as v2.0.0. If you are currently using v1.10.1 through v1.12.1, the code is functionally identical to v2.0.0. + +**See [MIGRATION.md](MIGRATION.md) for detailed upgrade instructions.** + +### Changed +- Restructured API classes from single `MxPlatformApi` to domain-specific classes + +## [1.12.1] - 11/25/2025 + +### Fixed +- Updated package template (`package.mustache`) to fix recurring dependency regression + - axios: ^0.21.4 → ^1.6.8 (fixes CVE GHSA-wf5p-g6vw-rhxx) + - typescript: ^3.6.4 → ^5.4.5 + - @types/node: ^12.11.5 → ^20.12.7 +- Added automated validation workflow to prevent template/package.json drift + +### ⚠️ DEPRECATED +This version contains breaking API changes that should have been released as v2.0.0. Please upgrade to v2.0.0 (code is functionally identical, just properly versioned). + +## [1.12.0] and earlier (1.10.1 - 1.12.0) - Various dates + +### ⚠️ DEPRECATED +These versions (v1.10.1 through v1.12.0) contain the breaking API restructure but were incorrectly published as minor/patch releases instead of a major version. They have been deprecated on npm in favor of v2.0.0. + +**If you are on any of these versions:** Please upgrade to v2.0.0. + +## [1.10.0] - 11/5/2025 + +### Note +- Last stable version with unified `MxPlatformApi` class +- Upgrade from this version to v2.0.0 requires code changes (see [MIGRATION.md](MIGRATION.md)) + +--- + +**Note:** This CHANGELOG was created retroactively. For detailed version history prior to v2.0.0, please refer to the [commit history](https://github.com/mxenabled/mx-platform-node/commits/master). diff --git a/latest/LICENSE b/latest/LICENSE new file mode 100644 index 0000000..1f8e9a2 --- /dev/null +++ b/latest/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 MX Technologies 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. diff --git a/latest/MIGRATION.md b/latest/MIGRATION.md new file mode 100644 index 0000000..c77937e --- /dev/null +++ b/latest/MIGRATION.md @@ -0,0 +1,82 @@ +# Migration Guide + +## Upgrading to v2.0.0 from v1.10.0 or earlier + +### Breaking Change: API Class Restructure + +**Important:** Starting with version 2.0.0 (originally introduced in v1.10.1, now properly versioned), the unified `MxPlatformApi` class has been replaced with domain-specific API classes. If you're upgrading from v1.10.0 or earlier, you'll need to update your imports and API instantiation. + +**Note:** Versions v1.10.1 through v1.12.1 are deprecated. If you're on any of these versions, please upgrade to v2.0.0 (functionally identical to v1.12.1, just properly versioned). + +### What Changed + +The library now provides granular API classes organized by domain (Users, Members, Accounts, Transactions, etc.) instead of a single `MxPlatformApi` class. This aligns with the OpenAPI specification structure and provides better code organization. + +### How to Migrate + +**Before (v1.10.0 and earlier):** +```javascript +import { Configuration, MxPlatformApi } from 'mx-platform-node'; + +const client = new MxPlatformApi(configuration); +await client.createUser(requestBody); +await client.listMembers(userGuid); +await client.listAccounts(userGuid); +``` + +**After (v2.0.0+):** +```javascript +import { Configuration, UsersApi, MembersApi, AccountsApi } from 'mx-platform-node'; + +const usersApi = new UsersApi(configuration); +const membersApi = new MembersApi(configuration); +const accountsApi = new AccountsApi(configuration); + +await usersApi.createUser(requestBody); +await membersApi.listMembers(userGuid); +await accountsApi.listAccounts(userGuid); +``` + +### Available API Classes + +The new structure includes the following API classes: + +- `AccountsApi` - Account operations +- `AuthorizationApi` - Authorization operations +- `BudgetsApi` - Budget operations +- `CategoriesApi` - Category operations +- `GoalsApi` - Goal operations +- `InsightsApi` - Insight operations +- `InstitutionsApi` - Institution operations +- `InvestmentHoldingsApi` - Investment holding operations +- `ManagedDataApi` - Managed data operations +- `MembersApi` - Member operations +- `MerchantsApi` - Merchant operations +- `MicrodepositsApi` - Microdeposit operations +- `MonthlyCashFlowProfileApi` - Monthly cash flow profile operations +- `NotificationsApi` - Notification operations +- `ProcessorTokenApi` - Processor token operations +- `RewardsApi` - Rewards operations +- `SpendingPlanApi` - Spending plan operations +- `StatementsApi` - Statement operations +- `TaggingsApi` - Tagging operations +- `TagsApi` - Tag operations +- `TransactionRulesApi` - Transaction rule operations +- `TransactionsApi` - Transaction operations +- `UsersApi` - User operations +- `VerifiableCredentialsApi` - Verifiable credential operations +- `WidgetsApi` - Widget operations + +For the complete list of available methods, please refer to the [API documentation](https://docs.mx.com/api). + +### Migration Checklist + +1. **Update your imports**: Replace `MxPlatformApi` with the specific API classes you need +2. **Update instantiation**: Create separate instances for each API class instead of a single client +3. **Update method calls**: Call methods on the appropriate API class instance +4. **Test thoroughly**: Verify all API calls work as expected with the new structure +5. **Update documentation**: If you have internal docs referencing the old API, update them + +### Need Help? + +If you encounter any issues during migration, please [open an issue](https://github.com/mxenabled/mx-platform-node/issues) on GitHub. diff --git a/latest/README.md b/latest/README.md new file mode 100644 index 0000000..777ca83 --- /dev/null +++ b/latest/README.md @@ -0,0 +1,92 @@ +*This project is currently in **Beta**. Please open up an issue [here](https://github.com/mxenabled/mx-platform-node/issues) to report issues using the MX Platform Node.js library.* + +# MX Platform Node.js + +The [MX Platform API](https://www.mx.com/products/platform-api) is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions. + +## Documentation + +Examples for the API endpoints can be found [here.](https://docs.mx.com/api) + +## Requirements + +The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +## Installation + +To build and compile the TypeScript sources to JavaScript use: + +```shell +npm install mx-platform-node +``` + +## Getting Started + +In order to make requests, you will need to [sign up](https://dashboard.mx.com/sign_up) for the MX Platform API and get a `Client ID` and `API Key`. + +Please follow the [installation](#installation) procedure and then run the following code to create your first User: + +```javascript +import { Configuration, UsersApi } from 'mx-platform-node'; + +const configuration = new Configuration({ + // Configure with your Client ID/API Key from https://dashboard.mx.com + username: 'Your Client ID', + password: 'Your API Key', + + // Configure environment. https://int-api.mx.com for development, https://api.mx.com for production + basePath: 'https://int-api.mx.com', + + baseOptions: { + headers: { + Accept: 'application/vnd.mx.api.v1+json' + } + } +}); + +const usersApi = new UsersApi(configuration); + +const requestBody = { + user: { + metadata: 'Creating a user!' + } +}; + +const response = await usersApi.createUser(requestBody); + +console.log(response.data); +``` + +## Upgrading from v1.x? + +> **⚠️ Breaking Changes in v2.0.0:** If you're upgrading from v1.10.0 or earlier, the API structure has changed significantly. See the [Migration Guide](MIGRATION.md) for detailed instructions on updating your code. + +## Development + +This project was generated by the [OpenAPI Generator](https://openapi-generator.tech). To generate this library, verify you have the latest version of the `openapi-generator-cli` found [here.](https://github.com/OpenAPITools/openapi-generator#17---npm) + +Running the following command in this repo's directory will generate this library using the [MX Platform API OpenAPI spec](https://github.com/mxenabled/openapi/blob/master/openapi/mx_platform_api.yml) with our [configuration and templates.](https://github.com/mxenabled/mx-platform-ruby/tree/master/openapi) +```shell +openapi-generator-cli generate \ +-i https://raw.githubusercontent.com/mxenabled/openapi/master/openapi/mx_platform_api.yml \ +-g typescript-axios \ +-c ./openapi/config.yml \ +-t ./openapi/templates +``` + +## Contributing + +Please [open an issue](https://github.com/mxenabled/mx-platform-node/issues) or [submit a pull request.](https://github.com/mxenabled/mx-platform-node/pulls) diff --git a/api.ts b/latest/api.ts similarity index 100% rename from api.ts rename to latest/api.ts diff --git a/base.ts b/latest/base.ts similarity index 100% rename from base.ts rename to latest/base.ts diff --git a/common.ts b/latest/common.ts similarity index 100% rename from common.ts rename to latest/common.ts diff --git a/configuration.ts b/latest/configuration.ts similarity index 100% rename from configuration.ts rename to latest/configuration.ts diff --git a/latest/git_push.sh b/latest/git_push.sh new file mode 100644 index 0000000..f53a75d --- /dev/null +++ b/latest/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/index.ts b/latest/index.ts similarity index 100% rename from index.ts rename to latest/index.ts diff --git a/package.json b/latest/package.json similarity index 87% rename from package.json rename to latest/package.json index a7b501a..6210ff0 100644 --- a/package.json +++ b/latest/package.json @@ -1,6 +1,6 @@ { "name": "mx-platform-node", - "version": "1.12.1", + "version": "2.0.0", "description": "A Node library for the MX Platform API.", "author": "MX", "keywords": [ @@ -12,6 +12,12 @@ "license": "MIT", "main": "./dist/index.js", "typings": "./dist/index.d.ts", + "files": [ + "dist/", + "CHANGELOG.md", + "README.md", + "MIGRATION.md" + ], "scripts": { "build": "tsc --outDir dist/", "prepare": "npm run build" diff --git a/tsconfig.esm.json b/latest/tsconfig.esm.json similarity index 100% rename from tsconfig.esm.json rename to latest/tsconfig.esm.json diff --git a/tsconfig.json b/latest/tsconfig.json similarity index 100% rename from tsconfig.json rename to latest/tsconfig.json diff --git a/openapi/config-latest.yml b/openapi/config-latest.yml index 9338ab5..d2b2b24 100644 --- a/openapi/config-latest.yml +++ b/openapi/config-latest.yml @@ -3,5 +3,5 @@ --- generatorName: typescript-axios npmName: mx-platform-node -npmVersion: 1.12.1 +npmVersion: 2.0.0 supportsES6: true diff --git a/openapi/config-v20111101.yml b/openapi/config-v20111101.yml index 9479856..5e3a8dc 100644 --- a/openapi/config-v20111101.yml +++ b/openapi/config-v20111101.yml @@ -1,5 +1,5 @@ --- generatorName: typescript-axios npmName: mx-platform-node-v20111101 -npmVersion: 1.12.1 +npmVersion: 2.0.0 supportsES6: true diff --git a/openapi/config-v20250224.yml b/openapi/config-v20250224.yml index 0602cfe..5a3e7e1 100644 --- a/openapi/config-v20250224.yml +++ b/openapi/config-v20250224.yml @@ -1,5 +1,5 @@ --- generatorName: typescript-axios npmName: mx-platform-node-v20250224 -npmVersion: 2.0.0 +npmVersion: 3.0.0 supportsES6: true diff --git a/openapi/config.yml b/openapi/config.yml index 64b895d..5efac3a 100644 --- a/openapi/config.yml +++ b/openapi/config.yml @@ -1,4 +1,5 @@ --- npmName: mx-platform-node -npmVersion: 1.12.1 +npmVersion: 2.0.0-rc.1 # Pre-release for testing new directory structure supportsES6: true +.openapi-generator-ignore: true diff --git a/openapi/templates/README.mustache b/openapi/templates/README.mustache index d6d1c3a..777ca83 100644 --- a/openapi/templates/README.mustache +++ b/openapi/templates/README.mustache @@ -40,7 +40,7 @@ In order to make requests, you will need to [sign up](https://dashboard.mx.com/s Please follow the [installation](#installation) procedure and then run the following code to create your first User: ```javascript -import { Configuration, MxPlatformApi } from 'mx-platform-node'; +import { Configuration, UsersApi } from 'mx-platform-node'; const configuration = new Configuration({ // Configure with your Client ID/API Key from https://dashboard.mx.com @@ -57,7 +57,7 @@ const configuration = new Configuration({ } }); -const client = new MxPlatformApi(configuration); +const usersApi = new UsersApi(configuration); const requestBody = { user: { @@ -65,11 +65,15 @@ const requestBody = { } }; -const response = await client.createUser(requestBody); +const response = await usersApi.createUser(requestBody); console.log(response.data); ``` +## Upgrading from v1.x? + +> **⚠️ Breaking Changes in v2.0.0:** If you're upgrading from v1.10.0 or earlier, the API structure has changed significantly. See the [Migration Guide](MIGRATION.md) for detailed instructions on updating your code. + ## Development This project was generated by the [OpenAPI Generator](https://openapi-generator.tech). To generate this library, verify you have the latest version of the `openapi-generator-cli` found [here.](https://github.com/OpenAPITools/openapi-generator#17---npm) diff --git a/openapi/templates/package.mustache b/openapi/templates/package.mustache index 19dd5bf..b1334f2 100644 --- a/openapi/templates/package.mustache +++ b/openapi/templates/package.mustache @@ -12,6 +12,12 @@ "license": "MIT", "main": "./dist/index.js", "typings": "./dist/index.d.ts", + "files": [ + "dist/", + "CHANGELOG.md", + "README.md", + "MIGRATION.md" + ], "scripts": { "build": "tsc --outDir dist/", "prepare": "npm run build"