<commit_before>package reports

import (
	"net/url"
	"strconv"
)

const (
	// ReportGetSBOMEndpoint is the endpoint for generating SBOMs
	ReportGetSBOMEndpoint = "v1/report/getSBOM"
)

// SBOMFormat is a string enum for the accepted SBOM formats that we can export
type SBOMFormat string

const (
	// SBOMFormatSPDX is the enum value for the SPDX SBOM format
	SBOMFormatSPDX SBOMFormat = "SPDX"
	// SBOMFormatCycloneDX is the enum value for the CycloneDX SBOM format
	SBOMFormatCycloneDX SBOMFormat = "CycloneDX"
)

// SBOMExportOptions represents all the different settings a user can specify for how the SBOM is exported.
// Specify only one of the following data sources to generate the SBOM from:
//  * ProjectIDs (a slice of one or more project IDs)
//  * TeamID (the ID of a team containing one or more projects; this will use all the team's projects)
//  * SBOMID (the ID of a software list containing one or more components; this will use all the list's components)
//  * SBOMEntryIDs (a slice of one or more software list component IDs)
// Format (required) specifies which format/standard the SBOM will be exported in.
// IncludeDependencies will include all the direct and transitive dependencies of each item in the SBOM if true,
// or exclude all the dependencies if false, leaving only the items themselves.
// TeamIsTopLevel applies only to SBOMs generated using the TeamID field. If true, the top-level item in the SBOM's
// hierarchy will be the team. If false, all the team's projects will be on the top level of the hierarchy.
type SBOMExportOptions struct {
	ProjectIDs   []string `json:"ids"`
	TeamID       string   `json:"team_id"`
	SBOMID       string   `json:"sbom_id"`
	SBOMEntryIDs []string `json:"sbom_entry_ids"`

	Format              SBOMFormat `json:"sbom_type"`
	IncludeDependencies bool       `json:"include_dependencies"`
	TeamIsTopLevel      bool       `json:"team_top_level"`
}

// Params converts an SBOMExportOptions object into a URL param object for use in making an API request
func (options SBOMExportOptions) Params() url.Values {
	params := url.Values{}
	params.Set("sbom_type", string(options.Format))
	params.Set("include_dependencies", strconv.FormatBool(options.IncludeDependencies))
	params.Set("team_top_level", strconv.FormatBool(options.TeamIsTopLevel))<commit_msg>Adding an enum for new gitlab sbom type<commit_after>package reports

import (
	"net/url"
	"strconv"
)

const (
	// ReportGetSBOMEndpoint is the endpoint for generating SBOMs
	ReportGetSBOMEndpoint = "v1/report/getSBOM"
)

// SBOMFormat is a string enum for the accepted SBOM formats that we can export
type SBOMFormat string

const (
	// SBOMFormatSPDX is the enum value for the SPDX SBOM format
	SBOMFormatSPDX SBOMFormat = "SPDX"
	// SBOMFormatCycloneDX is the enum value for the CycloneDX SBOM format
	SBOMFormatCycloneDX SBOMFormat = "CycloneDX"
	// SBOMFormatGitlab is the enum value for the Gitlab SBOM format
	SBOMFormatGitlab SBOMFormat = "Gitlab"
)

// SBOMExportOptions represents all the different settings a user can specify for how the SBOM is exported.
// Specify only one of the following data sources to generate the SBOM from:
//  * ProjectIDs (a slice of one or more project IDs)
//  * TeamID (the ID of a team containing one or more projects; this will use all the team's projects)
//  * SBOMID (the ID of a software list containing one or more components; this will use all the list's components)
//  * SBOMEntryIDs (a slice of one or more software list component IDs)
// Format (required) specifies which format/standard the SBOM will be exported in.
// IncludeDependencies will include all the direct and transitive dependencies of each item in the SBOM if true,
// or exclude all the dependencies if false, leaving only the items themselves.
// TeamIsTopLevel applies only to SBOMs generated using the TeamID field. If true, the top-level item in the SBOM's
// hierarchy will be the team. If false, all the team's projects will be on the top level of the hierarchy.
type SBOMExportOptions struct {
	ProjectIDs   []string `json:"ids"`
	TeamID       string   `json:"team_id"`
	SBOMID       string   `json:"sbom_id"`
	SBOMEntryIDs []string `json:"sbom_entry_ids"`

	Format              SBOMFormat `json:"sbom_type"`
	IncludeDependencies bool       `json:"include_dependencies"`
	TeamIsTopLevel      bool       `json:"team_top_level"`
}

// Params converts an SBOMExportOptions object into a URL param object for use in making an API request
func (options SBOMExportOptions) Params() url.Values {
	params := url.Values{}
	params.Set("sbom_type", string(options.Format))
	params.Set("include_dependencies", strconv.FormatBool(options.IncludeDependencies))
	params.Set("team_top_level", strconv.FormatBool(options.TeamIsTopLevel))
{'fraction_non_alphanumeric': 0.07283795130142737, 'fraction_numerical': 0.00041981528127623844, 'mean_word_length': 4.253583241455347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6134195', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1343, 'n_words': 573}