refactor: update provider method signatures
This commit is contained in:
@@ -479,7 +479,7 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
public async reorderRESTCollection(
|
||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||
destinationCollectionIndex: string | null
|
||||
destinationCollectionID: string | null
|
||||
): Promise<
|
||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||
> {
|
||||
@@ -497,7 +497,7 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
const result = await provider.reorderRESTCollection(
|
||||
collectionHandle,
|
||||
destinationCollectionIndex
|
||||
destinationCollectionID
|
||||
)
|
||||
|
||||
if (E.isLeft(result)) {
|
||||
@@ -509,7 +509,7 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
public async moveRESTCollection(
|
||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||
destinationCollectionIndex: string | null
|
||||
destinationCollectionID: string | null
|
||||
): Promise<
|
||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||
> {
|
||||
@@ -527,7 +527,7 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
const result = await provider.moveRESTCollection(
|
||||
collectionHandle,
|
||||
destinationCollectionIndex
|
||||
destinationCollectionID
|
||||
)
|
||||
|
||||
if (E.isLeft(result)) {
|
||||
@@ -539,8 +539,8 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
public async reorderRESTRequest(
|
||||
requestHandle: HandleRef<WorkspaceRequest>,
|
||||
destinationCollectionIndex: string,
|
||||
destinationRequestIndex: string | null
|
||||
destinationCollectionID: string,
|
||||
destinationRequestID: string | null
|
||||
): Promise<
|
||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||
> {
|
||||
@@ -558,8 +558,8 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
const result = await provider.reorderRESTRequest(
|
||||
requestHandle,
|
||||
destinationCollectionIndex,
|
||||
destinationRequestIndex
|
||||
destinationCollectionID,
|
||||
destinationRequestID
|
||||
)
|
||||
|
||||
if (E.isLeft(result)) {
|
||||
@@ -571,7 +571,7 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
public async moveRESTRequest(
|
||||
requestHandle: HandleRef<WorkspaceRequest>,
|
||||
destinationCollectionIndex: string
|
||||
destinationCollectionID: string
|
||||
): Promise<
|
||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||
> {
|
||||
@@ -589,7 +589,7 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
const result = await provider.moveRESTRequest(
|
||||
requestHandle,
|
||||
destinationCollectionIndex
|
||||
destinationCollectionID
|
||||
)
|
||||
|
||||
if (E.isLeft(result)) {
|
||||
|
||||
@@ -89,19 +89,19 @@ export interface WorkspaceProvider {
|
||||
|
||||
reorderRESTCollection(
|
||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||
destinationCollectionIndex: string | null
|
||||
destinationCollectionID: string | null
|
||||
): Promise<E.Either<unknown, void>>
|
||||
moveRESTCollection(
|
||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||
destinationCollectionIndex: string | null
|
||||
destinationCollectionID: string | null
|
||||
): Promise<E.Either<unknown, void>>
|
||||
reorderRESTRequest(
|
||||
requestHandle: HandleRef<WorkspaceRequest>,
|
||||
destinationCollectionIndex: string,
|
||||
destinationRequestIndex: string | null
|
||||
destinationCollectionID: string,
|
||||
destinationRequestID: string | null
|
||||
): Promise<E.Either<unknown, void>>
|
||||
moveRESTRequest(
|
||||
requestHandle: HandleRef<WorkspaceRequest>,
|
||||
destinationCollectionIndex: string
|
||||
destinationCollectionID: string
|
||||
): Promise<E.Either<unknown, void>>
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ export class PersonalWorkspaceProviderService
|
||||
|
||||
public reorderRESTCollection(
|
||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||
destinationCollectionIndex: string | null
|
||||
destinationCollectionID: string | null
|
||||
): Promise<E.Either<unknown, void>> {
|
||||
if (
|
||||
collectionHandle.value.type !== "ok" ||
|
||||
@@ -502,17 +502,14 @@ export class PersonalWorkspaceProviderService
|
||||
|
||||
const draggedCollectionIndex = collectionHandle.value.data.collectionID
|
||||
|
||||
updateRESTCollectionOrder(
|
||||
draggedCollectionIndex,
|
||||
destinationCollectionIndex
|
||||
)
|
||||
updateRESTCollectionOrder(draggedCollectionIndex, destinationCollectionID)
|
||||
|
||||
return Promise.resolve(E.right(undefined))
|
||||
}
|
||||
|
||||
public moveRESTCollection(
|
||||
collectionHandle: HandleRef<WorkspaceCollection>,
|
||||
destinationCollectionIndex: string | null
|
||||
destinationCollectionID: string | null
|
||||
): Promise<E.Either<unknown, void>> {
|
||||
if (
|
||||
collectionHandle.value.type !== "ok" ||
|
||||
@@ -524,7 +521,7 @@ export class PersonalWorkspaceProviderService
|
||||
|
||||
moveRESTFolder(
|
||||
collectionHandle.value.data.collectionID,
|
||||
destinationCollectionIndex
|
||||
destinationCollectionID
|
||||
)
|
||||
|
||||
return Promise.resolve(E.right(undefined))
|
||||
@@ -532,8 +529,8 @@ export class PersonalWorkspaceProviderService
|
||||
|
||||
public reorderRESTRequest(
|
||||
requestHandle: HandleRef<WorkspaceRequest>,
|
||||
destinationCollectionIndex: string,
|
||||
destinationRequestIndex: string | null
|
||||
destinationCollectionID: string,
|
||||
destinationRequestID: string | null
|
||||
): Promise<E.Either<unknown, void>> {
|
||||
if (
|
||||
requestHandle.value.type !== "ok" ||
|
||||
@@ -547,10 +544,8 @@ export class PersonalWorkspaceProviderService
|
||||
|
||||
updateRESTRequestOrder(
|
||||
this.pathToLastIndex(draggedRequestIndex),
|
||||
destinationRequestIndex
|
||||
? this.pathToLastIndex(destinationRequestIndex)
|
||||
: null,
|
||||
destinationCollectionIndex
|
||||
destinationRequestID ? this.pathToLastIndex(destinationRequestID) : null,
|
||||
destinationCollectionID
|
||||
)
|
||||
|
||||
return Promise.resolve(E.right(undefined))
|
||||
@@ -558,7 +553,7 @@ export class PersonalWorkspaceProviderService
|
||||
|
||||
public moveRESTRequest(
|
||||
requestHandle: HandleRef<WorkspaceRequest>,
|
||||
destinationCollectionIndex: string
|
||||
destinationCollectionID: string
|
||||
): Promise<E.Either<unknown, void>> {
|
||||
if (
|
||||
requestHandle.value.type !== "ok" ||
|
||||
@@ -577,7 +572,7 @@ export class PersonalWorkspaceProviderService
|
||||
moveRESTRequest(
|
||||
parentCollectionIndexPath,
|
||||
this.pathToLastIndex(requestIndex),
|
||||
destinationCollectionIndex
|
||||
destinationCollectionID
|
||||
)
|
||||
|
||||
return Promise.resolve(E.right(undefined))
|
||||
|
||||
Reference in New Issue
Block a user