Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
速習XRPC / Learning XRPC
Search
鎌倉
April 28, 2023
Technology
0
460
速習XRPC / Learning XRPC
Bluesky/ATProtocol勉強会 #1の発表資料です。
Bluesky (ATP) のAPIを叩いてみたい人向けに、基本的な概念や触り方を解説しています。
鎌倉
April 28, 2023
Tweet
Share
More Decks by 鎌倉
See All by 鎌倉
Svelte & Nostr
akiomik
0
330
Nostrのカスタムフィードの現状 / About Nostr custom feed
akiomik
0
300
日本人が開発した アプリ紹介 / Introduction of apps developed by Japanese
akiomik
0
600
Bluesky と Android / Bluesky and Android
akiomik
0
910
Nostr版togetterのNosliとNIP-33 / About Nosli and NIP-33
akiomik
0
470
話題の投稿がみれるサービス Nostrendsをつくったよ🤙 / About Nostrends
akiomik
0
660
Other Decks in Technology
See All in Technology
The Role of Developer Relations in AI Product Success.
giftojabu1
0
140
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
180
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
910
AIチャットボット開発への生成AI活用
ryomrt
0
170
日経電子版のStoreKit2フルリニューアル
shimastripe
1
140
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
300
AWS Lambdaと歩んだ“サーバーレス”と今後 #lambda_10years
yoshidashingo
1
180
Application Development WG Intro at AppDeveloperCon
salaboy
0
200
アジャイルチームがらしさを発揮するための目標づくり / Making the goal and enabling the team
kakehashi
3
150
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
600
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
TypeScript、上達の瞬間
sadnessojisan
46
13k
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
334
57k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
A better future with KSS
kneath
238
17k
GitHub's CSS Performance
jonrohan
1030
460k
Bash Introduction
62gerente
608
210k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
The Invisible Side of Design
smashingmag
298
50k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Transcript
श931$ #MVFTLZ"51SPUPDPMษڧձ ח !PNJCTLZTPDJBM
ࣗݾհ w 8FCΤϯδχΞ w ੨Ӣͱ͍͏#MVFTLZ༻"OESPJEΫϥΠΞϯτΛ࡞ͬͯ·͢ w IUUQTHJUIVCDPNBLJPNJLTFJVO
લఏࣝͱΰʔϧ w લఏࣝ w Ұൠతͳ8FC"1*͕৮ΕΔ w ˞࣮ऀࢹͷ͕த৺Ͱ͢ w ΰʔϧ w
-FYJDPOͷجຊతͳา͖ํ͕Θ͔Δ w ཁΛ͔͍ͭ·ΜͰۦ͚ؾຯʹਐΈ·͢
ΞδΣϯμ w ओཁͳͭͷ༻ޠ 931$ɺ-FYJDPOɺ/4*% w -FYJDPOೖ ୳͠ํͱओཁͳܕ w
ϦΫΤετͱೝূ w SFDPSEͱϦϙδτϦͷૢ࡞ w ͦͷଞ
ओཁͳͭͷ༻ޠ
931$ w $SPTTTZTUFN3FNPUF1SPDFEVSF$BMMT w 31$ ԕִखଓ͖ݺͼग़͠ ͷن֨ͷҰछ w H31$ 40"1
w "51SPUPDPMͷಠ༷ࣗ w )551 4 ͷ্Ͱಈ࡞ w 1%4ͱͷσʔλͷΓऔΓʹར༻
-FYJDPO w ϨΩγίϯ w ӳ<໊>༻ޠूɺޠኮɺࣙॻ w 931$ͷϝιουσʔλܕͷఆ ٛ w ·ͨͦΕΒͷϑΥʔϚοτ
+40/4DIFNB෩
/4*% w /BNF4QBDFE*% w -FYJDPOͷϦιʔεΛҰҙʹࣝผ͢ ΔͨΊͷ*% w 3FWFSTF%/4ܗࣜͰදه w +BWBͰΑ͘ݟΔΞϨ
w ΤϯυϙΠϯτ·ͨܕͱͯ͠༻
"51SPUPDPM 931$ Ͱͷ"1*ݺͼग़͠ -FYJDPOʹΑͬͯݺͼग़͕͠ఆΊΒΕͨ /4*%ܗࣜͷΤϯυϙΠϯτΛίʔϧ
-FYJDPOࣄ࢝Ί
-FYJDPOͷ୳͠ํ w ެࣜυΩϡϝϯτʹҰཡ͋Γ·͢ w IUUQTBUQSPUPDPNEPDT w ͨͩ͠ใ͕ݹ͔ͬͨΓෆ͍ͯ͠ Δ߹ w ࠷৽ͷ༷ʹ͍ͭͯHJUIVCͷϦϙδτ
ϦͷMFYJDPOTΛࢀর͢Δͷ͕࣮֬ w IUUQTHJUIVCDPNCMVFTLZTPDJBM BUQSPUPUSFFNBJOMFYJDPOT
-FYJDPOͷܕ w PCKFDU w QSPDFEVSF w RVFSZ w ϓϦϛςΟϒܕ JOUFHFSTUSJOHͳͲ
w ಛघͳܕ SFDPSE SFG VOJPO CMPC UPLFO TVCTDSJQUJPOͳͲ w ࠓճSFDPSEͷΈѻ͍·͢
PCKFDU { "id": "app.bsky.actor.defs", "defs": { "profileViewBasic": { "type": "object",
"required": ["did", "handle"], "properties": { "did": { "type": "string" }, "handle": { "type": "string" }, "avatar": { "type": "string" }, "viewer": { "type": "ref" }, "labels": { "type": "array" } } } } } w Ұൠతͳσʔλܕ w SFRVJSFEOPUOVMM w ˠͷ/4*% BQQCTLZBDUPSEFGTQSP fi MF7JFX#BTJD ˞ൈਮ
QSPDFEVSF { "id": "com.atproto.server.createSession", "defs": { "main": { "type": "procedure",
"input": { "schema": { "properties": { "identifier": { "type": "string" }, "password": { "type": "string" } } } }, "output": { "schema": { "properties": { "accessJwt": { "type": "string" }, "did": { "type": "string" }, } } } } } } w ߋ৽ܥϝιου w JOQVUPVUQVUΛ࣋ͭ w ӈͷ/4*% DPNBUQSPUPTFSWFSDSFB UF4FTTJPO NBJOলུ ˞ൈਮ
RVFSZ { "id": "app.bsky.feed.getTimeline", "defs": { "main": { "type": "query",
"parameters": { "type": "params", "properties": { "cursor": { "type": "string" } } }, "output": { "schema": { "properties": { "cursor": { "type": "string" }, "feed": { "type": "array" } } } } } } } w ࢀরܥϝιου w QBSBNFUFSTPVUQVUΛ࣋ͭ w ˠͷ/4*% BQQCTLZGFFEHFU5JNFMJO F ˞ൈਮ
ϦΫΤετͱೝূ
ϦΫΤετ w #MVFTLZͷ߹IUUQTCTLZTPDJBMYSQDOJTEʹରͯ͠ߦ͏ w αʔυύʔςΟ1%4ͷ߹ACTLZTPDJBMAͷ෦͕มΘΔ w ྫ w QSPDFEVSF1045IUUQTCTLZTPDJBMYSQD DPNBUQSPUPTFSWFSDSFBUF4FTTJPO
w RVFSZ(&5IUUQTCTLZTPDJBMYSQDBQQCTLZGFFEHFU5JNFMJOF
ϩάΠϯͷ-FYJDPO { "id": "com.atproto.server.createSession", "defs": { "main": { "type": "procedure",
"input": { "encoding": "application/json", "schema": { "required": [ "identifier", "password" ], "properties": { "identifier": { "type": "string" }, "password": { "type": "string" } } } } } } } ˞ൈਮ ϦΫΤετ1045 ϦΫΤετ#PEZ+40/ JEFOUJ fi FSͱQBTTXPSEඞਢ IBOEMFPSFNBJM ΤϯυϙΠϯτ YSQDDPNBUQSPUPTFSWFSDSFBUF4FTTJPO
ϩάΠϯͷϦΫΤετ curl -X POST \ -H 'Content-Type: application/json' \ -d
'{"identifier": "tester.bsky.social", "password": "foo"}' \ 'https://bsky.social/xrpc/com.atproto.server.createSession' # response { "did":"did:plc:ji4f2ypncqko5cm62pmyxh67", ... "accessJwt":"...", "refreshJwt":"..." } ೝূ͕ඞཁͳΤϯυϙΠϯτ ฦ͖ͬͯͨ+85ΛϦΫΤετʹؚΊΔ
RVFSZͷ-FYJDPO ϢʔβϑΟʔυͷऔಘ { "id": "app.bsky.feed.getAuthorFeed", "defs": { "main": { "type":
"query", "parameters": { "type": "params", "required": ["actor"], "properties": { "cursor": { "type": "string" } } } } } } ˞ൈਮ ϦΫΤετ(&5 ΫΤϦύϥϝʔλ ΤϯυϙΠϯτ YSQDBQQCTLZGFFEHFU"VUIPS'FFE BDUPS ͲͷϢʔβ͔ ඞਢ
RVFSZͷϦΫΤετ ϢʔβϑΟʔυͷऔಘ curl -X GET -H 'Authorization: Bearer ${createSessionで取得したaccessJwt}' 'https://bsky.social/xrpc/app.bsky.feed.getAuthorFeed?actor=foo'
ϦϙδτϦͱSFDPSE
ϦϙδτϦ %BUB3FQPTJUPSZ w 5-%3 w ϦϙδτϦॺ໊σʔλͷίϨΫγϣϯ w HJUͷϦϙδτϦΈ͍ͨͳͷ ͨͩ͠%#ͷϨίʔυ༻
w Ϣʔβ֤ʑͷެ։ΞΫςΟϏςΟΛࣗͷϦϙδτϦʹه w #MVFTLZ BQQCTLZ ͷ߹ɺߘɾϑΥϩʔɾ͍͍ͶͳͲ͕֨ೲ͞ ΕΔ
SFDPSE { "id": "app.bsky.feed.post", "defs": { "main": { "type": "record",
"key": "tid", "record": { "type": "object", "required": ["text", "createdAt"], "properties": { "text": { "type": "string" }, "createdAt": { "type": "string", "format": "datetime" } } } } } } w ϦϙδτϦ༻ͷσʔλܕ w ˠ#MVFTLZͷߘ QPTU ͷܕ ˞ൈਮ
ϦϙδτϦૢ࡞ { "id": "com.atproto.repo.createRecord", "defs": { "main": { "type": "procedure",
"input": { "encoding": "application/json", "schema": { "type": "object", "properties": { "repo": { "type": "string" }, "collection": { "type": "string" }, "record": { "type": "unknown" } } } } } } } w ϦϙδτϦͷϨίʔυ ՃͷQSPDFEVSF w ߘϑΥϩʔͳͲର ͱͳΔSFDPSEΛͯ͠ ߦ͏ ˞ൈਮ
ߘ࡞ͷϦΫΤετ curl -X POST \ -H 'Authorization: Bearer ${accessJwt}' \
-H 'Content-Type: application/json' \ -d '{ "repo": "tester.bsky.social", "collection": "app.bsky.feed.post", "record": { "text": "Hello, world!", "createdAt": "2023-04-28T22:00:00+09:00" } }' \ 'https://bsky.social/xrpc/com.atproto.repo.createRecord'
ͦͷଞࡉ͔͍৭ʑ w SLFZBUBMJDFIPTUDPNJPFYBNQMFTPOHZ*D[DDQBͷ Z*D[DDQB w CMPCͷܕ͜ͷลΛࢀর w େഁյҎલͷσʔλSFGͱTJ[F͕ͳ͍ͷͰҙ w !BUQSPUPBQJͩͱࣗಈͰSFGͱTJ[FΛิ͢ΔΑ͏ʹͳ͍ͬͯΔ
w ΤϥʔϋϯυϦϯά͜͜Λࢀর
ิͱ͔ w ۦ͚Ͱ͢Έ·ͤΜʂ w ʮࠓͷൃදͳΜΘ͔ΒΜ͔ͬͨʯͱ͍͏ํNBUUO͞Μͷʰ։ൃ ࢹ͔ΒݟΔɺ৽͍͠ࢄܕ4/4ʮ#MVFTLZʯͱ"51SPUPDPMͷՄೳ ੑʱͱ͍͏هࣄνΣοΫͯ͠Έ͍ͯͩ͘͞ w IUUQTHJIZPKQBSUJDMFCMVFTLZBUQSPUPDPM
Ҏ্🫡