@@ -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'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 }
0 commit comments