Skip to content

Add simple apl builder #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ use crate::{
},
error::{Error, Result},
http::{self, HeaderMap},
is_personal_token, users,
is_personal_token,
query_builder::{QueryBuilder, StateInitial, StatefulQueryBuilder},
users,
};

/// API URL is the URL for the Axiom Cloud API.
Expand Down Expand Up @@ -82,8 +84,13 @@ impl Client {
env!("CARGO_PKG_VERSION").to_string()
}

/// Get an APL query builder for the given dataset.
pub fn apl_builder(dataset_name: impl Into<String>) -> StatefulQueryBuilder<StateInitial> {
QueryBuilder::new(dataset_name)
}

/// Executes the given query specified using the Axiom Processing Language (APL).
/// To learn more about APL, see the APL documentation at https://www.axiom.co/docs/apl/introduction.
/// To learn more about APL, see the APL documentation at <https://www.axiom.co/docs/apl/introduction>.
#[instrument(skip(self, opts))]
pub async fn query<S, O>(&self, apl: S, opts: O) -> Result<QueryResult>
where
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub mod client;
pub mod error;
mod http;
pub mod limits;
pub mod query_builder;
mod serde;

pub mod datasets;
Expand Down
Loading