}
}
}
- my $update = {
- valueInputOption => 'USER_ENTERED',
- data => \@slack_mapping_updates
- };
- $start = [Time::HiRes::gettimeofday];
- $response = $ua->post(
- 'https://sheets.googleapis.com/v4/spreadsheets/' . $config::sheet_id . '/values:batchUpdate?key=' . $config::gsheets_api_key,
- Content => JSON::XS::encode_json($update),
- Content_type => 'application/json;charset=UTF-8',
- Authorization => 'Bearer ' . $token
- );
- log_timing($start, "/spreadsheets/values:batchUpdate");
- die $response->decoded_content if (!$response->is_success);
+ if (scalar @slack_mapping_updates > 0) {
+ my $update = {
+ valueInputOption => 'USER_ENTERED',
+ data => \@slack_mapping_updates
+ };
+ $start = [Time::HiRes::gettimeofday];
+ $response = $ua->post(
+ 'https://sheets.googleapis.com/v4/spreadsheets/' . $config::sheet_id . '/values:batchUpdate?key=' . $config::gsheets_api_key,
+ Content => JSON::XS::encode_json($update),
+ Content_type => 'application/json;charset=UTF-8',
+ Authorization => 'Bearer ' . $token
+ );
+ log_timing($start, "/spreadsheets/values:batchUpdate");
+ die $response->decoded_content if (!$response->is_success);
+ }
# Now that we have Slack names, we can log double-reacters.
for my $userid (keys %double) {