refactor: update provider method signatures + cleanup
This commit is contained in:
@@ -175,7 +175,7 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
public async createRESTRootCollection(
|
||||
workspaceHandle: HandleRef<Workspace>,
|
||||
newCollection: Partial<HoppCollection>
|
||||
newCollection: Partial<Exclude<HoppCollection, "id">> & { name: string }
|
||||
): Promise<
|
||||
E.Either<
|
||||
WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">,
|
||||
@@ -208,7 +208,7 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
public async createRESTChildCollection(
|
||||
parentCollectionHandle: HandleRef<WorkspaceCollection>,
|
||||
newChildCollection: Partial<HoppCollection>
|
||||
newChildCollection: Partial<HoppCollection> & { name: string }
|
||||
): Promise<
|
||||
E.Either<
|
||||
WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">,
|
||||
|
||||
@@ -49,11 +49,11 @@ export interface WorkspaceProvider {
|
||||
|
||||
createRESTRootCollection(
|
||||
workspaceHandle: HandleRef<Workspace>,
|
||||
newCollection: Partial<HoppCollection>
|
||||
newCollection: Partial<Exclude<HoppCollection, "id">> & { name: string }
|
||||
): Promise<E.Either<unknown, HandleRef<WorkspaceCollection>>>
|
||||
createRESTChildCollection(
|
||||
parentCollectionHandle: HandleRef<WorkspaceCollection>,
|
||||
newChildCollection: Partial<HoppCollection>
|
||||
newChildCollection: Partial<HoppCollection> & { name: string }
|
||||
): Promise<E.Either<unknown, HandleRef<WorkspaceCollection>>>
|
||||
updateRESTCollection(
|
||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||
|
||||
@@ -112,18 +112,17 @@ export class PersonalWorkspaceProviderService
|
||||
|
||||
public createRESTRootCollection(
|
||||
workspaceHandle: HandleRef<Workspace>,
|
||||
newCollection: Partial<HoppCollection>
|
||||
newCollection: Partial<Exclude<HoppCollection, "id">> & { name: string }
|
||||
): Promise<E.Either<unknown, HandleRef<WorkspaceCollection>>> {
|
||||
if (!isValidWorkspaceHandle(workspaceHandle, this.providerID, "personal")) {
|
||||
return Promise.resolve(E.left("INVALID_WORKSPACE_HANDLE" as const))
|
||||
}
|
||||
|
||||
const newCollectionName = newCollection.name as string
|
||||
const newCollectionName = newCollection.name
|
||||
const newCollectionID =
|
||||
this.restCollectionState.value.state.length.toString()
|
||||
|
||||
const newRootCollection = makeCollection({
|
||||
name: newCollectionName,
|
||||
folders: [],
|
||||
requests: [],
|
||||
headers: [],
|
||||
@@ -131,6 +130,7 @@ export class PersonalWorkspaceProviderService
|
||||
authType: "inherit",
|
||||
authActive: false,
|
||||
},
|
||||
...newCollection,
|
||||
})
|
||||
addRESTCollection(newRootCollection)
|
||||
|
||||
@@ -173,7 +173,7 @@ export class PersonalWorkspaceProviderService
|
||||
|
||||
public createRESTChildCollection(
|
||||
parentCollectionHandle: HandleRef<WorkspaceCollection>,
|
||||
newChildCollection: Partial<HoppCollection>
|
||||
newChildCollection: Partial<HoppCollection> & { name: string }
|
||||
): Promise<E.Either<unknown, HandleRef<WorkspaceCollection>>> {
|
||||
if (
|
||||
!isValidCollectionHandle(
|
||||
@@ -188,7 +188,7 @@ export class PersonalWorkspaceProviderService
|
||||
const { collectionID, providerID, workspaceID } =
|
||||
parentCollectionHandle.value.data
|
||||
|
||||
const newCollectionName = newChildCollection.name as string
|
||||
const newCollectionName = newChildCollection.name
|
||||
addRESTFolder(newCollectionName, collectionID)
|
||||
|
||||
platform.analytics?.logEvent({
|
||||
|
||||
Reference in New Issue
Block a user