Reorder codegens in alphabetical order

This commit is contained in:
Liyas Thomas
2020-10-30 18:16:34 +05:30
parent 5b4dd74503
commit 5cb6d10e3d
16 changed files with 68 additions and 72 deletions

View File

@@ -1,6 +1,6 @@
export const CLibCurlCodeGen = {
id: "C LibCurl",
name: "C LibCurl",
export const CLibcurlCodegen = {
id: "c-libcurl",
name: "C libcurl",
generator: ({
auth,
httpUser,

View File

@@ -1,6 +1,6 @@
import { isJSONContentType } from "~/helpers/utils/contenttypes"
export const CsRestSharpCodegen = {
export const CsRestsharpCodegen = {
id: "cs-restsharp",
name: "C# RestSharp",
generator: ({

View File

@@ -2,7 +2,7 @@ import { isJSONContentType } from "~/helpers/utils/contenttypes"
export const GoNativeCodegen = {
id: "go-native",
name: "Golang Native",
name: "Go Native",
generator: ({
url,
pathName,

View File

@@ -1,6 +1,6 @@
export const JavaOkHttpClientCodegen = {
id: "Java OkHTTP Client",
name: "Java OkHTTP Client",
export const JavaOkhttpCodegen = {
id: "java-okhttp",
name: "Java OkHttp",
generator: ({
auth,
httpUser,

View File

@@ -1,5 +1,3 @@
import { isJSONContentType } from "~/helpers/utils/contenttypes"
export const JavaUnirestCodegen = {
id: "java-unirest",
name: "Java Unirest",
@@ -32,18 +30,18 @@ export const JavaUnirestCodegen = {
]
// create client and request
const verb = verbs.find((v) => v.verb === method)
requestString.push(`HttpResponse<String> response = Unirest.${verb.unirestMethod}("${url}${pathName}${queryString}")\n`)
if (auth === "Basic Auth") {
requestString.push(
`HttpResponse<String> response = Unirest.${verb.unirestMethod}("${url}${pathName}${queryString}")\n`
)
if (auth === "Basic Auth") {
const basic = `${httpUser}:${httpPassword}`
requestString.push(
`.header("authorization", "Basic ${window.btoa(
unescape(encodeURIComponent(basic))
)}") \n`
`.header("authorization", "Basic ${window.btoa(unescape(encodeURIComponent(basic)))}") \n`
)
} else if (auth === "Bearer Token" || auth === "OAuth 2.0") {
requestString.push(`.header("authorization", "Bearer ${bearerToken}") \n`)
}
// custom headers
// custom headers
if (headers) {
headers.forEach(({ key, value }) => {
if (key) {
@@ -52,20 +50,20 @@ export const JavaUnirestCodegen = {
})
}
if (contentType) {
requestString.push(`.header("Content-Type", "${contentType}")\n`)
}
requestString.push(`.header("Content-Type", "${contentType}")\n`)
}
// set body
if (["POST", "PUT", "PATCH", "DELETE"].includes(method)) {
if (contentType.includes("x-www-form-urlencoded")) {
requestBody = `"${requestBody}"`
}else
{ requestBody = JSON.stringify(requestBody)
}
if (["POST", "PUT", "PATCH", "DELETE"].includes(method)) {
if (contentType.includes("x-www-form-urlencoded")) {
requestBody = `"${requestBody}"`
} else {
requestBody = JSON.stringify(requestBody)
}
requestString.push(`.body(${requestBody})`)
}
requestString.push(`\n.asString();\n`)
requestString.push(`.body(${requestBody})`)
}
requestString.push(`\n.asString();\n`)
return requestString.join("")
},
}

View File

@@ -1,6 +1,6 @@
import { isJSONContentType } from "~/helpers/utils/contenttypes"
export const JSFetchCodegen = {
export const JavascriptFetchCodegen = {
id: "js-fetch",
name: "JavaScript Fetch",
generator: ({

View File

@@ -1,5 +1,5 @@
export const JSjQueryCodegen = {
id: "js-jQuery",
export const JavascriptJqueryCodegen = {
id: "js-jquery",
name: "JavaScript jQuery",
generator: ({
url,

View File

@@ -1,6 +1,6 @@
import { isJSONContentType } from "~/helpers/utils/contenttypes"
export const JSXHRCodegen = {
export const JavascriptXhrCodegen = {
id: "js-xhr",
name: "JavaScript XHR",
generator: ({

View File

@@ -1,8 +1,6 @@
import { isJSONContentType } from "~/helpers/utils/contenttypes"
export const JSAxiosCodegen = {
id: "js-axios",
name: "JavaScript Axios",
export const NodejsAxiosCodegen = {
id: "nodejs-axios",
name: "NodeJs Axios",
generator: ({
url,
pathName,

View File

@@ -1,6 +1,6 @@
import { isJSONContentType } from "~/helpers/utils/contenttypes"
export const NodeJsNativeCodegen = {
export const NodejsNativeCodegen = {
id: "nodejs-native",
name: "NodeJs Native",
generator: ({

View File

@@ -1,6 +1,6 @@
import { isJSONContentType } from "~/helpers/utils/contenttypes"
export const NodeJsRequestCodegen = {
export const NodejsRequestCodegen = {
id: "nodejs-request",
name: "NodeJs Request",
generator: ({

View File

@@ -1,6 +1,6 @@
export const PowerShellRestMethod = {
export const PowershellRestmethodCodegen = {
id: "powershell-restmethod",
name: "Powershell RestMethod",
name: "PowerShell RestMethod",
generator: ({
url,
pathName,

View File

@@ -10,7 +10,7 @@ const printHeaders = (headers) => {
export const PythonHttpClientCodegen = {
id: "python-http-client",
name: "Python HTTP Client",
name: "Python http.client",
generator: ({
url,
pathName,

View File

@@ -1,4 +1,4 @@
export const ShellHTTPie = {
export const ShellHttpieCodegen = {
id: "shell-httpie",
name: "Shell HTTPie",
generator: ({

View File

@@ -1,6 +1,6 @@
export const WgetCodegen = {
id: "wget",
name: "wget",
export const ShellWgetCodegen = {
id: "shell-wget",
name: "Shell wget",
generator: ({
url,
pathName,