Skip to content

Commit

Permalink
build(codegen): updating SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
ct-sdks[bot] committed Apr 5, 2024
1 parent 960bfd0 commit 7e48267
Show file tree
Hide file tree
Showing 13 changed files with 174 additions and 0 deletions.
17 changes: 17 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
**Api changes**

<details>
<summary>Added Property(s)</summary>

- added property `attributedTo` to type `CreatedBy`
- added property `attributedTo` to type `LastModifiedBy`
</details>


<details>
<summary>Added Type(s)</summary>

- added type `Attribution`
- added type `AttributionSource`
</details>

**Import changes**

<details>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace commercetools.Sdk.Api.Models.Common
{

public partial class Attribution : IAttribution
{
public string ClientId { get; set; }

public IAttributionSource Source { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using commercetools.Base.CustomAttributes;
using commercetools.Base.Models;

// ReSharper disable CheckNamespace
namespace commercetools.Sdk.Api.Models.Common
{
public enum AttributionSource
{
[Description("Import")]
Import,

[Description("Export")]
Export
}

public class AttributionSourceWrapper : IAttributionSource
{
public string JsonName { get; internal set; }
public AttributionSource? Value { get; internal set; }
public override string ToString()
{
return JsonName;
}

IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}

public new IEnumerator<char> GetEnumerator()
{
return JsonName.GetEnumerator();
}
}

[EnumInterfaceCreator(typeof(IAttributionSource), "FindEnum")]
public interface IAttributionSource : IJsonName, IEnumerable<char>
{
public static IAttributionSource Import = new AttributionSourceWrapper
{ Value = AttributionSource.Import, JsonName = "Import" };

public static IAttributionSource Export = new AttributionSourceWrapper
{ Value = AttributionSource.Export, JsonName = "Export" };

AttributionSource? Value { get; }

static IAttributionSource[] Values()
{
return new[]
{
Import ,
Export
};
}
static IAttributionSource FindEnum(string value)
{
return Values().FirstOrDefault(origin => origin.JsonName == value) ?? new AttributionSourceWrapper() { JsonName = value };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ public partial class CreatedBy : ICreatedBy
public string AnonymousId { get; set; }

public ICustomerReference Associate { get; set; }

public IAttribution AttributedTo { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using commercetools.Base.CustomAttributes;

// ReSharper disable CheckNamespace
namespace commercetools.Sdk.Api.Models.Common
{
[DeserializeAs(typeof(commercetools.Sdk.Api.Models.Common.Attribution))]
public partial interface IAttribution
{
string ClientId { get; set; }

IAttributionSource Source { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public partial interface ICreatedBy : IClientLogging

new string AnonymousId { get; set; }

IAttribution AttributedTo { get; set; }

new ICustomerReference Associate { get; set; }

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public partial interface ILastModifiedBy : IClientLogging

new string AnonymousId { get; set; }

IAttribution AttributedTo { get; set; }

new ICustomerReference Associate { get; set; }

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ public partial class LastModifiedBy : ILastModifiedBy
public string AnonymousId { get; set; }

public ICustomerReference Associate { get; set; }

public IAttribution AttributedTo { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ReSharper disable CheckNamespace
namespace commercetools.Sdk.Api.Predicates.Query.Common
{

public partial class AttributionQueryBuilderDsl
{
public AttributionQueryBuilderDsl()
{
}

public static AttributionQueryBuilderDsl Of()
{
return new AttributionQueryBuilderDsl();
}

public IComparisonPredicateBuilder<AttributionQueryBuilderDsl, string> ClientId()
{
return new ComparisonPredicateBuilder<AttributionQueryBuilderDsl, string>(BinaryQueryPredicate.Of().Left(new ConstantQueryPredicate("clientId")),
p => new CombinationQueryPredicate<AttributionQueryBuilderDsl>(p, AttributionQueryBuilderDsl.Of),
PredicateFormatter.Format);
}
public IComparisonPredicateBuilder<AttributionQueryBuilderDsl, string> Source()
{
return new ComparisonPredicateBuilder<AttributionQueryBuilderDsl, string>(BinaryQueryPredicate.Of().Left(new ConstantQueryPredicate("source")),
p => new CombinationQueryPredicate<AttributionQueryBuilderDsl>(p, AttributionQueryBuilderDsl.Of),
PredicateFormatter.Format);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public CombinationQueryPredicate<CreatedByQueryBuilderDsl> Associate(
CreatedByQueryBuilderDsl.Of);
}

public CombinationQueryPredicate<CreatedByQueryBuilderDsl> AttributedTo(
Func<commercetools.Sdk.Api.Predicates.Query.Common.AttributionQueryBuilderDsl, CombinationQueryPredicate<commercetools.Sdk.Api.Predicates.Query.Common.AttributionQueryBuilderDsl>> fn)
{
return new CombinationQueryPredicate<CreatedByQueryBuilderDsl>(ContainerQueryPredicate.Of()
.Parent(ConstantQueryPredicate.Of().Constant("attributedTo"))
.Inner(fn.Invoke(commercetools.Sdk.Api.Predicates.Query.Common.AttributionQueryBuilderDsl.Of())),
CreatedByQueryBuilderDsl.Of);
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public CombinationQueryPredicate<LastModifiedByQueryBuilderDsl> Associate(
LastModifiedByQueryBuilderDsl.Of);
}

public CombinationQueryPredicate<LastModifiedByQueryBuilderDsl> AttributedTo(
Func<commercetools.Sdk.Api.Predicates.Query.Common.AttributionQueryBuilderDsl, CombinationQueryPredicate<commercetools.Sdk.Api.Predicates.Query.Common.AttributionQueryBuilderDsl>> fn)
{
return new CombinationQueryPredicate<LastModifiedByQueryBuilderDsl>(ContainerQueryPredicate.Of()
.Parent(ConstantQueryPredicate.Of().Constant("attributedTo"))
.Inner(fn.Invoke(commercetools.Sdk.Api.Predicates.Query.Common.AttributionQueryBuilderDsl.Of())),
LastModifiedByQueryBuilderDsl.Of);
}


}
}
12 changes: 12 additions & 0 deletions commercetools.Sdk/commercetools.Sdk.GraphQL.Api/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,17 @@ input AttributeTypeDraft {
ltext: SimpleAttributeTypeDraft
}

type Attribution {
clientId: String
source: AttributionSource!
userRef: Reference
}

enum AttributionSource {
Export
Import
}

"AuthenticationMode values."
enum AuthenticationMode {
ExternalAuth
Expand Down Expand Up @@ -4672,6 +4683,7 @@ type Initiator {
isPlatformClient: Boolean
externalUserId: String
anonymousId: String
attributedTo: Attribution
clientId: String
customerRef: Reference
userRef: Reference
Expand Down
1 change: 1 addition & 0 deletions references.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,4 @@ d6c4e8ca039647373df3aeb8369342bd50b02d61
c19a4123795d7a2d583abb9f278ce1264b030a91
9194bacd1d05947096d049eb383656c8d7f30812
cec3e86fa69d9a68a2add55c132e2ffff406a294
a9d748dbcbfc8d2a1cd8d0f8c4e48807e502e79e

0 comments on commit 7e48267

Please sign in to comment.