Skip to content

Commit

Permalink
Merge branch 'm-kovalsky/msgraphapi'
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kovalsky committed Jan 28, 2025
2 parents b74b32d + 5feb90e commit 43de77c
Show file tree
Hide file tree
Showing 5 changed files with 721 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/sempy_labs/_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import urllib.parse
import numpy as np
from IPython.display import display, HTML
import sempy_labs._authentication as auth
import requests
import sempy_labs._authentication as auth


def _build_url(url: str, params: dict) -> str:
Expand Down Expand Up @@ -1485,12 +1485,12 @@ def _base_api(
c = fabric.FabricRestClient()
elif client == "fabric_sp":
c = fabric.FabricRestClient(token_provider=auth.token_provider.get())
elif client == "azure":
elif client in ["azure", "graph"]:
pass
else:
raise ValueError(f"{icons.red_dot} The '{client}' client is not supported.")

if client != "azure":
if client not in ["azure", "graph"]:
if method == "get":
response = c.get(request)
elif method == "delete":
Expand All @@ -1504,9 +1504,12 @@ def _base_api(
else:
raise NotImplementedError
else:
headers = _get_headers(auth.token_provider.get(), audience="azure")
headers = _get_headers(auth.token_provider.get(), audience=client)
response = requests.request(
method.upper(), request, headers=headers, json=payload
method.upper(),
f"https://graph.microsoft.com/v1.0/{request}",
headers=headers,
json=payload,
)

if lro_return_json:
Expand Down
33 changes: 33 additions & 0 deletions src/sempy_labs/graph/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from sempy_labs.graph._groups import (
list_groups,
list_group_owners,
list_group_members,
add_group_members,
add_group_owners,
resolve_group_id,
renew_group,
)
from sempy_labs.graph._users import (
resolve_user_id,
get_user,
list_users,
send_mail,
)
from sempy_labs.graph._teams import (
list_teams,
)

__all__ = [
"list_groups",
"list_group_owners",
"list_group_members",
"add_group_members",
"add_group_owners",
"renew_group",
"resolve_group_id",
"resolve_user_id",
"get_user",
"list_users",
"send_mail",
"list_teams",
]
Loading

0 comments on commit 43de77c

Please sign in to comment.