Graph Client¶
m365_brain.m365.client
¶
The one Microsoft Graph transport: pagination, retry, backoff, write verbs.
Accepts a token_provider callable instead of coupling to a specific auth module.
GraphClient
¶
HTTP client for Microsoft Graph API v1.0.
Source code in m365_brain/m365/client.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
max_pages
property
¶
Return the configured maximum number of pages for paginated requests.
__init__
¶
__init__(graph_config: GraphConfig, token_provider: Callable[[], str], *, prefer_immutable_ids: bool) -> None
prefer_immutable_ids asks Graph for Outlook ids that survive a folder move.
A default id changes when a message moves, and sending a draft moves it from Drafts to Sent Items. An outbox that stored the default id reads every sent draft as a 404, i.e. as deleted. The sync keeps default ids because the vault is keyed on them.
Source code in m365_brain/m365/client.py
get
¶
Execute a GET request against Graph API. Returns the JSON response.
post
¶
POST a JSON body, or a bodyless POST when json_body is None.
patch
¶
put_bytes
¶
PUT raw bytes with an explicit Content-Type.
if_match carries an eTag for a conditional write, None for an
unconditional one. The transport does not decide which is appropriate;
m365/files.py owns that policy and never exposes the nullable.
Source code in m365_brain/m365/client.py
get_bytes
¶
Download binary content from a URL (e.g. @microsoft.graph.downloadUrl).
get_bytes_with_content_type
¶
Download binary content and return (bytes, content_type).
Source code in m365_brain/m365/client.py
get_pages
¶
Fetch up to max_pages pages of a collection. Returns (items, truncated).
get_paginated
¶
Iterate items from a paginated collection (thin wrapper over get_pages).
Source code in m365_brain/m365/client.py
get_delta
¶
get_delta(path: str, delta_link: str | None, params: dict[str, Any] | None, max_pages: int) -> tuple[list[dict], str | None]
Execute a delta query. Returns (items, resume_link).