docs: consolidate docs (#2182)

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2022-07-21 22:36:46 +02:00 committed by GitHub
parent 8d46d7e39e
commit ecffebc43c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
307 changed files with 1474 additions and 487 deletions

View file

@ -11,8 +11,10 @@ import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-ap
/**
* Retrieves the content and metadata about the specified note.
*
* @param noteIdOrAlias The id or alias of the note.
* @return Content and metadata of the specified note.
* @throws {Error} when the api request wasn't successful.
*/
export const getNote = async (noteIdOrAlias: string): Promise<Note> => {
const response = await new GetApiRequestBuilder<Note>('notes/' + noteIdOrAlias)
@ -23,8 +25,10 @@ export const getNote = async (noteIdOrAlias: string): Promise<Note> => {
/**
* Returns a list of media objects associated with the specified note.
*
* @param noteIdOrAlias The id or alias of the note.
* @return List of media object metadata associated with specified note.
* @throws {Error} when the api request wasn't successful.
*/
export const getMediaForNote = async (noteIdOrAlias: string): Promise<MediaUpload[]> => {
const response = await new GetApiRequestBuilder<MediaUpload[]>(`notes/${noteIdOrAlias}/media`).sendRequest()
@ -33,8 +37,10 @@ export const getMediaForNote = async (noteIdOrAlias: string): Promise<MediaUploa
/**
* Creates a new note with a given markdown content.
*
* @param markdown The content of the new note.
* @return Content and metadata of the new note.
* @throws {Error} when the api request wasn't successful.
*/
export const createNote = async (markdown: string): Promise<Note> => {
const response = await new PostApiRequestBuilder<Note, void>('notes')
@ -46,9 +52,11 @@ export const createNote = async (markdown: string): Promise<Note> => {
/**
* Creates a new note with a given markdown content and a defined primary alias.
*
* @param markdown The content of the new note.
* @param primaryAlias The primary alias of the new note.
* @return Content and metadata of the new note.
* @throws {Error} when the api request wasn't successful.
*/
export const createNoteWithPrimaryAlias = async (markdown: string, primaryAlias: string): Promise<Note> => {
const response = await new PostApiRequestBuilder<Note, void>('notes/' + primaryAlias)
@ -60,7 +68,9 @@ export const createNoteWithPrimaryAlias = async (markdown: string, primaryAlias:
/**
* Deletes the specified note.
*
* @param noteIdOrAlias The id or alias of the note to delete.
* @throws {Error} when the api request wasn't successful.
*/
export const deleteNote = async (noteIdOrAlias: string): Promise<void> => {
await new DeleteApiRequestBuilder('notes/' + noteIdOrAlias).sendRequest()