Skip to content

Commit ea8192d

Browse files
author
stlc-bot
committed
Build SDK
Stainless-Generated-From: 17a0e22
1 parent 0c0bc22 commit ea8192d

19 files changed

Lines changed: 2024 additions & 3 deletions

‎.stats.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 49
1+
configured_endpoints: 54

‎release-please-config.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"packages": {
33
".": {}
44
},
5-
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
5+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
66
"include-v-in-tag": true,
77
"include-component-in-tag": false,
88
"versioning": "prerelease",
9-
"prerelease": true,
9+
"prerelease": false,
1010
"bump-minor-pre-major": true,
1111
"bump-patch-for-minor-pre-major": false,
1212
"pull-request-header": "Automated Release PR",
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
using System;
2+
using System.Text.Json;
3+
using Imagekit.Core;
4+
using Imagekit.Models;
5+
6+
namespace Imagekit.Tests.Models;
7+
8+
public class NamedTransformationTest : TestBase
9+
{
10+
[Fact]
11+
public void FieldRoundtrip_Works()
12+
{
13+
var model = new NamedTransformation
14+
{
15+
ID = "6bZ9x2ZUx",
16+
CreatedAt = DateTimeOffset.Parse("2024-01-10T09:00:00.000Z"),
17+
Disabled = false,
18+
Name = "small_thumbnail",
19+
Transformation = "tr:w-150,h-150,fo-center,cm-resize",
20+
};
21+
22+
string expectedID = "6bZ9x2ZUx";
23+
DateTimeOffset expectedCreatedAt = DateTimeOffset.Parse("2024-01-10T09:00:00.000Z");
24+
bool expectedDisabled = false;
25+
string expectedName = "small_thumbnail";
26+
string expectedTransformation = "tr:w-150,h-150,fo-center,cm-resize";
27+
28+
Assert.Equal(expectedID, model.ID);
29+
Assert.Equal(expectedCreatedAt, model.CreatedAt);
30+
Assert.Equal(expectedDisabled, model.Disabled);
31+
Assert.Equal(expectedName, model.Name);
32+
Assert.Equal(expectedTransformation, model.Transformation);
33+
}
34+
35+
[Fact]
36+
public void SerializationRoundtrip_Works()
37+
{
38+
var model = new NamedTransformation
39+
{
40+
ID = "6bZ9x2ZUx",
41+
CreatedAt = DateTimeOffset.Parse("2024-01-10T09:00:00.000Z"),
42+
Disabled = false,
43+
Name = "small_thumbnail",
44+
Transformation = "tr:w-150,h-150,fo-center,cm-resize",
45+
};
46+
47+
string json = JsonSerializer.Serialize(model, ModelBase.SerializerOptions);
48+
var deserialized = JsonSerializer.Deserialize<NamedTransformation>(
49+
json,
50+
ModelBase.SerializerOptions
51+
);
52+
53+
Assert.Equal(model, deserialized);
54+
}
55+
56+
[Fact]
57+
public void FieldRoundtripThroughSerialization_Works()
58+
{
59+
var model = new NamedTransformation
60+
{
61+
ID = "6bZ9x2ZUx",
62+
CreatedAt = DateTimeOffset.Parse("2024-01-10T09:00:00.000Z"),
63+
Disabled = false,
64+
Name = "small_thumbnail",
65+
Transformation = "tr:w-150,h-150,fo-center,cm-resize",
66+
};
67+
68+
string element = JsonSerializer.Serialize(model, ModelBase.SerializerOptions);
69+
var deserialized = JsonSerializer.Deserialize<NamedTransformation>(
70+
element,
71+
ModelBase.SerializerOptions
72+
);
73+
Assert.NotNull(deserialized);
74+
75+
string expectedID = "6bZ9x2ZUx";
76+
DateTimeOffset expectedCreatedAt = DateTimeOffset.Parse("2024-01-10T09:00:00.000Z");
77+
bool expectedDisabled = false;
78+
string expectedName = "small_thumbnail";
79+
string expectedTransformation = "tr:w-150,h-150,fo-center,cm-resize";
80+
81+
Assert.Equal(expectedID, deserialized.ID);
82+
Assert.Equal(expectedCreatedAt, deserialized.CreatedAt);
83+
Assert.Equal(expectedDisabled, deserialized.Disabled);
84+
Assert.Equal(expectedName, deserialized.Name);
85+
Assert.Equal(expectedTransformation, deserialized.Transformation);
86+
}
87+
88+
[Fact]
89+
public void Validation_Works()
90+
{
91+
var model = new NamedTransformation
92+
{
93+
ID = "6bZ9x2ZUx",
94+
CreatedAt = DateTimeOffset.Parse("2024-01-10T09:00:00.000Z"),
95+
Disabled = false,
96+
Name = "small_thumbnail",
97+
Transformation = "tr:w-150,h-150,fo-center,cm-resize",
98+
};
99+
100+
model.Validate();
101+
}
102+
103+
[Fact]
104+
public void OptionalNonNullablePropertiesUnsetAreNotSet_Works()
105+
{
106+
var model = new NamedTransformation { };
107+
108+
Assert.Null(model.ID);
109+
Assert.False(model.RawData.ContainsKey("id"));
110+
Assert.Null(model.CreatedAt);
111+
Assert.False(model.RawData.ContainsKey("createdAt"));
112+
Assert.Null(model.Disabled);
113+
Assert.False(model.RawData.ContainsKey("disabled"));
114+
Assert.Null(model.Name);
115+
Assert.False(model.RawData.ContainsKey("name"));
116+
Assert.Null(model.Transformation);
117+
Assert.False(model.RawData.ContainsKey("transformation"));
118+
}
119+
120+
[Fact]
121+
public void OptionalNonNullablePropertiesUnsetValidation_Works()
122+
{
123+
var model = new NamedTransformation { };
124+
125+
model.Validate();
126+
}
127+
128+
[Fact]
129+
public void OptionalNonNullablePropertiesSetToNullAreNotSet_Works()
130+
{
131+
var model = new NamedTransformation
132+
{
133+
// Null should be interpreted as omitted for these properties
134+
ID = null,
135+
CreatedAt = null,
136+
Disabled = null,
137+
Name = null,
138+
Transformation = null,
139+
};
140+
141+
Assert.Null(model.ID);
142+
Assert.False(model.RawData.ContainsKey("id"));
143+
Assert.Null(model.CreatedAt);
144+
Assert.False(model.RawData.ContainsKey("createdAt"));
145+
Assert.Null(model.Disabled);
146+
Assert.False(model.RawData.ContainsKey("disabled"));
147+
Assert.Null(model.Name);
148+
Assert.False(model.RawData.ContainsKey("name"));
149+
Assert.Null(model.Transformation);
150+
Assert.False(model.RawData.ContainsKey("transformation"));
151+
}
152+
153+
[Fact]
154+
public void OptionalNonNullablePropertiesSetToNullValidation_Works()
155+
{
156+
var model = new NamedTransformation
157+
{
158+
// Null should be interpreted as omitted for these properties
159+
ID = null,
160+
CreatedAt = null,
161+
Disabled = null,
162+
Name = null,
163+
Transformation = null,
164+
};
165+
166+
model.Validate();
167+
}
168+
169+
[Fact]
170+
public void CopyConstructor_Works()
171+
{
172+
var model = new NamedTransformation
173+
{
174+
ID = "6bZ9x2ZUx",
175+
CreatedAt = DateTimeOffset.Parse("2024-01-10T09:00:00.000Z"),
176+
Disabled = false,
177+
Name = "small_thumbnail",
178+
Transformation = "tr:w-150,h-150,fo-center,cm-resize",
179+
};
180+
181+
NamedTransformation copied = new(model);
182+
183+
Assert.Equal(model, copied);
184+
}
185+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
using System;
2+
using Imagekit.Models.NamedTransformations;
3+
4+
namespace Imagekit.Tests.Models.NamedTransformations;
5+
6+
public class NamedTransformationCreateParamsTest : TestBase
7+
{
8+
[Fact]
9+
public void FieldRoundtrip_Works()
10+
{
11+
var parameters = new NamedTransformationCreateParams
12+
{
13+
Name = "small_thumbnail",
14+
Transformation = "tr:w-150,h-150,fo-center,cm-resize",
15+
Disabled = false,
16+
};
17+
18+
string expectedName = "small_thumbnail";
19+
string expectedTransformation = "tr:w-150,h-150,fo-center,cm-resize";
20+
bool expectedDisabled = false;
21+
22+
Assert.Equal(expectedName, parameters.Name);
23+
Assert.Equal(expectedTransformation, parameters.Transformation);
24+
Assert.Equal(expectedDisabled, parameters.Disabled);
25+
}
26+
27+
[Fact]
28+
public void OptionalNonNullableParamsUnsetAreNotSet_Works()
29+
{
30+
var parameters = new NamedTransformationCreateParams
31+
{
32+
Name = "small_thumbnail",
33+
Transformation = "tr:w-150,h-150,fo-center,cm-resize",
34+
};
35+
36+
Assert.Null(parameters.Disabled);
37+
Assert.False(parameters.RawBodyData.ContainsKey("disabled"));
38+
}
39+
40+
[Fact]
41+
public void OptionalNonNullableParamsSetToNullAreNotSet_Works()
42+
{
43+
var parameters = new NamedTransformationCreateParams
44+
{
45+
Name = "small_thumbnail",
46+
Transformation = "tr:w-150,h-150,fo-center,cm-resize",
47+
48+
// Null should be interpreted as omitted for these properties
49+
Disabled = null,
50+
};
51+
52+
Assert.Null(parameters.Disabled);
53+
Assert.False(parameters.RawBodyData.ContainsKey("disabled"));
54+
}
55+
56+
[Fact]
57+
public void Url_Works()
58+
{
59+
NamedTransformationCreateParams parameters = new()
60+
{
61+
Name = "small_thumbnail",
62+
Transformation = "tr:w-150,h-150,fo-center,cm-resize",
63+
};
64+
65+
var url = parameters.Url(new() { PrivateKey = "My Private Key", Password = "My Password" });
66+
67+
Assert.True(
68+
TestBase.UrisEqual(new Uri("https://api.imagekit.io/v1/named-transformations"), url)
69+
);
70+
}
71+
72+
[Fact]
73+
public void CopyConstructor_Works()
74+
{
75+
var parameters = new NamedTransformationCreateParams
76+
{
77+
Name = "small_thumbnail",
78+
Transformation = "tr:w-150,h-150,fo-center,cm-resize",
79+
Disabled = false,
80+
};
81+
82+
NamedTransformationCreateParams copied = new(parameters);
83+
84+
Assert.Equal(parameters, copied);
85+
}
86+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using Imagekit.Models.NamedTransformations;
3+
4+
namespace Imagekit.Tests.Models.NamedTransformations;
5+
6+
public class NamedTransformationDeleteParamsTest : TestBase
7+
{
8+
[Fact]
9+
public void FieldRoundtrip_Works()
10+
{
11+
var parameters = new NamedTransformationDeleteParams { ID = "id" };
12+
13+
string expectedID = "id";
14+
15+
Assert.Equal(expectedID, parameters.ID);
16+
}
17+
18+
[Fact]
19+
public void Url_Works()
20+
{
21+
NamedTransformationDeleteParams parameters = new() { ID = "id" };
22+
23+
var url = parameters.Url(new() { PrivateKey = "My Private Key", Password = "My Password" });
24+
25+
Assert.True(
26+
TestBase.UrisEqual(new Uri("https://api.imagekit.io/v1/named-transformations/id"), url)
27+
);
28+
}
29+
30+
[Fact]
31+
public void CopyConstructor_Works()
32+
{
33+
var parameters = new NamedTransformationDeleteParams { ID = "id" };
34+
35+
NamedTransformationDeleteParams copied = new(parameters);
36+
37+
Assert.Equal(parameters, copied);
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using Imagekit.Models.NamedTransformations;
3+
4+
namespace Imagekit.Tests.Models.NamedTransformations;
5+
6+
public class NamedTransformationGetParamsTest : TestBase
7+
{
8+
[Fact]
9+
public void FieldRoundtrip_Works()
10+
{
11+
var parameters = new NamedTransformationGetParams { ID = "id" };
12+
13+
string expectedID = "id";
14+
15+
Assert.Equal(expectedID, parameters.ID);
16+
}
17+
18+
[Fact]
19+
public void Url_Works()
20+
{
21+
NamedTransformationGetParams parameters = new() { ID = "id" };
22+
23+
var url = parameters.Url(new() { PrivateKey = "My Private Key", Password = "My Password" });
24+
25+
Assert.True(
26+
TestBase.UrisEqual(new Uri("https://api.imagekit.io/v1/named-transformations/id"), url)
27+
);
28+
}
29+
30+
[Fact]
31+
public void CopyConstructor_Works()
32+
{
33+
var parameters = new NamedTransformationGetParams { ID = "id" };
34+
35+
NamedTransformationGetParams copied = new(parameters);
36+
37+
Assert.Equal(parameters, copied);
38+
}
39+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
namespace Imagekit.Tests.Models.NamedTransformations;

0 commit comments

Comments
 (0)