/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import * as components from "../components/index.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type FileStorageFilesSearchGlobals = {
/**
* ID of the consumer which you want to get or push data from
*/
consumerId?: string | undefined;
/**
* The ID of your Unify application
*/
appId?: string | undefined;
};
export type FileStorageFilesSearchRequest = {
/**
* Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API.
*/
serviceId?: string | undefined;
/**
* Optional unmapped key/values that will be passed through to downstream as query parameters. Ie: ?pass_through[search]=leads becomes ?search=leads
*/
passThrough?: { [k: string]: any } | undefined;
/**
* The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.
Example: `fields=name,email,addresses.city`
In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
*/
fields?: string | null | undefined;
/**
* Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response.
*/
cursor?: string | null | undefined;
/**
* Number of results to return. Minimum 1, Maximum 200, Default 20
*/
limit?: number | undefined;
/**
* Apply filters
*/
filter?: components.FilesFilter | undefined;
filesSearch: components.FilesSearch;
};
export type FileStorageFilesSearchResponse = {
httpMeta: components.HTTPMetadata;
/**
* Files
*/
getFilesResponse?: components.GetFilesResponse | undefined;
/**
* Unexpected error
*/
unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined;
};
/** @internal */
export const FileStorageFilesSearchGlobals$inboundSchema: z.ZodType<
FileStorageFilesSearchGlobals,
z.ZodTypeDef,
unknown
> = z.object({
consumerId: z.string().optional(),
appId: z.string().optional(),
});
/** @internal */
export type FileStorageFilesSearchGlobals$Outbound = {
consumerId?: string | undefined;
appId?: string | undefined;
};
/** @internal */
export const FileStorageFilesSearchGlobals$outboundSchema: z.ZodType<
FileStorageFilesSearchGlobals$Outbound,
z.ZodTypeDef,
FileStorageFilesSearchGlobals
> = z.object({
consumerId: z.string().optional(),
appId: z.string().optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace FileStorageFilesSearchGlobals$ {
/** @deprecated use `FileStorageFilesSearchGlobals$inboundSchema` instead. */
export const inboundSchema = FileStorageFilesSearchGlobals$inboundSchema;
/** @deprecated use `FileStorageFilesSearchGlobals$outboundSchema` instead. */
export const outboundSchema = FileStorageFilesSearchGlobals$outboundSchema;
/** @deprecated use `FileStorageFilesSearchGlobals$Outbound` instead. */
export type Outbound = FileStorageFilesSearchGlobals$Outbound;
}
export function fileStorageFilesSearchGlobalsToJSON(
fileStorageFilesSearchGlobals: FileStorageFilesSearchGlobals,
): string {
return JSON.stringify(
FileStorageFilesSearchGlobals$outboundSchema.parse(
fileStorageFilesSearchGlobals,
),
);
}
export function fileStorageFilesSearchGlobalsFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => FileStorageFilesSearchGlobals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'FileStorageFilesSearchGlobals' from JSON`,
);
}
/** @internal */
export const FileStorageFilesSearchRequest$inboundSchema: z.ZodType<
FileStorageFilesSearchRequest,
z.ZodTypeDef,
unknown
> = z.object({
serviceId: z.string().optional(),
pass_through: z.record(z.any()).optional(),
fields: z.nullable(z.string()).optional(),
cursor: z.nullable(z.string()).optional(),
limit: z.number().int().default(20),
filter: components.FilesFilter$inboundSchema.optional(),
FilesSearch: components.FilesSearch$inboundSchema,
}).transform((v) => {
return remap$(v, {
"pass_through": "passThrough",
"FilesSearch": "filesSearch",
});
});
/** @internal */
export type FileStorageFilesSearchRequest$Outbound = {
serviceId?: string | undefined;
pass_through?: { [k: string]: any } | undefined;
fields?: string | null | undefined;
cursor?: string | null | undefined;
limit: number;
filter?: components.FilesFilter$Outbound | undefined;
FilesSearch: components.FilesSearch$Outbound;
};
/** @internal */
export const FileStorageFilesSearchRequest$outboundSchema: z.ZodType<
FileStorageFilesSearchRequest$Outbound,
z.ZodTypeDef,
FileStorageFilesSearchRequest
> = z.object({
serviceId: z.string().optional(),
passThrough: z.record(z.any()).optional(),
fields: z.nullable(z.string()).optional(),
cursor: z.nullable(z.string()).optional(),
limit: z.number().int().default(20),
filter: components.FilesFilter$outboundSchema.optional(),
filesSearch: components.FilesSearch$outboundSchema,
}).transform((v) => {
return remap$(v, {
passThrough: "pass_through",
filesSearch: "FilesSearch",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace FileStorageFilesSearchRequest$ {
/** @deprecated use `FileStorageFilesSearchRequest$inboundSchema` instead. */
export const inboundSchema = FileStorageFilesSearchRequest$inboundSchema;
/** @deprecated use `FileStorageFilesSearchRequest$outboundSchema` instead. */
export const outboundSchema = FileStorageFilesSearchRequest$outboundSchema;
/** @deprecated use `FileStorageFilesSearchRequest$Outbound` instead. */
export type Outbound = FileStorageFilesSearchRequest$Outbound;
}
export function fileStorageFilesSearchRequestToJSON(
fileStorageFilesSearchRequest: FileStorageFilesSearchRequest,
): string {
return JSON.stringify(
FileStorageFilesSearchRequest$outboundSchema.parse(
fileStorageFilesSearchRequest,
),
);
}
export function fileStorageFilesSearchRequestFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => FileStorageFilesSearchRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'FileStorageFilesSearchRequest' from JSON`,
);
}
/** @internal */
export const FileStorageFilesSearchResponse$inboundSchema: z.ZodType<
FileStorageFilesSearchResponse,
z.ZodTypeDef,
unknown
> = z.object({
HttpMeta: components.HTTPMetadata$inboundSchema,
GetFilesResponse: components.GetFilesResponse$inboundSchema.optional(),
UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema
.optional(),
}).transform((v) => {
return remap$(v, {
"HttpMeta": "httpMeta",
"GetFilesResponse": "getFilesResponse",
"UnexpectedErrorResponse": "unexpectedErrorResponse",
});
});
/** @internal */
export type FileStorageFilesSearchResponse$Outbound = {
HttpMeta: components.HTTPMetadata$Outbound;
GetFilesResponse?: components.GetFilesResponse$Outbound | undefined;
UnexpectedErrorResponse?:
| components.UnexpectedErrorResponse$Outbound
| undefined;
};
/** @internal */
export const FileStorageFilesSearchResponse$outboundSchema: z.ZodType<
FileStorageFilesSearchResponse$Outbound,
z.ZodTypeDef,
FileStorageFilesSearchResponse
> = z.object({
httpMeta: components.HTTPMetadata$outboundSchema,
getFilesResponse: components.GetFilesResponse$outboundSchema.optional(),
unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema
.optional(),
}).transform((v) => {
return remap$(v, {
httpMeta: "HttpMeta",
getFilesResponse: "GetFilesResponse",
unexpectedErrorResponse: "UnexpectedErrorResponse",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace FileStorageFilesSearchResponse$ {
/** @deprecated use `FileStorageFilesSearchResponse$inboundSchema` instead. */
export const inboundSchema = FileStorageFilesSearchResponse$inboundSchema;
/** @deprecated use `FileStorageFilesSearchResponse$outboundSchema` instead. */
export const outboundSchema = FileStorageFilesSearchResponse$outboundSchema;
/** @deprecated use `FileStorageFilesSearchResponse$Outbound` instead. */
export type Outbound = FileStorageFilesSearchResponse$Outbound;
}
export function fileStorageFilesSearchResponseToJSON(
fileStorageFilesSearchResponse: FileStorageFilesSearchResponse,
): string {
return JSON.stringify(
FileStorageFilesSearchResponse$outboundSchema.parse(
fileStorageFilesSearchResponse,
),
);
}
export function fileStorageFilesSearchResponseFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => FileStorageFilesSearchResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'FileStorageFilesSearchResponse' from JSON`,
);
}