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 2 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
2 changes: 1 addition & 1 deletion 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
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";
3 changes: 2 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,7 @@ 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