Skip to content

Commit

Permalink
fix: remove all methods that are not implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniAkash committed Mar 4, 2024
1 parent 6d3eb30 commit 5b72da1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 72 deletions.
28 changes: 0 additions & 28 deletions src/client/auth/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,34 +112,6 @@ export class ClarifaiAuthHelper {
}
}

/**
* TODO: This method cannot be directly implemented in Node.js TypeScript as there is no equivalent of Streamlit.
* A similar functionality might be achieved by using environment variables and additional parameters from a web framework like Express.js.
*/
static fromStreamlit(/* parameters, if any */): ClarifaiAuthHelper {
// Method logic goes here
throw new Error("Method not implemented.");
}

/**
* TODO: This method cannot be directly implemented in Node.js TypeScript as it's specific to Streamlit.
* In a Node.js environment, similar functionality could be achieved using query parameters from HTTP requests.
*/
static fromStreamlitQueryParams(/* parameters, if any */): ClarifaiAuthHelper {
// Method logic goes here
throw new Error("Method not implemented.");
}

/**
* TODO: This method is specific to Streamlit and cannot be directly implemented in Node.js TypeScript.
* Similar functionality might be possible by handling query parameters in a Node.js web framework.
*/
// @ts-expect-error this method is not yet implemented
private addStreamlitQueryParams(/* parameters, if any */): void {
// Method logic goes here
throw new Error("Method not implemented.");
}

/**
* Will look for the following environment variables:
* - user_id: CLARIFAI_USER_ID environment variable.
Expand Down
46 changes: 2 additions & 44 deletions src/client/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import { StatusCode } from "clarifai-nodejs-grpc/proto/clarifai/api/status/status_code_pb";
import { Lister } from "./lister";
import { AuthConfig, RequestParams } from "../utils/types";
import {
Expand All @@ -8,38 +7,16 @@ import {
MultiRunnerResponse,
PostAppsRequest,
} from "clarifai-nodejs-grpc/proto/clarifai/api/service_pb";
import {
mapParamsToRequest,
mergeObjects,
promisifyGrpcCall,
} from "../utils/misc";
// import { logger } from "../utils/logging";
import { mapParamsToRequest, promisifyGrpcCall } from "../utils/misc";
import {
App,
Workflow,
} from "clarifai-nodejs-grpc/proto/clarifai/api/resources_pb";
import { App as ClarifaiApp } from "./app";
import { StatusCode } from "clarifai-nodejs-grpc/proto/clarifai/api/status/status_code_pb";

// interface UserAppID {
// userId?: string;
// appId?: string;
// }

// interface AppInfo {
// // Define properties based on the Python code's usage
// }

// interface RunnerInfo {
// // Define properties based on the Python code's usage
// }

export class User extends Lister {
// private logger;

constructor(authConfig: AuthConfig = {}) {
super({ authConfig });
// this.logger = logger;
}

async *listApps({
Expand Down Expand Up @@ -102,11 +79,9 @@ export class User extends Lister {
async createApp({
appId,
baseWorkflow = "Empty",
authConfig = {},
}: {
appId: string;
baseWorkflow: string;
authConfig: AuthConfig;
}) {
const workflow = new Workflow();
workflow.setId(baseWorkflow);
Expand Down Expand Up @@ -136,23 +111,6 @@ export class User extends Lister {
);
}

// this.logger.info(
// `App created. Status Code: ${responseObject.status?.code}`,
// );

authConfig = mergeObjects(authConfig, {
userId: this.userAppId.getUserId(),
base: this.base,
pat: this.pat,
appId: responseObject.appsList?.[0]?.id,
});

return new ClarifaiApp({ authConfig });
}

// TypeScript does not have a direct equivalent to Python's __getattr__, so this functionality may need to be implemented differently if required.

toString() {
// Implementation of a method to return user details as a string
return responseObject;
}
}

0 comments on commit 5b72da1

Please sign in to comment.