feat: rest revamp (#2918)
Co-authored-by: Liyas Thomas <liyascthomas@gmail.com> Co-authored-by: Nivedin <53208152+nivedin@users.noreply.github.com> Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
58
packages/hoppscotch-common/src/helpers/rest/document.ts
Normal file
58
packages/hoppscotch-common/src/helpers/rest/document.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { HoppRESTRequest } from "@hoppscotch/data"
|
||||
|
||||
export type HoppRESTSaveContext =
|
||||
| {
|
||||
/**
|
||||
* The origin source of the request
|
||||
*/
|
||||
originLocation: "user-collection"
|
||||
/**
|
||||
* Path to the request folder
|
||||
*/
|
||||
folderPath: string
|
||||
/**
|
||||
* Index to the request
|
||||
*/
|
||||
requestIndex: number
|
||||
}
|
||||
| {
|
||||
/**
|
||||
* The origin source of the request
|
||||
*/
|
||||
originLocation: "team-collection"
|
||||
/**
|
||||
* ID of the request in the team
|
||||
*/
|
||||
requestID: string
|
||||
/**
|
||||
* ID of the team
|
||||
*/
|
||||
teamID?: string
|
||||
/**
|
||||
* ID of the collection loaded
|
||||
*/
|
||||
collectionID?: string
|
||||
}
|
||||
| null
|
||||
|
||||
/**
|
||||
* Defines a live 'document' (something that is open and being edited) in the app
|
||||
*/
|
||||
export type HoppRESTDocument = {
|
||||
/**
|
||||
* The request as it is in the document
|
||||
*/
|
||||
request: HoppRESTRequest
|
||||
|
||||
/**
|
||||
* Whether the request has any unsaved changes
|
||||
* (atleast as far as we can say)
|
||||
*/
|
||||
isDirty: boolean
|
||||
|
||||
/**
|
||||
* Info about where this request should be saved.
|
||||
* This contains where the request is originated from basically.
|
||||
*/
|
||||
saveContext?: HoppRESTSaveContext
|
||||
}
|
||||
Reference in New Issue
Block a user