/* * spdbx.h — scorpiox-scorpioplayer-dropbox-client flat P/Invoke face. * Also exposes the #26 backend (spdbx_backend) and #54 handler (sprch_get). */ #ifndef SPDBX_H #define SPDBX_H #include #include "scorpiox-io.h" #include "spffa.h" #include "sprch.h" #ifdef __cplusplus extern "C" { #endif #if defined(SPDBX_STATIC) # define SPDBX_API #elif defined(_WIN32) # if defined(SPDBX_BUILD) # define SPDBX_API __declspec(dllexport) # else # define SPDBX_API __declspec(dllimport) # endif #else # define SPDBX_API __attribute__((visibility("default"))) #endif #define SPDBX_ABI_VERSION 1 #define SPDBX_OK 0 #define SPDBX_ERR_AUTH 1 #define SPDBX_ERR_AUTH_EXPIRED 2 #define SPDBX_ERR_NOT_FOUND 3 #define SPDBX_ERR_RATE_LIMITED 4 #define SPDBX_ERR_TRANSPORT 5 #define SPDBX_ERR_BAD_REQUEST 6 #define SPDBX_ERR_UNSUPPORTED 7 #define SPDBX_ERR_CANCELLED 8 #define SPDBX_ERR_PROTOCOL 9 #define SPDBX_ERR_OOM 10 #define SPDBX_ERR_INVALID_ARG 11 #define SPDBX_ERR_BAD_CONFIG 12 /* wiring */ SPDBX_API void spdbx_set_io(const scorpiox_io *io); SPDBX_API void spdbx_set_token(const char *access_token); SPDBX_API void spdbx_set_refresh(const char *refresh_token, const char *app_key); /* #26 backend vtable (id "dropbox") */ SPDBX_API const spffa_backend *spdbx_backend(void); /* convenience listing (transparent first page; spdbx_list_next continues) */ SPDBX_API int spdbx_list(const char *path); SPDBX_API int spdbx_list_next(void); /* 1 = more, 0 = done, <0 = -err */ SPDBX_API int spdbx_count(void); SPDBX_API const char *spdbx_name(int i); SPDBX_API int spdbx_is_folder(int i); SPDBX_API long long spdbx_size(int i); /* -1 = unknown */ SPDBX_API const char *spdbx_id(int i); SPDBX_API const char *spdbx_path_display(int i); SPDBX_API int spdbx_stat(const char *path, long long *out_size, int *out_is_folder, char *out_id, size_t id_n, char *out_path_display, size_t pd_n); SPDBX_API int spdbx_locator(const char *path_or_id, char *out, size_t n); SPDBX_API void spdbx_cancel(void); SPDBX_API const char *spdbx_last_error(void); SPDBX_API int spdbx_last_http_code(void); SPDBX_API int spdbx_retry_after_s(void); SPDBX_API const char *spdbx_result_json(void); SPDBX_API const char *spdbx_version(void); SPDBX_API int spdbx_last_code(void); SPDBX_API const char *spdbx_strerror(int code); /* #54 */ SPDBX_API const sprch_handler *sprch_get(void); /* curl / fake transports (optional helpers). * spdbx_io_curl needs libcurl; Windows builds with SPDBX_NO_CURL omit it * (the app supplies its own scorpiox_io — e.g. the fleet HTTP transport). */ #ifndef SPDBX_NO_CURL SPDBX_API scorpiox_io spdbx_io_curl(void); #endif SPDBX_API scorpiox_io spdbx_io_fake(void); SPDBX_API int spdbx_fake_load(const char *json_fixtures); /* array of {match,status,body,headers?} */ SPDBX_API void spdbx_fake_reset(void); #ifndef SPDBX_NO_CURL SPDBX_API int spdbx_curl_last_retry_after(void); #endif /* fuzz / test helpers */ SPDBX_API int spdbx_fuzz_decode_list_json(const char *body, size_t n); SPDBX_API char *spdbx_fuzz_build_locator(const char *id, const char *path_lower); #ifdef __cplusplus } #endif #endif /* SPDBX_H */