$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
速習XRPC / Learning XRPC
Search
鎌倉
April 28, 2023
Technology
0
480
速習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
310
日本人が開発した アプリ紹介 / Introduction of apps developed by Japanese
akiomik
0
620
Bluesky と Android / Bluesky and Android
akiomik
0
920
Nostr版togetterのNosliとNIP-33 / About Nosli and NIP-33
akiomik
0
480
話題の投稿がみれるサービス Nostrendsをつくったよ🤙 / About Nostrends
akiomik
0
660
Other Decks in Technology
See All in Technology
【ASW21-01】STAMPSTPAで導き出した課題に対する対策立案手法の提案
hianraku9498
0
600
Explain EXPLAIN
keiko713
10
2.8k
イノベーショントークから見るクラウド運用の未来を振り返ってみた
nyankotaro
0
330
プロセス改善とE2E自動テストによる、プロダクトの品質向上事例
tomasagi
1
3.8k
2024 眼科AIコンテスト手法解説スライド 第5回日本眼科AI学会総会
minamikoyasuganka
0
120
宇宙最速のランチRecap LT会(開発者ツール&運用監視編)
nnydtmg
1
180
Advancing the 3D Geospatial Ecosystem in Japan via Global Collaborations
osgeojp
0
180
密着! Bedrockerがre:Invent 2024で過ごした5日間を紹介
minorun365
PRO
3
320
店舗向けSaaSにおける 顧客要望活用の実践アプローチ(20241205_pmconf)
yujirooo
0
3.3k
職能を超えたモブプログラミングが品質に与えた良い影響
tonionagauzzi
1
190
B10-ひと目でわかる(といいなぁ)Microsoft Purview
seafay
PRO
0
460
Amazon Bedrock Multi-Agent Collaboration Workshop の紹介 - ワークショップでAIエージェントを学ぼう
nasuvitz
3
300
Featured
See All Featured
The Cult of Friendly URLs
andyhume
78
6.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Faster Mobile Websites
deanohume
305
30k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
A better future with KSS
kneath
238
17k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Side Projects
sachag
452
42k
Automating Front-end Workflow
addyosmani
1366
200k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Documentation Writing (for coders)
carmenintech
65
4.5k
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
Ҏ্🫡