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