Skip to content

Commit

Permalink
remove expand trait from subscription and extension requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jenschude committed Aug 8, 2023
1 parent d9588eb commit 7ec2338
Show file tree
Hide file tree
Showing 25 changed files with 42 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import io.sphere.sdk.discountcodes.commands.DiscountCodeDeleteCommand;
import io.sphere.sdk.expansion.ExpansionPath;
import io.sphere.sdk.expansion.MetaModelReferenceExpansionDsl;
import io.sphere.sdk.extensions.commands.ExtensionDeleteCommand;
import io.sphere.sdk.inventory.commands.InventoryEntryDeleteCommand;
import io.sphere.sdk.orders.commands.OrderDeleteCommand;
import io.sphere.sdk.payments.commands.PaymentDeleteCommand;
Expand All @@ -54,7 +53,6 @@
import io.sphere.sdk.shoppinglists.commands.ShoppingListDeleteCommand;
import io.sphere.sdk.states.commands.StateDeleteCommand;
import io.sphere.sdk.stores.commands.StoreDeleteCommand;
import io.sphere.sdk.subscriptions.commands.SubscriptionDeleteCommand;
import io.sphere.sdk.taxcategories.commands.TaxCategoryDeleteCommand;
import io.sphere.sdk.types.commands.TypeDeleteCommand;
import io.sphere.sdk.zones.commands.ZoneDeleteCommand;
Expand All @@ -71,13 +69,13 @@ public static DeleteBuilder of(final ProjectApiRoot apiRoot) {
return new DeleteBuilder(apiRoot);
}

@SuppressWarnings("unchecked")
public static <T extends ApiMethod<T, TResult> & ExpandableTrait<T> & VersionedTrait<T>, TResult, TQuery extends MetaModelReferenceExpansionDsl<?, ? extends DeleteCommand<?>, ?>> T delete(
final T request, final long version, final TQuery deleteDsl) {
T deleteRequest = request;
T deleteRequest = (T) request.withVersion(version);
for (ExpansionPath<?> expansionPath : deleteDsl.expansionPaths()) {
deleteRequest = (T) deleteRequest.addExpand(expansionPath.toSphereExpand());
}
request.withVersion(version);
return deleteRequest;
}

Expand Down Expand Up @@ -335,32 +333,22 @@ public ByProjectKeyCustomerGroupsByIDDelete customerGroup(
deleteDsl);
}

public ByProjectKeyExtensionsByIDDelete extension(final String id, final Long version,
final Function<ExtensionDeleteCommand, ExtensionDeleteCommand> deleteDsl) {
public ByProjectKeyExtensionsByIDDelete extension(final String id, final Long version) {
requireNonNull(id);
return delete(apiRoot.extensions().withId(id).delete(), version,
() -> ExtensionDeleteCommand.of(io.sphere.sdk.models.Versioned.of(id, version)), deleteDsl);
return apiRoot.extensions().withId(id).delete().withVersion(version);
}

public ByProjectKeyExtensionsByIDDelete extension(final Versioned<Extension> extension,
final Function<ExtensionDeleteCommand, ExtensionDeleteCommand> deleteDsl) {
public ByProjectKeyExtensionsByIDDelete extension(final Versioned<Extension> extension) {
requireNonNull(extension.getId());
requireNonNull(extension.getVersion());
return delete(apiRoot.extensions().withId(extension.getId()).delete(), extension.getVersion(),
() -> ExtensionDeleteCommand
.of(io.sphere.sdk.models.Versioned.of(extension.getId(), extension.getVersion())),
deleteDsl);
return apiRoot.extensions().withId(extension.getId()).delete().withVersion(extension.getVersion());
}

public ByProjectKeyExtensionsByIDDelete extension(
final io.sphere.sdk.models.Versioned<io.sphere.sdk.extensions.Extension> extension,
final Function<ExtensionDeleteCommand, ExtensionDeleteCommand> deleteDsl) {
final io.sphere.sdk.models.Versioned<io.sphere.sdk.extensions.Extension> extension) {
requireNonNull(extension.getId());
requireNonNull(extension.getVersion());
return delete(apiRoot.extensions().withId(extension.getId()).delete(), extension.getVersion(),
() -> ExtensionDeleteCommand
.of(io.sphere.sdk.models.Versioned.of(extension.getId(), extension.getVersion())),
deleteDsl);
return apiRoot.extensions().withId(extension.getId()).delete().withVersion(extension.getVersion());
}

public ByProjectKeyInventoryByIDDelete inventory(final String id, final Long version,
Expand Down Expand Up @@ -630,32 +618,22 @@ public ByProjectKeyStoresByIDDelete store(final io.sphere.sdk.models.Versioned<i
deleteDsl);
}

public ByProjectKeySubscriptionsByIDDelete subscription(final String id, final Long version,
final Function<SubscriptionDeleteCommand, SubscriptionDeleteCommand> deleteDsl) {
public ByProjectKeySubscriptionsByIDDelete subscription(final String id, final Long version) {
requireNonNull(id);
return delete(apiRoot.subscriptions().withId(id).delete(), version,
() -> SubscriptionDeleteCommand.of(io.sphere.sdk.models.Versioned.of(id, version)), deleteDsl);
return apiRoot.subscriptions().withId(id).delete().withVersion(version);
}

public ByProjectKeySubscriptionsByIDDelete subscription(final Versioned<Subscription> subscription,
final Function<SubscriptionDeleteCommand, SubscriptionDeleteCommand> deleteDsl) {
public ByProjectKeySubscriptionsByIDDelete subscription(final Versioned<Subscription> subscription) {
requireNonNull(subscription.getId());
requireNonNull(subscription.getVersion());
return delete(apiRoot.subscriptions().withId(subscription.getId()).delete(), subscription.getVersion(),
() -> SubscriptionDeleteCommand
.of(io.sphere.sdk.models.Versioned.of(subscription.getId(), subscription.getVersion())),
deleteDsl);
return apiRoot.subscriptions().withId(subscription.getId()).delete().withVersion(subscription.getVersion());
}

public ByProjectKeySubscriptionsByIDDelete subscription(
final io.sphere.sdk.models.Versioned<io.sphere.sdk.subscriptions.Subscription> subscription,
final Function<SubscriptionDeleteCommand, SubscriptionDeleteCommand> deleteDsl) {
final io.sphere.sdk.models.Versioned<io.sphere.sdk.subscriptions.Subscription> subscription) {
requireNonNull(subscription.getId());
requireNonNull(subscription.getVersion());
return delete(apiRoot.subscriptions().withId(subscription.getId()).delete(), subscription.getVersion(),
() -> SubscriptionDeleteCommand
.of(io.sphere.sdk.models.Versioned.of(subscription.getId(), subscription.getVersion())),
deleteDsl);
return apiRoot.subscriptions().withId(subscription.getId()).delete().withVersion(subscription.getVersion());
}

public ByProjectKeyTaxCategoriesByIDDelete taxCategory(final String id, final Long version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import io.sphere.sdk.customers.queries.CustomerByIdGet;
import io.sphere.sdk.discountcodes.queries.DiscountCodeByIdGet;
import io.sphere.sdk.expansion.ExpansionPath;
import io.sphere.sdk.extensions.queries.ExtensionByIdGet;
import io.sphere.sdk.inventory.queries.InventoryEntryByIdGet;
import io.sphere.sdk.messages.queries.MessageByIdGet;
import io.sphere.sdk.orders.queries.OrderByIdGet;
Expand All @@ -58,7 +57,6 @@
import io.sphere.sdk.shoppinglists.queries.ShoppingListByIdGet;
import io.sphere.sdk.states.queries.StateByIdGet;
import io.sphere.sdk.stores.queries.StoreByIdGet;
import io.sphere.sdk.subscriptions.queries.SubscriptionByIdGet;
import io.sphere.sdk.taxcategories.queries.TaxCategoryByIdGet;
import io.sphere.sdk.types.queries.TypeByIdGet;
import io.sphere.sdk.zones.queries.ZoneByIdGet;
Expand Down Expand Up @@ -329,25 +327,20 @@ public ByProjectKeyCustomerGroupsByIDGet customerGroup(
() -> CustomerGroupByIdGet.of(identifiable.getId()), getDsl);
}

public ByProjectKeyExtensionsByIDGet extension(final String id,
final Function<ExtensionByIdGet, ExtensionByIdGet> getDsl) {
public ByProjectKeyExtensionsByIDGet extension(final String id) {
requireNonNull(id);
return get(apiRoot.extensions().withId(id).get(), () -> ExtensionByIdGet.of(id), getDsl);
return apiRoot.extensions().withId(id).get();
}

public ByProjectKeyExtensionsByIDGet extension(final Identifiable<Extension> identifiable,
final Function<ExtensionByIdGet, ExtensionByIdGet> getDsl) {
public ByProjectKeyExtensionsByIDGet extension(final Identifiable<Extension> identifiable) {
requireNonNull(identifiable.getId());
return get(apiRoot.extensions().withId(identifiable.getId()).get(),
() -> ExtensionByIdGet.of(identifiable.getId()), getDsl);
return apiRoot.extensions().withId(identifiable.getId()).get();
}

public ByProjectKeyExtensionsByIDGet extension(
final io.sphere.sdk.models.Identifiable<io.sphere.sdk.extensions.Extension> identifiable,
final Function<ExtensionByIdGet, ExtensionByIdGet> getDsl) {
final io.sphere.sdk.models.Identifiable<io.sphere.sdk.extensions.Extension> identifiable) {
requireNonNull(identifiable.getId());
return get(apiRoot.extensions().withId(identifiable.getId()).get(),
() -> ExtensionByIdGet.of(identifiable.getId()), getDsl);
return apiRoot.extensions().withId(identifiable.getId()).get();
}

public ByProjectKeyInventoryByIDGet inventory(final String id,
Expand Down Expand Up @@ -575,25 +568,20 @@ public ByProjectKeyStoresByIDGet store(
getDsl);
}

public ByProjectKeySubscriptionsByIDGet subscription(final String id,
final Function<SubscriptionByIdGet, SubscriptionByIdGet> getDsl) {
public ByProjectKeySubscriptionsByIDGet subscription(final String id) {
requireNonNull(id);
return get(apiRoot.subscriptions().withId(id).get(), () -> SubscriptionByIdGet.of(id), getDsl);
return apiRoot.subscriptions().withId(id).get();
}

public ByProjectKeySubscriptionsByIDGet subscription(final Identifiable<Subscription> identifiable,
final Function<SubscriptionByIdGet, SubscriptionByIdGet> getDsl) {
public ByProjectKeySubscriptionsByIDGet subscription(final Identifiable<Subscription> identifiable) {
requireNonNull(identifiable.getId());
return get(apiRoot.subscriptions().withId(identifiable.getId()).get(),
() -> SubscriptionByIdGet.of(identifiable.getId()), getDsl);
return apiRoot.subscriptions().withId(identifiable.getId()).get();
}

public ByProjectKeySubscriptionsByIDGet subscription(
final io.sphere.sdk.models.Identifiable<io.sphere.sdk.subscriptions.Subscription> identifiable,
final Function<SubscriptionByIdGet, SubscriptionByIdGet> getDsl) {
final io.sphere.sdk.models.Identifiable<io.sphere.sdk.subscriptions.Subscription> identifiable) {
requireNonNull(identifiable.getId());
return get(apiRoot.subscriptions().withId(identifiable.getId()).get(),
() -> SubscriptionByIdGet.of(identifiable.getId()), getDsl);
return apiRoot.subscriptions().withId(identifiable.getId()).get();
}

public ByProjectKeyTaxCategoriesByIDGet taxCategory(final String id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import io.sphere.sdk.customergroups.queries.CustomerGroupByKeyGet;
import io.sphere.sdk.customers.queries.CustomerByKeyGet;
import io.sphere.sdk.expansion.ExpansionPath;
import io.sphere.sdk.extensions.queries.ExtensionByKeyGet;
import io.sphere.sdk.orders.queries.OrderByOrderNumberGet;
import io.sphere.sdk.payments.queries.PaymentByKeyGet;
import io.sphere.sdk.productdiscounts.queries.ProductDiscountByKeyGet;
Expand All @@ -45,7 +44,6 @@
import io.sphere.sdk.shoppinglists.queries.ShoppingListByKeyGet;
import io.sphere.sdk.states.queries.StateByKeyGet;
import io.sphere.sdk.stores.queries.StoreByKeyGet;
import io.sphere.sdk.subscriptions.queries.SubscriptionByKeyGet;
import io.sphere.sdk.taxcategories.queries.TaxCategoryByKeyGet;
import io.sphere.sdk.zones.queries.ZoneByKeyGet;
import io.vrap.rmf.base.client.ApiMethod;
Expand Down Expand Up @@ -278,18 +276,15 @@ public ByProjectKeyCustomerGroupsKeyByKeyGet customerGroup(
() -> CustomerGroupByKeyGet.of(identifiable.toResourceIdentifier().getKey()), getDsl);
}

public ByProjectKeyExtensionsKeyByKeyGet extension(final String key,
final Function<ExtensionByKeyGet, ExtensionByKeyGet> getDsl) {
public ByProjectKeyExtensionsKeyByKeyGet extension(final String key) {
requireNonNull(key);
return get(apiRoot.extensions().withKey(key).get(), () -> ExtensionByKeyGet.of(key), getDsl);
return apiRoot.extensions().withKey(key).get();
}

public ByProjectKeyExtensionsKeyByKeyGet extension(
final io.sphere.sdk.models.ResourceIdentifiable<io.sphere.sdk.extensions.Extension> identifiable,
final Function<ExtensionByKeyGet, ExtensionByKeyGet> getDsl) {
final io.sphere.sdk.models.ResourceIdentifiable<io.sphere.sdk.extensions.Extension> identifiable) {
requireNonNull(identifiable.toResourceIdentifier().getKey());
return get(apiRoot.extensions().withKey(identifiable.toResourceIdentifier().getKey()).get(),
() -> ExtensionByKeyGet.of(identifiable.toResourceIdentifier().getKey()), getDsl);
return apiRoot.extensions().withKey(identifiable.toResourceIdentifier().getKey()).get();
}

public ByProjectKeyOrdersOrderNumberByOrderNumberGet order(final String key,
Expand Down Expand Up @@ -481,18 +476,15 @@ public ByProjectKeyStoresKeyByKeyGet store(
() -> StoreByKeyGet.of(identifiable.toResourceIdentifier().getKey()), getDsl);
}

public ByProjectKeySubscriptionsKeyByKeyGet subscription(final String key,
final Function<SubscriptionByKeyGet, SubscriptionByKeyGet> getDsl) {
public ByProjectKeySubscriptionsKeyByKeyGet subscription(final String key) {
requireNonNull(key);
return get(apiRoot.subscriptions().withKey(key).get(), () -> SubscriptionByKeyGet.of(key), getDsl);
return apiRoot.subscriptions().withKey(key).get();
}

public ByProjectKeySubscriptionsKeyByKeyGet subscription(
final io.sphere.sdk.models.ResourceIdentifiable<io.sphere.sdk.subscriptions.Subscription> identifiable,
final Function<SubscriptionByKeyGet, SubscriptionByKeyGet> getDsl) {
final io.sphere.sdk.models.ResourceIdentifiable<io.sphere.sdk.subscriptions.Subscription> identifiable) {
requireNonNull(identifiable.toResourceIdentifier().getKey());
return get(apiRoot.subscriptions().withKey(identifiable.toResourceIdentifier().getKey()).get(),
() -> SubscriptionByKeyGet.of(identifiable.toResourceIdentifier().getKey()), getDsl);
return apiRoot.subscriptions().withKey(identifiable.toResourceIdentifier().getKey()).get();
}

public ByProjectKeyTaxCategoriesKeyByKeyGet taxCategory(final String key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class ByProjectKeyExtensionsByIDDelete
com.commercetools.api.client.ApiDeleteMethod<ByProjectKeyExtensionsByIDDelete, com.commercetools.api.models.extension.Extension>,
com.commercetools.api.client.VersionedTrait<ByProjectKeyExtensionsByIDDelete>,
com.commercetools.api.client.ConflictingTrait<ByProjectKeyExtensionsByIDDelete>,
com.commercetools.api.client.ExpandableTrait<ByProjectKeyExtensionsByIDDelete>,
com.commercetools.api.client.ErrorableTrait<ByProjectKeyExtensionsByIDDelete>,
com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyExtensionsByIDDelete> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ByProjectKeyExtensionsByIDGet
extends ApiMethod<ByProjectKeyExtensionsByIDGet, com.commercetools.api.models.extension.Extension>
implements com.commercetools.api.client.ExpandableTrait<ByProjectKeyExtensionsByIDGet>,
com.commercetools.api.client.ErrorableTrait<ByProjectKeyExtensionsByIDGet>,
implements com.commercetools.api.client.ErrorableTrait<ByProjectKeyExtensionsByIDGet>,
com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyExtensionsByIDGet> {

private String projectKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
public class ByProjectKeyExtensionsByIDPost extends
BodyApiMethod<ByProjectKeyExtensionsByIDPost, com.commercetools.api.models.extension.Extension, com.commercetools.api.models.extension.ExtensionUpdate>
implements com.commercetools.api.client.ConflictingTrait<ByProjectKeyExtensionsByIDPost>,
com.commercetools.api.client.ExpandableTrait<ByProjectKeyExtensionsByIDPost>,
com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyExtensionsByIDPost>,
com.commercetools.api.client.ErrorableTrait<ByProjectKeyExtensionsByIDPost> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
public class ByProjectKeyExtensionsByIDPostString extends
StringBodyApiMethod<ByProjectKeyExtensionsByIDPostString, com.commercetools.api.models.extension.Extension>
implements com.commercetools.api.client.ConflictingTrait<ByProjectKeyExtensionsByIDPostString>,
com.commercetools.api.client.ExpandableTrait<ByProjectKeyExtensionsByIDPostString>,
com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyExtensionsByIDPostString>,
com.commercetools.api.client.ErrorableTrait<ByProjectKeyExtensionsByIDPostString> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
public class ByProjectKeyExtensionsGet
extends ApiMethod<ByProjectKeyExtensionsGet, com.commercetools.api.models.extension.ExtensionPagedQueryResponse>
implements ByProjectKeyExtensionsGetMixin,
com.commercetools.api.client.ExpandableTrait<ByProjectKeyExtensionsGet>,
com.commercetools.api.client.SortableTrait<ByProjectKeyExtensionsGet>,
com.commercetools.api.client.PagingTrait<ByProjectKeyExtensionsGet>,
com.commercetools.api.client.QueryTrait<ByProjectKeyExtensionsGet>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class ByProjectKeyExtensionsKeyByKeyDelete extends
com.commercetools.api.client.ApiDeleteMethod<ByProjectKeyExtensionsKeyByKeyDelete, com.commercetools.api.models.extension.Extension>,
com.commercetools.api.client.VersionedTrait<ByProjectKeyExtensionsKeyByKeyDelete>,
com.commercetools.api.client.ConflictingTrait<ByProjectKeyExtensionsKeyByKeyDelete>,
com.commercetools.api.client.ExpandableTrait<ByProjectKeyExtensionsKeyByKeyDelete>,
com.commercetools.api.client.ErrorableTrait<ByProjectKeyExtensionsKeyByKeyDelete>,
com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyExtensionsKeyByKeyDelete> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ByProjectKeyExtensionsKeyByKeyGet
extends ApiMethod<ByProjectKeyExtensionsKeyByKeyGet, com.commercetools.api.models.extension.Extension>
implements com.commercetools.api.client.ExpandableTrait<ByProjectKeyExtensionsKeyByKeyGet>,
com.commercetools.api.client.ErrorableTrait<ByProjectKeyExtensionsKeyByKeyGet>,
implements com.commercetools.api.client.ErrorableTrait<ByProjectKeyExtensionsKeyByKeyGet>,
com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyExtensionsKeyByKeyGet> {

private String projectKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
public class ByProjectKeyExtensionsKeyByKeyPost extends
BodyApiMethod<ByProjectKeyExtensionsKeyByKeyPost, com.commercetools.api.models.extension.Extension, com.commercetools.api.models.extension.ExtensionUpdate>
implements com.commercetools.api.client.ConflictingTrait<ByProjectKeyExtensionsKeyByKeyPost>,
com.commercetools.api.client.ExpandableTrait<ByProjectKeyExtensionsKeyByKeyPost>,
com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyExtensionsKeyByKeyPost>,
com.commercetools.api.client.ErrorableTrait<ByProjectKeyExtensionsKeyByKeyPost> {

Expand Down
Loading

0 comments on commit 7ec2338

Please sign in to comment.