-
Notifications
You must be signed in to change notification settings - Fork 0
/
jira_attachment.body.sql
95 lines (61 loc) · 2.22 KB
/
jira_attachment.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
create or replace package body jira_attachment
as
function get_attachment (
att_id in varchar2
)
return attachment_rec_tab
pipelined
as
row_data attachment_rec;
begin
dbms_application_info.set_action('get_attachment');
jira.init_talk('attachment/', 'GET');
jira.jira_call_request.call_json.put('id', att_id);
jira.talk;
row_data.filename := json_ext.get_string(jira.jira_response_result.result, 'filename');
row_data.author_name := json_ext.get_string(jira.jira_response_result.result, 'author.displayName');
row_data.author_link := json_ext.get_string(jira.jira_response_result.result, 'author.self');
row_data.created := json_ext.get_string(jira.jira_response_result.result, 'created');
row_data.att_size := json_ext.get_number(jira.jira_response_result.result, 'size');
row_data.mimetype := json_ext.get_string(jira.jira_response_result.result, 'mimeType');
row_data.content := json_ext.get_string(jira.jira_response_result.result, 'content');
row_data.thumbnail := json_ext.get_string(jira.jira_response_result.result, 'thumbnail');
pipe row(row_data);
dbms_application_info.set_action(null);
return;
end get_attachment;
procedure delete_attachment (
att_id in varchar2
)
as
begin
dbms_application_info.set_action('delete_attachment');
jira.init_talk('attachment/', 'DELETE');
jira.jira_call_request.call_json.put('id', att_id);
jira.talk;
dbms_application_info.set_action(null);
exception
when others then
dbms_application_info.set_action(null);
raise;
end delete_attachment;
function get_attachment_meta
return attachment_meta_rec_tab
pipelined
as
row_data attachment_meta_rec;
begin
dbms_application_info.set_action('get_attachment_meta');
jira.init_talk('attachment/meta', 'GET');
jira.talk;
row_data.enabled := json_ext.get_string(jira.jira_response_result.result, 'enabled');
row_data.upload_limit := json_ext.get_string(jira.jira_response_result.result, 'uploadLimit');
pipe row(row_data);
dbms_application_info.set_action(null);
return;
end get_attachment_meta;
begin
dbms_application_info.set_client_info('jira_attachment');
dbms_session.set_identifier('jira_attachment');
end jira_attachment;
/