Skip to content

Commit e14acb0

Browse files
committed
add bulk tags add method
1 parent 05488c8 commit e14acb0

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/imagekitio/client.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,19 @@ def purge_file_cache_status(request_id)
9494
@file.purge_cache_status(request_id.to_s)
9595
end
9696

97+
# Get metadata from remote_file_url
98+
# param remote_file_url: url string of remote file
9799
def get_remote_file_url_metadata(remote_file_url = "")
98100
@file.get_metadata_from_remote_url(remote_file_url)
99101
end
100102

101103
def stream_file(file_url, &block)
102104
@file.stream_file(file_url, &block)
103105
end
104-
# Get metadata from remote_file_url
105-
# param remote_file_url: url string of remote file
106+
107+
def bulk_tags_add(file_ids = [], tags = [])
108+
@file.batch_tags_add(file_ids, tags)
109+
end
106110

107111
def phash_distance(first, second)
108112
# Get hamming distance between two phash(image hash) to check

lib/imagekitio/file.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ def stream_file(remote_file_url, &block)
124124
@req_obj.request_stream('get', remote_file_url, headers: @req_obj.create_headers, &block)
125125
end
126126

127+
def bulk_tags_add(file_ids, tags)
128+
url = "#{constants.BASE_URL}/addTags"
129+
payload = { 'fileIds': file_ids, tags: tags }
130+
@req_obj.request('post', url, @req_obj.create_headers, payload)
131+
132+
end
133+
127134
def validate_upload_options(options)
128135

129136
# Validates upload value, checks if params are valid,

0 commit comments

Comments
 (0)