mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
auto generate frontend types
This commit is contained in:
@@ -34,6 +34,7 @@ def load_all_blocks() -> dict[str, type["Block"]]:
|
||||
|
||||
module_path = str(relative_path)[:-3].replace(os.path.sep, ".")
|
||||
modules.append(module_path)
|
||||
|
||||
for module in modules:
|
||||
if not re.match("^[a-z0-9_.]+$", module):
|
||||
raise ValueError(
|
||||
|
||||
@@ -115,6 +115,12 @@ class AutoRegistry:
|
||||
"""Get a registered provider by name."""
|
||||
with cls._lock:
|
||||
return cls._providers.get(name)
|
||||
|
||||
@classmethod
|
||||
def get_all_provider_names(cls) -> List[str]:
|
||||
"""Get all registered provider names."""
|
||||
with cls._lock:
|
||||
return list(cls._providers.keys())
|
||||
|
||||
@classmethod
|
||||
def clear(cls) -> None:
|
||||
|
||||
100
autogpt_platform/backend/backend/server/integrations/models.py
Normal file
100
autogpt_platform/backend/backend/server/integrations/models.py
Normal file
@@ -0,0 +1,100 @@
|
||||
"""
|
||||
Models for integration-related data structures that need to be exposed in the OpenAPI schema.
|
||||
|
||||
This module provides models that will be included in the OpenAPI schema generation,
|
||||
allowing frontend code generators like Orval to create corresponding TypeScript types.
|
||||
"""
|
||||
|
||||
from typing import Dict, List, Literal
|
||||
|
||||
from pydantic import BaseModel, Field, create_model
|
||||
|
||||
from backend.integrations.providers import ProviderName
|
||||
from backend.sdk.registry import AutoRegistry
|
||||
|
||||
|
||||
def get_all_provider_names() -> List[str]:
|
||||
"""
|
||||
Collect all provider names from both ProviderName enum and AutoRegistry.
|
||||
|
||||
This function should be called at runtime to ensure we get all
|
||||
dynamically registered providers.
|
||||
|
||||
Returns:
|
||||
A sorted list of unique provider names.
|
||||
"""
|
||||
# Get static providers from enum
|
||||
static_providers = [member.value for member in ProviderName]
|
||||
|
||||
# Get dynamic providers from registry
|
||||
dynamic_providers = AutoRegistry.get_all_provider_names()
|
||||
|
||||
# Combine and deduplicate
|
||||
all_providers = list(set(static_providers + dynamic_providers))
|
||||
all_providers.sort()
|
||||
|
||||
return all_providers
|
||||
|
||||
|
||||
# Note: We don't create a static enum here because providers are registered dynamically.
|
||||
# Instead, we expose provider names through API endpoints that can be fetched at runtime.
|
||||
|
||||
|
||||
class ProviderNamesResponse(BaseModel):
|
||||
"""Response containing list of all provider names."""
|
||||
providers: List[str] = Field(
|
||||
description="List of all available provider names",
|
||||
default_factory=get_all_provider_names
|
||||
)
|
||||
|
||||
|
||||
def create_provider_enum_model():
|
||||
"""
|
||||
Dynamically create a model with all provider names as a Literal type.
|
||||
This ensures the OpenAPI schema includes all provider names.
|
||||
"""
|
||||
all_providers = get_all_provider_names()
|
||||
|
||||
if not all_providers:
|
||||
# Fallback if no providers are registered yet
|
||||
all_providers = ["unknown"]
|
||||
|
||||
# Create a Literal type with all provider names
|
||||
# This will be included in the OpenAPI schema
|
||||
ProviderNameLiteral = Literal[tuple(all_providers)] # type: ignore
|
||||
|
||||
# Create a dynamic model that uses this Literal
|
||||
DynamicProviderModel = create_model(
|
||||
'AllProviderNames',
|
||||
provider=(ProviderNameLiteral, Field(description="A provider name from the complete list")),
|
||||
__module__=__name__
|
||||
)
|
||||
|
||||
return DynamicProviderModel
|
||||
|
||||
|
||||
class ProviderConstants(BaseModel):
|
||||
"""
|
||||
Model that exposes all provider names as a constant in the OpenAPI schema.
|
||||
This is designed to be converted by Orval into a TypeScript constant.
|
||||
"""
|
||||
PROVIDER_NAMES: Dict[str, str] = Field(
|
||||
description="All available provider names as a constant mapping",
|
||||
default_factory=lambda: {
|
||||
name.upper().replace('-', '_'): name
|
||||
for name in get_all_provider_names()
|
||||
}
|
||||
)
|
||||
|
||||
class Config:
|
||||
schema_extra = {
|
||||
"example": {
|
||||
"PROVIDER_NAMES": {
|
||||
"OPENAI": "openai",
|
||||
"ANTHROPIC": "anthropic",
|
||||
"EXA": "exa",
|
||||
"GEM": "gem",
|
||||
"EXAMPLE_SERVICE": "example-service"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,11 @@ from backend.integrations.oauth import HANDLERS_BY_NAME
|
||||
from backend.integrations.providers import ProviderName
|
||||
from backend.integrations.webhooks import get_webhook_manager
|
||||
from backend.sdk.registry import AutoRegistry
|
||||
from backend.server.integrations.models import (
|
||||
ProviderConstants,
|
||||
ProviderNamesResponse,
|
||||
get_all_provider_names,
|
||||
)
|
||||
from backend.server.v2.library.db import set_preset_webhook, update_preset
|
||||
from backend.util.exceptions import NeedConfirmation, NotFoundError
|
||||
from backend.util.settings import Settings
|
||||
@@ -516,78 +521,55 @@ async def list_providers() -> List[str]:
|
||||
|
||||
Returns both statically defined providers (from ProviderName enum)
|
||||
and dynamically registered providers (from SDK decorators).
|
||||
|
||||
Note: The complete list of provider names is also available as a constant
|
||||
in the generated TypeScript client via PROVIDER_NAMES.
|
||||
"""
|
||||
# Get static providers from enum
|
||||
static_providers = [member.value for member in ProviderName]
|
||||
|
||||
# Get dynamic providers from registry
|
||||
dynamic_providers = list(AutoRegistry._providers.keys())
|
||||
|
||||
# Combine and deduplicate
|
||||
all_providers = list(set(static_providers + dynamic_providers))
|
||||
all_providers.sort()
|
||||
|
||||
logger.info(f"Returning {len(all_providers)} providers")
|
||||
# Get all providers at runtime
|
||||
all_providers = get_all_provider_names()
|
||||
return all_providers
|
||||
|
||||
|
||||
class ProviderDetails(BaseModel):
|
||||
name: str
|
||||
source: Literal["static", "dynamic", "both"]
|
||||
has_oauth: bool
|
||||
has_webhooks: bool
|
||||
supported_credential_types: List[CredentialsType] = Field(default_factory=list)
|
||||
|
||||
|
||||
@router.get("/providers/details", response_model=Dict[str, ProviderDetails])
|
||||
async def get_providers_details() -> Dict[str, ProviderDetails]:
|
||||
@router.get("/providers/names", response_model=ProviderNamesResponse)
|
||||
async def get_provider_names() -> ProviderNamesResponse:
|
||||
"""
|
||||
Get detailed information about all providers.
|
||||
|
||||
Returns a dictionary mapping provider names to their details,
|
||||
including supported credential types and other metadata.
|
||||
Get all provider names in a structured format.
|
||||
|
||||
This endpoint is specifically designed to expose the provider names
|
||||
in the OpenAPI schema so that code generators like Orval can create
|
||||
appropriate TypeScript constants.
|
||||
"""
|
||||
# AutoRegistry is used directly as a class with class methods
|
||||
return ProviderNamesResponse()
|
||||
|
||||
# Build provider details
|
||||
provider_details: Dict[str, ProviderDetails] = {}
|
||||
|
||||
# Add static providers
|
||||
for member in ProviderName:
|
||||
provider_details[member.value] = ProviderDetails(
|
||||
name=member.value,
|
||||
source="static",
|
||||
has_oauth=member.value in AutoRegistry._oauth_handlers,
|
||||
has_webhooks=member.value in AutoRegistry._webhook_managers,
|
||||
)
|
||||
@router.get("/providers/constants", response_model=ProviderConstants)
|
||||
async def get_provider_constants() -> ProviderConstants:
|
||||
"""
|
||||
Get provider names as constants.
|
||||
|
||||
This endpoint returns a model with provider names as constants,
|
||||
specifically designed for OpenAPI code generation tools to create
|
||||
TypeScript constants.
|
||||
"""
|
||||
return ProviderConstants()
|
||||
|
||||
# Add/update with dynamic providers
|
||||
for provider in AutoRegistry._providers:
|
||||
if provider not in provider_details:
|
||||
provider_details[provider] = ProviderDetails(
|
||||
name=provider,
|
||||
source="dynamic",
|
||||
has_oauth=provider in AutoRegistry._oauth_handlers,
|
||||
has_webhooks=provider in AutoRegistry._webhook_managers,
|
||||
)
|
||||
else:
|
||||
provider_details[provider].source = "both"
|
||||
provider_details[provider].has_oauth = (
|
||||
provider in AutoRegistry._oauth_handlers
|
||||
)
|
||||
provider_details[provider].has_webhooks = (
|
||||
provider in AutoRegistry._webhook_managers
|
||||
)
|
||||
|
||||
# Determine supported credential types for each provider
|
||||
# This is a simplified version - in reality, you might want to inspect
|
||||
# the blocks or credentials to determine this more accurately
|
||||
for provider_name, details in provider_details.items():
|
||||
credential_types = []
|
||||
if details.has_oauth:
|
||||
credential_types.append("oauth2")
|
||||
# Most providers support API keys
|
||||
credential_types.append("api_key")
|
||||
details.supported_credential_types = credential_types
|
||||
class ProviderEnumResponse(BaseModel):
|
||||
"""Response containing a provider from the enum."""
|
||||
provider: str = Field(
|
||||
description="A provider name from the complete list of providers"
|
||||
)
|
||||
|
||||
return provider_details
|
||||
|
||||
@router.get("/providers/enum-example", response_model=ProviderEnumResponse)
|
||||
async def get_provider_enum_example() -> ProviderEnumResponse:
|
||||
"""
|
||||
Example endpoint that uses the CompleteProviderNames enum.
|
||||
|
||||
This endpoint exists to ensure that the CompleteProviderNames enum is included
|
||||
in the OpenAPI schema, which will cause Orval to generate it as a
|
||||
TypeScript enum/constant.
|
||||
"""
|
||||
# Return the first provider as an example
|
||||
all_providers = get_all_provider_names()
|
||||
return ProviderEnumResponse(provider=all_providers[0] if all_providers else "openai")
|
||||
|
||||
1451
autogpt_platform/frontend/src/app/api/__generated__/endpoints/admin/admin.msw.ts
generated
Normal file
1451
autogpt_platform/frontend/src/app/api/__generated__/endpoints/admin/admin.msw.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
184
autogpt_platform/frontend/src/app/api/__generated__/endpoints/analytics/analytics.msw.ts
generated
Normal file
184
autogpt_platform/frontend/src/app/api/__generated__/endpoints/analytics/analytics.msw.ts
generated
Normal file
@@ -0,0 +1,184 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
import type { HTTPValidationError } from "../../models/hTTPValidationError";
|
||||
|
||||
export const getPostV1LogRawMetricResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1LogRawAnalyticsResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1LogRawMetricMockHandler = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.post("*/api/analytics/log_raw_metric", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1LogRawMetricMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.post("*/api/analytics/log_raw_metric", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1LogRawMetricMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/analytics/log_raw_metric", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1LogRawMetricResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1LogRawAnalyticsMockHandler = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.post("*/api/analytics/log_raw_analytics", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1LogRawAnalyticsMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.post("*/api/analytics/log_raw_analytics", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1LogRawAnalyticsMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/analytics/log_raw_analytics", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1LogRawAnalyticsResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
export const getAnalyticsMock = () => [
|
||||
getPostV1LogRawMetricMockHandler(),
|
||||
getPostV1LogRawAnalyticsMockHandler(),
|
||||
];
|
||||
906
autogpt_platform/frontend/src/app/api/__generated__/endpoints/api-keys/api-keys.msw.ts
generated
Normal file
906
autogpt_platform/frontend/src/app/api/__generated__/endpoints/api-keys/api-keys.msw.ts
generated
Normal file
@@ -0,0 +1,906 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
import { APIKeyPermission } from "../../models/aPIKeyPermission";
|
||||
|
||||
import { APIKeyStatus } from "../../models/aPIKeyStatus";
|
||||
|
||||
import type { APIKeyWithoutHash } from "../../models/aPIKeyWithoutHash";
|
||||
|
||||
import type { CreateAPIKeyResponse } from "../../models/createAPIKeyResponse";
|
||||
|
||||
import type { GetV1ListUserApiKeys200 } from "../../models/getV1ListUserApiKeys200";
|
||||
|
||||
import type { HTTPValidationError } from "../../models/hTTPValidationError";
|
||||
|
||||
export const getGetV1ListUserApiKeysResponseMock =
|
||||
(): GetV1ListUserApiKeys200 =>
|
||||
faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(
|
||||
Object.values(APIKeyPermission),
|
||||
),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: faker.string.alpha({
|
||||
length: { min: 10, max: 20 },
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
export const getGetV1ListUserApiKeysResponseMock200 =
|
||||
(): GetV1ListUserApiKeys200 =>
|
||||
faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(
|
||||
Object.values(APIKeyPermission),
|
||||
),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: faker.string.alpha({
|
||||
length: { min: 10, max: 20 },
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
export const getPostV1CreateNewApiKeyResponseMock = (
|
||||
overrideResponse: Partial<CreateAPIKeyResponse> = {},
|
||||
): CreateAPIKeyResponse => ({
|
||||
api_key: {
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(Object.values(APIKeyPermission)),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
},
|
||||
plain_text_key: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1CreateNewApiKeyResponseMock200 = (
|
||||
overrideResponse: Partial<CreateAPIKeyResponse> = {},
|
||||
): CreateAPIKeyResponse => ({
|
||||
api_key: {
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(Object.values(APIKeyPermission)),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
},
|
||||
plain_text_key: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1CreateNewApiKeyResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getGetV1GetSpecificApiKeyResponseMock = (
|
||||
overrideResponse: Partial<APIKeyWithoutHash> = {},
|
||||
): APIKeyWithoutHash => ({
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(Object.values(APIKeyPermission)),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getGetV1GetSpecificApiKeyResponseMock200 = (
|
||||
overrideResponse: Partial<APIKeyWithoutHash> = {},
|
||||
): APIKeyWithoutHash => ({
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(Object.values(APIKeyPermission)),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getGetV1GetSpecificApiKeyResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getDeleteV1RevokeApiKeyResponseMock = (
|
||||
overrideResponse: Partial<APIKeyWithoutHash> = {},
|
||||
): APIKeyWithoutHash => ({
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(Object.values(APIKeyPermission)),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getDeleteV1RevokeApiKeyResponseMock200 = (
|
||||
overrideResponse: Partial<APIKeyWithoutHash> = {},
|
||||
): APIKeyWithoutHash => ({
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(Object.values(APIKeyPermission)),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getDeleteV1RevokeApiKeyResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1SuspendApiKeyResponseMock = (
|
||||
overrideResponse: Partial<APIKeyWithoutHash> = {},
|
||||
): APIKeyWithoutHash => ({
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(Object.values(APIKeyPermission)),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1SuspendApiKeyResponseMock200 = (
|
||||
overrideResponse: Partial<APIKeyWithoutHash> = {},
|
||||
): APIKeyWithoutHash => ({
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(Object.values(APIKeyPermission)),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1SuspendApiKeyResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPutV1UpdateKeyPermissionsResponseMock = (
|
||||
overrideResponse: Partial<APIKeyWithoutHash> = {},
|
||||
): APIKeyWithoutHash => ({
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(Object.values(APIKeyPermission)),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPutV1UpdateKeyPermissionsResponseMock200 = (
|
||||
overrideResponse: Partial<APIKeyWithoutHash> = {},
|
||||
): APIKeyWithoutHash => ({
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
prefix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
postfix: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
status: faker.helpers.arrayElement(Object.values(APIKeyStatus)),
|
||||
permissions: faker.helpers.arrayElements(Object.values(APIKeyPermission)),
|
||||
created_at: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
last_used_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
revoked_at: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
null,
|
||||
]),
|
||||
description: faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPutV1UpdateKeyPermissionsResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getGetV1ListUserApiKeysMockHandler = (
|
||||
overrideResponse?:
|
||||
| GetV1ListUserApiKeys200
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<GetV1ListUserApiKeys200> | GetV1ListUserApiKeys200),
|
||||
) => {
|
||||
return http.get("*/api/api-keys", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1ListUserApiKeysResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1ListUserApiKeysMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| GetV1ListUserApiKeys200
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<GetV1ListUserApiKeys200> | GetV1ListUserApiKeys200),
|
||||
) => {
|
||||
return http.get("*/api/api-keys", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1ListUserApiKeysResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1CreateNewApiKeyMockHandler = (
|
||||
overrideResponse?:
|
||||
| CreateAPIKeyResponse
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<CreateAPIKeyResponse> | CreateAPIKeyResponse),
|
||||
) => {
|
||||
return http.post("*/api/api-keys", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1CreateNewApiKeyResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1CreateNewApiKeyMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| CreateAPIKeyResponse
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<CreateAPIKeyResponse> | CreateAPIKeyResponse),
|
||||
) => {
|
||||
return http.post("*/api/api-keys", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1CreateNewApiKeyResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1CreateNewApiKeyMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/api-keys", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1CreateNewApiKeyResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1GetSpecificApiKeyMockHandler = (
|
||||
overrideResponse?:
|
||||
| APIKeyWithoutHash
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<APIKeyWithoutHash> | APIKeyWithoutHash),
|
||||
) => {
|
||||
return http.get("*/api/api-keys/:keyId", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1GetSpecificApiKeyResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1GetSpecificApiKeyMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| APIKeyWithoutHash
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<APIKeyWithoutHash> | APIKeyWithoutHash),
|
||||
) => {
|
||||
return http.get("*/api/api-keys/:keyId", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1GetSpecificApiKeyResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1GetSpecificApiKeyMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.get("*/api/api-keys/:keyId", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1GetSpecificApiKeyResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getDeleteV1RevokeApiKeyMockHandler = (
|
||||
overrideResponse?:
|
||||
| APIKeyWithoutHash
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.delete>[1]>[0],
|
||||
) => Promise<APIKeyWithoutHash> | APIKeyWithoutHash),
|
||||
) => {
|
||||
return http.delete("*/api/api-keys/:keyId", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getDeleteV1RevokeApiKeyResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getDeleteV1RevokeApiKeyMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| APIKeyWithoutHash
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.delete>[1]>[0],
|
||||
) => Promise<APIKeyWithoutHash> | APIKeyWithoutHash),
|
||||
) => {
|
||||
return http.delete("*/api/api-keys/:keyId", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getDeleteV1RevokeApiKeyResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getDeleteV1RevokeApiKeyMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.delete>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.delete("*/api/api-keys/:keyId", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getDeleteV1RevokeApiKeyResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1SuspendApiKeyMockHandler = (
|
||||
overrideResponse?:
|
||||
| APIKeyWithoutHash
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<APIKeyWithoutHash> | APIKeyWithoutHash),
|
||||
) => {
|
||||
return http.post("*/api/api-keys/:keyId/suspend", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1SuspendApiKeyResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1SuspendApiKeyMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| APIKeyWithoutHash
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<APIKeyWithoutHash> | APIKeyWithoutHash),
|
||||
) => {
|
||||
return http.post("*/api/api-keys/:keyId/suspend", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1SuspendApiKeyResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1SuspendApiKeyMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/api-keys/:keyId/suspend", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1SuspendApiKeyResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPutV1UpdateKeyPermissionsMockHandler = (
|
||||
overrideResponse?:
|
||||
| APIKeyWithoutHash
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.put>[1]>[0],
|
||||
) => Promise<APIKeyWithoutHash> | APIKeyWithoutHash),
|
||||
) => {
|
||||
return http.put("*/api/api-keys/:keyId/permissions", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPutV1UpdateKeyPermissionsResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPutV1UpdateKeyPermissionsMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| APIKeyWithoutHash
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.put>[1]>[0],
|
||||
) => Promise<APIKeyWithoutHash> | APIKeyWithoutHash),
|
||||
) => {
|
||||
return http.put("*/api/api-keys/:keyId/permissions", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPutV1UpdateKeyPermissionsResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPutV1UpdateKeyPermissionsMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.put>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.put("*/api/api-keys/:keyId/permissions", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPutV1UpdateKeyPermissionsResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
export const getApiKeysMock = () => [
|
||||
getGetV1ListUserApiKeysMockHandler(),
|
||||
getPostV1CreateNewApiKeyMockHandler(),
|
||||
getGetV1GetSpecificApiKeyMockHandler(),
|
||||
getDeleteV1RevokeApiKeyMockHandler(),
|
||||
getPostV1SuspendApiKeyMockHandler(),
|
||||
getPutV1UpdateKeyPermissionsMockHandler(),
|
||||
];
|
||||
414
autogpt_platform/frontend/src/app/api/__generated__/endpoints/auth/auth.msw.ts
generated
Normal file
414
autogpt_platform/frontend/src/app/api/__generated__/endpoints/auth/auth.msw.ts
generated
Normal file
@@ -0,0 +1,414 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
import type { HTTPValidationError } from "../../models/hTTPValidationError";
|
||||
|
||||
import type { NotificationPreference } from "../../models/notificationPreference";
|
||||
|
||||
import type { PostV1UpdateUserEmail200 } from "../../models/postV1UpdateUserEmail200";
|
||||
|
||||
export const getPostV1UpdateUserEmailResponseMock =
|
||||
(): PostV1UpdateUserEmail200 => ({
|
||||
[faker.string.alphanumeric(5)]: faker.string.alpha({
|
||||
length: { min: 10, max: 20 },
|
||||
}),
|
||||
});
|
||||
|
||||
export const getPostV1UpdateUserEmailResponseMock200 =
|
||||
(): PostV1UpdateUserEmail200 => ({
|
||||
[faker.string.alphanumeric(5)]: faker.string.alpha({
|
||||
length: { min: 10, max: 20 },
|
||||
}),
|
||||
});
|
||||
|
||||
export const getPostV1UpdateUserEmailResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getGetV1GetNotificationPreferencesResponseMock = (
|
||||
overrideResponse: Partial<NotificationPreference> = {},
|
||||
): NotificationPreference => ({
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
email: faker.internet.email(),
|
||||
preferences: faker.helpers.arrayElement([
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: faker.datatype.boolean(),
|
||||
},
|
||||
undefined,
|
||||
]),
|
||||
daily_limit: faker.helpers.arrayElement([
|
||||
faker.number.int({ min: undefined, max: undefined, multipleOf: undefined }),
|
||||
undefined,
|
||||
]),
|
||||
emails_sent_today: faker.helpers.arrayElement([
|
||||
faker.number.int({ min: undefined, max: undefined, multipleOf: undefined }),
|
||||
undefined,
|
||||
]),
|
||||
last_reset_date: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getGetV1GetNotificationPreferencesResponseMock200 = (
|
||||
overrideResponse: Partial<NotificationPreference> = {},
|
||||
): NotificationPreference => ({
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
email: faker.internet.email(),
|
||||
preferences: faker.helpers.arrayElement([
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: faker.datatype.boolean(),
|
||||
},
|
||||
undefined,
|
||||
]),
|
||||
daily_limit: faker.helpers.arrayElement([
|
||||
faker.number.int({ min: undefined, max: undefined, multipleOf: undefined }),
|
||||
undefined,
|
||||
]),
|
||||
emails_sent_today: faker.helpers.arrayElement([
|
||||
faker.number.int({ min: undefined, max: undefined, multipleOf: undefined }),
|
||||
undefined,
|
||||
]),
|
||||
last_reset_date: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1UpdateNotificationPreferencesResponseMock = (
|
||||
overrideResponse: Partial<NotificationPreference> = {},
|
||||
): NotificationPreference => ({
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
email: faker.internet.email(),
|
||||
preferences: faker.helpers.arrayElement([
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: faker.datatype.boolean(),
|
||||
},
|
||||
undefined,
|
||||
]),
|
||||
daily_limit: faker.helpers.arrayElement([
|
||||
faker.number.int({ min: undefined, max: undefined, multipleOf: undefined }),
|
||||
undefined,
|
||||
]),
|
||||
emails_sent_today: faker.helpers.arrayElement([
|
||||
faker.number.int({ min: undefined, max: undefined, multipleOf: undefined }),
|
||||
undefined,
|
||||
]),
|
||||
last_reset_date: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1UpdateNotificationPreferencesResponseMock200 = (
|
||||
overrideResponse: Partial<NotificationPreference> = {},
|
||||
): NotificationPreference => ({
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
email: faker.internet.email(),
|
||||
preferences: faker.helpers.arrayElement([
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: faker.datatype.boolean(),
|
||||
},
|
||||
undefined,
|
||||
]),
|
||||
daily_limit: faker.helpers.arrayElement([
|
||||
faker.number.int({ min: undefined, max: undefined, multipleOf: undefined }),
|
||||
undefined,
|
||||
]),
|
||||
emails_sent_today: faker.helpers.arrayElement([
|
||||
faker.number.int({ min: undefined, max: undefined, multipleOf: undefined }),
|
||||
undefined,
|
||||
]),
|
||||
last_reset_date: faker.helpers.arrayElement([
|
||||
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1UpdateNotificationPreferencesResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1GetOrCreateUserMockHandler = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.post("*/api/auth/user", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1GetOrCreateUserMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.post("*/api/auth/user", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1UpdateUserEmailMockHandler = (
|
||||
overrideResponse?:
|
||||
| PostV1UpdateUserEmail200
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<PostV1UpdateUserEmail200> | PostV1UpdateUserEmail200),
|
||||
) => {
|
||||
return http.post("*/api/auth/user/email", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1UpdateUserEmailResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1UpdateUserEmailMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| PostV1UpdateUserEmail200
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<PostV1UpdateUserEmail200> | PostV1UpdateUserEmail200),
|
||||
) => {
|
||||
return http.post("*/api/auth/user/email", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1UpdateUserEmailResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1UpdateUserEmailMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/auth/user/email", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1UpdateUserEmailResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1GetNotificationPreferencesMockHandler = (
|
||||
overrideResponse?:
|
||||
| NotificationPreference
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<NotificationPreference> | NotificationPreference),
|
||||
) => {
|
||||
return http.get("*/api/auth/user/preferences", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1GetNotificationPreferencesResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1GetNotificationPreferencesMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| NotificationPreference
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<NotificationPreference> | NotificationPreference),
|
||||
) => {
|
||||
return http.get("*/api/auth/user/preferences", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1GetNotificationPreferencesResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1UpdateNotificationPreferencesMockHandler = (
|
||||
overrideResponse?:
|
||||
| NotificationPreference
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<NotificationPreference> | NotificationPreference),
|
||||
) => {
|
||||
return http.post("*/api/auth/user/preferences", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1UpdateNotificationPreferencesResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1UpdateNotificationPreferencesMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| NotificationPreference
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<NotificationPreference> | NotificationPreference),
|
||||
) => {
|
||||
return http.post("*/api/auth/user/preferences", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1UpdateNotificationPreferencesResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1UpdateNotificationPreferencesMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/auth/user/preferences", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1UpdateNotificationPreferencesResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
export const getAuthMock = () => [
|
||||
getPostV1GetOrCreateUserMockHandler(),
|
||||
getPostV1UpdateUserEmailMockHandler(),
|
||||
getGetV1GetNotificationPreferencesMockHandler(),
|
||||
getPostV1UpdateNotificationPreferencesMockHandler(),
|
||||
];
|
||||
198
autogpt_platform/frontend/src/app/api/__generated__/endpoints/blocks/blocks.msw.ts
generated
Normal file
198
autogpt_platform/frontend/src/app/api/__generated__/endpoints/blocks/blocks.msw.ts
generated
Normal file
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
import type { GetV1ListAvailableBlocks200Item } from "../../models/getV1ListAvailableBlocks200Item";
|
||||
|
||||
import type { HTTPValidationError } from "../../models/hTTPValidationError";
|
||||
|
||||
import type { PostV1ExecuteGraphBlock200 } from "../../models/postV1ExecuteGraphBlock200";
|
||||
|
||||
export const getGetV1ListAvailableBlocksResponseMock =
|
||||
(): GetV1ListAvailableBlocks200Item[] =>
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({}));
|
||||
|
||||
export const getGetV1ListAvailableBlocksResponseMock200 =
|
||||
(): GetV1ListAvailableBlocks200Item[] =>
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({}));
|
||||
|
||||
export const getPostV1ExecuteGraphBlockResponseMock =
|
||||
(): PostV1ExecuteGraphBlock200 => ({
|
||||
[faker.string.alphanumeric(5)]: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({})),
|
||||
});
|
||||
|
||||
export const getPostV1ExecuteGraphBlockResponseMock200 =
|
||||
(): PostV1ExecuteGraphBlock200 => ({
|
||||
[faker.string.alphanumeric(5)]: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({})),
|
||||
});
|
||||
|
||||
export const getPostV1ExecuteGraphBlockResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getGetV1ListAvailableBlocksMockHandler = (
|
||||
overrideResponse?:
|
||||
| GetV1ListAvailableBlocks200Item[]
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) =>
|
||||
| Promise<GetV1ListAvailableBlocks200Item[]>
|
||||
| GetV1ListAvailableBlocks200Item[]),
|
||||
) => {
|
||||
return http.get("*/api/blocks", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1ListAvailableBlocksResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1ListAvailableBlocksMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| GetV1ListAvailableBlocks200Item[]
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) =>
|
||||
| Promise<GetV1ListAvailableBlocks200Item[]>
|
||||
| GetV1ListAvailableBlocks200Item[]),
|
||||
) => {
|
||||
return http.get("*/api/blocks", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1ListAvailableBlocksResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1ExecuteGraphBlockMockHandler = (
|
||||
overrideResponse?:
|
||||
| PostV1ExecuteGraphBlock200
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<PostV1ExecuteGraphBlock200> | PostV1ExecuteGraphBlock200),
|
||||
) => {
|
||||
return http.post("*/api/blocks/:blockId/execute", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1ExecuteGraphBlockResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1ExecuteGraphBlockMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| PostV1ExecuteGraphBlock200
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<PostV1ExecuteGraphBlock200> | PostV1ExecuteGraphBlock200),
|
||||
) => {
|
||||
return http.post("*/api/blocks/:blockId/execute", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1ExecuteGraphBlockResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1ExecuteGraphBlockMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/blocks/:blockId/execute", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1ExecuteGraphBlockResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
export const getBlocksMock = () => [
|
||||
getGetV1ListAvailableBlocksMockHandler(),
|
||||
getPostV1ExecuteGraphBlockMockHandler(),
|
||||
];
|
||||
1020
autogpt_platform/frontend/src/app/api/__generated__/endpoints/credits/credits.msw.ts
generated
Normal file
1020
autogpt_platform/frontend/src/app/api/__generated__/endpoints/credits/credits.msw.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
184
autogpt_platform/frontend/src/app/api/__generated__/endpoints/email/email.msw.ts
generated
Normal file
184
autogpt_platform/frontend/src/app/api/__generated__/endpoints/email/email.msw.ts
generated
Normal file
@@ -0,0 +1,184 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
import type { HTTPValidationError } from "../../models/hTTPValidationError";
|
||||
|
||||
export const getPostV1OneClickEmailUnsubscribeResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1HandlePostmarkEmailWebhooksResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1OneClickEmailUnsubscribeMockHandler = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.post("*/api/email/unsubscribe", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1OneClickEmailUnsubscribeMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.post("*/api/email/unsubscribe", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1OneClickEmailUnsubscribeMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/email/unsubscribe", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1OneClickEmailUnsubscribeResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1HandlePostmarkEmailWebhooksMockHandler = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.post("*/api/email/", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1HandlePostmarkEmailWebhooksMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.post("*/api/email/", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1HandlePostmarkEmailWebhooksMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/email/", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1HandlePostmarkEmailWebhooksResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
export const getEmailMock = () => [
|
||||
getPostV1OneClickEmailUnsubscribeMockHandler(),
|
||||
getPostV1HandlePostmarkEmailWebhooksMockHandler(),
|
||||
];
|
||||
5808
autogpt_platform/frontend/src/app/api/__generated__/endpoints/graphs/graphs.msw.ts
generated
Normal file
5808
autogpt_platform/frontend/src/app/api/__generated__/endpoints/graphs/graphs.msw.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
41
autogpt_platform/frontend/src/app/api/__generated__/endpoints/health/health.msw.ts
generated
Normal file
41
autogpt_platform/frontend/src/app/api/__generated__/endpoints/health/health.msw.ts
generated
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
export const getGetHealthHealthMockHandler = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.get("*/health", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetHealthHealthMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.get("*/health", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
export const getHealthMock = () => [getGetHealthHealthMockHandler()];
|
||||
1634
autogpt_platform/frontend/src/app/api/__generated__/endpoints/integrations/integrations.msw.ts
generated
Normal file
1634
autogpt_platform/frontend/src/app/api/__generated__/endpoints/integrations/integrations.msw.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1743
autogpt_platform/frontend/src/app/api/__generated__/endpoints/library/library.msw.ts
generated
Normal file
1743
autogpt_platform/frontend/src/app/api/__generated__/endpoints/library/library.msw.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
198
autogpt_platform/frontend/src/app/api/__generated__/endpoints/onboarding/onboarding.msw.ts
generated
Normal file
198
autogpt_platform/frontend/src/app/api/__generated__/endpoints/onboarding/onboarding.msw.ts
generated
Normal file
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
import type { HTTPValidationError } from "../../models/hTTPValidationError";
|
||||
|
||||
export const getPatchV1UpdateOnboardingProgressResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getGetV1GetOnboardingStatusMockHandler = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.get("*/api/onboarding", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1GetOnboardingStatusMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.get("*/api/onboarding", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPatchV1UpdateOnboardingProgressMockHandler = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.patch>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.patch("*/api/onboarding", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPatchV1UpdateOnboardingProgressMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.patch>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.patch("*/api/onboarding", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getPatchV1UpdateOnboardingProgressMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.patch>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.patch("*/api/onboarding", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPatchV1UpdateOnboardingProgressResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1GetRecommendedAgentsMockHandler = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.get("*/api/onboarding/agents", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1GetRecommendedAgentsMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.get("*/api/onboarding/agents", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1CheckOnboardingEnabledMockHandler = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.get("*/api/onboarding/enabled", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1CheckOnboardingEnabledMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| unknown
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<unknown> | unknown),
|
||||
) => {
|
||||
return http.get("*/api/onboarding/enabled", async (info) => {
|
||||
await delay(1000);
|
||||
if (typeof overrideResponse === "function") {
|
||||
await overrideResponse(info);
|
||||
}
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
});
|
||||
};
|
||||
export const getOnboardingMock = () => [
|
||||
getGetV1GetOnboardingStatusMockHandler(),
|
||||
getPatchV1UpdateOnboardingProgressMockHandler(),
|
||||
getGetV1GetRecommendedAgentsMockHandler(),
|
||||
getGetV1CheckOnboardingEnabledMockHandler(),
|
||||
];
|
||||
151
autogpt_platform/frontend/src/app/api/__generated__/endpoints/otto/otto.msw.ts
generated
Normal file
151
autogpt_platform/frontend/src/app/api/__generated__/endpoints/otto/otto.msw.ts
generated
Normal file
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
import type { ApiResponse } from "../../models/apiResponse";
|
||||
|
||||
import type { HTTPValidationError } from "../../models/hTTPValidationError";
|
||||
|
||||
export const getPostV2ProxyOttoChatRequestResponseMock = (
|
||||
overrideResponse: Partial<ApiResponse> = {},
|
||||
): ApiResponse => ({
|
||||
answer: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
documents: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
url: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
relevance_score: faker.number.float({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
fractionDigits: 2,
|
||||
}),
|
||||
})),
|
||||
success: faker.datatype.boolean(),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV2ProxyOttoChatRequestResponseMock200 = (
|
||||
overrideResponse: Partial<ApiResponse> = {},
|
||||
): ApiResponse => ({
|
||||
answer: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
documents: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
url: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
relevance_score: faker.number.float({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
fractionDigits: 2,
|
||||
}),
|
||||
})),
|
||||
success: faker.datatype.boolean(),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV2ProxyOttoChatRequestResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV2ProxyOttoChatRequestMockHandler = (
|
||||
overrideResponse?:
|
||||
| ApiResponse
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<ApiResponse> | ApiResponse),
|
||||
) => {
|
||||
return http.post("*/api/otto/ask", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV2ProxyOttoChatRequestResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV2ProxyOttoChatRequestMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| ApiResponse
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<ApiResponse> | ApiResponse),
|
||||
) => {
|
||||
return http.post("*/api/otto/ask", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV2ProxyOttoChatRequestResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV2ProxyOttoChatRequestMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/otto/ask", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV2ProxyOttoChatRequestResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
export const getOttoMock = () => [getPostV2ProxyOttoChatRequestMockHandler()];
|
||||
1026
autogpt_platform/frontend/src/app/api/__generated__/endpoints/presets/presets.msw.ts
generated
Normal file
1026
autogpt_platform/frontend/src/app/api/__generated__/endpoints/presets/presets.msw.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
620
autogpt_platform/frontend/src/app/api/__generated__/endpoints/schedules/schedules.msw.ts
generated
Normal file
620
autogpt_platform/frontend/src/app/api/__generated__/endpoints/schedules/schedules.msw.ts
generated
Normal file
@@ -0,0 +1,620 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
import type { DeleteV1DeleteExecutionSchedule200 } from "../../models/deleteV1DeleteExecutionSchedule200";
|
||||
|
||||
import type { GraphExecutionJobInfo } from "../../models/graphExecutionJobInfo";
|
||||
|
||||
import type { HTTPValidationError } from "../../models/hTTPValidationError";
|
||||
|
||||
export const getPostV1CreateExecutionScheduleResponseMock = (
|
||||
overrideResponse: Partial<GraphExecutionJobInfo> = {},
|
||||
): GraphExecutionJobInfo => ({
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_version: faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
cron: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
input_data: {},
|
||||
input_credentials: faker.helpers.arrayElement([
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: {
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
title: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
provider: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.helpers.arrayElement([
|
||||
"api_key",
|
||||
"oauth2",
|
||||
"user_password",
|
||||
"host_scoped",
|
||||
] as const),
|
||||
},
|
||||
},
|
||||
undefined,
|
||||
]),
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
next_run_time: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1CreateExecutionScheduleResponseMock200 = (
|
||||
overrideResponse: Partial<GraphExecutionJobInfo> = {},
|
||||
): GraphExecutionJobInfo => ({
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_version: faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
cron: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
input_data: {},
|
||||
input_credentials: faker.helpers.arrayElement([
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: {
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
title: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
provider: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.helpers.arrayElement([
|
||||
"api_key",
|
||||
"oauth2",
|
||||
"user_password",
|
||||
"host_scoped",
|
||||
] as const),
|
||||
},
|
||||
},
|
||||
undefined,
|
||||
]),
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
next_run_time: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1CreateExecutionScheduleResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getGetV1ListExecutionSchedulesForAGraphResponseMock =
|
||||
(): GraphExecutionJobInfo[] =>
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_version: faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
cron: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
input_data: {},
|
||||
input_credentials: faker.helpers.arrayElement([
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: {
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
title: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
provider: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.helpers.arrayElement([
|
||||
"api_key",
|
||||
"oauth2",
|
||||
"user_password",
|
||||
"host_scoped",
|
||||
] as const),
|
||||
},
|
||||
},
|
||||
undefined,
|
||||
]),
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
next_run_time: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
}));
|
||||
|
||||
export const getGetV1ListExecutionSchedulesForAGraphResponseMock200 =
|
||||
(): GraphExecutionJobInfo[] =>
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_version: faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
cron: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
input_data: {},
|
||||
input_credentials: faker.helpers.arrayElement([
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: {
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
title: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
provider: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.helpers.arrayElement([
|
||||
"api_key",
|
||||
"oauth2",
|
||||
"user_password",
|
||||
"host_scoped",
|
||||
] as const),
|
||||
},
|
||||
},
|
||||
undefined,
|
||||
]),
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
next_run_time: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
}));
|
||||
|
||||
export const getGetV1ListExecutionSchedulesForAGraphResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getGetV1ListExecutionSchedulesForAUserResponseMock =
|
||||
(): GraphExecutionJobInfo[] =>
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_version: faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
cron: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
input_data: {},
|
||||
input_credentials: faker.helpers.arrayElement([
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: {
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
title: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
provider: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.helpers.arrayElement([
|
||||
"api_key",
|
||||
"oauth2",
|
||||
"user_password",
|
||||
"host_scoped",
|
||||
] as const),
|
||||
},
|
||||
},
|
||||
undefined,
|
||||
]),
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
next_run_time: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
}));
|
||||
|
||||
export const getGetV1ListExecutionSchedulesForAUserResponseMock200 =
|
||||
(): GraphExecutionJobInfo[] =>
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
user_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
graph_version: faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
cron: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
input_data: {},
|
||||
input_credentials: faker.helpers.arrayElement([
|
||||
{
|
||||
[faker.string.alphanumeric(5)]: {
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
title: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
provider: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.helpers.arrayElement([
|
||||
"api_key",
|
||||
"oauth2",
|
||||
"user_password",
|
||||
"host_scoped",
|
||||
] as const),
|
||||
},
|
||||
},
|
||||
undefined,
|
||||
]),
|
||||
id: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
name: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
next_run_time: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
}));
|
||||
|
||||
export const getDeleteV1DeleteExecutionScheduleResponseMock =
|
||||
(): DeleteV1DeleteExecutionSchedule200 => ({});
|
||||
|
||||
export const getDeleteV1DeleteExecutionScheduleResponseMock200 =
|
||||
(): DeleteV1DeleteExecutionSchedule200 => ({});
|
||||
|
||||
export const getDeleteV1DeleteExecutionScheduleResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV1CreateExecutionScheduleMockHandler = (
|
||||
overrideResponse?:
|
||||
| GraphExecutionJobInfo
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<GraphExecutionJobInfo> | GraphExecutionJobInfo),
|
||||
) => {
|
||||
return http.post("*/api/graphs/:graphId/schedules", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1CreateExecutionScheduleResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1CreateExecutionScheduleMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| GraphExecutionJobInfo
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<GraphExecutionJobInfo> | GraphExecutionJobInfo),
|
||||
) => {
|
||||
return http.post("*/api/graphs/:graphId/schedules", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1CreateExecutionScheduleResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV1CreateExecutionScheduleMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/graphs/:graphId/schedules", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV1CreateExecutionScheduleResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1ListExecutionSchedulesForAGraphMockHandler = (
|
||||
overrideResponse?:
|
||||
| GraphExecutionJobInfo[]
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<GraphExecutionJobInfo[]> | GraphExecutionJobInfo[]),
|
||||
) => {
|
||||
return http.get("*/api/graphs/:graphId/schedules", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1ListExecutionSchedulesForAGraphResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1ListExecutionSchedulesForAGraphMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| GraphExecutionJobInfo[]
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<GraphExecutionJobInfo[]> | GraphExecutionJobInfo[]),
|
||||
) => {
|
||||
return http.get("*/api/graphs/:graphId/schedules", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1ListExecutionSchedulesForAGraphResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1ListExecutionSchedulesForAGraphMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.get("*/api/graphs/:graphId/schedules", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1ListExecutionSchedulesForAGraphResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1ListExecutionSchedulesForAUserMockHandler = (
|
||||
overrideResponse?:
|
||||
| GraphExecutionJobInfo[]
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<GraphExecutionJobInfo[]> | GraphExecutionJobInfo[]),
|
||||
) => {
|
||||
return http.get("*/api/schedules", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1ListExecutionSchedulesForAUserResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetV1ListExecutionSchedulesForAUserMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| GraphExecutionJobInfo[]
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||
) => Promise<GraphExecutionJobInfo[]> | GraphExecutionJobInfo[]),
|
||||
) => {
|
||||
return http.get("*/api/schedules", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getGetV1ListExecutionSchedulesForAUserResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getDeleteV1DeleteExecutionScheduleMockHandler = (
|
||||
overrideResponse?:
|
||||
| DeleteV1DeleteExecutionSchedule200
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.delete>[1]>[0],
|
||||
) =>
|
||||
| Promise<DeleteV1DeleteExecutionSchedule200>
|
||||
| DeleteV1DeleteExecutionSchedule200),
|
||||
) => {
|
||||
return http.delete("*/api/schedules/:scheduleId", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getDeleteV1DeleteExecutionScheduleResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getDeleteV1DeleteExecutionScheduleMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| DeleteV1DeleteExecutionSchedule200
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.delete>[1]>[0],
|
||||
) =>
|
||||
| Promise<DeleteV1DeleteExecutionSchedule200>
|
||||
| DeleteV1DeleteExecutionSchedule200),
|
||||
) => {
|
||||
return http.delete("*/api/schedules/:scheduleId", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getDeleteV1DeleteExecutionScheduleResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getDeleteV1DeleteExecutionScheduleMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.delete>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.delete("*/api/schedules/:scheduleId", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getDeleteV1DeleteExecutionScheduleResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
export const getSchedulesMock = () => [
|
||||
getPostV1CreateExecutionScheduleMockHandler(),
|
||||
getGetV1ListExecutionSchedulesForAGraphMockHandler(),
|
||||
getGetV1ListExecutionSchedulesForAUserMockHandler(),
|
||||
getDeleteV1DeleteExecutionScheduleMockHandler(),
|
||||
];
|
||||
2568
autogpt_platform/frontend/src/app/api/__generated__/endpoints/store/store.msw.ts
generated
Normal file
2568
autogpt_platform/frontend/src/app/api/__generated__/endpoints/store/store.msw.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
185
autogpt_platform/frontend/src/app/api/__generated__/endpoints/turnstile/turnstile.msw.ts
generated
Normal file
185
autogpt_platform/frontend/src/app/api/__generated__/endpoints/turnstile/turnstile.msw.ts
generated
Normal file
@@ -0,0 +1,185 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
import type { HTTPValidationError } from "../../models/hTTPValidationError";
|
||||
|
||||
import type { TurnstileVerifyResponse } from "../../models/turnstileVerifyResponse";
|
||||
|
||||
export const getPostV2VerifyTurnstileTokenResponseMock = (
|
||||
overrideResponse: Partial<TurnstileVerifyResponse> = {},
|
||||
): TurnstileVerifyResponse => ({
|
||||
success: faker.datatype.boolean(),
|
||||
error: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
challenge_timestamp: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
hostname: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
action: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV2VerifyTurnstileTokenResponseMock200 = (
|
||||
overrideResponse: Partial<TurnstileVerifyResponse> = {},
|
||||
): TurnstileVerifyResponse => ({
|
||||
success: faker.datatype.boolean(),
|
||||
error: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
challenge_timestamp: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
hostname: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
action: faker.helpers.arrayElement([
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
null,
|
||||
]),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV2VerifyTurnstileTokenResponseMock422 = (
|
||||
overrideResponse: Partial<HTTPValidationError> = {},
|
||||
): HTTPValidationError => ({
|
||||
detail: faker.helpers.arrayElement([
|
||||
Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() => ({
|
||||
loc: Array.from(
|
||||
{ length: faker.number.int({ min: 1, max: 10 }) },
|
||||
(_, i) => i + 1,
|
||||
).map(() =>
|
||||
faker.helpers.arrayElement([
|
||||
faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
faker.number.int({
|
||||
min: undefined,
|
||||
max: undefined,
|
||||
multipleOf: undefined,
|
||||
}),
|
||||
]),
|
||||
),
|
||||
msg: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
type: faker.string.alpha({ length: { min: 10, max: 20 } }),
|
||||
})),
|
||||
undefined,
|
||||
]),
|
||||
...overrideResponse,
|
||||
});
|
||||
|
||||
export const getPostV2VerifyTurnstileTokenMockHandler = (
|
||||
overrideResponse?:
|
||||
| TurnstileVerifyResponse
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<TurnstileVerifyResponse> | TurnstileVerifyResponse),
|
||||
) => {
|
||||
return http.post("*/api/turnstile/verify", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV2VerifyTurnstileTokenResponseMock(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV2VerifyTurnstileTokenMockHandler200 = (
|
||||
overrideResponse?:
|
||||
| TurnstileVerifyResponse
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<TurnstileVerifyResponse> | TurnstileVerifyResponse),
|
||||
) => {
|
||||
return http.post("*/api/turnstile/verify", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV2VerifyTurnstileTokenResponseMock200(),
|
||||
),
|
||||
{ status: 200, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPostV2VerifyTurnstileTokenMockHandler422 = (
|
||||
overrideResponse?:
|
||||
| HTTPValidationError
|
||||
| ((
|
||||
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||
) => Promise<HTTPValidationError> | HTTPValidationError),
|
||||
) => {
|
||||
return http.post("*/api/turnstile/verify", async (info) => {
|
||||
await delay(1000);
|
||||
|
||||
return new HttpResponse(
|
||||
JSON.stringify(
|
||||
overrideResponse !== undefined
|
||||
? typeof overrideResponse === "function"
|
||||
? await overrideResponse(info)
|
||||
: overrideResponse
|
||||
: getPostV2VerifyTurnstileTokenResponseMock422(),
|
||||
),
|
||||
{ status: 422, headers: { "Content-Type": "application/json" } },
|
||||
);
|
||||
});
|
||||
};
|
||||
export const getTurnstileMock = () => [
|
||||
getPostV2VerifyTurnstileTokenMockHandler(),
|
||||
];
|
||||
53
autogpt_platform/frontend/src/app/api/__generated__/models/completeProviderNames.ts
generated
Normal file
53
autogpt_platform/frontend/src/app/api/__generated__/models/completeProviderNames.ts
generated
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
|
||||
export type CompleteProviderNames =
|
||||
(typeof CompleteProviderNames)[keyof typeof CompleteProviderNames];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const CompleteProviderNames = {
|
||||
aiml_api: "aiml_api",
|
||||
anthropic: "anthropic",
|
||||
apollo: "apollo",
|
||||
compass: "compass",
|
||||
d_id: "d_id",
|
||||
discord: "discord",
|
||||
e2b: "e2b",
|
||||
fal: "fal",
|
||||
generic_webhook: "generic_webhook",
|
||||
github: "github",
|
||||
google: "google",
|
||||
google_maps: "google_maps",
|
||||
groq: "groq",
|
||||
http: "http",
|
||||
hubspot: "hubspot",
|
||||
ideogram: "ideogram",
|
||||
jina: "jina",
|
||||
linear: "linear",
|
||||
llama_api: "llama_api",
|
||||
medium: "medium",
|
||||
mem0: "mem0",
|
||||
notion: "notion",
|
||||
nvidia: "nvidia",
|
||||
ollama: "ollama",
|
||||
open_router: "open_router",
|
||||
openai: "openai",
|
||||
openweathermap: "openweathermap",
|
||||
pinecone: "pinecone",
|
||||
reddit: "reddit",
|
||||
replicate: "replicate",
|
||||
revid: "revid",
|
||||
screenshotone: "screenshotone",
|
||||
slant3d: "slant3d",
|
||||
smartlead: "smartlead",
|
||||
smtp: "smtp",
|
||||
todoist: "todoist",
|
||||
twitter: "twitter",
|
||||
unreal_speech: "unreal_speech",
|
||||
zerobounce: "zerobounce",
|
||||
} as const;
|
||||
@@ -6,12 +6,12 @@
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import type { CredentialsMetaInputTitle } from "./credentialsMetaInputTitle";
|
||||
import type { ProviderName } from "./providerName";
|
||||
import type { CredentialsMetaInputType } from "./credentialsMetaInputType";
|
||||
|
||||
export interface CredentialsMetaInput {
|
||||
id: string;
|
||||
title?: CredentialsMetaInputTitle;
|
||||
provider: ProviderName;
|
||||
/** Provider name for integrations. Can be any string value, including custom provider names. */
|
||||
provider: string;
|
||||
type: CredentialsMetaInputType;
|
||||
}
|
||||
|
||||
10
autogpt_platform/frontend/src/app/api/__generated__/models/getV1GetProvidersDetails200.ts
generated
Normal file
10
autogpt_platform/frontend/src/app/api/__generated__/models/getV1GetProvidersDetails200.ts
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import type { ProviderDetails } from "./providerDetails";
|
||||
|
||||
export type GetV1GetProvidersDetails200 = { [key: string]: ProviderDetails };
|
||||
@@ -5,12 +5,12 @@
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import type { ProviderName } from "./providerName";
|
||||
import type { LibraryAgentTriggerInfoConfigSchema } from "./libraryAgentTriggerInfoConfigSchema";
|
||||
import type { LibraryAgentTriggerInfoCredentialsInputName } from "./libraryAgentTriggerInfoCredentialsInputName";
|
||||
|
||||
export interface LibraryAgentTriggerInfo {
|
||||
provider: ProviderName;
|
||||
/** Provider name for integrations. Can be any string value, including custom provider names. */
|
||||
provider: string;
|
||||
/** Input schema for the trigger block */
|
||||
config_schema: LibraryAgentTriggerInfoConfigSchema;
|
||||
credentials_input_name: LibraryAgentTriggerInfoCredentialsInputName;
|
||||
|
||||
17
autogpt_platform/frontend/src/app/api/__generated__/models/providerConstants.ts
generated
Normal file
17
autogpt_platform/frontend/src/app/api/__generated__/models/providerConstants.ts
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import type { ProviderConstantsPROVIDERNAMES } from "./providerConstantsPROVIDERNAMES";
|
||||
|
||||
/**
|
||||
* Model that exposes all provider names as a constant in the OpenAPI schema.
|
||||
This is designed to be converted by Orval into a TypeScript constant.
|
||||
*/
|
||||
export interface ProviderConstants {
|
||||
/** All available provider names as a constant mapping */
|
||||
PROVIDER_NAMES?: ProviderConstantsPROVIDERNAMES;
|
||||
}
|
||||
12
autogpt_platform/frontend/src/app/api/__generated__/models/providerConstantsPROVIDERNAMES.ts
generated
Normal file
12
autogpt_platform/frontend/src/app/api/__generated__/models/providerConstantsPROVIDERNAMES.ts
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* All available provider names as a constant mapping
|
||||
*/
|
||||
export type ProviderConstantsPROVIDERNAMES = { [key: string]: string };
|
||||
17
autogpt_platform/frontend/src/app/api/__generated__/models/providerDetails.ts
generated
Normal file
17
autogpt_platform/frontend/src/app/api/__generated__/models/providerDetails.ts
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import type { ProviderDetailsSource } from "./providerDetailsSource";
|
||||
import type { ProviderDetailsSupportedCredentialTypesItem } from "./providerDetailsSupportedCredentialTypesItem";
|
||||
|
||||
export interface ProviderDetails {
|
||||
name: string;
|
||||
source: ProviderDetailsSource;
|
||||
has_oauth: boolean;
|
||||
has_webhooks: boolean;
|
||||
supported_credential_types?: ProviderDetailsSupportedCredentialTypesItem[];
|
||||
}
|
||||
17
autogpt_platform/frontend/src/app/api/__generated__/models/providerDetailsSource.ts
generated
Normal file
17
autogpt_platform/frontend/src/app/api/__generated__/models/providerDetailsSource.ts
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
|
||||
export type ProviderDetailsSource =
|
||||
(typeof ProviderDetailsSource)[keyof typeof ProviderDetailsSource];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const ProviderDetailsSource = {
|
||||
static: "static",
|
||||
dynamic: "dynamic",
|
||||
both: "both",
|
||||
} as const;
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
|
||||
export type ProviderDetailsSupportedCredentialTypesItem =
|
||||
(typeof ProviderDetailsSupportedCredentialTypesItem)[keyof typeof ProviderDetailsSupportedCredentialTypesItem];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const ProviderDetailsSupportedCredentialTypesItem = {
|
||||
api_key: "api_key",
|
||||
oauth2: "oauth2",
|
||||
user_password: "user_password",
|
||||
host_scoped: "host_scoped",
|
||||
} as const;
|
||||
15
autogpt_platform/frontend/src/app/api/__generated__/models/providerEnumResponse.ts
generated
Normal file
15
autogpt_platform/frontend/src/app/api/__generated__/models/providerEnumResponse.ts
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* Response containing a provider from the enum.
|
||||
*/
|
||||
export interface ProviderEnumResponse {
|
||||
/** A provider name from the complete list of providers */
|
||||
provider: string;
|
||||
}
|
||||
15
autogpt_platform/frontend/src/app/api/__generated__/models/providerNamesResponse.ts
generated
Normal file
15
autogpt_platform/frontend/src/app/api/__generated__/models/providerNamesResponse.ts
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* Response containing list of all provider names.
|
||||
*/
|
||||
export interface ProviderNamesResponse {
|
||||
/** List of all available provider names */
|
||||
providers?: string[];
|
||||
}
|
||||
@@ -5,13 +5,13 @@
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import type { ProviderName } from "./providerName";
|
||||
import type { WebhookConfig } from "./webhookConfig";
|
||||
|
||||
export interface Webhook {
|
||||
id?: string;
|
||||
user_id: string;
|
||||
provider: ProviderName;
|
||||
/** Provider name for integrations. Can be any string value, including custom provider names. */
|
||||
provider: string;
|
||||
credentials_id: string;
|
||||
webhook_type: string;
|
||||
resource: string;
|
||||
|
||||
272
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/admin/admin.ts
generated
Normal file
272
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/admin/admin.ts
generated
Normal file
@@ -0,0 +1,272 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* Get store listings with their version history for admins.
|
||||
|
||||
This provides a consolidated view of listings with their versions,
|
||||
allowing for an expandable UI in the admin dashboard.
|
||||
|
||||
Args:
|
||||
status: Filter by submission status (PENDING, APPROVED, REJECTED)
|
||||
search: Search by name, description, or user email
|
||||
page: Page number for pagination
|
||||
page_size: Number of items per page
|
||||
|
||||
Returns:
|
||||
StoreListingsWithVersionsResponse with listings and their versions
|
||||
* @summary Get Admin Listings History
|
||||
*/
|
||||
export const getV2GetAdminListingsHistoryQueryPageDefault = 1;
|
||||
export const getV2GetAdminListingsHistoryQueryPageSizeDefault = 20;
|
||||
|
||||
export const getV2GetAdminListingsHistoryQueryParams = zod.object({
|
||||
status: zod
|
||||
.enum(["DRAFT", "PENDING", "APPROVED", "REJECTED"])
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
search: zod.string().or(zod.null()).optional(),
|
||||
page: zod.number().default(getV2GetAdminListingsHistoryQueryPageDefault),
|
||||
page_size: zod
|
||||
.number()
|
||||
.default(getV2GetAdminListingsHistoryQueryPageSizeDefault),
|
||||
});
|
||||
|
||||
export const getV2GetAdminListingsHistoryResponseListingsItemHasApprovedVersionDefault = false;
|
||||
export const getV2GetAdminListingsHistoryResponseListingsItemVersionsDefault =
|
||||
[];
|
||||
|
||||
export const getV2GetAdminListingsHistoryResponse = zod
|
||||
.object({
|
||||
listings: zod.array(
|
||||
zod
|
||||
.object({
|
||||
listing_id: zod.string(),
|
||||
slug: zod.string(),
|
||||
agent_id: zod.string(),
|
||||
agent_version: zod.number(),
|
||||
active_version_id: zod.string().or(zod.null()).optional(),
|
||||
has_approved_version: zod.boolean().optional(),
|
||||
creator_email: zod.string().or(zod.null()).optional(),
|
||||
latest_version: zod
|
||||
.object({
|
||||
agent_id: zod.string(),
|
||||
agent_version: zod.number(),
|
||||
name: zod.string(),
|
||||
sub_heading: zod.string(),
|
||||
slug: zod.string(),
|
||||
description: zod.string(),
|
||||
image_urls: zod.array(zod.string()),
|
||||
date_submitted: zod.string().datetime({}),
|
||||
status: zod.enum(["DRAFT", "PENDING", "APPROVED", "REJECTED"]),
|
||||
runs: zod.number(),
|
||||
rating: zod.number(),
|
||||
store_listing_version_id: zod.string().or(zod.null()).optional(),
|
||||
version: zod.number().or(zod.null()).optional(),
|
||||
reviewer_id: zod.string().or(zod.null()).optional(),
|
||||
review_comments: zod.string().or(zod.null()).optional(),
|
||||
internal_comments: zod.string().or(zod.null()).optional(),
|
||||
reviewed_at: zod.string().datetime({}).or(zod.null()).optional(),
|
||||
changes_summary: zod.string().or(zod.null()).optional(),
|
||||
})
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
versions: zod
|
||||
.array(
|
||||
zod.object({
|
||||
agent_id: zod.string(),
|
||||
agent_version: zod.number(),
|
||||
name: zod.string(),
|
||||
sub_heading: zod.string(),
|
||||
slug: zod.string(),
|
||||
description: zod.string(),
|
||||
image_urls: zod.array(zod.string()),
|
||||
date_submitted: zod.string().datetime({}),
|
||||
status: zod.enum(["DRAFT", "PENDING", "APPROVED", "REJECTED"]),
|
||||
runs: zod.number(),
|
||||
rating: zod.number(),
|
||||
store_listing_version_id: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
version: zod.number().or(zod.null()).optional(),
|
||||
reviewer_id: zod.string().or(zod.null()).optional(),
|
||||
review_comments: zod.string().or(zod.null()).optional(),
|
||||
internal_comments: zod.string().or(zod.null()).optional(),
|
||||
reviewed_at: zod
|
||||
.string()
|
||||
.datetime({})
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
changes_summary: zod.string().or(zod.null()).optional(),
|
||||
}),
|
||||
)
|
||||
.default(
|
||||
getV2GetAdminListingsHistoryResponseListingsItemVersionsDefault,
|
||||
),
|
||||
})
|
||||
.describe("A store listing with its version history"),
|
||||
),
|
||||
pagination: zod.object({
|
||||
total_items: zod.number().describe("Total number of items."),
|
||||
total_pages: zod.number().describe("Total number of pages."),
|
||||
current_page: zod.number().describe("Current_page page number."),
|
||||
page_size: zod.number().describe("Number of items per page."),
|
||||
}),
|
||||
})
|
||||
.describe("Response model for listings with version history");
|
||||
|
||||
/**
|
||||
* Review a store listing submission.
|
||||
|
||||
Args:
|
||||
store_listing_version_id: ID of the submission to review
|
||||
request: Review details including approval status and comments
|
||||
user: Authenticated admin user performing the review
|
||||
|
||||
Returns:
|
||||
StoreSubmission with updated review information
|
||||
* @summary Review Store Submission
|
||||
*/
|
||||
export const postV2ReviewStoreSubmissionParams = zod.object({
|
||||
store_listing_version_id: zod.string(),
|
||||
});
|
||||
|
||||
export const postV2ReviewStoreSubmissionBody = zod.object({
|
||||
store_listing_version_id: zod.string(),
|
||||
is_approved: zod.boolean(),
|
||||
comments: zod.string(),
|
||||
internal_comments: zod.string().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
export const postV2ReviewStoreSubmissionResponse = zod.object({
|
||||
agent_id: zod.string(),
|
||||
agent_version: zod.number(),
|
||||
name: zod.string(),
|
||||
sub_heading: zod.string(),
|
||||
slug: zod.string(),
|
||||
description: zod.string(),
|
||||
image_urls: zod.array(zod.string()),
|
||||
date_submitted: zod.string().datetime({}),
|
||||
status: zod.enum(["DRAFT", "PENDING", "APPROVED", "REJECTED"]),
|
||||
runs: zod.number(),
|
||||
rating: zod.number(),
|
||||
store_listing_version_id: zod.string().or(zod.null()).optional(),
|
||||
version: zod.number().or(zod.null()).optional(),
|
||||
reviewer_id: zod.string().or(zod.null()).optional(),
|
||||
review_comments: zod.string().or(zod.null()).optional(),
|
||||
internal_comments: zod.string().or(zod.null()).optional(),
|
||||
reviewed_at: zod.string().datetime({}).or(zod.null()).optional(),
|
||||
changes_summary: zod.string().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Download the agent file by streaming its content.
|
||||
|
||||
Args:
|
||||
store_listing_version_id (str): The ID of the agent to download
|
||||
|
||||
Returns:
|
||||
StreamingResponse: A streaming response containing the agent's graph data.
|
||||
|
||||
Raises:
|
||||
HTTPException: If the agent is not found or an unexpected error occurs.
|
||||
* @summary Admin Download Agent File
|
||||
*/
|
||||
export const getV2AdminDownloadAgentFileParams = zod.object({
|
||||
store_listing_version_id: zod
|
||||
.string()
|
||||
.describe("The ID of the agent to download"),
|
||||
});
|
||||
|
||||
export const getV2AdminDownloadAgentFileResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Add Credits to User
|
||||
*/
|
||||
export const postV2AddCreditsToUserBody = zod.object({
|
||||
user_id: zod.string(),
|
||||
amount: zod.number(),
|
||||
comments: zod.string(),
|
||||
});
|
||||
|
||||
export const postV2AddCreditsToUserResponse = zod.object({
|
||||
new_balance: zod.number(),
|
||||
transaction_key: zod.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary Get All Users History
|
||||
*/
|
||||
export const getV2GetAllUsersHistoryQueryPageDefault = 1;
|
||||
export const getV2GetAllUsersHistoryQueryPageSizeDefault = 20;
|
||||
|
||||
export const getV2GetAllUsersHistoryQueryParams = zod.object({
|
||||
search: zod.string().or(zod.null()).optional(),
|
||||
page: zod.number().default(getV2GetAllUsersHistoryQueryPageDefault),
|
||||
page_size: zod.number().default(getV2GetAllUsersHistoryQueryPageSizeDefault),
|
||||
transaction_filter: zod
|
||||
.enum(["TOP_UP", "USAGE", "GRANT", "REFUND", "CARD_CHECK"])
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const getV2GetAllUsersHistoryResponseHistoryItemTransactionKeyDefault =
|
||||
"";
|
||||
export const getV2GetAllUsersHistoryResponseHistoryItemTransactionTimeDefault =
|
||||
"0001-01-01T00:00:00Z";
|
||||
export const getV2GetAllUsersHistoryResponseHistoryItemAmountDefault = 0;
|
||||
export const getV2GetAllUsersHistoryResponseHistoryItemRunningBalanceDefault = 0;
|
||||
export const getV2GetAllUsersHistoryResponseHistoryItemCurrentBalanceDefault = 0;
|
||||
export const getV2GetAllUsersHistoryResponseHistoryItemUsageNodeCountDefault = 0;
|
||||
export const getV2GetAllUsersHistoryResponseHistoryItemUsageStartTimeDefault =
|
||||
"9999-12-31T23:59:59.999999Z";
|
||||
|
||||
export const getV2GetAllUsersHistoryResponse = zod
|
||||
.object({
|
||||
history: zod.array(
|
||||
zod.object({
|
||||
transaction_key: zod.string().optional(),
|
||||
transaction_time: zod
|
||||
.string()
|
||||
.datetime({})
|
||||
.default(
|
||||
getV2GetAllUsersHistoryResponseHistoryItemTransactionTimeDefault,
|
||||
),
|
||||
transaction_type: zod
|
||||
.enum(["TOP_UP", "USAGE", "GRANT", "REFUND", "CARD_CHECK"])
|
||||
.optional(),
|
||||
amount: zod.number().optional(),
|
||||
running_balance: zod.number().optional(),
|
||||
current_balance: zod.number().optional(),
|
||||
description: zod.string().or(zod.null()).optional(),
|
||||
usage_graph_id: zod.string().or(zod.null()).optional(),
|
||||
usage_execution_id: zod.string().or(zod.null()).optional(),
|
||||
usage_node_count: zod.number().optional(),
|
||||
usage_start_time: zod
|
||||
.string()
|
||||
.datetime({})
|
||||
.default(
|
||||
getV2GetAllUsersHistoryResponseHistoryItemUsageStartTimeDefault,
|
||||
),
|
||||
user_id: zod.string(),
|
||||
user_email: zod.string().or(zod.null()).optional(),
|
||||
reason: zod.string().or(zod.null()).optional(),
|
||||
admin_email: zod.string().or(zod.null()).optional(),
|
||||
extra_data: zod.string().or(zod.null()).optional(),
|
||||
}),
|
||||
),
|
||||
pagination: zod.object({
|
||||
total_items: zod.number().describe("Total number of items."),
|
||||
total_pages: zod.number().describe("Total number of pages."),
|
||||
current_page: zod.number().describe("Current_page page number."),
|
||||
page_size: zod.number().describe("Number of items per page."),
|
||||
}),
|
||||
})
|
||||
.describe("Response model for listings with version history");
|
||||
34
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/analytics/analytics.ts
generated
Normal file
34
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/analytics/analytics.ts
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* @summary Log Raw Metric
|
||||
*/
|
||||
export const postV1LogRawMetricBody = zod.object({
|
||||
metric_name: zod.string().min(1),
|
||||
metric_value: zod.number(),
|
||||
data_string: zod.string().min(1),
|
||||
});
|
||||
|
||||
export const postV1LogRawMetricResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Log Raw Analytics
|
||||
*/
|
||||
export const postV1LogRawAnalyticsBody = zod.object({
|
||||
type: zod.string(),
|
||||
data: zod.record(zod.string(), zod.any()).describe("The data to log"),
|
||||
data_index: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Indexable field for any count based analytical measures like page order clicking, tutorial step completion, etc.",
|
||||
),
|
||||
});
|
||||
|
||||
export const postV1LogRawAnalyticsResponse = zod.any();
|
||||
170
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/api-keys/api-keys.ts
generated
Normal file
170
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/api-keys/api-keys.ts
generated
Normal file
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* List all API keys for the user
|
||||
* @summary List user API keys
|
||||
*/
|
||||
export const getV1ListUserApiKeysResponse = zod
|
||||
.array(
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
name: zod.string(),
|
||||
prefix: zod.string(),
|
||||
postfix: zod.string(),
|
||||
status: zod.enum(["ACTIVE", "REVOKED", "SUSPENDED"]),
|
||||
permissions: zod.array(
|
||||
zod.enum([
|
||||
"EXECUTE_GRAPH",
|
||||
"READ_GRAPH",
|
||||
"EXECUTE_BLOCK",
|
||||
"READ_BLOCK",
|
||||
]),
|
||||
),
|
||||
created_at: zod.string().datetime({}),
|
||||
last_used_at: zod.string().datetime({}).or(zod.null()),
|
||||
revoked_at: zod.string().datetime({}).or(zod.null()),
|
||||
description: zod.string().or(zod.null()),
|
||||
user_id: zod.string(),
|
||||
}),
|
||||
)
|
||||
.or(zod.record(zod.string(), zod.string()));
|
||||
|
||||
/**
|
||||
* Create a new API key
|
||||
* @summary Create new API key
|
||||
*/
|
||||
export const postV1CreateNewApiKeyBody = zod.object({
|
||||
name: zod.string(),
|
||||
permissions: zod.array(
|
||||
zod.enum(["EXECUTE_GRAPH", "READ_GRAPH", "EXECUTE_BLOCK", "READ_BLOCK"]),
|
||||
),
|
||||
description: zod.string().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
export const postV1CreateNewApiKeyResponse = zod.object({
|
||||
api_key: zod.object({
|
||||
id: zod.string(),
|
||||
name: zod.string(),
|
||||
prefix: zod.string(),
|
||||
postfix: zod.string(),
|
||||
status: zod.enum(["ACTIVE", "REVOKED", "SUSPENDED"]),
|
||||
permissions: zod.array(
|
||||
zod.enum(["EXECUTE_GRAPH", "READ_GRAPH", "EXECUTE_BLOCK", "READ_BLOCK"]),
|
||||
),
|
||||
created_at: zod.string().datetime({}),
|
||||
last_used_at: zod.string().datetime({}).or(zod.null()),
|
||||
revoked_at: zod.string().datetime({}).or(zod.null()),
|
||||
description: zod.string().or(zod.null()),
|
||||
user_id: zod.string(),
|
||||
}),
|
||||
plain_text_key: zod.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Get a specific API key
|
||||
* @summary Get specific API key
|
||||
*/
|
||||
export const getV1GetSpecificApiKeyParams = zod.object({
|
||||
key_id: zod.string(),
|
||||
});
|
||||
|
||||
export const getV1GetSpecificApiKeyResponse = zod.object({
|
||||
id: zod.string(),
|
||||
name: zod.string(),
|
||||
prefix: zod.string(),
|
||||
postfix: zod.string(),
|
||||
status: zod.enum(["ACTIVE", "REVOKED", "SUSPENDED"]),
|
||||
permissions: zod.array(
|
||||
zod.enum(["EXECUTE_GRAPH", "READ_GRAPH", "EXECUTE_BLOCK", "READ_BLOCK"]),
|
||||
),
|
||||
created_at: zod.string().datetime({}),
|
||||
last_used_at: zod.string().datetime({}).or(zod.null()),
|
||||
revoked_at: zod.string().datetime({}).or(zod.null()),
|
||||
description: zod.string().or(zod.null()),
|
||||
user_id: zod.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Revoke an API key
|
||||
* @summary Revoke API key
|
||||
*/
|
||||
export const deleteV1RevokeApiKeyParams = zod.object({
|
||||
key_id: zod.string(),
|
||||
});
|
||||
|
||||
export const deleteV1RevokeApiKeyResponse = zod.object({
|
||||
id: zod.string(),
|
||||
name: zod.string(),
|
||||
prefix: zod.string(),
|
||||
postfix: zod.string(),
|
||||
status: zod.enum(["ACTIVE", "REVOKED", "SUSPENDED"]),
|
||||
permissions: zod.array(
|
||||
zod.enum(["EXECUTE_GRAPH", "READ_GRAPH", "EXECUTE_BLOCK", "READ_BLOCK"]),
|
||||
),
|
||||
created_at: zod.string().datetime({}),
|
||||
last_used_at: zod.string().datetime({}).or(zod.null()),
|
||||
revoked_at: zod.string().datetime({}).or(zod.null()),
|
||||
description: zod.string().or(zod.null()),
|
||||
user_id: zod.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Suspend an API key
|
||||
* @summary Suspend API key
|
||||
*/
|
||||
export const postV1SuspendApiKeyParams = zod.object({
|
||||
key_id: zod.string(),
|
||||
});
|
||||
|
||||
export const postV1SuspendApiKeyResponse = zod.object({
|
||||
id: zod.string(),
|
||||
name: zod.string(),
|
||||
prefix: zod.string(),
|
||||
postfix: zod.string(),
|
||||
status: zod.enum(["ACTIVE", "REVOKED", "SUSPENDED"]),
|
||||
permissions: zod.array(
|
||||
zod.enum(["EXECUTE_GRAPH", "READ_GRAPH", "EXECUTE_BLOCK", "READ_BLOCK"]),
|
||||
),
|
||||
created_at: zod.string().datetime({}),
|
||||
last_used_at: zod.string().datetime({}).or(zod.null()),
|
||||
revoked_at: zod.string().datetime({}).or(zod.null()),
|
||||
description: zod.string().or(zod.null()),
|
||||
user_id: zod.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Update API key permissions
|
||||
* @summary Update key permissions
|
||||
*/
|
||||
export const putV1UpdateKeyPermissionsParams = zod.object({
|
||||
key_id: zod.string(),
|
||||
});
|
||||
|
||||
export const putV1UpdateKeyPermissionsBody = zod.object({
|
||||
permissions: zod.array(
|
||||
zod.enum(["EXECUTE_GRAPH", "READ_GRAPH", "EXECUTE_BLOCK", "READ_BLOCK"]),
|
||||
),
|
||||
});
|
||||
|
||||
export const putV1UpdateKeyPermissionsResponse = zod.object({
|
||||
id: zod.string(),
|
||||
name: zod.string(),
|
||||
prefix: zod.string(),
|
||||
postfix: zod.string(),
|
||||
status: zod.enum(["ACTIVE", "REVOKED", "SUSPENDED"]),
|
||||
permissions: zod.array(
|
||||
zod.enum(["EXECUTE_GRAPH", "READ_GRAPH", "EXECUTE_BLOCK", "READ_BLOCK"]),
|
||||
),
|
||||
created_at: zod.string().datetime({}),
|
||||
last_used_at: zod.string().datetime({}).or(zod.null()),
|
||||
revoked_at: zod.string().datetime({}).or(zod.null()),
|
||||
description: zod.string().or(zod.null()),
|
||||
user_id: zod.string(),
|
||||
});
|
||||
71
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/auth/auth.ts
generated
Normal file
71
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/auth/auth.ts
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* @summary Get or create user
|
||||
*/
|
||||
export const postV1GetOrCreateUserResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Update user email
|
||||
*/
|
||||
export const postV1UpdateUserEmailBody = zod.string();
|
||||
|
||||
export const postV1UpdateUserEmailResponse = zod.record(
|
||||
zod.string(),
|
||||
zod.string(),
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary Get notification preferences
|
||||
*/
|
||||
export const getV1GetNotificationPreferencesResponseDailyLimitDefault = 10;
|
||||
export const getV1GetNotificationPreferencesResponseEmailsSentTodayDefault = 0;
|
||||
|
||||
export const getV1GetNotificationPreferencesResponse = zod.object({
|
||||
user_id: zod.string(),
|
||||
email: zod.string().email(),
|
||||
preferences: zod
|
||||
.record(zod.string(), zod.boolean())
|
||||
.optional()
|
||||
.describe("Which notifications the user wants"),
|
||||
daily_limit: zod
|
||||
.number()
|
||||
.default(getV1GetNotificationPreferencesResponseDailyLimitDefault),
|
||||
emails_sent_today: zod.number().optional(),
|
||||
last_reset_date: zod.string().datetime({}).optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary Update notification preferences
|
||||
*/
|
||||
export const postV1UpdateNotificationPreferencesBody = zod.object({
|
||||
email: zod.string().email().describe("User's email address"),
|
||||
preferences: zod
|
||||
.record(zod.string(), zod.boolean())
|
||||
.describe("Which notifications the user wants"),
|
||||
daily_limit: zod.number().describe("Max emails per day"),
|
||||
});
|
||||
|
||||
export const postV1UpdateNotificationPreferencesResponseDailyLimitDefault = 10;
|
||||
export const postV1UpdateNotificationPreferencesResponseEmailsSentTodayDefault = 0;
|
||||
|
||||
export const postV1UpdateNotificationPreferencesResponse = zod.object({
|
||||
user_id: zod.string(),
|
||||
email: zod.string().email(),
|
||||
preferences: zod
|
||||
.record(zod.string(), zod.boolean())
|
||||
.optional()
|
||||
.describe("Which notifications the user wants"),
|
||||
daily_limit: zod
|
||||
.number()
|
||||
.default(postV1UpdateNotificationPreferencesResponseDailyLimitDefault),
|
||||
emails_sent_today: zod.number().optional(),
|
||||
last_reset_date: zod.string().datetime({}).optional(),
|
||||
});
|
||||
33
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/blocks/blocks.ts
generated
Normal file
33
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/blocks/blocks.ts
generated
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* @summary List available blocks
|
||||
*/
|
||||
export const getV1ListAvailableBlocksResponseItem = zod.record(
|
||||
zod.string(),
|
||||
zod.any(),
|
||||
);
|
||||
export const getV1ListAvailableBlocksResponse = zod.array(
|
||||
getV1ListAvailableBlocksResponseItem,
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary Execute graph block
|
||||
*/
|
||||
export const postV1ExecuteGraphBlockParams = zod.object({
|
||||
block_id: zod.string(),
|
||||
});
|
||||
|
||||
export const postV1ExecuteGraphBlockBody = zod.record(zod.string(), zod.any());
|
||||
|
||||
export const postV1ExecuteGraphBlockResponse = zod.record(
|
||||
zod.string(),
|
||||
zod.array(zod.any()),
|
||||
);
|
||||
153
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/credits/credits.ts
generated
Normal file
153
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/credits/credits.ts
generated
Normal file
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* @summary Get user credits
|
||||
*/
|
||||
export const getV1GetUserCreditsResponse = zod.record(
|
||||
zod.string(),
|
||||
zod.number(),
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary Request credit top up
|
||||
*/
|
||||
export const postV1RequestCreditTopUpBody = zod.object({
|
||||
credit_amount: zod.number(),
|
||||
});
|
||||
|
||||
export const postV1RequestCreditTopUpResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Fulfill checkout session
|
||||
*/
|
||||
export const patchV1FulfillCheckoutSessionResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Refund credit transaction
|
||||
*/
|
||||
export const postV1RefundCreditTransactionParams = zod.object({
|
||||
transaction_key: zod.string(),
|
||||
});
|
||||
|
||||
export const postV1RefundCreditTransactionBody = zod.record(
|
||||
zod.string(),
|
||||
zod.string(),
|
||||
);
|
||||
|
||||
export const postV1RefundCreditTransactionResponse = zod.number();
|
||||
|
||||
/**
|
||||
* @summary Get auto top up
|
||||
*/
|
||||
export const getV1GetAutoTopUpResponse = zod.object({
|
||||
amount: zod.number(),
|
||||
threshold: zod.number(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary Configure auto top up
|
||||
*/
|
||||
export const postV1ConfigureAutoTopUpBody = zod.object({
|
||||
amount: zod.number(),
|
||||
threshold: zod.number(),
|
||||
});
|
||||
|
||||
export const postV1ConfigureAutoTopUpResponse = zod.string();
|
||||
|
||||
/**
|
||||
* @summary Handle Stripe webhooks
|
||||
*/
|
||||
export const postV1HandleStripeWebhooksResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Manage payment methods
|
||||
*/
|
||||
export const getV1ManagePaymentMethodsResponse = zod.record(
|
||||
zod.string(),
|
||||
zod.string(),
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary Get credit history
|
||||
*/
|
||||
export const getV1GetCreditHistoryQueryTransactionCountLimitDefault = 100;
|
||||
|
||||
export const getV1GetCreditHistoryQueryParams = zod.object({
|
||||
transaction_time: zod.string().datetime({}).or(zod.null()).optional(),
|
||||
transaction_type: zod.string().or(zod.null()).optional(),
|
||||
transaction_count_limit: zod
|
||||
.number()
|
||||
.default(getV1GetCreditHistoryQueryTransactionCountLimitDefault),
|
||||
});
|
||||
|
||||
export const getV1GetCreditHistoryResponseTransactionsItemTransactionKeyDefault =
|
||||
"";
|
||||
export const getV1GetCreditHistoryResponseTransactionsItemTransactionTimeDefault =
|
||||
"0001-01-01T00:00:00Z";
|
||||
export const getV1GetCreditHistoryResponseTransactionsItemAmountDefault = 0;
|
||||
export const getV1GetCreditHistoryResponseTransactionsItemRunningBalanceDefault = 0;
|
||||
export const getV1GetCreditHistoryResponseTransactionsItemCurrentBalanceDefault = 0;
|
||||
export const getV1GetCreditHistoryResponseTransactionsItemUsageNodeCountDefault = 0;
|
||||
export const getV1GetCreditHistoryResponseTransactionsItemUsageStartTimeDefault =
|
||||
"9999-12-31T23:59:59.999999Z";
|
||||
|
||||
export const getV1GetCreditHistoryResponse = zod.object({
|
||||
transactions: zod.array(
|
||||
zod.object({
|
||||
transaction_key: zod.string().optional(),
|
||||
transaction_time: zod
|
||||
.string()
|
||||
.datetime({})
|
||||
.default(
|
||||
getV1GetCreditHistoryResponseTransactionsItemTransactionTimeDefault,
|
||||
),
|
||||
transaction_type: zod
|
||||
.enum(["TOP_UP", "USAGE", "GRANT", "REFUND", "CARD_CHECK"])
|
||||
.optional(),
|
||||
amount: zod.number().optional(),
|
||||
running_balance: zod.number().optional(),
|
||||
current_balance: zod.number().optional(),
|
||||
description: zod.string().or(zod.null()).optional(),
|
||||
usage_graph_id: zod.string().or(zod.null()).optional(),
|
||||
usage_execution_id: zod.string().or(zod.null()).optional(),
|
||||
usage_node_count: zod.number().optional(),
|
||||
usage_start_time: zod
|
||||
.string()
|
||||
.datetime({})
|
||||
.default(
|
||||
getV1GetCreditHistoryResponseTransactionsItemUsageStartTimeDefault,
|
||||
),
|
||||
user_id: zod.string(),
|
||||
user_email: zod.string().or(zod.null()).optional(),
|
||||
reason: zod.string().or(zod.null()).optional(),
|
||||
admin_email: zod.string().or(zod.null()).optional(),
|
||||
extra_data: zod.string().or(zod.null()).optional(),
|
||||
}),
|
||||
),
|
||||
next_transaction_time: zod.string().datetime({}).or(zod.null()),
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary Get refund requests
|
||||
*/
|
||||
export const getV1GetRefundRequestsResponseItem = zod.object({
|
||||
id: zod.string(),
|
||||
user_id: zod.string(),
|
||||
transaction_key: zod.string(),
|
||||
amount: zod.number(),
|
||||
reason: zod.string(),
|
||||
result: zod.string().or(zod.null()).optional(),
|
||||
status: zod.string(),
|
||||
created_at: zod.string().datetime({}),
|
||||
updated_at: zod.string().datetime({}),
|
||||
});
|
||||
export const getV1GetRefundRequestsResponse = zod.array(
|
||||
getV1GetRefundRequestsResponseItem,
|
||||
);
|
||||
181
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/email/email.ts
generated
Normal file
181
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/email/email.ts
generated
Normal file
@@ -0,0 +1,181 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* @summary One Click Email Unsubscribe
|
||||
*/
|
||||
export const postV1OneClickEmailUnsubscribeQueryParams = zod.object({
|
||||
token: zod.string(),
|
||||
});
|
||||
|
||||
export const postV1OneClickEmailUnsubscribeResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Handle Postmark Email Webhooks
|
||||
*/
|
||||
export const postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefault =
|
||||
"Delivery";
|
||||
export const postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefaultOne =
|
||||
"Bounce";
|
||||
export const postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefaultTwo =
|
||||
"SpamComplaint";
|
||||
export const postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefaultThree =
|
||||
"Open";
|
||||
export const postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefaultFour =
|
||||
"Click";
|
||||
export const postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefaultFive =
|
||||
"SubscriptionChange";
|
||||
|
||||
export const postV1HandlePostmarkEmailWebhooksBody = zod
|
||||
.object({
|
||||
RecordType: zod
|
||||
.string()
|
||||
.default(postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefault),
|
||||
ServerID: zod.number(),
|
||||
MessageStream: zod.string(),
|
||||
MessageID: zod.string(),
|
||||
Recipient: zod.string(),
|
||||
Tag: zod.string(),
|
||||
DeliveredAt: zod.string(),
|
||||
Details: zod.string(),
|
||||
Metadata: zod.record(zod.string(), zod.string()),
|
||||
})
|
||||
.or(
|
||||
zod.object({
|
||||
RecordType: zod
|
||||
.string()
|
||||
.default(postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefaultOne),
|
||||
ID: zod.number(),
|
||||
Type: zod.string(),
|
||||
TypeCode: zod
|
||||
.literal(1)
|
||||
.or(zod.literal(2))
|
||||
.or(zod.literal(16))
|
||||
.or(zod.literal(32))
|
||||
.or(zod.literal(64))
|
||||
.or(zod.literal(128))
|
||||
.or(zod.literal(256))
|
||||
.or(zod.literal(512))
|
||||
.or(zod.literal(1024))
|
||||
.or(zod.literal(2048))
|
||||
.or(zod.literal(4096))
|
||||
.or(zod.literal(8192))
|
||||
.or(zod.literal(16384))
|
||||
.or(zod.literal(100000))
|
||||
.or(zod.literal(100001))
|
||||
.or(zod.literal(100002))
|
||||
.or(zod.literal(100003))
|
||||
.or(zod.literal(100006))
|
||||
.or(zod.literal(100007))
|
||||
.or(zod.literal(100008))
|
||||
.or(zod.literal(100009))
|
||||
.or(zod.literal(100010)),
|
||||
Tag: zod.string(),
|
||||
MessageID: zod.string(),
|
||||
Details: zod.string(),
|
||||
Email: zod.string(),
|
||||
From: zod.string(),
|
||||
BouncedAt: zod.string(),
|
||||
Inactive: zod.boolean(),
|
||||
DumpAvailable: zod.boolean(),
|
||||
CanActivate: zod.boolean(),
|
||||
Subject: zod.string(),
|
||||
ServerID: zod.number(),
|
||||
MessageStream: zod.string(),
|
||||
Content: zod.string(),
|
||||
Name: zod.string(),
|
||||
Description: zod.string(),
|
||||
Metadata: zod.record(zod.string(), zod.string()),
|
||||
}),
|
||||
)
|
||||
.or(
|
||||
zod.object({
|
||||
RecordType: zod
|
||||
.string()
|
||||
.default(postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefaultTwo),
|
||||
ID: zod.number(),
|
||||
Type: zod.string(),
|
||||
TypeCode: zod.number(),
|
||||
Tag: zod.string(),
|
||||
MessageID: zod.string(),
|
||||
Details: zod.string(),
|
||||
Email: zod.string(),
|
||||
From: zod.string(),
|
||||
BouncedAt: zod.string(),
|
||||
Inactive: zod.boolean(),
|
||||
DumpAvailable: zod.boolean(),
|
||||
CanActivate: zod.boolean(),
|
||||
Subject: zod.string(),
|
||||
ServerID: zod.number(),
|
||||
MessageStream: zod.string(),
|
||||
Content: zod.string(),
|
||||
Name: zod.string(),
|
||||
Description: zod.string(),
|
||||
Metadata: zod.record(zod.string(), zod.string()),
|
||||
}),
|
||||
)
|
||||
.or(
|
||||
zod.object({
|
||||
RecordType: zod
|
||||
.string()
|
||||
.default(postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefaultThree),
|
||||
MessageStream: zod.string(),
|
||||
Metadata: zod.record(zod.string(), zod.string()),
|
||||
FirstOpen: zod.boolean(),
|
||||
Recipient: zod.string(),
|
||||
MessageID: zod.string(),
|
||||
ReceivedAt: zod.string(),
|
||||
Platform: zod.string(),
|
||||
ReadSeconds: zod.number(),
|
||||
Tag: zod.string(),
|
||||
UserAgent: zod.string(),
|
||||
OS: zod.record(zod.string(), zod.string()),
|
||||
Client: zod.record(zod.string(), zod.string()),
|
||||
Geo: zod.record(zod.string(), zod.string()),
|
||||
}),
|
||||
)
|
||||
.or(
|
||||
zod.object({
|
||||
RecordType: zod
|
||||
.string()
|
||||
.default(postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefaultFour),
|
||||
MessageStream: zod.string(),
|
||||
Metadata: zod.record(zod.string(), zod.string()),
|
||||
Recipient: zod.string(),
|
||||
MessageID: zod.string(),
|
||||
ReceivedAt: zod.string(),
|
||||
Platform: zod.string(),
|
||||
ClickLocation: zod.string(),
|
||||
OriginalLink: zod.string(),
|
||||
Tag: zod.string(),
|
||||
UserAgent: zod.string(),
|
||||
OS: zod.record(zod.string(), zod.string()),
|
||||
Client: zod.record(zod.string(), zod.string()),
|
||||
Geo: zod.record(zod.string(), zod.string()),
|
||||
}),
|
||||
)
|
||||
.or(
|
||||
zod.object({
|
||||
RecordType: zod
|
||||
.string()
|
||||
.default(postV1HandlePostmarkEmailWebhooksBodyRecordTypeDefaultFive),
|
||||
MessageID: zod.string(),
|
||||
ServerID: zod.number(),
|
||||
MessageStream: zod.string(),
|
||||
ChangedAt: zod.string(),
|
||||
Recipient: zod.string(),
|
||||
Origin: zod.string(),
|
||||
SuppressSending: zod.boolean(),
|
||||
SuppressionReason: zod.string(),
|
||||
Tag: zod.string(),
|
||||
Metadata: zod.record(zod.string(), zod.string()),
|
||||
}),
|
||||
);
|
||||
|
||||
export const postV1HandlePostmarkEmailWebhooksResponse = zod.any();
|
||||
1990
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/graphs/graphs.ts
generated
Normal file
1990
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/graphs/graphs.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
13
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/health/health.ts
generated
Normal file
13
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/health/health.ts
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* @summary Health
|
||||
*/
|
||||
export const getHealthHealthResponse = zod.any();
|
||||
324
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/integrations/integrations.ts
generated
Normal file
324
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/integrations/integrations.ts
generated
Normal file
@@ -0,0 +1,324 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* @summary Login
|
||||
*/
|
||||
export const getV1LoginParams = zod.object({
|
||||
provider: zod.string(),
|
||||
});
|
||||
|
||||
export const getV1LoginQueryScopesDefault = "";
|
||||
|
||||
export const getV1LoginQueryParams = zod.object({
|
||||
scopes: zod.string().optional(),
|
||||
});
|
||||
|
||||
export const getV1LoginResponse = zod.object({
|
||||
login_url: zod.string(),
|
||||
state_token: zod.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary Callback
|
||||
*/
|
||||
export const postV1CallbackParams = zod.object({
|
||||
provider: zod.string(),
|
||||
});
|
||||
|
||||
export const postV1CallbackBody = zod.object({
|
||||
code: zod.string(),
|
||||
state_token: zod.string(),
|
||||
});
|
||||
|
||||
export const postV1CallbackResponse = zod.object({
|
||||
id: zod.string(),
|
||||
provider: zod.string(),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
title: zod.string().or(zod.null()),
|
||||
scopes: zod.array(zod.string()).or(zod.null()),
|
||||
username: zod.string().or(zod.null()),
|
||||
host: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("Host pattern for host-scoped credentials"),
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary List Credentials
|
||||
*/
|
||||
export const getV1ListCredentialsResponseItem = zod.object({
|
||||
id: zod.string(),
|
||||
provider: zod.string(),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
title: zod.string().or(zod.null()),
|
||||
scopes: zod.array(zod.string()).or(zod.null()),
|
||||
username: zod.string().or(zod.null()),
|
||||
host: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("Host pattern for host-scoped credentials"),
|
||||
});
|
||||
export const getV1ListCredentialsResponse = zod.array(
|
||||
getV1ListCredentialsResponseItem,
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary List Credentials By Provider
|
||||
*/
|
||||
export const getV1ListCredentialsByProviderParams = zod.object({
|
||||
provider: zod.string(),
|
||||
});
|
||||
|
||||
export const getV1ListCredentialsByProviderResponseItem = zod.object({
|
||||
id: zod.string(),
|
||||
provider: zod.string(),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
title: zod.string().or(zod.null()),
|
||||
scopes: zod.array(zod.string()).or(zod.null()),
|
||||
username: zod.string().or(zod.null()),
|
||||
host: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("Host pattern for host-scoped credentials"),
|
||||
});
|
||||
export const getV1ListCredentialsByProviderResponse = zod.array(
|
||||
getV1ListCredentialsByProviderResponseItem,
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary Create Credentials
|
||||
*/
|
||||
export const postV1CreateCredentialsParams = zod.object({
|
||||
provider: zod.string(),
|
||||
});
|
||||
|
||||
export const postV1CreateCredentialsBodyTypeDefault = "oauth2";
|
||||
export const postV1CreateCredentialsBodyTypeDefaultOne = "api_key";
|
||||
export const postV1CreateCredentialsBodyTypeDefaultTwo = "user_password";
|
||||
export const postV1CreateCredentialsBodyTypeDefaultThree = "host_scoped";
|
||||
|
||||
export const postV1CreateCredentialsBody = zod
|
||||
.object({
|
||||
id: zod.string().optional(),
|
||||
provider: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
type: zod.string().default(postV1CreateCredentialsBodyTypeDefault),
|
||||
username: zod.string().or(zod.null()).optional(),
|
||||
access_token: zod.string(),
|
||||
access_token_expires_at: zod.number().or(zod.null()).optional(),
|
||||
refresh_token: zod.string().or(zod.null()).optional(),
|
||||
refresh_token_expires_at: zod.number().or(zod.null()).optional(),
|
||||
scopes: zod.array(zod.string()),
|
||||
metadata: zod.record(zod.string(), zod.any()).optional(),
|
||||
})
|
||||
.or(
|
||||
zod.object({
|
||||
id: zod.string().optional(),
|
||||
provider: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
type: zod.string().default(postV1CreateCredentialsBodyTypeDefaultOne),
|
||||
api_key: zod.string(),
|
||||
expires_at: zod
|
||||
.number()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe(
|
||||
"Unix timestamp (seconds) indicating when the API key expires (if at all)",
|
||||
),
|
||||
}),
|
||||
)
|
||||
.or(
|
||||
zod.object({
|
||||
id: zod.string().optional(),
|
||||
provider: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
type: zod.string().default(postV1CreateCredentialsBodyTypeDefaultTwo),
|
||||
username: zod.string(),
|
||||
password: zod.string(),
|
||||
}),
|
||||
)
|
||||
.or(
|
||||
zod.object({
|
||||
id: zod.string().optional(),
|
||||
provider: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
type: zod.string().default(postV1CreateCredentialsBodyTypeDefaultThree),
|
||||
host: zod
|
||||
.string()
|
||||
.describe("The host/URI pattern to match against request URLs"),
|
||||
headers: zod
|
||||
.record(zod.string(), zod.string())
|
||||
.optional()
|
||||
.describe("Key-value header map to add to matching requests"),
|
||||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary Get Credential
|
||||
*/
|
||||
export const getV1GetCredentialParams = zod.object({
|
||||
provider: zod.string(),
|
||||
cred_id: zod.string(),
|
||||
});
|
||||
|
||||
export const getV1GetCredentialResponseTypeDefault = "oauth2";
|
||||
export const getV1GetCredentialResponseTypeDefaultOne = "api_key";
|
||||
export const getV1GetCredentialResponseTypeDefaultTwo = "user_password";
|
||||
export const getV1GetCredentialResponseTypeDefaultThree = "host_scoped";
|
||||
|
||||
export const getV1GetCredentialResponse = zod
|
||||
.object({
|
||||
id: zod.string().optional(),
|
||||
provider: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
type: zod.string().default(getV1GetCredentialResponseTypeDefault),
|
||||
username: zod.string().or(zod.null()).optional(),
|
||||
access_token: zod.string(),
|
||||
access_token_expires_at: zod.number().or(zod.null()).optional(),
|
||||
refresh_token: zod.string().or(zod.null()).optional(),
|
||||
refresh_token_expires_at: zod.number().or(zod.null()).optional(),
|
||||
scopes: zod.array(zod.string()),
|
||||
metadata: zod.record(zod.string(), zod.any()).optional(),
|
||||
})
|
||||
.or(
|
||||
zod.object({
|
||||
id: zod.string().optional(),
|
||||
provider: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
type: zod.string().default(getV1GetCredentialResponseTypeDefaultOne),
|
||||
api_key: zod.string(),
|
||||
expires_at: zod
|
||||
.number()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe(
|
||||
"Unix timestamp (seconds) indicating when the API key expires (if at all)",
|
||||
),
|
||||
}),
|
||||
)
|
||||
.or(
|
||||
zod.object({
|
||||
id: zod.string().optional(),
|
||||
provider: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
type: zod.string().default(getV1GetCredentialResponseTypeDefaultTwo),
|
||||
username: zod.string(),
|
||||
password: zod.string(),
|
||||
}),
|
||||
)
|
||||
.or(
|
||||
zod.object({
|
||||
id: zod.string().optional(),
|
||||
provider: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
type: zod.string().default(getV1GetCredentialResponseTypeDefaultThree),
|
||||
host: zod
|
||||
.string()
|
||||
.describe("The host/URI pattern to match against request URLs"),
|
||||
headers: zod
|
||||
.record(zod.string(), zod.string())
|
||||
.optional()
|
||||
.describe("Key-value header map to add to matching requests"),
|
||||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary Delete Credentials
|
||||
*/
|
||||
export const deleteV1DeleteCredentialsParams = zod.object({
|
||||
provider: zod.string(),
|
||||
cred_id: zod.string(),
|
||||
});
|
||||
|
||||
export const deleteV1DeleteCredentialsQueryForceDefault = false;
|
||||
|
||||
export const deleteV1DeleteCredentialsQueryParams = zod.object({
|
||||
force: zod.boolean().optional(),
|
||||
});
|
||||
|
||||
export const deleteV1DeleteCredentialsResponseDeletedDefault = true;
|
||||
export const deleteV1DeleteCredentialsResponseDeletedDefaultOne = false;
|
||||
export const deleteV1DeleteCredentialsResponseNeedConfirmationDefault = true;
|
||||
|
||||
export const deleteV1DeleteCredentialsResponse = zod
|
||||
.object({
|
||||
deleted: zod
|
||||
.boolean()
|
||||
.default(deleteV1DeleteCredentialsResponseDeletedDefault),
|
||||
revoked: zod
|
||||
.boolean()
|
||||
.or(zod.null())
|
||||
.describe(
|
||||
"Indicates whether the credentials were also revoked by their provider. `None`/`null` if not applicable, e.g. when deleting non-revocable credentials such as API keys.",
|
||||
),
|
||||
})
|
||||
.or(
|
||||
zod.object({
|
||||
deleted: zod.boolean().optional(),
|
||||
need_confirmation: zod
|
||||
.boolean()
|
||||
.default(deleteV1DeleteCredentialsResponseNeedConfirmationDefault),
|
||||
message: zod.string(),
|
||||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary Webhook Ingress Generic
|
||||
*/
|
||||
export const postV1WebhookIngressGenericParams = zod.object({
|
||||
provider: zod.string(),
|
||||
webhook_id: zod.string(),
|
||||
});
|
||||
|
||||
export const postV1WebhookIngressGenericResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Webhook Ping
|
||||
*/
|
||||
export const postV1WebhookPingParams = zod.object({
|
||||
webhook_id: zod.string(),
|
||||
});
|
||||
|
||||
export const postV1WebhookPingResponse = zod.any();
|
||||
|
||||
/**
|
||||
* Get a list of all available provider names.
|
||||
|
||||
Returns both statically defined providers (from ProviderName enum)
|
||||
and dynamically registered providers (from SDK decorators).
|
||||
* @summary List Providers
|
||||
*/
|
||||
export const getV1ListProvidersResponseItem = zod.string();
|
||||
export const getV1ListProvidersResponse = zod.array(
|
||||
getV1ListProvidersResponseItem,
|
||||
);
|
||||
|
||||
/**
|
||||
* Get detailed information about all providers.
|
||||
|
||||
Returns a dictionary mapping provider names to their details,
|
||||
including supported credential types and other metadata.
|
||||
* @summary Get Providers Details
|
||||
*/
|
||||
export const getV1GetProvidersDetailsResponse = zod.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
name: zod.string(),
|
||||
source: zod.enum(["static", "dynamic", "both"]),
|
||||
has_oauth: zod.boolean(),
|
||||
has_webhooks: zod.boolean(),
|
||||
supported_credential_types: zod
|
||||
.array(zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]))
|
||||
.optional(),
|
||||
}),
|
||||
);
|
||||
497
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/library/library.ts
generated
Normal file
497
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/library/library.ts
generated
Normal file
@@ -0,0 +1,497 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* Get all agents in the user's library (both created and saved).
|
||||
|
||||
Args:
|
||||
user_id: ID of the authenticated user.
|
||||
search_term: Optional search term to filter agents by name/description.
|
||||
filter_by: List of filters to apply (favorites, created by user).
|
||||
sort_by: List of sorting criteria (created date, updated date).
|
||||
page: Page number to retrieve.
|
||||
page_size: Number of agents per page.
|
||||
|
||||
Returns:
|
||||
A LibraryAgentResponse containing agents and pagination metadata.
|
||||
|
||||
Raises:
|
||||
HTTPException: If a server/database error occurs.
|
||||
* @summary List Library Agents
|
||||
*/
|
||||
export const getV2ListLibraryAgentsQueryPageDefault = 1;
|
||||
export const getV2ListLibraryAgentsQueryPageSizeDefault = 15;
|
||||
|
||||
export const getV2ListLibraryAgentsQueryParams = zod.object({
|
||||
search_term: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("Search term to filter agents"),
|
||||
sort_by: zod
|
||||
.enum(["createdAt", "updatedAt"])
|
||||
.optional()
|
||||
.describe("Criteria to sort results by"),
|
||||
page: zod
|
||||
.number()
|
||||
.min(1)
|
||||
.default(getV2ListLibraryAgentsQueryPageDefault)
|
||||
.describe("Page number to retrieve (must be >= 1)"),
|
||||
page_size: zod
|
||||
.number()
|
||||
.min(1)
|
||||
.default(getV2ListLibraryAgentsQueryPageSizeDefault)
|
||||
.describe("Number of agents per page (must be >= 1)"),
|
||||
});
|
||||
|
||||
export const getV2ListLibraryAgentsResponse = zod
|
||||
.object({
|
||||
agents: zod.array(
|
||||
zod
|
||||
.object({
|
||||
id: zod.string(),
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
image_url: zod.string().or(zod.null()),
|
||||
creator_name: zod.string(),
|
||||
creator_image_url: zod.string(),
|
||||
status: zod.enum(["COMPLETED", "HEALTHY", "WAITING", "ERROR"]),
|
||||
updated_at: zod.string().datetime({}),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
input_schema: zod.record(zod.string(), zod.any()),
|
||||
credentials_input_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for credentials required by the agent"),
|
||||
has_external_trigger: zod
|
||||
.boolean()
|
||||
.describe(
|
||||
"Whether the agent has an external trigger (e.g. webhook) node",
|
||||
),
|
||||
trigger_setup_info: zod
|
||||
.object({
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
config_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for the trigger block"),
|
||||
credentials_input_name: zod.string().or(zod.null()),
|
||||
})
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
new_output: zod.boolean(),
|
||||
can_access_graph: zod.boolean(),
|
||||
is_latest_version: zod.boolean(),
|
||||
})
|
||||
.describe(
|
||||
"Represents an agent in the library, including metadata for display and\nuser interaction within the system.",
|
||||
),
|
||||
),
|
||||
pagination: zod.object({
|
||||
total_items: zod.number().describe("Total number of items."),
|
||||
total_pages: zod.number().describe("Total number of pages."),
|
||||
current_page: zod.number().describe("Current_page page number."),
|
||||
page_size: zod.number().describe("Number of items per page."),
|
||||
}),
|
||||
})
|
||||
.describe(
|
||||
"Response schema for a list of library agents and pagination info.",
|
||||
);
|
||||
|
||||
/**
|
||||
* Add an agent from the marketplace to the user's library.
|
||||
|
||||
Args:
|
||||
store_listing_version_id: ID of the store listing version to add.
|
||||
user_id: ID of the authenticated user.
|
||||
|
||||
Returns:
|
||||
library_model.LibraryAgent: Agent added to the library
|
||||
|
||||
Raises:
|
||||
HTTPException(404): If the listing version is not found.
|
||||
HTTPException(500): If a server/database error occurs.
|
||||
* @summary Add Marketplace Agent
|
||||
*/
|
||||
export const postV2AddMarketplaceAgentBody = zod.object({
|
||||
store_listing_version_id: zod.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary Get Library Agent
|
||||
*/
|
||||
export const getV2GetLibraryAgentParams = zod.object({
|
||||
library_agent_id: zod.string(),
|
||||
});
|
||||
|
||||
export const getV2GetLibraryAgentResponse = zod
|
||||
.object({
|
||||
id: zod.string(),
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
image_url: zod.string().or(zod.null()),
|
||||
creator_name: zod.string(),
|
||||
creator_image_url: zod.string(),
|
||||
status: zod.enum(["COMPLETED", "HEALTHY", "WAITING", "ERROR"]),
|
||||
updated_at: zod.string().datetime({}),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
input_schema: zod.record(zod.string(), zod.any()),
|
||||
credentials_input_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for credentials required by the agent"),
|
||||
has_external_trigger: zod
|
||||
.boolean()
|
||||
.describe(
|
||||
"Whether the agent has an external trigger (e.g. webhook) node",
|
||||
),
|
||||
trigger_setup_info: zod
|
||||
.object({
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
config_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for the trigger block"),
|
||||
credentials_input_name: zod.string().or(zod.null()),
|
||||
})
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
new_output: zod.boolean(),
|
||||
can_access_graph: zod.boolean(),
|
||||
is_latest_version: zod.boolean(),
|
||||
})
|
||||
.describe(
|
||||
"Represents an agent in the library, including metadata for display and\nuser interaction within the system.",
|
||||
);
|
||||
|
||||
/**
|
||||
* Update the library agent with the given fields.
|
||||
|
||||
Args:
|
||||
library_agent_id: ID of the library agent to update.
|
||||
payload: Fields to update (auto_update_version, is_favorite, etc.).
|
||||
user_id: ID of the authenticated user.
|
||||
|
||||
Raises:
|
||||
HTTPException(500): If a server/database error occurs.
|
||||
* @summary Update Library Agent
|
||||
*/
|
||||
export const patchV2UpdateLibraryAgentParams = zod.object({
|
||||
library_agent_id: zod.string(),
|
||||
});
|
||||
|
||||
export const patchV2UpdateLibraryAgentBody = zod
|
||||
.object({
|
||||
auto_update_version: zod
|
||||
.boolean()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("Auto-update the agent version"),
|
||||
is_favorite: zod
|
||||
.boolean()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("Mark the agent as a favorite"),
|
||||
is_archived: zod
|
||||
.boolean()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("Archive the agent"),
|
||||
})
|
||||
.describe(
|
||||
"Schema for updating a library agent via PUT.\n\nIncludes flags for auto-updating version, marking as favorite,\narchiving, or deleting.",
|
||||
);
|
||||
|
||||
export const patchV2UpdateLibraryAgentResponse = zod
|
||||
.object({
|
||||
id: zod.string(),
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
image_url: zod.string().or(zod.null()),
|
||||
creator_name: zod.string(),
|
||||
creator_image_url: zod.string(),
|
||||
status: zod.enum(["COMPLETED", "HEALTHY", "WAITING", "ERROR"]),
|
||||
updated_at: zod.string().datetime({}),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
input_schema: zod.record(zod.string(), zod.any()),
|
||||
credentials_input_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for credentials required by the agent"),
|
||||
has_external_trigger: zod
|
||||
.boolean()
|
||||
.describe(
|
||||
"Whether the agent has an external trigger (e.g. webhook) node",
|
||||
),
|
||||
trigger_setup_info: zod
|
||||
.object({
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
config_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for the trigger block"),
|
||||
credentials_input_name: zod.string().or(zod.null()),
|
||||
})
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
new_output: zod.boolean(),
|
||||
can_access_graph: zod.boolean(),
|
||||
is_latest_version: zod.boolean(),
|
||||
})
|
||||
.describe(
|
||||
"Represents an agent in the library, including metadata for display and\nuser interaction within the system.",
|
||||
);
|
||||
|
||||
/**
|
||||
* Soft-delete the specified library agent.
|
||||
|
||||
Args:
|
||||
library_agent_id: ID of the library agent to delete.
|
||||
user_id: ID of the authenticated user.
|
||||
|
||||
Returns:
|
||||
204 No Content if successful.
|
||||
|
||||
Raises:
|
||||
HTTPException(404): If the agent does not exist.
|
||||
HTTPException(500): If a server/database error occurs.
|
||||
* @summary Delete Library Agent
|
||||
*/
|
||||
export const deleteV2DeleteLibraryAgentParams = zod.object({
|
||||
library_agent_id: zod.string(),
|
||||
});
|
||||
|
||||
export const deleteV2DeleteLibraryAgentResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Get Library Agent By Graph Id
|
||||
*/
|
||||
export const getV2GetLibraryAgentByGraphIdParams = zod.object({
|
||||
graph_id: zod.string(),
|
||||
});
|
||||
|
||||
export const getV2GetLibraryAgentByGraphIdQueryParams = zod.object({
|
||||
version: zod.number().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
export const getV2GetLibraryAgentByGraphIdResponse = zod
|
||||
.object({
|
||||
id: zod.string(),
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
image_url: zod.string().or(zod.null()),
|
||||
creator_name: zod.string(),
|
||||
creator_image_url: zod.string(),
|
||||
status: zod.enum(["COMPLETED", "HEALTHY", "WAITING", "ERROR"]),
|
||||
updated_at: zod.string().datetime({}),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
input_schema: zod.record(zod.string(), zod.any()),
|
||||
credentials_input_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for credentials required by the agent"),
|
||||
has_external_trigger: zod
|
||||
.boolean()
|
||||
.describe(
|
||||
"Whether the agent has an external trigger (e.g. webhook) node",
|
||||
),
|
||||
trigger_setup_info: zod
|
||||
.object({
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
config_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for the trigger block"),
|
||||
credentials_input_name: zod.string().or(zod.null()),
|
||||
})
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
new_output: zod.boolean(),
|
||||
can_access_graph: zod.boolean(),
|
||||
is_latest_version: zod.boolean(),
|
||||
})
|
||||
.describe(
|
||||
"Represents an agent in the library, including metadata for display and\nuser interaction within the system.",
|
||||
);
|
||||
|
||||
/**
|
||||
* Get Library Agent from Store Listing Version ID.
|
||||
* @summary Get Agent By Store ID
|
||||
*/
|
||||
export const getV2GetAgentByStoreIdParams = zod.object({
|
||||
store_listing_version_id: zod.string(),
|
||||
});
|
||||
|
||||
export const getV2GetAgentByStoreIdResponse = zod
|
||||
.object({
|
||||
id: zod.string(),
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
image_url: zod.string().or(zod.null()),
|
||||
creator_name: zod.string(),
|
||||
creator_image_url: zod.string(),
|
||||
status: zod.enum(["COMPLETED", "HEALTHY", "WAITING", "ERROR"]),
|
||||
updated_at: zod.string().datetime({}),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
input_schema: zod.record(zod.string(), zod.any()),
|
||||
credentials_input_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for credentials required by the agent"),
|
||||
has_external_trigger: zod
|
||||
.boolean()
|
||||
.describe(
|
||||
"Whether the agent has an external trigger (e.g. webhook) node",
|
||||
),
|
||||
trigger_setup_info: zod
|
||||
.object({
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
config_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for the trigger block"),
|
||||
credentials_input_name: zod.string().or(zod.null()),
|
||||
})
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
new_output: zod.boolean(),
|
||||
can_access_graph: zod.boolean(),
|
||||
is_latest_version: zod.boolean(),
|
||||
})
|
||||
.describe(
|
||||
"Represents an agent in the library, including metadata for display and\nuser interaction within the system.",
|
||||
)
|
||||
.or(zod.null());
|
||||
|
||||
/**
|
||||
* @summary Fork Library Agent
|
||||
*/
|
||||
export const postV2ForkLibraryAgentParams = zod.object({
|
||||
library_agent_id: zod.string(),
|
||||
});
|
||||
|
||||
export const postV2ForkLibraryAgentResponse = zod
|
||||
.object({
|
||||
id: zod.string(),
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
image_url: zod.string().or(zod.null()),
|
||||
creator_name: zod.string(),
|
||||
creator_image_url: zod.string(),
|
||||
status: zod.enum(["COMPLETED", "HEALTHY", "WAITING", "ERROR"]),
|
||||
updated_at: zod.string().datetime({}),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
input_schema: zod.record(zod.string(), zod.any()),
|
||||
credentials_input_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for credentials required by the agent"),
|
||||
has_external_trigger: zod
|
||||
.boolean()
|
||||
.describe(
|
||||
"Whether the agent has an external trigger (e.g. webhook) node",
|
||||
),
|
||||
trigger_setup_info: zod
|
||||
.object({
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
config_schema: zod
|
||||
.record(zod.string(), zod.any())
|
||||
.describe("Input schema for the trigger block"),
|
||||
credentials_input_name: zod.string().or(zod.null()),
|
||||
})
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
new_output: zod.boolean(),
|
||||
can_access_graph: zod.boolean(),
|
||||
is_latest_version: zod.boolean(),
|
||||
})
|
||||
.describe(
|
||||
"Represents an agent in the library, including metadata for display and\nuser interaction within the system.",
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets up a webhook-triggered `LibraryAgentPreset` for a `LibraryAgent`.
|
||||
Returns the correspondingly created `LibraryAgentPreset` with `webhook_id` set.
|
||||
* @summary Setup Trigger
|
||||
*/
|
||||
export const postV2SetupTriggerParams = zod.object({
|
||||
library_agent_id: zod.string().describe("ID of the library agent"),
|
||||
});
|
||||
|
||||
export const postV2SetupTriggerBodyDescriptionDefault = "";
|
||||
|
||||
export const postV2SetupTriggerBody = zod.object({
|
||||
name: zod.string(),
|
||||
description: zod.string().optional(),
|
||||
trigger_config: zod.record(zod.string(), zod.any()),
|
||||
agent_credentials: zod
|
||||
.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const postV2SetupTriggerResponseIsActiveDefault = true;
|
||||
|
||||
export const postV2SetupTriggerResponse = zod
|
||||
.object({
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
inputs: zod.record(zod.string(), zod.any()),
|
||||
credentials: zod.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
is_active: zod.boolean().default(postV2SetupTriggerResponseIsActiveDefault),
|
||||
webhook_id: zod.string().or(zod.null()).optional(),
|
||||
id: zod.string(),
|
||||
user_id: zod.string(),
|
||||
updated_at: zod.string().datetime({}),
|
||||
})
|
||||
.describe("Represents a preset configuration for a library agent.");
|
||||
83
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/onboarding/onboarding.ts
generated
Normal file
83
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/onboarding/onboarding.ts
generated
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* @summary Get onboarding status
|
||||
*/
|
||||
export const getV1GetOnboardingStatusResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Update onboarding progress
|
||||
*/
|
||||
export const patchV1UpdateOnboardingProgressBody = zod.object({
|
||||
completedSteps: zod
|
||||
.array(
|
||||
zod.enum([
|
||||
"WELCOME",
|
||||
"USAGE_REASON",
|
||||
"INTEGRATIONS",
|
||||
"AGENT_CHOICE",
|
||||
"AGENT_NEW_RUN",
|
||||
"AGENT_INPUT",
|
||||
"CONGRATS",
|
||||
"GET_RESULTS",
|
||||
"RUN_AGENTS",
|
||||
"MARKETPLACE_VISIT",
|
||||
"MARKETPLACE_ADD_AGENT",
|
||||
"MARKETPLACE_RUN_AGENT",
|
||||
"BUILDER_OPEN",
|
||||
"BUILDER_SAVE_AGENT",
|
||||
"BUILDER_RUN_AGENT",
|
||||
]),
|
||||
)
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
notificationDot: zod.boolean().or(zod.null()).optional(),
|
||||
notified: zod
|
||||
.array(
|
||||
zod.enum([
|
||||
"WELCOME",
|
||||
"USAGE_REASON",
|
||||
"INTEGRATIONS",
|
||||
"AGENT_CHOICE",
|
||||
"AGENT_NEW_RUN",
|
||||
"AGENT_INPUT",
|
||||
"CONGRATS",
|
||||
"GET_RESULTS",
|
||||
"RUN_AGENTS",
|
||||
"MARKETPLACE_VISIT",
|
||||
"MARKETPLACE_ADD_AGENT",
|
||||
"MARKETPLACE_RUN_AGENT",
|
||||
"BUILDER_OPEN",
|
||||
"BUILDER_SAVE_AGENT",
|
||||
"BUILDER_RUN_AGENT",
|
||||
]),
|
||||
)
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
usageReason: zod.string().or(zod.null()).optional(),
|
||||
integrations: zod.array(zod.string()).or(zod.null()).optional(),
|
||||
otherIntegrations: zod.string().or(zod.null()).optional(),
|
||||
selectedStoreListingVersionId: zod.string().or(zod.null()).optional(),
|
||||
agentInput: zod.record(zod.string(), zod.any()).or(zod.null()).optional(),
|
||||
onboardingAgentExecutionId: zod.string().or(zod.null()).optional(),
|
||||
agentRuns: zod.number().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
export const patchV1UpdateOnboardingProgressResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Get recommended agents
|
||||
*/
|
||||
export const getV1GetRecommendedAgentsResponse = zod.any();
|
||||
|
||||
/**
|
||||
* @summary Check onboarding enabled
|
||||
*/
|
||||
export const getV1CheckOnboardingEnabledResponse = zod.any();
|
||||
39
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/otto/otto.ts
generated
Normal file
39
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/otto/otto.ts
generated
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* Proxy requests to Otto API while adding necessary security headers and logging.
|
||||
Requires an authenticated user.
|
||||
* @summary Proxy Otto Chat Request
|
||||
*/
|
||||
export const postV2ProxyOttoChatRequestBodyIncludeGraphDataDefault = false;
|
||||
|
||||
export const postV2ProxyOttoChatRequestBody = zod.object({
|
||||
query: zod.string(),
|
||||
conversation_history: zod.array(
|
||||
zod.object({
|
||||
query: zod.string(),
|
||||
response: zod.string(),
|
||||
}),
|
||||
),
|
||||
message_id: zod.string(),
|
||||
include_graph_data: zod.boolean().optional(),
|
||||
graph_id: zod.string().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
export const postV2ProxyOttoChatRequestResponse = zod.object({
|
||||
answer: zod.string(),
|
||||
documents: zod.array(
|
||||
zod.object({
|
||||
url: zod.string(),
|
||||
relevance_score: zod.number(),
|
||||
}),
|
||||
),
|
||||
success: zod.boolean(),
|
||||
});
|
||||
280
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/presets/presets.ts
generated
Normal file
280
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/presets/presets.ts
generated
Normal file
@@ -0,0 +1,280 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* Retrieve a paginated list of presets for the current user.
|
||||
* @summary List presets
|
||||
*/
|
||||
export const getV2ListPresetsQueryPageDefault = 1;
|
||||
export const getV2ListPresetsQueryPageSizeDefault = 10;
|
||||
|
||||
export const getV2ListPresetsQueryParams = zod.object({
|
||||
page: zod.number().min(1).default(getV2ListPresetsQueryPageDefault),
|
||||
page_size: zod.number().min(1).default(getV2ListPresetsQueryPageSizeDefault),
|
||||
graph_id: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.describe("Allows to filter presets by a specific agent graph"),
|
||||
});
|
||||
|
||||
export const getV2ListPresetsResponsePresetsItemIsActiveDefault = true;
|
||||
|
||||
export const getV2ListPresetsResponse = zod
|
||||
.object({
|
||||
presets: zod.array(
|
||||
zod
|
||||
.object({
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
inputs: zod.record(zod.string(), zod.any()),
|
||||
credentials: zod.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum([
|
||||
"api_key",
|
||||
"oauth2",
|
||||
"user_password",
|
||||
"host_scoped",
|
||||
]),
|
||||
}),
|
||||
),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
is_active: zod
|
||||
.boolean()
|
||||
.default(getV2ListPresetsResponsePresetsItemIsActiveDefault),
|
||||
webhook_id: zod.string().or(zod.null()).optional(),
|
||||
id: zod.string(),
|
||||
user_id: zod.string(),
|
||||
updated_at: zod.string().datetime({}),
|
||||
})
|
||||
.describe("Represents a preset configuration for a library agent."),
|
||||
),
|
||||
pagination: zod.object({
|
||||
total_items: zod.number().describe("Total number of items."),
|
||||
total_pages: zod.number().describe("Total number of pages."),
|
||||
current_page: zod.number().describe("Current_page page number."),
|
||||
page_size: zod.number().describe("Number of items per page."),
|
||||
}),
|
||||
})
|
||||
.describe("Response schema for a list of agent presets and pagination info.");
|
||||
|
||||
/**
|
||||
* Create a new preset for the current user.
|
||||
* @summary Create a new preset
|
||||
*/
|
||||
export const postV2CreateANewPresetBodyIsActiveDefault = true;
|
||||
export const postV2CreateANewPresetBodyIsActiveDefaultOne = true;
|
||||
|
||||
export const postV2CreateANewPresetBody = zod
|
||||
.object({
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
inputs: zod.record(zod.string(), zod.any()),
|
||||
credentials: zod.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
is_active: zod.boolean().default(postV2CreateANewPresetBodyIsActiveDefault),
|
||||
webhook_id: zod.string().or(zod.null()).optional(),
|
||||
})
|
||||
.describe(
|
||||
"Request model used when creating a new preset for a library agent.",
|
||||
)
|
||||
.or(
|
||||
zod
|
||||
.object({
|
||||
graph_execution_id: zod.string(),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
is_active: zod
|
||||
.boolean()
|
||||
.default(postV2CreateANewPresetBodyIsActiveDefaultOne),
|
||||
})
|
||||
.describe(
|
||||
"Request model used when creating a new preset for a library agent.",
|
||||
),
|
||||
);
|
||||
|
||||
export const postV2CreateANewPresetResponseIsActiveDefault = true;
|
||||
|
||||
export const postV2CreateANewPresetResponse = zod
|
||||
.object({
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
inputs: zod.record(zod.string(), zod.any()),
|
||||
credentials: zod.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
is_active: zod
|
||||
.boolean()
|
||||
.default(postV2CreateANewPresetResponseIsActiveDefault),
|
||||
webhook_id: zod.string().or(zod.null()).optional(),
|
||||
id: zod.string(),
|
||||
user_id: zod.string(),
|
||||
updated_at: zod.string().datetime({}),
|
||||
})
|
||||
.describe("Represents a preset configuration for a library agent.");
|
||||
|
||||
/**
|
||||
* Retrieve details for a specific preset by its ID.
|
||||
* @summary Get a specific preset
|
||||
*/
|
||||
export const getV2GetASpecificPresetParams = zod.object({
|
||||
preset_id: zod.string(),
|
||||
});
|
||||
|
||||
export const getV2GetASpecificPresetResponseIsActiveDefault = true;
|
||||
|
||||
export const getV2GetASpecificPresetResponse = zod
|
||||
.object({
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
inputs: zod.record(zod.string(), zod.any()),
|
||||
credentials: zod.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
is_active: zod
|
||||
.boolean()
|
||||
.default(getV2GetASpecificPresetResponseIsActiveDefault),
|
||||
webhook_id: zod.string().or(zod.null()).optional(),
|
||||
id: zod.string(),
|
||||
user_id: zod.string(),
|
||||
updated_at: zod.string().datetime({}),
|
||||
})
|
||||
.describe("Represents a preset configuration for a library agent.");
|
||||
|
||||
/**
|
||||
* Update an existing preset by its ID.
|
||||
* @summary Update an existing preset
|
||||
*/
|
||||
export const patchV2UpdateAnExistingPresetParams = zod.object({
|
||||
preset_id: zod.string(),
|
||||
});
|
||||
|
||||
export const patchV2UpdateAnExistingPresetBody = zod
|
||||
.object({
|
||||
inputs: zod.record(zod.string(), zod.any()).or(zod.null()).optional(),
|
||||
credentials: zod
|
||||
.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
)
|
||||
.or(zod.null())
|
||||
.optional(),
|
||||
name: zod.string().or(zod.null()).optional(),
|
||||
description: zod.string().or(zod.null()).optional(),
|
||||
is_active: zod.boolean().or(zod.null()).optional(),
|
||||
})
|
||||
.describe("Request model used when updating a preset for a library agent.");
|
||||
|
||||
export const patchV2UpdateAnExistingPresetResponseIsActiveDefault = true;
|
||||
|
||||
export const patchV2UpdateAnExistingPresetResponse = zod
|
||||
.object({
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
inputs: zod.record(zod.string(), zod.any()),
|
||||
credentials: zod.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
),
|
||||
name: zod.string(),
|
||||
description: zod.string(),
|
||||
is_active: zod
|
||||
.boolean()
|
||||
.default(patchV2UpdateAnExistingPresetResponseIsActiveDefault),
|
||||
webhook_id: zod.string().or(zod.null()).optional(),
|
||||
id: zod.string(),
|
||||
user_id: zod.string(),
|
||||
updated_at: zod.string().datetime({}),
|
||||
})
|
||||
.describe("Represents a preset configuration for a library agent.");
|
||||
|
||||
/**
|
||||
* Delete an existing preset by its ID.
|
||||
* @summary Delete a preset
|
||||
*/
|
||||
export const deleteV2DeleteAPresetParams = zod.object({
|
||||
preset_id: zod.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Execute a preset with the given graph and node input for the current user.
|
||||
* @summary Execute a preset
|
||||
*/
|
||||
export const postV2ExecuteAPresetParams = zod.object({
|
||||
preset_id: zod.string(),
|
||||
});
|
||||
|
||||
export const postV2ExecuteAPresetBody = zod.object({
|
||||
inputs: zod.record(zod.string(), zod.any()).optional(),
|
||||
});
|
||||
|
||||
export const postV2ExecuteAPresetResponse = zod.record(zod.string(), zod.any());
|
||||
143
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/schedules/schedules.ts
generated
Normal file
143
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/schedules/schedules.ts
generated
Normal file
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* @summary Create execution schedule
|
||||
*/
|
||||
export const postV1CreateExecutionScheduleParams = zod.object({
|
||||
graph_id: zod.string().describe("ID of the graph to schedule"),
|
||||
});
|
||||
|
||||
export const postV1CreateExecutionScheduleBody = zod.object({
|
||||
graph_version: zod.number().or(zod.null()).optional(),
|
||||
name: zod.string(),
|
||||
cron: zod.string(),
|
||||
inputs: zod.record(zod.string(), zod.any()),
|
||||
credentials: zod
|
||||
.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const postV1CreateExecutionScheduleResponse = zod.object({
|
||||
user_id: zod.string(),
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
cron: zod.string(),
|
||||
input_data: zod.record(zod.string(), zod.any()),
|
||||
input_credentials: zod
|
||||
.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
)
|
||||
.optional(),
|
||||
id: zod.string(),
|
||||
name: zod.string(),
|
||||
next_run_time: zod.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary List execution schedules for a graph
|
||||
*/
|
||||
export const getV1ListExecutionSchedulesForAGraphParams = zod.object({
|
||||
graph_id: zod.string(),
|
||||
});
|
||||
|
||||
export const getV1ListExecutionSchedulesForAGraphResponseItem = zod.object({
|
||||
user_id: zod.string(),
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
cron: zod.string(),
|
||||
input_data: zod.record(zod.string(), zod.any()),
|
||||
input_credentials: zod
|
||||
.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
)
|
||||
.optional(),
|
||||
id: zod.string(),
|
||||
name: zod.string(),
|
||||
next_run_time: zod.string(),
|
||||
});
|
||||
export const getV1ListExecutionSchedulesForAGraphResponse = zod.array(
|
||||
getV1ListExecutionSchedulesForAGraphResponseItem,
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary List execution schedules for a user
|
||||
*/
|
||||
export const getV1ListExecutionSchedulesForAUserResponseItem = zod.object({
|
||||
user_id: zod.string(),
|
||||
graph_id: zod.string(),
|
||||
graph_version: zod.number(),
|
||||
cron: zod.string(),
|
||||
input_data: zod.record(zod.string(), zod.any()),
|
||||
input_credentials: zod
|
||||
.record(
|
||||
zod.string(),
|
||||
zod.object({
|
||||
id: zod.string(),
|
||||
title: zod.string().or(zod.null()).optional(),
|
||||
provider: zod
|
||||
.string()
|
||||
.describe(
|
||||
"Provider name for integrations. Can be any string value, including custom provider names.",
|
||||
),
|
||||
type: zod.enum(["api_key", "oauth2", "user_password", "host_scoped"]),
|
||||
}),
|
||||
)
|
||||
.optional(),
|
||||
id: zod.string(),
|
||||
name: zod.string(),
|
||||
next_run_time: zod.string(),
|
||||
});
|
||||
export const getV1ListExecutionSchedulesForAUserResponse = zod.array(
|
||||
getV1ListExecutionSchedulesForAUserResponseItem,
|
||||
);
|
||||
|
||||
/**
|
||||
* @summary Delete execution schedule
|
||||
*/
|
||||
export const deleteV1DeleteExecutionScheduleParams = zod.object({
|
||||
schedule_id: zod.string().describe("ID of the schedule to delete"),
|
||||
});
|
||||
|
||||
export const deleteV1DeleteExecutionScheduleResponse = zod.record(
|
||||
zod.string(),
|
||||
zod.any(),
|
||||
);
|
||||
492
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/store/store.ts
generated
Normal file
492
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/store/store.ts
generated
Normal file
@@ -0,0 +1,492 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* Get the profile details for the authenticated user.
|
||||
* @summary Get user profile
|
||||
*/
|
||||
export const getV2GetUserProfileResponse = zod.object({
|
||||
name: zod.string(),
|
||||
username: zod.string(),
|
||||
description: zod.string(),
|
||||
links: zod.array(zod.string()),
|
||||
avatar_url: zod.string().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Update the store profile for the authenticated user.
|
||||
|
||||
Args:
|
||||
profile (Profile): The updated profile details
|
||||
user_id (str): ID of the authenticated user
|
||||
|
||||
Returns:
|
||||
CreatorDetails: The updated profile
|
||||
|
||||
Raises:
|
||||
HTTPException: If there is an error updating the profile
|
||||
* @summary Update user profile
|
||||
*/
|
||||
export const postV2UpdateUserProfileBodyIsFeaturedDefault = false;
|
||||
|
||||
export const postV2UpdateUserProfileBody = zod.object({
|
||||
name: zod.string(),
|
||||
username: zod.string(),
|
||||
description: zod.string(),
|
||||
links: zod.array(zod.string()),
|
||||
avatar_url: zod.string(),
|
||||
is_featured: zod.boolean().optional(),
|
||||
});
|
||||
|
||||
export const postV2UpdateUserProfileResponse = zod.object({
|
||||
name: zod.string(),
|
||||
username: zod.string(),
|
||||
description: zod.string(),
|
||||
links: zod.array(zod.string()),
|
||||
avatar_url: zod.string(),
|
||||
agent_rating: zod.number(),
|
||||
agent_runs: zod.number(),
|
||||
top_categories: zod.array(zod.string()),
|
||||
});
|
||||
|
||||
/**
|
||||
* Get a paginated list of agents from the store with optional filtering and sorting.
|
||||
|
||||
Args:
|
||||
featured (bool, optional): Filter to only show featured agents. Defaults to False.
|
||||
creator (str | None, optional): Filter agents by creator username. Defaults to None.
|
||||
sorted_by (str | None, optional): Sort agents by "runs" or "rating". Defaults to None.
|
||||
search_query (str | None, optional): Search agents by name, subheading and description. Defaults to None.
|
||||
category (str | None, optional): Filter agents by category. Defaults to None.
|
||||
page (int, optional): Page number for pagination. Defaults to 1.
|
||||
page_size (int, optional): Number of agents per page. Defaults to 20.
|
||||
|
||||
Returns:
|
||||
StoreAgentsResponse: Paginated list of agents matching the filters
|
||||
|
||||
Raises:
|
||||
HTTPException: If page or page_size are less than 1
|
||||
|
||||
Used for:
|
||||
- Home Page Featured Agents
|
||||
- Home Page Top Agents
|
||||
- Search Results
|
||||
- Agent Details - Other Agents By Creator
|
||||
- Agent Details - Similar Agents
|
||||
- Creator Details - Agents By Creator
|
||||
* @summary List store agents
|
||||
*/
|
||||
export const getV2ListStoreAgentsQueryFeaturedDefault = false;
|
||||
export const getV2ListStoreAgentsQueryPageDefault = 1;
|
||||
export const getV2ListStoreAgentsQueryPageSizeDefault = 20;
|
||||
|
||||
export const getV2ListStoreAgentsQueryParams = zod.object({
|
||||
featured: zod.boolean().optional(),
|
||||
creator: zod.string().or(zod.null()).optional(),
|
||||
sorted_by: zod.string().or(zod.null()).optional(),
|
||||
search_query: zod.string().or(zod.null()).optional(),
|
||||
category: zod.string().or(zod.null()).optional(),
|
||||
page: zod.number().default(getV2ListStoreAgentsQueryPageDefault),
|
||||
page_size: zod.number().default(getV2ListStoreAgentsQueryPageSizeDefault),
|
||||
});
|
||||
|
||||
export const getV2ListStoreAgentsResponse = zod.object({
|
||||
agents: zod.array(
|
||||
zod.object({
|
||||
slug: zod.string(),
|
||||
agent_name: zod.string(),
|
||||
agent_image: zod.string(),
|
||||
creator: zod.string(),
|
||||
creator_avatar: zod.string(),
|
||||
sub_heading: zod.string(),
|
||||
description: zod.string(),
|
||||
runs: zod.number(),
|
||||
rating: zod.number(),
|
||||
}),
|
||||
),
|
||||
pagination: zod.object({
|
||||
total_items: zod.number().describe("Total number of items."),
|
||||
total_pages: zod.number().describe("Total number of pages."),
|
||||
current_page: zod.number().describe("Current_page page number."),
|
||||
page_size: zod.number().describe("Number of items per page."),
|
||||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* This is only used on the AgentDetails Page
|
||||
|
||||
It returns the store listing agents details.
|
||||
* @summary Get specific agent
|
||||
*/
|
||||
export const getV2GetSpecificAgentParams = zod.object({
|
||||
username: zod.string(),
|
||||
agent_name: zod.string(),
|
||||
});
|
||||
|
||||
export const getV2GetSpecificAgentResponseHasApprovedVersionDefault = false;
|
||||
|
||||
export const getV2GetSpecificAgentResponse = zod.object({
|
||||
store_listing_version_id: zod.string(),
|
||||
slug: zod.string(),
|
||||
agent_name: zod.string(),
|
||||
agent_video: zod.string(),
|
||||
agent_image: zod.array(zod.string()),
|
||||
creator: zod.string(),
|
||||
creator_avatar: zod.string(),
|
||||
sub_heading: zod.string(),
|
||||
description: zod.string(),
|
||||
categories: zod.array(zod.string()),
|
||||
runs: zod.number(),
|
||||
rating: zod.number(),
|
||||
versions: zod.array(zod.string()),
|
||||
last_updated: zod.string().datetime({}),
|
||||
active_version_id: zod.string().or(zod.null()).optional(),
|
||||
has_approved_version: zod.boolean().optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Get Agent Graph from Store Listing Version ID.
|
||||
* @summary Get agent graph
|
||||
*/
|
||||
export const getV2GetAgentGraphParams = zod.object({
|
||||
store_listing_version_id: zod.string(),
|
||||
});
|
||||
|
||||
export const getV2GetAgentGraphResponse = zod.any();
|
||||
|
||||
/**
|
||||
* Get Store Agent Details from Store Listing Version ID.
|
||||
* @summary Get agent by version
|
||||
*/
|
||||
export const getV2GetAgentByVersionParams = zod.object({
|
||||
store_listing_version_id: zod.string(),
|
||||
});
|
||||
|
||||
export const getV2GetAgentByVersionResponseHasApprovedVersionDefault = false;
|
||||
|
||||
export const getV2GetAgentByVersionResponse = zod.object({
|
||||
store_listing_version_id: zod.string(),
|
||||
slug: zod.string(),
|
||||
agent_name: zod.string(),
|
||||
agent_video: zod.string(),
|
||||
agent_image: zod.array(zod.string()),
|
||||
creator: zod.string(),
|
||||
creator_avatar: zod.string(),
|
||||
sub_heading: zod.string(),
|
||||
description: zod.string(),
|
||||
categories: zod.array(zod.string()),
|
||||
runs: zod.number(),
|
||||
rating: zod.number(),
|
||||
versions: zod.array(zod.string()),
|
||||
last_updated: zod.string().datetime({}),
|
||||
active_version_id: zod.string().or(zod.null()).optional(),
|
||||
has_approved_version: zod.boolean().optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Create a review for a store agent.
|
||||
|
||||
Args:
|
||||
username: Creator's username
|
||||
agent_name: Name/slug of the agent
|
||||
review: Review details including score and optional comments
|
||||
user_id: ID of authenticated user creating the review
|
||||
|
||||
Returns:
|
||||
The created review
|
||||
* @summary Create agent review
|
||||
*/
|
||||
export const postV2CreateAgentReviewParams = zod.object({
|
||||
username: zod.string(),
|
||||
agent_name: zod.string(),
|
||||
});
|
||||
|
||||
export const postV2CreateAgentReviewBody = zod.object({
|
||||
store_listing_version_id: zod.string(),
|
||||
score: zod.number(),
|
||||
comments: zod.string().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
export const postV2CreateAgentReviewResponse = zod.object({
|
||||
score: zod.number(),
|
||||
comments: zod.string().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* This is needed for:
|
||||
- Home Page Featured Creators
|
||||
- Search Results Page
|
||||
|
||||
---
|
||||
|
||||
To support this functionality we need:
|
||||
- featured: bool - to limit the list to just featured agents
|
||||
- search_query: str - vector search based on the creators profile description.
|
||||
- sorted_by: [agent_rating, agent_runs] -
|
||||
* @summary List store creators
|
||||
*/
|
||||
export const getV2ListStoreCreatorsQueryFeaturedDefault = false;
|
||||
export const getV2ListStoreCreatorsQueryPageDefault = 1;
|
||||
export const getV2ListStoreCreatorsQueryPageSizeDefault = 20;
|
||||
|
||||
export const getV2ListStoreCreatorsQueryParams = zod.object({
|
||||
featured: zod.boolean().optional(),
|
||||
search_query: zod.string().or(zod.null()).optional(),
|
||||
sorted_by: zod.string().or(zod.null()).optional(),
|
||||
page: zod.number().default(getV2ListStoreCreatorsQueryPageDefault),
|
||||
page_size: zod.number().default(getV2ListStoreCreatorsQueryPageSizeDefault),
|
||||
});
|
||||
|
||||
export const getV2ListStoreCreatorsResponse = zod.object({
|
||||
creators: zod.array(
|
||||
zod.object({
|
||||
name: zod.string(),
|
||||
username: zod.string(),
|
||||
description: zod.string(),
|
||||
avatar_url: zod.string(),
|
||||
num_agents: zod.number(),
|
||||
agent_rating: zod.number(),
|
||||
agent_runs: zod.number(),
|
||||
is_featured: zod.boolean(),
|
||||
}),
|
||||
),
|
||||
pagination: zod.object({
|
||||
total_items: zod.number().describe("Total number of items."),
|
||||
total_pages: zod.number().describe("Total number of pages."),
|
||||
current_page: zod.number().describe("Current_page page number."),
|
||||
page_size: zod.number().describe("Number of items per page."),
|
||||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the details of a creator
|
||||
- Creator Details Page
|
||||
* @summary Get creator details
|
||||
*/
|
||||
export const getV2GetCreatorDetailsParams = zod.object({
|
||||
username: zod.string(),
|
||||
});
|
||||
|
||||
export const getV2GetCreatorDetailsResponse = zod.object({
|
||||
name: zod.string(),
|
||||
username: zod.string(),
|
||||
description: zod.string(),
|
||||
links: zod.array(zod.string()),
|
||||
avatar_url: zod.string(),
|
||||
agent_rating: zod.number(),
|
||||
agent_runs: zod.number(),
|
||||
top_categories: zod.array(zod.string()),
|
||||
});
|
||||
|
||||
/**
|
||||
* @summary Get my agents
|
||||
*/
|
||||
export const getV2GetMyAgentsResponse = zod.object({
|
||||
agents: zod.array(
|
||||
zod.object({
|
||||
agent_id: zod.string(),
|
||||
agent_version: zod.number(),
|
||||
agent_name: zod.string(),
|
||||
agent_image: zod.string().or(zod.null()).optional(),
|
||||
description: zod.string(),
|
||||
last_edited: zod.string().datetime({}),
|
||||
}),
|
||||
),
|
||||
pagination: zod.object({
|
||||
total_items: zod.number().describe("Total number of items."),
|
||||
total_pages: zod.number().describe("Total number of pages."),
|
||||
current_page: zod.number().describe("Current_page page number."),
|
||||
page_size: zod.number().describe("Number of items per page."),
|
||||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete a store listing submission.
|
||||
|
||||
Args:
|
||||
user_id (str): ID of the authenticated user
|
||||
submission_id (str): ID of the submission to be deleted
|
||||
|
||||
Returns:
|
||||
bool: True if the submission was successfully deleted, False otherwise
|
||||
* @summary Delete store submission
|
||||
*/
|
||||
export const deleteV2DeleteStoreSubmissionParams = zod.object({
|
||||
submission_id: zod.string(),
|
||||
});
|
||||
|
||||
export const deleteV2DeleteStoreSubmissionResponse = zod.boolean();
|
||||
|
||||
/**
|
||||
* Get a paginated list of store submissions for the authenticated user.
|
||||
|
||||
Args:
|
||||
user_id (str): ID of the authenticated user
|
||||
page (int, optional): Page number for pagination. Defaults to 1.
|
||||
page_size (int, optional): Number of submissions per page. Defaults to 20.
|
||||
|
||||
Returns:
|
||||
StoreListingsResponse: Paginated list of store submissions
|
||||
|
||||
Raises:
|
||||
HTTPException: If page or page_size are less than 1
|
||||
* @summary List my submissions
|
||||
*/
|
||||
export const getV2ListMySubmissionsQueryPageDefault = 1;
|
||||
export const getV2ListMySubmissionsQueryPageSizeDefault = 20;
|
||||
|
||||
export const getV2ListMySubmissionsQueryParams = zod.object({
|
||||
page: zod.number().default(getV2ListMySubmissionsQueryPageDefault),
|
||||
page_size: zod.number().default(getV2ListMySubmissionsQueryPageSizeDefault),
|
||||
});
|
||||
|
||||
export const getV2ListMySubmissionsResponse = zod.object({
|
||||
submissions: zod.array(
|
||||
zod.object({
|
||||
agent_id: zod.string(),
|
||||
agent_version: zod.number(),
|
||||
name: zod.string(),
|
||||
sub_heading: zod.string(),
|
||||
slug: zod.string(),
|
||||
description: zod.string(),
|
||||
image_urls: zod.array(zod.string()),
|
||||
date_submitted: zod.string().datetime({}),
|
||||
status: zod.enum(["DRAFT", "PENDING", "APPROVED", "REJECTED"]),
|
||||
runs: zod.number(),
|
||||
rating: zod.number(),
|
||||
store_listing_version_id: zod.string().or(zod.null()).optional(),
|
||||
version: zod.number().or(zod.null()).optional(),
|
||||
reviewer_id: zod.string().or(zod.null()).optional(),
|
||||
review_comments: zod.string().or(zod.null()).optional(),
|
||||
internal_comments: zod.string().or(zod.null()).optional(),
|
||||
reviewed_at: zod.string().datetime({}).or(zod.null()).optional(),
|
||||
changes_summary: zod.string().or(zod.null()).optional(),
|
||||
}),
|
||||
),
|
||||
pagination: zod.object({
|
||||
total_items: zod.number().describe("Total number of items."),
|
||||
total_pages: zod.number().describe("Total number of pages."),
|
||||
current_page: zod.number().describe("Current_page page number."),
|
||||
page_size: zod.number().describe("Number of items per page."),
|
||||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* Create a new store listing submission.
|
||||
|
||||
Args:
|
||||
submission_request (StoreSubmissionRequest): The submission details
|
||||
user_id (str): ID of the authenticated user submitting the listing
|
||||
|
||||
Returns:
|
||||
StoreSubmission: The created store submission
|
||||
|
||||
Raises:
|
||||
HTTPException: If there is an error creating the submission
|
||||
* @summary Create store submission
|
||||
*/
|
||||
export const postV2CreateStoreSubmissionBodyImageUrlsDefault = [];
|
||||
export const postV2CreateStoreSubmissionBodyDescriptionDefault = "";
|
||||
export const postV2CreateStoreSubmissionBodyCategoriesDefault = [];
|
||||
|
||||
export const postV2CreateStoreSubmissionBody = zod.object({
|
||||
agent_id: zod.string(),
|
||||
agent_version: zod.number(),
|
||||
slug: zod.string(),
|
||||
name: zod.string(),
|
||||
sub_heading: zod.string(),
|
||||
video_url: zod.string().or(zod.null()).optional(),
|
||||
image_urls: zod
|
||||
.array(zod.string())
|
||||
.default(postV2CreateStoreSubmissionBodyImageUrlsDefault),
|
||||
description: zod.string().optional(),
|
||||
categories: zod
|
||||
.array(zod.string())
|
||||
.default(postV2CreateStoreSubmissionBodyCategoriesDefault),
|
||||
changes_summary: zod.string().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
export const postV2CreateStoreSubmissionResponse = zod.object({
|
||||
agent_id: zod.string(),
|
||||
agent_version: zod.number(),
|
||||
name: zod.string(),
|
||||
sub_heading: zod.string(),
|
||||
slug: zod.string(),
|
||||
description: zod.string(),
|
||||
image_urls: zod.array(zod.string()),
|
||||
date_submitted: zod.string().datetime({}),
|
||||
status: zod.enum(["DRAFT", "PENDING", "APPROVED", "REJECTED"]),
|
||||
runs: zod.number(),
|
||||
rating: zod.number(),
|
||||
store_listing_version_id: zod.string().or(zod.null()).optional(),
|
||||
version: zod.number().or(zod.null()).optional(),
|
||||
reviewer_id: zod.string().or(zod.null()).optional(),
|
||||
review_comments: zod.string().or(zod.null()).optional(),
|
||||
internal_comments: zod.string().or(zod.null()).optional(),
|
||||
reviewed_at: zod.string().datetime({}).or(zod.null()).optional(),
|
||||
changes_summary: zod.string().or(zod.null()).optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Upload media (images/videos) for a store listing submission.
|
||||
|
||||
Args:
|
||||
file (UploadFile): The media file to upload
|
||||
user_id (str): ID of the authenticated user uploading the media
|
||||
|
||||
Returns:
|
||||
str: URL of the uploaded media file
|
||||
|
||||
Raises:
|
||||
HTTPException: If there is an error uploading the media
|
||||
* @summary Upload submission media
|
||||
*/
|
||||
export const postV2UploadSubmissionMediaBody = zod.object({
|
||||
file: zod.instanceof(File),
|
||||
});
|
||||
|
||||
export const postV2UploadSubmissionMediaResponse = zod.any();
|
||||
|
||||
/**
|
||||
* Generate an image for a store listing submission.
|
||||
|
||||
Args:
|
||||
agent_id (str): ID of the agent to generate an image for
|
||||
user_id (str): ID of the authenticated user
|
||||
|
||||
Returns:
|
||||
JSONResponse: JSON containing the URL of the generated image
|
||||
* @summary Generate submission image
|
||||
*/
|
||||
export const postV2GenerateSubmissionImageQueryParams = zod.object({
|
||||
agent_id: zod.string(),
|
||||
});
|
||||
|
||||
export const postV2GenerateSubmissionImageResponse = zod.any();
|
||||
|
||||
/**
|
||||
* Download the agent file by streaming its content.
|
||||
|
||||
Args:
|
||||
store_listing_version_id (str): The ID of the agent to download
|
||||
|
||||
Returns:
|
||||
StreamingResponse: A streaming response containing the agent's graph data.
|
||||
|
||||
Raises:
|
||||
HTTPException: If the agent is not found or an unexpected error occurs.
|
||||
* @summary Download agent file
|
||||
*/
|
||||
export const getV2DownloadAgentFileParams = zod.object({
|
||||
store_listing_version_id: zod
|
||||
.string()
|
||||
.describe("The ID of the agent to download"),
|
||||
});
|
||||
|
||||
export const getV2DownloadAgentFileResponse = zod.any();
|
||||
53
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/turnstile/turnstile.ts
generated
Normal file
53
autogpt_platform/frontend/src/app/api/__generated__/zod-schema/turnstile/turnstile.ts
generated
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* AutoGPT Agent Server
|
||||
* This server is used to execute agents that are created by the AutoGPT system.
|
||||
* OpenAPI spec version: 0.1
|
||||
*/
|
||||
import { z as zod } from "zod";
|
||||
|
||||
/**
|
||||
* Verify a Cloudflare Turnstile token.
|
||||
This endpoint verifies a token returned by the Cloudflare Turnstile challenge
|
||||
on the client side. It returns whether the verification was successful.
|
||||
* @summary Verify Turnstile Token
|
||||
*/
|
||||
export const postV2VerifyTurnstileTokenBody = zod
|
||||
.object({
|
||||
token: zod.string().describe("The Turnstile token to verify"),
|
||||
action: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("The action that the user is attempting to perform"),
|
||||
})
|
||||
.describe("Request model for verifying a Turnstile token.");
|
||||
|
||||
export const postV2VerifyTurnstileTokenResponse = zod
|
||||
.object({
|
||||
success: zod
|
||||
.boolean()
|
||||
.describe("Whether the token verification was successful"),
|
||||
error: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("Error message if verification failed"),
|
||||
challenge_timestamp: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("Timestamp of the challenge (ISO format)"),
|
||||
hostname: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("Hostname of the site where the challenge was solved"),
|
||||
action: zod
|
||||
.string()
|
||||
.or(zod.null())
|
||||
.optional()
|
||||
.describe("The action associated with this verification"),
|
||||
})
|
||||
.describe("Response model for the Turnstile verification endpoint.");
|
||||
@@ -18,8 +18,9 @@
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProviderName",
|
||||
"title": "The provider to initiate an OAuth flow for"
|
||||
"type": "string",
|
||||
"title": "The provider to initiate an OAuth flow for",
|
||||
"description": "Provider name for integrations. Can be any string value, including custom provider names."
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -64,8 +65,9 @@
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProviderName",
|
||||
"title": "The target provider for this OAuth exchange"
|
||||
"type": "string",
|
||||
"title": "The target provider for this OAuth exchange",
|
||||
"description": "Provider name for integrations. Can be any string value, including custom provider names."
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -133,8 +135,9 @@
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProviderName",
|
||||
"title": "The provider to list credentials for"
|
||||
"type": "string",
|
||||
"title": "The provider to list credentials for",
|
||||
"description": "Provider name for integrations. Can be any string value, including custom provider names."
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -173,8 +176,9 @@
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProviderName",
|
||||
"title": "The provider to create credentials for"
|
||||
"type": "string",
|
||||
"title": "The provider to create credentials for",
|
||||
"description": "Provider name for integrations. Can be any string value, including custom provider names."
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -253,8 +257,9 @@
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProviderName",
|
||||
"title": "The provider to retrieve credentials for"
|
||||
"type": "string",
|
||||
"title": "The provider to retrieve credentials for",
|
||||
"description": "Provider name for integrations. Can be any string value, including custom provider names."
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -315,8 +320,9 @@
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProviderName",
|
||||
"title": "The provider to delete credentials for"
|
||||
"type": "string",
|
||||
"title": "The provider to delete credentials for",
|
||||
"description": "Provider name for integrations. Can be any string value, including custom provider names."
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -380,8 +386,9 @@
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProviderName",
|
||||
"title": "Provider where the webhook was registered"
|
||||
"type": "string",
|
||||
"title": "Provider where the webhook was registered",
|
||||
"description": "Provider name for integrations. Can be any string value, including custom provider names."
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -436,6 +443,86 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/integrations/providers": {
|
||||
"get": {
|
||||
"tags": ["v1", "integrations"],
|
||||
"summary": "List Providers",
|
||||
"description": "Get a list of all available provider names.\n\nReturns both statically defined providers (from ProviderName enum)\nand dynamically registered providers (from SDK decorators).\n\nNote: The complete list of provider names is also available as a constant\nin the generated TypeScript client via PROVIDER_NAMES.",
|
||||
"operationId": "getV1ListProviders",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": { "type": "string" },
|
||||
"type": "array",
|
||||
"title": "Response Getv1Listproviders"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/integrations/providers/names": {
|
||||
"get": {
|
||||
"tags": ["v1", "integrations"],
|
||||
"summary": "Get Provider Names",
|
||||
"description": "Get all provider names in a structured format.\n\nThis endpoint is specifically designed to expose the provider names\nin the OpenAPI schema so that code generators like Orval can create\nappropriate TypeScript constants.",
|
||||
"operationId": "getV1GetProviderNames",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProviderNamesResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/integrations/providers/constants": {
|
||||
"get": {
|
||||
"tags": ["v1", "integrations"],
|
||||
"summary": "Get Provider Constants",
|
||||
"description": "Get provider names as constants.\n\nThis endpoint returns a model with provider names as constants,\nspecifically designed for OpenAPI code generation tools to create\nTypeScript constants.",
|
||||
"operationId": "getV1GetProviderConstants",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ProviderConstants" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/integrations/providers/enum-example": {
|
||||
"get": {
|
||||
"tags": ["v1", "integrations"],
|
||||
"summary": "Get Provider Enum Example",
|
||||
"description": "Example endpoint that uses the CompleteProviderNames enum.\n\nThis endpoint exists to ensure that the CompleteProviderNames enum is included\nin the OpenAPI schema, which will cause Orval to generate it as a\nTypeScript enum/constant.",
|
||||
"operationId": "getV1GetProviderEnumExample",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProviderEnumResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/analytics/log_raw_metric": {
|
||||
"post": {
|
||||
"tags": ["v1", "analytics"],
|
||||
@@ -4052,7 +4139,11 @@
|
||||
"anyOf": [{ "type": "string" }, { "type": "null" }],
|
||||
"title": "Title"
|
||||
},
|
||||
"provider": { "$ref": "#/components/schemas/ProviderName" },
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"title": "Provider",
|
||||
"description": "Provider name for integrations. Can be any string value, including custom provider names."
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": ["api_key", "oauth2", "user_password", "host_scoped"],
|
||||
@@ -4062,8 +4153,8 @@
|
||||
"type": "object",
|
||||
"required": ["id", "provider", "type"],
|
||||
"title": "CredentialsMetaInput",
|
||||
"credentials_provider": [],
|
||||
"credentials_types": []
|
||||
"credentials_provider": ["string"],
|
||||
"credentials_types": ["api_key", "oauth2", "user_password"]
|
||||
},
|
||||
"CredentialsMetaResponse": {
|
||||
"properties": {
|
||||
@@ -4769,7 +4860,11 @@
|
||||
},
|
||||
"LibraryAgentTriggerInfo": {
|
||||
"properties": {
|
||||
"provider": { "$ref": "#/components/schemas/ProviderName" },
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"title": "Provider",
|
||||
"description": "Provider name for integrations. Can be any string value, including custom provider names."
|
||||
},
|
||||
"config_schema": {
|
||||
"additionalProperties": true,
|
||||
"type": "object",
|
||||
@@ -5572,51 +5667,44 @@
|
||||
"required": ["name", "username", "description", "links"],
|
||||
"title": "ProfileDetails"
|
||||
},
|
||||
"ProviderName": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"aiml_api",
|
||||
"anthropic",
|
||||
"apollo",
|
||||
"compass",
|
||||
"discord",
|
||||
"d_id",
|
||||
"e2b",
|
||||
"exa",
|
||||
"fal",
|
||||
"generic_webhook",
|
||||
"github",
|
||||
"google",
|
||||
"google_maps",
|
||||
"groq",
|
||||
"http",
|
||||
"hubspot",
|
||||
"ideogram",
|
||||
"jina",
|
||||
"linear",
|
||||
"llama_api",
|
||||
"medium",
|
||||
"mem0",
|
||||
"notion",
|
||||
"nvidia",
|
||||
"ollama",
|
||||
"openai",
|
||||
"openweathermap",
|
||||
"open_router",
|
||||
"pinecone",
|
||||
"reddit",
|
||||
"replicate",
|
||||
"revid",
|
||||
"screenshotone",
|
||||
"slant3d",
|
||||
"smartlead",
|
||||
"smtp",
|
||||
"twitter",
|
||||
"todoist",
|
||||
"unreal_speech",
|
||||
"zerobounce"
|
||||
],
|
||||
"title": "ProviderName"
|
||||
"ProviderConstants": {
|
||||
"properties": {
|
||||
"PROVIDER_NAMES": {
|
||||
"additionalProperties": { "type": "string" },
|
||||
"type": "object",
|
||||
"title": "Provider Names",
|
||||
"description": "All available provider names as a constant mapping"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "ProviderConstants",
|
||||
"description": "Model that exposes all provider names as a constant in the OpenAPI schema.\nThis is designed to be converted by Orval into a TypeScript constant."
|
||||
},
|
||||
"ProviderEnumResponse": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"title": "Provider",
|
||||
"description": "A provider name from the complete list of providers"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": ["provider"],
|
||||
"title": "ProviderEnumResponse",
|
||||
"description": "Response containing a provider from the enum."
|
||||
},
|
||||
"ProviderNamesResponse": {
|
||||
"properties": {
|
||||
"providers": {
|
||||
"items": { "type": "string" },
|
||||
"type": "array",
|
||||
"title": "Providers",
|
||||
"description": "List of all available provider names"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "ProviderNamesResponse",
|
||||
"description": "Response containing list of all provider names."
|
||||
},
|
||||
"RefundRequest": {
|
||||
"properties": {
|
||||
@@ -6390,7 +6478,11 @@
|
||||
"properties": {
|
||||
"id": { "type": "string", "title": "Id" },
|
||||
"user_id": { "type": "string", "title": "User Id" },
|
||||
"provider": { "$ref": "#/components/schemas/ProviderName" },
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"title": "Provider",
|
||||
"description": "Provider name for integrations. Can be any string value, including custom provider names."
|
||||
},
|
||||
"credentials_id": { "type": "string", "title": "Credentials Id" },
|
||||
"webhook_type": { "type": "string", "title": "Webhook Type" },
|
||||
"resource": { "type": "string", "title": "Resource" },
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
import {
|
||||
BlockIOCredentialsSubSchema,
|
||||
CredentialsMetaInput,
|
||||
CredentialsProviderName,
|
||||
} from "@/lib/autogpt-server-api/types";
|
||||
import { IconKey, IconKeyPlus, IconUserPlus } from "@/components/ui/icons";
|
||||
import {
|
||||
@@ -37,10 +36,11 @@ import { getHostFromUrl } from "@/lib/utils/url";
|
||||
const fallbackIcon = FaKey;
|
||||
|
||||
// --8<-- [start:ProviderIconsEmbed]
|
||||
export const providerIcons: Record<
|
||||
CredentialsProviderName,
|
||||
// Provider icons mapping - uses fallback for unknown providers
|
||||
export const providerIcons: Partial<Record<
|
||||
string,
|
||||
React.FC<{ className?: string }>
|
||||
> = {
|
||||
>> = {
|
||||
aiml_api: fallbackIcon,
|
||||
anthropic: fallbackIcon,
|
||||
apollo: fallbackIcon,
|
||||
|
||||
@@ -7,58 +7,37 @@ import {
|
||||
CredentialsMetaResponse,
|
||||
CredentialsProviderName,
|
||||
HostScopedCredentials,
|
||||
PROVIDER_NAMES,
|
||||
UserPasswordCredentials,
|
||||
} from "@/lib/autogpt-server-api";
|
||||
import { useBackendAPI } from "@/lib/autogpt-server-api/context";
|
||||
import { useToastOnFail } from "@/components/ui/use-toast";
|
||||
|
||||
// Get keys from CredentialsProviderName type
|
||||
const CREDENTIALS_PROVIDER_NAMES = Object.values(
|
||||
PROVIDER_NAMES,
|
||||
) as CredentialsProviderName[];
|
||||
|
||||
// --8<-- [start:CredentialsProviderNames]
|
||||
const providerDisplayNames: Record<CredentialsProviderName, string> = {
|
||||
aiml_api: "AI/ML",
|
||||
anthropic: "Anthropic",
|
||||
apollo: "Apollo",
|
||||
discord: "Discord",
|
||||
d_id: "D-ID",
|
||||
e2b: "E2B",
|
||||
exa: "Exa",
|
||||
fal: "FAL",
|
||||
github: "GitHub",
|
||||
google: "Google",
|
||||
google_maps: "Google Maps",
|
||||
groq: "Groq",
|
||||
http: "HTTP",
|
||||
hubspot: "Hubspot",
|
||||
ideogram: "Ideogram",
|
||||
jina: "Jina",
|
||||
linear: "Linear",
|
||||
medium: "Medium",
|
||||
mem0: "Mem0",
|
||||
notion: "Notion",
|
||||
nvidia: "Nvidia",
|
||||
ollama: "Ollama",
|
||||
openai: "OpenAI",
|
||||
openweathermap: "OpenWeatherMap",
|
||||
open_router: "Open Router",
|
||||
llama_api: "Llama API",
|
||||
pinecone: "Pinecone",
|
||||
screenshotone: "ScreenshotOne",
|
||||
slant3d: "Slant3D",
|
||||
smartlead: "SmartLead",
|
||||
smtp: "SMTP",
|
||||
reddit: "Reddit",
|
||||
replicate: "Replicate",
|
||||
revid: "Rev.ID",
|
||||
twitter: "Twitter",
|
||||
todoist: "Todoist",
|
||||
unreal_speech: "Unreal Speech",
|
||||
zerobounce: "ZeroBounce",
|
||||
} as const;
|
||||
// Helper function to convert provider names to display names
|
||||
function toDisplayName(provider: string): string {
|
||||
// Special cases that need manual handling
|
||||
const specialCases: Record<string, string> = {
|
||||
aiml_api: "AI/ML",
|
||||
d_id: "D-ID",
|
||||
e2b: "E2B",
|
||||
llama_api: "Llama API",
|
||||
open_router: "Open Router",
|
||||
smtp: "SMTP",
|
||||
revid: "Rev.ID",
|
||||
};
|
||||
|
||||
if (specialCases[provider]) {
|
||||
return specialCases[provider];
|
||||
}
|
||||
|
||||
// General case: convert snake_case to Title Case
|
||||
return provider
|
||||
.split(/[_-]/)
|
||||
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
// Provider display names are now generated dynamically by toDisplayName function
|
||||
// --8<-- [end:CredentialsProviderNames]
|
||||
|
||||
type APIKeyCredentialsCreatable = Omit<
|
||||
@@ -115,6 +94,7 @@ export default function CredentialsProvider({
|
||||
}) {
|
||||
const [providers, setProviders] =
|
||||
useState<CredentialsProvidersContextType | null>(null);
|
||||
const [providerNames, setProviderNames] = useState<string[]>([]);
|
||||
const { isLoggedIn } = useSupabase();
|
||||
const api = useBackendAPI();
|
||||
const onFailToast = useToastOnFail();
|
||||
@@ -147,8 +127,8 @@ export default function CredentialsProvider({
|
||||
state_token: string,
|
||||
): Promise<CredentialsMetaResponse> => {
|
||||
try {
|
||||
const credsMeta = await api.oAuthCallback(provider, code, state_token);
|
||||
addCredentials(provider, credsMeta);
|
||||
const credsMeta = await api.oAuthCallback(provider as string, code, state_token);
|
||||
addCredentials(provider as string, credsMeta);
|
||||
return credsMeta;
|
||||
} catch (error) {
|
||||
onFailToast("complete OAuth authentication")(error);
|
||||
@@ -231,7 +211,7 @@ export default function CredentialsProvider({
|
||||
CredentialsDeleteResponse | CredentialsDeleteNeedConfirmationResponse
|
||||
> => {
|
||||
try {
|
||||
const result = await api.deleteCredentials(provider, id, force);
|
||||
const result = await api.deleteCredentials(provider as string, id, force);
|
||||
if (!result.deleted) {
|
||||
return result;
|
||||
}
|
||||
@@ -241,8 +221,8 @@ export default function CredentialsProvider({
|
||||
return {
|
||||
...prev,
|
||||
[provider]: {
|
||||
...prev[provider],
|
||||
savedCredentials: prev[provider].savedCredentials.filter(
|
||||
...prev[provider]!,
|
||||
savedCredentials: prev[provider]!.savedCredentials.filter(
|
||||
(cred) => cred.id !== id,
|
||||
),
|
||||
},
|
||||
@@ -257,8 +237,18 @@ export default function CredentialsProvider({
|
||||
[api, onFailToast],
|
||||
);
|
||||
|
||||
// Fetch provider names on mount
|
||||
useEffect(() => {
|
||||
if (!isLoggedIn) {
|
||||
api
|
||||
.listProviders()
|
||||
.then((names) => {
|
||||
setProviderNames(names);
|
||||
})
|
||||
.catch(onFailToast("load provider names"));
|
||||
}, [api, onFailToast]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isLoggedIn || providerNames.length === 0) {
|
||||
if (isLoggedIn == false) setProviders(null);
|
||||
return;
|
||||
}
|
||||
@@ -280,11 +270,11 @@ export default function CredentialsProvider({
|
||||
setProviders((prev) => ({
|
||||
...prev,
|
||||
...Object.fromEntries(
|
||||
CREDENTIALS_PROVIDER_NAMES.map((provider) => [
|
||||
providerNames.map((provider) => [
|
||||
provider,
|
||||
{
|
||||
provider,
|
||||
providerName: providerDisplayNames[provider],
|
||||
providerName: toDisplayName(provider as string),
|
||||
savedCredentials: credentialsByProvider[provider] ?? [],
|
||||
oAuthCallback: (code: string, state_token: string) =>
|
||||
oAuthCallback(provider, code, state_token),
|
||||
@@ -308,11 +298,13 @@ export default function CredentialsProvider({
|
||||
}, [
|
||||
api,
|
||||
isLoggedIn,
|
||||
providerNames,
|
||||
createAPIKeyCredentials,
|
||||
createUserPasswordCredentials,
|
||||
createHostScopedCredentials,
|
||||
deleteCredentials,
|
||||
oAuthCallback,
|
||||
onFailToast,
|
||||
]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -358,6 +358,10 @@ export default class BackendAPI {
|
||||
);
|
||||
}
|
||||
|
||||
listProviders(): Promise<string[]> {
|
||||
return this._get("/integrations/providers");
|
||||
}
|
||||
|
||||
listCredentials(provider?: string): Promise<CredentialsMetaResponse[]> {
|
||||
return this._get(
|
||||
provider
|
||||
|
||||
@@ -153,50 +153,15 @@ export type Credentials =
|
||||
| HostScopedCredentials;
|
||||
|
||||
// --8<-- [start:BlockIOCredentialsSubSchema]
|
||||
export const PROVIDER_NAMES = {
|
||||
AIML_API: "aiml_api",
|
||||
ANTHROPIC: "anthropic",
|
||||
APOLLO: "apollo",
|
||||
D_ID: "d_id",
|
||||
DISCORD: "discord",
|
||||
E2B: "e2b",
|
||||
EXA: "exa",
|
||||
FAL: "fal",
|
||||
GITHUB: "github",
|
||||
GOOGLE: "google",
|
||||
GOOGLE_MAPS: "google_maps",
|
||||
GROQ: "groq",
|
||||
HTTP: "http",
|
||||
HUBSPOT: "hubspot",
|
||||
IDEOGRAM: "ideogram",
|
||||
JINA: "jina",
|
||||
LINEAR: "linear",
|
||||
MEDIUM: "medium",
|
||||
MEM0: "mem0",
|
||||
NOTION: "notion",
|
||||
NVIDIA: "nvidia",
|
||||
OLLAMA: "ollama",
|
||||
OPENAI: "openai",
|
||||
OPENWEATHERMAP: "openweathermap",
|
||||
OPEN_ROUTER: "open_router",
|
||||
LLAMA_API: "llama_api",
|
||||
PINECONE: "pinecone",
|
||||
SCREENSHOTONE: "screenshotone",
|
||||
SLANT3D: "slant3d",
|
||||
SMARTLEAD: "smartlead",
|
||||
SMTP: "smtp",
|
||||
TWITTER: "twitter",
|
||||
REPLICATE: "replicate",
|
||||
REDDIT: "reddit",
|
||||
REVID: "revid",
|
||||
UNREAL_SPEECH: "unreal_speech",
|
||||
TODOIST: "todoist",
|
||||
ZEROBOUNCE: "zerobounce",
|
||||
} as const;
|
||||
// --8<-- [end:BlockIOCredentialsSubSchema]
|
||||
// Provider names are now dynamic and fetched from the API
|
||||
// This allows for SDK-registered providers without hardcoding
|
||||
export type CredentialsProviderName = string;
|
||||
|
||||
export type CredentialsProviderName =
|
||||
(typeof PROVIDER_NAMES)[keyof typeof PROVIDER_NAMES];
|
||||
// For backward compatibility, we'll keep PROVIDER_NAMES but it should be
|
||||
// populated dynamically from the API. This is a placeholder that will be
|
||||
// replaced with actual values from the /api/integrations/providers endpoint
|
||||
export const PROVIDER_NAMES = {} as Record<string, string>;
|
||||
// --8<-- [end:BlockIOCredentialsSubSchema]
|
||||
|
||||
export type BlockIOCredentialsSubSchema = BlockIOObjectSubSchema & {
|
||||
/* Mirror of backend/data/model.py:CredentialsFieldSchemaExtra */
|
||||
|
||||
Reference in New Issue
Block a user