func()

in pkg/client/sonar/quality_profile.go [17:35]


func (sc *Client) CreateQualityProfile(ctx context.Context, name, language string) (*QualityProfile, error) {
	profile := struct {
		Profile QualityProfile `json:"profile"`
	}{}

	resp, err := sc.startRequest(ctx).
		SetFormData(map[string]string{
			nameField:  name,
			"language": language,
		}).
		SetResult(&profile).
		Post("/qualityprofiles/create")

	if err = sc.checkError(resp, err); err != nil {
		return nil, fmt.Errorf("failed to create quality profile: %w", err)
	}

	return &profile.Profile, nil
}