0

Delete Doc

by
Published Mar 4, 2023

Delete document

Script AppWrite
  • Submitted by said30 Deno
    Created 1227 days ago
    1
    import * as sdk from "https://deno.land/x/[email protected]/mod.ts";
    2
    import type { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    3
    
    
    4
    export async function main(
    5
        auth: Resource<"appwrite">,
    6
        collectionId: string,
    7
        databaseId: string,
    8
        documentId: string
    9
    ) 
    10
    {
    11
      
    12
      let client = new sdk.Client();
    13
      client
    14
          .setEndpoint(auth.endpoint) // Your API Endpoint
    15
          .setProject(auth.project) // Your project ID
    16
          .setKey(auth.key) // Your secret API key
    17
    
    
    18
      const databases = new sdk.Databases(client);
    19
    
    
    20
      
    21
      return await databases.deleteDocument
    22
      (
    23
        databaseId,
    24
        collectionId,
    25
        documentId
    26
      )
    27
    }
    28