/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../../lib/primitives.js"; export type SearchRequest = { page?: number | undefined; /** * The query string needs to be url encoded and is made up of the following options: * * @remarks * - Search term. This is just a string. Usually it would be the first item in the query. * - `@`: Use the `@` followed by the username to specify posts by this user. * - `#`: Use the `#` followed by the category slug to search within this category. * - `tags:`: `api,solved` or for posts that have all the specified tags `api+solved`. * - `before:`: `yyyy-mm-dd` * - `after:`: `yyyy-mm-dd` * - `order:`: `latest`, `likes`, `views`, `latest_topic` * - `assigned:`: username (without `@`) * - `in:`: `title`, `likes`, `personal`, `messages`, `seen`, `unseen`, `posted`, `created`, `watching`, `tracking`, `bookmarks`, `assigned`, `unassigned`, `first`, `pinned`, `wiki` * - `with:`: `images` * - `status:`: `open`, `closed`, `public`, `archived`, `noreplies`, `single_user`, `solved`, `unsolved` * - `group:`: group_name or group_id * - `group_messages:`: group_name or group_id * - `min_posts:`: 1 * - `max_posts:`: 10 * - `min_views:`: 1 * - `max_views:`: 10 * * If you are using cURL you can use the `-G` and the `--data-urlencode` flags to encode the query: * * ``` * curl -i -sS -X GET -G "http://localhost:4200/search.json" \ * --data-urlencode 'q=wordpress @scossar #fun after:2020-01-01' * ``` */ q?: string | undefined; }; export type GroupedSearchResult = { canCreateTopic: boolean; categoryIds: Array; error: string | null; groupIds: Array; moreCategories: string | null; moreFullPageResults: string | null; morePosts: string | null; moreUsers: string | null; postIds: Array; searchLogId: number; tagIds: Array; term: string; userIds: Array; }; /** * success response */ export type SearchResponseBody = { categories: Array; groupedSearchResult: GroupedSearchResult; groups: Array; posts: Array; tags: Array; users: Array; }; /** @internal */ export const SearchRequest$inboundSchema: z.ZodType< SearchRequest, z.ZodTypeDef, unknown > = z.object({ page: z.number().int().optional(), q: z.string().optional(), }); /** @internal */ export type SearchRequest$Outbound = { page?: number | undefined; q?: string | undefined; }; /** @internal */ export const SearchRequest$outboundSchema: z.ZodType< SearchRequest$Outbound, z.ZodTypeDef, SearchRequest > = z.object({ page: z.number().int().optional(), q: 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 SearchRequest$ { /** @deprecated use `SearchRequest$inboundSchema` instead. */ export const inboundSchema = SearchRequest$inboundSchema; /** @deprecated use `SearchRequest$outboundSchema` instead. */ export const outboundSchema = SearchRequest$outboundSchema; /** @deprecated use `SearchRequest$Outbound` instead. */ export type Outbound = SearchRequest$Outbound; } /** @internal */ export const GroupedSearchResult$inboundSchema: z.ZodType< GroupedSearchResult, z.ZodTypeDef, unknown > = z.object({ can_create_topic: z.boolean(), category_ids: z.array(z.any()), error: z.nullable(z.string()), group_ids: z.array(z.any()), more_categories: z.nullable(z.string()), more_full_page_results: z.nullable(z.string()), more_posts: z.nullable(z.string()), more_users: z.nullable(z.string()), post_ids: z.array(z.any()), search_log_id: z.number().int(), tag_ids: z.array(z.any()), term: z.string(), user_ids: z.array(z.any()), }).transform((v) => { return remap$(v, { "can_create_topic": "canCreateTopic", "category_ids": "categoryIds", "group_ids": "groupIds", "more_categories": "moreCategories", "more_full_page_results": "moreFullPageResults", "more_posts": "morePosts", "more_users": "moreUsers", "post_ids": "postIds", "search_log_id": "searchLogId", "tag_ids": "tagIds", "user_ids": "userIds", }); }); /** @internal */ export type GroupedSearchResult$Outbound = { can_create_topic: boolean; category_ids: Array; error: string | null; group_ids: Array; more_categories: string | null; more_full_page_results: string | null; more_posts: string | null; more_users: string | null; post_ids: Array; search_log_id: number; tag_ids: Array; term: string; user_ids: Array; }; /** @internal */ export const GroupedSearchResult$outboundSchema: z.ZodType< GroupedSearchResult$Outbound, z.ZodTypeDef, GroupedSearchResult > = z.object({ canCreateTopic: z.boolean(), categoryIds: z.array(z.any()), error: z.nullable(z.string()), groupIds: z.array(z.any()), moreCategories: z.nullable(z.string()), moreFullPageResults: z.nullable(z.string()), morePosts: z.nullable(z.string()), moreUsers: z.nullable(z.string()), postIds: z.array(z.any()), searchLogId: z.number().int(), tagIds: z.array(z.any()), term: z.string(), userIds: z.array(z.any()), }).transform((v) => { return remap$(v, { canCreateTopic: "can_create_topic", categoryIds: "category_ids", groupIds: "group_ids", moreCategories: "more_categories", moreFullPageResults: "more_full_page_results", morePosts: "more_posts", moreUsers: "more_users", postIds: "post_ids", searchLogId: "search_log_id", tagIds: "tag_ids", userIds: "user_ids", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GroupedSearchResult$ { /** @deprecated use `GroupedSearchResult$inboundSchema` instead. */ export const inboundSchema = GroupedSearchResult$inboundSchema; /** @deprecated use `GroupedSearchResult$outboundSchema` instead. */ export const outboundSchema = GroupedSearchResult$outboundSchema; /** @deprecated use `GroupedSearchResult$Outbound` instead. */ export type Outbound = GroupedSearchResult$Outbound; } /** @internal */ export const SearchResponseBody$inboundSchema: z.ZodType< SearchResponseBody, z.ZodTypeDef, unknown > = z.object({ categories: z.array(z.any()), grouped_search_result: z.lazy(() => GroupedSearchResult$inboundSchema), groups: z.array(z.any()), posts: z.array(z.any()), tags: z.array(z.any()), users: z.array(z.any()), }).transform((v) => { return remap$(v, { "grouped_search_result": "groupedSearchResult", }); }); /** @internal */ export type SearchResponseBody$Outbound = { categories: Array; grouped_search_result: GroupedSearchResult$Outbound; groups: Array; posts: Array; tags: Array; users: Array; }; /** @internal */ export const SearchResponseBody$outboundSchema: z.ZodType< SearchResponseBody$Outbound, z.ZodTypeDef, SearchResponseBody > = z.object({ categories: z.array(z.any()), groupedSearchResult: z.lazy(() => GroupedSearchResult$outboundSchema), groups: z.array(z.any()), posts: z.array(z.any()), tags: z.array(z.any()), users: z.array(z.any()), }).transform((v) => { return remap$(v, { groupedSearchResult: "grouped_search_result", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SearchResponseBody$ { /** @deprecated use `SearchResponseBody$inboundSchema` instead. */ export const inboundSchema = SearchResponseBody$inboundSchema; /** @deprecated use `SearchResponseBody$outboundSchema` instead. */ export const outboundSchema = SearchResponseBody$outboundSchema; /** @deprecated use `SearchResponseBody$Outbound` instead. */ export type Outbound = SearchResponseBody$Outbound; }