Skip to content

Commit

Permalink
Merge branch 'release/v0.8.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
ja573 committed Sep 30, 2022
2 parents 6a151db + 3bad9d5 commit a012467
Show file tree
Hide file tree
Showing 32 changed files with 609 additions and 76 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- [#438](https://github.com/thoth-pub/thoth/issues/438) - Allow specifying query parameters based on the requested specification
- Upgrade rust to `1.64.0` in development `Dockerfile`

## [[0.8.9]](https://github.com/thoth-pub/thoth/releases/tag/v0.8.9) - 2022-09-21
### Added
Expand Down
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth"
version = "0.8.9"
version = "0.8.10"
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" }
members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"]

[dependencies]
thoth-api = { version = "0.8.9", path = "thoth-api", features = ["backend"] }
thoth-api-server = { version = "0.8.9", path = "thoth-api-server" }
thoth-app-server = { version = "0.8.9", path = "thoth-app-server" }
thoth-errors = { version = "0.8.9", path = "thoth-errors" }
thoth-export-server = { version = "0.8.9", path = "thoth-export-server" }
thoth-api = { version = "0.8.10", path = "thoth-api", features = ["backend"] }
thoth-api-server = { version = "0.8.10", path = "thoth-api-server" }
thoth-app-server = { version = "0.8.10", path = "thoth-app-server" }
thoth-errors = { version = "0.8.10", path = "thoth-errors" }
thoth-export-server = { version = "0.8.10", path = "thoth-export-server" }
clap = "2.33.3"
dialoguer = "0.7.1"
dotenv = "0.15.0"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUST_VERSION=1.63.0
ARG RUST_VERSION=1.64.0

FROM rust:${RUST_VERSION}

Expand Down
6 changes: 3 additions & 3 deletions thoth-api-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth-api-server"
version = "0.8.9"
version = "0.8.10"
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth"
readme = "README.md"

[dependencies]
thoth-api = { version = "0.8.9", path = "../thoth-api", features = ["backend"] }
thoth-errors = { version = "0.8.9", path = "../thoth-errors" }
thoth-api = { version = "0.8.10", path = "../thoth-api", features = ["backend"] }
thoth-errors = { version = "0.8.10", path = "../thoth-errors" }
actix-web = "4.0.1"
actix-cors = "0.6.0"
actix-identity = "0.4.0"
Expand Down
4 changes: 2 additions & 2 deletions thoth-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth-api"
version = "0.8.9"
version = "0.8.10"
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" }
backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web"]

[dependencies]
thoth-errors = { version = "0.8.9", path = "../thoth-errors" }
thoth-errors = { version = "0.8.10", path = "../thoth-errors" }
actix-web = { version = "4.0.1", optional = true }
argon2rs = "0.2.5"
isbn2 = "0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion thoth-app-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth-app-server"
version = "0.8.9"
version = "0.8.10"
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
edition = "2018"
license = "Apache-2.0"
Expand Down
6 changes: 3 additions & 3 deletions thoth-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth-app"
version = "0.8.9"
version = "0.8.10"
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
edition = "2018"
license = "Apache-2.0"
Expand Down Expand Up @@ -38,5 +38,5 @@ serde = { version = "1.0.115", features = ["derive"] }
serde_json = "1.0"
url = "2.1.1"
uuid = { version = "0.7", features = ["serde", "v4"] }
thoth-api = { version = "0.8.9", path = "../thoth-api" }
thoth-errors = { version = "0.8.9", path = "../thoth-errors" }
thoth-api = { version = "0.8.10", path = "../thoth-api" }
thoth-errors = { version = "0.8.10", path = "../thoth-errors" }
2 changes: 1 addition & 1 deletion thoth-app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"start_url": "/?homescreen=1",
"background_color": "#ffffff",
"theme_color": "#ffdd57",
"version": "0.8.9",
"version": "0.8.10",
"icons": [
{
"src": "\/android-icon-36x36.png",
Expand Down
2 changes: 2 additions & 0 deletions thoth-app/src/component/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::let_unit_value)]

#[macro_export]
macro_rules! pagination_helpers {
($component:ident, $pagination_text:ident, $search_text:ident) => {
Expand Down
6 changes: 3 additions & 3 deletions thoth-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth-client"
version = "0.8.9"
version = "0.8.10"
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth"
readme = "README.md"

[dependencies]
thoth-api = {version = "0.8.9", path = "../thoth-api" }
thoth-errors = {version = "0.8.9", path = "../thoth-errors" }
thoth-api = {version = "0.8.10", path = "../thoth-api" }
thoth-errors = {version = "0.8.10", path = "../thoth-errors" }
graphql_client = "0.11.0"
chrono = { version = "0.4", features = ["serde"] }
reqwest = { version = "0.11", features = ["json"] }
Expand Down
34 changes: 25 additions & 9 deletions thoth-client/assets/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fragment Work on Work {
publisherUrl
}
}
issues {
issues(limit: $issuesLimit) {
issueOrdinal
series {
seriesType
Expand Down Expand Up @@ -67,12 +67,12 @@ fragment Work on Work {
}
}
}
languages {
languages(limit: $languagesLimit) {
languageCode
languageRelation
mainLanguage
}
publications {
publications(limit: $publicationsLimit) {
publicationId
publicationType
isbn
Expand All @@ -98,12 +98,12 @@ fragment Work on Work {
canonical
}
}
subjects {
subjects(limit: $subjectsLimit) {
subjectCode
subjectType
subjectOrdinal
}
fundings {
fundings(limit: $fundingsLimit) {
program
projectName
projectShortname
Expand All @@ -116,7 +116,7 @@ fragment Work on Work {
countryCode
}
}
relations {
relations(limit: $relationsLimit) {
relationType
relationOrdinal
relatedWork {
Expand Down Expand Up @@ -157,13 +157,29 @@ fragment Work on Work {
}
}

query WorkQuery($workId: Uuid!) {
query WorkQuery(
$workId: Uuid!,
$issuesLimit: Int!,
$languagesLimit: Int!,
$publicationsLimit: Int!,
$subjectsLimit: Int!,
$fundingsLimit: Int!,
$relationsLimit: Int!
) {
work(workId: $workId) {
...Work
}
}
query WorksQuery($publishers: [Uuid!]) {
query WorksQuery(
$publishers: [Uuid!],
$issuesLimit: Int!,
$languagesLimit: Int!,
$publicationsLimit: Int!,
$subjectsLimit: Int!,
$fundingsLimit: Int!,
$relationsLimit: Int!
) {
works(limit: 99999, publishers: $publishers) {
...Work
}
}
}
26 changes: 18 additions & 8 deletions thoth-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod parameters;
// GraphQLQuery derive macro breaks this linting rule - ignore while awaiting fix
#[allow(clippy::derive_partial_eq_without_eq)]
mod queries;
Expand All @@ -9,6 +10,8 @@ use std::future::Future;
use thoth_errors::{ThothError, ThothResult};
use uuid::Uuid;

pub use crate::parameters::QueryParameters;
use crate::parameters::{WorkQueryVariables, WorksQueryVariables};
pub use crate::queries::work_query::*;
use crate::queries::{work_query, works_query, WorkQuery, WorksQuery};

Expand Down Expand Up @@ -50,18 +53,19 @@ impl ThothClient {
///
/// ```no_run
/// # use thoth_errors::ThothResult;
/// # use thoth_client::{ThothClient, Work};
/// # use thoth_client::{QueryParameters, ThothClient, Work};
/// # use uuid::Uuid;
///
/// # async fn run() -> ThothResult<Work> {
/// let thoth_client = ThothClient::new("https://api.thoth.pub/graphql".to_string());
/// let work_id = Uuid::parse_str("00000000-0000-0000-AAAA-000000000001")?;
/// let work = thoth_client.get_work(work_id).await?;
/// let work = thoth_client.get_work(work_id, QueryParameters::new()).await?;
/// # Ok(work)
/// # }
/// ```
pub async fn get_work(&self, work_id: Uuid) -> ThothResult<Work> {
let request_body = WorkQuery::build_query(work_query::Variables { work_id });
pub async fn get_work(&self, work_id: Uuid, parameters: QueryParameters) -> ThothResult<Work> {
let variables: work_query::Variables = WorkQueryVariables::new(work_id, parameters).into();
let request_body = WorkQuery::build_query(variables);
let res = self.post_request(&request_body).await.await?;
let response_body: Response<work_query::ResponseData> = res.json().await?;
match response_body.data {
Expand All @@ -80,18 +84,24 @@ impl ThothClient {
///
/// ```no_run
/// # use thoth_errors::ThothResult;
/// # use thoth_client::{ThothClient, Work};
/// # use thoth_client::{QueryParameters, ThothClient, Work};
/// # use uuid::Uuid;
///
/// # async fn run() -> ThothResult<Vec<Work>> {
/// let thoth_client = ThothClient::new("https://api.thoth.pub/graphql".to_string());
/// let publisher_id = Uuid::parse_str("00000000-0000-0000-AAAA-000000000001")?;
/// let works = thoth_client.get_works(Some(vec![publisher_id])).await?;
/// let works = thoth_client.get_works(Some(vec![publisher_id]), QueryParameters::new()).await?;
/// # Ok(works)
/// # }
/// ```
pub async fn get_works(&self, publishers: Option<Vec<Uuid>>) -> ThothResult<Vec<Work>> {
let request_body = WorksQuery::build_query(works_query::Variables { publishers });
pub async fn get_works(
&self,
publishers: Option<Vec<Uuid>>,
parameters: QueryParameters,
) -> ThothResult<Vec<Work>> {
let variables: works_query::Variables =
WorksQueryVariables::new(publishers, parameters).into();
let request_body = WorksQuery::build_query(variables);
let res = self.post_request(&request_body).await.await?;
let response_body: Response<works_query::ResponseData> = res.json().await?;
match response_body.data {
Expand Down
Loading

0 comments on commit a012467

Please sign in to comment.