File tree Expand file tree Collapse file tree 4 files changed +50
-14
lines changed Expand file tree Collapse file tree 4 files changed +50
-14
lines changed Original file line number Diff line number Diff line change @@ -421,8 +421,9 @@ options = UploadFileRequestOptions(
421
421
overwrite_tags = False ,
422
422
overwrite_custom_metadata = True ,
423
423
custom_metadata = {' testss' : 12 },
424
- transformation = transformation
425
- checks = " 'request.folder' : '/testing-python-folder'" # To run server side checks before uploading files. Notice the quotes around request.folder and /testing-python-folder.
424
+ transformation = transformation,
425
+ checks = " 'request.folder' : '/testing-python-folder'" , # To run server side checks before uploading files. Notice the quotes around request.folder and /testing-python-folder.
426
+ isPublished = True
426
427
)
427
428
428
429
result = imagekit.upload_file(file = ' <url|base_64|binary>' , # required
@@ -622,6 +623,33 @@ print(result.response_metadata.raw)
622
623
print (result.file_id)
623
624
```
624
625
626
+ ** Update publish status**
627
+
628
+ If ` UpdateFileRequestOptions ` contains the ` publish ` property, all other properties will be ignored.
629
+
630
+ ``` python
631
+ from imagekitio.models.UpdateFileRequestOptions import UpdateFileRequestOptions
632
+
633
+ options = UpdateFileRequestOptions(
634
+ publish = {
635
+ " isPublished" : True ,
636
+ " includeFileVersions" : True
637
+ }
638
+ )
639
+
640
+ result = imagekit.update_file_details(file_id = ' 62cfd39819ca454d82a07182'
641
+ , options = options) # required
642
+
643
+ # Final Result
644
+ print (result)
645
+
646
+ # Raw Response
647
+ print (result.response_metadata.raw)
648
+
649
+ # print that file's id
650
+ print (result.file_id)
651
+ ```
652
+
625
653
** 6. Add tags**
626
654
627
655
Accepts a list of ` file_ids ` and ` tags ` as a parameter to be used to add tags. All parameters specified in
Original file line number Diff line number Diff line change 31
31
"embedded_metadata" ,
32
32
"transformation" ,
33
33
"checks" ,
34
+ "isPublished" ,
34
35
]
Original file line number Diff line number Diff line change @@ -11,16 +11,20 @@ def __init__(
11
11
tags : List [str ] = None ,
12
12
custom_coordinates : str = None ,
13
13
custom_metadata : json = None ,
14
+ publish : json = None ,
14
15
):
15
- if remove_ai_tags is not None :
16
- self .remove_ai_tags = remove_ai_tags
17
- if webhook_url is not None :
18
- self .webhook_url = webhook_url
19
- if extensions is not None :
20
- self .extensions = extensions
21
- if tags is not None :
22
- self .tags = tags
23
- if custom_coordinates is not None :
24
- self .custom_coordinates = custom_coordinates
25
- if custom_metadata is not None :
26
- self .custom_metadata = custom_metadata
16
+ if publish is not None :
17
+ self .publish = publish
18
+ else :
19
+ if remove_ai_tags is not None :
20
+ self .remove_ai_tags = remove_ai_tags
21
+ if webhook_url is not None :
22
+ self .webhook_url = webhook_url
23
+ if extensions is not None :
24
+ self .extensions = extensions
25
+ if tags is not None :
26
+ self .tags = tags
27
+ if custom_coordinates is not None :
28
+ self .custom_coordinates = custom_coordinates
29
+ if custom_metadata is not None :
30
+ self .custom_metadata = custom_metadata
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ def __init__(
20
20
custom_metadata : json = None ,
21
21
transformation : json = None ,
22
22
checks : str = None ,
23
+ isPublished : bool = None ,
23
24
):
24
25
if use_unique_file_name is not None :
25
26
self .use_unique_file_name = use_unique_file_name
@@ -51,3 +52,5 @@ def __init__(
51
52
self .transformation = transformation
52
53
if checks is not None :
53
54
self .checks = checks
55
+ if isPublished is not None :
56
+ self .isPublished = isPublished
You can’t perform that action at this time.
0 commit comments