Starting to add wiki JSON query capabilites.
This commit is contained in:
parent
5c86e98aae
commit
48968316c6
@ -7,8 +7,8 @@ Class {
|
|||||||
#name : #FossilRepo,
|
#name : #FossilRepo,
|
||||||
#superclass : #Object,
|
#superclass : #Object,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'url',
|
'local',
|
||||||
'local'
|
'remote'
|
||||||
],
|
],
|
||||||
#category : #Fossil
|
#category : #Fossil
|
||||||
}
|
}
|
||||||
@ -24,24 +24,17 @@ FossilRepo >> checkinsFor: relativeFilePath [
|
|||||||
^ (((self jsonDataFor: relativeFilePath) at: 'payload') at: 'checkins')
|
^ (((self jsonDataFor: relativeFilePath) at: 'payload') at: 'checkins')
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #querying }
|
{ #category : #wiki }
|
||||||
FossilRepo >> jsonDataFor: aFileName [
|
FossilRepo >> jsonDataFor: anUrlSegment [
|
||||||
| answer |
|
^ ZnClient new
|
||||||
answer := NeoJSONReader fromString: (self jsonStringFor: aFileName).
|
get: (self wikiRoot addPathSegment: anUrlSegment);
|
||||||
(answer keys includes: 'resultText') ifTrue: [
|
contents.
|
||||||
(answer at: 'resultText') = 'File entry not found.'
|
|
||||||
ifTrue: [
|
|
||||||
self inform: 'WARNING! ', (answer at: 'resultText'),
|
|
||||||
' Verify the file path you are entering'.
|
|
||||||
^ self]
|
|
||||||
].
|
|
||||||
^ answer
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #querying }
|
{ #category : #querying }
|
||||||
FossilRepo >> jsonStringFor: aFileName [
|
FossilRepo >> jsonStringFor: aFileName [
|
||||||
| queryForJSONData |
|
| queryForJSONData |
|
||||||
queryForJSONData := self url addPathSegments: #('json' 'finfo').
|
queryForJSONData := self remote addPathSegments: #('json' 'finfo').
|
||||||
queryForJSONData queryAt: 'name' put: aFileName.
|
queryForJSONData queryAt: 'name' put: aFileName.
|
||||||
^ (ZnEasy get: queryForJSONData) contents.
|
^ (ZnEasy get: queryForJSONData) contents.
|
||||||
]
|
]
|
||||||
@ -63,12 +56,27 @@ FossilRepo >> local: aLocalFilePath [
|
|||||||
local := aLocalFilePath
|
local := aLocalFilePath
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #wiki }
|
||||||
FossilRepo >> url [
|
FossilRepo >> pageList [
|
||||||
^ url
|
^ NeoJSONReader fromString: (self jsonDataFor: 'list')
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FossilRepo >> url: aString [
|
FossilRepo >> remote [
|
||||||
url := aString asUrl
|
^ remote
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
FossilRepo >> remote: anUrlString [
|
||||||
|
remote := anUrlString asUrl
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #wiki }
|
||||||
|
FossilRepo >> wikiRoot [
|
||||||
|
^ self jsonRoot addPathSegment: 'wiki'
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #wiki }
|
||||||
|
FossilRepo >> wikiTimeline [
|
||||||
|
^ NeoJSONReader fromString: (self jsonDataFor: 'timeline')
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user