typesense/typesense-java

Client constructor is package level protected

Closed this issue · 1 comments

Description

org.typesense.api.Client has a package protected constructor.

Client(Configuration configuration){ this.configuration = configuration; this.apiCall = new ApiCall(configuration); collections = new Collections(apiCall); this.individualCollections = new HashMap<>(); this.aliases = new Aliases(this.apiCall); this.individualAliases = new HashMap<>(); this.keys = new Keys(this.apiCall); this.individualKeys = new HashMap<Long, Key>(); this.health = new Health(this.apiCall); this.operations = new Operations(this.apiCall); this.metrics = new Metrics(this.apiCall); this.debug = new Debug(this.apiCall); this.multiSearch = new MultiSearch(this.apiCall); }

so when we try to run: new Client(configuration); from outside the package the error:

error: Client(Configuration) is not public in Client; cannot be accessed from outside package

is displayed.

Steps to reproduce

  1. create a new java project
  2. add typesense-java as dependency
  3. create a method that initiate a TypeSense Client

CleanShot 2022-02-10 at 18 49 40@2x

Expected Behavior

Error: error: Client(Configuration) is not public in Client; cannot be accessed from outside package

Actual Behavior

the constructor should be public or a factor pattern should be used.

Metadata

Typsense Version:

OS:

Fixed in v0.0.2.