private async Task RegisterWithServer() { // note: the terms of service is automatically populated from directory.meta.terms-of-service when null var registration = await client.RegisterAsync(new NewRegistrationRequest { Agreement = options.AcceptTermsOfService ? options.TermsOfServiceUri : null, Contact = new[] { options.Contact } }); Log.Verbose($"Created at: {registration.CreatedAt}"); Log.Verbose($"Id: {registration.Id}"); Log.Verbose($"Contact: {string.Join(", ", registration.Contact)}"); Log.Verbose($"Initial Ip: {registration.InitialIp}"); if (!string.IsNullOrWhiteSpace(registration.Location) && options.AcceptTermsOfService) { Log.Info("accepting terms of service"); if (registration.Agreement != options.TermsOfServiceUri) { Log.Error($"Cannot accept terms of service. The terms of service uri is '{registration.Agreement}', expected it to be '{options.TermsOfServiceUri}'."); return; } await client.UpdateRegistrationAsync(new UpdateRegistrationRequest( location : registration.Location, agreement : registration.Agreement, contact : new[] { options.Contact } )); } }
private async Task RegisterWithServer() { var registration = await client.RegisterAsync(options.AcceptTermsOfService?options.TermsOfServiceUri : null, new[] { options.Contact }); Info($"Terms of service: {registration.Agreement}"); Verbose($"Created at: {registration.CreatedAt}"); Verbose($"Id: {registration.Id}"); Verbose($"Contact: {string.Join(", ", registration.Contact)}"); Verbose($"Initial Ip: {registration.InitialIp}"); if (!string.IsNullOrWhiteSpace(registration.Location) && options.AcceptTermsOfService) { Info("accepting terms of service"); if (!string.Equals(registration.Agreement, options.TermsOfServiceUri)) { Error($"Cannot accept terms of service. The terms of service uri is '{registration.Agreement}', expected it to be '{options.TermsOfServiceUri}'."); return; } await client.UpdateRegistrationAsync(registration.Location, registration.Agreement, new[] { options.Contact }); } }
async Task RegisterWithServer() { var registration = await _client.RegisterAsync(_termsOfServiceUri, new[] { "mailto:" + _email }); Log.Info($"Terms of service: {registration.Agreement}"); Log.Verbose($"Created at: {registration.CreatedAt}"); Log.Verbose($"Id: {registration.Id}"); Log.Verbose($"Contact: {string.Join(", ", registration.Contact)}"); Log.Verbose($"Initial Ip: {registration.InitialIp}"); if (!string.IsNullOrWhiteSpace(registration.Location)) { Log.Info("accepting terms of service"); if (!string.Equals(registration.Agreement, _termsOfServiceUri)) { Log.Error($"Cannot accept terms of service. The terms of service uri is '{registration.Agreement}', expected it to be '{_termsOfServiceUri}'."); return; } await _client.UpdateRegistrationAsync(registration.Location, registration.Agreement, new[] { "mailto:" + _email }); } }