From 22c1abd093f9eb4d7604d792e49cae76187fc559 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Wed, 24 Feb 2021 13:12:13 -0500 Subject: [PATCH] added some source files --- src/generate.rs | 5 ++++ src/request.rs | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 src/generate.rs create mode 100644 src/request.rs diff --git a/src/generate.rs b/src/generate.rs new file mode 100644 index 0000000..9ceed81 --- /dev/null +++ b/src/generate.rs @@ -0,0 +1,5 @@ +use crate::config::Configuration; + +fn generate_config() { + +} \ No newline at end of file diff --git a/src/request.rs b/src/request.rs new file mode 100644 index 0000000..d9038b8 --- /dev/null +++ b/src/request.rs @@ -0,0 +1,64 @@ +use std::collections::HashMap; + +use clap::ArgMatches; +use reqwest::Client; + +use crate::config::Configuration; + +pub struct Request<'a> { + pub client: Client, + pub arg_value: Vec<&'a str>, + pub map: HashMap, + pub url: Option, +} + +pub struct Authentication { + pub basic: bool, + pub api_token: bool, +} + +impl Request<'static> { + fn new() -> Request<'static> { + Request { + client: Client::new(), + arg_value: Vec::new(), + map: HashMap::new(), + url: None + } + } +} + +impl Authentication { + pub fn new(config: &Configuration) -> Authentication { + let basic_auth: String; + let api_auth: String; + + // TODO: might be broken, haven't tested + // this is horror code, I know it + // match the damn thing + // someone is going to take this and put it in r/badcode lol + + match config { + _ => panic!() + } + } + + fn with_basic() -> Authentication { + Authentication { + basic: true, + api_token: false + } + } + + fn with_api_token() -> Authentication { + Authentication { + basic: false, + api_token: true + } + } + + // This method requires the instanciated config, an optional instanciated args, and instanciated auth + pub fn request_chooser(&self, config: &Configuration, arg: Option<&ArgMatches>, auth: &Authentication, arg_string: &str) { + + } +} \ No newline at end of file