Adding Missing Method for Environments in python SDK
Hey folks, I am working on the following issue https://github.com/novuhq/novu-python/issues/74. I need help in understanding the updateMyEnvironment API (https://api.novu.co/api#/Environments/EnvironmentsController_updateMyEnvironment). It would be really help-full if any maintainer or contributor can help me in with it!
GitHub
Issues · novuhq/novu-python
Python SDK for Novu - The open-source notification infrastructure for engineers. 🚀 - Issues · novuhq/novu-python
24 Replies
@Mr.__palindrome, you just advanced to level 1!
I tried to work with it but I'm really confused what the different payload parameters means. like dns and inboundParseDomain.
And do I need to add them in its respective dto (EnvironmentDto) as no dns or inboundParseDomain keyword defination is mentioned!
@Mr.__palindrome
Give us some time
let us ping python sdk maintainer
hey @Pawan Jain no one from the maintainer team reached to me yet.. I'm stuck at this issue from over a week. All of my development has been done but I'm stuck at writing the test case as I could not figure out the use case of the API!!
@unicodeveloper
Can you please help here?
I am not sure how to help here @Mr.__palindrome
What exactly do you need help understanding?
There are other methods in the specific class you are working with in the SDK on this issue with sample code on how to achieve the methods you are adding to that class.
Some require normal parameters, some require setting up a dto to pass as a parameter.
So do you need additional clarity on on what to put in the api reference docs to test it out or what’s the need here?
Hey @unicodeveloper, I tried playing with the api reference that is available on https://docs.novu.co/api-reference/environments/update-env-by-id to understand the endpoint and write the test cases but whenever I hit the request I am getting 401(unauthorized). I checked and verified that the api key which I'm using is correct as I can hit other endpoints using it. Here is a screenshot for the reference.
It would be really helpfull if you can explain the use case of the api and the use case of different keywords int he payload!
I think I might know the issue now. Thanks for providing more clarity. From the response here, it is saying "API endpoint not available".
This means the API endpoint might not be public facing. If I am right, then we probably need to remove it from the API reference and need not add it anymore to the SDK.
Please let me come back to you on this issue.
Sure! Confirm me ones.. then I'll raise the PR!
Hey @Nayan We have now removed this API endpoint. It has also been removed from the API reference docs.
So please go ahead only with the regenerate API keys functionality
Thanks for the update🙂
@Nayan, you just advanced to level 2!
Hey @unicodeveloper, sorry for distrubing you again. The endpoint is removed from Novu documentation but it is still visible in the swagger documentation (https://api.novu.co/api#/Environments/EnvironmentsController_updateMyEnvironment)
Can you remove this from here as well! Otherwise it can create confusion to other contributors!
It's still available in the Swagger docs because the next release is not out yet. When it's out and tagged, it will no longer be visible
Okay thank you!
BTW I am also facing issue in writing the test case for the regenerate method as after regenerating the api key is changing!
Any idea how can I tackle that?
I think you can just make your test case test that the response after regenerating should not be the same with the value that was there before.
Basically comparing the two values not to be equal
okay.. thanks for the idea!
Hey @unicodeveloper I guess there is some issue with the sample regenerate endpoint. As the response which needs to be returned from the regenerate endpoint is different from what is mentioned in the document.
While performing test the testcase is getting continuously failed as the expected response would be in the following format:
But in the test case the sample url and api key getting following as response format:
Can you please verify this from your end!
the data which contains the key and the user id needs to be a list of dictionaries but in the sample it is a single dictionary!
And also it is returning the same API key after regenerating in the sample!
It means the docs reponse is wrong. It needs to be updated to be the object format. can you raise it as an issue to the docs and maybe send a PR?
I verified the actual api, it is giving response in the mentioned doc format only. But the sample is giving a different response format!
And the response format also matched with the get api key API and its sample's response format. But the sample response for regenerate api key has a different format!
Hey @unicodeveloper any update on this! Or else I can raise a PR handling this condition/exception!
I think already answered you in the PR/issue
So are you asking for the regenerate api key issue now?
Yeah right!
So what's the ask for the regenerate api method?
The api response format for the sample response which is used in test is different from the response which is returned by the actual API endpoint.
I have shared more details here
Hey had a small convo with ryshu. The issue has been resolved!
@Nayan, you just advanced to level 3!