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
13 changes: 13 additions & 0 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2026 Peanut Butter Unicorn LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Test
on:
pull_request:
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2026 Peanut Butter Unicorn LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Release

on:
Expand Down Expand Up @@ -32,4 +45,4 @@ jobs:
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_FILE: ${{ secrets.GPG_FILE }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
run: ./gradlew publishToMavenCentral --info
run: ./gradlew publishToMavenCentral --info
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ A good way to summarize the 'testing commandments' is "If it's documented, [test

```java
/**
* {@summary List Locales}
* <h1>{@summary List Locales}</h1>
* Lists the translation locales available for the account. Allowed for anyone
*
* @return Success response (status code 200)
Expand Down
34 changes: 17 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2026 Peanut Butter Unicorn, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED

Expand All @@ -9,7 +24,6 @@ plugins {
id("signing")
id("com.gradleup.nmcp.aggregation").version("1.4.4")
id("io.micronaut.library") version "4.6.2"
id("io.micronaut.openapi") version "4.6.2"
id("jacoco")
id("org.sonarqube") version "latest.release"
}
Expand Down Expand Up @@ -60,21 +74,6 @@ micronaut {
incremental(true)
annotations("lol.pbu.*")
}
openapi {
version = "6.20.0"
client(file("src/main/resources/z4j.yaml")) {
apiPackageName.set("lol.pbu.z4j.client")
modelPackageName.set("lol.pbu.z4j.model")
useReactive.set(true)
useAuth.set(false)
lombok.set(true)
clientId.set("zendesk")
apiNameSuffix.set("Client")
alwaysUseGenerateHttpResponse.set(false)
generateHttpResponseWhereRequired.set(false)
additionalProperties.put("retryable", "true")
}
}
}

sonarqube {
Expand Down Expand Up @@ -125,7 +124,7 @@ publishing {
}
developers {
developer {
id.set("jonathan-zollinger")
id.set("Jonathan-Zollinger")
name.set("Jonathan Zollinger")
email.set("jonathan.zollinger@gmail.com")
}
Expand Down Expand Up @@ -158,3 +157,4 @@ nmcpAggregation {
}
publishAllProjectsProbablyBreakingProjectIsolation()
}

16 changes: 16 additions & 0 deletions gradle/asciidoc.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2026 Peanut Butter Unicorn, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
asciidoctorj {
version '2.1.0'
modules {
Expand All @@ -21,3 +36,4 @@ asciidoctorj {
"revnumber": "$project.version"
}


17 changes: 16 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
rootProject.name = "z4j"
/*
* Copyright 2026 Peanut Butter Unicorn, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
rootProject.name = "z4j"
64 changes: 64 additions & 0 deletions src/main/java/lol/pbu/z4j/client/ArticleClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright 2026 Peanut Butter Unicorn, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lol.pbu.z4j.client;

import io.micronaut.core.annotation.Nullable;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.PathVariable;
import io.micronaut.http.annotation.QueryValue;
import io.micronaut.http.client.annotation.Client;
import io.micronaut.retry.annotation.Retryable;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lol.pbu.z4j.model.ArticlesResponse;
import lol.pbu.z4j.model.LocaleAbbreviation;
import lol.pbu.z4j.model.SortArticleBy;
import lol.pbu.z4j.model.SortOrder;
import reactor.core.publisher.Mono;

/**
* <h1>{@summary Work with Articles in Zendesk.}</h1>
*
* <ul><li> List Articles by a given locale with {@link #listArticles}</li></ul>
*
* @author Jonathan-Zollinger
* @since 0.1.1
*/

@Retryable
@Client("zendesk")
public interface ArticleClient {

/**
* <h1>{@summary List Articles}</h1>
*
* @param localeAbbreviation The locale in which the article is displayed. (must be lowercase, even if zendesk returns a mixed case response) (required)
* @param sortBy Sorts the articles by one of the accepted values (optional)
* @param sortOrder Selects the order of the results. (optional)
* @param startTime You can use the incremental article endpoint to list all the articles that were updated since a certain date and time.
* This time is given as a <a href='https://www.epochconverter.com/'>Unix epoch timeStamp</a> (optional)
* @param labelNames Only articles that have all the labels are returned. Multiple labels can be passed in a comma-delimited string (optional)
* @return OK Response (status code 200)
*/
@Get("/api/v2/help_center/{locale}/articles")
Mono<@Valid ArticlesResponse> listArticles(
@PathVariable("locale") @NotNull LocaleAbbreviation localeAbbreviation,
@QueryValue("sort_by") @Nullable SortArticleBy sortBy,
@QueryValue("sort_order") @Nullable SortOrder sortOrder,
@QueryValue("start_time") @Nullable Long startTime,
@QueryValue("label_names") @Nullable String labelNames
);
}
19 changes: 17 additions & 2 deletions src/main/java/lol/pbu/z4j/client/BasicAuthFilter.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2026 Peanut Butter Unicorn, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lol.pbu.z4j.client;

import io.micronaut.context.annotation.Property;
Expand All @@ -13,7 +28,6 @@
/**
* Add a basic auth to anything
*

* @author Jonathan Zollinger
* @since 0.0.1
*/
Expand All @@ -34,7 +48,7 @@ public class BasicAuthFilter {
* @param token api token generated from z4j
*/
public BasicAuthFilter(@Property(name = "micronaut.http.services.zendesk.email") String email,
@Property(name = "micronaut.http.services.zendesk.token") String token){
@Property(name = "micronaut.http.services.zendesk.token") String token) {
this.email = email;
this.token = token;
}
Expand All @@ -47,3 +61,4 @@ public void doFilter(MutableHttpRequest<?> request) {
request.header("Content-Type", "application/json");
}
}

Loading
Loading