msgraph.graph.graph

Microsoft Graph object
License: BSL-1.0.
struct Graph;
this(string tenantId, string clientId, string[] requireScope, string clientSecret = null);
this(string tenantId, string clientId, string accessToken, string refreshToken, string[] requireScope);
this(AuthInfo authInfo);
void setup(string tenantId, string clientId, string[] requireScope, string clientSecret = null);
void setup(string tenantId, string clientId, string accessToken, string refreshToken, string[] requireScope);
void setup(AuthInfo info);
Setup Microsoft Graph
Parameters:
string clientId Client ID (from Asure Active Directory)
string tenantId Tenant ID (from Asure Active Directory)
string clientSecret Client secret (from Asure Active Directory, provisioned client secret). This is set only for server application.
AuthInfo authInfo Detail information for authrization.
void authorize(string code);
void updateTokens();
const string accessToken();
const SysTime accessTokenExpires();
const bool isAccessTokenExpired();
const string refreshToken();
alias Method = std.net.curl.HTTP.Method;
enum Endpoint: string;
v1_0
v1
beta
struct HttpResult;
HTTP.StatusLine statusLine;
string[string] responseHeaders;
immutable(ubyte)[] responseBody;
inout ref inout(HTTP) handle() return;
void setProxy(string proxy);
void setProxy(string proxy, ushort port, CurlProxy proxyType = CurlProxy.http);
void setProxy(string proxy, string authUser, string authPass, CurlAuth authType = CurlAuth.basic);
void setProxy(string proxy, ushort port, string authUser, string authPass, CurlProxy proxyType = CurlProxy.http, CurlAuth authType = CurlAuth.basic);
Set proxy settings
Parameters:
string proxy Hostname or URL
ushort port Port number
CurlProxy proxyType Type of proxy
string authUser User name for proxy
string authPass Password for proxy
CurlAuth authType Auth type of proxy
void setCert(in char[] cafile, in char[] clientCertFile = null, in char[] privateKeyFile = null, in char[] privateKeyPassword = null);
Certification settings
Parameters:
char[] cafile PEM file of trusted CA.
char[] clientCertFile PEM file of client cert file if required.
char[] privateKeyFile PEM file of client private key file if required.
char[] privateKeyPassword Password of private key file if required.
HttpResult request(Method method, Endpoint endpoint, in char[] resource, in char[] query, in ubyte[] contents = null, string contentType = null);
HTTP Request for Microsoft Graph API call
HttpResult get(in char[] resource, in char[] query);
HttpResult get(string resource, string[string] query);
HttpResult get(string resource);
GET Request
HttpResult post(in char[] resource, in ubyte[] contents, string contentType = "application/octet-stream");
HttpResult post(in char[] resource, in char[] contents, string contentType = "application/x-www-form-urlencoded");
HttpResult post(in char[] resource, JSONValue params);
HttpResult post(in char[] resource, string[string] params);
POST Request
HttpResult put(in char[] resource, in ubyte[] contents, string contentType = "application/octet-stream");
HttpResult put(in char[] resource, in char[] contents, string contentType = "application/x-www-form-urlencoded");
HttpResult put(in char[] resource, JSONValue params);
HttpResult put(in char[] resource, string[string] params);
PUT Request
HttpResult patch(in char[] resource, in ubyte[] contents, string contentType = "application/octet-stream");
HttpResult patch(in char[] resource, in char[] contents, string contentType = "application/x-www-form-urlencoded");
HttpResult patch(in char[] resource, JSONValue params);
HttpResult patch(in char[] resource, string[string] params);
PATCH Request
HttpResult del(in char[] resource);
DELETE Request
bool setupWithAdHocServer(ref Graph g, AuthInfo authInfo, Duration dur = 30.seconds);