Types.ps1xml

<?xml version="1.0" encoding="utf-8" ?>
<Types>
  <Type>
    <Name>Gitlab.Branch</Name>
    <Members>
      <ScriptProperty>
        <Name>LastAuthor</Name>
        <GetScriptBlock>$this.Commit[0].author_name</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.ProtectedBranch</Name>
    <Members>
      <ScriptProperty>
        <Name>WhoCanPush</Name>
        <GetScriptBlock>$this.PushAccessLevels.access_level_description -join ','</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>WhoCanMerge</Name>
        <GetScriptBlock>$this.MergeAccessLevels.access_level_description -join ','</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.Group</Name>
    <Members>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.Issue</Name>
    <Members>
      <ScriptProperty>
        <Name>AuthorName</Name>
        <GetScriptBlock>$this.Author.Name</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>AssigneeName</Name>
        <GetScriptBlock>$this.Assignee.Name</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>ProjectName</Name>
        <GetScriptBlock>$this.WebUrl -match '://[\w\.]+/(?&lt;ProjectPath&gt;.*)/-' | Out-Null; $Matches['ProjectPath']</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.MergeRequest</Name>
    <Members>
      <ScriptProperty>
        <Name>AuthorName</Name>
        <GetScriptBlock>$this.Author.Name</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>AssigneeName</Name>
        <GetScriptBlock>$this.Assignee.Name</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>ProjectName</Name>
        <GetScriptBlock>$this.WebUrl -match '://[\w\.]+/(?&lt;ProjectPath&gt;.*)/-' | Out-Null; $Matches['ProjectPath']</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>ChangeSummary</Name>
        <GetScriptBlock>$this | Get-GitlabMergeRequestChangeSummary</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.Pipeline</Name>
    <Members>
      <ScriptProperty>
        <Name>UserName</Name>
        <GetScriptBlock>$this.User.username</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
    <Type>
    <Name>Gitlab.PipelineSchedule</Name>
    <Members>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.Environment</Name>
    <Members>
      <ScriptProperty>
        <Name>EnvironmentName</Name>
        <GetScriptBlock>$this.Name</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>ProjectId</Name>
        <GetScriptBlock>$this.Project.id</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.Deployment</Name>
    <Members>
      <ScriptProperty>
        <Name>EnvironmentId</Name>
        <GetScriptBlock>$this.Environment.id</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>EnvironmentName</Name>
        <GetScriptBlock>$this.Environment.name</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Created</Name>
        <GetScriptBlock>$this.CreatedAt.ToString('yyyy-MM-dd HH:mm')</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Deployer</Name>
        <GetScriptBlock>$this.User.name</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Pipeline</Name>
        <GetScriptBlock>$this.Deployable.Pipeline | New-WrapperObject 'Gitlab.Pipeline'</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.Job</Name>
    <Members>
      <ScriptProperty>
        <Name>ProjectId</Name>
        <GetScriptBlock>$this.Pipeline.project_id</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.TestReport</Name>
    <Members>
      <ScriptProperty>
        <Name>Failures</Name>
        <GetScriptBlock>$this.TestSuites.test_cases | Where-Object status -eq 'failed'</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.Project</Name>
    <Members>
      <ScriptProperty>
        <Name>Group</Name>
        <GetScriptBlock>$($($this.PathWithNamespace -split '/') | Select-Object -SkipLast 1) -join '/'</GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Tags</Name>
        <GetScriptBlock>$this.TagList</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.MergeRequestSearchResult</Name>
    <Members>
      <ScriptProperty>
        <Name>AuthorName</Name>
        <GetScriptBlock>$this.Author.username</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.BlobSearchResult</Name>
    <Members>
      <ScriptProperty>
        <Name>LineNumber</Name>
        <GetScriptBlock>$this.Startline</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.User</Name>
    <Members>
      <ScriptProperty>
        <Name>Status</Name>
        <GetScriptBlock>$this.State</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.Configuration</Name>
    <Members>
      <ScriptProperty>
        <Name>SitesDisplay</Name>
        <GetScriptBlock>
          $this.Sites | ForEach-Object { [bool]::Parse($_.IsDefault) ? "$($_.Url) (default)" : $_.Url }
        </GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.Variable</Name>
    <Members>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.RepositoryTree</Name>
    <Members>
      <ScriptProperty>
        <Name>ItemType</Name>
        <GetScriptBlock>$this.Type -eq 'tree' ? 'Directory' : 'File'</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Gitlab.RepositoryFile</Name>
    <Members>
      <ScriptProperty>
        <Name>Name</Name>
        <GetScriptBlock>$this.FileName</GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
</Types>