151 Commits

Author SHA1 Message Date
fac607719d Move the CreateResult enum into the releases mod
This thing only needs to exist so Serde can decode the response JSON
properly. I'll either get a success, a missing token, *no body at all
which doesnt' make sense*, or some other ApiError text. In all cases,
the crate::Result is returned. This thing doesn't need to be public.
2025-06-01 11:07:11 -05:00
ee42e09620 Fix API response decoding -- sometimes it's an err
The reqwest might work, but the API still returns an error message.
I forgot about this old hack I had left around because I'm a big dummy.
2025-05-31 22:46:54 -05:00
8ab1f77b0e Only apply the Auth token header if a token exists 2025-05-31 22:21:41 -05:00
508e2ac802 Fix auth token header, needs "token" prefix
https://docs.gitea.com/development/api-usage#authentication

I had this right earlier, but dropped it after the switch to a pre-
configured client via ClientBuilder a few commits ago.
2025-05-31 20:53:36 -05:00
baf0117a74 Delete the error mapper utility
Now that all API functions are the new versions using my gt_tools::Error
type natively, I don't need to map from the reqwest::Error into the
wrapped variant.
2025-05-29 17:46:00 -05:00
3e563d4bb0 Clean up now-unused imports in main.rs 2025-05-29 17:45:46 -05:00
e848d9ace5 Delete old do_upload_release 2025-05-29 17:42:54 -05:00
6b537c8992 Hook in new create_release_attachment to main 2025-05-29 17:42:31 -05:00
6d95e54bc7 Transfer impl of release_attach to new home
A bunch of code has been dropped because it's no longer necessary -- yay for better data builder usage and real error handling!
2025-05-29 17:42:26 -05:00
29172bae0b Delete old do_create_release function 2025-05-28 20:29:41 -05:00
4250deb419 Implement new fn create_release() 2025-05-28 20:27:52 -05:00
a212dc3ceb Drop unused imports 2025-05-28 20:27:31 -05:00
766703b8ec Load API token at startup, not API calls 2025-05-28 20:21:13 -05:00
a16594f5a9 Use our own Error enum in fn main 2025-05-28 19:33:52 -05:00
d3a0d3f67e Fix the URL path to actually go to the API 2025-05-28 19:27:32 -05:00
90ae47abb2 Delete old do_list_releases, wire in the new one
With an `.unwrap()` because the error types don't match right now.
2025-05-27 23:05:03 -05:00
472e592400 Implement the new ::api::list_releases function 2025-05-27 23:03:09 -05:00
e19602925e Add release_attachment module
For whatever reason, releases and release attachments are separate modules in the Gitea codebase. I'm going to continue mirroring that structure for now.
2025-05-27 23:02:27 -05:00
36adabb4fd Start our own Error enum 2025-05-27 23:01:49 -05:00
84bd7fe990 Fix release API module's name 2025-05-27 20:52:23 -05:00
5db1134257 Move CreateReleaseOption to new tree 2025-05-27 20:46:04 -05:00
5f666a8179 Move the Release info structs to new tree 2025-05-27 20:43:39 -05:00
351c4902ae Create new module layout based on Gitea's own 2025-05-27 20:40:13 -05:00
b26436d5be Remove already commented-out code & dbg prints 2025-05-27 19:26:11 -05:00
053ee8def9 Use file name, not whole path as upload name 2025-05-27 19:21:05 -05:00
c731cd963c Some but not all of the upload routine 2025-05-27 19:19:09 -05:00
54487622c0 Add CLI option for uploading files + dummy hookup
I think this is the interface I want for uploading release files. There is an extra option to create the release ahead of the upload just in case it doesn't exist. One *should* create it with the create command or through the Gitea GUI so that everything can be properly written into the release info.
2025-05-25 09:08:22 -05:00
8843640385 Thread the primary args through the operation fn's 2025-05-24 19:33:46 -05:00
6b409c56d4 Change primary arguments
Owner and repo are combined into one string the same way Go dependencies or GitHub Actions are named. `<owner>/<repo>`

Each will be fetched from a matching environment variable if not specified on the command line.
2025-05-24 19:33:21 -05:00
1210b168ee Demo: missing CLI args can be filled via env vars 2025-05-24 19:00:35 -05:00
985c411902 Wire in the release CLI args to the creation fn 2025-05-24 18:47:51 -05:00
c5efb0e9f7 Add remaining release creation CLI args 2025-05-24 18:47:35 -05:00
973d9aa6c6 Fix: missing slash between owner and repo 2025-05-24 18:29:49 -05:00
0f4f2ee48f TODO: Serde won't make empty-vec 2025-05-24 18:17:41 -05:00
d4ec677b28 Internal-ize API endpoint assembly for create-release 2025-05-24 18:15:01 -05:00
2c9cd5b958 Move list-releases code to its own function 2025-05-24 18:13:39 -05:00
f7ba2e99aa Assemble fragments to get API endpoint 2025-05-24 18:13:10 -05:00
da15506896 Sort derive macros 2025-05-24 17:59:25 -05:00
2705900e10 Lint 2025-05-24 17:59:17 -05:00
80637ca76c Move create-release code to it's own function 2025-05-24 17:56:10 -05:00
19cb224598 Hook up the new deserialization structs 2025-05-24 17:07:08 -05:00
26fa57a24f Additional structs & enums for API error responses
Obviously the Gitea API can return errors, which are also JSON strings.
Theres a new error response struct to collect these, and an enum for
Serde to unpack which ever variant happens to come back.
2025-05-24 17:04:08 -05:00
f1da1b508a Releases can now be created... sorta
The API token is read from the environment variable `RELEASE_KEY_GITEA`.
"GITEA" is on the end because Gitea itself will refuse to allow users to
configure Act variables starting with the name "GITEA_".

All information about the release is hard-coded right now. I just needed
to see it hit the API and appear on the Gitea page. Hooking up the extra
options is up next.
2025-05-24 15:14:53 -05:00
f31f5b49da Move the URL and HTTP Client out of match block
I'm going to need these in several of the arms.
2025-05-24 14:53:16 -05:00
013c797e1f Drop nested list variable in command
The enum variant is the value this code-path requires. The inner bool doesn't do anything, so it can go away.
2025-05-24 14:31:07 -05:00
8b0f60d348 Wire in the ListReleases primary command
Hey, look at that. I can do the thing what with the stuff and such.
2025-05-24 14:18:38 -05:00
408b0108a5 Starting the Clap CLI parser 2025-05-24 13:52:32 -05:00
2067964a80 Demo use of JSON deserialization
It Just Works. Praise the Rust macros.
2025-05-22 18:23:32 -05:00
4d16f8f292 Add structs to represent API results
So far it's just a pair that work together to do the repo list results.
2025-05-22 18:23:32 -05:00
45b5049d0e Slapdash API call demo
I can hit the endpoint and retrieve data. Excellent.
2025-05-22 18:23:32 -05:00