Search API - uoftblueprint/sistema GitHub Wiki
Helpful pages:
- JS types: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures (JS is not strongly typed but let's be certain of what values are expected and retrieved)
Searching
/<searchActivityCards(search: string)/>
- Given some user input, generate a list of activity cards in the Sistema Curriculum Materials folder. Cap results at Constants.maxSearch which is an int determining the max number of suggested activity cards per search.
- Google API:
files.list<- will specify .jpg - Not calling any ios/android RNFS features
- Stores/modifies nothing on RNFS
- Retrieves nothing from RNFS
- Deletes nothing from RNFS
Signature
static searchActivityCards(search: string): Array
Return
- Returns Array <- Array of ids: you can later access file with get method
/<getActivityCardPreview(id: string)/>
- Get a preview of a requested activity card from Drive
- Using blob
- Not calling any ios/android RNFS features
- Stores/modifies nothing on RNFS
- Retrieves nothing from RNFS
- Deletes nothing from RNFS
Signature
static getActivityCards(search: string): Blob
Returns
- Blob
/<downloadActivityCard(id: string)/>
- Downloads an activity card from Drive. Returns a local path to the image.
- Calls
files.getfrom Drive to download file. - React Native Fs
mkdir(filepath: string, options?: MkdirOptions)<- if a directory is not already made for organization - React Native Fs
exists(filepath: string)<- check if it is already in the directory - React Native Fs
writeFile(filepath: string, contents: string, encoding?: string) - Not using any android or iOS specific RNFS
- Stores activity card in RNFS
- Checks if a filepath already exists
Signature
static downloadActivityCard(id: string): Returns string
Return
- String
/<deleteActivityCard(filepath: string)/>
- Delete an activity card image file stored in RNFS, throws error otherwise
- React Native FS
unlink(filepath: string)<- to delete a file path - Deletes image from RNFS
Signature
static deleteActivityCards(filepath: string): Promise
Return
- Promise
/<copyLessonPlan(filepath: string)/>
- Copy/duplicate a lesson plan and return the new filepath. Throw an error if the lesson plan being copied doesn’t exist.
- React Native FS
exists(filepath: string)<- check if the file path exists, throw error if not - React Native
copyFile(filepath: string, destPath: string) - Retrieves whatever is stored at filepath from RNFS
- Stores copy in RNFS
Signature
static copyActivityCards(filepath: string): String
Returns
- String