line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Licensed under the Upwork's API Terms of Use; |
2
|
|
|
|
|
|
|
# you may not use this file except in compliance with the Terms. |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software |
5
|
|
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
6
|
|
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
7
|
|
|
|
|
|
|
# See the License for the specific language governing permissions and |
8
|
|
|
|
|
|
|
# limitations under the License. |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# Author:: Maksym Novozhylov (mnovozhilov@upwork.com) |
11
|
|
|
|
|
|
|
# Copyright:: Copyright 2021(c) Upwork.com |
12
|
|
|
|
|
|
|
# License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
package Net::Upwork::API::Routers::Graphql; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
73669
|
use strict; |
|
2
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
58
|
|
17
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
50
|
|
18
|
2
|
|
|
2
|
|
489
|
use parent "Net::Upwork::API"; |
|
2
|
|
|
|
|
297
|
|
|
2
|
|
|
|
|
10
|
|
19
|
2
|
|
|
2
|
|
150
|
use JSON::MaybeXS qw/encode_json/; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
127
|
|
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
2
|
|
14
|
use constant ENTRY_POINT => Net::Upwork::API::Client::ENTRY_POINT_GQL; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
432
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Graphql |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 FUNCTIONS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=over 4 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item new($api) |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Create a new object for accessing GraphQL API |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
B |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$api |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
API object |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
46
|
0
|
|
|
0
|
1
|
|
my ($class, $api) = @_; |
47
|
0
|
|
|
|
|
|
return Net::Upwork::API::init_router($class, $api, ENTRY_POINT); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item set_org_uid_header |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Configure X-Upwork-API-TenantId header |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
B |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$tenant_id |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Organization UID |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
B |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
void |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub set_org_uid_header { |
67
|
0
|
|
|
0
|
1
|
|
my ($self, $tenant_id) = @_; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$self->{tenant_id} = $tenant_id; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item execute |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Execute GraphQL request |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
B |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
JSON response as a string |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub execute { |
83
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
84
|
0
|
|
|
|
|
|
my %params = @_; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $json = encode_json \%params; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return $self->client()->graphql_request($json, $self->{tenant_id}); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=back |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHOR |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Maksym Novozhylov C<< >> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 COPYRIGHT |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Copyright E Upwork Global Corp., 2021 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |