Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication for ghEntity #14

Open
mariari opened this issue Jan 6, 2024 · 0 comments
Open

Authentication for ghEntity #14

mariari opened this issue Jan 6, 2024 · 0 comments

Comments

@mariari
Copy link
Contributor

mariari commented Jan 6, 2024

Currently how GhEntity and it's children classes work, is that you give it a raw dictionary, and from there GhEntity creates a ZnClient

This has issues when rate limiting is had, or when private data is wanted

GhEntity >> createFrom: aKey with: aBlock onError: anErrorBlock [
	^ rawData 
		at: aKey
		ifPresent: [ :url | 
			| trimmedUrl |
			trimmedUrl := url
				copyWithRegex: '{.*}'
				matchesTranslatedUsing: [ :each | ''].
			ZnClient new 
				get: trimmedUrl
				onSuccess: [ :result | 
					[
						aBlock value: (STON fromString: result)
					] on: Error do: [ :e | anErrorBlock value ] ]
				onError: [ anErrorBlock value ] ]
		ifAbsent: [ {} ]
]

This can easily be changed such that ghEntity has a new slot for an authentication key if desired.

I may work on this myself, and submit a patch as it seems quite trivial to do, however I may not have the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant