mailcow / mailcow-dockerized

mailcow: dockerized - 🐮 + 🐋 = 💕
https://mailcow.email
GNU General Public License v3.0
9.07k stars 1.19k forks source link

[api] Make JSON types static #3961

Open TheOneWithTheBraid opened 3 years ago

TheOneWithTheBraid commented 3 years ago

Summary

It would be great to have static types in the API. Currently, in many types of responses, the mailcow API returns non-constant types: get/domain's bytes_total sometimes returns Strings, sometimes ints. For languages with static typing, it is very hard to handle this inconsistency.

I propose to standardize the types used.

Motivation

I currently try to integrate the mailcow API into a Dart server, which seems to be difficult due to the non-static types.

Additional context

Nope

andryyy commented 3 years ago

Yes, we should fix that. Do you think you can propose a change? Or collect invalid returns?

TheOneWithTheBraid commented 3 years ago

I will try it. Where is the source code of the API located? In the backend or in a separate repo? I would probably even like to fix it...

TheOneWithTheBraid commented 3 years ago

Well, is https://github.com/mailcow/cow-app really the right repo for the API?

tobikris commented 3 years ago

I have tried to look into that as well. I think the current API code is in https://github.com/mailcow/mailcow-dockerized/blob/master/data/web/json_api.php The repo https://github.com/mailcow/cow-app seems to be some kind of proof of concept at this state?

andryyy commented 3 years ago

Oh, sorry, overlooked this. Yes, the json_api.php is what you are looking for.

The cow-app repository is a WIP as of today, yes.

tobikris commented 3 years ago

Thanks for the clarification. Is there any information on this WIP? I have thought of implementing a terraform provider. But currently it is not clear to me if that makes sense or if the whole API will change? Also I might be interested in helping with the development of this WIP.

andryyy commented 3 years ago

The cow-app is a mail UI. :) Not related.