/// <summary> /// Returns a list of alerts for a given project with the specified tag. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target project.</param> /// <param name="tagKey">The project tag key to filter the projects.</param> /// <param name="tagValue">The project tag value to filter the projects.</param> /// <returns>Returns a list of alerts for the given organization token filter by the specified tag.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public async Task <List <Alert> > GetAlertsByProjectTagAsync(OrgToken orgToken, string tagKey, string tagValue) { var request = new ProjectTagRequest("getAlertsByProjectTag", UserKey, orgToken: orgToken, tagKey: tagKey, tagValue: tagValue); var response = await request.MakeRequestAsync <AlertsResponse>(this); return(response.Data.Alerts); }
/// <summary> /// Returns a list of alerts for a given organization with the specified type. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <param name="alertType">Type of the alert to use to filter the alerts.</param> /// <param name="fromDate">An optional parameter that filters alerts after this date.</param> /// <param name="toDate">An optional parameter that filters alerts before this date.</param> /// <returns>Returns a list of alerts for the given organization token filtered by the specified type.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public async Task <List <Alert> > GetOrganizationAlertsByTypeAsync(OrgToken orgToken, string alertType, DateTime?fromDate = null, DateTime?toDate = null) { var request = new AlertTypeRequest("getOrganizationAlertsByType", UserKey, orgToken: orgToken, alertType: alertType, fromDate: fromDate, toDate: toDate); var response = await request.MakeRequestAsync <AlertsResponse>(this); return(response.Data.Alerts); }
/// <summary> /// Get basic information regarding all products within the organization: name, token, creation date and last updated date. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <returns>Returns the vitals within the organization for all products.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public async Task <List <Vitals> > GetOrganizationProductVitalsAsync(OrgToken orgToken) { var request = new BaseRequest("getOrganizationProductVitals", UserKey, orgToken: orgToken); var response = await request.MakeRequestAsync <ProductVitalsResponse>(this); return(response.Data.ProductVitals); }
/// <summary> /// Returns a list of alerts for a given organization. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <returns>Returns a list of alerts for the given organization token.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public async Task <List <Alert> > GetOrganizationAlertsAsync(OrgToken orgToken) { var request = new BaseRequest("getOrganizationAlerts", UserKey, orgToken: orgToken); var response = await request.MakeRequestAsync <AlertsResponse>(this); return(response.Data.Alerts); }
/// <summary> /// Returns a list of alerts for a given organization. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <returns>Returns a list of alerts for the given organization token.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public List <Alert> GetOrganizationAlerts(OrgToken orgToken) { var request = new BaseRequest("getOrganizationAlerts", UserKey, orgToken: orgToken); var response = request.MakeRequest <AlertsResponse>(this); return(response.Data.Alerts); }
// TODO: Get All Organizations #endregion Organization Vitals #region Project / Product Vitals /// <summary> /// Returns a list of products for a given organization. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <returns>Returns a list of products for the given organization token.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public async Task <List <Product> > GetAllProductsAsync(OrgToken orgToken) { var request = new BaseRequest("getAllProducts", UserKey, orgToken: orgToken); var response = await request.MakeRequestAsync <ProductsResponse>(this); return(response.Data.Products); }
/// <summary> /// Returns a list of libraries and their licenses for a given organization. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <returns>Returns a list of libraries and their licenses for the given organization token.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public async Task <List <Library> > GetOrganizationLicensesAsync(OrgToken orgToken) { var request = new BaseRequest("getOrganizationLicenses", UserKey, orgToken: orgToken); var response = await request.MakeRequestAsync <LicensesResponse>(this); return(response.Data.Libraries); }
/// <summary> /// Get basic information regarding all products within the organization: name, token, creation date and last updated date. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <returns>Returns the vitals within the organization for all products.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public List <Vitals> GetOrganizationProductVitals(OrgToken orgToken) { var request = new BaseRequest("getOrganizationProductVitals", UserKey, orgToken: orgToken); var response = request.MakeRequest <ProductVitalsResponse>(this); return(response.Data.ProductVitals); }
// TODO: Get All Organizations #endregion Organization Vitals #region Project / Product Vitals /// <summary> /// Returns a list of products for a given organization. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <returns>Returns a list of products for the given organization token.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public List <Product> GetAllProducts(OrgToken orgToken) { var request = new BaseRequest("getAllProducts", UserKey, orgToken: orgToken); var response = request.MakeRequest <ProductsResponse>(this); return(response.Data.Products); }
/// <summary> /// Returns a dictionary of licenses and counts for a given organization. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <returns>Returns a dictionary of licenses and counts for a given organization.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public Dictionary <string, int> GetOrganizationLicenseHistogram(OrgToken orgToken) { var request = new BaseRequest("getOrganizationLicenseHistogram", UserKey, orgToken: orgToken); var response = request.MakeRequest <LicensesHistogramResponse>(this); return(response.Data.LicenseHistogram); }
/// <summary> /// Returns a list of libraries and their licenses for a given organization. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <returns>Returns a list of libraries and their licenses for the given organization token.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public List <Library> GetOrganizationLicenses(OrgToken orgToken) { var request = new BaseRequest("getOrganizationLicenses", UserKey, orgToken: orgToken); var response = request.MakeRequest <LicensesResponse>(this); return(response.Data.Libraries); }
public ProjectTagRequest( string requestType, string userKey, OrgToken orgToken, string tagKey, string tagValue) : base(requestType, userKey, orgToken, null, null) { TagKey = tagKey; TagValue = tagValue; }
public BaseRequest( string requestType, string userKey, OrgToken orgToken = null, ProductToken productToken = null, ProjectToken projectToken = null) { RequestType = requestType ?? throw new ArgumentNullException(nameof(requestType)); UserKey = userKey; OrgToken = orgToken; ProductToken = productToken; ProjectToken = projectToken; }
public ServiceIntegrationTests() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile("appsettings.test.json", optional: true, reloadOnChange: true); var configuration = builder.Build(); OrgToken = new OrgToken(configuration.GetSection("whitesource:orgToken").Value); ProductToken = new ProductToken(configuration.GetSection("whitesource:productToken").Value); ProjectToken = new ProjectToken(configuration.GetSection("whitesource:projectToken").Value); LibraryUuid = configuration.GetSection("whitesource:libraryUuid").Value; service = new WhitesourceService(configuration.GetSection("whitesource:userKey").Value, configuration.GetSection("whitesource:url").Value); }
public AlertTypeRequest( string requestType, string userKey, OrgToken orgToken = null, ProductToken productToken = null, ProjectToken projectToken = null, string alertType = null, DateTime?fromDate = null, DateTime?toDate = null) : base(requestType, userKey, orgToken, productToken, projectToken) { AlertType = alertType; FromDate = fromDate; ToDate = toDate; }
/// <summary> /// Returns a dictionary of licenses and counts for a given organization. /// </summary> /// <param name="orgToken">The Whitesource organization token for the target organization.</param> /// <returns>Returns a dictionary of licenses and counts for a given organization.</returns> /// <exception cref="WhitesourceRequestException">Thrown if an exception occurs calling Whitesource service.</exception> public async Task <Dictionary <string, int> > GetOrganizationLicenseHistogramAsync(OrgToken orgToken) { var request = new BaseRequest("getOrganizationLicenseHistogram", UserKey, orgToken: orgToken); var response = await request.MakeRequestAsync <LicensesHistogramResponse>(this); return(response.Data.LicenseHistogram); }