/// <summary> /// /// </summary> /// <param name="address"></param> /// <param name="key"></param> /// <param name="collections"></param> /// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None"/>.</param> /// <returns></returns> public async Task <ThreadId> NewDbFromAdd(string address, string key, IList <Models.CollectionInfo> collections, CancellationToken cancellationToken = default) { Multiaddress addr = Multiaddress.Decode(address); byte[] keyBytes = ThreadKey.FromString(key).Bytes; NewDBFromAddrRequest request = new() { Addr = ByteString.CopyFrom(addr.ToBytes()), Key = ByteString.CopyFrom(keyBytes) }; if (collections != null) { //TODO: Finish mapping request.Collections.AddRange(collections.Select(c => { return(_mapper.Map <Grpc.CollectionConfig>(c)); }).ToArray()); } await _apiClient.NewDBFromAddrAsync(request, headers : _threadContext.Metadata, cancellationToken : cancellationToken); //TODO: Get the threadID and Address string threadId = string.Empty; return(ThreadId.FromString(threadId)); }