Skip to content

Commit f2bfe39

Browse files
taeyzzzThanetpon Kultontikorn
andauthored
generate enum from selection for share type plugin (#29)
* generate enum from selection for share type plugin * update package --------- Co-authored-by: Thanetpon Kultontikorn <[email protected]>
1 parent 9fb6b5d commit f2bfe39

File tree

11 files changed

+430
-2
lines changed

11 files changed

+430
-2
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
5+
using Newtonsoft.Json.Linq;
6+
using Agoda.Graphql;
7+
8+
namespace Agoda.Graphql.SupplyApi.Queries.Apm.GetApmMultipleDiscountByKeys
9+
{
10+
public class Query : QueryBase<Data>
11+
{
12+
private const string _query = @"query GetApmMultipleDiscountByKeys($apmMultipleDiscountKeys: [getApmMultipleDiscount!]!) {
13+
ApmMultipleDiscount(apmMultipleDiscountKeys: $apmMultipleDiscountKeys) {
14+
apmAdjustmentDiscount {
15+
ApmAdjustmentDiscountId
16+
ProgramId
17+
AdjustmentChannelId
18+
AdjustmentDiscountPercent
19+
CategoryName
20+
StartDate
21+
EndDate
22+
}
23+
apmCommissionDiscount {
24+
ApmCommissionDiscountId
25+
ProgramId
26+
CommissionChannelId
27+
CommissionDiscountPercent
28+
CategoryName
29+
StartDate
30+
EndDate
31+
}
32+
}
33+
}";
34+
35+
public List<GetApmMultipleDiscount> ApmMultipleDiscountKeys { get; }
36+
37+
public Query(List<GetApmMultipleDiscount> apmMultipleDiscountKeys, IResultProcessor<Data> resultProcessor = null) : base(resultProcessor)
38+
{
39+
ApmMultipleDiscountKeys = apmMultipleDiscountKeys;
40+
}
41+
42+
protected override string QueryText => _query;
43+
44+
protected override Dictionary<string, object> Variables => new Dictionary<string, object>
45+
{
46+
{ "apmMultipleDiscountKeys", ApmMultipleDiscountKeys }
47+
};
48+
}
49+
50+
public sealed class Data
51+
{
52+
[JsonProperty("ApmMultipleDiscount")]
53+
public ApmMultipleDiscount ApmMultipleDiscount { get; set; }
54+
}
55+
56+
public sealed class ApmAdjustmentDiscount
57+
{
58+
[JsonProperty("ApmAdjustmentDiscountId")]
59+
public int ApmAdjustmentDiscountId { get; set; }
60+
[JsonProperty("ProgramId")]
61+
public int ProgramId { get; set; }
62+
[JsonProperty("AdjustmentChannelId")]
63+
public int AdjustmentChannelId { get; set; }
64+
[JsonProperty("AdjustmentDiscountPercent")]
65+
public double AdjustmentDiscountPercent { get; set; }
66+
[JsonProperty("CategoryName")]
67+
public string CategoryName { get; set; }
68+
[JsonProperty("StartDate")]
69+
public DateTime StartDate { get; set; }
70+
[JsonProperty("EndDate")]
71+
public DateTime EndDate { get; set; }
72+
}
73+
74+
public sealed class ApmCommissionDiscount
75+
{
76+
[JsonProperty("ApmCommissionDiscountId")]
77+
public int ApmCommissionDiscountId { get; set; }
78+
[JsonProperty("ProgramId")]
79+
public int ProgramId { get; set; }
80+
[JsonProperty("CommissionChannelId")]
81+
public int CommissionChannelId { get; set; }
82+
[JsonProperty("CommissionDiscountPercent")]
83+
public double CommissionDiscountPercent { get; set; }
84+
[JsonProperty("CategoryName")]
85+
public string CategoryName { get; set; }
86+
[JsonProperty("StartDate")]
87+
public DateTime StartDate { get; set; }
88+
[JsonProperty("EndDate")]
89+
public DateTime EndDate { get; set; }
90+
}
91+
92+
public sealed class ApmMultipleDiscount
93+
{
94+
[JsonProperty("apmAdjustmentDiscount")]
95+
public List<ApmAdjustmentDiscount> ApmAdjustmentDiscount { get; set; }
96+
[JsonProperty("apmCommissionDiscount")]
97+
public List<ApmCommissionDiscount> ApmCommissionDiscount { get; set; }
98+
}
99+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
query GetApmMultipleDiscountByKeys($apmMultipleDiscountKeys: [getApmMultipleDiscount!]!) {
2+
ApmMultipleDiscount (apmMultipleDiscountKeys: $apmMultipleDiscountKeys) {
3+
apmAdjustmentDiscount {
4+
ApmAdjustmentDiscountId
5+
ProgramId
6+
AdjustmentChannelId
7+
AdjustmentDiscountPercent
8+
CategoryName
9+
StartDate
10+
EndDate
11+
}
12+
apmCommissionDiscount {
13+
ApmCommissionDiscountId
14+
ProgramId
15+
CommissionChannelId
16+
CommissionDiscountPercent
17+
CategoryName
18+
StartDate
19+
EndDate
20+
}
21+
}
22+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
5+
using Newtonsoft.Json.Linq;
6+
using Agoda.Graphql;
7+
8+
namespace Agoda.Graphql.SupplyApi.Queries.CustomerSegments.GetCustomerSegmentGroups
9+
{
10+
public class Query : QueryBase<Data>
11+
{
12+
private const string _query = @"query GetCustomerSegmentGroups {
13+
CustomerSegmentGroups {
14+
customerSegmentGroupId
15+
name
16+
subContinentId
17+
cmsItemId
18+
isActive
19+
isLocal
20+
customerSegmentType
21+
}
22+
}";
23+
24+
25+
26+
public Query(IResultProcessor<Data> resultProcessor = null) : base(resultProcessor)
27+
{
28+
29+
}
30+
31+
protected override string QueryText => _query;
32+
33+
protected override Dictionary<string, object> Variables => new Dictionary<string, object>
34+
{
35+
36+
};
37+
}
38+
39+
public sealed class Data
40+
{
41+
[JsonProperty("CustomerSegmentGroups")]
42+
public List<CustomerSegmentGroups> CustomerSegmentGroups { get; set; }
43+
}
44+
45+
public sealed class CustomerSegmentGroups
46+
{
47+
[JsonProperty("customerSegmentGroupId")]
48+
public int CustomerSegmentGroupId { get; set; }
49+
[JsonProperty("name")]
50+
public string Name { get; set; }
51+
[JsonProperty("subContinentId")]
52+
public int SubContinentId { get; set; }
53+
[JsonProperty("cmsItemId")]
54+
public int CmsItemId { get; set; }
55+
[JsonProperty("isActive")]
56+
public bool IsActive { get; set; }
57+
[JsonProperty("isLocal")]
58+
public bool IsLocal { get; set; }
59+
[JsonProperty("customerSegmentType")]
60+
public CustomerSegmentType CustomerSegmentType { get; set; }
61+
}
62+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
query GetCustomerSegmentGroups {
2+
CustomerSegmentGroups {
3+
customerSegmentGroupId,
4+
name,
5+
subContinentId,
6+
cmsItemId,
7+
isActive,
8+
isLocal,
9+
customerSegmentType
10+
}
11+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
5+
using Newtonsoft.Json.Linq;
6+
using Agoda.Graphql;
7+
8+
namespace Agoda.Graphql.SupplyApi.Queries.CustomerSegments.GetCustomerSegmentSubContinents
9+
{
10+
public class Query : QueryBase<Data>
11+
{
12+
private const string _query = @"query GetCustomerSegmentSubContinents {
13+
CustomerSegmentSubContinents {
14+
subContinentId
15+
name
16+
continentId
17+
isActive
18+
sortOrder
19+
cmsItemId
20+
}
21+
}";
22+
23+
24+
25+
public Query(IResultProcessor<Data> resultProcessor = null) : base(resultProcessor)
26+
{
27+
28+
}
29+
30+
protected override string QueryText => _query;
31+
32+
protected override Dictionary<string, object> Variables => new Dictionary<string, object>
33+
{
34+
35+
};
36+
}
37+
38+
public sealed class Data
39+
{
40+
[JsonProperty("CustomerSegmentSubContinents")]
41+
public List<CustomerSegmentSubContinents> CustomerSegmentSubContinents { get; set; }
42+
}
43+
44+
public sealed class CustomerSegmentSubContinents
45+
{
46+
[JsonProperty("subContinentId")]
47+
public int SubContinentId { get; set; }
48+
[JsonProperty("name")]
49+
public string Name { get; set; }
50+
[JsonProperty("continentId")]
51+
public int ContinentId { get; set; }
52+
[JsonProperty("isActive")]
53+
public bool IsActive { get; set; }
54+
[JsonProperty("sortOrder")]
55+
public int SortOrder { get; set; }
56+
[JsonProperty("cmsItemId")]
57+
public int CmsItemId { get; set; }
58+
}
59+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
query GetCustomerSegmentSubContinents {
2+
CustomerSegmentSubContinents {
3+
subContinentId,
4+
name,
5+
continentId,
6+
isActive,
7+
sortOrder,
8+
cmsItemId
9+
}
10+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
5+
using Newtonsoft.Json.Linq;
6+
using Agoda.Graphql;
7+
8+
namespace Agoda.Graphql.SupplyApi.Queries.CustomerSegments.GetCustomerSegments
9+
{
10+
public class Query : QueryBase<Data>
11+
{
12+
private const string _query = @"query GetCustomerSegments {
13+
CustomerSegments {
14+
customerSegmentId
15+
customerSegmentGroupId
16+
languageId
17+
countryIso2
18+
isActive
19+
}
20+
}";
21+
22+
23+
24+
public Query(IResultProcessor<Data> resultProcessor = null) : base(resultProcessor)
25+
{
26+
27+
}
28+
29+
protected override string QueryText => _query;
30+
31+
protected override Dictionary<string, object> Variables => new Dictionary<string, object>
32+
{
33+
34+
};
35+
}
36+
37+
public sealed class Data
38+
{
39+
[JsonProperty("CustomerSegments")]
40+
public List<CustomerSegments> CustomerSegments { get; set; }
41+
}
42+
43+
public sealed class CustomerSegments
44+
{
45+
[JsonProperty("customerSegmentId")]
46+
public int CustomerSegmentId { get; set; }
47+
[JsonProperty("customerSegmentGroupId")]
48+
public int CustomerSegmentGroupId { get; set; }
49+
[JsonProperty("languageId")]
50+
public int LanguageId { get; set; }
51+
[JsonProperty("countryIso2")]
52+
public string CountryIso2 { get; set; }
53+
[JsonProperty("isActive")]
54+
public bool IsActive { get; set; }
55+
}
56+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
query GetCustomerSegments {
2+
CustomerSegments {
3+
customerSegmentId,
4+
customerSegmentGroupId,
5+
languageId,
6+
countryIso2,
7+
isActive
8+
}
9+
}

Agoda.Graphql/SupplyApi/Queries/SharedTypes.generated.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,24 @@
77

88
namespace Agoda.Graphql.SupplyApi.Queries
99
{
10+
public sealed class GetApmMultipleDiscount
11+
{
12+
[JsonProperty("adjustmentChannelId")]
13+
public int? AdjustmentChannelId { get; set; }
14+
[JsonProperty("commissionChannelId")]
15+
public int? CommissionChannelId { get; set; }
16+
[JsonProperty("date")]
17+
public string Date { get; set; }
18+
[JsonProperty("programId")]
19+
public int ProgramId { get; set; }
20+
}
1021

22+
public enum CustomerSegmentType
23+
{
24+
IpOnly,
25+
Language,
26+
Origin,
27+
Unknown,
28+
VipLevel
29+
}
1130
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "agoda-graphql-csharp-generator",
3-
"version": "2.1.10",
3+
"version": "2.1.11",
44
"main": "dist/agoda-csharp-operation.js",
55
"exports": {
66
"./shared-types": "./dist/agoda-csharp-shared-types.js",

0 commit comments

Comments
 (0)