Giter Site home page Giter Site logo

startautomating / psa Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 3.66 MB

PowerShell Announcements (with AtProtocol)

License: MIT License

PowerShell 100.00%
announcement-generator announcements atproto atprotocol bluesky bluesky-client githubactions powershell powershell-module

psa's Introduction

PowerShell Announcements (with AtProtocol)

PSA is:

  • A PowerShell Module For Making Announcements
  • A Beautiful BlueSky Client for the CLI
  • An (Almost) Perfect PowerShell Wrapper for the At Protocol
  • A GitHub Action to Automate Announcements

Getting Started

To connect to AtProtocol / BlueSky with PSA, simply use Connect-BlueSky:

$myCredential = Get-Credential # Provide your handle or email and an app-password
Connect-BlueSky -Authentication $myCredential

Getting Profiles and Posts

Once you're connected, you can talk to every part of the At Protocol.

In the At Protocol, users are called "Actors", so, to get a profile, we'd use:

Get-BskyActorProfile -Actor mrpowershell.bsky.social

You'll see a nice snapshot of a profile:

PSA Profile View

While this might look nice, it's actually a full object.

You can explore what that object can do by piping it to the PowerShell command, Get-Member

Get-BskyActorProfile -Actor mrpowershell.bsky.social -Cache | Get-Member

For instance, this would show the profile's first 50 posts.

PSA Posts View

(Get-BskyActorProfile -Actor mrpowershell.bsky.social -Cache).Posts

And this would show the first 50 liked posts.

(Get-BskyActorProfile -Actor mrpowershell.bsky.social -Cache).Likes

This shows us the first 50 followers

(Get-BskyActorProfile -Actor mrpowershell.bsky.social -Cache).Followers

This shows us the first 50 follows

(Get-BskyActorProfile -Actor mrpowershell.bsky.social -Cache).Follows

To get more of any of these results, simply get the .More property

# Get the profile
$BlueSkyProfile = (Get-BskyActorProfile -Actor mrpowershell.bsky.social -Cache)
# Get the first 50 posts
$BlueSkyProfile.Posts
# Get the next 50 posts
$BlueSkyProfile.Posts.More

How PSA is Built

PSA is primarily built automatically.

It uses PipeScript to generate PowerShell commands automatically for every lexicon in the At Protocol.

EZOut is used to add formatting, so that posts and profiles look nice and can be clicked.

SendPSA - The GitHub Action

PSA can be used as a GitHub Action! Just add these few lines to any job:

- name: Run PSA
  uses: StartAutomating/PSA@main
  id: PSA

This will import PSA and look thru the workspace for any *.PSA.ps1 files and run them.

Check out PSA's PSA Script for a useful example.

PSA Commands

PSA exports 535 commands (118 functions and 417 aliases)

Functions

Name Synopsis
Add-AtProtoModerationReport com.atproto.moderation.createReport
Add-AtProtoRepoRecord com.atproto.repo.createRecord
Add-AtProtoServerAccount com.atproto.server.createAccount
Add-AtProtoServerAppPassword com.atproto.server.createAppPassword
Add-AtProtoServerInviteCode com.atproto.server.createInviteCode
Add-AtProtoServerInviteCodes com.atproto.server.createInviteCodes
Add-AtProtoServerSession com.atproto.server.createSession
Block-BskyGraphActor app.bsky.graph.muteActor
Block-BskyGraphActorList app.bsky.graph.muteActorList
Connect-AtProto Connects to the AtProtocol
Disable-AtProtoAdminAccountInvites com.atproto.admin.disableAccountInvites
Disable-AtProtoAdminInviteCodes com.atproto.admin.disableInviteCodes
Enable-AtProtoAdminAccountInvites com.atproto.admin.enableAccountInvites
Get-AtProtoAdminDefinition
Get-AtProtoAdminInviteCodes com.atproto.admin.getInviteCodes
Get-AtProtoAdminModerationAction com.atproto.admin.getModerationAction
Get-AtProtoAdminModerationActions com.atproto.admin.getModerationActions
Get-AtProtoAdminModerationReport com.atproto.admin.getModerationReport
Get-AtProtoAdminModerationReports com.atproto.admin.getModerationReports
Get-AtProtoAdminRecord com.atproto.admin.getRecord
Get-AtProtoAdminRepo com.atproto.admin.getRepo
Get-AtProtoLabelDefinition
Get-AtProtoModerationDefinition
Get-AtProtoRepo com.atproto.repo.describeRepo
Get-AtProtoRepoRecord com.atproto.repo.getRecord
Get-AtProtoRepoRecords com.atproto.repo.listRecords
Get-AtProtoServer com.atproto.server.describeServer
Get-AtProtoServerAccountInviteCodes com.atproto.server.getAccountInviteCodes
Get-AtProtoServerAppPasswords com.atproto.server.listAppPasswords
Get-AtProtoServerDefinition
Get-AtProtoServerSession com.atproto.server.getSession
Get-AtProtoSyncBlob com.atproto.sync.getBlob
Get-AtProtoSyncBlobs com.atproto.sync.listBlobs
Get-AtProtoSyncBlocks com.atproto.sync.getBlocks
Get-AtProtoSyncCheckout com.atproto.sync.getCheckout
Get-AtProtoSyncHead com.atproto.sync.getHead
Get-AtProtoSyncLatestCommit com.atproto.sync.getLatestCommit
Get-AtProtoSyncRecord com.atproto.sync.getRecord
Get-AtProtoSyncRepo com.atproto.sync.getRepo
Get-AtProtoSyncRepos com.atproto.sync.listRepos
Get-BskyActorDefinition
Get-BskyActorPreferences app.bsky.actor.getPreferences
Get-BskyActorProfile app.bsky.actor.getProfile
Get-BskyActorProfiles app.bsky.actor.getProfiles
Get-BskyActorSuggestions app.bsky.actor.getSuggestions
Get-BskyFeed app.bsky.feed.getFeed
Get-BskyFeedActorFeeds app.bsky.feed.getActorFeeds
Get-BskyFeedActorLikes app.bsky.feed.getActorLikes
Get-BskyFeedAuthorFeed app.bsky.feed.getAuthorFeed
Get-BskyFeedDefinition
Get-BskyFeedGenerator app.bsky.feed.getFeedGenerator
Get-BskyFeedGenerators app.bsky.feed.getFeedGenerators
Get-BskyFeedLikes app.bsky.feed.getLikes
Get-BskyFeedListFeed app.bsky.feed.getListFeed
Get-BskyFeedPosts app.bsky.feed.getPosts
Get-BskyFeedPostThread app.bsky.feed.getPostThread
Get-BskyFeedRepostedBy app.bsky.feed.getRepostedBy
Get-BskyFeedSkeleton app.bsky.feed.getFeedSkeleton
Get-BskyFeedSuggestedFeeds app.bsky.feed.getSuggestedFeeds
Get-BskyFeedTimeline app.bsky.feed.getTimeline
Get-BskyGraphBlocks app.bsky.graph.getBlocks
Get-BskyGraphDefinition
Get-BskyGraphFollowers app.bsky.graph.getFollowers
Get-BskyGraphFollows app.bsky.graph.getFollows
Get-BskyGraphList app.bsky.graph.getList
Get-BskyGraphListBlocks app.bsky.graph.getListBlocks
Get-BskyGraphListMutes app.bsky.graph.getListMutes
Get-BskyGraphLists app.bsky.graph.getLists
Get-BskyGraphMutes app.bsky.graph.getMutes
Get-BskyGraphSuggestedFollowsByActor app.bsky.graph.getSuggestedFollowsByActor
Get-BskyNotifications app.bsky.notification.listNotifications
Get-BskyNotificationUnreadCount app.bsky.notification.getUnreadCount
Get-BskyUnspeccedDefinition
Get-BskyUnspeccedPopular app.bsky.unspecced.getPopular
Get-BskyUnspeccedPopularFeedGenerators app.bsky.unspecced.getPopularFeedGenerators
Get-BskyUnspeccedTimelineSkeleton app.bsky.unspecced.getTimelineSkeleton
Invoke-AtProto Invokes the AT Protocol
Invoke-AtProtoAdminModerationAction com.atproto.admin.takeModerationAction
Register-BskyNotificationPush app.bsky.notification.registerPush
Remove-AtProtoRepoRecord com.atproto.repo.deleteRecord
Remove-AtProtoServerAccount com.atproto.server.deleteAccount
Remove-AtProtoServerSession com.atproto.server.deleteSession
Request-AtProtoServerAccountDelete com.atproto.server.requestAccountDelete
Request-AtProtoServerEmailConfirmation com.atproto.server.requestEmailConfirmation
Request-AtProtoServerEmailUpdate com.atproto.server.requestEmailUpdate
Request-AtProtoServerPasswordReset com.atproto.server.requestPasswordReset
Request-AtProtoSyncCrawl com.atproto.sync.requestCrawl
Reset-AtProtoServerPassword com.atproto.server.resetPassword
Resolve-AtProtoAdminModerationReports com.atproto.admin.resolveModerationReports
Resolve-AtProtoIdentityHandle com.atproto.identity.resolveHandle
Revoke-AtProtoServerAppPassword com.atproto.server.revokeAppPassword
Search-AtProtoAdminRepos com.atproto.admin.searchRepos
Search-AtProtoLabels com.atproto.label.queryLabels
Search-BskyActors app.bsky.actor.searchActors
Search-BskyActorsTypeahead app.bsky.actor.searchActorsTypeahead
Search-BskyFeedPosts app.bsky.feed.searchPosts
Search-BskyUnspeccedActorsSkeleton app.bsky.unspecced.searchActorsSkeleton
Search-BskyUnspeccedPostsSkeleton app.bsky.unspecced.searchPostsSkeleton
Send-AtProto Sends to the At Protocol
Send-AtProtoAdminEmail com.atproto.admin.sendEmail
Set-AtProtoRepoBlob com.atproto.repo.uploadBlob
Set-AtProtoRepoRecord com.atproto.repo.putRecord
Set-AtProtoRepoWrites com.atproto.repo.applyWrites
Set-BskyActorPreferences app.bsky.actor.putPreferences
Set-BskyUnspeccedLabels app.bsky.unspecced.applyLabels
Sync-AtProtoServerSession com.atproto.server.refreshSession
Unblock-BskyGraphActor app.bsky.graph.unmuteActor
Unblock-BskyGraphActorList app.bsky.graph.unmuteActorList
Undo-AtProtoAdminModerationAction com.atproto.admin.reverseModerationAction
Update-AtProtoAdminAccountEmail com.atproto.admin.updateAccountEmail
Update-AtProtoAdminAccountHandle com.atproto.admin.updateAccountHandle
Update-AtProtoIdentityHandle com.atproto.identity.updateHandle
Update-AtProtoServerEmail com.atproto.server.updateEmail
Update-AtProtoTempRepoVersion com.atproto.temp.upgradeRepoVersion
Update-BskyNotificationSeen app.bsky.notification.updateSeen
Watch-AtProtoLabels com.atproto.label.subscribeLabels
Watch-AtProtoSyncRepos com.atproto.sync.subscribeRepos
Watch-AtProtoSyncUpdate com.atproto.sync.notifyOfUpdate

Aliases

Name ResolvedCommand
Add-AtProtoModerationReport
Add-AtProtoRepoRecord
Add-AtProtoServerAccount
Add-AtProtoServerAppPassword
Add-AtProtoServerInviteCode
Add-AtProtoServerInviteCodes
Add-AtProtoServerSession
Block-BskyGraphActor
Block-BskyGraphActorList
Connect-AtProto
Disable-AtProtoAdminAccountInvites
Disable-AtProtoAdminInviteCodes
Enable-AtProtoAdminAccountInvites
Get-AtProtoAdminDefinition
Get-AtProtoAdminInviteCodes
Get-AtProtoAdminModerationAction
Get-AtProtoAdminModerationActions
Get-AtProtoAdminModerationReport
Get-AtProtoAdminModerationReports
Get-AtProtoAdminRecord
Get-AtProtoAdminRepo
Get-AtProtoLabelDefinition
Get-AtProtoModerationDefinition
Get-AtProtoRepo
Get-AtProtoRepoRecord
Get-AtProtoRepoRecords
Get-AtProtoServer
Get-AtProtoServerAccountInviteCodes
Get-AtProtoServerAppPasswords
Get-AtProtoServerDefinition
Get-AtProtoServerSession
Get-AtProtoSyncBlob
Get-AtProtoSyncBlobs
Get-AtProtoSyncBlocks
Get-AtProtoSyncCheckout
Get-AtProtoSyncHead
Get-AtProtoSyncLatestCommit
Get-AtProtoSyncRecord
Get-AtProtoSyncRepo
Get-AtProtoSyncRepos
Get-BskyActorDefinition
Get-BskyActorPreferences
Get-BskyActorProfile
Get-BskyActorProfiles
Get-BskyActorSuggestions
Get-BskyFeed
Get-BskyFeedActorFeeds
Get-BskyFeedActorLikes
Get-BskyFeedAuthorFeed
Get-BskyFeedDefinition
Get-BskyFeedGenerator
Get-BskyFeedGenerators
Get-BskyFeedLikes
Get-BskyFeedListFeed
Get-BskyFeedPosts
Get-BskyFeedPostThread
Get-BskyFeedRepostedBy
Get-BskyFeedSkeleton
Get-BskyFeedSuggestedFeeds
Get-BskyFeedTimeline
Get-BskyGraphBlocks
Get-BskyGraphDefinition
Get-BskyGraphFollowers
Get-BskyGraphFollows
Get-BskyGraphList
Get-BskyGraphListBlocks
Get-BskyGraphListMutes
Get-BskyGraphLists
Get-BskyGraphMutes
Get-BskyGraphSuggestedFollowsByActor
Get-BskyNotifications
Get-BskyNotificationUnreadCount
Get-BskyUnspeccedDefinition
Get-BskyUnspeccedPopular
Get-BskyUnspeccedPopularFeedGenerators
Get-BskyUnspeccedTimelineSkeleton
Invoke-AtProto
Invoke-AtProtoAdminModerationAction
Register-BskyNotificationPush
Remove-AtProtoRepoRecord
Remove-AtProtoServerAccount
Remove-AtProtoServerSession
Request-AtProtoServerAccountDelete
Request-AtProtoServerEmailConfirmation
Request-AtProtoServerEmailUpdate
Request-AtProtoServerPasswordReset
Request-AtProtoSyncCrawl
Reset-AtProtoServerPassword
Resolve-AtProtoAdminModerationReports
Resolve-AtProtoIdentityHandle
Revoke-AtProtoServerAppPassword
Search-AtProtoAdminRepos
Search-AtProtoLabels
Search-BskyActors
Search-BskyActorsTypeahead
Search-BskyFeedPosts
Search-BskyUnspeccedActorsSkeleton
Search-BskyUnspeccedPostsSkeleton
Send-AtProto
Send-AtProtoAdminEmail
Set-AtProtoRepoBlob
Set-AtProtoRepoRecord
Set-AtProtoRepoWrites
Set-BskyActorPreferences
Set-BskyUnspeccedLabels
Sync-AtProtoServerSession
Unblock-BskyGraphActor
Unblock-BskyGraphActorList
Undo-AtProtoAdminModerationAction
Update-AtProtoAdminAccountEmail
Update-AtProtoAdminAccountHandle
Update-AtProtoIdentityHandle
Update-AtProtoServerEmail
Update-AtProtoTempRepoVersion
Update-BskyNotificationSeen
Watch-AtProtoLabels
Watch-AtProtoSyncRepos
Watch-AtProtoSyncUpdate

psa's People

Contributors

startautomating avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

psa's Issues

Invoke-AtProtocol

We will want to accumulate piped input and run in the end block.

We will also want to special-case a body parameter with a binding of ".". This should be sent as a request body.

At Protocol data definition files should become self-descriptive commands

Each .defs file within the at protocol contains information multiple endpoints are likely to reference.

To make a more perfect wrapper of At Protocol, we want to make .defs files into commands that describe the definitions contained within.

For useful bonus points, we want a type reference to "just work"

At Protocol Commands should deeply decorate results

Any at protocol command that returns a strongly defined property should propagate that decoration into the output objects.

This should happen recursively.

This way, any known objects in any return from anything in at can be formatted and extended.

Format BlueSky Profiles

Display in color, use the .MarkdownDescription (#32 ) where possible, and link to profile/followers/follows.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.