Documentation ¶
Index ¶
- Constants
- Variables
- func CheckForNewCLIVersion(client HTTPClient) string
- func GenerateFileHashStr(fName string) (string, error)
- func GetContentTypeByExtension(ext string) (string, bool)
- func GetDirectoryContainingFile(wd, filename string) (string, error)
- func IsDefaultContentType(cType string) bool
- func RandomAlphaNumericSpecialString(length int) string
- func RandomAlphaNumericSpecialStringStrict(length int) string
- func RandomAlphaNumericString(length int) string
- func RandomAlphaString(length int) string
- func ResolveAppDirectory(appPath, workingDirectory string) (string, error)
- func ResolveAppInstanceData(appID, path string) (models.AppInstanceData, error)
- func UnmarshalFromDir(path string) (map[string]interface{}, error)
- func WriteFileToDir(dest string, data io.Reader) error
- func WriteZipToDir(dest string, zipData io.Reader, overwrite bool) error
- type HTTPClient
- type MediaType
Constants ¶
const ( MediaTypeTextPlain = MediaType("text/plain; charset=utf-8") MediaTypeOctetStream = MediaType("application/octet-stream") MediaTypeHTML = MediaType("text/html") MediaTypeJSON = MediaType("application/json") MediaTypeMultipartFormData = MediaType("multipart/form-data") MediaTypeFormURLEncoded = MediaType("application/x-www-form-urlencoded") MediaTypeZip = MediaType("application/zip") )
The set of known MediaTypes
const (
// FunctionsRoot is the root directory for functions and dependencies
FunctionsRoot = "functions"
)
Variables ¶
var ( // HostingRoot is the root directory for hosting assets and attributes HostingRoot = "hosting" // HostingFilesDirectory is the directory to place the static hosting assets HostingFilesDirectory = fmt.Sprintf("%s/files", HostingRoot) // HostingAttributes is the file that stores the static hosting asset descriptions struct HostingAttributes = fmt.Sprintf("%s/metadata.json", HostingRoot) // HostingCacheFileName is the file that stores the cached hosting asset data HostingCacheFileName = ".asset-cache.json" )
var ( // CLIVersion represents the current version of the CLI. This version is dynamically replaced at build-time CLIVersion = "1.0.0" // CLIOSArch represents the OS Architecture of the CLI. It is used to select the appropriate URL for the CLI // binary based on the user's OS CLIOSArch string )
Functions ¶
func CheckForNewCLIVersion ¶
func CheckForNewCLIVersion(client HTTPClient) string
CheckForNewCLIVersion looks for and returns a url for a new version of the CLI, if one exists. Any errors are swallowed.
func GenerateFileHashStr ¶ added in v1.2.0
GenerateFileHashStr takes a file name and opens and generates a string of the hash.Hash for that file
func GetContentTypeByExtension ¶ added in v1.2.0
GetContentTypeByExtension takes an extension (String) and outputs the default content type used to represent it
func GetDirectoryContainingFile ¶
GetDirectoryContainingFile searches upwards for a valid Stitch app directory
func IsDefaultContentType ¶ added in v1.2.0
IsDefaultContentType that takes a content / MIME type and outputs if it is one of the default content-types in fileName
func RandomAlphaNumericSpecialString ¶
RandomAlphaNumericSpecialString generates a new random alphanumeric key with special characters
func RandomAlphaNumericSpecialStringStrict ¶
RandomAlphaNumericSpecialStringStrict generates a new random alphanumeric key with special characters
func RandomAlphaNumericString ¶
RandomAlphaNumericString generates a new random alphanumeric key
func RandomAlphaString ¶
RandomAlphaString generates a new random alphabetic string of given length
func ResolveAppDirectory ¶ added in v1.5.0
ResolveAppDirectory returns the directory path for an app
func ResolveAppInstanceData ¶ added in v1.5.0
func ResolveAppInstanceData(appID, path string) (models.AppInstanceData, error)
ResolveAppInstanceData loads data for an app from a stitch.json file located in the provided directory path, merging in any overridden parameters from command line flags
func UnmarshalFromDir ¶
UnmarshalFromDir unmarshals a Stitch app from the given directory into a map[string]interface{}
func WriteFileToDir ¶ added in v1.2.0
WriteFileToDir writes the data to dest and creates the necessary directories along the path
Types ¶
type HTTPClient ¶
HTTPClient represents the minimum HTTP client required to check for version information