@follow-app/client-sdk
Version:
TypeScript client SDK for Follow RSS Server API
127 lines (113 loc) • 2.13 kB
text/typescript
/**
* Standard Follow API response wrapper
*/
export interface FollowAPIResponse<T = any> {
code: number
data: T
message?: string
}
/**
* Error response from Follow API
*/
export interface FollowAPIErrorResponse {
code: number
message: string
data?: any
}
/**
* Generic type for requests that only contain an id parameter
*/
export interface IdRequest {
id: string
}
/**
* Generic type for requests that only contain a feedId parameter
*/
export interface FeedIdRequest {
feedId: string
}
/**
* Generic type for requests that only contain a listId parameter
*/
export interface ListIdRequest {
listId: string
}
/**
* Generic type for requests that only contain a userId parameter
*/
export interface UserIdRequest {
userId: string
}
/**
* Generic type for requests that only contain an entryId parameter
*/
export interface EntryIdRequest {
entryId: string
}
/**
* HTTP methods supported by the client
*/
export type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH"
/**
* Request content types
*/
export type RequestContentType =
| "json" |
"formData" |
"text" |
"blob" |
"arrayBuffer"
/**
* Response content types
*/
export type ResponseContentType =
| "json" |
"text" |
"blob" |
"arrayBuffer" |
"stream" |
"raw"
/**
* Request options for API calls
*/
export interface RequestOptions {
method?: HTTPMethod
headers?: Record<string, string>
body?: unknown
query?: Record<string, string | number | boolean | string[]>
timeout?: number
signal?: AbortSignal
requestType?: RequestContentType
asRaw?: boolean
}
/**
* Client configuration options
*/
export interface ClientConfig {
baseURL: string
timeout?: number
headers?: Record<string, string>
credentials?: RequestCredentials
fetch?: typeof fetch
}
/**
* Pagination parameters
*/
export interface PaginationParams {
page?: number
limit?: number
before?: string
after?: string
}
/**
* Pagination response
*/
export interface PaginationResponse<T> {
data: T[]
pagination: {
page: number
limit: number
total: number
hasMore: boolean
}
}