├── all └── .gitignore ├── core ├── .gitignore └── src │ ├── jvmTest │ ├── resources │ │ ├── image │ │ │ ├── 200x100.png │ │ │ └── 200x200.png │ │ └── video │ │ │ ├── heavy.mp4 │ │ │ └── light.mp4 │ └── kotlin │ │ └── work │ │ └── socialhub │ │ └── kbsky │ │ ├── JwtStore.kt │ │ └── app │ │ └── bsky │ │ ├── notification │ │ ├── UpdateSeenTest.kt │ │ └── GetUnreadCountTest.kt │ │ ├── graph │ │ ├── UnmuteTest.kt │ │ ├── GetBlocksTest.kt │ │ ├── GetMutesTest.kt │ │ └── GetFollowsTest.kt │ │ ├── unspecced │ │ └── GetPopularTest.kt │ │ ├── actor │ │ ├── GetProfileTest.kt │ │ └── SearchActorsTest.kt │ │ └── feed │ │ └── SearchPostsTest.kt │ ├── commonMain │ └── kotlin │ │ └── work │ │ └── socialhub │ │ └── kbsky │ │ ├── util │ │ ├── facet │ │ │ ├── FacetType.kt │ │ │ ├── FacetRecord.kt │ │ │ └── FacetRegex.kt │ │ ├── MediaType.kt │ │ ├── ATUri.kt │ │ └── json │ │ │ └── JsonElementUtil.kt │ │ ├── api │ │ ├── entity │ │ │ ├── share │ │ │ │ ├── Response.kt │ │ │ │ ├── AuthRequest.kt │ │ │ │ ├── RecordRequest.kt │ │ │ │ ├── RKeyRequest.kt │ │ │ │ ├── ErrorResponse.kt │ │ │ │ └── MapRequest.kt │ │ │ ├── app │ │ │ │ └── bsky │ │ │ │ │ ├── video │ │ │ │ │ ├── VideoUploadVideoResponse.kt │ │ │ │ │ ├── VideoGetUploadLimitsRequest.kt │ │ │ │ │ ├── VideoGetJobStatusResponse.kt │ │ │ │ │ ├── VideoGetUploadLimitsResponse.kt │ │ │ │ │ ├── VideoUploadVideoRequest.kt │ │ │ │ │ └── VideoGetJobStatusRequest.kt │ │ │ │ │ ├── graph │ │ │ │ │ ├── GraphBlockResponse.kt │ │ │ │ │ ├── GraphCreateListResponse.kt │ │ │ │ │ ├── GraphAddUserToListResponse.kt │ │ │ │ │ ├── GraphDeleteListRequest.kt │ │ │ │ │ ├── GraphGetStarterPackResponse.kt │ │ │ │ │ ├── GraphEditListResponse.kt │ │ │ │ │ ├── GraphFollowResponse.kt │ │ │ │ │ ├── GraphGetStarterPacksResponse.kt │ │ │ │ │ ├── GraphGetListsResponse.kt │ │ │ │ │ ├── GraphGetMutesResponse.kt │ │ │ │ │ ├── GraphGetBlocksResponse.kt │ │ │ │ │ ├── GraphGetFollowsResponse.kt │ │ │ │ │ ├── GraphGetFollowersResponse.kt │ │ │ │ │ ├── GraphGetKnownFollowersResponse.kt │ │ │ │ │ ├── GraphDeleteBlockRequest.kt │ │ │ │ │ ├── GraphDeleteFollowRequest.kt │ │ │ │ │ ├── GraphRemoveUserFromListRequest.kt │ │ │ │ │ ├── GraphGetListResponse.kt │ │ │ │ │ ├── GraphMuteActorRequest.kt │ │ │ │ │ ├── GraphUnmuteActorRequest.kt │ │ │ │ │ ├── GraphGetStarterPacksRequest.kt │ │ │ │ │ ├── GraphGetStarterPackRequest.kt │ │ │ │ │ ├── GraphGetBlocksRequest.kt │ │ │ │ │ ├── GraphGetMutesRequest.kt │ │ │ │ │ ├── GraphEditListRequest.kt │ │ │ │ │ ├── GraphGetListRequest.kt │ │ │ │ │ ├── GraphGetListsRequest.kt │ │ │ │ │ ├── GraphGetFollowsRequest.kt │ │ │ │ │ ├── GraphGetFollowersRequest.kt │ │ │ │ │ └── GraphGetKnownFollowersRequest.kt │ │ │ │ │ ├── notification │ │ │ │ │ ├── NotificationGetUnreadCountResponse.kt │ │ │ │ │ ├── NotificationGetUnreadCountRequest.kt │ │ │ │ │ ├── NotificationListNotificationsResponse.kt │ │ │ │ │ └── NotificationListNotificationsRequest.kt │ │ │ │ │ ├── feed │ │ │ │ │ ├── FeedLikeResponse.kt │ │ │ │ │ ├── FeedPostResponse.kt │ │ │ │ │ ├── FeedPostgateResponse.kt │ │ │ │ │ ├── FeedRepostResponse.kt │ │ │ │ │ ├── FeedThreadgateResponse.kt │ │ │ │ │ ├── FeedGetPostsResponse.kt │ │ │ │ │ ├── FeedGetTimelineResponse.kt │ │ │ │ │ ├── FeedGetFeedGeneratorsResponse.kt │ │ │ │ │ ├── FeedGetBookmarksResponse.kt │ │ │ │ │ ├── FeedGetFeedResponse.kt │ │ │ │ │ ├── FeedGetListFeedResponse.kt │ │ │ │ │ ├── FeedGetActorLikesResponse.kt │ │ │ │ │ ├── FeedGetAuthorFeedResponse.kt │ │ │ │ │ ├── FeedGetActorFeedsResponse.kt │ │ │ │ │ ├── FeedGetPostThreadResponse.kt │ │ │ │ │ ├── FeedGetFeedGeneratorResponse.kt │ │ │ │ │ ├── FeedGetLikesResponse.kt │ │ │ │ │ ├── FeedGetQuotesResponse.kt │ │ │ │ │ ├── FeedGetRepostedByResponse.kt │ │ │ │ │ ├── FeedSearchPostsResponse.kt │ │ │ │ │ ├── FeedDeleteLikeRequest.kt │ │ │ │ │ ├── FeedDeletePostRequest.kt │ │ │ │ │ ├── FeedDeleteRepostRequest.kt │ │ │ │ │ ├── FeedDeleteBookmarkRequest.kt │ │ │ │ │ ├── FeedGetPostsRequest.kt │ │ │ │ │ ├── FeedGetFeedGeneratorRequest.kt │ │ │ │ │ ├── FeedGetFeedGeneratorsRequest.kt │ │ │ │ │ ├── FeedCreateBookmarkRequest.kt │ │ │ │ │ ├── FeedGetPostThreadRequest.kt │ │ │ │ │ ├── FeedGetBookmarksRequest.kt │ │ │ │ │ ├── FeedGetActorLikesRequest.kt │ │ │ │ │ ├── FeedGetActorFeedsRequest.kt │ │ │ │ │ ├── FeedGetTimelineRequest.kt │ │ │ │ │ ├── FeedGetFeedRequest.kt │ │ │ │ │ └── FeedGetListFeedRequest.kt │ │ │ │ │ ├── actor │ │ │ │ │ ├── ActorGetProfileResponse.kt │ │ │ │ │ ├── ActorUpdateProfileResponse.kt │ │ │ │ │ ├── ActorGetPreferencesResponse.kt │ │ │ │ │ ├── ActorGetProfilesResponse.kt │ │ │ │ │ ├── ActorSearchActorsTypeaheadResponse.kt │ │ │ │ │ ├── ActorSearchActorsResponse.kt │ │ │ │ │ ├── ActorGetPreferencesRequest.kt │ │ │ │ │ ├── ActorGetProfileRequest.kt │ │ │ │ │ └── ActorGetProfilesRequest.kt │ │ │ │ │ ├── labeler │ │ │ │ │ ├── LabelerGetServicesResponse.kt │ │ │ │ │ └── LabelerGetServicesRequest.kt │ │ │ │ │ └── unspecced │ │ │ │ │ ├── UnspeccedGetPopularResponse.kt │ │ │ │ │ ├── UnspeccedSearchFeedsRequest.kt │ │ │ │ │ ├── UnspeccedSearchFeedsResponse.kt │ │ │ │ │ └── UnspeccedGetPopularRequest.kt │ │ │ ├── chat │ │ │ │ └── bsky │ │ │ │ │ └── convo │ │ │ │ │ ├── ConvoSendMessageResponse.kt │ │ │ │ │ ├── ConvoDeleteMessageForSelfResponse.kt │ │ │ │ │ ├── ConvoLeaveConvoResponse.kt │ │ │ │ │ ├── ConvoAddReactionResponse.kt │ │ │ │ │ ├── ConvoGetConvoResponse.kt │ │ │ │ │ ├── ConvoGetLogResponse.kt │ │ │ │ │ ├── ConvoMuteConvoResponse.kt │ │ │ │ │ ├── ConvoRemoveReactionResponse.kt │ │ │ │ │ ├── ConvoUpdateReadResponse.kt │ │ │ │ │ ├── ConvoUnmuteConvoResponse.kt │ │ │ │ │ ├── ConvoGetConvoForMembersResponse.kt │ │ │ │ │ ├── ConvoGetListConvosResponse.kt │ │ │ │ │ ├── ConvoGetMessagesResponse.kt │ │ │ │ │ ├── ConvoGetLogRequest.kt │ │ │ │ │ ├── ConvoGetConvoRequest.kt │ │ │ │ │ ├── ConvoMuteConvoRequest.kt │ │ │ │ │ ├── ConvoLeaveConvoRequest.kt │ │ │ │ │ ├── ConvoUnmuteConvoRequest.kt │ │ │ │ │ ├── ConvoGetListConvosRequest.kt │ │ │ │ │ ├── ConvoUpdateReadRequest.kt │ │ │ │ │ ├── ConvoDeleteMessageForSelfRequest.kt │ │ │ │ │ ├── ConvoGetConvoForMembersRequest.kt │ │ │ │ │ ├── ConvoAddReactionRequest.kt │ │ │ │ │ ├── ConvoGetMessagesRequest.kt │ │ │ │ │ ├── ConvoRemoveReactionRequest.kt │ │ │ │ │ └── ConvoSendMessageRequest.kt │ │ │ └── com │ │ │ │ └── atproto │ │ │ │ ├── server │ │ │ │ ├── ServerGetServiceAuthResponse.kt │ │ │ │ ├── ServerRefreshSessionResponse.kt │ │ │ │ ├── ServerCreateSessionRequest.kt │ │ │ │ ├── ServerGetSessionResponse.kt │ │ │ │ ├── ServerCreateSessionResponse.kt │ │ │ │ └── ServerGetServiceAuthRequest.kt │ │ │ │ ├── repo │ │ │ │ ├── RepoPutRecordResponse.kt │ │ │ │ ├── RepoCreateRecordResponse.kt │ │ │ │ ├── RepoUploadBlobResponse.kt │ │ │ │ ├── RepoGetRecordResponse.kt │ │ │ │ ├── RepoListRecordsResponse.kt │ │ │ │ ├── RepoUploadBlobRequest.kt │ │ │ │ ├── RepoDescribeRepoResponse.kt │ │ │ │ └── RepoDescribeRepoRequest.kt │ │ │ │ ├── moderation │ │ │ │ └── ModerationCreateReportResponse.kt │ │ │ │ └── identity │ │ │ │ ├── IdentityResolveHandleResponse.kt │ │ │ │ └── IdentityResolveHandleRequest.kt │ │ ├── app │ │ │ └── bsky │ │ │ │ ├── UnspeccedResource.kt │ │ │ │ └── LabelerResource.kt │ │ └── com │ │ │ └── atproto │ │ │ ├── ModerationResource.kt │ │ │ └── IdentityResource.kt │ │ ├── BlueskyConfig.kt │ │ ├── model │ │ ├── plc │ │ │ ├── DIDLogVerificationMethods.kt │ │ │ ├── DIDLogPDS.kt │ │ │ ├── DIDDetailsService.kt │ │ │ ├── DIDLogService.kt │ │ │ ├── DIDDetailsVerificationMethod.kt │ │ │ ├── DIDLog.kt │ │ │ └── DIDDetails.kt │ │ ├── app │ │ │ └── bsky │ │ │ │ ├── actor │ │ │ │ ├── ActorDefsLabelerPrefItem.kt │ │ │ │ ├── ActorDefsPreferences.kt │ │ │ │ ├── ActorDefsKnownFollowers.kt │ │ │ │ ├── ActorDefsSavedFeed.kt │ │ │ │ ├── ActorDefsProfileAssociated.kt │ │ │ │ ├── ActorDefsProfileAssociatedChat.kt │ │ │ │ ├── ActorDefsViewerState.kt │ │ │ │ ├── ActorDefsAdultContentPref.kt │ │ │ │ ├── ActorDefsSavedFeedsPrefV2.kt │ │ │ │ ├── ActorDefsLabelersPref.kt │ │ │ │ ├── ActorDefsPersonalDetailsPref.kt │ │ │ │ ├── ActorDefsProfileView.kt │ │ │ │ ├── ActorDefsContentLabelPref.kt │ │ │ │ ├── ActorDefsSavedFeedsPref.kt │ │ │ │ └── ActorDefsVerificationView.kt │ │ │ │ ├── labeler │ │ │ │ ├── LabelerViewerState.kt │ │ │ │ ├── LabelerPolicies.kt │ │ │ │ └── LabelerViewUnion.kt │ │ │ │ ├── graph │ │ │ │ ├── GraphStarterPackFeedItem.kt │ │ │ │ ├── GraphDefsListViewerState.kt │ │ │ │ ├── GraphFollow.kt │ │ │ │ ├── GraphBlock.kt │ │ │ │ ├── GraphListItem.kt │ │ │ │ ├── GraphDefsListItemView.kt │ │ │ │ └── GraphDefsListViewBasic.kt │ │ │ │ ├── embed │ │ │ │ ├── EmbedDefsAspectRatio.kt │ │ │ │ ├── EmbedExternalViewExternal.kt │ │ │ │ ├── EmbedImagesImage.kt │ │ │ │ ├── EmbedImagesViewImage.kt │ │ │ │ ├── EmbedExternalExternal.kt │ │ │ │ ├── EmbedImagesView.kt │ │ │ │ ├── EmbedExternalView.kt │ │ │ │ ├── EmbedRecordViewBlocked.kt │ │ │ │ ├── EmbedRecordViewNotFound.kt │ │ │ │ ├── EmbedRecord.kt │ │ │ │ ├── EmbedRecordViewDetached.kt │ │ │ │ ├── EmbedImages.kt │ │ │ │ ├── EmbedRecordWithMedia.kt │ │ │ │ ├── EmbedRecordView.kt │ │ │ │ ├── EmbedExternal.kt │ │ │ │ └── EmbedRecordWithMediaView.kt │ │ │ │ ├── undoc │ │ │ │ ├── UndocSearchFeedsUser.kt │ │ │ │ └── UndocSearchFeedsPost.kt │ │ │ │ ├── feed │ │ │ │ ├── FeedDefsGeneratorViewerState.kt │ │ │ │ ├── FeedDefsReplyRef.kt │ │ │ │ ├── FeedPostReplyRef.kt │ │ │ │ ├── FeedDefsFeedViewPost.kt │ │ │ │ ├── FeedDefsBookmarkView.kt │ │ │ │ ├── FeedGetLikesLike.kt │ │ │ │ ├── FeedDefsViewerState.kt │ │ │ │ ├── FeedDefsThreadgateView.kt │ │ │ │ ├── FeedDefsReasonPin.kt │ │ │ │ ├── FeedThreadgateFollowerRule.kt │ │ │ │ ├── FeedPostgateDisableRule.kt │ │ │ │ ├── FeedThreadgateMentionRule.kt │ │ │ │ ├── FeedThreadgateFollowingRule.kt │ │ │ │ ├── FeedThreadgateListRule.kt │ │ │ │ ├── FeedDefsNotFoundPost.kt │ │ │ │ ├── FeedPostgateEmbeddingRulesUnion.kt │ │ │ │ ├── FeedDefsReasonUnion.kt │ │ │ │ ├── FeedDefsThreadViewPost.kt │ │ │ │ ├── FeedDefsThreadUnion.kt │ │ │ │ ├── FeedThreadgate.kt │ │ │ │ ├── FeedDefsBookmarkItemUnion.kt │ │ │ │ ├── FeedLike.kt │ │ │ │ ├── FeedRepost.kt │ │ │ │ ├── FeedPostgate.kt │ │ │ │ └── FeedDefsReasonRepost.kt │ │ │ │ ├── richtext │ │ │ │ ├── RichtextFacetByteSlice.kt │ │ │ │ ├── RichtextFacet.kt │ │ │ │ ├── RichtextFacetTag.kt │ │ │ │ ├── RichtextFacetLink.kt │ │ │ │ ├── RichtextFacetMention.kt │ │ │ │ └── RichtextFacetFeatureUnion.kt │ │ │ │ └── video │ │ │ │ └── JobStatus.kt │ │ ├── share │ │ │ ├── Error.kt │ │ │ ├── BlobRef.kt │ │ │ └── Blob.kt │ │ ├── chat │ │ │ └── bsky │ │ │ │ └── convo │ │ │ │ ├── ConvoDefsMessageViewSender.kt │ │ │ │ ├── ConvoDefsReactionViewSender.kt │ │ │ │ ├── ConvoDefsReactionView.kt │ │ │ │ ├── ConvoDefsMessageInput.kt │ │ │ │ ├── ConvoDefsLogBeginConvo.kt │ │ │ │ ├── ConvoDefsLogLeaveConvo.kt │ │ │ │ ├── ConvoDefsMessageAndReactionView.kt │ │ │ │ ├── ConvoDefsLogDeleteMessage.kt │ │ │ │ ├── ConvoDefsLogReadMessage.kt │ │ │ │ ├── ConvoDefsLogCreateMessage.kt │ │ │ │ ├── ConvoDefsConvoView.kt │ │ │ │ ├── ConvoDefsDeletedMessageView.kt │ │ │ │ ├── ConvoDefsLogAddReaction.kt │ │ │ │ ├── ConvoDefsLogRemoveReaction.kt │ │ │ │ └── ConvoDefsMessageUnion.kt │ │ └── com │ │ │ └── atproto │ │ │ ├── label │ │ │ ├── LabelDefsLabelValueDefinitionStrings.kt │ │ │ ├── LabelDefsSelfLabel.kt │ │ │ ├── LabelDefsSelfLabels.kt │ │ │ └── LabelDefsLabelValueDefinition.kt │ │ │ ├── repo │ │ │ ├── RepoListRecordsRecord.kt │ │ │ ├── RepoRef.kt │ │ │ └── RepoStrongRef.kt │ │ │ ├── moderation │ │ │ ├── ModerationReport.kt │ │ │ └── ModerationSubjectUnion.kt │ │ │ └── server │ │ │ └── DidDocUnion.kt │ │ ├── ATProtocolFactory.kt │ │ ├── domain │ │ └── Service.kt │ │ ├── BlueskyException.kt │ │ ├── PLCDirectory.kt │ │ ├── PLCDirectoryFactory.kt │ │ ├── BlueskyFactory.kt │ │ ├── ATProtocol.kt │ │ ├── ATProtocolConfig.kt │ │ ├── ATProtocolException.kt │ │ ├── NetworkConfig.kt │ │ └── auth │ │ ├── UnauthenticatedAuthProvider.kt │ │ └── AuthProvider.kt │ ├── commonTest │ └── kotlin │ │ └── work │ │ └── socialhub │ │ └── kbsky │ │ ├── plc │ │ ├── GetLogTest.kt │ │ └── GetDetailsTest.kt │ │ └── com │ │ └── atproto │ │ └── identity │ │ └── ResolveHandleTest.kt │ ├── jvmMain │ └── kotlin │ │ └── work │ │ └── socialhub │ │ └── kbsky │ │ └── util │ │ └── facet │ │ └── FacetRegex.kt │ └── nativeMain │ └── kotlin │ └── work │ └── socialhub │ └── kbsky │ └── util │ └── facet │ └── FacetRegex.kt ├── stream ├── .gitignore └── src │ └── commonMain │ └── kotlin │ └── work │ └── socialhub │ └── kbsky │ └── stream │ ├── entity │ ├── callback │ │ ├── ClosedCallback.kt │ │ ├── OpenedCallback.kt │ │ └── ErrorCallback.kt │ ├── app │ │ └── bsky │ │ │ ├── callback │ │ │ └── JetStreamEventCallback.kt │ │ │ └── model │ │ │ ├── Account.kt │ │ │ ├── Identity.kt │ │ │ ├── Commit.kt │ │ │ └── Event.kt │ └── com │ │ └── atproto │ │ ├── model │ │ ├── StreamOp.kt │ │ └── StreamRoot.kt │ │ └── callback │ │ └── SyncEventCallback.kt │ ├── ATProtocolStream.kt │ ├── BlueskyStream.kt │ ├── ATProtocolStreamConfig.kt │ ├── api │ ├── app │ │ └── bsky │ │ │ └── JetStreamResource.kt │ ├── entity │ │ └── com │ │ │ └── atproto │ │ │ └── SyncSubscribeReposRequest.kt │ └── com │ │ └── atproto │ │ └── SyncResource.kt │ ├── BlueskyStreamConfig.kt │ ├── BlueskyStreamFactory.kt │ ├── ATProtocolStreamFactory.kt │ └── internal │ ├── app │ └── bsky │ │ └── _BlueskyStream.kt │ └── com │ └── atproto │ └── _ATProtocolStream.kt ├── secrets.json.default ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── plugins ├── build.gradle.kts ├── settings.gradle.kts └── src │ └── main │ └── kotlin │ └── root.publications.gradle.kts ├── .github └── dependabot.yml ├── auth └── src │ ├── jvmTest │ └── kotlin │ │ └── work │ │ └── socialhub │ │ └── kbsky │ │ └── auth │ │ ├── JwtStore.kt │ │ └── WellKnownTest.kt │ └── commonMain │ └── kotlin │ └── work │ └── socialhub │ └── kbsky │ └── auth │ ├── api │ └── entity │ │ ├── oauth │ │ ├── BuildAuthorizationUrlRequest.kt │ │ ├── OAuthPushedAuthorizationResponse.kt │ │ └── OAuthTokenResponse.kt │ │ └── wellknown │ │ └── WellKnownOAuthProtectedResourceResponse.kt │ ├── domain │ └── OAuthScopes.kt │ ├── Auth.kt │ ├── helper │ └── RandomHelper.kt │ ├── OAuthContext.kt │ ├── OAuthSession.kt │ ├── AuthFactory.kt │ └── internal │ └── _Auth.kt ├── Makefile ├── settings.gradle.kts └── gradle.properties /all/.gitignore: -------------------------------------------------------------------------------- 1 | swiftpackage/ 2 | kbsky.podspec -------------------------------------------------------------------------------- /core/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | build/ 3 | out/ 4 | -------------------------------------------------------------------------------- /stream/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | build/ 3 | out/ 4 | -------------------------------------------------------------------------------- /secrets.json.default: -------------------------------------------------------------------------------- 1 | { 2 | "handle": "", 3 | "password": "" 4 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uakihir0/kbsky/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /core/src/jvmTest/resources/image/200x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uakihir0/kbsky/HEAD/core/src/jvmTest/resources/image/200x100.png -------------------------------------------------------------------------------- /core/src/jvmTest/resources/image/200x200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uakihir0/kbsky/HEAD/core/src/jvmTest/resources/image/200x200.png -------------------------------------------------------------------------------- /core/src/jvmTest/resources/video/heavy.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uakihir0/kbsky/HEAD/core/src/jvmTest/resources/video/heavy.mp4 -------------------------------------------------------------------------------- /core/src/jvmTest/resources/video/light.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uakihir0/kbsky/HEAD/core/src/jvmTest/resources/video/light.mp4 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea 3 | .gradle 4 | .kotlin 5 | .prompts 6 | target/ 7 | build/ 8 | out/ 9 | oauth.json 10 | secrets.json 11 | jwt.txt 12 | jwt.json 13 | /local.properties 14 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/util/facet/FacetType.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.util.facet 2 | 3 | enum class FacetType { 4 | Text, 5 | Mention, 6 | Link, 7 | Tag, 8 | } 9 | -------------------------------------------------------------------------------- /plugins/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | dependencies { 6 | implementation(libs.nexus.publish) 7 | implementation(libs.maven.publish) 8 | implementation(libs.dokka) 9 | } -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/callback/ClosedCallback.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.callback 2 | 3 | interface ClosedCallback { 4 | fun onClosed() 5 | } 6 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/callback/OpenedCallback.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.callback 2 | 3 | interface OpenedCallback { 4 | fun onOpened() 5 | } 6 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/callback/ErrorCallback.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.callback 2 | 3 | interface ErrorCallback { 4 | fun onError(e: Exception) 5 | } 6 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/util/MediaType.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.util 2 | 3 | import io.ktor.http.ContentType 4 | 5 | object MediaType { 6 | 7 | val JSON = ContentType.Application.Json.toString() 8 | } -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | groups: 6 | dependencies: 7 | patterns: 8 | - "*" 9 | schedule: 10 | interval: "weekly" 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/util/facet/FacetRecord.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.util.facet 2 | 3 | data class FacetRecord( 4 | var type: FacetType, 5 | var contentText: String, 6 | var displayText: String, 7 | ) 8 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/util/ATUri.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.util 2 | 3 | /** 4 | * ATProtocol URI 5 | * at://{did}/{recordType}/{key} 6 | */ 7 | data class ATUri(val did: String, val recordType: String, val rkey: String) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/share/Response.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.share 2 | 3 | /** 4 | * @author uakihir0 5 | */ 6 | data class Response( 7 | val data: T, 8 | val json: String, 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/share/AuthRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.share 2 | 3 | import work.socialhub.kbsky.auth.AuthProvider 4 | 5 | open class AuthRequest( 6 | open val auth: AuthProvider 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/JwtStore.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class JwtStore( 7 | var accessJwt: String? = null, 8 | var refreshJwt: String? = null, 9 | ) -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/ATProtocolStream.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream 2 | 3 | import work.socialhub.kbsky.stream.api.com.atproto.SyncResource 4 | 5 | interface ATProtocolStream { 6 | fun sync(): SyncResource 7 | } 8 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/BlueskyStream.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream 2 | 3 | import work.socialhub.kbsky.stream.api.app.bsky.JetStreamResource 4 | 5 | interface BlueskyStream { 6 | 7 | fun jetStream(): JetStreamResource 8 | } -------------------------------------------------------------------------------- /auth/src/jvmTest/kotlin/work/socialhub/kbsky/auth/JwtStore.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class JwtStore( 7 | var accessJwt: String? = null, 8 | var refreshJwt: String? = null, 9 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/video/VideoUploadVideoResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.video 2 | 3 | import work.socialhub.kbsky.model.app.bsky.video.JobStatus 4 | 5 | typealias VideoUploadVideoResponse = JobStatus -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/api/entity/oauth/BuildAuthorizationUrlRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth.api.entity.oauth 2 | 3 | data class BuildAuthorizationUrlRequest( 4 | var requestUri: String = "", 5 | var clientId: String = "", 6 | ) 7 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/BlueskyConfig.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | open class BlueskyConfig : ATProtocolConfig() { 4 | 5 | var videoServiceUri: String = "https://video.bsky.app/" 6 | var videoServiceDid: String = "did:web:video.bsky.app" 7 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/plc/DIDLogVerificationMethods.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.plc 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class DIDLogVerificationMethods( 7 | var atproto: String? = null, 8 | ) 9 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsLabelerPrefItem.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ActorDefsLabelerPrefItem( 7 | val did: String 8 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/share/Error.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.share 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Error( 7 | var message: String = "", 8 | var error: String = "", 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/labeler/LabelerViewerState.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.labeler 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class LabelerViewerState( 7 | var like: String? = null, 8 | ) 9 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsMessageViewSender.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ConvoDefsMessageViewSender( 7 | var did: String, 8 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/plc/DIDLogPDS.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.plc 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class DIDLogPDS( 7 | var type: String? = null, 8 | var endpoint: String? = null, 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoSendMessageResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsMessageView 4 | 5 | typealias ConvoSendMessageResponse = ConvoDefsMessageView -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/util/facet/FacetRegex.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.util.facet 2 | 3 | /** 4 | * プラットフォーム別のハッシュタグ正規表現を提供 5 | * 6 | * iOSとJVMで正規表現エンジンの動作が異なるため、 7 | * expect/actualでプラットフォーム別の実装を提供します。 8 | */ 9 | internal expect fun getTagRegex(): Regex 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphBlockResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoCreateRecordResponse 4 | 5 | typealias GraphBlockResponse = RepoCreateRecordResponse 6 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/graph/GraphStarterPackFeedItem.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class GraphStarterPackFeedItem( 7 | /** at-uri */ 8 | var uri: String 9 | ) -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/domain/OAuthScopes.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth.domain 2 | 3 | enum class OAuthScopes( 4 | val value: String 5 | ) { 6 | ATProto("atproto"), 7 | TransitionGeneric("transition:generic"), 8 | TransitionChatBsky("transition:chat.bsky"), 9 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedDefsAspectRatio.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class EmbedDefsAspectRatio( 7 | var width: Int = 1, 8 | var height: Int = 1, 9 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphCreateListResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoCreateRecordResponse 4 | 5 | typealias GraphCreateListResponse = RepoCreateRecordResponse 6 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsPreferences.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ActorDefsPreferences( 7 | val items: List? = null, 8 | ) 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphAddUserToListResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoCreateRecordResponse 4 | 5 | typealias GraphAddUserToListResponse = RepoCreateRecordResponse 6 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/app/bsky/callback/JetStreamEventCallback.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.app.bsky.callback 2 | 3 | import work.socialhub.kbsky.stream.entity.app.bsky.model.Event 4 | 5 | interface JetStreamEventCallback { 6 | 7 | fun onEvent(event: Event) 8 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/server/ServerGetServiceAuthResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.server 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ServerGetServiceAuthResponse( 7 | var token: String = "", 8 | ) 9 | -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/Auth.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth 2 | 3 | import work.socialhub.kbsky.auth.api.OAuthResource 4 | import work.socialhub.kbsky.auth.api.WellKnownResource 5 | 6 | interface Auth { 7 | 8 | fun wellKnown(): WellKnownResource 9 | fun oauth(): OAuthResource 10 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoDeleteMessageForSelfResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsDeletedMessageView 4 | 5 | typealias ConvoDeleteMessageForSelfResponse = ConvoDefsDeletedMessageView -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/share/BlobRef.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.share 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class BlobRef( 8 | @SerialName("\$link") 9 | var link: String? = null, 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/undoc/UndocSearchFeedsUser.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.undoc 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class UndocSearchFeedsUser( 7 | var did: String? = null, 8 | var handle: String? = null, 9 | ) 10 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/com/atproto/model/StreamOp.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.com.atproto.model 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class StreamOp( 7 | var action: String? = null, 8 | var path: String? = null, 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/notification/NotificationGetUnreadCountResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.notification 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class NotificationGetUnreadCountResponse( 7 | var count: Int = -1, 8 | ) 9 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoLeaveConvoResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ConvoLeaveConvoResponse( 7 | var convoId: String, 8 | var rev: String 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsGeneratorViewerState.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class FeedDefsGeneratorViewerState( 7 | /** at-url */ 8 | var like: String? = null, 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsReplyRef.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class FeedDefsReplyRef( 7 | var root: FeedDefsPostView? = null, 8 | var parent: FeedDefsPostView? = null, 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/repo/RepoPutRecordResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.repo 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | open class RepoPutRecordResponse { 7 | lateinit var uri: String 8 | lateinit var cid: String 9 | } 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/plc/DIDDetailsService.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.plc 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class DIDDetailsService( 7 | var id: String? = null, 8 | var type: String? = null, 9 | var serviceEndpoint: String? = null, 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/ATProtocolFactory.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | import work.socialhub.kbsky.internal._ATProtocol 4 | 5 | object ATProtocolFactory { 6 | fun instance(uri: String): ATProtocol { 7 | return _ATProtocol(ATProtocolConfig() 8 | .also { it.pdsUri = uri }) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/repo/RepoCreateRecordResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.repo 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | open class RepoCreateRecordResponse { 7 | lateinit var uri: String 8 | lateinit var cid: String 9 | } 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/plc/DIDLogService.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.plc 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class DIDLogService( 8 | @SerialName("atproto_pds") 9 | var atprotoPDS: DIDLogPDS? = null, 10 | ) 11 | -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/helper/RandomHelper.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth.helper 2 | 3 | object RandomHelper { 4 | 5 | fun random(len: Int): String { 6 | val lists = ('a'..'z') + ('0'..'9') 7 | return (1..len) 8 | .map { lists.random() } 9 | .joinToString("") 10 | } 11 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedLikeResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoCreateRecordResponse 5 | 6 | @Serializable 7 | class FeedLikeResponse : RepoCreateRecordResponse() 8 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedPostResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoCreateRecordResponse 5 | 6 | @Serializable 7 | class FeedPostResponse : RepoCreateRecordResponse() 8 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedPostgateResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoCreateRecordResponse 5 | 6 | @Serializable 7 | class FeedPostgateResponse : RepoCreateRecordResponse() 8 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedRepostResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoCreateRecordResponse 5 | 6 | @Serializable 7 | class FeedRepostResponse : RepoCreateRecordResponse() 8 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/repo/RepoUploadBlobResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.repo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.share.Blob 5 | 6 | @Serializable 7 | data class RepoUploadBlobResponse( 8 | var blob: Blob = Blob(), 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedThreadgateResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoCreateRecordResponse 5 | 6 | @Serializable 7 | class FeedThreadgateResponse : RepoCreateRecordResponse() 8 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsKnownFollowers.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ActorDefsKnownFollowers( 7 | val count: Int = 0, 8 | var followers: List = emptyList(), 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/actor/ActorGetProfileResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileViewDetailed 5 | 6 | @Serializable 7 | class ActorGetProfileResponse : ActorDefsProfileViewDetailed() 8 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/actor/ActorUpdateProfileResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoPutRecordResponse 5 | 6 | @Serializable 7 | class ActorUpdateProfileResponse : RepoPutRecordResponse() 8 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/undoc/UndocSearchFeedsPost.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.undoc 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class UndocSearchFeedsPost( 7 | var createdAt: Long? = null, 8 | var text: String? = null, 9 | var user: String? = null, 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsReactionViewSender.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * chat.bsky.convo.defs#reactionViewSender 7 | */ 8 | @Serializable 9 | data class ConvoDefsReactionViewSender( 10 | val did: String, 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/moderation/ModerationCreateReportResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.moderation 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.moderation.ModerationReport 5 | 6 | @Serializable 7 | class ModerationCreateReportResponse : ModerationReport() -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/app/bsky/model/Account.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.app.bsky.model 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Account( 7 | var active: Boolean = true, 8 | var did: String = "", 9 | var sec: Long = 0, 10 | var time: String = "", 11 | ) 12 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/app/bsky/model/Identity.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.app.bsky.model 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Identity( 7 | var did: String = "", 8 | var handle: String = "", 9 | var sec: Long = 0, 10 | var time: String = "", 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/video/VideoGetUploadLimitsRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.video 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.auth.AuthProvider 5 | 6 | data class VideoGetUploadLimitsRequest( 7 | override val auth: AuthProvider, 8 | ) : AuthRequest(auth) 9 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoAddReactionResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsMessageView 5 | 6 | @Serializable 7 | data class ConvoAddReactionResponse( 8 | val message: ConvoDefsMessageView 9 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoGetConvoResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsConvoView 5 | 6 | @Serializable 7 | data class ConvoGetConvoResponse( 8 | var convo: ConvoDefsConvoView 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoGetLogResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsLogUnion 5 | 6 | @Serializable 7 | data class ConvoGetLogResponse( 8 | var logs: List 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/graph/GraphDefsListViewerState.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class GraphDefsListViewerState( 7 | var repost: String? = null, 8 | var like: String? = null, 9 | var replyDisabled: Boolean? = null, 10 | ) 11 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | ./gradlew \ 3 | core:clean stream:clean \ 4 | core:assemble stream:assemble \ 5 | -x check --refresh-dependencies 6 | 7 | pods: 8 | ./gradlew \ 9 | all:assembleKbskyXCFramework \ 10 | all:podPublishXCFramework \ 11 | -x check --refresh-dependencies 12 | 13 | version: 14 | ./gradlew version --no-daemon --console=plain -q 15 | 16 | .PHONY: build pods version -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoMuteConvoResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsConvoView 5 | 6 | @Serializable 7 | data class ConvoMuteConvoResponse( 8 | var convo: ConvoDefsConvoView 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoRemoveReactionResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsMessageView 5 | 6 | @Serializable 7 | data class ConvoRemoveReactionResponse( 8 | val message: ConvoDefsMessageView 9 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoUpdateReadResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsConvoView 5 | 6 | @Serializable 7 | data class ConvoUpdateReadResponse( 8 | var convo: ConvoDefsConvoView 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetPostsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsPostView 5 | 6 | @Serializable 7 | data class FeedGetPostsResponse( 8 | var posts: List = emptyList(), 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoUnmuteConvoResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsConvoView 5 | 6 | @Serializable 7 | data class ConvoUnmuteConvoResponse( 8 | var convo: ConvoDefsConvoView 9 | ) 10 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/com/atproto/callback/SyncEventCallback.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.com.atproto.callback 2 | 3 | import work.socialhub.kbsky.model.share.RecordUnion 4 | 5 | interface SyncEventCallback { 6 | fun onEvent( 7 | cid: String?, 8 | uri: String?, 9 | record: RecordUnion 10 | ) 11 | } 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphDeleteListRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.auth.AuthProvider 5 | 6 | data class GraphDeleteListRequest( 7 | override val auth: AuthProvider, 8 | val listUri: String, 9 | ) : AuthRequest(auth) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetStarterPackResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.graph.GraphDefsStarterPackView 5 | 6 | @Serializable 7 | data class GraphGetStarterPackResponse( 8 | var starterPack: GraphDefsStarterPackView 9 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/com/atproto/label/LabelDefsLabelValueDefinitionStrings.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.com.atproto.label 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class LabelDefsLabelValueDefinitionStrings( 7 | var lang: String = "", 8 | var name: String = "", 9 | var description: String = "", 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoGetConvoForMembersResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsConvoView 5 | 6 | @Serializable 7 | data class ConvoGetConvoForMembersResponse( 8 | var convo: ConvoDefsConvoView 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/domain/Service.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.domain 2 | 3 | enum class Service( 4 | val uri: String 5 | ) { 6 | // 7 | BSKY_SOCIAL("https://bsky.social"), 8 | BSKY_NETWORK("https://bsky.network"), 9 | BSKY_APP_PUBLIC("https://public.api.bsky.app"), 10 | 11 | OYSTER_US_EAST("https://oyster.us-east.host.bsky.network"), 12 | } 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedPostReplyRef.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.repo.RepoStrongRef 5 | 6 | @Serializable 7 | data class FeedPostReplyRef( 8 | var root: RepoStrongRef? = null, 9 | var parent: RepoStrongRef? = null, 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/notification/NotificationGetUnreadCountRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.notification 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.auth.AuthProvider 5 | 6 | data class NotificationGetUnreadCountRequest( 7 | override val auth: AuthProvider, 8 | ) : AuthRequest(auth) 9 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedExternalViewExternal.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class EmbedExternalViewExternal( 7 | var uri: String = "", 8 | var title: String = "", 9 | var description: String = "", 10 | var thumb: String? = null, 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsFeedViewPost.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class FeedDefsFeedViewPost( 7 | var post: FeedDefsPostView = FeedDefsPostView(), 8 | var reply: FeedDefsReplyRef? = null, 9 | var reason: FeedDefsReasonUnion? = null, 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/plc/DIDDetailsVerificationMethod.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.plc 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class DIDDetailsVerificationMethod( 7 | var id: String? = null, 8 | var type: String? = null, 9 | var controller: String? = null, 10 | var publicKeyMultibase: String? = null, 11 | ) 12 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/com/atproto/model/StreamRoot.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.com.atproto.model 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class StreamRoot( 7 | var op: Int? = null, 8 | var repo: String? = null, 9 | var ops: List? = null, 10 | var t: String? = null, 11 | ) 12 | 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/BlueskyException.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | data class BlueskyException( 4 | override val message: String?, 5 | val exception: Exception?, 6 | ) : RuntimeException( 7 | message, 8 | exception, 9 | ) { 10 | constructor(message: String?) : this(message, null) 11 | constructor(exception: Exception?) : this(null, exception) 12 | } 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/PLCDirectory.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | import work.socialhub.kbsky.api.entity.share.Response 4 | import work.socialhub.kbsky.model.plc.DIDDetails 5 | import work.socialhub.kbsky.model.plc.DIDLog 6 | 7 | interface PLCDirectory { 8 | fun DIDDetails(did: String): Response 9 | fun DIDLogs(did: String): Response> 10 | } 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetTimelineResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class FeedGetTimelineResponse( 7 | var cursor: String? = null, 8 | var feed: List = emptyList(), 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphEditListResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoPutRecordResponse 5 | 6 | @Serializable 7 | data class GraphEditListResponse( 8 | val dummy: Unit = Unit, 9 | ) : RepoPutRecordResponse() 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphFollowResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.api.entity.com.atproto.repo.RepoCreateRecordResponse 5 | 6 | @Serializable 7 | data class GraphFollowResponse( 8 | val dummy: Unit = Unit, 9 | ) : RepoCreateRecordResponse() 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/labeler/LabelerGetServicesResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.labeler 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.labeler.LabelerViewUnion 5 | 6 | @Serializable 7 | data class LabelerGetServicesResponse( 8 | var views: List = emptyList(), 9 | ) 10 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/ATProtocolStreamConfig.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream 2 | 3 | import work.socialhub.kbsky.ATProtocolConfig 4 | import work.socialhub.kbsky.domain.Service 5 | 6 | data class ATProtocolStreamConfig( 7 | /** 8 | * URI of the FireHose. 9 | */ 10 | var firehoseUri: String = Service.BSKY_NETWORK.uri, 11 | ) : ATProtocolConfig() { 12 | } -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/OAuthContext.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * Following values required during OAuth 7 | */ 8 | @Serializable 9 | data class OAuthContext( 10 | var redirectUri: String? = null, 11 | var codeVerifier: String? = null, 12 | var state: String? = null, 13 | ) : OAuthSession() 14 | 15 | -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/OAuthSession.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | open class OAuthSession { 7 | 8 | var clientId: String? = null 9 | 10 | /** ECDSA P256 DER Base64 key */ 11 | var publicKey: String? = null 12 | var privateKey: String? = null 13 | 14 | var dPoPNonce: String = "" 15 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/PLCDirectoryFactory.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | import work.socialhub.kbsky.internal._PLCDirectory 4 | 5 | object PLCDirectoryFactory { 6 | fun instance(): PLCDirectory { 7 | return _PLCDirectory("https://plc.directory/") 8 | } 9 | 10 | fun instance(uri: String): PLCDirectory { 11 | return _PLCDirectory(uri) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetFeedGeneratorsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsGeneratorView 5 | 6 | @Serializable 7 | data class FeedGetFeedGeneratorsResponse( 8 | var feeds: List = emptyList(), 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedImagesImage.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.share.Blob 5 | 6 | @Serializable 7 | data class EmbedImagesImage( 8 | var image: Blob? = null, 9 | var alt: String? = null, 10 | var aspectRatio: EmbedDefsAspectRatio? = null, 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedImagesViewImage.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class EmbedImagesViewImage( 7 | val thumb: String? = null, 8 | val fullsize: String? = null, 9 | val alt: String? = null, 10 | val aspectRatio: EmbedDefsAspectRatio? = null, 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/repo/RepoGetRecordResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.repo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.share.RecordUnion 5 | 6 | @Serializable 7 | data class RepoGetRecordResponse( 8 | var uri: String = "", 9 | var cid: String? = null, 10 | var value: RecordUnion, 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsReactionView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * chat.bsky.convo.defs#reactionView 7 | */ 8 | @Serializable 9 | data class ConvoDefsReactionView( 10 | val value: String, 11 | val sender: ConvoDefsReactionViewSender, 12 | val createdAt: String, 13 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/com/atproto/repo/RepoListRecordsRecord.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.com.atproto.repo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.share.RecordUnion 5 | 6 | @Serializable 7 | data class RepoListRecordsRecord( 8 | var uri: String? = null, 9 | var cid: String? = null, 10 | var value: RecordUnion? = null, 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/share/Blob.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.share 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Blob( 8 | @SerialName("\$type") 9 | var type: String = "blob", 10 | var ref: BlobRef? = null, 11 | var mimeType: String? = null, 12 | var size: Int? = null, 13 | ) 14 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/util/json/JsonElementUtil.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.util.json 2 | 3 | import kotlinx.serialization.json.JsonElement 4 | import kotlinx.serialization.json.jsonObject 5 | import kotlinx.serialization.json.jsonPrimitive 6 | 7 | object JsonElementUtil { 8 | 9 | fun JsonElement.type(): String? { 10 | return jsonObject["\$type"]?.jsonPrimitive?.content 11 | } 12 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/actor/ActorGetPreferencesResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsPreferencesUnion 5 | 6 | @Serializable 7 | data class ActorGetPreferencesResponse( 8 | var preferences: List = emptyList(), 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/actor/ActorGetProfilesResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileViewDetailed 5 | 6 | @Serializable 7 | data class ActorGetProfilesResponse( 8 | var profiles: List = emptyList(), 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/actor/ActorSearchActorsTypeaheadResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileView 5 | 6 | @Serializable 7 | data class ActorSearchActorsTypeaheadResponse( 8 | var actors: List = emptyList(), 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetBookmarksResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsBookmarkView 5 | 6 | @Serializable 7 | data class FeedGetBookmarksResponse( 8 | val cursor: String? = null, 9 | val bookmarks: List, 10 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetStarterPacksResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.graph.GraphDefsStarterPackViewBasic 5 | 6 | @Serializable 7 | data class GraphGetStarterPacksResponse( 8 | var starterPacks: List 9 | ) 10 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsSavedFeed.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ActorDefsSavedFeed( 7 | val id: String = "", 8 | // knownValues: ['feed', 'list', 'timeline'] 9 | val type: String = "", 10 | val value: String = "", 11 | val pinned: Boolean = false, 12 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetFeedResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsFeedViewPost 5 | 6 | @Serializable 7 | data class FeedGetFeedResponse( 8 | var cursor: String? = null, 9 | var feed: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetListsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.graph.GraphDefsListView 5 | 6 | @Serializable 7 | data class GraphGetListsResponse( 8 | var cursor: String? = null, 9 | var lists: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoGetListConvosResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsConvoView 5 | 6 | @Serializable 7 | data class ConvoGetListConvosResponse( 8 | var cursor: String? = null, 9 | var convos: List 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/share/RecordRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.share 2 | 3 | import kotlinx.datetime.Clock 4 | import work.socialhub.kbsky.internal.share._InternalUtility 5 | 6 | interface RecordRequest { 7 | var createdAt: String? 8 | 9 | fun createdAt(): String { 10 | return createdAt ?: _InternalUtility.dateFormat.format(Clock.System.now()) 11 | } 12 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsProfileAssociated.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ActorDefsProfileAssociated( 7 | var lists: Int? = null, 8 | var feedgens: Int? = null, 9 | var labeler: Boolean? = null, 10 | var chat: ActorDefsProfileAssociatedChat? = null, 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsProfileAssociatedChat.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ActorDefsProfileAssociatedChat( 7 | // "knownValues": ["all", "none", "following"] 8 | // when nothing is set, it is assumed to be "following" 9 | var allowIncoming: String = "", 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetListFeedResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsFeedViewPost 5 | 6 | @Serializable 7 | data class FeedGetListFeedResponse( 8 | var cursor: String? = null, 9 | var feed: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetMutesResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileView 5 | 6 | @Serializable 7 | data class GraphGetMutesResponse( 8 | var cursor: String? = null, 9 | var mutes: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/video/VideoGetJobStatusResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.video 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.video.JobStatus 5 | 6 | /** 7 | * Response for retrieving video job status. 8 | */ 9 | @Serializable 10 | data class VideoGetJobStatusResponse( 11 | var jobStatus: JobStatus, 12 | ) 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoGetMessagesResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsMessageUnion 5 | 6 | @Serializable 7 | data class ConvoGetMessagesResponse( 8 | var cursor: String? = null, 9 | var messages: List 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetActorLikesResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsFeedViewPost 5 | 6 | @Serializable 7 | data class FeedGetActorLikesResponse( 8 | var cursor: String? = null, 9 | var feed: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetAuthorFeedResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsFeedViewPost 5 | 6 | @Serializable 7 | data class FeedGetAuthorFeedResponse( 8 | var cursor: String? = null, 9 | var feed: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetBlocksResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileView 5 | 6 | @Serializable 7 | data class GraphGetBlocksResponse( 8 | var cursor: String? = null, 9 | var blocks: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedExternalExternal.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.share.Blob 5 | 6 | @Serializable 7 | data class EmbedExternalExternal( 8 | var uri: String = "", 9 | var title: String = "", 10 | var description: String = "", 11 | var thumb: Blob? = null, 12 | ) 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsBookmarkView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.repo.RepoStrongRef 5 | 6 | @Serializable 7 | data class FeedDefsBookmarkView( 8 | val subject: RepoStrongRef, 9 | val createdAt: String? = null, 10 | val item: FeedDefsBookmarkItemUnion, 11 | ) 12 | -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/AuthFactory.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth 2 | 3 | import work.socialhub.kbsky.auth.internal._Auth 4 | 5 | object AuthFactory { 6 | 7 | fun instance(config: AuthConfig): Auth { 8 | return _Auth(config) 9 | } 10 | 11 | fun instance(pdsUri: String): Auth { 12 | return instance(AuthConfig().also { 13 | it.pdsServer = pdsUri 14 | }) 15 | } 16 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/actor/ActorSearchActorsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileView 5 | 6 | @Serializable 7 | data class ActorSearchActorsResponse( 8 | var cursor: String? = null, 9 | var actors: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetActorFeedsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsGeneratorView 5 | 6 | @Serializable 7 | data class FeedGetActorFeedsResponse( 8 | var cursor: String? = null, 9 | var feeds: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/richtext/RichtextFacetByteSlice.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.richtext 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * A text segment. Start is inclusive, end is exclusive. Indices are for utf8-encoded strings. 7 | */ 8 | @Serializable 9 | data class RichtextFacetByteSlice( 10 | var byteStart: Int? = null, 11 | var byteEnd: Int? = null 12 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/BlueskyFactory.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | import work.socialhub.kbsky.internal._Bluesky 4 | 5 | object BlueskyFactory { 6 | fun instance(uri: String): Bluesky { 7 | return _Bluesky(BlueskyConfig() 8 | .also { it.pdsUri = uri }) 9 | } 10 | 11 | fun instance(config: BlueskyConfig = BlueskyConfig()): Bluesky { 12 | return _Bluesky(config) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/identity/IdentityResolveHandleResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.identity 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * https://github.com/bluesky-social/atproto/blob/main/lexicons/com/atproto/identity/resolveHandle.json 7 | */ 8 | @Serializable 9 | data class IdentityResolveHandleResponse( 10 | var did: String = "", 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/repo/RepoListRecordsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.repo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.repo.RepoListRecordsRecord 5 | 6 | @Serializable 7 | data class RepoListRecordsResponse( 8 | var cursor: String? = null, 9 | var records: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetPostThreadResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsThreadUnion 5 | 6 | /** 7 | * Response for a post thread request. 8 | */ 9 | @Serializable 10 | data class FeedGetPostThreadResponse( 11 | var thread: FeedDefsThreadUnion? = null, 12 | ) 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/unspecced/UnspeccedGetPopularResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.unspecced 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsFeedViewPost 5 | 6 | @Serializable 7 | data class UnspeccedGetPopularResponse( 8 | var cursor: String? = null, 9 | var feed: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedGetLikesLike.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileView 5 | 6 | @Serializable 7 | data class FeedGetLikesLike( 8 | var indexedAt: String = "", 9 | var createdAt: String = "", 10 | var actor: ActorDefsProfileView = ActorDefsProfileView(), 11 | ) 12 | -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/api/entity/oauth/OAuthPushedAuthorizationResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth.api.entity.oauth 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class OAuthPushedAuthorizationResponse( 8 | @SerialName("request_uri") 9 | val requestUri: String, 10 | 11 | @SerialName("expires_in") 12 | val expiresIn: Int = -1, 13 | ) 14 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/labeler/LabelerGetServicesRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.labeler 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.auth.AuthProvider 5 | 6 | data class LabelerGetServicesRequest( 7 | override val auth: AuthProvider, 8 | var dids: List = emptyList(), 9 | var detailed: Boolean? = null, 10 | ) : AuthRequest(auth) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/labeler/LabelerPolicies.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.labeler 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.label.LabelDefsLabelValueDefinition 5 | 6 | @Serializable 7 | data class LabelerPolicies( 8 | var labelValues: List = emptyList(), 9 | var labelValueDefinitions: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /plugins/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | gradlePluginPortal() 6 | } 7 | } 8 | 9 | dependencyResolutionManagement { 10 | repositories { 11 | google() 12 | mavenCentral() 13 | gradlePluginPortal() 14 | } 15 | versionCatalogs { 16 | create("libs") { 17 | from(files("../gradle/libs.versions.toml")) 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetFeedGeneratorResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsGeneratorView 5 | 6 | @Serializable 7 | data class FeedGetFeedGeneratorResponse( 8 | var view: FeedDefsGeneratorView? = null, 9 | var online: Boolean? = null, 10 | var valid: Boolean? = null, 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/video/VideoGetUploadLimitsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.video 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class VideoGetUploadLimitsResponse( 7 | val canUpload: Boolean, 8 | val remainingDailyVideos: Int? = null, 9 | val remainingDailyBytes: Long? = null, 10 | val message: String? = null, 11 | val error: String? = null, 12 | ) 13 | -------------------------------------------------------------------------------- /plugins/src/main/kotlin/root.publications.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.github.gradle-nexus.publish-plugin") 3 | } 4 | 5 | nexusPublishing { 6 | repositories { 7 | sonatype { 8 | // only for users registered in Sonatype after 24 Feb 2021 9 | nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) 10 | snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetLikesResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedGetLikesLike 5 | 6 | @Serializable 7 | data class FeedGetLikesResponse( 8 | var uri: String = "", 9 | var cid: String? = null, 10 | var cursor: String? = null, 11 | var likes: List = emptyList(), 12 | ) 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetQuotesResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsPostView 5 | 6 | @Serializable 7 | data class FeedGetQuotesResponse( 8 | var uri: String = "", 9 | var cid: String? = null, 10 | var cursor: String? = null, 11 | var posts: List = emptyList(), 12 | ) 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/repo/RepoUploadBlobRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.repo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.auth.AuthProvider 5 | 6 | data class RepoUploadBlobRequest( 7 | override val auth: AuthProvider, 8 | var bytes: ByteArray, 9 | var name: String = "data", 10 | var contentType: String = "image/jpeg", 11 | ) : AuthRequest(auth) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/share/RKeyRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.share 2 | 3 | import work.socialhub.kbsky.util.ATUriParser 4 | 5 | interface RKeyRequest { 6 | var uri: String? 7 | var rkey: String? 8 | 9 | fun rkey(): String? { 10 | if (rkey != null) { 11 | return rkey 12 | } 13 | return if (uri != null) { 14 | ATUriParser.getRKey(uri!!) 15 | } else null 16 | } 17 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsViewerState.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class FeedDefsViewerState( 7 | var repost: String? = null, 8 | var like: String? = null, 9 | var bookmarked: Boolean? = null, 10 | var replyDisabled: Boolean? = null, 11 | var embeddingDisabled: Boolean? = null, 12 | var pinned: Boolean? = null, 13 | ) 14 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/com/atproto/moderation/ModerationReport.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.com.atproto.moderation 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | open class ModerationReport { 7 | val id: Int? = null 8 | val reasonType: String? = null 9 | val reason: String? = null 10 | val subject: ModerationSubjectUnion? = null 11 | val reportedBy: String? = null 12 | val createdAt: String? = null 13 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/video/VideoUploadVideoRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.video 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.auth.AuthProvider 5 | 6 | data class VideoUploadVideoRequest( 7 | override val auth: AuthProvider, 8 | var bytes: ByteArray, 9 | var name: String = "data.mp4", 10 | var contentType: String = "video/mp4", 11 | ) : AuthRequest(auth) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsThreadgateView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.graph.GraphDefsListViewBasic 5 | 6 | @Serializable 7 | data class FeedDefsThreadgateView( 8 | var uri: String? = null, 9 | var cid: String? = null, 10 | var record: FeedThreadgate? = null, 11 | var lists: List? = null, 12 | ) 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsMessageInput.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.embed.EmbedUnion 5 | import work.socialhub.kbsky.model.app.bsky.richtext.RichtextFacet 6 | 7 | @Serializable 8 | data class ConvoDefsMessageInput( 9 | var text: String, 10 | var facets: List? = null, 11 | var embed: EmbedUnion? = null, 12 | ) -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/api/app/bsky/JetStreamResource.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.api.app.bsky 2 | 3 | import work.socialhub.kbsky.stream.api.entity.app.bsky.JetStreamSubscribeRequest 4 | import work.socialhub.kbsky.stream.entity.app.bsky.JetStreamClient 5 | 6 | /** 7 | * https://docs.bsky.app/blog/jetstream 8 | */ 9 | interface JetStreamResource { 10 | 11 | fun subscribe( 12 | request: JetStreamSubscribeRequest 13 | ): JetStreamClient 14 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/unspecced/UnspeccedSearchFeedsRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.unspecced 2 | 3 | import work.socialhub.kbsky.api.entity.share.MapRequest 4 | 5 | data class UnspeccedSearchFeedsRequest( 6 | var q: String? = null, 7 | ) : MapRequest { 8 | 9 | override fun toMap(): Map { 10 | return mutableMapOf().also { 11 | it.addParam("q", q) 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetRepostedByResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileView 5 | 6 | @Serializable 7 | data class FeedGetRepostedByResponse( 8 | var uri: String = "", 9 | var cid: String? = null, 10 | var cursor: String? = null, 11 | var repostedBy: List = emptyList(), 12 | ) 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetFollowsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileView 5 | 6 | @Serializable 7 | data class GraphGetFollowsResponse( 8 | var cursor: String? = null, 9 | var subject: ActorDefsProfileView = ActorDefsProfileView(), 10 | var follows: List = emptyList(), 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/com/atproto/server/DidDocUnion.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.com.atproto.server 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.plc.DIDDetails 5 | import work.socialhub.kbsky.util.json.DidDocPolymorphicSerializer 6 | 7 | /** 8 | * @see DIDDetails 9 | */ 10 | @Serializable(with = DidDocPolymorphicSerializer::class) 11 | abstract class DidDocUnion { 12 | 13 | val asDIDDetails get() = this as? DIDDetails 14 | } -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/app/bsky/model/Commit.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.app.bsky.model 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.share.RecordUnion 5 | 6 | @Serializable 7 | data class Commit( 8 | var rev: String = "", 9 | var operation: String = "", 10 | var collection: String = "", 11 | var rkey: String = "", 12 | var record: RecordUnion? = null, 13 | var cid: String? = null, 14 | ) 15 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetFollowersResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileView 5 | 6 | @Serializable 7 | data class GraphGetFollowersResponse( 8 | var cursor: String? = null, 9 | var subject: ActorDefsProfileView = ActorDefsProfileView(), 10 | var followers: List = emptyList(), 11 | ) 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/plc/DIDLog.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.plc 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class DIDLog( 7 | var sig: String? = null, 8 | var prev: String? = null, 9 | var type: String? = null, 10 | var services: DIDLogService? = null, 11 | var alsoKnownAs: List? = null, 12 | var rotationKeys: List? = null, 13 | var verificationMethods: DIDLogVerificationMethods? = null, 14 | ) 15 | -------------------------------------------------------------------------------- /core/src/commonTest/kotlin/work/socialhub/kbsky/plc/GetLogTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.plc 2 | 3 | import work.socialhub.kbsky.PLCDirectoryFactory 4 | import kotlin.test.Test 5 | 6 | class GetLogTest() { 7 | 8 | @Test 9 | fun testGetLog() { 10 | val did = "did:plc:bwdof2anluuf5wmfy2upgulw" 11 | 12 | val response = PLCDirectoryFactory 13 | .instance() 14 | .DIDLogs(did) 15 | 16 | println(checkNotNull(response.data[0].alsoKnownAs)[0]) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/com/atproto/label/LabelDefsSelfLabel.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.com.atproto.label 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. 7 | */ 8 | @Serializable 9 | data class LabelDefsSelfLabel( 10 | /** The short string name of the value or type of this label. */ 11 | var `val`: String = "", 12 | ) 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetKnownFollowersResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileView 5 | 6 | @Serializable 7 | data class GraphGetKnownFollowersResponse( 8 | var cursor: String? = null, 9 | var subject: ActorDefsProfileView = ActorDefsProfileView(), 10 | var followers: List = emptyList(), 11 | ) 12 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/entity/app/bsky/model/Event.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.entity.app.bsky.model 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class Event( 8 | var did: String = "", 9 | @SerialName("time_us") 10 | var timeUs: Long = 0, 11 | var kind: String = "", 12 | var commit: Commit? = null, 13 | var identity: Identity? = null, 14 | var account: Account? = null, 15 | ) 16 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/actor/ActorGetPreferencesRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.actor 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ActorGetPreferencesRequest( 8 | override val auth: AuthProvider, 9 | ) : AuthRequest(auth), MapRequest { 10 | 11 | override fun toMap(): Map = emptyMap() 12 | } 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/repo/RepoDescribeRepoResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.repo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.server.DidDocUnion 5 | 6 | @Serializable 7 | data class RepoDescribeRepoResponse( 8 | val handle: String, 9 | val did: String, 10 | val didDoc: DidDocUnion? = null, 11 | val collections: List? = null, 12 | val handleIsCorrect: Boolean = false, 13 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphDeleteBlockRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.RKeyRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphDeleteBlockRequest( 8 | override val auth: AuthProvider, 9 | override var uri: String? = null, 10 | override var rkey: String? = null, 11 | ) : AuthRequest(auth), RKeyRequest 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/richtext/RichtextFacet.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.richtext 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class RichtextFacet( 9 | @SerialName("\$type") 10 | val type: String = BlueskyTypes.RichtextFacet, 11 | var index: RichtextFacetByteSlice? = null, 12 | var features: MutableList? = null, 13 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/ATProtocol.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | import work.socialhub.kbsky.api.com.atproto.IdentityResource 4 | import work.socialhub.kbsky.api.com.atproto.ModerationResource 5 | import work.socialhub.kbsky.api.com.atproto.RepoResource 6 | import work.socialhub.kbsky.api.com.atproto.ServerResource 7 | 8 | interface ATProtocol { 9 | fun identity(): IdentityResource 10 | fun server(): ServerResource 11 | fun repo(): RepoResource 12 | fun moderation(): ModerationResource 13 | } 14 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphDeleteFollowRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.RKeyRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphDeleteFollowRequest( 8 | override val auth: AuthProvider, 9 | override var uri: String? = null, 10 | override var rkey: String? = null, 11 | ) : AuthRequest(auth), RKeyRequest 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/notification/NotificationListNotificationsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.notification 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.notification.NotificationListNotificationsNotification 5 | 6 | @Serializable 7 | data class NotificationListNotificationsResponse( 8 | var cursor: String? = null, 9 | var notifications: List = emptyList(), 10 | ) 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/repo/RepoDescribeRepoRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.repo 2 | 3 | import work.socialhub.kbsky.api.entity.share.MapRequest 4 | 5 | data class RepoDescribeRepoRequest( 6 | /** The handle or DID of the repo. */ 7 | val repo: String, 8 | ) : MapRequest { 9 | 10 | override fun toMap(): Map { 11 | return mutableMapOf().also { 12 | it.addParam("repo", repo) 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /core/src/jvmMain/kotlin/work/socialhub/kbsky/util/facet/FacetRegex.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.util.facet 2 | 3 | /** 4 | * Kotlin/JVM 用のハッシュタグ正規表現 5 | */ 6 | internal actual fun getTagRegex(): Regex { 7 | 8 | // (ref そのまだだと、空文字でも認識されてしまう問題があるので先頭を修正し、括弧を追加した上で、# だけでも認識される問題があるので末尾の ? を + に変更) 9 | return Regex("(?<=^|\\s)([##]((?!\\ufe0f)[^\\s\\u00AD\\u2060\\u200A\\u200B\\u200C\\u200D\\u20e2]*[^\\d\\s\\p{P}\\u00AD\\u2060\\u200A\\u200B\\u200C\\u200D\\u20e2]+[^\\s\\u00AD\\u2060\\u200A\\u200B\\u200C\\u200D\\u20e2]*)+)") 10 | } 11 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphRemoveUserFromListRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.RKeyRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphRemoveUserFromListRequest( 8 | override val auth: AuthProvider, 9 | override var uri: String? = null, 10 | override var rkey: String? = null, 11 | ) : AuthRequest(auth), RKeyRequest 12 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsReasonPin.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class FeedDefsReasonPin( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | ) : FeedDefsReasonUnion() { 12 | 13 | companion object { 14 | val TYPE = BlueskyTypes.FeedDefs + "#reasonPin" 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/api/entity/com/atproto/SyncSubscribeReposRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.api.entity.com.atproto 2 | 3 | import work.socialhub.kbsky.api.entity.share.MapRequest 4 | 5 | data class SyncSubscribeReposRequest( 6 | var cursor: String? = null, 7 | var filter: List = listOf(), 8 | ) : MapRequest { 9 | 10 | override fun toMap(): Map { 11 | return mutableMapOf().also { 12 | it.addParam("cursor", cursor) 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetListResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.graph.GraphDefsListItemView 5 | import work.socialhub.kbsky.model.app.bsky.graph.GraphDefsListView 6 | 7 | @Serializable 8 | data class GraphGetListResponse( 9 | var cursor: String? = null, 10 | var list: GraphDefsListView = GraphDefsListView(), 11 | var items: List = emptyList(), 12 | ) 13 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/com/atproto/repo/RepoRef.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.com.atproto.repo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.model.com.atproto.moderation.ModerationSubjectUnion 6 | 7 | /** 8 | * Repository reference by DID. 9 | */ 10 | @Serializable 11 | data class RepoRef( 12 | val did: String, 13 | ) : ModerationSubjectUnion() { 14 | @SerialName("\$type") 15 | override val type: String = "com.atproto.admin.defs#repoRef" 16 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/server/ServerRefreshSessionResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.server 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.server.DidDocUnion 5 | 6 | @Serializable 7 | data class ServerRefreshSessionResponse( 8 | var accessJwt: String = "", 9 | var refreshJwt: String = "", 10 | var handle: String = "", 11 | var did: String = "", 12 | var didDoc: DidDocUnion? = null, 13 | var active: Boolean? = null, 14 | ) 15 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/ATProtocolConfig.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | import work.socialhub.kbsky.domain.Service 4 | 5 | open class ATProtocolConfig { 6 | 7 | /** 8 | * URI of the PDS. 9 | */ 10 | var pdsUri: String = Service.BSKY_SOCIAL.uri 11 | 12 | /** 13 | * Change the URI to the PDS to which you belong when requesting a session-based API? 14 | * (If you use the Chat feature, you will need to change the URI to the PDS you belong to if you turn it off) 15 | */ 16 | var updatePdsUri: Boolean = true 17 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsViewerState.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class ActorDefsViewerState( 7 | var muted: Boolean? = null, 8 | var blockedBy: Boolean? = null, 9 | /** at-uri */ 10 | var blocking: String? = null, 11 | /** at-uri */ 12 | var following: String? = null, 13 | /** at-uri */ 14 | var followedBy: String? = null, 15 | val knownFollowers: ActorDefsKnownFollowers? = null, 16 | ) 17 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/BlueskyStreamConfig.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream 2 | 3 | import work.socialhub.kbsky.BlueskyConfig 4 | 5 | data class BlueskyStreamConfig( 6 | var jetStreamHost: String? = null, 7 | ) : BlueskyConfig() { 8 | 9 | companion object { 10 | val defaultJetStreamHosts = listOf( 11 | "jetstream1.us-east.bsky.network", 12 | "jetstream2.us-east.bsky.network", 13 | "jetstream1.us-west.bsky.network", 14 | "jetstream2.us-west.bsky.network", 15 | ) 16 | } 17 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedThreadgateFollowerRule.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class FeedThreadgateFollowerRule( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | ) : FeedThreadgateAllowUnion() { 12 | 13 | companion object { 14 | const val TYPE = BlueskyTypes.FeedThreadgate + "#followerRule" 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/richtext/RichtextFacetTag.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.richtext 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class RichtextFacetTag( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var tag: String = "", 12 | ) : RichtextFacetFeatureUnion() { 13 | 14 | companion object { 15 | const val TYPE = BlueskyTypes.RichtextFacet + "#tag" 16 | } 17 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedPostgateDisableRule.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class FeedPostgateDisableRule( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | ) : FeedPostgateEmbeddingRulesUnion() { 12 | 13 | companion object { 14 | const val TYPE = BlueskyTypes.FeedPostgate + "#disableRule" 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedThreadgateMentionRule.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class FeedThreadgateMentionRule( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | ) : FeedThreadgateAllowUnion() { 12 | 13 | companion object { 14 | const val TYPE = BlueskyTypes.FeedThreadgate + "#mentionRule" 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedSearchPostsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.feed.FeedDefsPostView 5 | 6 | @Serializable 7 | data class FeedSearchPostsResponse( 8 | var cursor: String? = null, 9 | 10 | /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ 11 | var hitsTotal: Int? = null, 12 | var posts: List = emptyList(), 13 | ) 14 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/unspecced/UnspeccedSearchFeedsResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.unspecced 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.app.bsky.undoc.UndocSearchFeedsPost 5 | import work.socialhub.kbsky.model.app.bsky.undoc.UndocSearchFeedsUser 6 | 7 | @Serializable 8 | data class UnspeccedSearchFeedsResponse( 9 | var cid: String? = null, 10 | var tid: String? = null, 11 | var user: UndocSearchFeedsUser? = null, 12 | var post: UndocSearchFeedsPost? = null, 13 | ) 14 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedThreadgateFollowingRule.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class FeedThreadgateFollowingRule( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | ) : FeedThreadgateAllowUnion() { 12 | 13 | companion object { 14 | const val TYPE = BlueskyTypes.FeedThreadgate + "#followingRule" 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/internal/_Auth.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth.internal 2 | 3 | import work.socialhub.kbsky.auth.Auth 4 | import work.socialhub.kbsky.auth.AuthConfig 5 | import work.socialhub.kbsky.auth.api.OAuthResource 6 | import work.socialhub.kbsky.auth.api.WellKnownResource 7 | 8 | class _Auth( 9 | val config: AuthConfig 10 | ) : Auth { 11 | 12 | var wellKnown: WellKnownResource = _WellKnownResource(config) 13 | var oauth: OAuthResource = _OAuthResource(config) 14 | 15 | override fun wellKnown() = wellKnown 16 | override fun oauth() = oauth 17 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/ATProtocolException.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | import work.socialhub.kbsky.api.entity.share.ErrorResponse 4 | 5 | data class ATProtocolException( 6 | override val message: String?, 7 | val exception: Exception?, 8 | val status: Int?, 9 | val body: String?, 10 | var response: ErrorResponse? = null, 11 | ) : RuntimeException( 12 | message, 13 | exception, 14 | ) { 15 | constructor(message: String?) : this(message, null, null, null) 16 | constructor(exception: Exception?) : this(null, exception, null, null) 17 | } 18 | -------------------------------------------------------------------------------- /core/src/nativeMain/kotlin/work/socialhub/kbsky/util/facet/FacetRegex.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.util.facet 2 | 3 | /** 4 | * Kotlin/Native 用のハッシュタグ正規表現 5 | * 6 | * Kotlin/Nativeの正規表現エンジンでは、#と#を明示的に文字クラスから除外し、 7 | * シンプルなパターンを使用することで正しく動作します。 8 | * (iOS, macOS, Windows, Linux すべての Native ターゲットで使用) 9 | */ 10 | internal actual fun getTagRegex(): Regex { 11 | 12 | // Kotlin/Native 用の調整された正規表現 13 | // - ##とスペースを文字クラスから除外 14 | // - 数字のみのハッシュタグを除外するため、数字以外の文字が最低1文字必要 15 | // - 先読みで区切り文字を確認 16 | return Regex("(?<=^|\\s)([##](?!\\ufe0f)(?=[^##\\s]*[^\\d##\\s])[^##\\s]+)(?=\\s|$)") 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedDeleteLikeRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.RKeyRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | /** 8 | * Uri includes the rkey. 9 | * so, uri or rkey is enough. 10 | */ 11 | data class FeedDeleteLikeRequest( 12 | override val auth: AuthProvider, 13 | override var uri: String? = null, 14 | override var rkey: String? = null, 15 | ) : AuthRequest(auth), RKeyRequest 16 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedDeletePostRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.RKeyRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | /** 8 | * Uri includes the rkey. 9 | * so, uri or rkey is enough. 10 | */ 11 | data class FeedDeletePostRequest( 12 | override val auth: AuthProvider, 13 | override var uri: String? = null, 14 | override var rkey: String? = null, 15 | ) : AuthRequest(auth), RKeyRequest 16 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/com/atproto/label/LabelDefsSelfLabels.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.com.atproto.label 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.ATProtocolTypes 6 | 7 | /** 8 | * Metadata tags on an atproto record, published by the author within the record. 9 | */ 10 | @Serializable 11 | data class LabelDefsSelfLabels( 12 | @SerialName("\$type") 13 | var type: String = ATProtocolTypes.LabelDefs + "#selfLabels", 14 | var values: List = emptyList(), 15 | ) 16 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | import java.util.Locale 2 | 3 | pluginManagement { 4 | includeBuild("plugins") 5 | repositories { 6 | google() 7 | mavenCentral() 8 | gradlePluginPortal() 9 | } 10 | } 11 | 12 | rootProject.name = "kbsky" 13 | 14 | include("core") 15 | include("stream") 16 | include("auth") 17 | 18 | // exclude "all" on Windows OS 19 | val osName = System.getProperty("os.name").lowercase(Locale.getDefault()) 20 | if (osName.contains("mac")) { 21 | include("all") 22 | } 23 | 24 | plugins { 25 | id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" 26 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedDeleteRepostRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.RKeyRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | /** 8 | * Uri includes the rkey. 9 | * so, uri or rkey is enough. 10 | */ 11 | data class FeedDeleteRepostRequest( 12 | override val auth: AuthProvider, 13 | override var uri: String? = null, 14 | override var rkey: String? = null, 15 | ) : AuthRequest(auth), RKeyRequest 16 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/server/ServerCreateSessionRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.server 2 | 3 | import work.socialhub.kbsky.api.entity.share.MapRequest 4 | 5 | data class ServerCreateSessionRequest( 6 | var identifier: String? = null, 7 | var password: String? = null, 8 | ) : MapRequest { 9 | 10 | override fun toMap(): Map { 11 | return mutableMapOf().also { 12 | it.addParam("identifier", identifier) 13 | it.addParam("password", password) 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/server/ServerGetSessionResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.server 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.server.DidDocUnion 5 | 6 | @Serializable 7 | data class ServerGetSessionResponse( 8 | var handle: String = "", 9 | var did: String = "", 10 | var email: String? = null, 11 | var emailConfirmed: Boolean? = null, 12 | var emailAuthFactor: Boolean? = null, 13 | var didDoc: DidDocUnion? = null, 14 | var active: Boolean? = null, 15 | ) 16 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsLogBeginConvo.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ConvoDefsLogBeginConvo( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var rev: String, 12 | var convoId: String, 13 | ) : ConvoDefsLogUnion() { 14 | companion object { 15 | const val TYPE = BlueskyTypes.ConvoDefs + "#logBeginConvo" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsLogLeaveConvo.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ConvoDefsLogLeaveConvo( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var rev: String, 12 | var convoId: String, 13 | ) : ConvoDefsLogUnion() { 14 | 15 | companion object { 16 | const val TYPE = BlueskyTypes.ConvoDefs + "#logLeaveConvo" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/com/atproto/repo/RepoStrongRef.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.com.atproto.repo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.model.com.atproto.moderation.ModerationSubjectUnion 6 | 7 | /** 8 | * A URI with a content-hash fingerprint. 9 | */ 10 | @Serializable 11 | data class RepoStrongRef( 12 | val uri: String = "", 13 | val cid: String = "", 14 | ) : ModerationSubjectUnion() { 15 | @SerialName("\$type") 16 | override val type: String = "com.atproto.repo.strongRef" 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedThreadgateListRule.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class FeedThreadgateListRule( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | // at-uri 12 | var list: String = "", 13 | ) : FeedThreadgateAllowUnion() { 14 | 15 | companion object { 16 | const val TYPE = BlueskyTypes.FeedThreadgate + "#listRule" 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/app/bsky/UnspeccedResource.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.app.bsky 2 | 3 | import work.socialhub.kbsky.api.entity.app.bsky.unspecced.UnspeccedGetPopularRequest 4 | import work.socialhub.kbsky.api.entity.app.bsky.unspecced.UnspeccedGetPopularResponse 5 | import work.socialhub.kbsky.api.entity.share.Response 6 | 7 | 8 | interface UnspeccedResource { 9 | 10 | /** 11 | * DEPRECATED: will be removed soon. Use a feed generator alternative. 12 | */ 13 | fun getPopular( 14 | request: UnspeccedGetPopularRequest 15 | ): Response 16 | } 17 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsNotFoundPost.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class FeedDefsNotFoundPost( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var uri: String? = null, 12 | var notFound: Boolean = true, 13 | ) : FeedDefsThreadUnion(), FeedDefsBookmarkItemUnion { 14 | companion object { 15 | val TYPE = BlueskyTypes.FeedDefs + "#notFoundPost" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/graph/GraphFollow.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.graph 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | import work.socialhub.kbsky.model.share.RecordUnion 7 | 8 | @Serializable 9 | data class GraphFollow( 10 | @SerialName("\$type") 11 | override var type: String = TYPE, 12 | var subject: String? = null, 13 | var createdAt: String? = null, 14 | ) : RecordUnion() { 15 | companion object { 16 | const val TYPE = BlueskyTypes.GraphFollow 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsMessageAndReactionView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ConvoDefsMessageAndReactionView( 9 | @SerialName("\$type") 10 | val type: String = TYPE, 11 | val message: ConvoDefsMessageView, 12 | val reaction: ConvoDefsReactionView, 13 | ) { 14 | companion object { 15 | const val TYPE = BlueskyTypes.ConvoDefs + "#messageAndReactionView" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedDeleteBookmarkRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedDeleteBookmarkRequest( 8 | override val auth: AuthProvider, 9 | val uri: String, 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("uri", uri) 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/identity/IdentityResolveHandleRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.identity 2 | 3 | import work.socialhub.kbsky.api.entity.share.MapRequest 4 | 5 | data class IdentityResolveHandleRequest( 6 | /** The handle to resolve. If not supplied, will resolve the host's own handle. */ 7 | var handle: String? = null 8 | ) : MapRequest { 9 | 10 | override fun toMap() = 11 | mutableMapOf().also { 12 | it.addParam("handle", handle) 13 | } 14 | 15 | fun handle(handle: String) = also { this.handle = handle } 16 | } 17 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/richtext/RichtextFacetLink.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.richtext 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | /** 8 | * A facet feature for links. 9 | */ 10 | @Serializable 11 | data class RichtextFacetLink( 12 | @SerialName("\$type") 13 | override var type: String = TYPE, 14 | var uri: String? = null, 15 | ) : RichtextFacetFeatureUnion() { 16 | 17 | companion object { 18 | const val TYPE = BlueskyTypes.RichtextFacet + "#link" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoGetLogRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoGetLogRequest( 8 | override val auth: AuthProvider, 9 | var cursor: String = "", 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("cursor", cursor) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/api/com/atproto/SyncResource.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.api.com.atproto 2 | 3 | import work.socialhub.kbsky.stream.api.entity.com.atproto.SyncSubscribeReposRequest 4 | import work.socialhub.kbsky.stream.entity.com.atproto.SyncStreamClient 5 | 6 | /** 7 | * ATProtocol/Sync 8 | * [Reference](https://atproto.com/lexicons/com-atproto-sync#comatprotosyncsubscriberepos) 9 | */ 10 | interface SyncResource { 11 | /** 12 | * [WIP] 13 | * Subscribe to repo updates 14 | */ 15 | fun subscribeRepos( 16 | request: SyncSubscribeReposRequest 17 | ): SyncStreamClient 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetPostsRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedGetPostsRequest( 8 | override val auth: AuthProvider, 9 | var uris: List? = null, 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("uris", uris) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphMuteActorRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphMuteActorRequest( 8 | override val auth: AuthProvider, 9 | var actor: String? = null, 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("actor", actor) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/video/VideoGetJobStatusRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.video 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class VideoGetJobStatusRequest( 8 | override val auth: AuthProvider, 9 | val jobId: String, 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("jobId", jobId) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/richtext/RichtextFacetMention.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.richtext 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | /** 8 | * A facet feature for actor mentions. 9 | */ 10 | @Serializable 11 | data class RichtextFacetMention( 12 | @SerialName("\$type") 13 | override var type: String = TYPE, 14 | var did: String? = null, 15 | ) : RichtextFacetFeatureUnion() { 16 | 17 | companion object { 18 | const val TYPE = BlueskyTypes.RichtextFacet + "#mention" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/actor/ActorGetProfileRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.actor 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ActorGetProfileRequest( 8 | override val auth: AuthProvider, 9 | var actor: String? = null, 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("actor", actor) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphUnmuteActorRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphUnmuteActorRequest( 8 | override val auth: AuthProvider, 9 | var actor: String? = null, 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("actor", actor) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoGetConvoRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoGetConvoRequest( 8 | override val auth: AuthProvider, 9 | var convoId: String = "", 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("convoId", convoId) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoMuteConvoRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoMuteConvoRequest( 8 | override val auth: AuthProvider, 9 | var convoId: String = "", 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("convoId", convoId) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsLogDeleteMessage.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ConvoDefsLogDeleteMessage( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var rev: String, 12 | var convoId: String, 13 | var message: ConvoDefsMessageUnion, 14 | ) : ConvoDefsLogUnion() { 15 | companion object { 16 | const val TYPE = BlueskyTypes.ConvoDefs + "#logDeleteMessage" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsLogReadMessage.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ConvoDefsLogReadMessage( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var rev: String, 12 | var convoId: String, 13 | var message: ConvoDefsMessageUnion, 14 | ) : ConvoDefsLogUnion() { 15 | 16 | companion object { 17 | const val TYPE = BlueskyTypes.ConvoDefs + "#logReadMessage" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoLeaveConvoRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoLeaveConvoRequest( 8 | override val auth: AuthProvider, 9 | var convoId: String = "", 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("convoId", convoId) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoUnmuteConvoRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoUnmuteConvoRequest( 8 | override val auth: AuthProvider, 9 | var convoId: String = "", 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("convoId", convoId) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedPostgateEmbeddingRulesUnion.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.util.json.PostgateEmbeddingRulesUnionPolymorphicSerializer 6 | 7 | /** 8 | * @see FeedPostgateDisableRule 9 | */ 10 | @Serializable(with = PostgateEmbeddingRulesUnionPolymorphicSerializer::class) 11 | abstract class FeedPostgateEmbeddingRulesUnion { 12 | @SerialName("\$type") 13 | abstract var type: String 14 | 15 | val asPostgateDisableRule get() = this as? FeedPostgateDisableRule 16 | } 17 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/video/JobStatus.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.video 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.share.Blob 5 | 6 | @Serializable 7 | data class JobStatus( 8 | val jobId: String, 9 | val did: String, 10 | // The state of the video processing job. All values not listed as a known value indicate that the job is in process. 11 | // ["JOB_STATE_COMPLETED", "JOB_STATE_FAILED"] 12 | val state: String, 13 | val progress: Int? = null, 14 | val blob: Blob? = null, 15 | val error: String? = null, 16 | val message: String? = null, 17 | ) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsLogCreateMessage.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ConvoDefsLogCreateMessage( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var rev: String, 12 | var convoId: String, 13 | var message: ConvoDefsMessageUnion, 14 | ) : ConvoDefsLogUnion() { 15 | 16 | companion object { 17 | const val TYPE = BlueskyTypes.ConvoDefs + "#logCreateMessage" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/actor/ActorGetProfilesRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.actor 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ActorGetProfilesRequest( 8 | override val auth: AuthProvider, 9 | var actors: List? = null, 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("actors", actors) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetStarterPacksRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphGetStarterPacksRequest( 8 | override val auth: AuthProvider, 9 | var uris: List? = null, 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("uris", uris) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/graph/GraphBlock.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.graph 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | import work.socialhub.kbsky.model.share.RecordUnion 7 | 8 | /** 9 | * A block. 10 | */ 11 | @Serializable 12 | data class GraphBlock( 13 | @SerialName("\$type") 14 | override var type: String = TYPE, 15 | var subject: String? = null, 16 | var createdAt: String? = null, 17 | ) : RecordUnion() { 18 | companion object { 19 | const val TYPE = BlueskyTypes.GraphBlock 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsConvoView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.chat.bsky.actor.ActorDefsProfileViewBasic 5 | 6 | /** 7 | * chat.bsky.convo.defs#convoView 8 | */ 9 | @Serializable 10 | data class ConvoDefsConvoView( 11 | val id: String, 12 | val rev: String, 13 | val members: List, 14 | val lastMessage: ConvoDefsMessageUnion? = null, 15 | val lastReaction: ConvoDefsMessageAndReactionView? = null, 16 | val muted: Boolean = false, 17 | val unreadCount: Int = 0, 18 | ) -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Gradle 2 | org.gradle.jvmargs=-Xmx3g 3 | org.gradle.parallel=true 4 | org.gradle.daemon=true 5 | 6 | # Kotlin 7 | kotlin.code.style=official 8 | kotlin.daemon.jvm.options=-Xmx3g 9 | kotlin.incremental=true 10 | 11 | # Dokka 12 | org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled 13 | org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true 14 | 15 | # Maven Central publishing configuration 16 | # for com.vanniktech.maven.publish 17 | mavenCentralPublishing=true 18 | mavenCentralAutomaticPublishing=true 19 | 20 | # Java Toolchain Auto-Provisioning 21 | org.gradle.java.installations.auto-detect=true 22 | org.gradle.java.installations.auto-download=true -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/graph/GraphListItem.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.graph 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | import work.socialhub.kbsky.model.share.RecordUnion 7 | 8 | @Serializable 9 | data class GraphListItem( 10 | @SerialName("\$type") 11 | override var type: String = TYPE, 12 | var subject: String? = null, 13 | var list: String? = null, 14 | var createdAt: String? = null, 15 | ) : RecordUnion() { 16 | companion object { 17 | const val TYPE = BlueskyTypes.GraphListItem 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/labeler/LabelerViewUnion.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.labeler 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.util.json.LabelerViewPolymorphicSerializer 6 | 7 | /** 8 | * @see LabelerView 9 | * @see LabelerViewDetailed 10 | */ 11 | @Serializable(with = LabelerViewPolymorphicSerializer::class) 12 | abstract class LabelerViewUnion { 13 | @SerialName("\$type") 14 | abstract var type: String 15 | 16 | val asLabelerView get() = this as? LabelerView 17 | val asLabelerViewDetailed get() = this as? LabelerViewDetailed 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/plc/DIDDetails.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.plc 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.server.DidDocUnion 5 | 6 | @Serializable 7 | data class DIDDetails( 8 | var id: String? = null, 9 | var alsoKnownAs: List? = null, 10 | var verificationMethod: List? = null, 11 | var service: List? = null, 12 | ) : DidDocUnion() { 13 | 14 | fun pdsEndpoint(): String? { 15 | return service 16 | ?.firstOrNull { it.id == "#atproto_pds" } 17 | ?.serviceEndpoint 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/BlueskyStreamFactory.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream 2 | 3 | import io.ktor.http.Url 4 | import work.socialhub.kbsky.stream.internal.app.bsky._BlueskyStream 5 | 6 | object BlueskyStreamFactory { 7 | 8 | fun instance( 9 | jetStreamUri: String, 10 | ): BlueskyStream { 11 | return _BlueskyStream( 12 | BlueskyStreamConfig().also { 13 | it.jetStreamHost = Url(jetStreamUri).host 14 | }) 15 | } 16 | 17 | fun instance( 18 | config: BlueskyStreamConfig = BlueskyStreamConfig(), 19 | ): BlueskyStream { 20 | return _BlueskyStream(config) 21 | } 22 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetFeedGeneratorRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedGetFeedGeneratorRequest( 8 | override val auth: AuthProvider, 9 | /** at-uri */ 10 | var feed: String? = null, 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("feed", feed) 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetStarterPackRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphGetStarterPackRequest( 8 | override val auth: AuthProvider, 9 | var starterPack: String? = null, 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | it.addParam("starterPack", starterPack) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/server/ServerCreateSessionResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.server 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.server.DidDocUnion 5 | 6 | @Serializable 7 | data class ServerCreateSessionResponse( 8 | var accessJwt: String = "", 9 | var refreshJwt: String = "", 10 | var handle: String = "", 11 | var did: String = "", 12 | 13 | var email: String? = null, 14 | var emailConfirmed: Boolean? = null, 15 | var emailAuthFactor: Boolean? = null, 16 | var didDoc: DidDocUnion? = null, 17 | var active: Boolean? = null, 18 | ) 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsReasonUnion.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.util.json.FeedDefsReasonPolymorphicSerializer 6 | 7 | /** 8 | * @see FeedDefsReasonRepost 9 | * @see FeedDefsReasonPin 10 | */ 11 | @Serializable(with = FeedDefsReasonPolymorphicSerializer::class) 12 | abstract class FeedDefsReasonUnion { 13 | @SerialName("\$type") 14 | abstract var type: String 15 | 16 | val asReasonRepost get() = this as? FeedDefsReasonRepost 17 | val asReasonPin get() = this as? FeedDefsReasonPin 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsThreadViewPost.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class FeedDefsThreadViewPost( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var post: FeedDefsPostView? = null, 12 | var parent: FeedDefsThreadUnion? = null, 13 | var replies: List? = null, 14 | ) : FeedDefsThreadUnion() { 15 | companion object { 16 | val TYPE = BlueskyTypes.FeedDefs + "#threadViewPost" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonTest/kotlin/work/socialhub/kbsky/plc/GetDetailsTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.plc 2 | 3 | import work.socialhub.kbsky.PLCDirectoryFactory 4 | import kotlin.test.Test 5 | 6 | class GetDetailsTest() { 7 | 8 | @Test 9 | fun testGetDetails() { 10 | val did = "did:plc:bwdof2anluuf5wmfy2upgulw" 11 | 12 | val response = PLCDirectoryFactory 13 | .instance() 14 | .DIDDetails(did) 15 | 16 | response.data.service?.forEach { 17 | println(it.id) 18 | println(it.type) 19 | println(it.serviceEndpoint) 20 | } 21 | 22 | println(checkNotNull(response.data.alsoKnownAs)[0]) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsDeletedMessageView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ConvoDefsDeletedMessageView( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var id: String, 12 | var rev: String, 13 | var sender: ConvoDefsMessageViewSender, 14 | var sentAt: String, 15 | ) : ConvoDefsMessageUnion() { 16 | companion object { 17 | const val TYPE = BlueskyTypes.ConvoDefs + "#deletedMessageView" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetFeedGeneratorsRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedGetFeedGeneratorsRequest( 8 | override val auth: AuthProvider, 9 | /** at-uri */ 10 | var feeds: List? = null, 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("feeds", feeds) 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsThreadUnion.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.util.json.FeedDefsThreadPolymorphicSerializer 6 | 7 | /** 8 | * @see FeedDefsThreadViewPost 9 | * @see FeedDefsNotFoundPost 10 | */ 11 | @Serializable(with = FeedDefsThreadPolymorphicSerializer::class) 12 | abstract class FeedDefsThreadUnion { 13 | @SerialName("\$type") 14 | abstract var type: String 15 | 16 | val asViewPost get() = this as? FeedDefsThreadViewPost 17 | val asNotFoundPost get() = this as? FeedDefsNotFoundPost 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedThreadgate.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | import work.socialhub.kbsky.model.share.RecordUnion 7 | 8 | @Serializable 9 | data class FeedThreadgate( 10 | @SerialName("\$type") 11 | override var type: String = TYPE, 12 | var createdAt: String? = null, 13 | var post: String? = null, 14 | var allow: List? = null, 15 | ) : RecordUnion() { 16 | companion object { 17 | const val TYPE = BlueskyTypes.FeedThreadgate 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsLogAddReaction.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ConvoDefsLogAddReaction( 9 | @SerialName("\$type") 10 | override val type: String = TYPE, 11 | val rev: String, 12 | val convoId: String, 13 | val message: ConvoDefsMessageUnion, 14 | val reaction: ConvoDefsReactionView, 15 | ) : ConvoDefsLogUnion() { 16 | companion object { 17 | const val TYPE = BlueskyTypes.ConvoDefs + "#logAddReaction" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/api/entity/oauth/OAuthTokenResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth.api.entity.oauth 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class OAuthTokenResponse( 8 | 9 | @SerialName("access_token") 10 | val accessToken: String, 11 | 12 | @SerialName("token_type") 13 | val tokenType: String, 14 | 15 | @SerialName("refresh_token") 16 | val refreshToken: String, 17 | 18 | @SerialName("scope") 19 | val scope: String, 20 | 21 | @SerialName("expires_in") 22 | val expiresIn: Int = -1, 23 | 24 | @SerialName("sub") 25 | val sub: String, 26 | ) 27 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/share/ErrorResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.share 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class ErrorResponse( 8 | var message: String = "", 9 | var error: String, 10 | // for OAuth 11 | @SerialName("error_description") 12 | var errorDescription: String = "", 13 | ) { 14 | 15 | fun messageForDisplay(): String { 16 | return if (errorDescription.isNotEmpty()) { 17 | // OAuth error 18 | "$error: $errorDescription" 19 | } else { 20 | message.ifBlank { error } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsLogRemoveReaction.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ConvoDefsLogRemoveReaction( 9 | @SerialName("\$type") 10 | override val type: String = TYPE, 11 | val rev: String, 12 | val convoId: String, 13 | val message: ConvoDefsMessageUnion, 14 | val reaction: ConvoDefsReactionView, 15 | ) : ConvoDefsLogUnion() { 16 | companion object { 17 | const val TYPE = BlueskyTypes.ConvoDefs + "#logRemoveReaction" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedCreateBookmarkRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedCreateBookmarkRequest( 8 | override val auth: AuthProvider, 9 | val uri: String, 10 | val cid: String, 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("uri", uri) 16 | it.addParam("cid", cid) 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/graph/GraphDefsListItemView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.graph 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileView 7 | 8 | /** 9 | * List Item 10 | */ 11 | @Serializable 12 | data class GraphDefsListItemView( 13 | @SerialName("\$type") 14 | var type: String = TYPE, 15 | var uri: String? = null, 16 | var subject: ActorDefsProfileView? = null, 17 | ) { 18 | companion object { 19 | const val TYPE = BlueskyTypes.GraphDefs + "#listItemView" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedImagesView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class EmbedImagesView( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var images: List? = null, 12 | ) : EmbedViewUnion() { 13 | 14 | companion object { 15 | const val TYPE = BlueskyTypes.EmbedImages + "#view" 16 | } 17 | 18 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 19 | constructor() : this(TYPE, null) 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedExternalView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class EmbedExternalView( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var external: EmbedExternalViewExternal? = null, 12 | ) : EmbedViewUnion() { 13 | 14 | companion object { 15 | const val TYPE = BlueskyTypes.EmbedExternal + "#view" 16 | } 17 | 18 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 19 | constructor() : this(TYPE, null) 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedRecordViewBlocked.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class EmbedRecordViewBlocked( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var uri: String? = null, 12 | ) : EmbedRecordViewUnion() { 13 | 14 | companion object { 15 | const val TYPE = BlueskyTypes.EmbedRecord + "#viewBlocked" 16 | } 17 | 18 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 19 | constructor() : this(TYPE, null) 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedRecordViewNotFound.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class EmbedRecordViewNotFound( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var uri: String? = null, 12 | ) : EmbedRecordViewUnion() { 13 | 14 | companion object { 15 | const val TYPE = BlueskyTypes.EmbedRecord + "#viewNotFound" 16 | } 17 | 18 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 19 | constructor() : this(TYPE, null) 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/NetworkConfig.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky 2 | 3 | open class NetworkConfig { 4 | 5 | /** 6 | * Specifies a request timeout in milliseconds. 7 | * 8 | * https://ktor.io/docs/client-timeout.html 9 | */ 10 | var requestTimeoutMillis: Long? = null 11 | 12 | /** 13 | * Specifies a connection timeout in milliseconds. 14 | * 15 | * https://ktor.io/docs/client-timeout.html 16 | */ 17 | var connectTimeoutMillis: Long? = null 18 | 19 | /** 20 | * Specifies a socket timeout (read and write) in milliseconds. 21 | * 22 | * https://ktor.io/docs/client-timeout.html 23 | */ 24 | var socketTimeoutMillis: Long? = null 25 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/com/atproto/moderation/ModerationSubjectUnion.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.com.atproto.moderation 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.model.com.atproto.repo.RepoRef 6 | import work.socialhub.kbsky.model.com.atproto.repo.RepoStrongRef 7 | 8 | /** 9 | * @see RepoRef 10 | * @see RepoStrongRef 11 | */ 12 | @Serializable(with = ModerationSubjectUnionSerializer::class) 13 | abstract class ModerationSubjectUnion { 14 | @SerialName("\$type") 15 | abstract val type: String 16 | 17 | val asRef get() = this as? RepoRef 18 | val asStrongRef get() = this as? RepoStrongRef 19 | } 20 | -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/app/bsky/notification/UpdateSeenTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.app.bsky.notification 2 | 3 | import work.socialhub.kbsky.AbstractTest 4 | import work.socialhub.kbsky.BlueskyFactory 5 | import work.socialhub.kbsky.api.entity.app.bsky.notification.NotificationUpdateSeenRequest 6 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 7 | import kotlin.test.Test 8 | 9 | class UpdateSeenTest : AbstractTest() { 10 | 11 | @Test 12 | fun testUpdateSeen() { 13 | BlueskyFactory 14 | .instance(BSKY_SOCIAL.uri) 15 | .notification() 16 | .updateSeen( 17 | NotificationUpdateSeenRequest(auth()) 18 | ) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/app/bsky/LabelerResource.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.app.bsky 2 | 3 | import work.socialhub.kbsky.api.entity.app.bsky.labeler.LabelerGetServicesRequest 4 | import work.socialhub.kbsky.api.entity.app.bsky.labeler.LabelerGetServicesResponse 5 | import work.socialhub.kbsky.api.entity.share.Response 6 | 7 | /** 8 | * Bluesky/Labeler 9 | * [Reference](https://github.com/bluesky-social/atproto/tree/main/lexicons/app/bsky/labeler) 10 | */ 11 | interface LabelerResource { 12 | 13 | /** 14 | * Get information about a list of labeler services. 15 | */ 16 | fun getServices( 17 | request: LabelerGetServicesRequest 18 | ): Response 19 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetPostThreadRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedGetPostThreadRequest( 8 | override val auth: AuthProvider, 9 | var uri: String = "", 10 | var depth: Int? = null, 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("uri", uri) 16 | it.addParam("depth", depth) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/share/MapRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.share 2 | 3 | import work.socialhub.kbsky.internal.share._InternalUtility 4 | 5 | interface MapRequest { 6 | 7 | fun toMappedJson(): String { 8 | return _InternalUtility.toJson(toMap()) 9 | } 10 | 11 | fun toMap(): Map 12 | 13 | fun MutableMap.addParam( 14 | key: String, 15 | value: Any? 16 | ) { 17 | if (value == null) { 18 | return 19 | } 20 | if (value is String) { 21 | if (value.isBlank()) { 22 | return 23 | } 24 | } 25 | this[key] = value 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/auth/UnauthenticatedAuthProvider.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth 2 | 3 | import work.socialhub.khttpclient.HttpRequest 4 | import work.socialhub.khttpclient.HttpResponse 5 | 6 | class UnauthenticatedAuthProvider: AuthProvider { 7 | 8 | override fun beforeRequestHook(method: String, request: HttpRequest) { 9 | // Nothing to do 10 | } 11 | 12 | override fun afterRequestHook(method: String, request: HttpRequest, response: HttpResponse): Boolean { 13 | // Do nothing here 14 | return false 15 | } 16 | 17 | override val did: String = "" 18 | override val pdsDid: String = "" 19 | override var acceptLabelers: List = emptyList() 20 | 21 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsBookmarkItemUnion.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.util.json.FeedDefsBookmarkPolymorphicSerializer 6 | 7 | /** 8 | * @see FeedDefsNotFoundPost 9 | * @see FeedDefsPostView 10 | */ 11 | @Serializable(with = FeedDefsBookmarkPolymorphicSerializer::class) 12 | interface FeedDefsBookmarkItemUnion { 13 | @SerialName("\$type") 14 | val type: String 15 | } 16 | 17 | val FeedDefsBookmarkItemUnion.asNotFoundPost get() = this as? FeedDefsNotFoundPost 18 | val FeedDefsBookmarkItemUnion.asPostView get() = this as? FeedDefsPostView -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/chat/bsky/convo/ConvoDefsMessageUnion.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.chat.bsky.convo 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.util.json.ChatConvoDefsMessageUnionSerializer 6 | 7 | /** 8 | * @see ConvoDefsMessageView 9 | * @see ConvoDefsDeletedMessageView 10 | */ 11 | @Serializable(with = ChatConvoDefsMessageUnionSerializer::class) 12 | abstract class ConvoDefsMessageUnion { 13 | @SerialName("\$type") 14 | abstract val type: String 15 | 16 | val asMessageView get() = this as? ConvoDefsMessageView 17 | val asDeletedMessageView get() = this as? ConvoDefsDeletedMessageView 18 | } 19 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetBookmarksRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedGetBookmarksRequest( 8 | override val auth: AuthProvider, 9 | val limit: Int? = null, 10 | val cursor: String? = null, 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("limit", limit) 16 | it.addParam("cursor", cursor) 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetBlocksRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphGetBlocksRequest( 8 | override val auth: AuthProvider, 9 | var limit: Int? = null, 10 | var cursor: String? = null, 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("limit", limit) 16 | it.addParam("cursor", cursor) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetMutesRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphGetMutesRequest( 8 | override val auth: AuthProvider, 9 | var limit: Int? = null, 10 | var cursor: String? = null, 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("limit", limit) 16 | it.addParam("cursor", cursor) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/com/atproto/ModerationResource.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.com.atproto 2 | 3 | import work.socialhub.kbsky.api.entity.com.atproto.moderation.ModerationCreateReportRequest 4 | import work.socialhub.kbsky.api.entity.com.atproto.moderation.ModerationCreateReportResponse 5 | import work.socialhub.kbsky.api.entity.share.Response 6 | 7 | /** 8 | * ATProtocol/Moderation 9 | * [Reference](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto/moderation) 10 | */ 11 | interface ModerationResource { 12 | 13 | /** 14 | * レポートを作成する 15 | */ 16 | fun createReport( 17 | request: ModerationCreateReportRequest 18 | ): Response 19 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/auth/AuthProvider.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth 2 | 3 | import work.socialhub.khttpclient.HttpRequest 4 | import work.socialhub.khttpclient.HttpResponse 5 | 6 | interface AuthProvider { 7 | fun beforeRequestHook( 8 | method: String, 9 | request: HttpRequest, 10 | ) 11 | 12 | /** 13 | * @return If true, retry only once 14 | */ 15 | fun afterRequestHook( 16 | method: String, 17 | request: HttpRequest, 18 | response: HttpResponse, 19 | ): Boolean 20 | 21 | val did: String 22 | val pdsDid: String 23 | 24 | // TODO: This is a temporary solution to avoid circular dependencies1 25 | var acceptLabelers: List 26 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsAdultContentPref.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ActorDefsAdultContentPref( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var enabled: Boolean = false, 12 | ) : ActorDefsPreferencesUnion() { 13 | 14 | companion object { 15 | const val TYPE = BlueskyTypes.ActorDefs + "#adultContentPref" 16 | } 17 | 18 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 19 | constructor() : this(TYPE, false) 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoGetListConvosRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoGetListConvosRequest( 8 | override val auth: AuthProvider, 9 | var limit: Int? = null, 10 | var cursor: String? = null, 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("limit", limit) 16 | it.addParam("cursor", cursor) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedLike.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | import work.socialhub.kbsky.model.com.atproto.repo.RepoStrongRef 7 | import work.socialhub.kbsky.model.share.RecordUnion 8 | 9 | @Serializable 10 | data class FeedLike( 11 | @SerialName("\$type") 12 | override var type: String = TYPE, 13 | var subject: RepoStrongRef? = null, 14 | var createdAt: String? = null, 15 | val via: RepoStrongRef? = null, 16 | ) : RecordUnion() { 17 | companion object { 18 | const val TYPE = BlueskyTypes.FeedLike 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/ATProtocolStreamFactory.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream 2 | 3 | import work.socialhub.kbsky.stream.internal.com.atproto._ATProtocolStream 4 | 5 | object ATProtocolStreamFactory { 6 | 7 | fun instance( 8 | pdsUri: String, 9 | firehoseUri: String, 10 | ): ATProtocolStream { 11 | return _ATProtocolStream( 12 | ATProtocolStreamConfig().also { 13 | it.pdsUri = pdsUri 14 | it.firehoseUri = firehoseUri 15 | }) 16 | } 17 | 18 | fun instance( 19 | config: ATProtocolStreamConfig = ATProtocolStreamConfig(), 20 | ): ATProtocolStream { 21 | return _ATProtocolStream(config) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedRecord.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | import work.socialhub.kbsky.model.com.atproto.repo.RepoStrongRef 7 | 8 | @Serializable 9 | data class EmbedRecord( 10 | @SerialName("\$type") 11 | override var type: String = TYPE, 12 | var record: RepoStrongRef? = null, 13 | ) : EmbedUnion() { 14 | 15 | companion object { 16 | const val TYPE = BlueskyTypes.EmbedRecord 17 | } 18 | 19 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 20 | constructor() : this(TYPE, null) 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedRepost.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | import work.socialhub.kbsky.model.com.atproto.repo.RepoStrongRef 7 | import work.socialhub.kbsky.model.share.RecordUnion 8 | 9 | @Serializable 10 | data class FeedRepost( 11 | @SerialName("\$type") 12 | override var type: String = TYPE, 13 | var subject: RepoStrongRef? = null, 14 | var createdAt: String? = null, 15 | val via: RepoStrongRef? = null, 16 | ) : RecordUnion() { 17 | companion object { 18 | const val TYPE = BlueskyTypes.FeedRepost 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/app/bsky/graph/UnmuteTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.AbstractTest 4 | import work.socialhub.kbsky.BlueskyFactory 5 | import work.socialhub.kbsky.api.entity.app.bsky.graph.GraphUnmuteActorRequest 6 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 7 | import kotlin.test.Test 8 | 9 | class UnmuteTest : AbstractTest() { 10 | 11 | @Test 12 | fun testUnmute() { 13 | BlueskyFactory 14 | .instance(BSKY_SOCIAL.uri) 15 | .graph() 16 | .unmuteActor( 17 | GraphUnmuteActorRequest(auth()).also { 18 | it.actor = "bsky.app" 19 | } 20 | ) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoUpdateReadRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoUpdateReadRequest( 8 | override val auth: AuthProvider, 9 | var convoId: String = "", 10 | var messageId: String = "", 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("convoId", convoId) 16 | it.addParam("messageId", messageId) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/com/atproto/label/LabelDefsLabelValueDefinition.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.com.atproto.label 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class LabelDefsLabelValueDefinition( 7 | // The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). 8 | var identifier: String = "", 9 | // "inform", "alert", "none" 10 | var severity: String = "", 11 | // "content", "media", "none" 12 | var blurs: String = "", 13 | // "ignore", "warn", "hide" 14 | var defaultSetting: String = "", 15 | var adultOnly: Boolean = false, 16 | var locales: List = emptyList(), 17 | ) 18 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsSavedFeedsPrefV2.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ActorDefsSavedFeedsPrefV2( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var items: List = emptyList(), 12 | ) : ActorDefsPreferencesUnion() { 13 | 14 | companion object { 15 | const val TYPE = BlueskyTypes.ActorDefs + "#savedFeedsPrefV2" 16 | } 17 | 18 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 19 | constructor() : this(TYPE, emptyList()) 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedRecordViewDetached.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class EmbedRecordViewDetached( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var uri: String? = null, 12 | var detached: Boolean = true, 13 | ) : EmbedRecordViewUnion() { 14 | 15 | companion object { 16 | const val TYPE = BlueskyTypes.EmbedRecord + "#viewDetached" 17 | } 18 | 19 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 20 | constructor() : this(TYPE, null, true) 21 | } 22 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/internal/app/bsky/_BlueskyStream.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.internal.app.bsky 2 | 3 | import work.socialhub.kbsky.Bluesky 4 | import work.socialhub.kbsky.internal._Bluesky 5 | import work.socialhub.kbsky.stream.BlueskyStream 6 | import work.socialhub.kbsky.stream.BlueskyStreamConfig 7 | import work.socialhub.kbsky.stream.api.app.bsky.JetStreamResource 8 | 9 | class _BlueskyStream( 10 | config: BlueskyStreamConfig 11 | ) : BlueskyStream { 12 | 13 | protected val bluesky: Bluesky = _Bluesky(config) 14 | 15 | protected val jetStream: JetStreamResource = _JetStreamResource(this.bluesky, config) 16 | 17 | /** 18 | * {@inheritDoc} 19 | */ 20 | override fun jetStream() = jetStream 21 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedImages.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | /** 8 | * A set of images embedded in some other form of content 9 | */ 10 | @Serializable 11 | data class EmbedImages( 12 | @SerialName("\$type") 13 | override var type: String = TYPE, 14 | var images: List? = null, 15 | ) : EmbedUnion() { 16 | 17 | companion object { 18 | const val TYPE = BlueskyTypes.EmbedImages 19 | } 20 | 21 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 22 | constructor() : this(TYPE, null) 23 | } 24 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedPostgate.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | import work.socialhub.kbsky.model.share.RecordUnion 7 | 8 | @Serializable 9 | data class FeedPostgate( 10 | @SerialName("\$type") 11 | override var type: String = TYPE, 12 | var createdAt: String? = null, 13 | var post: String? = null, 14 | var detachedEmbeddingUris: List? = null, 15 | var embeddingRules: List? = null, 16 | ) : RecordUnion() { 17 | companion object { 18 | const val TYPE = BlueskyTypes.FeedPostgate 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/app/bsky/graph/GetBlocksTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.AbstractTest 4 | import work.socialhub.kbsky.BlueskyFactory 5 | import work.socialhub.kbsky.api.entity.app.bsky.graph.GraphGetBlocksRequest 6 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 7 | import kotlin.test.Test 8 | 9 | class GetBlocksTest : AbstractTest() { 10 | 11 | @Test 12 | fun testGetBlocks() { 13 | val response = BlueskyFactory 14 | .instance(BSKY_SOCIAL.uri) 15 | .graph() 16 | .getBlocks( 17 | GraphGetBlocksRequest(auth()) 18 | ) 19 | 20 | response.data.blocks 21 | .forEach { print(it) } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoDeleteMessageForSelfRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoDeleteMessageForSelfRequest( 8 | override val auth: AuthProvider, 9 | var convoId: String = "", 10 | var messageId: String = "", 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("convoId", convoId) 16 | it.addParam("messageId", messageId) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsLabelersPref.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ActorDefsLabelersPref( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | @SerialName("labelers") 12 | var labelers: List? = null, 13 | ) : ActorDefsPreferencesUnion() { 14 | 15 | companion object { 16 | const val TYPE = BlueskyTypes.ActorDefs + "#labelersPref" 17 | } 18 | 19 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 20 | constructor() : this(TYPE, null) 21 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/notification/NotificationListNotificationsRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.notification 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class NotificationListNotificationsRequest( 8 | override val auth: AuthProvider, 9 | var limit: Int? = null, 10 | var cursor: String? = null, 11 | ) : AuthRequest(auth), MapRequest { 12 | 13 | override fun toMap(): Map { 14 | return mutableMapOf().also { 15 | it.addParam("limit", limit) 16 | it.addParam("cursor", cursor) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoGetConvoForMembersRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoGetConvoForMembersRequest( 8 | override val auth: AuthProvider, 9 | var members: List = emptyList(), 10 | ) : AuthRequest(auth), MapRequest { 11 | 12 | override fun toMap(): Map { 13 | return mutableMapOf().also { 14 | // the API seems to be support one member only in 2024/06/25 15 | it.addParam("members", members.first()) 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /stream/src/commonMain/kotlin/work/socialhub/kbsky/stream/internal/com/atproto/_ATProtocolStream.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.stream.internal.com.atproto 2 | 3 | import work.socialhub.kbsky.ATProtocol 4 | import work.socialhub.kbsky.internal._ATProtocol 5 | import work.socialhub.kbsky.stream.ATProtocolStream 6 | import work.socialhub.kbsky.stream.ATProtocolStreamConfig 7 | import work.socialhub.kbsky.stream.api.com.atproto.SyncResource 8 | 9 | class _ATProtocolStream( 10 | config: ATProtocolStreamConfig 11 | ) : ATProtocolStream { 12 | 13 | protected val atproto: ATProtocol = _ATProtocol(config) 14 | 15 | protected val sync: SyncResource = _SyncResource(this.atproto, config) 16 | 17 | /** 18 | * {@inheritDoc} 19 | */ 20 | override fun sync() = sync 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphEditListRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.auth.AuthProvider 5 | import work.socialhub.kbsky.model.app.bsky.richtext.RichtextFacet 6 | import work.socialhub.kbsky.model.com.atproto.label.LabelDefsSelfLabels 7 | import work.socialhub.kbsky.model.share.Blob 8 | 9 | data class GraphEditListRequest( 10 | override val auth: AuthProvider, 11 | val listUri: String, 12 | val name: String, 13 | val description: String?, 14 | val descriptionFacets: List? = null, 15 | val avatar: Blob? = null, 16 | var labels: LabelDefsSelfLabels? = null, 17 | ) : AuthRequest(auth) -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsPersonalDetailsPref.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ActorDefsPersonalDetailsPref( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | /** The birth date of account owner. */ 12 | var birthDate: String? = null, 13 | ) : ActorDefsPreferencesUnion() { 14 | 15 | companion object { 16 | const val TYPE = BlueskyTypes.ActorDefs + "#personalDetailsPref" 17 | } 18 | 19 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 20 | constructor() : this(TYPE, null) 21 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedRecordWithMedia.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class EmbedRecordWithMedia( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var record: EmbedRecord? = null, 12 | /** only external and images */ 13 | var media: EmbedUnion? = null, 14 | ) : EmbedUnion() { 15 | 16 | companion object { 17 | const val TYPE = BlueskyTypes.EmbedRecordWithMedia 18 | } 19 | 20 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 21 | constructor() : this(TYPE, null, null) 22 | } 23 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/feed/FeedDefsReasonRepost.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.feed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | import work.socialhub.kbsky.model.app.bsky.actor.ActorDefsProfileViewBasic 7 | 8 | @Serializable 9 | data class FeedDefsReasonRepost( 10 | @SerialName("\$type") 11 | override var type: String = TYPE, 12 | var by: ActorDefsProfileViewBasic? = null, 13 | var uri: String? = null, 14 | var cid: String? = null, 15 | var indexedAt: String? = null, 16 | ) : FeedDefsReasonUnion() { 17 | 18 | companion object { 19 | val TYPE = BlueskyTypes.FeedDefs + "#reasonRepost" 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/richtext/RichtextFacetFeatureUnion.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.richtext 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.util.json.RichtextFacetFeaturePolymorphicSerializer 6 | 7 | /** 8 | * @see RichtextFacetLink 9 | * @see RichtextFacetMention 10 | * @see RichtextFacetTag 11 | */ 12 | @Serializable(with = RichtextFacetFeaturePolymorphicSerializer::class) 13 | abstract class RichtextFacetFeatureUnion { 14 | @SerialName("\$type") 15 | abstract var type: String 16 | 17 | val asLink get() = this as? RichtextFacetLink 18 | val asMention get() = this as? RichtextFacetMention 19 | val asTag get() = this as? RichtextFacetTag 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsProfileView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | import work.socialhub.kbsky.model.com.atproto.label.LabelDefsLabel 5 | 6 | @Serializable 7 | data class ActorDefsProfileView( 8 | var did: String = "", 9 | var handle: String = "", 10 | var displayName: String? = null, 11 | var description: String? = null, 12 | var avatar: String? = null, 13 | var associated: ActorDefsProfileAssociated? = null, 14 | var indexedAt: String? = null, 15 | var createdAt: String? = null, 16 | var viewer: ActorDefsViewerState? = null, 17 | var labels: List? = null, 18 | var verification: ActorDefsVerificationState? = null, 19 | ) 20 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedRecordView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | /** 8 | * A representation of a record embedded in another form of content 9 | */ 10 | @Serializable 11 | data class EmbedRecordView( 12 | @SerialName("\$type") 13 | override var type: String = TYPE, 14 | var record: EmbedRecordViewUnion? = null, 15 | ) : EmbedViewUnion() { 16 | 17 | companion object { 18 | const val TYPE = BlueskyTypes.EmbedRecord + "#view" 19 | } 20 | 21 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 22 | constructor() : this(TYPE, null) 23 | } 24 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetListRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphGetListRequest( 8 | override val auth: AuthProvider, 9 | var list: String? = null, 10 | var limit: Int? = null, 11 | var cursor: String? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("list", list) 17 | it.addParam("limit", limit) 18 | it.addParam("cursor", cursor) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsContentLabelPref.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ActorDefsContentLabelPref( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var label: String = "", 12 | /** ["show", "warn", "hide"] */ 13 | var visibility: String = "", 14 | ) : ActorDefsPreferencesUnion() { 15 | 16 | companion object { 17 | const val TYPE = BlueskyTypes.ActorDefs + "#contentLabelPref" 18 | } 19 | 20 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 21 | constructor() : this(TYPE, "", "") 22 | } 23 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedExternal.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | /** 8 | * A representation of some externally linked content, embedded in another form of content 9 | */ 10 | @Serializable 11 | data class EmbedExternal( 12 | @SerialName("\$type") 13 | override var type: String = TYPE, 14 | var external: EmbedExternalExternal? = null, 15 | ) : EmbedUnion() { 16 | 17 | companion object { 18 | const val TYPE = BlueskyTypes.EmbedExternal 19 | } 20 | 21 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 22 | constructor() : this(TYPE, null) 23 | } 24 | -------------------------------------------------------------------------------- /core/src/commonTest/kotlin/work/socialhub/kbsky/com/atproto/identity/ResolveHandleTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.com.atproto.identity 2 | 3 | import work.socialhub.kbsky.ATProtocolFactory 4 | import work.socialhub.kbsky.api.entity.com.atproto.identity.IdentityResolveHandleRequest 5 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 6 | import kotlin.test.Test 7 | 8 | class ResolveHandleTest { 9 | 10 | @Test 11 | fun testResolveHandle() { 12 | val response = ATProtocolFactory 13 | .instance(BSKY_SOCIAL.uri) 14 | .identity() 15 | .resolveHandle( 16 | IdentityResolveHandleRequest().also { 17 | it.handle = "uakihir0.com" 18 | } 19 | ) 20 | 21 | println(response.data.did) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/app/bsky/notification/GetUnreadCountTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.app.bsky.notification 2 | 3 | import work.socialhub.kbsky.AbstractTest 4 | import work.socialhub.kbsky.BlueskyFactory 5 | import work.socialhub.kbsky.api.entity.app.bsky.notification.NotificationGetUnreadCountRequest 6 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 7 | import kotlin.test.Test 8 | 9 | class GetUnreadCountTest : AbstractTest() { 10 | 11 | @Test 12 | fun testGetUnreadCount() { 13 | val response = BlueskyFactory 14 | .instance(BSKY_SOCIAL.uri) 15 | .notification() 16 | .getUnreadCount( 17 | NotificationGetUnreadCountRequest(auth()) 18 | ) 19 | 20 | println(response.data.count) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/app/bsky/unspecced/GetPopularTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.app.bsky.unspecced 2 | 3 | import work.socialhub.kbsky.AbstractTest 4 | import work.socialhub.kbsky.BlueskyFactory 5 | import work.socialhub.kbsky.api.entity.app.bsky.unspecced.UnspeccedGetPopularRequest 6 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 7 | import kotlin.test.Test 8 | 9 | class GetPopularTest : AbstractTest() { 10 | 11 | @Test 12 | fun testGetPopular() { 13 | val feeds = BlueskyFactory 14 | .instance(BSKY_SOCIAL.uri) 15 | .unspecced() 16 | .getPopular( 17 | UnspeccedGetPopularRequest(auth()) 18 | ) 19 | 20 | feeds.data.feed.forEach { 21 | print(it.post) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetActorLikesRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedGetActorLikesRequest( 8 | override val auth: AuthProvider, 9 | var actor: String? = null, 10 | var limit: Int? = null, 11 | var cursor: String? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("actor", actor) 17 | it.addParam("limit", limit) 18 | it.addParam("cursor", cursor) 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetListsRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphGetListsRequest( 8 | override val auth: AuthProvider, 9 | var actor: String? = null, 10 | var limit: Int? = null, 11 | var cursor: String? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("actor", actor) 17 | it.addParam("limit", limit) 18 | it.addParam("cursor", cursor) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/app/bsky/actor/GetProfileTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.app.bsky.actor 2 | 3 | import work.socialhub.kbsky.AbstractTest 4 | import work.socialhub.kbsky.BlueskyFactory 5 | import work.socialhub.kbsky.api.entity.app.bsky.actor.ActorGetProfileRequest 6 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 7 | import kotlin.test.Test 8 | 9 | class GetProfileTest : AbstractTest() { 10 | 11 | @Test 12 | fun testGetProfile() { 13 | val actor = BlueskyFactory 14 | .instance(BSKY_SOCIAL.uri) 15 | .actor() 16 | .getProfile( 17 | ActorGetProfileRequest(auth()).also { 18 | it.actor = "uakihir0.com" 19 | } 20 | ) 21 | 22 | print(actor.data) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetActorFeedsRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedGetActorFeedsRequest( 8 | override val auth: AuthProvider, 9 | var actor: String? = null, 10 | var limit: Int? = null, 11 | var cursor: String? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("actor", actor) 17 | it.addParam("limit", limit) 18 | it.addParam("cursor", cursor) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetFollowsRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphGetFollowsRequest( 8 | override val auth: AuthProvider, 9 | var actor: String? = null, 10 | var limit: Int? = null, 11 | var cursor: String? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("actor", actor) 17 | it.addParam("limit", limit) 18 | it.addParam("cursor", cursor) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/embed/EmbedRecordWithMediaView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.embed 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class EmbedRecordWithMediaView( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | var record: EmbedRecordView? = null, 12 | /** only external and images */ 13 | var media: EmbedViewUnion? = null, 14 | ) : EmbedViewUnion() { 15 | 16 | companion object { 17 | const val TYPE = BlueskyTypes.EmbedRecordWithMedia + "#view" 18 | } 19 | 20 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 21 | constructor() : this(TYPE, null, null) 22 | } 23 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/graph/GraphDefsListViewBasic.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.graph 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | /** 8 | * List 9 | */ 10 | @Serializable 11 | data class GraphDefsListViewBasic( 12 | @SerialName("\$type") 13 | var type: String = TYPE, 14 | var uri: String? = null, 15 | var cid: String? = null, 16 | var name: String? = null, 17 | var purpose: String? = null, 18 | var avatar: String? = null, 19 | var viewer: GraphDefsListViewerState? = null, 20 | var indexedAt: String? = null, 21 | ) { 22 | companion object { 23 | const val TYPE = BlueskyTypes.GraphDefs + "#listViewBasic" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/app/bsky/graph/GetMutesTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.AbstractTest 4 | import work.socialhub.kbsky.BlueskyFactory 5 | import work.socialhub.kbsky.Printer.dump 6 | import work.socialhub.kbsky.api.entity.app.bsky.graph.GraphGetMutesRequest 7 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 8 | import kotlin.test.Test 9 | 10 | class GetMutesTest : AbstractTest() { 11 | 12 | @Test 13 | fun testGetMutes() { 14 | val response = BlueskyFactory 15 | .instance(BSKY_SOCIAL.uri) 16 | .graph() 17 | .getMutes( 18 | GraphGetMutesRequest(auth()) 19 | ) 20 | 21 | response.data.mutes.forEach { 22 | dump(it) 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetTimelineRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedGetTimelineRequest( 8 | override val auth: AuthProvider, 9 | var algorithm: String? = null, 10 | var limit: Int? = null, 11 | var cursor: String? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("algorithm", algorithm) 17 | it.addParam("limit", limit) 18 | it.addParam("cursor", cursor) 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetFollowersRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphGetFollowersRequest( 8 | override val auth: AuthProvider, 9 | var actor: String? = null, 10 | var limit: Int? = null, 11 | var cursor: String? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("actor", actor) 17 | it.addParam("limit", limit) 18 | it.addParam("cursor", cursor) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoAddReactionRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoAddReactionRequest( 8 | override val auth: AuthProvider, 9 | val convoId: String, 10 | val messageId: String, 11 | val value: String, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | 15 | override fun toMap(): Map { 16 | return mutableMapOf().also { 17 | it.addParam("convoId", convoId) 18 | it.addParam("messageId", messageId) 19 | it.addParam("value", value) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoGetMessagesRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoGetMessagesRequest( 8 | override val auth: AuthProvider, 9 | var convoId: String = "", 10 | var limit: Int? = null, 11 | var cursor: String? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("convoId", convoId) 17 | it.addParam("limit", limit) 18 | it.addParam("cursor", cursor) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoRemoveReactionRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ConvoRemoveReactionRequest( 8 | override val auth: AuthProvider, 9 | val convoId: String, 10 | val messageId: String, 11 | val value: String, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("convoId", convoId) 17 | it.addParam("messageId", messageId) 18 | it.addParam("value", value) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/com/atproto/server/ServerGetServiceAuthRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.com.atproto.server 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class ServerGetServiceAuthRequest( 8 | override val auth: AuthProvider, 9 | // did 10 | val aud: String, 11 | val exp: Long? = null, 12 | val lxm: String? = null, 13 | ) : MapRequest, AuthRequest(auth) { 14 | 15 | override fun toMap(): Map { 16 | return mutableMapOf().also { 17 | it.addParam("aud", aud) 18 | it.addParam("exp", exp) 19 | it.addParam("lxm", lxm) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetFeedRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedGetFeedRequest( 8 | override val auth: AuthProvider, 9 | /** at-url */ 10 | var feed: String? = null, 11 | var limit: Int? = null, 12 | var cursor: String? = null, 13 | ) : AuthRequest(auth), MapRequest { 14 | 15 | override fun toMap(): Map { 16 | return mutableMapOf().also { 17 | it.addParam("feed", feed) 18 | it.addParam("limit", limit) 19 | it.addParam("cursor", cursor) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/graph/GraphGetKnownFollowersRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class GraphGetKnownFollowersRequest( 8 | override val auth: AuthProvider, 9 | var actor: String? = null, 10 | var limit: Int? = null, 11 | var cursor: String? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("actor", actor) 17 | it.addParam("limit", limit) 18 | it.addParam("cursor", cursor) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /auth/src/commonMain/kotlin/work/socialhub/kbsky/auth/api/entity/wellknown/WellKnownOAuthProtectedResourceResponse.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth.api.entity.wellknown 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | 6 | @Serializable 7 | data class WellKnownOAuthProtectedResourceResponse( 8 | @SerialName("resource") 9 | var resource: String = "", 10 | 11 | @SerialName("authorization_servers") 12 | var authorizationServers: List = emptyList(), 13 | 14 | @SerialName("scopes_supported") 15 | var scopesSupported: List = emptyList(), 16 | 17 | @SerialName("bearer_methods_supported") 18 | var bearerMethodsSupported: List = emptyList(), 19 | 20 | @SerialName("resource_documentation") 21 | var resourceDocumentation: String = "", 22 | ) 23 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/feed/FeedGetListFeedRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class FeedGetListFeedRequest( 8 | override val auth: AuthProvider, 9 | /** at-url */ 10 | var list: String? = null, 11 | var limit: Int? = null, 12 | var cursor: String? = null, 13 | ) : AuthRequest(auth), MapRequest { 14 | 15 | override fun toMap(): Map { 16 | return mutableMapOf().also { 17 | it.addParam("list", list) 18 | it.addParam("limit", limit) 19 | it.addParam("cursor", cursor) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/app/bsky/actor/SearchActorsTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.app.bsky.actor 2 | 3 | import work.socialhub.kbsky.AbstractTest 4 | import work.socialhub.kbsky.BlueskyFactory 5 | import work.socialhub.kbsky.api.entity.app.bsky.actor.ActorSearchActorsRequest 6 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 7 | import kotlin.test.Test 8 | 9 | class SearchActorsTest : AbstractTest() { 10 | 11 | @Test 12 | fun testSearchActors() { 13 | val actors = BlueskyFactory 14 | .instance(BSKY_SOCIAL.uri) 15 | .actor() 16 | .searchActors( 17 | ActorSearchActorsRequest(auth()).also { 18 | it.q = "uakihir0" 19 | } 20 | ) 21 | 22 | actors.data.actors.forEach { print(it) } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/chat/bsky/convo/ConvoSendMessageRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.chat.bsky.convo 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | import work.socialhub.kbsky.model.chat.bsky.convo.ConvoDefsMessageInput 7 | 8 | data class ConvoSendMessageRequest( 9 | override val auth: AuthProvider, 10 | var convoId: String = "", 11 | var message: ConvoDefsMessageInput? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("convoId", convoId) 17 | it.addParam("message", message) 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/app/bsky/unspecced/UnspeccedGetPopularRequest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.entity.app.bsky.unspecced 2 | 3 | import work.socialhub.kbsky.api.entity.share.AuthRequest 4 | import work.socialhub.kbsky.api.entity.share.MapRequest 5 | import work.socialhub.kbsky.auth.AuthProvider 6 | 7 | data class UnspeccedGetPopularRequest( 8 | override val auth: AuthProvider, 9 | var includeNsfw: Boolean? = null, 10 | var limit: Int? = null, 11 | var cursor: String? = null, 12 | ) : AuthRequest(auth), MapRequest { 13 | 14 | override fun toMap(): Map { 15 | return mutableMapOf().also { 16 | it.addParam("includeNsfw", includeNsfw) 17 | it.addParam("limit", limit) 18 | it.addParam("cursor", cursor) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsSavedFeedsPref.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.SerialName 4 | import kotlinx.serialization.Serializable 5 | import work.socialhub.kbsky.BlueskyTypes 6 | 7 | @Serializable 8 | data class ActorDefsSavedFeedsPref( 9 | @SerialName("\$type") 10 | override var type: String = TYPE, 11 | /** at-url */ 12 | var pinned: List = emptyList(), 13 | /** at-url */ 14 | var saved: List = emptyList(), 15 | ) : ActorDefsPreferencesUnion() { 16 | 17 | companion object { 18 | const val TYPE = BlueskyTypes.ActorDefs + "#savedFeedsPref" 19 | } 20 | 21 | @Deprecated("use primary constructor", level = DeprecationLevel.HIDDEN) 22 | constructor() : this(TYPE, emptyList(), emptyList()) 23 | } 24 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/api/com/atproto/IdentityResource.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.api.com.atproto 2 | 3 | import work.socialhub.kbsky.api.entity.com.atproto.identity.IdentityResolveHandleRequest 4 | import work.socialhub.kbsky.api.entity.com.atproto.identity.IdentityResolveHandleResponse 5 | import work.socialhub.kbsky.api.entity.share.Response 6 | 7 | /** 8 | * ATProtocol/Identity 9 | * [Reference](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto/identity) 10 | */ 11 | interface IdentityResource { 12 | 13 | /** 14 | * Provides the DID of a repo. 15 | */ 16 | fun resolveHandle( 17 | request: IdentityResolveHandleRequest 18 | ): Response 19 | 20 | /** 21 | * Updates the handle of the account. 22 | */ 23 | fun updateHandle() 24 | } 25 | -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/app/bsky/feed/SearchPostsTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.app.bsky.feed 2 | 3 | import work.socialhub.kbsky.AbstractTest 4 | import work.socialhub.kbsky.BlueskyFactory 5 | import work.socialhub.kbsky.api.entity.app.bsky.feed.FeedSearchPostsRequest 6 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 7 | import kotlin.test.Test 8 | 9 | class SearchPostsTest : AbstractTest() { 10 | 11 | @Test 12 | fun testSearchPosts() { 13 | val feeds = BlueskyFactory 14 | .instance(BSKY_SOCIAL.uri) 15 | .feed() 16 | .searchPosts( 17 | FeedSearchPostsRequest( 18 | auth = auth(), 19 | q = "SocialHub" 20 | ) 21 | ) 22 | 23 | feeds.data.posts 24 | .forEach { print(it) } 25 | } 26 | } -------------------------------------------------------------------------------- /core/src/jvmTest/kotlin/work/socialhub/kbsky/app/bsky/graph/GetFollowsTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.app.bsky.graph 2 | 3 | import work.socialhub.kbsky.AbstractTest 4 | import work.socialhub.kbsky.BlueskyFactory 5 | import work.socialhub.kbsky.api.entity.app.bsky.graph.GraphGetFollowsRequest 6 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 7 | import kotlin.test.Test 8 | 9 | class GetFollowsTest : AbstractTest() { 10 | 11 | @Test 12 | fun testGetFollows() { 13 | val response = BlueskyFactory 14 | .instance(BSKY_SOCIAL.uri) 15 | .graph() 16 | .getFollows( 17 | GraphGetFollowsRequest(auth()).also { 18 | it.actor = "uakihir0.com" 19 | } 20 | ) 21 | 22 | response.data.follows 23 | .forEach { print(it) } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /core/src/commonMain/kotlin/work/socialhub/kbsky/model/app/bsky/actor/ActorDefsVerificationView.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.model.app.bsky.actor 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | /** 6 | * An individual verification for an associated subject. 7 | */ 8 | @Serializable 9 | data class ActorDefsVerificationView( 10 | /** 11 | * The user who issued this verification. 12 | * Format: did 13 | */ 14 | val issuer: String, 15 | 16 | /** 17 | * The AT-URI of the verification record. 18 | * Format: at-uri 19 | */ 20 | val uri: String, 21 | 22 | /** 23 | * True if the verification passes validation, otherwise false. 24 | */ 25 | val isValid: Boolean, 26 | 27 | /** 28 | * Timestamp when the verification was created. 29 | * Format: datetime 30 | */ 31 | val createdAt: String 32 | ) -------------------------------------------------------------------------------- /auth/src/jvmTest/kotlin/work/socialhub/kbsky/auth/WellKnownTest.kt: -------------------------------------------------------------------------------- 1 | package work.socialhub.kbsky.auth 2 | 3 | import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL 4 | import work.socialhub.kbsky.domain.Service.OYSTER_US_EAST 5 | import kotlin.test.Test 6 | 7 | class WellKnownTest : AbstractTest() { 8 | 9 | @Test 10 | fun testWellKnownOAuthProtectedResource() { 11 | val response = AuthFactory 12 | .instance(OYSTER_US_EAST.uri) 13 | .wellKnown() 14 | .oAuthProtectedResource() 15 | println(response.data.authorizationServers[0]) 16 | } 17 | 18 | @Test 19 | fun testWellKnownOAuthAuthorizationServer() { 20 | val response = AuthFactory 21 | .instance(BSKY_SOCIAL.uri) 22 | .wellKnown() 23 | .oAuthAuthorizationServer() 24 | println(response.data.issuer) 25 | } 26 | } --------------------------------------------------------------------------------