Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add undocumented param to contacts API endpoint which allows URNs to be expanded #4511

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

rowanseymour
Copy link
Member

Without param...

"urns": ["tel:+250700009999", "twitterid:357475478548745"]

With param...

"urns": [
    {
        "channel": {
            "uuid": "c9a5d98a-4c89-4f25-af96-81f06b67e019",
            "name": "Vonage"
        },
        "scheme": "tel",
        "path": "+250700009999",
        "display": null
    },
    {
        "channel": null,
        "scheme": "twitterid",
        "path": "357475478548745",
        "display": "cathy"
    }
]

Without param in anon org...

"urns": ["tel:********", "twitterid:********"]

With param in anon org...

"urns": [
    {
        "channel": {
            "uuid": "c9a5d98a-4c89-4f25-af96-81f06b67e019",
            "name": "Vonage"
        },
        "scheme": "tel",
        "path": "********",
        "display": null
    },
    {
        "channel": null,
        "scheme": "twitterid",
        "path": "********",
        "display": "cathy"
    }
]

No channel indicates a URN which is not sendable.

@codecov
Copy link

codecov bot commented Apr 25, 2023

Codecov Report

Merging #4511 (32491d7) into main (229cbf0) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main     #4511   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          495       495           
  Lines        26583     26598   +15     
=========================================
+ Hits         26583     26598   +15     
Impacted Files Coverage Δ
temba/api/v2/fields.py 100.00% <100.00%> (ø)
temba/api/v2/serializers.py 100.00% <100.00%> (ø)
temba/api/v2/views.py 100.00% <100.00%> (ø)
temba/contacts/models.py 100.00% <100.00%> (ø)
temba/mailroom/client.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Fetches additional information about the given contacts from mailroom
"""
if not contacts:
return

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should return an empty dict above?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and that line is not covered so the type should be dict as the function shows I think

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good spot - just fixed that after adding more tests

@rowanseymour rowanseymour merged commit 047c2a5 into main Apr 25, 2023
@rowanseymour rowanseymour deleted the expand_urns branch April 25, 2023 22:36
@github-actions github-actions bot locked and limited conversation to collaborators Apr 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants