@@ -27,7 +27,7 @@ class VerificationService {
2727 }
2828
2929 verify ( source_image_path , target_image_path , options ) {
30- const { get_full_url, add_options_to_url, isUrl } = common_functions ;
30+ const { get_full_url, add_options_to_url, isUrl, isPathRelative } = common_functions ;
3131 // add extra parameter(s) name with true value if it is referenced in API documentation for particular endpoint
3232 // add_options_to_url() adds this parameter to url if user passes some value as option otherwise function ignores this parameter
3333 let required_url_parameters = {
@@ -44,8 +44,8 @@ class VerificationService {
4444 let isSourceImageUrl = isUrl ( source_image_path ) ;
4545 let isTargetImageUrl = isUrl ( target_image_path ) ;
4646
47- let isSourceBlob = source_image_path instanceof Blob ;
48- let isTargetBlob = target_image_path instanceof Blob ;
47+ let isSourceRelativePath = isPathRelative ( source_image_path ) ;
48+ let isTargetRelativePath = isPathRelative ( target_image_path ) ;
4949
5050 return new Promise ( ( resolve , reject ) => {
5151 if ( isSourceImageUrl ) {
@@ -57,42 +57,43 @@ class VerificationService {
5757 . catch ( error => {
5858 reject ( error )
5959 } )
60- } else if ( isTargetBlob ) {
61- verification_endpoints . url_blob_request ( source_image_path , isSourceImageUrl , target_image_path , url , this . key )
60+ } else if ( isTargetRelativePath ) {
61+ verification_endpoints . one_url_request ( source_image_path , isSourceImageUrl , target_image_path , url , this . key )
6262 . then ( response => {
6363 resolve ( response . data )
6464 } )
6565 . catch ( error => {
6666 reject ( error )
6767 } )
6868 } else {
69- verification_endpoints . one_url_request ( source_image_path , isSourceImageUrl , target_image_path , url , this . key )
69+ verification_endpoints . url_blob_request ( source_image_path , isSourceImageUrl , target_image_path , url , this . key )
7070 . then ( response => {
7171 resolve ( response . data )
7272 } )
7373 . catch ( error => {
7474 reject ( error )
7575 } )
7676 }
77- } else if ( isSourceBlob ) {
77+ } else if ( isSourceRelativePath ) {
7878 if ( isTargetImageUrl ) {
79- verification_endpoints . url_blob_request ( source_image_path , isSourceImageUrl , target_image_path , url , this . key )
79+ console . log ( "hey I'm here" , isSourceImageUrl )
80+ verification_endpoints . one_url_request ( source_image_path , isSourceImageUrl , target_image_path , url , this . key )
8081 . then ( response => {
8182 resolve ( response . data )
8283 } )
8384 . catch ( error => {
8485 reject ( error )
8586 } )
86- } else if ( isTargetBlob ) {
87- verification_endpoints . both_blob_request ( source_image_path , target_image_path , url , this . key )
87+ } else if ( isTargetRelativePath ) {
88+ verification_endpoints . verify_face_request ( source_image_path , target_image_path , url , this . key )
8889 . then ( response => {
8990 resolve ( response . data )
9091 } )
9192 . catch ( error => {
9293 reject ( error )
9394 } )
9495 } else {
95- verification_endpoints . one_blob_request ( source_image_path , isSourceBlob , target_image_path , url , this . key )
96+ verification_endpoints . one_blob_request ( source_image_path , false , target_image_path , url , this . key )
9697 . then ( response => {
9798 resolve ( response . data )
9899 } )
@@ -102,23 +103,23 @@ class VerificationService {
102103 }
103104 } else {
104105 if ( isTargetImageUrl ) {
105- verification_endpoints . one_url_request ( source_image_path , isSourceImageUrl , target_image_path , url , this . key )
106+ verification_endpoints . url_blob_request ( source_image_path , isSourceImageUrl , target_image_path , url , this . key )
106107 . then ( response => {
107108 resolve ( response . data )
108109 } )
109110 . catch ( error => {
110111 reject ( error )
111112 } )
112- } else if ( isTargetBlob ) {
113- verification_endpoints . one_blob_request ( source_image_path , target_image_path , url , this . key )
113+ } else if ( isTargetRelativePath ) {
114+ verification_endpoints . one_blob_request ( source_image_path , true , target_image_path , url , this . key )
114115 . then ( response => {
115116 resolve ( response . data )
116117 } )
117118 . catch ( error => {
118119 reject ( error )
119- } )
120+ } )
120121 } else {
121- verification_endpoints . verify_face_request ( source_image_path , target_image_path , url , this . key )
122+ verification_endpoints . both_blob_request ( source_image_path , target_image_path , url , this . key )
122123 . then ( response => {
123124 resolve ( response . data )
124125 } )
0 commit comments