Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
78 lines
2.2 KiB
TypeScript
78 lines
2.2 KiB
TypeScript
import api from './api'
|
|
|
|
// ── Types ─────────────────────────────────────────────────────────────────────
|
|
|
|
export interface CollectionOwner {
|
|
id: string
|
|
username: string
|
|
avatar: string | null
|
|
}
|
|
|
|
export interface Collection {
|
|
id: string
|
|
name: string
|
|
description: string | null
|
|
isPrivate: boolean
|
|
user: CollectionOwner
|
|
itemCount: number
|
|
updatedAt: string
|
|
createdAt: string
|
|
/** Cover image URL derived from the first item in the collection */
|
|
coverUrl?: string | null
|
|
}
|
|
|
|
export interface CollectionsListResponse {
|
|
collections: Collection[]
|
|
total: number
|
|
page: number
|
|
totalPages: number
|
|
}
|
|
|
|
export type CollectionSort = 'updatedAt' | 'itemCount' | 'name'
|
|
export type CollectionTab = 'mine' | 'following' | 'discover'
|
|
|
|
export interface ListCollectionsParams {
|
|
tab?: CollectionTab
|
|
search?: string
|
|
sort?: CollectionSort
|
|
page?: number
|
|
limit?: number
|
|
}
|
|
|
|
export interface CreateCollectionPayload {
|
|
name: string
|
|
description?: string
|
|
isPrivate: boolean
|
|
}
|
|
|
|
// ── Service ───────────────────────────────────────────────────────────────────
|
|
|
|
export const collectionsService = {
|
|
list: async (params: ListCollectionsParams = {}): Promise<CollectionsListResponse> => {
|
|
const { data } = await api.get<CollectionsListResponse>('/collections', { params })
|
|
return data
|
|
},
|
|
|
|
get: async (id: string): Promise<Collection> => {
|
|
const { data } = await api.get<Collection>(`/collections/${id}`)
|
|
return data
|
|
},
|
|
|
|
create: async (payload: CreateCollectionPayload): Promise<Collection> => {
|
|
const { data } = await api.post<Collection>('/collections', payload)
|
|
return data
|
|
},
|
|
|
|
update: async (
|
|
id: string,
|
|
payload: Partial<CreateCollectionPayload>
|
|
): Promise<Collection> => {
|
|
const { data } = await api.patch<Collection>(`/collections/${id}`, payload)
|
|
return data
|
|
},
|
|
|
|
delete: async (id: string): Promise<void> => {
|
|
await api.delete(`/collections/${id}`)
|
|
},
|
|
}
|