Skip to content

Commit 247c7c4

Browse files
author
SDKgen-Bot
committed
Operation "records.getAll.throws.400" was added
Operation "records.getAll.throws.403" was added Operation "records.getAll.throws.404" was added Operation "records.getAll.throws.500" was added Operation "records.get.throws.400" was added Operation "records.get.throws.403" was added Operation "records.get.throws.404" was added Operation "records.get.throws.500" was added Operation "records.replace.throws.400" was added Operation "records.replace.throws.403" was added Operation "records.replace.throws.404" was added Operation "records.replace.throws.500" was added Operation "records.replaceAll.throws.400" was added Operation "records.replaceAll.throws.403" was added Operation "records.replaceAll.throws.404" was added Operation "records.replaceAll.throws.500" was added Operation "records.update.throws.400" was added Operation "records.update.throws.403" was added Operation "records.update.throws.404" was added Operation "records.update.throws.500" was added Operation "records.updateAll.throws.400" was added Operation "records.updateAll.throws.403" was added Operation "records.updateAll.throws.404" was added Operation "records.updateAll.throws.500" was added Operation "fields.create.throws.400" was added Operation "fields.create.throws.403" was added Operation "fields.create.throws.404" was added Operation "fields.create.throws.500" was added Operation "fields.update.throws.400" was added Operation "fields.update.throws.403" was added Operation "fields.update.throws.404" was added Operation "fields.update.throws.500" was added Operation "tables.create.throws.400" was added Operation "tables.create.throws.403" was added Operation "tables.create.throws.404" was added Operation "tables.create.throws.500" was added Operation "tables.update.throws.400" was added Operation "tables.update.throws.403" was added Operation "tables.update.throws.404" was added Operation "tables.update.throws.500" was added Operation "comments.getAll.throws.400" was added Operation "comments.getAll.throws.403" was added Operation "comments.getAll.throws.404" was added Operation "comments.getAll.throws.500" was added Operation "comments.create.throws.400" was added Operation "comments.create.throws.403" was added Operation "comments.create.throws.404" was added Operation "comments.create.throws.500" was added Operation "comments.update.throws.400" was added Operation "comments.update.throws.403" was added Operation "comments.update.throws.404" was added Operation "comments.update.throws.500" was added Operation "comments.delete.throws.400" was added Operation "comments.delete.throws.403" was added Operation "comments.delete.throws.404" was added Operation "comments.delete.throws.500" was added Operation "records.create" was added Type "Error" was added Type "Error_Details" was added
1 parent fbec3ae commit 247c7c4

File tree

8 files changed

+136
-1
lines changed

8 files changed

+136
-1
lines changed

sdkgen.lock

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/SdkFabric.Airtable/CommentsTag.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ public async Task<CommentCollection> GetAll(string baseId, string tableIdOrName,
4242

4343
throw (int) response.StatusCode switch
4444
{
45+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
46+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
47+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
48+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
4549
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
4650
};
4751
}
@@ -70,6 +74,10 @@ public async Task<Comment> Create(string baseId, string tableIdOrName, string re
7074

7175
throw (int) response.StatusCode switch
7276
{
77+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
78+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
79+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
80+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
7381
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
7482
};
7583
}
@@ -99,6 +107,10 @@ public async Task<Comment> Update(string baseId, string tableIdOrName, string re
99107

100108
throw (int) response.StatusCode switch
101109
{
110+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
111+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
112+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
113+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
102114
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
103115
};
104116
}
@@ -127,6 +139,10 @@ public async Task<CommentDeleteResponse> Delete(string baseId, string tableIdOrN
127139

128140
throw (int) response.StatusCode switch
129141
{
142+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
143+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
144+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
145+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
130146
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
131147
};
132148
}

src/SdkFabric.Airtable/Error.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Error automatically generated by SDKgen please do not edit this file manually
3+
* @see https://sdkgen.app
4+
*/
5+
6+
using System.Text.Json.Serialization;
7+
namespace SdkFabric.Airtable;
8+
public class Error
9+
{
10+
[JsonPropertyName("error")]
11+
public ErrorDetails? Error { get; set; }
12+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* ErrorDetails automatically generated by SDKgen please do not edit this file manually
3+
* @see https://sdkgen.app
4+
*/
5+
6+
using System.Text.Json.Serialization;
7+
namespace SdkFabric.Airtable;
8+
public class ErrorDetails
9+
{
10+
[JsonPropertyName("type")]
11+
public string? Type { get; set; }
12+
[JsonPropertyName("message")]
13+
public string? Message { get; set; }
14+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* ErrorException automatically generated by SDKgen please do not edit this file manually
3+
* @see https://sdkgen.app
4+
*/
5+
6+
7+
using Sdkgen.Client.Exception;
8+
9+
namespace SdkFabric.Airtable;
10+
11+
public class ErrorException : KnownStatusCodeException
12+
{
13+
public Error Payload;
14+
15+
public ErrorException(Error payload)
16+
{
17+
this.Payload = payload;
18+
}
19+
}

src/SdkFabric.Airtable/FieldsTag.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ public async Task<Field> Create(string baseId, string tableId, Field payload)
4242

4343
throw (int) response.StatusCode switch
4444
{
45+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
46+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
47+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
48+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
4549
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
4650
};
4751
}
@@ -70,6 +74,10 @@ public async Task<Field> Update(string baseId, string tableId, string columnId,
7074

7175
throw (int) response.StatusCode switch
7276
{
77+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
78+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
79+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
80+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
7381
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
7482
};
7583
}

src/SdkFabric.Airtable/RecordsTag.cs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public async Task<RecordCollection> GetAll(string baseId, string tableIdOrName,
5656

5757
throw (int) response.StatusCode switch
5858
{
59+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
60+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
61+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
62+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
5963
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
6064
};
6165
}
@@ -86,6 +90,44 @@ public async Task<Record> Get(string baseId, string tableIdOrName, string record
8690

8791
throw (int) response.StatusCode switch
8892
{
93+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
94+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
95+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
96+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
97+
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
98+
};
99+
}
100+
101+
/**
102+
* Creates multiple records. Note that table names and table ids can be used interchangeably. We recommend using table IDs so you don&#039;t need to modify your API request when your table name changes.
103+
*/
104+
public async Task<RecordCollection> Create(string baseId, string tableIdOrName, RecordCollection payload)
105+
{
106+
Dictionary<string, object> pathParams = new();
107+
pathParams.Add("baseId", baseId);
108+
pathParams.Add("tableIdOrName", tableIdOrName);
109+
110+
Dictionary<string, object> queryParams = new();
111+
112+
List<string> queryStructNames = new();
113+
114+
RestRequest request = new(this.Parser.Url("/v0/:baseId/:tableIdOrName", pathParams), Method.Post);
115+
this.Parser.Query(request, queryParams, queryStructNames);
116+
request.AddJsonBody(JsonSerializer.Serialize(payload));
117+
118+
RestResponse response = await this.HttpClient.ExecuteAsync(request);
119+
120+
if (response.IsSuccessful)
121+
{
122+
return this.Parser.Parse<RecordCollection>(response.Content);
123+
}
124+
125+
throw (int) response.StatusCode switch
126+
{
127+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
128+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
129+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
130+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
89131
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
90132
};
91133
}
@@ -117,6 +159,10 @@ public async Task<Record> Replace(string baseId, string tableIdOrName, string re
117159

118160
throw (int) response.StatusCode switch
119161
{
162+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
163+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
164+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
165+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
120166
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
121167
};
122168
}
@@ -147,6 +193,10 @@ public async Task<BulkUpdateResponse> ReplaceAll(string baseId, string tableIdOr
147193

148194
throw (int) response.StatusCode switch
149195
{
196+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
197+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
198+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
199+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
150200
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
151201
};
152202
}
@@ -178,6 +228,10 @@ public async Task<Record> Update(string baseId, string tableIdOrName, string rec
178228

179229
throw (int) response.StatusCode switch
180230
{
231+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
232+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
233+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
234+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
181235
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
182236
};
183237
}
@@ -208,6 +262,10 @@ public async Task<BulkUpdateResponse> UpdateAll(string baseId, string tableIdOrN
208262

209263
throw (int) response.StatusCode switch
210264
{
265+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
266+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
267+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
268+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
211269
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
212270
};
213271
}

src/SdkFabric.Airtable/TablesTag.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public async Task<Table> Create(string baseId, Table payload)
4444

4545
throw (int) response.StatusCode switch
4646
{
47+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
48+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
49+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
50+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
4751
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
4852
};
4953
}
@@ -71,6 +75,10 @@ public async Task<Table> Update(string baseId, string tableIdOrName, Table paylo
7175

7276
throw (int) response.StatusCode switch
7377
{
78+
400 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
79+
403 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
80+
404 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
81+
500 => new ErrorException(this.Parser.Parse<Error>(response.Content)),
7482
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
7583
};
7684
}

0 commit comments

Comments
 (0)