FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
SignNow.NET/SignNow.Net/SignNowContext.cs at develop · Yagg/SignNow.NET · GitHub
Yagg
/
SignNow.NET
Public
forked from
signnow/SignNow.NET
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
SignNow.NET
/
SignNow.Net
/
SignNowContext.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
110 lines (95 loc) · 4.39 KB
Breadcrumbs
SignNow.NET
/
SignNow.Net
/
SignNowContext.cs
Copy path
File metadata and controls
110 lines (95 loc) · 4.39 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
using
SignNow
.
Net
.
Internal
.
Constants
;
using
SignNow
.
Net
.
Interfaces
;
using
SignNow
.
Net
.
Model
;
using
SignNow
.
Net
.
Service
;
using
System
;
using
System
.
Net
.
Http
;
using
SignNow
.
Net
.
_Internal
.
Helpers
;
namespace
SignNow
.
Net
{
/// <summary>
/// Service container with all signNow services
/// </summary>
public
class
SignNowContext
:
WebClientBase
,
ISignNowContext
{
/// <inheritdoc cref="IOAuth2Service"/>
public
OAuth2Service
OAuth
{
get
;
protected
set
;
}
/// <inheritdoc cref="IUserService"/>
public
IUserService
Users
{
get
;
protected
set
;
}
/// <inheritdoc cref="ISignInvite"/>
public
ISignInvite
Invites
{
get
;
protected
set
;
}
/// <inheritdoc cref="IDocumentService"/>
public
IDocumentService
Documents
{
get
;
protected
set
;
}
/// <inheritdoc cref="IFolderService"/>
public
IFolderService
Folders
{
get
;
protected
set
;
}
/// <inheritdoc cref="IEventSubscriptionService"/>
public
IEventSubscriptionService
Events
{
get
;
protected
set
;
}
/// <inheritdoc cref="IDocumentGroupService"/>
public
IDocumentGroupService
DocumentGroups
{
get
;
protected
set
;
}
/// <inheritdoc cref="IDocumentGroupTemplatesService"/>
public
IDocumentGroupTemplatesService
DocumentGroupTemplates
{
get
;
protected
set
;
}
/// <summary>
/// Create all the services using single instance of <see cref="ISignNowClient"/> and other dependencies.
/// </summary>
/// <param name="token">User Access token</param>
public
SignNowContext
(
Token
token
)
:
this
(
ApiUrl
.
ApiBaseUrl
,
token
)
{
}
/// <inheritdoc cref="SignNowContext(Token)"/>
/// <summary>Create all the services with user provided Http Client</summary>
/// <param name="baseApiUrl">Base signNow api URL</param>
/// <param name="client">User provided Http Client</param>
public
SignNowContext
(
Uri
baseApiUrl
,
Token
token
,
HttpClient
client
)
:
this
(
baseApiUrl
,
token
,
new
SignNowClient
(
client
)
)
{
}
/// <inheritdoc cref="SignNowContext(Token)"/>
/// <param name="baseApiUrl">Base signNow api URL</param>
/// <param name="signNowClient">signNow HTTP Client</param>
public
SignNowContext
(
Uri
baseApiUrl
,
Token
token
,
ISignNowClient
signNowClient
=
null
)
:
base
(
baseApiUrl
,
token
,
signNowClient
)
{
OAuth
=
new
OAuth2Service
(
ApiBaseUrl
,
""
,
""
,
SignNowClient
)
;
Users
=
new
UserService
(
ApiBaseUrl
,
Token
,
SignNowClient
)
;
Invites
=
(
ISignInvite
)
Users
;
Documents
=
new
DocumentService
(
ApiBaseUrl
,
Token
,
SignNowClient
)
;
Folders
=
new
FolderService
(
ApiBaseUrl
,
Token
,
SignNowClient
)
;
Events
=
new
EventSubscriptionService
(
ApiBaseUrl
,
Token
,
SignNowClient
)
;
DocumentGroups
=
new
DocumentGroupService
(
ApiBaseUrl
,
Token
,
SignNowClient
)
;
DocumentGroupTemplates
=
new
DocumentGroupTemplatesService
(
ApiBaseUrl
,
Token
,
SignNowClient
)
;
}
/// <summary>
/// Setup application client ID/Secret for authorization.
/// </summary>
/// <param name="clientId">Application client ID</param>
/// <param name="clientSecret">Application client Secret</param>
public
void
SetAppCredentials
(
string
clientId
,
string
clientSecret
)
{
OAuth
.
ClientId
=
clientId
;
OAuth
.
ClientSecret
=
clientSecret
;
}
/// <summary>
/// Setup application client ID/Secret for authorization.
/// </summary>
/// <param name="basicToken">Application Basic authorization token</param>
public
void
SetBasicToken
(
string
basicToken
)
{
OAuth
.
BasicToken
=
basicToken
;
}
public
Token
GetAccessToken
(
string
login
,
string
password
,
Scope
scope
)
{
Token
=
ThreadUtils
.
RunSync
(
(
)
=>
OAuth
.
GetTokenAsync
(
login
,
password
,
scope
)
)
;
SyncTokens
(
)
;
return
Token
;
}
private
void
SyncTokens
(
)
{
(
(
UserService
)
Users
)
.
Token
=
Token
;
(
(
DocumentService
)
Documents
)
.
Token
=
Token
;
(
(
FolderService
)
Folders
)
.
Token
=
Token
;
(
(
EventSubscriptionService
)
Events
)
.
Token
=
Token
;
(
(
DocumentGroupService
)
DocumentGroups
)
.
Token
=
Token
;
(
(
DocumentGroupTemplatesService
)
DocumentGroupTemplates
)
.
Token
=
Token
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL