Skip to content

Commit

Permalink
Support Item Segmentations
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraFiedler committed Jan 6, 2023
1 parent 4ee8200 commit 106a7c7
Show file tree
Hide file tree
Showing 123 changed files with 4,039 additions and 387 deletions.
46 changes: 46 additions & 0 deletions Src/Recombee.ApiClient.Tests/AddManualReqlSegmentBatchUnitTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
This file is auto-generated, do not edit
*/


using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Recombee.ApiClient.ApiRequests;
using Recombee.ApiClient.Bindings;

namespace Recombee.ApiClient.Tests
{
public class AddManualReqlSegmentBatchUnitTest: RecombeeUnitTest
{

[Fact]
public void TestAddManualReqlSegment()
{
Object resp2;
resp2 = client.Send(new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes"));

Request[] requests = new Request[] {
new AddManualReqlSegment("seg1", "first-segment", "'str_property' != null", title: "First Segment")
};

BatchResponse batchResponse = client.Send(new Batch(requests));
Assert.Equal(201, (int)batchResponse.StatusCodes.ElementAt(0));
}

[Fact]
public async void TestAddManualReqlSegmentAsync()
{
Object resp2;
resp2 = await client.SendAsync(new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes"));

Request[] requests = new Request[] {
new AddManualReqlSegment("seg1", "first-segment", "'str_property' != null", title: "First Segment")
};

BatchResponse batchResponse = await client.SendAsync(new Batch(requests));
Assert.Equal(201, (int)batchResponse.StatusCodes.ElementAt(0));
}
}
}
40 changes: 40 additions & 0 deletions Src/Recombee.ApiClient.Tests/AddManualReqlSegmentUnitTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
This file is auto-generated, do not edit
*/


using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Recombee.ApiClient.ApiRequests;
using Recombee.ApiClient.Bindings;

namespace Recombee.ApiClient.Tests
{
public class AddManualReqlSegmentUnitTest: RecombeeUnitTest
{

[Fact]
public void TestAddManualReqlSegment()
{
AddManualReqlSegment req;
RecombeeBinding resp;
Object resp2;
// it 'adds manual ReQL segment'
resp2 = client.Send(new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes"));
resp = client.Send(new AddManualReqlSegment("seg1", "first-segment", "'str_property' != null", title: "First Segment"));
}

[Fact]
public async void TestAddManualReqlSegmentAsync()
{
AddManualReqlSegment req;
RecombeeBinding resp;
Object resp2;
// it 'adds manual ReQL segment'
resp2 = await client.SendAsync(new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes"));
resp = await client.SendAsync(new AddManualReqlSegment("seg1", "first-segment", "'str_property' != null", title: "First Segment"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
This file is auto-generated, do not edit
*/


using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Recombee.ApiClient.ApiRequests;
using Recombee.ApiClient.Bindings;

namespace Recombee.ApiClient.Tests
{
public class CreateAutoReqlSegmentationBatchUnitTest: RecombeeUnitTest
{

[Fact]
public void TestCreateAutoReqlSegmentation()
{
Object resp2;
Request[] requests = new Request[] {
new CreateAutoReqlSegmentation("seg1", "items", "{'str_property'}", title: "Test Segmentation", description: "For test purposes"),
new CreateAutoReqlSegmentation("seg1", "items", "{'str_property'}", title: "Test Segmentation", description: "For test purposes")
};

BatchResponse batchResponse = client.Send(new Batch(requests));
Assert.Equal(201, (int)batchResponse.StatusCodes.ElementAt(0));
Assert.Equal(409, (int)batchResponse.StatusCodes.ElementAt(1));
}

[Fact]
public async void TestCreateAutoReqlSegmentationAsync()
{
Object resp2;
Request[] requests = new Request[] {
new CreateAutoReqlSegmentation("seg1", "items", "{'str_property'}", title: "Test Segmentation", description: "For test purposes"),
new CreateAutoReqlSegmentation("seg1", "items", "{'str_property'}", title: "Test Segmentation", description: "For test purposes")
};

BatchResponse batchResponse = await client.SendAsync(new Batch(requests));
Assert.Equal(201, (int)batchResponse.StatusCodes.ElementAt(0));
Assert.Equal(409, (int)batchResponse.StatusCodes.ElementAt(1));
}
}
}
56 changes: 56 additions & 0 deletions Src/Recombee.ApiClient.Tests/CreateAutoReqlSegmentationUnitTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
This file is auto-generated, do not edit
*/


using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Recombee.ApiClient.ApiRequests;
using Recombee.ApiClient.Bindings;

namespace Recombee.ApiClient.Tests
{
public class CreateAutoReqlSegmentationUnitTest: RecombeeUnitTest
{

[Fact]
public void TestCreateAutoReqlSegmentation()
{
CreateAutoReqlSegmentation req;
RecombeeBinding resp;
Object resp2;
// it 'creates auto ReQL segmentation'
resp = client.Send(new CreateAutoReqlSegmentation("seg1", "items", "{'str_property'}", title: "Test Segmentation", description: "For test purposes"));
try
{
client.Send(new CreateAutoReqlSegmentation("seg1", "items", "{'str_property'}", title: "Test Segmentation", description: "For test purposes"));
Assert.True(false,"No exception thrown");
}
catch (ResponseException ex)
{
Assert.Equal(409, (int)ex.StatusCode);
}
}

[Fact]
public async void TestCreateAutoReqlSegmentationAsync()
{
CreateAutoReqlSegmentation req;
RecombeeBinding resp;
Object resp2;
// it 'creates auto ReQL segmentation'
resp = await client.SendAsync(new CreateAutoReqlSegmentation("seg1", "items", "{'str_property'}", title: "Test Segmentation", description: "For test purposes"));
try
{
await client.SendAsync(new CreateAutoReqlSegmentation("seg1", "items", "{'str_property'}", title: "Test Segmentation", description: "For test purposes"));
Assert.True(false,"No exception thrown");
}
catch (ResponseException ex)
{
Assert.Equal(409, (int)ex.StatusCode);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
This file is auto-generated, do not edit
*/


using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Recombee.ApiClient.ApiRequests;
using Recombee.ApiClient.Bindings;

namespace Recombee.ApiClient.Tests
{
public class CreateManualReqlSegmentationBatchUnitTest: RecombeeUnitTest
{

[Fact]
public void TestCreateManualReqlSegmentation()
{
Object resp2;
Request[] requests = new Request[] {
new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes"),
new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes")
};

BatchResponse batchResponse = client.Send(new Batch(requests));
Assert.Equal(201, (int)batchResponse.StatusCodes.ElementAt(0));
Assert.Equal(409, (int)batchResponse.StatusCodes.ElementAt(1));
}

[Fact]
public async void TestCreateManualReqlSegmentationAsync()
{
Object resp2;
Request[] requests = new Request[] {
new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes"),
new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes")
};

BatchResponse batchResponse = await client.SendAsync(new Batch(requests));
Assert.Equal(201, (int)batchResponse.StatusCodes.ElementAt(0));
Assert.Equal(409, (int)batchResponse.StatusCodes.ElementAt(1));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
This file is auto-generated, do not edit
*/


using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Recombee.ApiClient.ApiRequests;
using Recombee.ApiClient.Bindings;

namespace Recombee.ApiClient.Tests
{
public class CreateManualReqlSegmentationUnitTest: RecombeeUnitTest
{

[Fact]
public void TestCreateManualReqlSegmentation()
{
CreateManualReqlSegmentation req;
RecombeeBinding resp;
Object resp2;
// it 'creates manual ReQL segmentation'
resp = client.Send(new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes"));
try
{
client.Send(new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes"));
Assert.True(false,"No exception thrown");
}
catch (ResponseException ex)
{
Assert.Equal(409, (int)ex.StatusCode);
}
}

[Fact]
public async void TestCreateManualReqlSegmentationAsync()
{
CreateManualReqlSegmentation req;
RecombeeBinding resp;
Object resp2;
// it 'creates manual ReQL segmentation'
resp = await client.SendAsync(new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes"));
try
{
await client.SendAsync(new CreateManualReqlSegmentation("seg1", "items", title: "Test Segmentation", description: "For test purposes"));
Assert.True(false,"No exception thrown");
}
catch (ResponseException ex)
{
Assert.Equal(409, (int)ex.StatusCode);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
This file is auto-generated, do not edit
*/


using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Recombee.ApiClient.ApiRequests;
using Recombee.ApiClient.Bindings;

namespace Recombee.ApiClient.Tests
{
public class CreatePropertyBasedSegmentationBatchUnitTest: RecombeeUnitTest
{

[Fact]
public void TestCreatePropertyBasedSegmentation()
{
Object resp2;
Request[] requests = new Request[] {
new CreatePropertyBasedSegmentation("seg1", "items", "str_property", title: "Test Segmentation", description: "For test purposes"),
new CreatePropertyBasedSegmentation("seg1", "items", "str_property", title: "Test Segmentation", description: "For test purposes")
};

BatchResponse batchResponse = client.Send(new Batch(requests));
Assert.Equal(201, (int)batchResponse.StatusCodes.ElementAt(0));
Assert.Equal(409, (int)batchResponse.StatusCodes.ElementAt(1));
}

[Fact]
public async void TestCreatePropertyBasedSegmentationAsync()
{
Object resp2;
Request[] requests = new Request[] {
new CreatePropertyBasedSegmentation("seg1", "items", "str_property", title: "Test Segmentation", description: "For test purposes"),
new CreatePropertyBasedSegmentation("seg1", "items", "str_property", title: "Test Segmentation", description: "For test purposes")
};

BatchResponse batchResponse = await client.SendAsync(new Batch(requests));
Assert.Equal(201, (int)batchResponse.StatusCodes.ElementAt(0));
Assert.Equal(409, (int)batchResponse.StatusCodes.ElementAt(1));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
This file is auto-generated, do not edit
*/


using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Recombee.ApiClient.ApiRequests;
using Recombee.ApiClient.Bindings;

namespace Recombee.ApiClient.Tests
{
public class CreatePropertyBasedSegmentationUnitTest: RecombeeUnitTest
{

[Fact]
public void TestCreatePropertyBasedSegmentation()
{
CreatePropertyBasedSegmentation req;
RecombeeBinding resp;
Object resp2;
// it 'creates property based segmentation'
resp = client.Send(new CreatePropertyBasedSegmentation("seg1", "items", "str_property", title: "Test Segmentation", description: "For test purposes"));
try
{
client.Send(new CreatePropertyBasedSegmentation("seg1", "items", "str_property", title: "Test Segmentation", description: "For test purposes"));
Assert.True(false,"No exception thrown");
}
catch (ResponseException ex)
{
Assert.Equal(409, (int)ex.StatusCode);
}
}

[Fact]
public async void TestCreatePropertyBasedSegmentationAsync()
{
CreatePropertyBasedSegmentation req;
RecombeeBinding resp;
Object resp2;
// it 'creates property based segmentation'
resp = await client.SendAsync(new CreatePropertyBasedSegmentation("seg1", "items", "str_property", title: "Test Segmentation", description: "For test purposes"));
try
{
await client.SendAsync(new CreatePropertyBasedSegmentation("seg1", "items", "str_property", title: "Test Segmentation", description: "For test purposes"));
Assert.True(false,"No exception thrown");
}
catch (ResponseException ex)
{
Assert.Equal(409, (int)ex.StatusCode);
}
}
}
}
Loading

0 comments on commit 106a7c7

Please sign in to comment.