Moco constructor

Moco(
  1. String applicationUrl, {
  2. MocoOpts? options,
})

Constructor

Implementation

Moco(String applicationUrl, {MocoOpts? options}) {
  this.appsUrl = applicationUrl;
  if (options != null) {
    var a =
        options.options!.payloadEncryption!.enforcement!.contains("COMMON");
    var prefix = options.options?.tokenStorageKeyPrefix != null;
    this.client = HttpRequestClass(
        appUrl: applicationUrl,
        commonEnc: a,
        storagePrefix:
            prefix ? options.options?.tokenStorageKeyPrefix! : null,
        options: options);

    if (prefix) {
      prefixAccessToken =
          options.options!.tokenStorageKeyPrefix! + "accessToken";
      prefixRefreshToken =
          options.options!.tokenStorageKeyPrefix! + "refreshToken";
      prefixExpiry = options.options!.tokenStorageKeyPrefix! + "expiry";
    }
  } else {
    this.client = HttpRequestClass(appUrl: applicationUrl, options: options);
  }

  this.auth = Auth(applicationUrl, options, this.client);
  this.user = User(applicationUrl, options, this.client);
  this._invoke = Invoke(applicationUrl, options, this.client);
  this.gql = Graphql(applicationUrl, options, this.client);
  this.storage = Storage(applicationUrl, options, this.client);
}