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
Novu_Bot
Novu_Bot15mo ago
@Mr.__palindrome, you just advanced to level 1!
mr-palindrome
mr-palindromeOP15mo ago
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!
Pawan Jain
Pawan Jain15mo ago
@Mr.__palindrome Give us some time let us ping python sdk maintainer
mr-palindrome
mr-palindromeOP15mo ago
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!!
Pawan Jain
Pawan Jain15mo ago
@unicodeveloper Can you please help here?
Prosper
Prosper15mo ago
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?
mr-palindrome
mr-palindromeOP15mo ago
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!
No description
Prosper
Prosper15mo ago
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.
mr-palindrome
mr-palindromeOP15mo ago
Sure! Confirm me ones.. then I'll raise the PR!
Prosper
Prosper15mo ago
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
mr-palindrome
mr-palindromeOP15mo ago
Thanks for the update🙂
Novu_Bot
Novu_Bot15mo ago
@Nayan, you just advanced to level 2!
mr-palindrome
mr-palindromeOP15mo ago
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!
No description
Prosper
Prosper15mo ago
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
mr-palindrome
mr-palindromeOP15mo ago
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?
Prosper
Prosper15mo ago
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
mr-palindrome
mr-palindromeOP15mo ago
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:
{
"data": [
{
"key": "string",
"_userId": "string"
}
]
}
{
"data": [
{
"key": "string",
"_userId": "string"
}
]
}
But in the test case the sample url and api key getting following as response format:
{
"data":
{
"key": "string",
"_userId": "string"
}
}
{
"data":
{
"key": "string",
"_userId": "string"
}
}
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!
Prosper
Prosper15mo ago
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?
mr-palindrome
mr-palindromeOP15mo ago
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!
Prosper
Prosper15mo ago
I think already answered you in the PR/issue So are you asking for the regenerate api key issue now?
mr-palindrome
mr-palindromeOP15mo ago
Yeah right!
Prosper
Prosper15mo ago
So what's the ask for the regenerate api method?
mr-palindrome
mr-palindromeOP15mo ago
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!
Novu_Bot
Novu_Bot15mo ago
@Nayan, you just advanced to level 3!
Want results from more Discord servers?
Add your server