@apistudio/apim-cli
Version:
CLI for API Management Products
59 lines • 2.65 kB
TypeScript
/**
* Copyright Super iPaaS Integration LLC, an IBM Company 2024
*/
import { FileAccessType } from "../api-authoring/interfaces/api-spec-handler.interface.js";
import { ApiScopeInfo } from "../api-authoring/store/api-scope-context.model.js";
import { Metadata } from "../common/models/base-asset.model.js";
export declare enum SupportedMethods {
GET = "get",
POST = "post",
PUT = "put",
DELETE = "delete",
PATCH = "patch",
OPTIONS = "options"
}
export interface ScopedPaths {
[key: string]: SupportedMethods[];
}
export interface Scope {
metadata: Metadata;
scopedPaths?: ScopedPaths;
}
export interface IScopeHandler {
/**
* Creates a scope file with provided metadata in the project and links it in the provided apiFile
* @param metadata The metadata of scope.
* @param apiFile FileHandle or VCSFileInfo in which the newly created scope would be referenced
* @returns Returns the FileHandle or VCSFileInfo of created scope
*/
createScope(metadata: Metadata, apiFile: FileAccessType): Promise<FileAccessType>;
/**
* Overwrites the scopeFile content with updatedScope data.
* Also updates entry in apiFile if metatdata of scope has changed.
* @param scopeFile FileHandle or VCSFileInfo of kind Scope file
* @param udpatedScope Updated scope that should be written in scopeFile
* @param apiFile FileHandle or VCSFileInfo of api where updated scope would be referred
*/
updateScope(scopeFile: FileAccessType, udpatedScope: Scope, apiFile: FileAccessType): Promise<void>;
/**
* Returns the overall scope object parsed from scopeFile.
* @param scopeFile FileHandle or VCSFileInfo of kind Scope file
* @returns Scope object with metadata and list of scopedPaths
*/
getScope(scopeFile: FileAccessType): Promise<Scope>;
/**
* Removes the scopeFile from project folder and its entry from apiFile
* @param scopeFile FileHandle or VCSFileInfo of kind Scope file
* @param scopeMetadata Metadata of scope file to be deleted
* @param apiFile FileHandle or VCSFileInfo of api where deleted scope entry should be removed
*/
deleteScope(scopeFile: FileAccessType, scopeMetadata: Metadata, apiFile: FileAccessType): Promise<void>;
/**
* Checks if the 2 given scopes are same and returns the match state
* @param scopeInfo1 Scope info to check match
* @param scopeInfo2 Other scope to check match
* @returns True if a match, else false
*/
isMatchingScope(scopeInfo1: ApiScopeInfo, scopeInfo2: ApiScopeInfo): boolean;
}
//# sourceMappingURL=IScopeHandler.d.ts.map