Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshew committed Feb 24, 2025
2 parents 5b4958a + 67cf6ad commit cadb95e
Show file tree
Hide file tree
Showing 100 changed files with 1,732 additions and 2,368 deletions.
2 changes: 1 addition & 1 deletion cli/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2024 Vercel, Inc
Copyright (c) 2025 Vercel, Inc

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
36 changes: 5 additions & 31 deletions crates/turborepo-api-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use serde::Deserialize;
use turborepo_ci::{is_ci, Vendor};
use turborepo_vercel_api::{
token::ResponseTokenMetadata, APIError, CachingStatus, CachingStatusResponse,
PreflightResponse, SpacesResponse, Team, TeamsResponse, UserResponse, VerificationResponse,
VerifiedSsoUser,
PreflightResponse, Team, TeamsResponse, UserResponse, VerificationResponse, VerifiedSsoUser,
};
use url::Url;

Expand All @@ -23,7 +22,6 @@ pub use crate::error::{Error, Result};
pub mod analytics;
mod error;
mod retry;
pub mod spaces;
pub mod telemetry;

pub use bytes::Bytes;
Expand All @@ -43,11 +41,6 @@ pub trait Client {
team_id: &str,
) -> impl Future<Output = Result<Option<Team>>> + Send;
fn add_ci_header(request_builder: RequestBuilder) -> RequestBuilder;
fn get_spaces(
&self,
token: &str,
team_id: Option<&str>,
) -> impl Future<Output = Result<SpacesResponse>> + Send;
fn verify_sso_token(
&self,
token: &str,
Expand Down Expand Up @@ -199,29 +192,6 @@ impl Client for APIClient {
request_builder
}

async fn get_spaces(&self, token: &str, team_id: Option<&str>) -> Result<SpacesResponse> {
// create url with teamId if provided
let endpoint = match team_id {
Some(team_id) => format!("/v0/spaces?limit=100&teamId={}", team_id),
None => "/v0/spaces?limit=100".to_string(),
};

let request_builder = self
.client
.get(self.make_url(endpoint.as_str())?)
.header("User-Agent", self.user_agent.clone())
.header("Content-Type", "application/json")
.header("Authorization", format!("Bearer {}", token));

let response =
retry::make_retryable_request(request_builder, retry::RetryStrategy::Timeout)
.await?
.into_response()
.error_for_status()?;

Ok(response.json().await?)
}

async fn verify_sso_token(&self, token: &str, token_name: &str) -> Result<VerifiedSsoUser> {
let request_builder = self
.client
Expand Down Expand Up @@ -628,6 +598,10 @@ impl APIClient {
self.base_url.as_str()
}

pub fn with_base_url(&mut self, base_url: String) {
self.base_url = base_url;
}

async fn do_preflight(
&self,
token: &str,
Expand Down
264 changes: 0 additions & 264 deletions crates/turborepo-api-client/src/spaces.rs

This file was deleted.

11 changes: 2 additions & 9 deletions crates/turborepo-auth/src/auth/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ mod tests {
use async_trait::async_trait;
use reqwest::{Method, RequestBuilder, Response};
use turborepo_vercel_api::{
CachingStatus, CachingStatusResponse, Membership, Role, SpacesResponse, Team,
TeamsResponse, User, UserResponse, VerifiedSsoUser,
CachingStatus, CachingStatusResponse, Membership, Role, Team, TeamsResponse, User,
UserResponse, VerifiedSsoUser,
};
use turborepo_vercel_api_mock::start_test_server;

Expand Down Expand Up @@ -247,13 +247,6 @@ mod tests {
fn add_ci_header(_request_builder: RequestBuilder) -> RequestBuilder {
unimplemented!("add_ci_header")
}
async fn get_spaces(
&self,
_token: &str,
_team_id: Option<&str>,
) -> turborepo_api_client::Result<SpacesResponse> {
unimplemented!("get_spaces")
}
async fn verify_sso_token(
&self,
token: &str,
Expand Down
10 changes: 1 addition & 9 deletions crates/turborepo-auth/src/auth/logout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ mod tests {
use turborepo_api_client::Client;
use turborepo_ui::ColorConfig;
use turborepo_vercel_api::{
token::ResponseTokenMetadata, SpacesResponse, Team, TeamsResponse, UserResponse,
VerifiedSsoUser,
token::ResponseTokenMetadata, Team, TeamsResponse, UserResponse, VerifiedSsoUser,
};
use url::Url;

Expand All @@ -116,13 +115,6 @@ mod tests {
fn add_ci_header(_request_builder: RequestBuilder) -> RequestBuilder {
unimplemented!("add_ci_header")
}
async fn get_spaces(
&self,
_token: &str,
_team_id: Option<&str>,
) -> turborepo_api_client::Result<SpacesResponse> {
unimplemented!("get_spaces")
}
async fn verify_sso_token(
&self,
token: &str,
Expand Down
Loading

0 comments on commit cadb95e

Please sign in to comment.