Revert "Revert "feat: add SKYVERN_BASE_URL environment variable support for client base URL""
This reverts commit d0ea267ad1.
This commit is contained in:
@@ -1,59 +0,0 @@
|
|||||||
import { CopyIcon } from "@radix-ui/react-icons";
|
|
||||||
import {
|
|
||||||
DropdownMenu,
|
|
||||||
DropdownMenuContent,
|
|
||||||
DropdownMenuItem,
|
|
||||||
DropdownMenuTrigger,
|
|
||||||
} from "@/components/ui/dropdown-menu";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { useToast } from "@/components/ui/use-toast";
|
|
||||||
import { copyText } from "@/util/copyText";
|
|
||||||
import {
|
|
||||||
type ApiRequest,
|
|
||||||
getCurlCommand,
|
|
||||||
getPowerShellCommand,
|
|
||||||
} from "@/util/apiCommands";
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
getRequest: () => ApiRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
function CopyApiCommandDropdown({ getRequest }: Props) {
|
|
||||||
const { toast } = useToast();
|
|
||||||
|
|
||||||
const handleCopy = async (type: "curl" | "powershell") => {
|
|
||||||
const request = getRequest();
|
|
||||||
const text =
|
|
||||||
type === "curl" ? getCurlCommand(request) : getPowerShellCommand(request);
|
|
||||||
await copyText(text);
|
|
||||||
toast({
|
|
||||||
variant: "success",
|
|
||||||
title: "Copied to Clipboard",
|
|
||||||
description:
|
|
||||||
type === "curl"
|
|
||||||
? "The cURL command has been copied to your clipboard."
|
|
||||||
: "The PowerShell command has been copied to your clipboard.",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DropdownMenu>
|
|
||||||
<DropdownMenuTrigger asChild>
|
|
||||||
<Button variant="secondary">
|
|
||||||
<CopyIcon className="mr-2 h-4 w-4" />
|
|
||||||
Copy API Command
|
|
||||||
</Button>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
<DropdownMenuContent align="end">
|
|
||||||
<DropdownMenuItem onSelect={() => handleCopy("curl")}>
|
|
||||||
Copy cURL (Unix/Linux/macOS)
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem onSelect={() => handleCopy("powershell")}>
|
|
||||||
Copy PowerShell (Windows)
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { CopyApiCommandDropdown };
|
|
||||||
@@ -20,12 +20,14 @@ import { toast } from "@/components/ui/use-toast";
|
|||||||
import { useApiCredential } from "@/hooks/useApiCredential";
|
import { useApiCredential } from "@/hooks/useApiCredential";
|
||||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||||
import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
|
import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
|
||||||
|
import { copyText } from "@/util/copyText";
|
||||||
import { apiBaseUrl } from "@/util/env";
|
import { apiBaseUrl } from "@/util/env";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { PlayIcon, ReloadIcon } from "@radix-ui/react-icons";
|
import { CopyIcon, PlayIcon, ReloadIcon } from "@radix-ui/react-icons";
|
||||||
import { ToastAction } from "@radix-ui/react-toast";
|
import { ToastAction } from "@radix-ui/react-toast";
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { AxiosError } from "axios";
|
import { AxiosError } from "axios";
|
||||||
|
import fetchToCurl from "fetch-to-curl";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useForm, useFormState } from "react-hook-form";
|
import { useForm, useFormState } from "react-hook-form";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
@@ -37,7 +39,6 @@ import {
|
|||||||
} from "./taskFormTypes";
|
} from "./taskFormTypes";
|
||||||
import { ProxySelector } from "@/components/ProxySelector";
|
import { ProxySelector } from "@/components/ProxySelector";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import { CopyApiCommandDropdown } from "@/components/CopyApiCommandDropdown";
|
|
||||||
type Props = {
|
type Props = {
|
||||||
initialValues: CreateNewTaskFormValues;
|
initialValues: CreateNewTaskFormValues;
|
||||||
};
|
};
|
||||||
@@ -621,17 +622,30 @@ function CreateNewTaskForm({ initialValues }: Props) {
|
|||||||
</TaskFormSection>
|
</TaskFormSection>
|
||||||
|
|
||||||
<div className="flex justify-end gap-3">
|
<div className="flex justify-end gap-3">
|
||||||
<CopyApiCommandDropdown
|
<Button
|
||||||
getRequest={() => ({
|
type="button"
|
||||||
method: "POST",
|
variant="secondary"
|
||||||
url: `${apiBaseUrl}/tasks`,
|
onClick={async () => {
|
||||||
body: createTaskRequestObject(form.getValues()),
|
const curl = fetchToCurl({
|
||||||
headers: {
|
method: "POST",
|
||||||
"Content-Type": "application/json",
|
url: `${apiBaseUrl}/tasks`,
|
||||||
"x-api-key": apiCredential ?? "<your-api-key>",
|
body: createTaskRequestObject(form.getValues()),
|
||||||
},
|
headers: {
|
||||||
})}
|
"Content-Type": "application/json",
|
||||||
/>
|
"x-api-key": apiCredential ?? "<your-api-key>",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
copyText(curl).then(() => {
|
||||||
|
toast({
|
||||||
|
title: "Copied cURL",
|
||||||
|
description: "cURL copied to clipboard",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CopyIcon className="mr-2 h-4 w-4" />
|
||||||
|
cURL
|
||||||
|
</Button>
|
||||||
<Button type="submit" disabled={mutation.isPending}>
|
<Button type="submit" disabled={mutation.isPending}>
|
||||||
{mutation.isPending && (
|
{mutation.isPending && (
|
||||||
<ReloadIcon className="mr-2 h-4 w-4 animate-spin" />
|
<ReloadIcon className="mr-2 h-4 w-4 animate-spin" />
|
||||||
|
|||||||
@@ -16,12 +16,14 @@ import { useApiCredential } from "@/hooks/useApiCredential";
|
|||||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||||
import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
|
import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
|
||||||
import { SubmitEvent } from "@/types";
|
import { SubmitEvent } from "@/types";
|
||||||
|
import { copyText } from "@/util/copyText";
|
||||||
import { apiBaseUrl } from "@/util/env";
|
import { apiBaseUrl } from "@/util/env";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { PlayIcon, ReloadIcon } from "@radix-ui/react-icons";
|
import { CopyIcon, PlayIcon, ReloadIcon } from "@radix-ui/react-icons";
|
||||||
import { ToastAction } from "@radix-ui/react-toast";
|
import { ToastAction } from "@radix-ui/react-toast";
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { AxiosError } from "axios";
|
import { AxiosError } from "axios";
|
||||||
|
import fetchToCurl from "fetch-to-curl";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useForm, useFormState } from "react-hook-form";
|
import { useForm, useFormState } from "react-hook-form";
|
||||||
import { Link, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
@@ -31,7 +33,6 @@ import { TaskFormSection } from "./TaskFormSection";
|
|||||||
import { savedTaskFormSchema, SavedTaskFormValues } from "./taskFormTypes";
|
import { savedTaskFormSchema, SavedTaskFormValues } from "./taskFormTypes";
|
||||||
import { OrganizationApiResponse, ProxyLocation } from "@/api/types";
|
import { OrganizationApiResponse, ProxyLocation } from "@/api/types";
|
||||||
import { ProxySelector } from "@/components/ProxySelector";
|
import { ProxySelector } from "@/components/ProxySelector";
|
||||||
import { CopyApiCommandDropdown } from "@/components/CopyApiCommandDropdown";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
initialValues: SavedTaskFormValues;
|
initialValues: SavedTaskFormValues;
|
||||||
@@ -736,17 +737,31 @@ function SavedTaskForm({ initialValues }: Props) {
|
|||||||
</TaskFormSection>
|
</TaskFormSection>
|
||||||
|
|
||||||
<div className="flex justify-end gap-3">
|
<div className="flex justify-end gap-3">
|
||||||
<CopyApiCommandDropdown
|
<Button
|
||||||
getRequest={() => ({
|
type="button"
|
||||||
method: "POST",
|
variant="secondary"
|
||||||
url: `${apiBaseUrl}/tasks`,
|
onClick={async () => {
|
||||||
body: createTaskRequestObject(form.getValues()),
|
const curl = fetchToCurl({
|
||||||
headers: {
|
method: "POST",
|
||||||
"Content-Type": "application/json",
|
url: `${apiBaseUrl}/tasks`,
|
||||||
"x-api-key": apiCredential ?? "<your-api-key>",
|
body: createTaskRequestObject(form.getValues()),
|
||||||
},
|
headers: {
|
||||||
})}
|
"Content-Type": "application/json",
|
||||||
/>
|
"x-api-key": apiCredential ?? "<your-api-key>",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
copyText(curl).then(() => {
|
||||||
|
toast({
|
||||||
|
variant: "success",
|
||||||
|
title: "Copied successfully",
|
||||||
|
description: "cURL copied to clipboard",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CopyIcon className="mr-2 h-4 w-4" />
|
||||||
|
cURL
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
name="save"
|
name="save"
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ import { useApiCredential } from "@/hooks/useApiCredential";
|
|||||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||||
import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
|
import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
|
||||||
import { WorkflowApiResponse } from "@/routes/workflows/types/workflowTypes";
|
import { WorkflowApiResponse } from "@/routes/workflows/types/workflowTypes";
|
||||||
|
import { copyText } from "@/util/copyText";
|
||||||
import { apiBaseUrl } from "@/util/env";
|
import { apiBaseUrl } from "@/util/env";
|
||||||
import { PlayIcon, ReloadIcon } from "@radix-ui/react-icons";
|
import { CopyIcon, PlayIcon, ReloadIcon } from "@radix-ui/react-icons";
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { CopyApiCommandDropdown } from "@/components/CopyApiCommandDropdown";
|
import fetchToCurl from "fetch-to-curl";
|
||||||
import { Link, Outlet, useParams } from "react-router-dom";
|
import { Link, Outlet, useParams } from "react-router-dom";
|
||||||
import { statusIsFinalized } from "../types";
|
import { statusIsFinalized } from "../types";
|
||||||
import { useTaskQuery } from "./hooks/useTaskQuery";
|
import { useTaskQuery } from "./hooks/useTaskQuery";
|
||||||
@@ -179,17 +180,34 @@ function TaskDetails() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<CopyApiCommandDropdown
|
<Button
|
||||||
getRequest={() => ({
|
variant="secondary"
|
||||||
method: "POST",
|
onClick={() => {
|
||||||
url: `${apiBaseUrl}/tasks`,
|
if (!task) {
|
||||||
body: task ? createTaskRequestObject(task) : undefined,
|
return;
|
||||||
headers: {
|
}
|
||||||
"Content-Type": "application/json",
|
const curl = fetchToCurl({
|
||||||
"x-api-key": apiCredential ?? "<your-api-key>",
|
method: "POST",
|
||||||
},
|
url: `${apiBaseUrl}/tasks`,
|
||||||
})}
|
body: createTaskRequestObject(task),
|
||||||
/>
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"x-api-key": apiCredential ?? "<your-api-key>",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
copyText(curl).then(() => {
|
||||||
|
toast({
|
||||||
|
variant: "success",
|
||||||
|
title: "Copied to Clipboard",
|
||||||
|
description:
|
||||||
|
"The cURL command has been copied to your clipboard.",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CopyIcon className="mr-2 h-4 w-4" />
|
||||||
|
cURL
|
||||||
|
</Button>
|
||||||
{taskIsRunningOrQueued && (
|
{taskIsRunningOrQueued && (
|
||||||
<Dialog>
|
<Dialog>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ import { Input } from "@/components/ui/input";
|
|||||||
import { toast } from "@/components/ui/use-toast";
|
import { toast } from "@/components/ui/use-toast";
|
||||||
import { useApiCredential } from "@/hooks/useApiCredential";
|
import { useApiCredential } from "@/hooks/useApiCredential";
|
||||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||||
|
import { copyText } from "@/util/copyText";
|
||||||
import { apiBaseUrl } from "@/util/env";
|
import { apiBaseUrl } from "@/util/env";
|
||||||
import { PlayIcon, ReloadIcon } from "@radix-ui/react-icons";
|
import { CopyIcon, PlayIcon, ReloadIcon } from "@radix-ui/react-icons";
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import { CopyApiCommandDropdown } from "@/components/CopyApiCommandDropdown";
|
import fetchToCurl from "fetch-to-curl";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
@@ -332,20 +333,39 @@ function RunWorkflowForm({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-end gap-2">
|
<div className="flex justify-end gap-2">
|
||||||
<CopyApiCommandDropdown
|
<Button
|
||||||
getRequest={() => ({
|
type="button"
|
||||||
method: "POST",
|
variant="secondary"
|
||||||
url: `${apiBaseUrl}/workflows/${workflowPermanentId}/run`,
|
onClick={() => {
|
||||||
body: getRunWorkflowRequestBody(
|
const values = form.getValues();
|
||||||
form.getValues(),
|
const body = getRunWorkflowRequestBody(
|
||||||
|
values,
|
||||||
workflowParameters,
|
workflowParameters,
|
||||||
),
|
);
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
const curl = fetchToCurl({
|
||||||
"x-api-key": apiCredential ?? "<your-api-key>",
|
method: "POST",
|
||||||
},
|
url: `${apiBaseUrl}/workflows/${workflowPermanentId}/run`,
|
||||||
})}
|
body,
|
||||||
/>
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"x-api-key": apiCredential ?? "<your-api-key>",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
copyText(curl).then(() => {
|
||||||
|
toast({
|
||||||
|
variant: "success",
|
||||||
|
title: "Copied to Clipboard",
|
||||||
|
description:
|
||||||
|
"The cURL command has been copied to your clipboard.",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CopyIcon className="mr-2 h-4 w-4" />
|
||||||
|
cURL
|
||||||
|
</Button>
|
||||||
<Button type="submit" disabled={runWorkflowMutation.isPending}>
|
<Button type="submit" disabled={runWorkflowMutation.isPending}>
|
||||||
{runWorkflowMutation.isPending && (
|
{runWorkflowMutation.isPending && (
|
||||||
<ReloadIcon className="mr-2 h-4 w-4 animate-spin" />
|
<ReloadIcon className="mr-2 h-4 w-4 animate-spin" />
|
||||||
|
|||||||
@@ -17,15 +17,17 @@ import { Skeleton } from "@/components/ui/skeleton";
|
|||||||
import { toast } from "@/components/ui/use-toast";
|
import { toast } from "@/components/ui/use-toast";
|
||||||
import { useApiCredential } from "@/hooks/useApiCredential";
|
import { useApiCredential } from "@/hooks/useApiCredential";
|
||||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||||
|
import { copyText } from "@/util/copyText";
|
||||||
import { apiBaseUrl } from "@/util/env";
|
import { apiBaseUrl } from "@/util/env";
|
||||||
import {
|
import {
|
||||||
|
CopyIcon,
|
||||||
FileIcon,
|
FileIcon,
|
||||||
Pencil2Icon,
|
Pencil2Icon,
|
||||||
PlayIcon,
|
PlayIcon,
|
||||||
ReloadIcon,
|
ReloadIcon,
|
||||||
} from "@radix-ui/react-icons";
|
} from "@radix-ui/react-icons";
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import { CopyApiCommandDropdown } from "@/components/CopyApiCommandDropdown";
|
import fetchToCurl from "fetch-to-curl";
|
||||||
import { Link, Outlet, useParams, useSearchParams } from "react-router-dom";
|
import { Link, Outlet, useParams, useSearchParams } from "react-router-dom";
|
||||||
import { statusIsFinalized, statusIsRunningOrQueued } from "../tasks/types";
|
import { statusIsFinalized, statusIsRunningOrQueued } from "../tasks/types";
|
||||||
import { useWorkflowQuery } from "./hooks/useWorkflowQuery";
|
import { useWorkflowQuery } from "./hooks/useWorkflowQuery";
|
||||||
@@ -181,20 +183,37 @@ function WorkflowRun() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<CopyApiCommandDropdown
|
<Button
|
||||||
getRequest={() => ({
|
variant="secondary"
|
||||||
method: "POST",
|
onClick={() => {
|
||||||
url: `${apiBaseUrl}/workflows/${workflowPermanentId}/run`,
|
if (!workflowRun) {
|
||||||
body: {
|
return;
|
||||||
data: workflowRun?.parameters,
|
}
|
||||||
proxy_location: "RESIDENTIAL",
|
const curl = fetchToCurl({
|
||||||
},
|
method: "POST",
|
||||||
headers: {
|
url: `${apiBaseUrl}/workflows/${workflowPermanentId}/run`,
|
||||||
"Content-Type": "application/json",
|
body: {
|
||||||
"x-api-key": apiCredential ?? "<your-api-key>",
|
data: workflowRun?.parameters,
|
||||||
},
|
proxy_location: "RESIDENTIAL",
|
||||||
})}
|
},
|
||||||
/>
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"x-api-key": apiCredential ?? "<your-api-key>",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
copyText(curl).then(() => {
|
||||||
|
toast({
|
||||||
|
variant: "success",
|
||||||
|
title: "Copied to Clipboard",
|
||||||
|
description:
|
||||||
|
"The cURL command has been copied to your clipboard.",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CopyIcon className="mr-2 h-4 w-4" />
|
||||||
|
cURL
|
||||||
|
</Button>
|
||||||
<Button asChild variant="secondary">
|
<Button asChild variant="secondary">
|
||||||
<Link to={`/workflows/${workflowPermanentId}/edit`}>
|
<Link to={`/workflows/${workflowPermanentId}/edit`}>
|
||||||
<Pencil2Icon className="mr-2 h-4 w-4" />
|
<Pencil2Icon className="mr-2 h-4 w-4" />
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
import fetchToCurl from "fetch-to-curl";
|
|
||||||
|
|
||||||
export type ApiRequest = {
|
|
||||||
method: string;
|
|
||||||
url: string;
|
|
||||||
body?: unknown;
|
|
||||||
headers: Record<string, string>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function getCurlCommand(request: ApiRequest): string {
|
|
||||||
return fetchToCurl(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getPowerShellCommand(request: ApiRequest): string {
|
|
||||||
const { method, url, headers, body } = request;
|
|
||||||
const headerLines = Object.entries(headers)
|
|
||||||
.map(([key, value]) => ` '${key}' = '${value}'`)
|
|
||||||
.join("\n");
|
|
||||||
const bodyJson = body ? JSON.stringify(body, null, 2) : undefined;
|
|
||||||
const bodyLine = bodyJson
|
|
||||||
? ` Body = '${bodyJson.replace(/'/g, "''")}'\n`
|
|
||||||
: "";
|
|
||||||
return (
|
|
||||||
`$Params = @{\n` +
|
|
||||||
` Uri = '${url}'\n` +
|
|
||||||
` Method = '${method}'\n` +
|
|
||||||
` Headers = @{\n${headerLines}\n }\n` +
|
|
||||||
bodyLine +
|
|
||||||
`}\n` +
|
|
||||||
`Invoke-RestMethod @Params`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
# This file was auto-generated by Fern from our API Definition.
|
# This file was auto-generated by Fern from our API Definition.
|
||||||
|
|
||||||
|
import os
|
||||||
import typing
|
import typing
|
||||||
|
import logging
|
||||||
from .environment import SkyvernEnvironment
|
from .environment import SkyvernEnvironment
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
from .core.client_wrapper import SyncClientWrapper
|
from .core.client_wrapper import SyncClientWrapper
|
||||||
from .types.run_engine import RunEngine
|
from .types.run_engine import RunEngine
|
||||||
from .types.proxy_location import ProxyLocation
|
from .types.proxy_location import ProxyLocation
|
||||||
@@ -42,7 +46,9 @@ class Skyvern:
|
|||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
base_url : typing.Optional[str]
|
base_url : typing.Optional[str]
|
||||||
The base url to use for requests from the client.
|
The base url to use for requests from the client. If omitted, the value
|
||||||
|
of the ``SKYVERN_BASE_URL`` environment variable is used when set; otherwise
|
||||||
|
it falls back to the selected ``environment``.
|
||||||
|
|
||||||
environment : SkyvernEnvironment
|
environment : SkyvernEnvironment
|
||||||
The environment to use for requests from the client. from .environment import SkyvernEnvironment
|
The environment to use for requests from the client. from .environment import SkyvernEnvironment
|
||||||
@@ -1622,7 +1628,9 @@ class AsyncSkyvern:
|
|||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
base_url : typing.Optional[str]
|
base_url : typing.Optional[str]
|
||||||
The base url to use for requests from the client.
|
The base url to use for requests from the client. If omitted, the value
|
||||||
|
of the ``SKYVERN_BASE_URL`` environment variable is used when set; otherwise
|
||||||
|
it falls back to the selected ``environment``.
|
||||||
|
|
||||||
environment : SkyvernEnvironment
|
environment : SkyvernEnvironment
|
||||||
The environment to use for requests from the client. from .environment import SkyvernEnvironment
|
The environment to use for requests from the client. from .environment import SkyvernEnvironment
|
||||||
@@ -3353,8 +3361,16 @@ class AsyncSkyvern:
|
|||||||
|
|
||||||
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SkyvernEnvironment) -> str:
|
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SkyvernEnvironment) -> str:
|
||||||
if base_url is not None:
|
if base_url is not None:
|
||||||
|
logger.debug("Using explicit base_url: %s", base_url)
|
||||||
return base_url
|
return base_url
|
||||||
elif environment is not None:
|
|
||||||
|
env_base_url = os.getenv("SKYVERN_BASE_URL")
|
||||||
|
if env_base_url:
|
||||||
|
logger.debug("Using SKYVERN_BASE_URL from environment: %s", env_base_url)
|
||||||
|
return env_base_url
|
||||||
|
|
||||||
|
if environment is not None:
|
||||||
|
logger.debug("Using base_url from environment enum: %s", environment.value)
|
||||||
return environment.value
|
return environment.value
|
||||||
else:
|
|
||||||
raise Exception("Please pass in either base_url or environment to construct the client")
|
raise Exception("Please pass in either base_url or environment to construct the client")
|
||||||
|
|||||||
Reference in New Issue
Block a user