Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • WomboDream

Index

Constructors

  • new WomboDream(authentifier: GoogleAuthentifier, apiTaskUrl: string, apiUserSuffix: string, apiTaskSuffix: string, apiShopSuffix: string, apiStyleSuffix: string, apiGallerySuffix: string, originUrl: string, uploadUrl: string): WomboDream
  • Parameters

    • authentifier: GoogleAuthentifier
    • apiTaskUrl: string
    • apiUserSuffix: string
    • apiTaskSuffix: string
    • apiShopSuffix: string
    • apiStyleSuffix: string
    • apiGallerySuffix: string
    • originUrl: string
    • uploadUrl: string

    Returns WomboDream

Properties

apiGallerySuffix: string
apiShopSuffix: string
apiStyleSuffix: string
apiTaskSuffix: string
apiTaskUrl: string
apiUserSuffix: string
authentifier: GoogleAuthentifier
originUrl: string
uploadUrl: string

Methods

  • buildApiGalleryUrl(taskId: string): string
  • buildApiStyleUrl(): string
  • buildApiTaskShopUrl(taskId: string): string
  • buildApiTaskUrl(taskId: string): string
  • Create a new HTTP request agent with custom headers

    example
    const agent = await dreamInstance.buildHttpRequestAgentForApiUser({baseURL: "https://app.wombo.art", headers: {Authorization: "Bearer 12345"}});
    agent.get('https://app.wombo.art').then(res => console.log(res.data));

    Parameters

    Returns Promise<AxiosInstance>

  • Create a new HTTP request agent with custom headers for dream API

    example
    const agent = await dreamInstance.buildHttpRequestAgentForDreamApi();
    agent.get('https://app.wombo.art').then(res => console.log(res.data));

    Returns Promise<AxiosInstance>

  • Create a new HTTP request agent with custom headers for user API

    example
    const agent = await dreamInstance.buildHttpRequestAgentForApiUser();
    agent.post('https://app.wombo.art/api/users', {username: "myusername"}).then(res => console.log(res.data));

    Returns Promise<AxiosInstance>

  • buildRawApiGalleryUrl(): string
  • buildRawApiTaskUrl(): string
  • buildUploadUrl(): string
  • Configure an existing Task

    warning

    must be done with the same account as the task was created

    example
    const task:Task;
    dreamInstance.configureTask(task, "kitten", 34).then(console.log);

    Parameters

    • task: Task
    • prompt: string
    • style: number
    • Optional input_image: TaskImageInputSpec

      use an image as input

    • display_freq: number = DEFAULT_DISPLAY_FREQ

      how often the task makes intermediate renders

    Returns Promise<Task>

  • createTask(prompt: string, style: number, input_image?: TaskImageInputSpec, display_freq?: number): Promise<Task>
  • Create and configure an existing Task

    example
    dreamInstance.createTask("kitten", 34).then(console.log);
    

    Parameters

    • prompt: string
    • style: number
    • Optional input_image: TaskImageInputSpec

      use an image as input

    • display_freq: number = DEFAULT_DISPLAY_FREQ

      how often the task makes intermediate renders

    Returns Promise<Task>

  • deleteGalleryTask(taskGalleryId: number): Promise<void>
  • Fetch a gallery saved task

    warning

    task_id != task_gallery_id

    warning

    you must be logged as a user to use it

    example
    const taskGalleryId:number;
    dreamInstance.deleteGalleryTask(taskGalleryId);

    Parameters

    • taskGalleryId: number

    Returns Promise<void>

  • fetchGalleryTask(taskGalleryId: number): Promise<SavedTask>
  • Fetch a gallery saved task

    warning

    task_id != task_gallery_id

    warning

    you must be logged as a user to use it

    example
    const taskGalleryId:number;
    dreamInstance.fetchGalleryTask(taskGalleryId).then(console.log);

    Parameters

    • taskGalleryId: number

    Returns Promise<SavedTask>

  • Fetch gallery saved tasks

    warning

    you must be logged as a user to use it

    example
    dreamInstance.fetchGalleryTasks().then(console.log);
    

    Returns Promise<SavedTask[]>

  • fetchTaskInfos(taskId: string): Promise<Task>
  • Fetch the current infos of a Task

    warning

    must be done with the same account as the task was created

    example
    const taskId:string;
    dreamInstance.fetchTaskInfos(taskId).then(console.log);

    Parameters

    • taskId: string

    Returns Promise<Task>

  • fetchTaskShopUrl(taskId: string): Promise<String>
  • Fetch shop url from task id

    warning

    must be done with the same account as the task was created

    example
    const taskId:string;
    dreamInstance.fetchTaskShopUrl(taskId).then(console.log);

    Parameters

    • taskId: string

    Returns Promise<String>

  • generatePicture(prompt: string, style: number, progressCallback?: (task: Task) => void, input_image?: TaskImageInputSpec, checkFrequency?: number, display_freq?: number): Promise<Task>
  • Create a new task and generate a picture

    example
    dreamInstance.generatePicture('kitten', 34, (task) => {
    console.log(task.state, 'stage', task.photo_url_list.length);
    })
    .then((task) => console.log(task?.result.final))
    .catch(console.error);

    Parameters

    • prompt: string
    • style: number
    • progressCallback: (task: Task) => void = ...

      a callback function that will be called with the progress of the Task

        • Parameters

          Returns void

    • Optional input_image: TaskImageInputSpec

      use an image as input

    • checkFrequency: number = DEFAULT_CHECK_FREQ
    • display_freq: number = DEFAULT_DISPLAY_FREQ

      how often the task makes intermediate renders

    Returns Promise<Task>

  • initTask(): Promise<Task>
  • Initialize new Task

    The Task wont start until it is configured

    example
    dreamInstance.initTask().then(console.log);
    

    Returns Promise<Task>

  • saveTaskToGallery(taskId: string, name?: string, isPublic?: boolean, isPromptVisible?: boolean): Promise<SavedTask>
  • Save task to the gallery

    warning

    must be done with the same account as the task was created

    warning

    you must be logged as a user to use it

    example
    const taskId:string;
    dreamInstance.saveTaskToGallery(taskId, "wonderful kitty").then(console.log);

    Parameters

    • taskId: string
    • name: string = ''
    • isPublic: boolean = false
    • isPromptVisible: boolean = true

    Returns Promise<SavedTask>

  • setUsername(username: string): Promise<void>
  • Set account username

    warning

    YOU NEED TO SET A USERNAME TO INTERRACT WITH GALLERY

    example
    dreamInstance.setUsername("myusername");
    

    Parameters

    • username: string

    Returns Promise<void>

  • Upload an image for later use

    warning

    jpg/jpeg are the only supported image formats

    example
    dreamInstance.uploadImage(fs.readFileSync('./image.jpg')).then(console.log);
    

    Parameters

    Returns Promise<UploadResource>

Generated using TypeDoc