Comments (6)
Personally, I would vote fail (which validate count will do). That'd give me output saying "hey fool, you can only give me 100 of these" then I know I have to batch them in the code on my end.
from bluebirdps.
On a few of the functions, I was using the private function New-ValidationErrorRecord
to generate a cleaner error record when the provided parameters were not valid. I believe this private function was created after Get-TwitterFollowers
.
Parameter validation is definitely something that needs to be addressed.
Here is where some confusion creeps in:
Get-TwitterFollowers
connects to the following two endpoints. The maximum and default ResultsPerPage
for each endpoint is different.
Endpoint | ResultsPerPage Max | ResultsPerPage Default |
---|---|---|
followers/list.json | 200 | 50 |
followers/ids.json | 5000 | 5000 |
I'll need to see how to implement the two defaults and maximum values within a ValidateScript
. Since the endpoint is determined by the ParameterSetName, I'm not sure if I can use that in a ValidateScript
.
I've asked Twitter. Hopefully, someone can provide some insight.
Thanks
from bluebirdps.
Additionally, there are some parameters that can accept an array, but the array cannot exceed a certain count.
During the ValidateScript
, the count of the array is not available.
Instead of returning with a warning, which is the current behavior, we could simply warn that anything over the maximum count will be truncated. This would need to be handled within the body of the function.
Get-TwitterFriendship -ScreenName $Names
WARNING: More than 100 ScreenNames provided. Processing the first 100 only.
from bluebirdps.
For those array ones, remember that you can include multiple validation options:
param (
[ValidateCount(1,3)] # Needs at least object, but can include up to three
[ValidateNotNullOrEmpty()]
[ValidateScript({Test-Item $_})]
[string[]] $Name
)
As a user I'd prefer to be told upfront if I've included an array that's too long, and I should go and fix my code to break it up (as having the cmdlet truncate the array for me could be iffy when I try to figure out "ok... which ones do I need to re do?")
from bluebirdps.
Wowzers! [ValidateCount()]
satisfies UserId
and ScreenName
quite nicely!
So, the question would be: terminating failure over 100 OR warning over 100?
What do you think @Windos ?
from bluebirdps.
I would also vote for fail (by using validate count) as it makes it more clear that something is wrong as opposed to not getting all the data and potentially not seeing the yellow warning
from bluebirdps.
Related Issues (20)
- Add Commands for New Bookmark V2 Endpoints HOT 2
- Update documentation HOT 2
- Add Functionality to Parse User and Pinned Tweets to Find Mastodon Account References
- BaseEntity GetEntities() Does Not Instantiate Annotations, CashTags, HashTags, and Mentions Correctly
- Remove ListId Alias from List Commands
- Publish-Tweet - Fails to render API response
- Add capability for users to opt-in to waiting until rate limit reset time
- Add $BluebirdPSLastResponse session variable
- [BUG] Find-TwitterMastodonLinks - Matching criteria incorrectly matches on some Mastodon instance hostnames HOT 2
- Add capability to set BluebirdPS Configuration RateLimitAction value via environment variables
- [DISCUSSION] HOT 4
- Find-TwitterMastodonLinks IgnoreDomain parameter is not working
- Change $BluebirdPSVersion to use assembly version HOT 1
- Add enhancements to Find-TwitterMastodonLinks HOT 1
- Cannot Publish-Tweet HOT 1
- Add Support for Reverse Chronological Timeline endpoint HOT 1
- Set-TwitterBearerToken: Authentication failed because the remote party sent a TLS alert: 'HandshakeFailure'. HOT 10
- Publish-Tweet: Getting Error Message when publishing Tweet HOT 6
- Special characters in Tweet HOT 1
- Japanese characters were garbled when using Publish-Tweet.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bluebirdps.