Documentation
¶
Index ¶
- Constants
- type Auth
- type AuthBuilder
- func (t *AuthBuilder) Build() (*Auth, error)
- func (t *AuthBuilder) WithApiVersion(apiVersion string) *AuthBuilder
- func (t *AuthBuilder) WithClientId(ClientId string) *AuthBuilder
- func (t *AuthBuilder) WithClientSecret(ClientSecret string) *AuthBuilder
- func (t *AuthBuilder) WithCustomTokenCache(TokenCache ITokenCache) *AuthBuilder
- func (t *AuthBuilder) WithEndpoint(endpointLocation string) *AuthBuilder
- func (t *AuthBuilder) WithRedirectUrl(RedirectUrl string) *AuthBuilder
- func (t *AuthBuilder) WithResponseMode(ResponseMode string) *AuthBuilder
- func (t *AuthBuilder) WithScopes(Scopes []string) *AuthBuilder
- func (t *AuthBuilder) WithTenant(Tenant string) *AuthBuilder
- type Client
- type DefaultTokenCache
- type GraphResponse
- type ITokenCache
- type Token
Constants ¶
View Source
const ( ApiVersion10 = "v1.0" ApiVersionBeta = "beta" EndpointInternational = "graph.microsoft.com" EndpointChina = "microsoftgraph.chinacloudapi.cn" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct { Tenant string ClientId string ClientSecret string RedirectUrl string Scopes []string ResponseMode string TokenCache ITokenCache ApiVersion string Endpoint string }
func (*Auth) GetAccessToken ¶
GetAccessToken Stores user AccessToken and RefreshToken to TokenStore
returns User's HomeAccountId
func (*Auth) GetAuthUrl ¶
type AuthBuilder ¶
type AuthBuilder struct {
// contains filtered or unexported fields
}
func NewAuthBuilder ¶ added in v1.0.0
func NewAuthBuilder() *AuthBuilder
NewAuthBuilder Create a new builder
func (*AuthBuilder) Build ¶
func (t *AuthBuilder) Build() (*Auth, error)
func (*AuthBuilder) WithApiVersion ¶ added in v1.0.0
func (t *AuthBuilder) WithApiVersion(apiVersion string) *AuthBuilder
func (*AuthBuilder) WithClientId ¶
func (t *AuthBuilder) WithClientId(ClientId string) *AuthBuilder
func (*AuthBuilder) WithClientSecret ¶
func (t *AuthBuilder) WithClientSecret(ClientSecret string) *AuthBuilder
func (*AuthBuilder) WithCustomTokenCache ¶
func (t *AuthBuilder) WithCustomTokenCache(TokenCache ITokenCache) *AuthBuilder
func (*AuthBuilder) WithEndpoint ¶ added in v1.0.0
func (t *AuthBuilder) WithEndpoint(endpointLocation string) *AuthBuilder
func (*AuthBuilder) WithRedirectUrl ¶
func (t *AuthBuilder) WithRedirectUrl(RedirectUrl string) *AuthBuilder
func (*AuthBuilder) WithResponseMode ¶
func (t *AuthBuilder) WithResponseMode(ResponseMode string) *AuthBuilder
func (*AuthBuilder) WithScopes ¶
func (t *AuthBuilder) WithScopes(Scopes []string) *AuthBuilder
func (*AuthBuilder) WithTenant ¶
func (t *AuthBuilder) WithTenant(Tenant string) *AuthBuilder
type Client ¶
type Client struct { HomeAccountId string TokenCache ITokenCache AuthClient *Auth }
func GetClient ¶
func GetClient(auth *Auth, HomeAccountId string, tokenCache ...ITokenCache) *Client
GetClient
Get a *Client
HomeAccountId can be set to "",but should be set by WithHomeAccountId()
func (*Client) Request ¶
func (t *Client) Request(method string, path string, body []byte, header *map[string][]string, query *map[string][]string) (*GraphResponse, error)
Request
method:HTTP method used to request
path: e.g.:https://graph.microsoft.com/v1.0/me => /me
body: Set "" when method is GET, otherwise you will get an error
header:Optional.Set custom headers by it.
func (*Client) WithHomeAccountId ¶
WithHomeAccountId
Set HomeAccountId.
If you set it when create Client, previous will be override.
type DefaultTokenCache ¶
type DefaultTokenCache struct {
// contains filtered or unexported fields
}
func (*DefaultTokenCache) Delete ¶ added in v0.0.3
func (t *DefaultTokenCache) Delete(HomeAccountId string) error
func (*DefaultTokenCache) Get ¶
func (t *DefaultTokenCache) Get(HomeAccountId string) *Token
type GraphResponse ¶
type GraphResponse struct { Body string RawBody []byte Headers http.Header RawResponse *http.Response }
func (*GraphResponse) GetJson ¶
func (t *GraphResponse) GetJson() gjson.Result
func (*GraphResponse) ToJson ¶
func (t *GraphResponse) ToJson() (map[string]interface{}, error)
type ITokenCache ¶
Click to show internal directories.
Click to hide internal directories.