private void CopyCommandLineArgs() { if (CommandLineParser.CommandLineArgs.TryGetValue("organizationid", out var orgID)) { OrganizationID = orgID; } if (CommandLineParser.CommandLineArgs.TryGetValue("serverurl", out var serverUrl)) { ServerUrl = serverUrl; } if (CommandLineParser.CommandLineArgs.TryGetValue("devicegroup", out var deviceGroup)) { DeviceGroup = deviceGroup; } if (CommandLineParser.CommandLineArgs.TryGetValue("devicealias", out var deviceAlias)) { DeviceAlias = deviceAlias; } if (CommandLineParser.CommandLineArgs.TryGetValue("deviceuuid", out var deviceUuid)) { DeviceUuid = deviceUuid; } if (ServerUrl?.EndsWith("/") == true) { ServerUrl = ServerUrl.Substring(0, ServerUrl.LastIndexOf("/")); } }
private string CreateUrl(string path, params string[] pathParams) { var url = new StringBuilder(); url.Append(ServerUrl); if (!ServerUrl.EndsWith("/")) { url.Append("/"); } url.Append("api/v4"); if (!path.StartsWith("/")) { url.Append("/"); } var escapedPathParams = pathParams .Select(x => Uri.EscapeDataString(x)) .ToArray(); url.Append(string.Format(path, escapedPathParams)); return(url.ToString()); }
private void SetupOAuth() { OAuthTokenServer = Settings["Raven/OAuthTokenServer"] ?? (ServerUrl.EndsWith("/") ? ServerUrl + "OAuth/API-Key" : ServerUrl + "/OAuth/API-Key"); OAuthTokenCertificate = GetCertificate(); }
private Uri GetApiBaseUrl() { var separator = ServerUrl.EndsWith('/') ? string.Empty : "/"; return(new Uri($"{ServerUrl}{separator}{ProjectCollection}/")); }