Skip to content

kecsot/ts-appwrite-api-layer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript-AppWrite-API-Layer

This is a custom TypeScript layer to use AppWrite database.

An example:

const { createItem, 
        getItem,
        updateItem,
        deleteItem,
        countItems,
        getList,
        getAllItems } = useCardResource()

Create Item

const item = await createItem(deckModel) // (input: IBaseModel, output: BaseType)

Get Item

  const item = await getItem("mr1n219cb1x2y1kfh")

Update Item

const item = await updateItem(deckModel) // (input: BaseType, output: BaseType)

Delete Item

const item = await deleteItem("nl2e1bjke21bie12zbda") // (input: BaseType, output: BaseType)

Count Items

const count = await countItems([ResourceQuery.greaterThan('age', 21)])

Get List (paginated data)

 const items = await getList(1, 100)

Get All Items (recursively collect data used getList)

 const items = await getAllItems([ResourceQuery.orderDesc('id'), ResourceQuery.limit(10)])

About

A custom layer above AppWrite.io to make less dependency

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published