1use std::ffi::c_char;
2use std::ffi::c_uint;
3
4pub enum LyContext {}
5
6pub enum LyResult {}
7
8pub enum LyError {}
9
10pub enum LyJob {}
11
12pub const LY_JOB_RUNNING: c_uint = 0;
13pub const LY_JOB_DONE: c_uint = 1;
14pub const LY_JOB_FAILED: c_uint = 2;
15pub const LY_JOB_CANCELLED: c_uint = 3;
16
17pub const LY_OK: c_uint = 0;
18pub const LY_E_INVALID_ARGUMENT: c_uint = 1;
19pub const LY_E_RUNTIME: c_uint = 2;
20pub const LY_E_EXTRACT: c_uint = 3;
21pub const LY_E_NETWORK: c_uint = 4;
22pub const LY_E_CANCELLED: c_uint = 5;
23pub const LY_E_BUSY: c_uint = 6;
24pub const LY_E_INTERNAL: c_uint = 7;
25
26pub const LY_ABI_VERSION: u32 = 1;
27
28unsafe extern "C" {
29 pub fn ly_abi_version() -> u32;
30
31 pub fn ly_context_create(
32 options_json: *const c_char,
33 options_len: usize,
34 out: *mut *mut LyContext,
35 error: *mut *mut LyError,
36 ) -> c_uint;
37
38 pub fn ly_context_release(context: *mut LyContext) -> c_uint;
39
40 pub fn ly_extract(
41 context: *mut LyContext,
42 url: *const c_char,
43 url_len: usize,
44 options_json: *const c_char,
45 options_len: usize,
46 out: *mut *mut LyResult,
47 error: *mut *mut LyError,
48 ) -> c_uint;
49
50 pub fn ly_result_json(
51 result: *const LyResult,
52 data: *mut *const c_char,
53 len: *mut usize,
54 ) -> c_uint;
55
56 pub fn ly_result_release(result: *mut LyResult);
57
58 pub fn ly_version_info(out: *mut *mut LyResult, error: *mut *mut LyError) -> c_uint;
59
60 pub fn ly_error_code(error: *const LyError) -> c_uint;
61
62 pub fn ly_error_message(error: *const LyError) -> *const c_char;
63
64 pub fn ly_error_is_retryable(error: *const LyError) -> bool;
65
66 pub fn ly_error_details_json(
67 error: *const LyError,
68 data: *mut *const c_char,
69 len: *mut usize,
70 ) -> c_uint;
71
72 pub fn ly_download_start(
73 context: *mut LyContext,
74 url: *const c_char,
75 url_len: usize,
76 options_json: *const c_char,
77 options_len: usize,
78 out: *mut *mut LyJob,
79 error: *mut *mut LyError,
80 ) -> c_uint;
81
82 pub fn ly_job_poll(
83 job: *mut LyJob,
84 state: *mut c_uint,
85 events: *mut *mut LyResult,
86 error: *mut *mut LyError,
87 ) -> c_uint;
88
89 pub fn ly_job_wait(
90 job: *mut LyJob,
91 out: *mut *mut LyResult,
92 error: *mut *mut LyError,
93 ) -> c_uint;
94
95 pub fn ly_job_cancel(job: *mut LyJob) -> c_uint;
96
97 pub fn ly_job_release(job: *mut LyJob);
98
99 pub fn ly_error_release(error: *mut LyError);
100}