package
0.0.0-20241219120101-d8a5f49ad328
Repository: https://github.com/fossology/licensedb.git
Documentation: pkg.go.dev
# Functions
CreateLicense creates a new license in the database.
CreateObligation creates a new obligation record and associates it with relevant licenses.
CreateObligationClassification creates a new obligation classification.
CreateObligationType creates a new obligation type.
DeleteObligation marks an existing obligation record as inactive
@Summary Deactivate obligation @Description Deactivate an obligation @Id DeleteObligation @Tags Obligations @Accept json @Produce json @Param topic path string true "Topic of the obligation to be updated" @Success 204 @Failure 404 {object} models.LicenseError "No obligation with given topic found" @Security ApiKeyAuth @Router /obligations/{topic} [delete].
DeleteObligationClassification marks an existing obligation classification record as inactive
@Summary Deactivate obligation classification @Description Deactivate an obligation classification @Id DeleteObligationClassification @Tags Obligations @Accept json @Produce json @Param classification path string true "Obligation Classification" @Success 200 @Failure 400 {object} models.LicenseError "cannot delete obligation classification 'GREEN' as it's still referenced by some obligations" @Failure 404 {object} models.LicenseError "obligation classification 'GREEN' not found" @Failure 500 {object} models.LicenseError "something went wrong while deleting obligation classification" @Security ApiKeyAuth @Router /obligations/classifications/{classification} [delete].
DeleteObligationType marks an existing obligation type record as inactive
@Summary Deactivate obligation type @Description Deactivate an obligation type @Id DeleteObligationType @Tags Obligations @Accept json @Produce json @Param type path string true "Obligation Type" @Success 200 @Failure 400 {object} models.LicenseError "cannot delete obligation type 'RISK' as it's still referenced by some obligations" @Failure 404 {object} models.LicenseError "obligation type 'RISK' not found" @Failure 500 {object} models.LicenseError "something went wrong while deleting obligation type" @Security ApiKeyAuth @Router /obligations/types/{type} [delete].
ExportLicenses gives users all licenses as a json file.
ExportObligations gives users all obligations as a json file.
FilterLicense Get licenses from service based on different filters.
GetAllAudit retrieves a list of all audit records from the database
@Summary Get audit records @Description Get all audit records from the server @Id GetAllAudit @Tags Audits @Accept json @Produce json @Param page query int false "Page number" @Param limit query int false "Number of records per page" @Success 200 {object} models.AuditResponse "Audit records" @Failure 404 {object} models.LicenseError "Not changelogs in DB" @Security ApiKeyAuth || {} @Router /audits [get].
GetAllLicensePreviews retrieves a list of shortnames of all licenses
@Summary Get shortnames of all active licenses @Description Get shortnames of all active licenses from the service @Id GetAllLicensePreviews @Tags Licenses @Accept json @Produce json @Param active query bool true "Active license only" @Success 200 {object} models.LicensePreviewResponse @Failure 400 {object} models.LicenseError "Invalid active value" @Failure 500 {object} models.LicenseError "Unable to fetch licenses" @Security ApiKeyAuth || {} @Router /licenses/preview [get].
GetAllObligation retrieves a list of all obligation records
@Summary Get all active obligations @Description Get all active obligations from the service @Id GetAllObligation @Tags Obligations @Accept json @Produce json @Param active query bool true "Active obligation only" @Param page query int false "Page number" @Param limit query int false "Number of records per page" @Param order_by query string false "Asc or desc ordering" Enums(asc, desc) default(asc) @Success 200 {object} models.SwaggerObligationResponse @Failure 404 {object} models.LicenseError "No obligations in DB" @Security ApiKeyAuth || {} @Router /obligations [get].
GetAllObligationClassification retrieves a list of all obligation classifications
@Summary Get all active obligation classifications @Description Get all active obligation classifications from the service @Id GetAllObligationClassification @Tags Obligations @Accept json @Produce json @Param active query bool true "Active obligation classification only" @Success 200 {object} models.ObligationClassificationResponse @Failure 404 {object} models.LicenseError "No obligation classifications in DB" @Security ApiKeyAuth @Router /obligations/classifications [get].
GetAllObligationPreviews retrieves a list of topics and types of all obligations
@Summary Get topic and types of all active obligations @Description Get topic and type of all active obligations from the service @Id GetAllObligationPreviews @Tags Obligations @Accept json @Produce json @Param active query bool true "Active obligation only" @Success 200 {object} models.ObligationPreviewResponse @Security ApiKeyAuth || {} @Router /obligations/preview [get].
GetAllObligationType retrieves a list of all obligation types
@Summary Get all active obligation types @Description Get all active obligation types from the service @Id GetAllObligationType @Tags Obligations @Accept json @Produce json @Param active query bool true "Active obligation type only" @Success 200 {object} models.ObligationTypeResponse @Failure 404 {object} models.LicenseError "No obligation types in DB" @Security ApiKeyAuth @Router /obligations/types [get].
The GetAPICollection function returns the apis which require authentication and which do not
@Summary Returns the apis which require authentication and which do not @Description Returns the apis which require authentication and which do not @Id getAPICollection @Tags API Collection @Accept json @Produce json @Success 200 {object} models.APICollectionResponse @Failure 500 {object} models.LicenseError "Unable to parse swagger docs" @Router /apiCollection [get].
GetAudit retrieves a specific audit record by its ID from the database
@Summary Get an audit record @Description Get a specific audit records by ID @Id GetAudit @Tags Audits @Accept json @Produce json @Param audit_id path string true "Audit ID" @Success 200 {object} models.AuditResponse @Failure 400 {object} models.LicenseError "Invalid audit ID" @Failure 404 {object} models.LicenseError "No audit entry with given ID" @Security ApiKeyAuth || {} @Router /audits/{audit_id} [get].
GetChangeLogbyId retrieves a specific change history record by its ID for a given audit.
GetChangeLogs retrieves a list of change history records associated with a specific audit
@Summary Get changelogs @Description Get changelogs of an audit record @Id GetChangeLogs @Tags Audits @Accept json @Produce json @Param audit_id path string true "Audit ID" @Success 200 {object} models.ChangeLogResponse @Failure 400 {object} models.LicenseError "Invalid audit ID" @Failure 404 {object} models.LicenseError "No audit entry with given ID" @Failure 500 {object} models.LicenseError "unable to find changes" @Security ApiKeyAuth || {} @Router /audits/{audit_id}/changes [get].
The GetHealth function returns if the DB is running and connected.
GetLicense to get a single license by its shortname
@Summary Get a license by shortname @Description Get a single license by its shortname @Id GetLicense @Tags Licenses @Accept json @Produce json @Param shortname path string true "Shortname of the license" @Success 200 {object} models.LicenseResponse @Failure 404 {object} models.LicenseError "License with shortname not found" @Security ApiKeyAuth || {} @Router /licenses/{shortname} [get].
GetObligation retrieves an active obligation record
@Summary Get an obligation @Description Get an active based on given topic @Id GetObligation @Tags Obligations @Accept json @Produce json @Param topic path string true "Topic of the obligation" @Success 200 {object} models.SwaggerObligationResponse @Failure 404 {object} models.LicenseError "No obligation with given topic found" @Security ApiKeyAuth || {} @Router /obligations/{topic} [get].
GetObligationAudits fetches audits corresponding to an obligation
@Summary Fetches audits corresponding to an obligation @Description Fetches audits corresponding to an obligation @Id GetObligationAudits @Tags Obligations @Accept json @Produce json @Param topic path string true "Topic of the obligation for which audits need to be fetched" @Param page query int false "Page number" @Param limit query int false "Number of records per page" @Success 200 {object} models.AuditResponse @Failure 404 {object} models.LicenseError "No obligation with given topic found" @Failure 500 {object} models.LicenseError "unable to find audits with such obligation topic"
@Security ApiKeyAuth || {}
@Router /obligations/{topic}/audits [get].
GetObligationMapByLicense retrieves obligation maps for given license shortname
@Summary Get maps for a license @Description Get obligation maps for a given license shortname @Id GetObligationMapByLicense @Tags Obligations @Accept json @Produce json @Param license path string true "Shortname of the license" @Success 200 {object} models.ObligationMapResponse @Failure 404 {object} models.LicenseError "No license with given shortname found or no map for license exists" @Security ApiKeyAuth || {} @Router /obligation_maps/license/{license} [get].
GetObligationMapByTopic retrieves obligation maps for a given obligation topic
@Summary Get maps for an obligation @Description Get obligation maps for a given obligation topic @Id GetObligationMapByTopic @Tags Obligations @Accept json @Produce json @Param topic path string true "Topic of the obligation" @Success 200 {object} models.ObligationMapResponse @Failure 404 {object} models.LicenseError "No obligation with given topic found or no map for obligation exists" @Security ApiKeyAuth || {} @Router /obligation_maps/topic/{topic} [get].
The HandleInvalidUrl function returns the error when an invalid url is entered.
ImportLicenses creates new licenses records via a json file.
ImportObligations creates new obligation records via a json file.
PatchObligationMap Add or remove licenses from obligation map for a given obligation topic
@Summary Add or remove licenses from obligation map @Description Add or remove licenses from obligation map for a given obligation topic @Id PatchObligationMap @Tags Obligations @Accept json @Produce json @Param topic path string true "Topic of the obligation" @Param shortname body models.LicenseMapShortnamesInput true "Shortnames of the licenses with action" @Success 200 {object} models.ObligationMapResponse @Failure 400 {object} models.LicenseError "Invalid json body" @Failure 404 {object} models.LicenseError "No license or obligation found." @Failure 500 {object} models.LicenseError "Failure to insert new maps" @Security ApiKeyAuth @Router /obligation_maps/topic/{topic}/license [patch].
No description provided by the author
SearchInLicense Search for license data based on user-provided search criteria.
UpdateLicense Update license with given shortname and create audit and changelog entries.
UpdateLicenseInObligationMap Update license list of an obligation map
@Summary Change license list @Description Replaces the license list of an obligation topic with the given list in the obligation map.
UpdateObligation updates an existing active obligation record
@Summary Update obligation @Description Update an existing obligation record @Id UpdateObligation @Tags Obligations @Accept json @Produce json @Param topic path string true "Topic of the obligation to be updated" @Param obligation body models.ObligationUpdateDTO true "Obligation to be updated" @Success 200 {object} models.SwaggerObligationResponse @Failure 400 {object} models.LicenseError "Invalid request" @Failure 404 {object} models.LicenseError "No obligation with given topic found" @Failure 500 {object} models.LicenseError "Unable to update obligation" @Security ApiKeyAuth @Router /obligations/{topic} [patch].
# Constants
No description provided by the author
No description provided by the author