Skip to content

Commit 6e21607

Browse files
committed
v3.0.0
1 parent 8176134 commit 6e21607

11 files changed

+55
-22
lines changed

Excel-REST - Blank.xlsm

5.29 KB
Binary file not shown.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ For more details, check out the [Wiki](https://github.com/timhall/Excel-REST/wik
101101

102102
### Release Notes
103103

104+
#### 3.0.0
105+
106+
- Add `Client.GetJSON` and `Client.PostJSON` helpers to GET and POST JSON without setting up request
107+
- Add `AfterExecute` to `IAuthenticator`
108+
104109
#### 2.3.0
105110

106111
- Add `form-urlencoded` format and helpers

authenticators/FacebookAuthenticator.cls

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = True
1010
Implements IAuthenticator
1111
''
12-
' Facebook Authenticator v1.0.0
12+
' Facebook Authenticator v2.0.0
1313
' (c) Tim Hall - https://github.com/timhall/Excel-REST
1414
'
1515
' Custom IAuthenticator for Facebook OAuth
@@ -100,25 +100,15 @@ End Property
100100
' Public Methods
101101
' ============================================= '
102102

103+
''
104+
' Setup authenticator
105+
' --------------------------------------------- '
106+
103107
Public Sub Setup(ApplicationId As String, ApplicationSecret As String)
104108
Me.ApplicationId = ApplicationId
105109
Me.ApplicationSecret = ApplicationSecret
106110
End Sub
107111

108-
Private Sub IAuthenticator_BeforeExecute(Request As RestRequest)
109-
Request.AddQuerystringParam "access_token", Me.Token
110-
End Sub
111-
112-
Private Sub IAuthenticator_HttpOpen( _
113-
http As MSXML2.IXMLHTTPRequest, _
114-
Request As RestRequest, _
115-
BaseUrl As String, _
116-
Optional useAsync As Boolean = False)
117-
118-
' Perform standard http open
119-
Call http.Open(Request.MethodName(), Request.FullUrl(BaseUrl), useAsync)
120-
End Sub
121-
122112
Public Sub Login()
123113
On Error GoTo CleanUp
124114

@@ -179,6 +169,44 @@ End Sub
179169
' Private Methods
180170
' ============================================= '
181171

172+
''
173+
' Hook for taking action before a request is executed
174+
'
175+
' @param {RestClient} Client The client that is about to execute the request
176+
' @param {RestRequest} Request The request about to be executed
177+
' --------------------------------------------- '
178+
179+
Private Sub IAuthenticator_BeforeExecute(ByVal Client As RestClient, ByRef Request As RestRequest)
180+
Request.AddQuerystringParam "access_token", Me.Token
181+
End Sub
182+
183+
''
184+
' Hook for taking action after request has been executed
185+
'
186+
' @param {RestClient} Client The client that executed request
187+
' @param {RestRequest} Request The request that was just executed
188+
' @param {RestResponse} Response to request
189+
' --------------------------------------------- '
190+
191+
Private Sub IAuthenticator_AfterExecute(ByVal Client As RestClient, ByVal Request As RestRequest, ByRef Response As RestResponse)
192+
193+
End Sub
194+
195+
''
196+
' Hook for overriding standard http open (used for HTTP Basic)
197+
'
198+
' @param {MSXML2.IXMLHTTPRequest} http
199+
' @parma {RestClient} Client The client that is about to open request
200+
' @param {RestRequest} Request The request about to be opened
201+
' @param {String} BaseUrl
202+
' @param {Boolean} [useAsync=False]
203+
' --------------------------------------------- '
204+
205+
Private Sub IAuthenticator_HttpOpen(ByRef Http As Object, ByVal Client As RestClient, ByRef Request As RestRequest, BaseUrl As String, Optional UseAsync As Boolean = False)
206+
' Perform standard http open
207+
Call Http.Open(Request.MethodName(), Request.FullUrl(BaseUrl), UseAsync)
208+
End Sub
209+
182210
Private Function TokenRequest() As RestRequest
183211
Set TokenRequest = New RestRequest
184212
TokenRequest.Resource = "oauth/access_token"

examples/Excel-REST - Example.xlsm

462 Bytes
Binary file not shown.

specs/Excel-REST - Specs.xlsm

334 Bytes
Binary file not shown.

src/IAuthenticator.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Attribute VB_Creatable = False
88
Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = True
1010
''
11-
' IAuthenticator v2.3.0
11+
' IAuthenticator v3.0.0
1212
' (c) Tim Hall - https://github.com/timhall/Excel-REST
1313
'
1414
' Interface for creating authenticators for rest client

src/RestClient.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Attribute VB_Creatable = False
88
Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = True
1010
''
11-
' RestClient v2.3.0
11+
' RestClient v3.0.0
1212
' (c) Tim Hall - https://github.com/timhall/Excel-REST
1313
'
1414
' Interact with REST web services from Excel

src/RestClientBase.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Attribute VB_Name = "RestClientBase"
22
''
3-
' RestClientBase v2.3.0
3+
' RestClientBase v3.0.0
44
' (c) Tim Hall - https://github.com/timhall/Excel-REST
55
'
66
' Extendable RestClientBase for developing custom client classes

src/RestHelpers.bas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Attribute VB_Name = "RestHelpers"
22
''
3-
' RestHelpers v2.3.0
3+
' RestHelpers v3.0.0
44
' (c) Tim Hall - https://github.com/timhall/Excel-REST
55
'
66
' Common helpers RestClient
@@ -38,7 +38,7 @@ Attribute VB_Name = "RestHelpers"
3838

3939
#End If
4040

41-
Private Const UserAgent As String = "Excel Client v2.3.0 (https://github.com/timhall/Excel-REST)"
41+
Private Const UserAgent As String = "Excel Client v3.0.0 (https://github.com/timhall/Excel-REST)"
4242

4343
' Moved to top from JSONLib
4444
Private Const INVALID_JSON As Long = 1

src/RestRequest.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Attribute VB_Creatable = False
88
Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = True
1010
''
11-
' RestRequest v2.3.0
11+
' RestRequest v3.0.0
1212
' (c) Tim Hall - https://github.com/timhall/Excel-REST
1313
'
1414
' Create a request for use with a rest client

0 commit comments

Comments
 (0)