chore: Rename endpoint consts and reformat

This commit is contained in:
Tyler Beckman 2024-10-27 14:25:08 -06:00
parent 6f290c90e9
commit aa4432bf37
Signed by: Ty
GPG key ID: 2813440C772555A4
3 changed files with 12 additions and 10 deletions

View file

@ -43,7 +43,7 @@ type Endpoint<'a> = (reqwest::Method, &'a str);
/// we could completely change it without requiring an upgrade to v1 /// we could completely change it without requiring an upgrade to v1
/// clients.) /// clients.)
/// ``` /// ```
pub const ADD_CHAIN_ENDPOINT: Endpoint = (reqwest::Method::POST, "/ct/v1/add-chain"); pub const ADD_CHAIN: Endpoint = (reqwest::Method::POST, "/ct/v1/add-chain");
/// Reference: https://datatracker.ietf.org/doc/html/rfc6962#section-4.2 /// Reference: https://datatracker.ietf.org/doc/html/rfc6962#section-4.2
/// ```txt /// ```txt
@ -59,4 +59,4 @@ pub const ADD_CHAIN_ENDPOINT: Endpoint = (reqwest::Method::POST, "/ct/v1/add-cha
/// ///
/// Outputs are the same as in Section 4.1. /// Outputs are the same as in Section 4.1.
/// ``` /// ```
pub const ADD_PRE_CHAIN_ENDPOINT: Endpoint = (reqwest::Method::POST, "/ct/v1/add-pre-chain"); pub const ADD_PRE_CHAIN: Endpoint = (reqwest::Method::POST, "/ct/v1/add-pre-chain");

View file

@ -34,8 +34,8 @@ impl CtApiClient {
) -> reqwest::Result<AddChainResponse> { ) -> reqwest::Result<AddChainResponse> {
self.inner_client self.inner_client
.request( .request(
endpoints::ADD_CHAIN_ENDPOINT.0, endpoints::ADD_CHAIN.0,
self.log_url.to_string() + endpoints::ADD_CHAIN_ENDPOINT.1 self.log_url.to_string() + endpoints::ADD_CHAIN.1
) )
.json(&AddChainRequest { chain }) .json(&AddChainRequest { chain })
.send() .send()
@ -67,8 +67,8 @@ impl CtApiClient {
) -> reqwest::Result<AddChainResponse> { ) -> reqwest::Result<AddChainResponse> {
self.inner_client self.inner_client
.request( .request(
endpoints::ADD_PRE_CHAIN_ENDPOINT.0, endpoints::ADD_PRE_CHAIN.0,
self.log_url.to_string() + endpoints::ADD_PRE_CHAIN_ENDPOINT.1 self.log_url.to_string() + endpoints::ADD_PRE_CHAIN.1
) )
.json(&AddChainRequest { chain }) .json(&AddChainRequest { chain })
.send() .send()

View file

@ -2,7 +2,8 @@ use serde::{Deserialize, Serialize};
/// A request payload for adding a chain to a CT log /// A request payload for adding a chain to a CT log
/// ///
/// See: [`super::endpoints::ADD_CHAIN_ENDPOINT`] or [`super::endpoints::ADD_PRE_CHAIN_ENDPOINT`] /// See: [`super::endpoints::ADD_CHAIN`] or
/// [`super::endpoints::ADD_PRE_CHAIN`]
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
pub struct AddChainRequest { pub struct AddChainRequest {
pub chain: Vec<String> pub chain: Vec<String>
@ -10,7 +11,8 @@ pub struct AddChainRequest {
/// A response given when adding a chain to a CT log /// A response given when adding a chain to a CT log
/// ///
/// See: [`super::endpoints::ADD_CHAIN_ENDPOINT`] or [`super::endpoints::ADD_PRE_CHAIN_ENDPOINT`] /// See: [`super::endpoints::ADD_CHAIN`] or
/// [`super::endpoints::ADD_PRE_CHAIN`]
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct AddChainResponse { pub struct AddChainResponse {
pub sct_version: u8, pub sct_version: u8,