Documentation

# What can Purple Fabric's SDK do?

# Overview

  • The SDK expects you to implement the simple run() function to achieve your goals
  • SDK enables you to bring in custom dependencies at OS level as well as at project level
  • SDK provides the Context object that can provide useful operations for the developer
  • The developer can build the connector with type-safe Pydantic models generated from the schema

# The Context class

The Context class enables the developer to perform the following operations:

  • storage: Upload and download files from Purple Fabric Platform
  • logger: Provides a logging.Logger instance configured with sensible defaults
  • trace_id: Provides the current trace_id used for tracking of requests across Purple Fabric Platform

# Uploading files to Purple Fabric Platform

  • To upload a file to the Purple Fabric Platform, create an instance of File. It takes file_name and file_content as its arguments
  • Use the context.storage.upload() function to upload the file. It provides a reference ID, that can be used to track the location of the file
  • The upload function is capable of uploading a single file per call

# Downloading files from Purple Fabric Platform

  • To download a file from Purple Fabric Platform, the user has to provide the file_ref_id parameter
  • The context.storage.download() function is capable of downloading a single file per call
  • The downloaded file is an instance of File model