mirror of
https://github.com/pd4d10/git-touch.git
synced 2026-03-22 14:09:41 -05:00
refactoring fetchBb #102
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @shreyas1599 on GitHub (Jan 10, 2021).
Hi, @pd4d10
fetchBbandfetchBbJsonare two different methods. I need to add other HTTP methods(PUT, DELETE, PATCH) like I did for Gitee. Is it alright if I refactor this into a singlefetchBbmethod and update the references across all files? Also was there any specific reason you used two methods(fetchBb and fetchBbJson) for bitbucket unlike the others?@pd4d10 commented on GitHub (Jan 10, 2021):
OK. BTW, the
httplib seems a bit verbose when using the HTTP method other than 'GET'.Currently it is:
But for the common request utility function, what we want is more like:
So we could pass the HTTP method enum directly
@shreyas1599 commented on GitHub (Jan 10, 2021):
Oh do you mean using this function:
and then Something like this?
But the above seems will not make the existing code simpler.
Are you talking more along these lines: https://github.com/dart-lang/language/issues/158 ?
Seems like we can't create methods in enums. Only using extensions we can call methods
@pd4d10 commented on GitHub (Jan 11, 2021):
Yeah, I mean if the
httplib does already support this, the code would be simpler. For example, we could get rid of theswitch caseas follows:780970a5b7/lib/models/auth.dart (L333-L366)We could just pass the
methodinstead, no matter if it is astringorenum@pd4d10 commented on GitHub (Jan 11, 2021):
I think your proposal is fine. Let's just do the refactor as you supposed.