Skip to content
Merged
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
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish to crates.io
on:
push:
tags: ['v*'] # Triggers when pushing tags starting with 'v'
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OIDC token exchange
steps:
- uses: actions/checkout@v4
- uses: rust-lang/crates-io-auth-action@v1
id: auth

- name: Publish typesense_derive
run: cargo publish
working-directory: typesense_derive

- name: Publish typesense_codegen
run: cargo publish
working-directory: typesense_codegen

- name: Publish typesense
run: cargo publish
working-directory: typesense
14 changes: 14 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,17 @@ members = [
"typesense_derive",
"typesense_codegen"
]

resolver = "3"

[workspace.package]
version = "0.3.0"
edition = "2024"
license = "Apache-2.0"
repository = "https://github.com/typesense/typesense-rust"
authors = ["Typesense <contact@typesense.org>"]

[workspace.dependencies]

typesense_derive = { path = "./typesense_derive", version = "0.3.0" }
typesense_codegen = { path = "./typesense_codegen", version = "0.25.0" }
16 changes: 8 additions & 8 deletions typesense/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "typesense"
version = "0.1.0"
authors = ["Typesense <contact@typesense.org>"]
edition = "2018"
license = "Apache-2.0"
description = "WIP client for typesense"
repository = "https://github.com/typesense/typesense-rust"
version.workspace = true
authors.workspace = true
repository.workspace = true
edition.workspace = true
license.workspace = true
description = "Client for typesense"

[features]
default = ["derive"]
Expand All @@ -24,8 +24,8 @@ hmac = "0.12"
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.10"
typesense_derive = { version = "0.1.0", path = "../typesense_derive", optional = true }
typesense_codegen = { version = "0.25.0", path = "../typesense_codegen" }
typesense_derive = { workspace = true, optional = true }
typesense_codegen = { workspace = true }

[dev-dependencies]
dotenvy = "0.15"
Expand Down
2 changes: 1 addition & 1 deletion typesense/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! A document to be indexed in a given collection must conform to the schema of the collection.
//!
use crate::collection_schema::CollectionSchema;
use serde::{de::DeserializeOwned, Serialize};
use serde::{Serialize, de::DeserializeOwned};

/// Trait that should implement every struct that wants to be represented as a Typesense
/// Document
Expand Down
4 changes: 2 additions & 2 deletions typesense/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! More info [here](https://typesense.org/docs/0.20.0/api/api-keys.html).

use base64::{engine::general_purpose::STANDARD as Base64Engine, Engine};
use base64::{Engine, engine::general_purpose::STANDARD as Base64Engine};
use core::fmt;
use hmac::{Hmac, Mac};
use serde::{Deserialize, Serialize};
Expand All @@ -29,7 +29,7 @@ pub async fn generate_scoped_search_key(
let digest = Base64Engine.encode(result.into_bytes());

let key_prefix = &key.as_ref()[0..4];
let raw_scoped_key = format!("{}{}{}", digest, key_prefix, params);
let raw_scoped_key = format!("{digest}{key_prefix}{params}");

Ok(Base64Engine.encode(raw_scoped_key.as_bytes()))
}
Expand Down
2 changes: 1 addition & 1 deletion typesense/tests/api/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use super::Config;
use serde::{Deserialize, Serialize};
use typesense::document::Document;
use typesense::Typesense;
use typesense::document::Document;
use typesense_codegen::apis::collections_api;
use typesense_codegen::models::{CollectionResponse, CollectionSchema};

Expand Down
2 changes: 1 addition & 1 deletion typesense/tests/api/documents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use super::Config;
use serde::{Deserialize, Serialize};
use typesense::Typesense;
use typesense::document::Document;
use typesense::models::SearchParameters;
use typesense::Typesense;
use typesense_codegen::apis::documents_api;

#[derive(Typesense, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion typesense/tests/derive/collection.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
use typesense::document::Document;
use typesense::Typesense;
use typesense::document::Document;

#[test]
fn derived_document_generates_schema() {
Expand Down
11 changes: 6 additions & 5 deletions typesense_codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[package]
name = "typesense_codegen"
version = "0.25.0"
authors = ["OpenAPI Generator team and contributors"]
description = "client for typesense generated with openapi spec"
edition = "2018"
license = "Apache-2.0"
version = "0.25.1"
description = "Types for typesense generated with openapi spec"
authors.workspace = true
repository.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
serde = "^1.0"
Expand Down
10 changes: 5 additions & 5 deletions typesense_codegen/src/apis/analytics_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech
*/

use super::{configuration, Error};
use super::{Error, configuration};
use crate::apis::ResponseContent;

/// struct for typed errors of method [`create_analytics_rule`]
Expand Down Expand Up @@ -62,7 +62,7 @@ pub async fn create_analytics_rule(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -114,7 +114,7 @@ pub async fn delete_analytics_rule(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -165,7 +165,7 @@ pub async fn retrieve_analytics_rule(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -211,7 +211,7 @@ pub async fn retrieve_analytics_rules(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down
20 changes: 10 additions & 10 deletions typesense_codegen/src/apis/collections_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech
*/

use super::{configuration, Error};
use super::{Error, configuration};
use crate::apis::ResponseContent;

/// struct for typed errors of method [`create_collection`]
Expand Down Expand Up @@ -104,7 +104,7 @@ pub async fn create_collection(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -155,7 +155,7 @@ pub async fn delete_alias(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -206,7 +206,7 @@ pub async fn delete_collection(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -257,7 +257,7 @@ pub async fn get_alias(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -302,7 +302,7 @@ pub async fn get_aliases(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -353,7 +353,7 @@ pub async fn get_collection(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -399,7 +399,7 @@ pub async fn get_collections(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -451,7 +451,7 @@ pub async fn update_collection(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down Expand Up @@ -504,7 +504,7 @@ pub async fn upsert_alias(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down
4 changes: 2 additions & 2 deletions typesense_codegen/src/apis/debug_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech
*/

use super::{configuration, Error};
use super::{Error, configuration};
use crate::apis::ResponseContent;

/// struct for typed errors of method [`debug`]
Expand Down Expand Up @@ -37,7 +37,7 @@ pub async fn debug(
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
let local_var_key = &local_var_apikey.key;
let local_var_value = match local_var_apikey.prefix {
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
None => local_var_key.clone(),
};
local_var_req_builder =
Expand Down
Loading
Loading