Greenworks API

Haojian Wu edited this page Oct 21, 2016 · 5 revisions

NOTE: The content in this wiki page is deprecated. For official documentation on v0.6.0 or later, see docs.

The Greenworks API can be accessed by creating an instance of the related node module.

Example: var greenworks = require('./greenworks-osx');

if (greenworks.initAPI()) { console.log('Steam API initalised'); } else { console.log('Error initalising Steam API'); }

Once acquired, you can work on the greenworks object by using the methods and properties described as follows:

  • Greenworks.initAPI()
  • Greenworks.getCloudQuotas()
  • Greenworks.saveTextToFile(string fileName, string content, func success, func error)
  • Greenworks.readTextFromFile(string fileName, func success, func error)
  • Greenworks.activateAchievement(string achievementId, func success, func error)
  • Greenworks.enableCloud()
  • Greenworks.isCloudEnabled()
  • Greenworks.isCloudEnabledForUser()
  • Greenworks.getNumberOfPlayers()
  • Greenworks.ugcPublish(string fileName, string title, string description, string imageFile, func successCallback, func errorCallback, func progressCallback)
  • Greenworks.ugcPublishUpdate(int publishedFileId, string fileName, string title, string description, string imageFile, func successCallback, func errorCallback, func progressCallback)
  • Greenworks.ugcGetItems(int type, int sort, func successCallback, func errorCallback, func progressCallback)
  • Greenworks.ugcGetUserItems(int type, int sort, int filter, func successCallback, func errorCallback, func progressCallback)
  • Greenworks.ugcDownloadItem(string fileName, int hFile, string targetFolder, func successCallback, func errorCallback, func progressCallback)
  • Greenworks.ugcSynchronizeItems(string targetFolder, func success, func error, func progress)
  • Greenworks.getCurrentGameLanguage()
  • Greenworks.getCurrentUILanguage()
  • Greenworks.getSteamId()
  • Greenworks.ugcShowOverlay(optional workshopItemId)
  • Greenworks.ugcUnsubscribe(int publishedFileId, func success, func error, func progress)
  • Greenworks.getCurrentGameInstallDir()
  • Greenworks.runCallbacks()

Greenworks.Utils

  • Greenworks.Utils.createArchive(string zipFile, string sourceDir, string password, int compressionLevel, func success, func error)
  • Greenworks.Utils.extractArchive(string zipFile, string targetDir, string password, func success, func error)
  • Greenworks.Utils.sleep(int ms)
  • Greenworks.Utils.getOS(int ms)
  • Greenworks.Utils.move(string sourceFolder, string targetFolder)
  • Greenworks.Utils.enableConsole()
  • Greenworks.Utils.disableConsole()
  • Greenworks.Utils.enableWriteToLog(string targetFile)
  • Greenworks.Utils.disableWriteToLog()
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.