Clivern / wit-java

🗿Java Library For Wit.ai
https://wit.ai
Apache License 2.0
11 stars 2 forks source link

Unable To Call Methods From their class #77

Closed ahmedsaheed closed 2 years ago

ahmedsaheed commented 2 years ago

Describe the bug Whenever i try to call any method after instantiating its class. It doesn't work. To Reproduce Steps to reproduce the behavior: NOTE: When adding the gradle dependency, i have use implementation 'com.clivern:wit-java:1.0.0' instead of compile 'com.clivern:wit-java:1.0.0'

  1. Create a new class, try instantiate Config like so Config config = new Config(); ''
  2. Now call config.loadPropertiesFile("config.properties"); or config.configLogger();
  3. The loadPropertiesFile or configLogger method is unresolved. Same is applied to wit.send(getApp)
  4. See error

Expected behavior This methods should be callable once instanciated

Screenshots Here you'd see that my editor has highligted those method with red as they are unresolveable. Screenshot 2022-05-03 at 01 56 14

I'm not sure this issue is from my end, any sort of help would be appreciated

Clivern commented 2 years ago

Hi @ahmedsaheed,

Do you have the above code inside a main method! Try to run and see the actual error not the auto completion issues.

package com.base;

import com.clivern.wit.api.App;
import com.clivern.wit.api.endpoint.AppEndpoint;
import com.clivern.wit.util.Config;
import com.clivern.wit.Wit;

public class Main {

    /**
     * @param args The command line arguments.
     **/
    public static void main(String []args) {
      Config config = new Config();
      config.loadPropertiesFile("config.properties");
      config.configLogger();

      Wit wit = new Wit(config);

      App getApp = new App(AppEndpoint.GET);
      // To Use another App Id different from the one on your properties file
      // getApp.setAppId("Your Custom App ID Here");
      // To Use Another Access Token Different From The one on your properties file
      // getApp.setAccessToken("Your Custom Access Token Here");
      String result = "";
      String error = "";

      if( wit.send(getApp) ){
          result = wit.getResponse();
      }else{
          error = wit.getError();
      }     
    }
}
ahmedsaheed commented 2 years ago

Thanks very much. It's all fixed. i neglected the exceptions earlier. Thanks