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
650
Other Decks in Technology
See All in Technology
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
580
Taming you application's environments
salaboy
0
180
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
7
800
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
120
dev 補講: プロダクトセキュリティ / Product security overview
wa6sn
1
2.3k
Terraform Stacks入門 #HashiTalks
msato
0
350
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
180
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
300
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Designing for humans not robots
tammielis
250
25k
Embracing the Ebb and Flow
colly
84
4.5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Teambox: Starting and Learning
jrom
133
8.8k
Practical Orchestrator
shlominoach
186
10k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
It's Worth the Effort
3n
183
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
Ҏ্🫡