Documentation
¶
Index ¶
- func GenerateStateParameter() (string, error)
- type AuthType
- type Client
- func (c *Client) ExchangeCodeForToken(oauthConfig OAuthConfig, code string) (*TokenResponse, error)
- func (c *Client) GenerateAuthorizationURL(oauthConfig OAuthConfig, state string) (string, error)
- func (c *Client) GetGraphClient() *msgraph.GraphServiceClient
- func (c *Client) GetOneNoteDataAsJSON(ctx context.Context) (*types.DocumentCollection, error)
- func (c *Client) GetUserID() string
- func (c *Client) IsDelegatedAuth() bool
- func (c *Client) RefreshToken(oauthConfig OAuthConfig, refreshToken string) (*TokenResponse, error)
- func (c *Client) TestAccessToken(accessToken string) error
- type ConcurrencyConfig
- type Config
- type ContentJob
- type ContentResult
- type Interface
- type OAuthClient
- type OAuthConfig
- type OneNoteRawData
- type SectionJob
- type SectionResult
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateStateParameter ¶
GenerateStateParameter generates a cryptographically secure random state parameter for OAuth
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the base Microsoft Graph client
func NewClient ¶
NewClient creates a new Microsoft Graph client with service credentials (client credentials flow)
func NewClientWithToken ¶
NewClientWithToken creates a new Microsoft Graph client using an existing access token (from auth service)
func NewClientWithUserID ¶
NewClientWithUserID creates a new Microsoft Graph client with service credentials for a specific user
func (*Client) ExchangeCodeForToken ¶
func (c *Client) ExchangeCodeForToken(oauthConfig OAuthConfig, code string) (*TokenResponse, error)
ExchangeCodeForToken exchanges authorization code for access token
func (*Client) GenerateAuthorizationURL ¶
func (c *Client) GenerateAuthorizationURL(oauthConfig OAuthConfig, state string) (string, error)
AuthorizationURL generates the authorization URL for OAuth 2.0 flow
func (*Client) GetGraphClient ¶
func (c *Client) GetGraphClient() *msgraph.GraphServiceClient
GetGraphClient returns the underlying Microsoft Graph client
func (*Client) GetOneNoteDataAsJSON ¶
GetOneNoteDataAsJSON implements the Interface method to get all OneNote pages as JSON array This is the public interface that delegates to the data combination layer
func (*Client) IsDelegatedAuth ¶
IsDelegatedAuth returns true if the client uses delegated authentication flow
func (*Client) RefreshToken ¶
func (c *Client) RefreshToken(oauthConfig OAuthConfig, refreshToken string) (*TokenResponse, error)
RefreshToken refreshes an expired access token using refresh token
func (*Client) TestAccessToken ¶
TestAccessToken tests if an access token is valid by making a request to Microsoft Graph
type ConcurrencyConfig ¶
type ConcurrencyConfig struct {
MaxSectionWorkers int // Maximum concurrent section fetchers
MaxContentWorkers int // Maximum concurrent content fetchers
}
ConcurrencyConfig defines limits for concurrent operations
func DefaultConcurrencyConfig ¶
func DefaultConcurrencyConfig() ConcurrencyConfig
DefaultConcurrencyConfig returns sensible defaults for API rate limiting
type Config ¶
type Config struct {
ClientID string
ClientSecret string
TenantID string
LoginEndpoint string
Scopes []string
// OneNote concurrency configuration
OneNoteConcurrency *ConcurrencyConfig
}
Config represents the configuration for Microsoft Graph client
type ContentJob ¶
ContentJob represents a content fetching job
type ContentResult ¶
ContentResult represents the result of content fetching
type Interface ¶
type Interface interface {
// OneNote data extraction - returns all OneNote pages as JSON array
GetOneNoteDataAsJSON(ctx context.Context) (*types.DocumentCollection, error)
}
Interface defines the main interface for Microsoft Graph data extraction services
type OAuthClient ¶
type OAuthClient struct {
// contains filtered or unexported fields
}
OAuthClient represents a client specifically for OAuth operations
func NewOAuthClient ¶
func NewOAuthClient(config OAuthConfig) *OAuthClient
NewOAuthClient creates a new OAuth client
func (*OAuthClient) ExchangeCode ¶
func (oc *OAuthClient) ExchangeCode(code string) (*TokenResponse, error)
ExchangeCode exchanges authorization code for tokens
func (*OAuthClient) GetAuthorizationURL ¶
func (oc *OAuthClient) GetAuthorizationURL(state string) (string, error)
GetAuthorizationURL generates authorization URL
func (*OAuthClient) RefreshAccessToken ¶
func (oc *OAuthClient) RefreshAccessToken(refreshToken string) (*TokenResponse, error)
RefreshAccessToken refreshes access token using refresh token
func (*OAuthClient) TestToken ¶
func (oc *OAuthClient) TestToken(accessToken string) error
TestToken tests if access token is valid
type OAuthConfig ¶
type OAuthConfig struct {
ClientID string
ClientSecret string
TenantID string // Use "common" for personal accounts, specific tenant ID for work/school accounts
RedirectURI string
Scopes []string
}
OAuthConfig represents OAuth configuration for Microsoft Graph
func NewPersonalAccountOAuthConfig ¶
func NewPersonalAccountOAuthConfig(clientID, clientSecret, redirectURI string, scopes []string) OAuthConfig
NewPersonalAccountOAuthConfig creates OAuth config for personal Microsoft accounts
func NewWorkSchoolAccountOAuthConfig ¶
func NewWorkSchoolAccountOAuthConfig(clientID, clientSecret, tenantID, redirectURI string, scopes []string) OAuthConfig
NewWorkSchoolAccountOAuthConfig creates OAuth config for work/school Microsoft accounts
func (OAuthConfig) IsPersonalAccountConfig ¶
func (c OAuthConfig) IsPersonalAccountConfig() bool
IsPersonalAccountConfig returns true if this config is set up for personal accounts
type OneNoteRawData ¶
type OneNoteRawData struct {
Notebooks []msgraphmodels.Notebookable
Sections map[string][]msgraphmodels.OnenoteSectionable
Pages map[string][]msgraphmodels.OnenotePageable
Content map[string][]byte
}
OneNoteRawData represents raw data fetched from OneNote API
type SectionJob ¶
type SectionJob struct {
NotebookID string
Section msgraphmodels.OnenoteSectionable
SectionIndex int
TotalSections int
}
SectionJob represents a section processing job
type SectionResult ¶
type SectionResult struct {
SectionID string
Pages []msgraphmodels.OnenotePageable
Error error
}
SectionResult represents the result of section processing
type TokenResponse ¶
type TokenResponse struct {
TokenType string `json:"token_type"`
Scope string `json:"scope"`
ExpiresIn int `json:"expires_in"`
ExtExpiresIn int `json:"ext_expires_in"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
}
TokenResponse represents the response from the token endpoint