Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate CLI to use base url of subdomain api.apimatic.io #30

Merged
merged 7 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/check_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: Run and check build for current commit
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ v3 ]
branches: [ alpha ]
pull_request:
branches: [ v3 ]
branches: [ alpha ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand All @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '12', '13', '14' ]
node: [ '14', '18' ]
name: Node ${{ matrix.node }} sample
steps:
- name: checkout cli
Expand All @@ -41,4 +41,4 @@ jobs:

- name: Check Build
working-directory: 'cli'
run: npm run build
run: npm run build
2 changes: 1 addition & 1 deletion .github/workflows/npm-tag-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
steps:
- name: change-latest-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm dist-tag add @apimatic/cli@${LATEST_VERSION} latest
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '12', '13', '14' ]
node: [ '18' ]
name: Release with Node version ${{ matrix.node }}
steps:
- name: Checkout CLI
Expand Down Expand Up @@ -37,6 +37,6 @@ jobs:
- name: Release
working-directory: cli
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,4 @@ $RECYCLE.BIN/
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

lib/
tmp/
package-lock.json
tmp/
6,939 changes: 6,939 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"lint:fix": "eslint --fix \"src/**/*.{js,ts}\" --quiet"
},
"dependencies": {
"@apimatic/sdk": "^0.1.0-alpha.1",
"@apimatic/sdk": "^0.1.0-alpha.2",
"@oclif/command": "^1.8.0",
"@oclif/config": "^1.17.0",
"@oclif/plugin-autocomplete": "^0.3.0",
Expand Down Expand Up @@ -85,7 +85,7 @@
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^8.10.2",
"typescript": "^3.9.10"
"typescript": "^5.2.2"
},
"oclif": {
"commands": "./lib/commands",
Expand Down
2 changes: 1 addition & 1 deletion src/config/env.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const baseURL = "https://www.apimatic.io/api";
export const baseURL = "https://api.apimatic.io";
7 changes: 6 additions & 1 deletion src/controllers/api/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { writeFileUsingReadableStream } from "../../utils/utils";
import { DownloadTransformationParams, TransformationData, TransformationIdParams } from "../../types/api/transform";
import {
ApiResponse,
ContentType,
ExportFormats,
FileWrapper,
Transformation,
Expand All @@ -21,7 +22,11 @@ export const getTransformationId = async (
let generation: ApiResponse<Transformation>;
if (file) {
const fileDescriptor = new FileWrapper(fs.createReadStream(file));
generation = await transformationController.transformViaFile(fileDescriptor, format as ExportFormats);
generation = await transformationController.transformViaFile(
ContentType.EnumMultipartformdata,
fileDescriptor,
format as ExportFormats
);
} else if (url) {
const body: TransformViaUrlRequest = {
url: url,
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/api/validate.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import cli from "cli-ux";
import * as fs from "fs-extra";

import { ApiResponse, FileWrapper } from "@apimatic/core";
import { ApiResponse, FileWrapper } from "@apimatic/sdk";
import { GetValidationParams } from "../../types/api/validate";
import { APIValidationExternalApisController, ApiValidationSummary } from "@apimatic/sdk";
import { APIValidationExternalApisController, ApiValidationSummary, ContentType } from "@apimatic/sdk";

export const getValidation = async (
{ file, url }: GetValidationParams,
Expand All @@ -14,7 +14,7 @@ export const getValidation = async (
cli.action.start("Validating specification file");
if (file) {
const fileDescriptor = new FileWrapper(fs.createReadStream(file));
validation = await apiValidationController.validateAPIViaFile(fileDescriptor);
validation = await apiValidationController.validateAPIViaFile(ContentType.EnumMultipartformdata, fileDescriptor);
} else if (url) {
validation = await apiValidationController.validateAPIViaURL(url);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/sdk/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Platforms,
GenerateSdkViaUrlRequest
} from "@apimatic/sdk";
import { ApiResponse, FileWrapper } from "@apimatic/core";
import { ApiResponse, FileWrapper } from "@apimatic/sdk";
import { GenerationIdParams, SimplePlatforms, DownloadSDKParams } from "../../types/sdk/generate";
import { unzipFile, writeFileUsingReadableStream } from "../../utils/utils";

Expand Down