Add synchronous support to the DeliveryClient

オープン
#109 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

  • #112 @cunhazera による — マージされずにクローズ

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java
領域
api

調査の方向性

まず DeliveryClient のメソッドと、issue に記載されている CompletionStage ベースの戻り値を読み、それらを提供されている DeliveryClientHelper ラッパーと比較します。同期的な代替手段で結果と失敗をどのように公開するかを定義し、完了条件として呼び出し例を検討します。

索引モデルが issue の本文から書いたものです。

説明

enhancement good first issue groomed hacktoberfest help wanted up-for-grabs
Motivation

After updating a large application to the latest version of the Java SDK, all calls to the DeliveryClient had to wrapped in a synchronous wrapper. It would be helpful if there were a built-in way to call the DeliveryClient synchronously rather than introducing additional code to the project.

Proposed solution

Add alternate methods for working with the DeliveryClient synchronously, for example:

deliveryClient.getItems().toSync() or deliveryClient.getItemsSynchronously()

Additional context

Here is the wrapper class that I had to write:

public class DeliveryClientHelper {
    public static <T> T toSync(CompletionStage<T> completionStage) {
        try {
            return completionStage.toCompletableFuture().get();
        } catch (InterruptedException e) {
            log.error("Error converting completion stage: {}", e.getMessage());
        } catch (ExecutionException e) {
            log.error("Error converting completion stage: {}", e.getMessage());
        }
        return null;
    }
}

An example call using the wrapper:

List<AgencySiteBlogLanding> blogHomepages = DeliveryClientHelper.toSync(deliveryClient.getItems(AgencySiteBlogLanding.class));

An ideal way to use the DeliveryClient

List<AgencySiteBlogLanding> blogHomepages = deliveryClient.getItems(AgencySiteBlogLanding.class).toSync();
主要言語
Java
スター
17
フォーク
27
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

kontent-ai/java-packages のほかの issue

kontent-ai/java-packages の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。