0.1.2 • Published 8 months ago

@app-comment/core v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

app-comment-core

core binings for app-comment

!IMPORTANT
If you are not using this with app-comment then you need to have databaseId and collectionId

Getting started 🚀

Pre-requisits

  • signup for appwrite cloud or self-host it
  • go to appwrite console and create a project
  • go into projects setting and create api key with scope database, auth and storage
  • you will need projectId , api key and appwrite-baseurl (if you are using appwrite clound then it is https://cloud.appwrite.io/v1 )
  • make sure you have nodeJs installed in your system if you are using this as stand alone

Installation

npm i @app-comment/core

Automated install

npx @app-comment/app-comment-cli

This will setup the app-comment project and install all the required dependencies.

Usage

// appcomment.js
import appComment from @app-comment/core
const appConfig = {
    baseURL : "https://cloud.appwrite.io/v1",
    projectId : <your project id>,
    api : <your appwrite api>,
    databaseId : <database id>, // optional
    collectionId : <collection id> // optional
}
const appcomment = new appComment(...appConfig)

export default appcomment

Now use appcomment in your project

Quick Start ⏩

import appcomment from <path-to-appcomment.js>

// list all the documents of a given collection
// top-level await is only avialable in nodejs 14+
const allDocuments = await appcomment.listDocuments()

//or

let allDocuments
;(async ()=>{
   allDocuments = await appcomment.listDocuments()
})()
console.log(allDocuments)

built-in methods

methodsarguments
createUseremail, password,name,userId
userLoginemail,password
userLogoutvoid
getLoggedInUservoid
getUseruserId
getAllUsersquery?, search?
createDatabasedatabaseId?, databasename?
getDatabasedatabaseId
createCollectioncollectionId?, databaseId
getCollectioncollectionId, databaseId
createDocumentdatabaseId, collectionId, data, userId
getdocumentdocumentId
listAllDocumentsdatabaseId, collectionId, query?
deleteDocumentdocumentId
updateDocumentdatabaseId, collectionId, data
createBooldatabaseId, collectionId, options
createStringdatabaseId, collectionId, options
createNumberdatabaseId, collectionId, options