0.0.48 • Published 23 days ago

oute-services-asset-sdk v0.0.48

Weekly downloads
-
License
-
Repository
-
Last release
23 days ago

This module expose helper functions

  • Initialization
  var params = {
    url: @server url
    token: @access token
  }
  var Asset = require("oute-services-asset-sdk")
  var asset_instance = new Asset(params)

Cache functions

  • Find asset in cache
  asset_instance.findAssetInCache(cache_obj, asset_id)
  • Find asset location in cache
  asset_instance.findAssetLocationInCache(cache_obj, asset, parent_id)
  • Find asset info in cache this return promise
  asset_instance.findAssetInfoInCache(cache_obj, asset_id)
  • Search assets in cache
  search_options = {
    annotation: ["PROJECT"],
    name: "xyz",
    recursive: true //this is helpful when want to find in childs
  }
  asset_instance.findAssetsInCache(cache_obj, search_options)
  • Delete assets in cache
  asset_ids = ["LSN7rofCP"]
  is_hard_delete = false //true when deleting from trash
  asset_instance.deleteAssetsInCache(cache_obj, asset_ids, is_hard_delete)
  • Move asset in cache
  asset_ids = ["q-GmTD5-K"]
  parent_id = "wi3uim5jQ"
  asset_instance.moveAssetsInCache(cache_obj, asset_ids, parent_id)
  • Get Latest cache
  user_id = "test@gofo.app"
  workspace_id = "ZzBfJMpfQ"
  checksum = undefined
  await asset_instance.getLatestCache(user_id, workspace_id, checksum)
  • Add asset in cache
  assets = [{"_id": "eW7jrNnhs"}]
  parent_id = "wi3uim5jQ"
  asset_instance.addAssetsInCache(cache_obj, assets, parent_id)
  • Rename asset in cache
  asset_id = "TSDKpihJY"
  asset_name = "test12"
  asset_instance.renameAssetInCache(cache_obj, asset_id, asset_name)
  • Update favorite in cache
  asset_ids = ["TSDKpihJY"]
  is_favorite = true
  asset_instance.updateFavoriteInCache(cache_obj, asset_ids, is_favorite)
  • Restore assets in cache
  asset_ids = ["LSN7rofCP"]
  asset_instance.restoreAssetsInCache(cache_obj, asset_ids)
  • Empty trash in cache
  asset_instance.emptyTrashInCache(cache_obj)

Core functions

  • Invite members
  body = {
    "workspace_id": "ZzBfJMpfQ",
    "notify": false,
    "message": "Hi this is imp",
    "asset_ids": ["x1QBwyqbN"],
    "invitees": [
      {
          "email_id": "test1@gofo.app",
          "role": "VIEWER" //posible values VIEWER, EDITOR, PERMANENT_DELETED
      }
    ]
  }
  await asset_instance.inviteMembers(body)
  • Share to members
  body = {
    "asset_ids": ["JrIHcMHgd"],
    "invitees": [
        {
          "email_id": "test1@gofo.app",
          "role": "VIEWER" //posible values VIEWER, EDITOR, PERMANENT_DELETED
        }
    ]
  }
  await asset_instance.share(body)
  • Remove access for member
  body = {
    "asset_id": "MyTbZOnfH",
    "user_id": "test1@gofo.app"
  }
  await asset_instance.removeAccess(body)
  • get members
  asset_id = "MyTbZOnfH"
  await asset_instance.getMembers(asset_id)
  • update favorite for asset
  asset_ids = ["q-GmTD5-K"]
  is_favorite = false
  await asset_instance.updateFavorite(asset_ids, is_favorite)
  • Rename asset
  asset_id = "q-GmTD5-K"
  asset_name = "test12"
  await asset_instance.rename(asset_id, asset_name)
  • Move asset
  asset_ids = ["q-GmTD5-K"]
  parent_id = "wi3uim5jQ"
  await asset_instance.move(asset_ids, parent_id)
  • Delete asset
  asset_ids = ["q-GmTD5-K"]
  is_hard_delete = false //true when deleting from trash
  await asset_instance.delete(asset_ids, is_hard_delete)
  • Save asset
  body = {
    "_id": "q-GmTD5-K",
    "name": "test",
    "workspace_id": "ZzBfJMpfQ",
    "parent_id": null,
    "type": "FOLDER",
    "user_id": "test@gofo.app",
    "share_to_all": false,
    "deep_extend": true,
    "meta": {
      "thumbnail": "https://ccc.oute.app/ZzBfJMpfQ/test@gofo.app/1686221763145/test.jpeg",
      "test": 1
    }
  }
  await asset_instance.save(body)
  • Restore assets
  asset_ids = ["LSN7rofCP"]
  await asset_instance.restore(asset_ids)
  • Can access asset
  asset_id = "q-GmTD5-K"
  await asset_instance.canAccess(asset_id)
  • Can edit asset
  asset_id = "q-GmTD5-K"
  await asset_instance.canEdit(asset_id)
  • Empty trash
  workspace_id = "q-GmTD5-K"
  await asset_instance.emptyTrash(workspace_id)
  • Find one
  query = {
    "_id": "q-GmTD5-K"
  }
  await asset_instance.findOne(query)
  • Get event list
  query = {} //send if want to filter data
  await asset_instance.getEvents(query)
0.0.48

23 days ago

0.0.46

29 days ago

0.0.47

29 days ago

0.0.45

2 months ago

0.0.44

2 months ago

0.0.43

5 months ago

0.0.42

5 months ago

0.0.40

7 months ago

0.0.41

7 months ago

0.0.38

8 months ago

0.0.39

7 months ago

0.0.37

8 months ago

0.0.32

8 months ago

0.0.33

8 months ago

0.0.34

8 months ago

0.0.35

8 months ago

0.0.36

8 months ago

0.0.31

8 months ago

0.0.30

9 months ago

0.0.29

9 months ago

0.0.28

9 months ago

0.0.27

9 months ago

0.0.26

9 months ago

0.0.25

9 months ago

0.0.24

9 months ago

0.0.23

9 months ago

0.0.22

9 months ago

0.0.21

9 months ago

0.0.20

9 months ago

0.0.19

9 months ago

0.0.18

10 months ago

0.0.17

10 months ago

0.0.16

10 months ago

0.0.15

10 months ago

0.0.14

10 months ago

0.0.13

10 months ago

0.0.12

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago