func tagCategoryByName(ctx context.Context, client *tags.RestClient, name string) (string, error) {
	cats, err := client.GetCategoriesByName(ctx, name)
	if err != nil {
		return "", fmt.Errorf("could not get category for name %q: %s", name, err)
	}

	if len(cats) < 1 {
		return "", fmt.Errorf("category name %q not found", name)
	}
	if len(cats) > 1 {
		// Although GetCategoriesByName does not seem to think that tag categories
		// are unique, empirical observation via the console and API show that they
		// are. This error case is handled anyway.
		return "", fmt.Errorf("multiple categories with name %q found", name)
	}

	return cats[0].ID, nil
}
func tagCategoryByName(ctx context.Context, client *tags.RestClient, name string) (string, error) {
	cats, err := client.GetCategoriesByName(ctx, name)
	if err != nil {
		return "", fmt.Errorf("could not get category for name %q: %s", name, err)
	}

	if len(cats) < 1 {
		return "", fmt.Errorf("category name %q not found", name)
	}
	if len(cats) > 1 {
		
		
		
		return "", fmt.Errorf("multiple categories with name %q found", name)
	}

	return cats[0].ID, nil
}
func tagCategoryByName ( ctx context . Context , client * tags . RestClient , name string ) ( string , error ) { cats , err := client . GetCategoriesByName ( ctx , name ) if err != nil { return " " , fmt . Errorf ( " " , name , err ) } if len ( cats ) < 1 { return " " , fmt . Errorf ( " " , name ) } if len ( cats ) > 1 { // Although GetCategoriesByName does not seem to think that tag categories // are unique, empirical observation via the console and API show that they // are. This error case is handled anyway. return " " , fmt . Errorf ( " " , name ) } return cats [ 0 ] . ID , nil }
// tagCategoryByName converts a tag category name into its ID.
tagCategoryByName converts a tag category name into its ID .