typesense / typesense-dart

Dart client for Typesense
https://typesense.org/docs
Apache License 2.0
71 stars 16 forks source link

Support for collection update #118

Closed kishorenc closed 2 years ago

kishorenc commented 2 years ago

Is your feature request related to a problem? Please describe.

In the next version of Typesense (0.23) we're supporting in-place schema changes to collections through a PATCH /collections/:name end-point. We need to add this method to the client.

Describe the solution you'd like

Please see the examples I've created for the various clients (not all of them are implemented yet) here.

The Dart version looks like this:

final updateSchema = UpdateSchema(
  {
    Field('company_category', Type.string),
    Field('num_employees', drop: true)
  }
);
await client.collection('companies').update(updateSchema);

For now you can change only the fields (can't change the name or other properties like default_sorting_field etc. yet). So we need a UpdateSchema wrapper class that's a subset of the Schema class (only containing fields) with which we can call the .update().

cc @happy-san