Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose Directory Create Transport #78

Merged
merged 1 commit into from
Apr 11, 2024
Merged

expose Directory Create Transport #78

merged 1 commit into from
Apr 11, 2024

Conversation

gimmyxd
Copy link
Member

@gimmyxd gimmyxd commented Apr 11, 2024

Utility method to enable extending the directory v3 class with addition gRPC clients.
Using CreateTransport we ensure that the service is validated and initialed correctly.
eg:

class Ds0 extends DirectoryV3 {
  StoreClient: PromiseClient<typeof Store>

  constructor(config: DirectoryV3Config) {
    super(config)
    const storeTransport = this.CreateTransport(config, undefined)
    this.StoreClient = createPromiseClient(Store, storeTransport!)
  }

  async createTenant(params: PartialMessage<CreateTenantRequest>) {
    try {
      const response = await this.StoreClient.createTenant(params)

      return response.result
    } catch (error) {
      handleError(error, 'createTenant')
    }
  }
}

@gimmyxd gimmyxd merged commit d5403d0 into main Apr 11, 2024
5 checks passed
@gimmyxd gimmyxd deleted the expose_create_transport branch April 11, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant