| 1 | package Tomba::Bulk; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use parent 'Tomba::Client'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | Tomba::Bulk - Bulk operations for the Tomba.io API | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | use Tomba::Bulk; | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | my $tomba = Tomba::Bulk->new("ta_xxxxx", "ts_xxxxx"); | ||||||||||||||||||||||||||||
| 16 | my $bulks = $tomba->ListBulks("finder"); | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | Manage bulk operations: list, get, launch, delete, archive, rename, progress, and download. | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | Type can be: search, finder, verifier, enrich, author, linkedin, company, | ||||||||||||||||||||||||||||
| 23 | phone-finder, phone-validator, similar. | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =cut | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 4 | my @VALID_TYPES = qw(search similar company finder enrich linkedin author verifier phone-finder phone-validator); | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | sub _validate_type { | ||||||||||||||||||||||||||
|
Subroutine
_validate_type: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 30 | 0 | my ($type) = @_; | |||||||||||||||||||||||||||
| 31 | 0 | ▶ | die "Missing required parameter: 'type'\n" unless defined $type && length($type); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $type and length $type
MC/DC0%0/2
defined $type and length $type
defined $type
length $type
Truth table0%0/3
A and B
A= defined $typeB= length $type
| |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | unless (grep { $_ eq $type } @VALID_TYPES) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 0 | die "Invalid bulk type: \"$type\". Must be one of: " . join(", ", @VALID_TYPES) . "\n"; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 38 | # Bulk Operations | ||||||||||||||||||||||||||||
| 39 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | =head2 ListBulks | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | my $data = $tomba->ListBulks("finder"); | ||||||||||||||||||||||||||||
| 44 | my $data = $tomba->ListBulks("verifier", { page => 1, limit => 10 }); | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | Retrieve a list of bulk operations for the given type. | ||||||||||||||||||||||||||||
| 47 | Type can be: search, finder, verifier, enrich, author, linkedin, company, | ||||||||||||||||||||||||||||
| 48 | phone-finder, phone-validator, similar. | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | See L<https://docs.tomba.io/api/bulks> | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =cut | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | ▶ | sub ListBulks { | ||||||||||||||||||||||||||
|
Subroutine
ListBulks: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 55 | 0 | my ($self, $type, $params) = @_; | |||||||||||||||||||||||||||
| 56 | 0 | _validate_type($type); | |||||||||||||||||||||||||||
| 57 | 0 | return $self->call("/bulk/$type", $params); | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =head2 CreateBulk | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | my $data = $tomba->CreateBulk("finder", { emails => ["a@example.com"] }); | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | Create a new bulk operation of the given type. | ||||||||||||||||||||||||||||
| 65 | Type can be: search, finder, verifier, enrich, author, linkedin, company, | ||||||||||||||||||||||||||||
| 66 | phone-finder, phone-validator, similar. | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | See L<https://docs.tomba.io/api/bulks> | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =cut | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub CreateBulk { | ||||||||||||||||||||||||||
|
Subroutine
CreateBulk: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 73 | 0 | my ($self, $type, $body) = @_; | |||||||||||||||||||||||||||
| 74 | 0 | _validate_type($type); | |||||||||||||||||||||||||||
| 75 | 0 | return $self->post("/bulk/$type", $body); | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =head2 GetBulk | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | my $data = $tomba->GetBulk("finder", $bulk_id); | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | Retrieve details of a specific bulk operation. | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | See L<https://docs.tomba.io/api/bulks> | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =cut | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub GetBulk { | ||||||||||||||||||||||||||
|
Subroutine
GetBulk: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 89 | 0 | my ($self, $type, $id) = @_; | |||||||||||||||||||||||||||
| 90 | 0 | _validate_type($type); | |||||||||||||||||||||||||||
| 91 | 0 | return $self->call("/bulk/$type/$id"); | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | =head2 LaunchBulk | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | my $data = $tomba->LaunchBulk("finder", $bulk_id); | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | Launch a bulk operation. | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | See L<https://docs.tomba.io/api/bulks> | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | =cut | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | sub LaunchBulk { | ||||||||||||||||||||||||||
|
Subroutine
LaunchBulk: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 105 | 0 | my ($self, $type, $id) = @_; | |||||||||||||||||||||||||||
| 106 | 0 | _validate_type($type); | |||||||||||||||||||||||||||
| 107 | 0 | return $self->put("/bulk/$type/$id", {}); | |||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =head2 DeleteBulk | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | my $data = $tomba->DeleteBulk("finder", $bulk_id); | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | Delete a bulk operation. | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | See L<https://docs.tomba.io/api/bulks> | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | =cut | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub DeleteBulk { | ||||||||||||||||||||||||||
|
Subroutine
DeleteBulk: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 121 | 0 | my ($self, $type, $id) = @_; | |||||||||||||||||||||||||||
| 122 | 0 | _validate_type($type); | |||||||||||||||||||||||||||
| 123 | 0 | return $self->delete_request("/bulk/$type/$id/delete"); | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | =head2 ArchiveBulk | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | my $data = $tomba->ArchiveBulk("finder", $bulk_id); | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | Archive a bulk operation. | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | See L<https://docs.tomba.io/api/bulks> | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | =cut | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub ArchiveBulk { | ||||||||||||||||||||||||||
|
Subroutine
ArchiveBulk: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 137 | 0 | my ($self, $type, $id) = @_; | |||||||||||||||||||||||||||
| 138 | 0 | _validate_type($type); | |||||||||||||||||||||||||||
| 139 | 0 | return $self->delete_request("/bulk/$type/$id/archive"); | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | =head2 RenameBulk | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | my $data = $tomba->RenameBulk("finder", $bulk_id, "New Name"); | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | Rename a bulk operation. | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | See L<https://docs.tomba.io/api/bulks> | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | =cut | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 0 | ▶ | sub RenameBulk { | ||||||||||||||||||||||||||
|
Subroutine
RenameBulk: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 153 | 0 | my ($self, $type, $id, $name) = @_; | |||||||||||||||||||||||||||
| 154 | 0 | _validate_type($type); | |||||||||||||||||||||||||||
| 155 | 0 | return $self->put("/bulk/$type/$id/rename", { name => $name }); | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | =head2 BulkProgress | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | my $data = $tomba->BulkProgress("finder", $bulk_id); | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | Get progress of a bulk operation. | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | See L<https://docs.tomba.io/api/bulks> | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | =cut | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 0 | ▶ | sub BulkProgress { | ||||||||||||||||||||||||||
|
Subroutine
BulkProgress: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 169 | 0 | my ($self, $type, $id) = @_; | |||||||||||||||||||||||||||
| 170 | 0 | _validate_type($type); | |||||||||||||||||||||||||||
| 171 | 0 | return $self->call("/bulk/$type/$id/progress"); | |||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | =head2 BulkDownload | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | my $data = $tomba->BulkDownload("finder", $bulk_id); | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | Download results of a bulk operation. | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | See L<https://docs.tomba.io/api/bulks> | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | =cut | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub BulkDownload { | ||||||||||||||||||||||||||
|
Subroutine
BulkDownload: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 185 | 0 | my ($self, $type, $id) = @_; | |||||||||||||||||||||||||||
| 186 | 0 | _validate_type($type); | |||||||||||||||||||||||||||
| 187 | 0 | return $self->call_raw("/bulk/$type/$id/download"); | |||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 4 | 1; | |||||||||||||||||||||||||||
| 191 | __END__ | ||||||||||||||||||||||||||||