-
Notifications
You must be signed in to change notification settings - Fork 1
/
github_repos_content.body.sql
164 lines (118 loc) · 3.54 KB
/
github_repos_content.body.sql
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
create or replace package body github_repos_content
as
procedure create_file (
git_account varchar2
, repos_name varchar2
, path varchar2
, message varchar2
, content clob
, branch varchar2 default null
)
as
begin
github.init_talk('/repos/' || git_account || '/' || repos_name || '/contents/' || path, 'PUT');
github.github_call_request.call_json.put('message', message);
github.github_call_request.call_json.put('committer', github.github_committer_hash);
github.github_call_request.call_json.put('content', content);
if branch is not null then
github.github_call_request.call_json.put('branch', branch);
end if;
github.talk(
github_account => git_account
);
end create_file;
procedure update_file (
git_account varchar2
, repos_name varchar2
, path varchar2
, message varchar2
, content clob
, sha varchar2
, branch varchar2 default null
)
as
begin
github.init_talk('/repos/' || git_account || '/' || repos_name || '/contents/' || path, 'PUT');
github.github_call_request.call_json.put('message', message);
github.github_call_request.call_json.put('committer', github.github_committer_hash);
github.github_call_request.call_json.put('content', content);
github.github_call_request.call_json.put('sha', sha);
if branch is not null then
github.github_call_request.call_json.put('branch', branch);
end if;
github.talk(
github_account => git_account
);
end update_file;
procedure delete_file (
git_account varchar2
, repos_name varchar2
, path varchar2
, message varchar2
, sha varchar2
, branch varchar2 default null
)
as
begin
github.init_talk('/repos/' || git_account || '/' || repos_name || '/contents/' || path, 'DELETE');
github.github_call_request.call_json.put('message', message);
github.github_call_request.call_json.put('committer', github.github_committer_hash);
github.github_call_request.call_json.put('sha', sha);
if branch is not null then
github.github_call_request.call_json.put('branch', branch);
end if;
github.talk(
github_account => git_account
);
end delete_file;
function get_content (
git_account varchar2
, repos_name varchar2
, path varchar2
, ref varchar2 default null
)
return github.call_result
as
begin
if ref is not null then
null;
end if;
github.init_talk('/repos/' || git_account || '/' || repos_name || '/contents/' || path, 'GET');
github.talk(
github_account => git_account
);
return github.github_response_result;
end get_content;
function get_archive_link (
git_account varchar2
, repos_name varchar2
, archive_format varchar2 default 'tarball'
, ref varchar2 default 'master'
)
return varchar2
as
begin
github.init_talk('/repos/' || git_account || '/' || repos_name || '/' || archive_format || '/' || ref, 'GET');
github.talk(
github_account => git_account
);
-- Now we have a header with the link to the archive
return github.github_response_result.result.get('Location').to_char;
end get_archive_link;
function get_readme (
git_account varchar2
, repos_name varchar2
, ref varchar2 default 'master'
)
return github.call_result
as
begin
github.init_talk('/repos/' || git_account || '/' || repos_name || '/readme', 'GET');
github.github_call_request.call_json.put('ref', ref);
github.talk(
github_account => git_account
);
return github.github_response_result;
end get_readme;
end github_repos_content;
/