@@ -87,6 +87,8 @@ typedef enum opendal_code {
8787 OPENDAL_RANGE_NOT_SATISFIED ,
8888} opendal_code ;
8989
90+ typedef struct opendal_presigned_request_inner opendal_presigned_request_inner ;
91+
9092/**
9193 * \brief opendal_bytes carries raw-bytes with its length
9294 *
@@ -577,12 +579,52 @@ typedef struct opendal_capability {
577579 * If operator supports presign write.
578580 */
579581 bool presign_write ;
582+ /**
583+ * If operator supports presign delete.
584+ */
585+ bool presign_delete ;
580586 /**
581587 * If operator supports shared.
582588 */
583589 bool shared ;
584590} opendal_capability ;
585591
592+ /**
593+ * \brief The underlying presigned request, which contains the HTTP method, URI, and headers.
594+ * This is an opaque struct, please use the accessor functions to get the fields.
595+ */
596+ typedef struct opendal_presigned_request {
597+ struct opendal_presigned_request_inner * inner ;
598+ } opendal_presigned_request ;
599+
600+ /**
601+ * @brief The result of a presign operation.
602+ */
603+ typedef struct opendal_result_presign {
604+ /**
605+ * The presigned request.
606+ */
607+ struct opendal_presigned_request * req ;
608+ /**
609+ * The error.
610+ */
611+ struct opendal_error * error ;
612+ } opendal_result_presign ;
613+
614+ /**
615+ * \brief The key-value pair for the headers of the presigned request.
616+ */
617+ typedef struct opendal_http_header_pair {
618+ /**
619+ * The key of the header.
620+ */
621+ const char * key ;
622+ /**
623+ * The value of the header.
624+ */
625+ const char * value ;
626+ } opendal_http_header_pair ;
627+
586628/**
587629 * \brief The is the result type returned by opendal_reader_read().
588630 * The result type contains a size field, which is the size of the data read,
@@ -1376,6 +1418,59 @@ struct opendal_capability opendal_operator_info_get_full_capability(const struct
13761418 */
13771419struct opendal_capability opendal_operator_info_get_native_capability (const struct opendal_operator_info * self );
13781420
1421+ /**
1422+ * \brief Presign a read operation.
1423+ */
1424+ struct opendal_result_presign opendal_operator_presign_read (const struct opendal_operator * op ,
1425+ const char * path ,
1426+ uint64_t expire_secs );
1427+
1428+ /**
1429+ * \brief Presign a write operation.
1430+ */
1431+ struct opendal_result_presign opendal_operator_presign_write (const struct opendal_operator * op ,
1432+ const char * path ,
1433+ uint64_t expire_secs );
1434+
1435+ /**
1436+ * \brief Presign a delete operation.
1437+ */
1438+ struct opendal_result_presign opendal_operator_presign_delete (const struct opendal_operator * op ,
1439+ const char * path ,
1440+ uint64_t expire_secs );
1441+
1442+ /**
1443+ * \brief Presign a stat operation.
1444+ */
1445+ struct opendal_result_presign opendal_operator_presign_stat (const struct opendal_operator * op ,
1446+ const char * path ,
1447+ uint64_t expire_secs );
1448+
1449+ /**
1450+ * Get the method of the presigned request.
1451+ */
1452+ const char * opendal_presigned_request_method (const struct opendal_presigned_request * req );
1453+
1454+ /**
1455+ * Get the URI of the presigned request.
1456+ */
1457+ const char * opendal_presigned_request_uri (const struct opendal_presigned_request * req );
1458+
1459+ /**
1460+ * Get the headers of the presigned request.
1461+ */
1462+ const struct opendal_http_header_pair * opendal_presigned_request_headers (const struct opendal_presigned_request * req );
1463+
1464+ /**
1465+ * Get the length of the headers of the presigned request.
1466+ */
1467+ uintptr_t opendal_presigned_request_headers_len (const struct opendal_presigned_request * req );
1468+
1469+ /**
1470+ * \brief Free the presigned request.
1471+ */
1472+ void opendal_presigned_request_free (struct opendal_presigned_request * req );
1473+
13791474/**
13801475 * \brief Frees the heap memory used by the opendal_bytes
13811476 */
0 commit comments