-
Notifications
You must be signed in to change notification settings - Fork 1
/
github_org.body.sql
96 lines (73 loc) · 2.22 KB
/
github_org.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
create or replace package body github_org
as
function list_user_orgs (
git_account varchar2
)
return github.call_result
as
github_api_endpoint varchar2(4000) := '/users/' || git_account || '/orgs';
github_api_endpoint_method varchar2(100) := 'GET';
github_api_json json.jsonstructobj;
begin
github.talk(
github_account => git_account
, api_endpoint => github_api_endpoint
, endpoint_method => github_api_endpoint_method
);
return github.github_response_result;
end list_user_orgs;
function get_org (
org_name varchar2
)
return github.call_result
as
github_api_endpoint varchar2(4000) := '/orgs/' || org_name;
github_api_endpoint_method varchar2(100) := 'GET';
github_api_json json.jsonstructobj;
begin
github.talk(
github_account => git_account
, api_endpoint => github_api_endpoint
, endpoint_method => github_api_endpoint_method
);
return github.github_response_result;
end get_org;
procedure edit_org (
org_name varchar2
, billing_email varchar2 default null
, company varchar2 default null
, email varchar2 default null
, location varchar2 default null
, name varchar2 default null
)
as
github_api_endpoint varchar2(4000) := '/orgs/' || org_name;
github_api_endpoint_method varchar2(100) := 'PATCH';
github_api_json json.jsonstructobj;
begin
json.newjsonobj(github_api_json);
if billing_email is not null then
github_api_json := json.addattr(github_api_json, 'billing_email', billing_email);
end if;
if company is not null then
github_api_json := json.addattr(github_api_json, 'company', company);
end if;
if email is not null then
github_api_json := json.addattr(github_api_json, 'email', email);
end if;
if location is not null then
github_api_json := json.addattr(github_api_json, 'location', location);
end if;
if name is not null then
github_api_json := json.addattr(github_api_json, 'name', name);
end if;
json.closejsonobj(github_api_json);
github.talk(
github_account => git_account
, api_endpoint => github_api_endpoint
, endpoint_method => github_api_endpoint_method
, api_data => json.json2string(github_api_json)
);
end edit_org;
end github_org;
/