Edits history of script submission #304 for ' Create Doc (AppWrite)'

  • deno
    import * as sdk from "https://deno.land/x/[email protected]/mod.ts";
    import type { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    
    export async function main(
        auth: Resource<"appwrite">,
        collectionId: string,
        databaseId: string,
        data: object,
        documentId?: string
    ) 
    {
    
      let client = new sdk.Client();
      client
          .setEndpoint(auth.endpoint) // Your API Endpoint
          .setProject(auth.project) // Your project ID
          .setKey(auth.key) // Your secret API key
    
      const databases = new sdk.Databases(client);
    
      return await databases.createDocument
      (
        databaseId,
        collectionId,
        documentId? documentId : sdk.ID.unique(),
        data
      )
    
    }
    

    Submitted by said30 1227 days ago