@utcp/sdk
Version:
Universal Tool Calling Protocol (UTCP) client library for TypeScript
114 lines (113 loc) • 3.12 kB
TypeScript
import { z } from 'zod';
/**
* Authentication using an API key.
*
* The key can be provided directly or sourced from an environment variable.
*/
export declare const ApiKeyAuthSchema: z.ZodObject<{
auth_type: z.ZodLiteral<"api_key">;
api_key: z.ZodString;
var_name: z.ZodString;
location: z.ZodDefault<z.ZodEnum<["header", "query", "cookie"]>>;
}, "strip", z.ZodTypeAny, {
auth_type: "api_key";
api_key: string;
var_name: string;
location: "header" | "query" | "cookie";
}, {
auth_type: "api_key";
api_key: string;
var_name: string;
location?: "header" | "query" | "cookie" | undefined;
}>;
export type ApiKeyAuth = z.infer<typeof ApiKeyAuthSchema>;
/**
* Authentication using a username and password.
*/
export declare const BasicAuthSchema: z.ZodObject<{
auth_type: z.ZodLiteral<"basic">;
username: z.ZodString;
password: z.ZodString;
}, "strip", z.ZodTypeAny, {
auth_type: "basic";
username: string;
password: string;
}, {
auth_type: "basic";
username: string;
password: string;
}>;
export type BasicAuth = z.infer<typeof BasicAuthSchema>;
/**
* Authentication using OAuth2.
*/
export declare const OAuth2AuthSchema: z.ZodObject<{
auth_type: z.ZodLiteral<"oauth2">;
token_url: z.ZodString;
client_id: z.ZodString;
client_secret: z.ZodString;
scope: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
auth_type: "oauth2";
token_url: string;
client_id: string;
client_secret: string;
scope?: string | undefined;
}, {
auth_type: "oauth2";
token_url: string;
client_id: string;
client_secret: string;
scope?: string | undefined;
}>;
export type OAuth2Auth = z.infer<typeof OAuth2AuthSchema>;
/**
* Combined authentication types.
*/
export declare const AuthSchema: z.ZodDiscriminatedUnion<"auth_type", [z.ZodObject<{
auth_type: z.ZodLiteral<"api_key">;
api_key: z.ZodString;
var_name: z.ZodString;
location: z.ZodDefault<z.ZodEnum<["header", "query", "cookie"]>>;
}, "strip", z.ZodTypeAny, {
auth_type: "api_key";
api_key: string;
var_name: string;
location: "header" | "query" | "cookie";
}, {
auth_type: "api_key";
api_key: string;
var_name: string;
location?: "header" | "query" | "cookie" | undefined;
}>, z.ZodObject<{
auth_type: z.ZodLiteral<"basic">;
username: z.ZodString;
password: z.ZodString;
}, "strip", z.ZodTypeAny, {
auth_type: "basic";
username: string;
password: string;
}, {
auth_type: "basic";
username: string;
password: string;
}>, z.ZodObject<{
auth_type: z.ZodLiteral<"oauth2">;
token_url: z.ZodString;
client_id: z.ZodString;
client_secret: z.ZodString;
scope: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
auth_type: "oauth2";
token_url: string;
client_id: string;
client_secret: string;
scope?: string | undefined;
}, {
auth_type: "oauth2";
token_url: string;
client_id: string;
client_secret: string;
scope?: string | undefined;
}>]>;
export type Auth = z.infer<typeof AuthSchema>;