Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-ConfluenceSpace does not return labels, and does not take label as input parameter #183

Open
o-l-a-v opened this issue Jun 24, 2020 · 2 comments

Comments

@o-l-a-v
Copy link

o-l-a-v commented Jun 24, 2020

Description

API says that get space will return labels. The Get-Space also includes mentions of labels in $iwParameters['GetParameters'] property expand, where we can find metadata.labels.

But no labels are returned when getting all spaces nor a specific space.

  • API Documentation \ Space \ Get
  • Get-Space, which actually specifies labels as an attribute to expand, and with no input parameter for getting spaces with a given label/ category.
    image
  • "Space" class found in ConfluencePS.Types.cs, which does not say anything about label or category.
    image

Steps To Reproduce

Get-ConfluenceSpace | Format-List -Force

Expected behavior

Labels or categories should be included in the response.

Screenshots

Your Environment

  • PowerShell 5.1 on Windows 10 Enterprise 20H1.
  • ConfluencePS version 2.5.

Possible Solution

  • Add label to the space class (probably)
  • Add input parameter to Get-ConfluenceSpace function to get spaces by labels.
@o-l-a-v
Copy link
Author

o-l-a-v commented Jun 24, 2020

I added ability to get spaces by label adding the following to Get-Space.

Input parameter

[Parameter(Mandatory = $false)]
[string[]] $Label

Logic for adding label(s) to $iwParameters['GetParameters']

if ($Label -and $Label.'Count' -gt 0) {
    $iwParameters['GetParameters'].Add('label',($Label -join ','))
}

Does not seem to work with multiple labels though.

@o-l-a-v
Copy link
Author

o-l-a-v commented Jun 24, 2020

Added getting labels from spaces.

Private\ConvertTo-Space

@{
    'Name' = 'labels'
    'Expression' = {
        $_.'metadata'.'labels'.'results'.'name'
    }
}

ConfluencePS.Types.cs

public class Space {
	public Int32 Id { get; set; }
	public String Key { get; set; }
	public String Name { get; set; }
	public Icon Icon { get; set; }
	public String Type { get; set; }
	public String Description { get; set; }
	public String[] Labels { get; set; }
	public Page Homepage { get; set; }
	public override string ToString() {
		return "[" + Key + "] " + Name;
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant