-
Notifications
You must be signed in to change notification settings - Fork 0
/
GitPub.types.ps1xml
122 lines (109 loc) · 3.06 KB
/
GitPub.types.ps1xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?xml version="1.0" encoding="utf-16"?>
<!-- Generated with EZOut 1.9.7: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
<Types>
<Type>
<Name>GitPub.Post.Gist</Name>
<Members>
<ScriptProperty>
<Name>Body</Name>
<GetScriptBlock>
if (-not $this.Files) { return '' }
if (-not $this.cachedBody) {
$g = $this
$firstFile = @(
foreach ($prop in $this.files.psobject.Properties) {
if ($prop.MemberType -eq 'ScriptProperty') { continue }
$prop;break
}
).Value
if ($firstFile.type -ne 'text/markdown') { return '' }
if (-not $firstFile.raw_url) { return '' }
$bodyToCache = Invoke-RestMethod $firstFile.raw_url
$bodyToCache
$this | Add-Member NoteProperty cachedBody $bodyToCache -Force
} else {
$this.cachedBody
}
</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>PostAuthor</Name>
<GetScriptBlock>
if ($this.owner.type -ne 'bot') {
$this.owner.login
} else {
''
}
</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>PostTitle</Name>
<GetScriptBlock>
$this.Description
</GetScriptBlock>
</ScriptProperty>
</Members>
</Type>
<Type>
<Name>GitPub.Post.Issue</Name>
<Members>
<ScriptProperty>
<Name>PostAuthor</Name>
<GetScriptBlock>
if ($this.user.type -ne 'bot') {
$this.user.login
} else {
''
}
</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>PostBody</Name>
<GetScriptBlock>
$hasReferences = $this.Body -match '\#\d+'
if (-not $hasReferences) { return $this.Body }
$repoRoot = $this.html_url -replace '\/issues.+$'
[Regex]::Replace($this.Body, "\#(?<i>\d+)", {
param($match)
"[#$($match.Groups['i'].Value)]($repoRoot/issues/$(
$match.Groups['i'].Value
))"
})
</GetScriptBlock>
</ScriptProperty>
</Members>
</Type>
<Type>
<Name>GitPub.Post.Release</Name>
<Members>
<AliasProperty>
<Name>Title</Name>
<ReferencedMemberName>Name</ReferencedMemberName>
</AliasProperty>
<ScriptProperty>
<Name>PostAuthor</Name>
<GetScriptBlock>
if ($this.author.type -ne 'bot') {
$this.author.login
} else {
''
}
</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>PostBody</Name>
<GetScriptBlock>
$hasReferences = $this.Body -match '\#\d+'
if (-not $hasReferences) { return $this.Body }
$repoRoot = $this.html_url -replace '\/releases.+$'
[Regex]::Replace($this.Body, "\#(?<i>\d+)", {
param($match)
"[#$($match.Groups['i'].Value)]($repoRoot/issues/$(
$match.Groups['i'].Value
))"
})
</GetScriptBlock>
</ScriptProperty>
</Members>
</Type>
</Types>