Type Alias ItemMethods

ItemMethods: {
    list(data: SpaceTarget & PaginationTarget & ItemTypeTarget): Promise<{
        items: Item[];
        count: number;
    }>;
    find(data: ItemTarget): Promise<null | Item<GlItem>>;
    edit(data: ItemTarget & Partial<EditablePartOfItem>): Promise<boolean>;
    remove(data: ItemTarget): Promise<boolean>;
    createDoor(data: Omit<EditablePartOfItem, "width" | "height" | "ratio"> & {
        targetId: ObjectId;
    } & SpaceTarget): Promise<string>;
    createDrawing(data: Omit<EditablePartOfItem,
        | "width"
        | "height"
        | "ratio"
        | "x"
        | "y"> & Omit<FocusWriting, "glType" | "timed"> & SpaceTarget): Promise<string>;
    createFrame(data: EditablePartOfItem & Pick<Frame, "name"> & SpaceTarget): Promise<string>;
    createImage(data: EditablePartOfItem & {
        image: File;
    } & SpaceTarget & Pick<Image, "flip">): Promise<string>;
    createLink(data: Omit<EditablePartOfItem, "width" | "height" | "ratio"> & Omit<Link, "glType"> & SpaceTarget): Promise<string>;
    createPresentation(data: EditablePartOfItem & {
        pdf: File;
    } & SpaceTarget & Pick<Presentation, "page">): Promise<string>;
    createSticker(data: EditablePartOfItem & Omit<Sticker, "glType"> & SpaceTarget): Promise<string>;
    createYoutube(data: EditablePartOfItem & Omit<Youtube, "glType"> & SpaceTarget): Promise<string>;
    editDoor(data: {
        targetId: ObjectId;
    } & ItemTarget): Promise<boolean>;
    editDrawing(data: Partial<Pick<FocusWriting, "data" | "color" | "size">> & ItemTarget): Promise<boolean>;
    editFrame(data: Pick<Frame, "name"> & ItemTarget): Promise<boolean>;
    editImage(data: Pick<Image, "flip"> & ItemTarget): Promise<boolean>;
    editLink(data: Partial<Pick<Link, "text" | "url" | "status">> & ItemTarget): Promise<boolean>;
    editPresentation(data: Pick<Presentation, "page"> & ItemTarget): Promise<boolean>;
    editSticker(data: Partial<Omit<Sticker, "glType">> & ItemTarget): Promise<boolean>;
    editYoutube(data: Pick<Youtube, "position"> & ItemTarget): Promise<boolean>;
}

Type declaration

  • list:function
    • Get a list of items with pagination.

      Requires AccessScope.ItemRead.

      Parameters

      Returns Promise<{
          items: Item[];
          count: number;
      }>

      count of items and a list of items:

      • id is identifier of item
      • x is relative/absolute x coordinate
      • y is relative/absolute y coordinate
      • z is z-index value
      • width is width of item in space pixels
      • height is height of item is space pixels
      • ratio equals initial width divided by initial height
      • rotation is rotation of item in deg
      • scale is item scale, miss support, always has value 1.0
      • locked (GlLock) is lock status of item
      • visibility (GlVisibility) is item visibility
      • parent is identifier of parent or zero
      • creator is identifier of item creator (user/guest)
      • created is the creation timestamp as string (ISO 8601)
      • editor is identifier of item editor (user/guest)
      • edited is the editing timestamp as string (ISO 8601)
      • data is custom item data, see GlItem implementations
      • sizeOnDisk is file size in MiB or zero
      • version is actual version of item, version can be changed due to item migration to a new version
  • find:function
    • Find an item by id.

      Requires AccessScope.ItemRead.

      Parameters

      • data: ItemTarget
        • spaceId is the identifier of space
        • itemId is the identifier of item

      Returns Promise<null | Item<GlItem>>

      Null or object:

      • id is identifier of item
      • x is relative/absolute x coordinate
      • y is relative/absolute y coordinate
      • z is z-index value
      • width is width of item in space pixels
      • height is height of item is space pixels
      • ratio equals initial width divided by initial height
      • rotation is rotation of item in deg
      • scale is item scale, miss support, always has value 1.0
      • locked (GlLock) is lock status of item
      • visibility (GlVisibility) is item visibility
      • parent is identifier of parent or zero
      • creator is identifier of item creator (user/guest)
      • created is the creation timestamp as string (ISO 8601)
      • editor is identifier of item editor (user/guest)
      • edited is the editing timestamp as string (ISO 8601)
      • data is custom item data, see GlItem implementations
      • sizeOnDisk is file size in MiB or zero
      • version is actual version of item
  • edit:function
    • Edit an item, this method can change any editable field of item.

      Requires AccessScope.ItemEdit.

      Parameters

      • data: ItemTarget & Partial<EditablePartOfItem>
        • spaceId is the identifier of space
        • itemId is the identifier of item
        • x is relative/absolute x coordinate
        • y is relative/absolute y coordinate
        • z is z-index value
        • width is width of item in space pixels
        • height is height of item is space pixels
        • ratio equals initial width divided by initial height
        • rotation is rotation of item in deg
        • scale is item scale, miss support, always has value 1.0
        • locked (GlLock) is lock status of item
        • visibility (GlVisibility) is item visibility
        • parent is identifier of parent or zero

      Returns Promise<boolean>

      true if item is present in the database

  • remove:function
  • createDoor:function
    • Create a new door in space.

      Requires AccessScope.ItemCreate.

      Parameters

      • data: Omit<EditablePartOfItem, "width" | "height" | "ratio"> & {
            targetId: ObjectId;
        } & SpaceTarget
        • spaceId is identifier of space where item will be inserted
        • targetId is destination space identifier
        • x is relative/absolute x coordinate
        • y is relative/absolute y coordinate
        • z is z-index value
        • ratio equals initial width divided by initial height
        • rotation is rotation of item in deg
        • scale is item scale, miss support, always has value 1.0
        • locked (GlLock) is lock status of item
        • visibility (GlVisibility) is item visibility
        • parent is identifier of parent or zero

      Returns Promise<string>

      Identifier of the created door

  • createDrawing:function
    • Create a drawing.

      Requires AccessScope.ItemCreate.

      Parameters

      • data: Omit<EditablePartOfItem,
            | "width"
            | "height"
            | "ratio"
            | "x"
            | "y"> & Omit<FocusWriting, "glType" | "timed"> & SpaceTarget
        • spaceId is identifier of space where item will be inserted
        • data is value for d attribute of path tag
        • color (DrawingColor) is stroke color
        • size is stroke weight
        • z is z-index value
        • rotation is rotation of item in deg
        • scale is item scale, miss support, always has value 1.0
        • locked (GlLock) is lock status of item
        • visibility (GlVisibility) is item visibility
        • parent is identifier of parent or zero

      Returns Promise<string>

      Identifier of created drawing

  • createFrame:function
    • Beta

      Create a frame.

      Requires AccessScope.ItemCreate.

      Parameters

      • data: EditablePartOfItem & Pick<Frame, "name"> & SpaceTarget
        • spaceId is identifier of space where item will be inserted
        • name is screen name of the frame
        • x is relative/absolute x coordinate
        • y is relative/absolute y coordinate
        • z is z-index value
        • rotation is rotation of item in deg
        • scale is item scale, miss support, always has value 1.0
        • locked (GlLock) is lock status of item
        • visibility (GlVisibility) is item visibility
        • parent is identifier of parent or zero

      Returns Promise<string>

      Identifier of created frame

  • createImage:function
    • Upload an image.

      Requires AccessScope.ItemCreate.

      Parameters

      • data: EditablePartOfItem & {
            image: File;
        } & SpaceTarget & Pick<Image, "flip">
        • spaceId is identifier of space where item will be inserted
        • file is File to upload
        • x is relative/absolute x coordinate
        • y is relative/absolute y coordinate
        • z is z-index value
        • ratio equals initial width divided by initial height
        • rotation is rotation of item in deg
        • scale is item scale, miss support, always has value 1.0
        • locked (GlLock) is lock status of item
        • visibility (GlVisibility) is item visibility
        • parent is identifier of parent or zero

      Returns Promise<string>

      Identifier of created image

      ModuleErrors.AccessRestricted; ModuleErrors.NotFound;

      The width and height are max values is this method

  • createLink:function
    • Create an external link.

      Requires AccessScope.ItemCreate.

      Parameters

      • data: Omit<EditablePartOfItem, "width" | "height" | "ratio"> & Omit<Link, "glType"> & SpaceTarget
        • spaceId is identifier of space where item will be inserted
        • text is screen text of link
        • url is URL to follow
        • status (GlLinkStatus) is link behavior mode
        • x is relative/absolute x coordinate
        • y is relative/absolute y coordinate
        • z is z-index value
        • ratio equals initial width divided by initial height
        • rotation is rotation of item in deg
        • scale is item scale, miss support, always has value 1.0
        • locked (GlLock) is lock status of item
        • visibility (GlVisibility) is item visibility
        • parent is identifier of parent or zero

      Returns Promise<string>

      Identifier of the created link

  • createPresentation:function
    • Crete a presentation.

      Requires AccessScope.ItemCreate.

      Parameters

      • data: EditablePartOfItem & {
            pdf: File;
        } & SpaceTarget & Pick<Presentation, "page">
        • spaceId is identifier of space where item will be inserted
        • file is File to upload
        • x is relative/absolute x coordinate
        • y is relative/absolute y coordinate
        • z is z-index value
        • rotation is rotation of item in deg
        • scale is item scale, miss support, always has value 1.0
        • locked (GlLock) is lock status of item
        • visibility (GlVisibility) is item visibility
        • parent is identifier of parent or zero

      Returns Promise<string>

      Identifier of the created presentation

      ModuleErrors.AccessRestricted; ModuleErrors.NotFound;

      Zero width/height will be replaced with auto values

  • createSticker:function
    • Create a sticker.

      Requires AccessScope.ItemCreate.

      Parameters

      • data: EditablePartOfItem & Omit<Sticker, "glType"> & SpaceTarget
        • spaceId is identifier of space where item will be inserted
        • text is sticker text
        • color (StickerColor) is background color
        • form (StickerForm) is sticker figure
        • hAlign (GlHTextAlign) is text horizontal align
        • vAlign (GlVTextAlign) is text vertical align
        • size is font size of text
        • borderColor (StickerBorderColor) is color of border
        • borderType (BorderType) is border style
        • borderSize is border width
        • x is relative/absolute x coordinate
        • y is relative/absolute y coordinate
        • z is z-index value
        • ratio equals initial width divided by initial height
        • rotation is rotation of item in deg
        • scale is item scale, miss support, always has value 1.0
        • locked (GlLock) is lock status of item
        • visibility (GlVisibility) is item visibility
        • parent is identifier of parent or zero

      Returns Promise<string>

      Identifier of the created sticker

  • createYoutube:function
    • Create a YouTube video player.

      Requires AccessScope.ItemCreate.

      Parameters

      • data: EditablePartOfItem & Omit<Youtube, "glType"> & SpaceTarget
        • spaceId is identifier of space where item will be inserted
        • link is a YouTube embed link
        • position is play start position in seconds
        • x is relative/absolute x coordinate
        • y is relative/absolute y coordinate
        • z is z-index value
        • ratio equals initial width divided by initial height
        • rotation is rotation of item in deg
        • scale is item scale, miss support, always has value 1.0
        • locked (GlLock) is lock status of item
        • visibility (GlVisibility) is item visibility
        • parent is identifier of parent or zero

      Returns Promise<string>

      Identifier of the created player

  • editDoor:function
  • editDrawing:function
  • editFrame:function
  • editImage:function
  • editLink:function
  • editPresentation:function
  • editSticker:function
  • editYoutube:function