ð¬ ãã£ãããµãŒãã¹
ãã£ãããµãŒãã¹ã¯ããã£ã³ãã«ããµãã¹ã¯ãªãã·ã§ã³ãã¡ãã»ãŒãžãã¡ãã»ãŒãžãã³ãã¬ãŒããæ¢èªç¶æ ãWebSocket ã¹ããªãŒãã³ã°ãå«ããªã¢ã«ã¿ã€ã ã³ãã¥ãã±ãŒã·ã§ã³æ©èœã®å æ¬çãªãœãªã¥ãŒã·ã§ã³ãæäŸããŸãããã£ã³ãã«ç®¡çãšãµãã¹ã¯ãªãã·ã§ã³åŠçããåäžã®äžè²«ãã API ã«çµ±åããŸãã
ð ã¯ã€ãã¯ã¹ã¿ãŒãâ
import express from 'express';
import {middlewares, services, drivers} from '@nodeblocks/backend-sdk';
const {nodeBlocksErrorMiddleware} = middlewares;
const {chatService} = services;
const {withMongo, createFileStorageDriver} = drivers;
const connectToDatabase = withMongo('mongodb://localhost:27017/?authSource=admin', 'dev', 'user', 'password');
const fileStorageDriver = createFileStorageDriver('your-project-id', 'your-bucket-name');
express()
.use(
chatService(
{
identities: client.collection('identities'),
chatChannels: client.collection('chatChannels'),
chatMessages: client.collection('chatMessages'),
subscriptions: client.collection('subscriptions'),
},
{
authSecrets: {
authEncSecret: 'your-encryption-secret',
authSignSecret: 'your-signing-secret',
},
identity: {
typeIds: {
admin: '100',
guest: '000',
regular: '001',
},
},
}
)
)
.use(nodeBlocksErrorMiddleware())
.listen(8089, () => console.log('Server running'));
ð ãšã³ããã€ã³ãæŠèŠâ
ãã£ã³ãã«æäœâ
| ã¡ãœãã | ãã¹ | 説æ |
|---|---|---|
POST | /channels | æ°ãããã£ã³ãã«ãäœæ |
GET | /channels | ãã¹ãŠã®ãã£ã³ãã«ãäžèЧååŸ |
GET | /channels/:channelId | ç¹å®ã®ãã£ã³ãã«ãååŸ |
GET | /channels/:channelId/icon-upload-url | ãã£ã³ãã«ã¢ã€ã³ã³çšã®çœ²åä»ã URL ãçæ |
PATCH | /channels/:channelId | ãã£ã³ãã«ãæŽæ° |
DELETE | /channels/:channelId | ãã£ã³ãã«ãåé€ |
ãµãã¹ã¯ãªãã·ã§ã³æäœâ
| ã¡ãœãã | ãã¹ | 説æ |
|---|---|---|
POST | /subscriptions | æ°ãããµãã¹ã¯ãªãã·ã§ã³ãäœæ |
GET | /subscriptions | ãã¹ãŠã®ãµãã¹ã¯ãªãã·ã§ã³ãäžèЧååŸ |
GET | /subscriptions/:subscriptionId | ç¹å®ã®ãµãã¹ã¯ãªãã·ã§ã³ãååŸ |
DELETE | /subscriptions/:subscriptionId | ãµãã¹ã¯ãªãã·ã§ã³ãåé€ |
ã¡ãã»ãŒãžæäœâ
| ã¡ãœãã | ãã¹ | 説æ |
|---|---|---|
POST | /messages | æ°ããã¡ãã»ãŒãžãäœæ |
GET | /messages?channelId=:channelId | ãã£ã³ãã«å ã®ã¡ãã»ãŒãžãäžèЧååŸ |
GET | /channels/:channelId/messages | ç¹å®ãã£ã³ãã«ã®å šã¡ãã»ãŒãžãååŸ |
GET | /messages/:messageId | ç¹å®ã®ã¡ãã»ãŒãžãååŸ |
GET | /messages/:messageId/attachment-upload-url | ã¡ãã»ãŒãžæ·»ä»çšã®çœ²åä»ã URL ãçæ |
POST | /messages/:messageId/attachments | æ¢åã¡ãã»ãŒãžã«æ·»ä»ãã¡ã€ã«ãäœæ |
DELETE | /messages/:messageId/attachments/:attachmentId | ã¡ãã»ãŒãžããæ·»ä»ãã¡ã€ã«ãåé€ |
PATCH | /messages/:messageId | ã¡ãã»ãŒãžãæŽæ° |
DELETE | /messages/:messageId | ã¡ãã»ãŒãžãåé€ |
ã¡ãã»ãŒãžãã³ãã¬ãŒãæäœâ
| ã¡ãœãã | ãã¹ | 説æ |
|---|---|---|
POST | /message-templates | æ°ããã¡ãã»ãŒãžãã³ãã¬ãŒããäœæ |
GET | /message-templates | ãã¹ãŠã®ã¡ãã»ãŒãžãã³ãã¬ãŒããäžèЧååŸïŒç®¡çè ã®ã¿ïŒ |
GET | /organizations/:organizationId/message-templates | çµç¹ã®ã¡ãã»ãŒãžãã³ãã¬ãŒããäžèЧååŸïŒçµç¹ owner/admin ã®ã¿ïŒ |
GET | /message-templates/:messageTemplateId | ç¹å®ã®ã¡ãã»ãŒãžãã³ãã¬ãŒããååŸ |
PATCH | /message-templates/:messageTemplateId | æ¢åã®ã¡ãã»ãŒãžãã³ãã¬ãŒããæŽæ° |
DELETE | /message-templates/:messageTemplateId | æ¢åã®ã¡ãã»ãŒãžãã³ãã¬ãŒããåé€ |
ãã£ã³ãã«æ¢èªç¶æ ã®æäœâ
| ã¡ãœãã | ãã¹ | 説æ |
|---|---|---|
PUT | /channels/:channelId/read-state | ãã£ã³ãã«ã®æ¢èªç¶æ ã upsertïŒäœæãŸãã¯æŽæ°ïŒ |
ãªã¢ã«ã¿ã€ã ã¹ããªãŒãã³ã°â
| ã¡ãœãã | ãã¹ | 説æ |
|---|---|---|
WS | /messages/listen | ã¡ãã»ãŒãžããªã¢ã«ã¿ã€ã ã«ã¹ããªãŒãã³ã°ïŒwebSocketServer ãªãã·ã§ã³ãå¿
èŠïŒ |
WS /messages/listenãæå¹ã«ããã«ã¯ãchatServiceã®ç¬¬ 3 åŒæ°ãšããŠ{ webSocketServer }ãæž¡ããŠãã ããã
ðïž ãšã³ãã£ãã£ã¹ããŒãâ
ãã£ã³ãã«ãšã³ãã£ãã£â
{
"name": "string",
"ownerId": "string",
"icon": {"objectId": "string (UUID)", "type": "string"},
"createdAt": "string (datetime)",
"id": "string",
"updatedAt": "string (datetime)"
}
ãã£ãŒã«ã詳现:
| ãã£ãŒã«ã | å | èªåçæ | å¿ é | 説æ |
|---|---|---|---|---|
name | string | â | â | ãã£ã³ãã«å/ã¿ã€ãã« |
ownerId | string | â | â | ãã®ãã£ã³ãã«ã®ææè ãšãªãã¢ã€ãã³ãã£ãã£ã®ID |
icon | object | null | â | â | ãã£ã³ãã«ã¢ã€ã³ã³ããªã¯ãšã¹ã㯠{ objectId, type }ãfileStorageDriver äœ¿çšæã®ã¬ã¹ãã³ã¹ã¯ { type, url } |
createdAt | datetime | â | â | äœææ¥æ |
id | string | â | â | äžæèå¥åïŒUUIDïŒ |
updatedAt | datetime | â | â | æçµæŽæ°æ¥æ |
ãµãã¹ã¯ãªãã·ã§ã³ãšã³ãã£ãã£â
{
"approved": "boolean",
"channelId": "string",
"permissions": ["string"],
"subscribedAt": "string (datetime)",
"subscribedId": "string",
"createdAt": "string (datetime)",
"id": "string",
"updatedAt": "string (datetime)"
}
ãã£ãŒã«ã詳现:
| ãã£ãŒã«ã | å | èªåçæ | å¿ é | 説æ |
|---|---|---|---|---|
approved | boolean | â | â | ãµãã¹ã¯ãªãã·ã§ã³ãæ¿èªæžã¿ãã©ãã |
channelId | string | â | â | 察象ãã£ã³ãã«ã®ID |
permissions | array | â | â | æš©éæååã®é åïŒäŸ: ["read", "write"]) |
subscribedAt | datetime | â | â | ãµãã¹ã¯ãªãã·ã§ã³äœææ¥æ |
subscribedId | string | â | â | 賌èªããã¢ã€ãã³ãã£ãã£ã®ID |
createdAt | datetime | â | â | äœææ¥æ |
id | string | â | â | äžæèå¥åïŒUUIDïŒ |
updatedAt | datetime | â | â | æçµæŽæ°æ¥æ |
ã¡ãã»ãŒãžãšã³ãã£ãã£â
{
"channelId": "string",
"content": "string",
"senderId": "string",
"title": "string",
"attachments": [{"url": "string", "type": "string"}],
"createdAt": "string (datetime)",
"id": "string",
"updatedAt": "string (datetime)"
}
ãã£ãŒã«ã詳现:
| ãã£ãŒã«ã | å | èªåçæ | å¿ é | 説æ |
|---|---|---|---|---|
channelId | string | â | â | ã¡ãã»ãŒãžãéä¿¡ããããã£ã³ãã«ã®ID |
content | string | â | â | ã¡ãã»ãŒãžæ¬æ |
senderId | string | â | â | ã¡ãã»ãŒãžéä¿¡è ã®ã¢ã€ãã³ãã£ãã£ID |
title | string | â | â | ä»»æã®ã¡ãã»ãŒãžã¿ã€ãã« |
attachments | array | â | â | ã¡ãã»ãŒãžã®ãã¡ã€ã«æ·»ä»ïŒæ·»ä»ãšã³ããã€ã³ãã§è¿œå ãããŸã§ç©ºïŒ |
attachments[].url | string | â | â | æ£èŠåæžã¿ã®ããŠã³ããŒãïŒé²èЧ URLïŒfileStorageDriver ãå¿
èŠïŒ |
attachments[].type | string | â | â | MIME ã¿ã€ããŸãã¯ãã¡ã€ã«ã«ããŽãª |
createdAt | datetime | â | â | äœææ¥æ |
id | string | â | â | äžæèå¥åïŒUUIDïŒ |
updatedAt | datetime | â | â | æçµæŽæ°æ¥æ |
ð æ³šæ: èªåçæãã£ãŒã«ãã¯ãµãŒãã¹åŽã§èšå®ãããäœæ/æŽæ°ãªã¯ãšã¹ãã«å«ããªãã§ãã ãããã¹ããŒãã¯
additionalProperties: falseã匷å¶ããå®çŸ©ããããã£ãŒã«ãã®ã¿ãèš±å¯ããŸãã
ãã£ã³ãã«æ¢èªç¶æ ãšã³ãã£ãã£â
{
"channelId": "string",
"identityId": "string",
"lastReadMessageId": "string",
"lastReadMessageCreatedAt": "string (datetime)",
"createdAt": "string (datetime)",
"id": "string",
"updatedAt": "string (datetime)"
}
ãã£ãŒã«ã詳现:
| ãã£ãŒã«ã | å | èªåçæ | å¿ é | 説æ |
|---|---|---|---|---|
channelId | string | â | â | èšé²å¯Ÿè±¡ãã£ã³ãã«ã® ID |
identityId | string | â | â | æ¢èªç¶æ ãèšé²ããã¢ã€ãã³ãã£ãã£ã® ID |
lastReadMessageId | string | â | â | æåŸã«èªãã ã¡ãã»ãŒãžã® ID |
lastReadMessageCreatedAt | datetime | â | â | æåŸã«èªãã ã¡ãã»ãŒãžã®äœææ¥æ |
createdAt | datetime | â | â | äœææ¥æ |
id | string | â | â | äžæèå¥åïŒUUIDïŒ |
updatedAt | datetime | â | â | æçµæŽæ°æ¥æ |
ð æ³šæ: èªåçæãã£ãŒã«ãã¯ãµãŒãã¹ãèšå®ãããããupsert ãªã¯ãšã¹ãã«å«ããªãã§ãã ãããã¹ããŒãã§ã¯
additionalProperties: falseã匷å¶ããå®çŸ©æžã¿ãã£ãŒã«ãã ããèš±å¯ããŸãã
ð èªèšŒããããŒâ
ä¿è·ããããšã³ããã€ã³ãã§ã¯ã次ã®ããããŒãå«ããŠãã ããïŒ
Authorization: Bearer <access_token>
x-nb-fingerprint: <device_fingerprint>
â ïž éèŠ: èªå¯æã«ãã£ã³ã¬ãŒããªã³ããæå®ããå ŽåãèªèšŒæžã¿ã®ãã¹ãŠã®ãªã¯ãšã¹ãã§
x-nb-fingerprintããããŒãå¿ é ã§ããæ¬ åŠããŠããå Žå㯠401 Unauthorized ãè¿ããŸãã
ð§ APIãšã³ããã€ã³ãâ
ðº ãã£ã³ãã«æäœâ
1. ãã£ã³ãã«äœæâ
æå®ãããæ å ±ã§æ°ãããã£ãããã£ã³ãã«ãäœæããŸãã
ãªã¯ãšã¹ã:
- Method:
POST - Path:
/channels - ããããŒ:
Content-Type: application/jsonAuthorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: èªåé©çšïŒname ãš ownerId ãå¿ é ã远å ããããã£ãªãïŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ãŸãã¯æ¬äººïŒownerId ãèªèšŒãŠãŒã¶ãŒãšäžèŽïŒ
ãªã¯ãšã¹ãããã£:
| ãã£ãŒã«ã | å | å¿ é | 説æ |
|---|---|---|---|
name | string | â | ãã£ã³ãã«å/ã¿ã€ãã« |
ownerId | string | â | ãã®ãã£ã³ãã«ãææãããŠãŒã¶ãŒã®ID |
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
name | string | ãã£ã³ãã«å/ã¿ã€ãã« |
ownerId | string | ãã®ãã£ã³ãã«ãææãããŠãŒã¶ãŒã®ID |
createdAt | string | äœææ¥æ |
id | string | ãã£ã³ãã«äžæID |
updatedAt | string | æçµæŽæ°æ¥æ |
ãªã¯ãšã¹ãäŸ:
curl -X POST http://localhost:8089/channels \
-H "Content-Type: application/json" \
-d '{
"name": "Project Updates",
"ownerId": "user-456"
}'
æåã¬ã¹ãã³ã¹:
HTTP/1.1 201 Created
Content-Type: application/json
{
"name": "Project Updates",
"ownerId": "user-456",
"createdAt": "2025-06-24T08:33:40.146Z",
"id": "af62eac3-06aa-481a-8c44-a029e96de2ed",
"updatedAt": "2025-06-24T08:33:40.146Z"
}
ããªããŒã·ã§ã³ãšã©ãŒäŸ:
å¿ é ãã£ãŒã«ãäžè¶³:
{
"error": {
"message": "must have ownerId when creating a new channel"
}
}
ã¹ããŒãæ€èšŒãšã©ãŒ:
{
"error": {
"message": "Validation Error",
"data": [
"request body must have required property 'ownerId'"
]
}
}
远å ããããã£ãšã©ãŒ:
{
"error": {
"message": "Validation Error",
"data": [
"request body must NOT have additional properties"
]
}
}
{
"error": {
"message": "Validation Error",
"data": [
"request body must NOT have additional properties",
"request body must NOT have additional properties"
]
}
}
2. ãã£ã³ãã«äžèЧâ
ãã£ã«ã¿ãããŒãžã³ã°ãæå®ããŠå šãã£ã³ãã«ãååŸããŸãã
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/channels - ããããŒ:
Authorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: name, ownerId ãšããŒãžã³ã°ïŒpage, limitïŒã®ã¯ãšãªæ€èšŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ããŸãã¯æ¬äººïŒèªåã®ãã£ã³ãã«ãååŸããå ŽåïŒ
ã¯ãšãªãã©ã¡ãŒã¿:
| ãã©ã¡ãŒã¿ | å | å¿ é | 説æ |
|---|---|---|---|
name | string | â | ãã£ã³ãã«åã§ãã£ã«ã¿ |
ownerId | string | â | ææè IDã§ãã£ã«ã¿ |
page | number | â | ããŒãžçªå· |
limit | number | â | 1ããŒãžãããã®ä»¶æ° |
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
name | string | ãã£ã³ãã«å/ã¿ã€ãã« |
ownerId | string | ãã®ãã£ã³ãã«ãææãããŠãŒã¶ãŒã®ID |
createdAt | string | äœææ¥æ |
id | string | ãã£ã³ãã«äžæID |
updatedAt | string | æçµæŽæ°æ¥æ |
ãªã¯ãšã¹ãäŸ:
curl http://localhost:8089/channels
æåã¬ã¹ãã³ã¹:
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"name": "Project Updates",
"ownerId": "user-456",
"createdAt": "2025-06-24T08:33:40.146Z",
"id": "af62eac3-06aa-481a-8c44-a029e96de2ed",
"updatedAt": "2025-06-24T08:33:40.146Z"
}
]
3. ãã£ã³ãã«ååŸâ
ID ã§ç¹å®ã®ãã£ã³ãã«ãååŸããŸãã
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/channels/:channelId - ããããŒ:
Authorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: ãã£ã³ãã«IDã®ãã¹ãã©ã¡ãŒã¿æ€èšŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ããã£ã³ãã«ææè ããŸãã¯åœè©²ãã£ã³ãã«ã®æå¹ãªãµãã¹ã¯ãªãã·ã§ã³
ãªã¯ãšã¹ãäŸ:
curl http://localhost:8089/channels/af62eac3-06aa-481a-8c44-a029e96de2ed
4. ãã£ã³ãã«ã¢ã€ã³ã³ã®ã¢ããããŒã URL ãååŸâ
ãã£ã³ãã«ã¢ã€ã³ã³ç»åãå®å šã«ã¢ããããŒãããããã®çœ²åä»ã URL ãçæããŸãããªããžã§ã¯ã ID ãšäžæçãªçœ²åä»ã URL ãè¿ããŸãã
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/channels/:channelId/icon-upload-url - ããããŒ:
Authorization: Bearer <token>ãx-nb-fingerprint: <device-fingerprint> - èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
URL ãã©ã¡ãŒã¿:
| ãã©ã¡ãŒã¿ | å | å¿ é | 説æ |
|---|---|---|---|
channelId | string | â | 察象ãã£ã³ãã«ã® ID |
ã¯ãšãªãã©ã¡ãŒã¿:
| ãã©ã¡ãŒã¿ | å | å¿ é | 説æ |
|---|---|---|---|
contentType | string | â | ç»åã® MIME ã¿ã€ãïŒäŸ: image/pngãimage/jpegïŒ |
contentLength | number | â | ãã¡ã€ã«ãµã€ãºïŒãã€ããæå€§ 10MBïŒ |
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
objectId | string | ã¢ã€ã³ã³çšã«çæãããã¹ãã¬ãŒãžãªããžã§ã¯ã ID |
url | string | ãã¡ã€ã«ã¢ããããŒãçšã®çœ²åä»ã URL |
ããªããŒã·ã§ã³: ç»åã¢ããããŒãã¹ããŒãïŒã³ã³ãã³ãã¿ã€ããšãµã€ãºã®å¶çŽïŒã䜿çšããŸããèªèšŒæžã¿ã§ããã管çè ãŸãã¯ãã£ã³ãã«ææè ã§ããå¿ èŠããããŸãã
ãªã¯ãšã¹ãäŸ:
curl "http://localhost:8089/channels/af62eac3-06aa-481a-8c44-a029e96de2ed/icon-upload-url?contentType=image/jpeg&contentLength=524288" \
-H "Authorization: Bearer <token>"
æåã¬ã¹ãã³ã¹:
HTTP/1.1 200 OK
Content-Type: application/json
{
"objectId": "7edfb95f-0ab6-4adc-a6e1-2a86a2f1e6d2",
"url": "https://storage.googleapis.com/bucket/channels/icons/...&X-Goog-Expires=900&X-Goog-Signature=..."
}
äœ¿çšæé :
contentTypeãšcontentLengthãæå®ããŠãã®ãšã³ããã€ã³ããåŒã³åºãã眲åä»ã URL ãååŸããŸãã- è¿ããã
urlã«ãã¡ã€ã«ãã€ããªãå«ã PUT ãªã¯ãšã¹ããéããã¢ã€ã³ã³ãã¯ã©ãŠãã¹ãã¬ãŒãžãžçŽæ¥ã¢ããããŒãããŸãã - è¿ããã
objectIdãä¿åããã¢ããããŒãæžã¿ã®ã¢ã€ã³ã³ãåç §ããŸãã
ãšã©ãŒã¬ã¹ãã³ã¹: ã¯ãšãªãã©ã¡ãŒã¿ãäžè¶³ãããš Validation Errorãç»å以å€ã®ã³ã³ãã³ãã¿ã€ãã§ã¯ Invalid content type - must be an imageã10MB è¶
éã§ã¯ File size exceeds maximum allowed (10MB) ãè¿ããŸãããã£ã³ãã«ããªãå Žå㯠Channel not foundãææè
ãŸãã¯ç®¡çè
ã§ãªãå Žå㯠Unauthorized - must be channel owner or admin ãè¿ããŸãã
5. ãã£ã³ãã«æŽæ°â
æ¢åã®ãã£ã³ãã«ã®ããããã£ãæŽæ°ããŸãã
ãªã¯ãšã¹ã:
- Method:
PATCH - Path:
/channels/:channelId - ããããŒ:
Content-Type: application/jsonAuthorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: éšåæŽæ°ã¹ããŒãïŒå šãã£ãŒã«ãä»»æã远å ããããã£ãªãïŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ãŸãã¯ãã£ã³ãã«ææè
ãªã¯ãšã¹ãããã£:
| ãã£ãŒã«ã | å | å¿ é | 説æ |
|---|---|---|---|
name | string | â | æ°ãããã£ã³ãã«å/ã¿ã€ãã« |
ownerId | string | â | æ°ããææè ID |
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
name | string | æŽæ°åŸã®ãã£ã³ãã«å/ã¿ã€ãã« |
ownerId | string | æŽæ°åŸã®ææè ID |
createdAt | string | äœææ¥æ |
id | string | ãã£ã³ãã«äžæID |
updatedAt | string | æçµæŽæ°æ¥æ |
ãªã¯ãšã¹ãäŸ:
curl -X PATCH http://localhost:8089/channels/af62eac3-06aa-481a-8c44-a029e96de2ed \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Project Updates"
}'
5. ãã£ã³ãã«åé€â
ãã£ã³ãã«ãšé¢é£ããŒã¿ãåé€ããŸãã
ãªã¯ãšã¹ã:
- Method:
DELETE - Path:
/channels/:channelId - ããããŒ:
Authorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: ãã£ã³ãã«IDã®ãã¹ãã©ã¡ãŒã¿æ€èšŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ãŸãã¯ãã£ã³ãã«ææè
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
| ãªã | - | æåæã¯ã¬ã¹ãã³ã¹ããã£ãªã |
ãªã¯ãšã¹ãäŸ:
curl -X DELETE http://localhost:8089/channels/af62eac3-06aa-481a-8c44-a029e96de2ed
æåã¬ã¹ãã³ã¹:
- ã¹ããŒã¿ã¹:
204 No Content - ããã£: ïŒç©ºïŒ
èŠã€ãããªãå Žåã®ãšã©ãŒäŸ:
{
"error": {
"message": "Channel not found"
}
}
ð ãµãã¹ã¯ãªãã·ã§ã³æäœâ
6. ãµãã¹ã¯ãªãã·ã§ã³äœæâ
ãã£ã³ãã«ãžã®æ°èŠãµãã¹ã¯ãªãã·ã§ã³ãäœæããŸãã
ãªã¯ãšã¹ã:
- Method:
POST - Path:
/subscriptions - ããããŒ:
Content-Type: application/jsonAuthorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: èªåé©çšïŒchannelId ãš subscribedId ãå¿ é ã远å ããããã£ãªãïŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ãŸãã¯æ¬äººïŒè³Œèªè ãèªèšŒãŠãŒã¶ãŒïŒ
ãªã¯ãšã¹ãããã£:
| ãã£ãŒã«ã | å | å¿ é | 説æ |
|---|---|---|---|
channelId | string | â | 賌èªå¯Ÿè±¡ã®ãã£ã³ãã«ID |
approved | boolean | â | ãµãã¹ã¯ãªãã·ã§ã³ãæ¿èªæžã¿ã |
permissions | array | â | æš©éæååã®é å |
subscribedAt | string | â | ãµãã¹ã¯ãªãã·ã§ã³äœææ¥æ |
subscribedId | string | â | 賌èªãŠãŒã¶ãŒã®ID |
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
channelId | string | 賌èªå¯Ÿè±¡ã®ãã£ã³ãã«ID |
subscribedId | string | 賌èªãŠãŒã¶ãŒã®ID |
approved | boolean | ãµãã¹ã¯ãªãã·ã§ã³ãæ¿èªæžã¿ã |
permissions | array | æš©éæååã®é å |
subscribedAt | string | ãµãã¹ã¯ãªãã·ã§ã³äœææ¥æ |
createdAt | string | äœææ¥æ |
id | string | ãµãã¹ã¯ãªãã·ã§ã³äžæID |
updatedAt | string | æçµæŽæ°æ¥æ |
ãªã¯ãšã¹ãäŸ:
curl -X POST http://localhost:8089/subscriptions \
-H "Content-Type: application/json" \
-d '{
"channelId": "af62eac3-06aa-481a-8c44-a029e96de2ed",
"subscribedId": "user-456",
"approved": true,
"permissions": ["read", "write"]
}'
æåã¬ã¹ãã³ã¹:
HTTP/1.1 201 Created
Content-Type: application/json
{
"channelId": "af62eac3-06aa-481a-8c44-a029e96de2ed",
"subscribedId": "user-456",
"approved": true,
"permissions": ["read", "write"],
"createdAt": "2025-06-27T02:16:07.916Z",
"id": "b17501d6-2576-4a18-86f5-3545da75e678",
"updatedAt": "2025-06-27T02:16:07.916Z"
}
ããªããŒã·ã§ã³ãšã©ãŒäŸ:
{
"error": {
"message": "Validation Error",
"data": [
"request body must have required property 'channelId'",
"request body must have required property 'subscribedId'",
]
}
}
{
"error": {
"message": "Validation Error",
"data": [
"request body must NOT have additional properties",
]
}
}
7. ãµãã¹ã¯ãªãã·ã§ã³äžèЧâ
ãã£ã«ã¿ãããŒãžã³ã°ãæå®ããŠãµãã¹ã¯ãªãã·ã§ã³ãååŸããŸãã
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/subscriptions - ããããŒ:
Authorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: approved, channelId, subscribedAt, subscribedId ãšããŒãžã³ã°ïŒpage, limitïŒã®ã¯ãšãªæ€èšŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ãåœè©²ãã£ã³ãã«ã®æå¹ãªãµãã¹ã¯ãªãã·ã§ã³ããã£ã³ãã«ææè ããŸãã¯æ¬äººïŒè³Œèªè ïŒ
ã¯ãšãªãã©ã¡ãŒã¿:
| ãã©ã¡ãŒã¿ | å | å¿ é | 説æ |
|---|---|---|---|
approved | boolean | â | æ¿èªç¶æ ã§ãã£ã«ã¿ |
channelId | string | â | ãã£ã³ãã«IDã§ãã£ã«ã¿ |
subscribedId | string | â | 賌èªè IDã§ãã£ã«ã¿ |
subscribedAt | string | â | è³Œèªæ¥æã§ãã£ã«ã¿ |
page | number | â | ããŒãžçªå· |
limit | number | â | 1ããŒãžãããã®ä»¶æ° |
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
channelId | string | 賌èªå¯Ÿè±¡ã®ãã£ã³ãã«ID |
subscribedId | string | 賌èªãŠãŒã¶ãŒã®ID |
approved | boolean | ãµãã¹ã¯ãªãã·ã§ã³ãæ¿èªæžã¿ã |
permissions | array | æš©éæååã®é å |
subscribedAt | string | ãµãã¹ã¯ãªãã·ã§ã³äœææ¥æ |
createdAt | string | äœææ¥æ |
id | string | ãµãã¹ã¯ãªãã·ã§ã³äžæID |
updatedAt | string | æçµæŽæ°æ¥æ |
ãªã¯ãšã¹ãäŸ:
curl http://localhost:8089/subscriptions
8. ãµãã¹ã¯ãªãã·ã§ã³ååŸâ
ID ã§ç¹å®ã®ãµãã¹ã¯ãªãã·ã§ã³ãååŸããŸãã
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/subscriptions/:subscriptionId - ããããŒ:
Authorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: ãµãã¹ã¯ãªãã·ã§ã³IDã®ãã¹ãã©ã¡ãŒã¿æ€èšŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ãŸãã¯ãµãã¹ã¯ãªãã·ã§ã³ææè
ãªã¯ãšã¹ãäŸ:
curl http://localhost:8089/subscriptions/b17501d6-2576-4a18-86f5-3545da75e678
9. ãµãã¹ã¯ãªãã·ã§ã³åé€â
ãµãã¹ã¯ãªãã·ã§ã³ãåé€ïŒãã£ã³ãã«ã®è³Œèªè§£é€ïŒããŸãã
ãªã¯ãšã¹ã:
- Method:
DELETE - Path:
/subscriptions/:subscriptionId - ããããŒ:
Authorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: ãµãã¹ã¯ãªãã·ã§ã³IDã®ãã¹ãã©ã¡ãŒã¿æ€èšŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ãŸãã¯ãµãã¹ã¯ãªãã·ã§ã³ææè
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
| ãªã | - | æåæã¯ã¬ã¹ãã³ã¹ããã£ãªã |
ãªã¯ãšã¹ãäŸ:
curl -X DELETE http://localhost:8089/subscriptions/b17501d6-2576-4a18-86f5-3545da75e678
æåã¬ã¹ãã³ã¹:
- ã¹ããŒã¿ã¹:
204 No Content - ããã£: ïŒç©ºïŒ
èŠã€ãããªãå Žåã®ãšã©ãŒäŸ:
{
"error": {
"message": "Subscription not found"
}
}
ð¬ ã¡ãã»ãŒãžæäœâ
10. ã¡ãã»ãŒãžäœæâ
ãã£ã³ãã«ã«æ°ããã¡ãã»ãŒãžãéä¿¡ããŸãã
ãªã¯ãšã¹ã:
- Method:
POST - Path:
/messages - ããããŒ:
Content-Type: application/jsonAuthorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: èªåé©çšïŒcontent, senderId, channelId ãå¿ é ã远å ããããã£ãªãïŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- éä¿¡è æ¬äººã§ããããš
- åœè©²ãã£ã³ãã«ã®æå¹ãªãµãã¹ã¯ãªãã·ã§ã³ãããããš
ãªã¯ãšã¹ãããã£:
| ãã£ãŒã«ã | å | å¿ é | 説æ |
|---|---|---|---|
channelId | string | â | ã¡ãã»ãŒãžãéä¿¡ããããã£ã³ãã«ã®ID |
content | string | â | ã¡ãã»ãŒãžæ¬æ |
senderId | string | â | ã¡ãã»ãŒãžéä¿¡è ã®ãŠãŒã¶ãŒID |
title | string | â | ä»»æã®ã¡ãã»ãŒãžã¿ã€ãã« |
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
channelId | string | ã¡ãã»ãŒãžãéä¿¡ããããã£ã³ãã«ã®ID |
content | string | ã¡ãã»ãŒãžæ¬æ |
senderId | string | ã¡ãã»ãŒãžéä¿¡è ã®ãŠãŒã¶ãŒID |
title | string | ä»»æã®ã¡ãã»ãŒãžã¿ã€ãã« |
createdAt | string | äœææ¥æ |
id | string | ã¡ãã»ãŒãžäžæID |
updatedAt | string | æçµæŽæ°æ¥æ |
ãªã¯ãšã¹ãäŸ:
curl -X POST http://localhost:8089/messages \
-H "Content-Type: application/json" \
-d '{"channelId": "test-channel-123", "content": "Hello world!", "senderId": "user-456"}'
æåã¬ã¹ãã³ã¹:
{
"channelId": "test-channel-123",
"content": "Hello world!",
"senderId": "user-456",
"createdAt": "2025-07-01T03:22:06.178Z",
"id": "2b43d66c-9cab-434b-9cb7-18de8d3ec9c9",
"updatedAt": "2025-07-01T03:22:06.178Z"
}
ããªããŒã·ã§ã³ãšã©ãŒäŸ:
{
"error": {
"message": "Validation Error",
"data": [
"request body must have required property 'senderId'",
"request body must have required property 'channelId'"
]
}
}
11. ã¡ãã»ãŒãžäžèЧâ
ç¹å®ã®ãã£ã³ãã«ã®ã¡ãã»ãŒãžãååŸããŸãã
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/messages?channelId=:channelId - ããããŒ:
Authorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: channelIdïŒå¿ é ïŒãä»»æã® content, senderId, titleãããã³ããŒãžã³ã°ïŒpage, limitïŒã®ã¯ãšãªæ€èšŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ãåœè©²ãã£ã³ãã«ã®æå¹ãªãµãã¹ã¯ãªãã·ã§ã³ããŸãã¯éä¿¡è æ¬äºº
ã¯ãšãªãã©ã¡ãŒã¿:
| ãã©ã¡ãŒã¿ | å | å¿ é | 説æ |
|---|---|---|---|
channelId | string | â | ååŸå¯Ÿè±¡ã®ãã£ã³ãã«ID |
content | string | â | ã¡ãã»ãŒãžæ¬æã§ãã£ã«ã¿ |
senderId | string | â | éä¿¡è IDã§ãã£ã«ã¿ |
title | string | â | ã¡ãã»ãŒãžã¿ã€ãã«ã§ãã£ã«ã¿ |
page | number | â | ããŒãžçªå· |
limit | number | â | 1ããŒãžãããã®ä»¶æ° |
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
channelId | string | ã¡ãã»ãŒãžãéä¿¡ããããã£ã³ãã«ã®ID |
content | string | ã¡ãã»ãŒãžæ¬æ |
senderId | string | ã¡ãã»ãŒãžéä¿¡è ã®ãŠãŒã¶ãŒID |
title | string | ä»»æã®ã¡ãã»ãŒãžã¿ã€ãã« |
createdAt | string | äœææ¥æ |
id | string | ã¡ãã»ãŒãžäžæID |
updatedAt | string | æçµæŽæ°æ¥æ |
ãªã¯ãšã¹ãäŸ:
curl "http://localhost:8089/messages?channelId=test-channel-123"
æåã¬ã¹ãã³ã¹:
[
{
"channelId": "test-channel-123",
"content": "Updated message content",
"senderId": "user-456",
"createdAt": "2025-07-01T03:22:06.178Z",
"id": "2b43d66c-9cab-434b-9cb7-18de8d3ec9c9",
"updatedAt": "2025-07-01T03:22:34.413Z"
}
]
ããªããŒã·ã§ã³ãšã©ãŒäŸ:
{
"error": {
"message": "Validation Error",
"data": [
"query parameter 'channelId' is required"
]
}
}
12. ã¡ãã»ãŒãžååŸïŒIDæå®ïŒâ
ID ã§ç¹å®ã®ã¡ãã»ãŒãžãååŸããŸãã
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/messages/:messageId - ããããŒ:
Authorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: ã¡ãã»ãŒãžIDã®ãã¹ãã©ã¡ãŒã¿æ€èšŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ãŸãã¯ã¡ãã»ãŒãžææè
ãªã¯ãšã¹ãäŸ:
curl http://localhost:8089/messages/2b43d66c-9cab-434b-9cb7-18de8d3ec9c9
æåã¬ã¹ãã³ã¹:
{
"channelId": "test-channel-123",
"content": "Updated message content",
"senderId": "user-456",
"createdAt": "2025-07-01T03:22:06.178Z",
"id": "2b43d66c-9cab-434b-9cb7-18de8d3ec9c9",
"updatedAt": "2025-07-01T03:22:34.413Z"
}
Not Found ãšã©ãŒäŸ:
{
"error": {
"message": "Message not found"
}
}
13. ã¡ãã»ãŒãžæŽæ°â
æ¢åã®ã¡ãã»ãŒãžå å®¹ãæŽæ°ããŸãã
ãªã¯ãšã¹ã:
- Method:
PATCH - Path:
/messages/:messageId - ããããŒ:
Content-Type: application/jsonAuthorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: éšåæŽæ°ã¹ããŒãïŒå šãã£ãŒã«ãä»»æãã¡ãã»ãŒãžIDã®ãã¹æ€èšŒã远å ããããã£ãªãïŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ãŸãã¯ã¡ãã»ãŒãžææè
ãªã¯ãšã¹ãããã£:
| ãã£ãŒã«ã | å | å¿ é | 説æ |
|---|---|---|---|
content | string | â | æŽæ°åŸã®ã¡ãã»ãŒãžæ¬æ |
title | string | â | æŽæ°åŸã®ã¡ãã»ãŒãžã¿ã€ãã« |
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
channelId | string | ã¡ãã»ãŒãžãéä¿¡ããããã£ã³ãã«ã®ID |
content | string | æŽæ°åŸã®ã¡ãã»ãŒãžæ¬æ |
senderId | string | ã¡ãã»ãŒãžéä¿¡è ã®ãŠãŒã¶ãŒID |
title | string | æŽæ°åŸã®ã¡ãã»ãŒãžã¿ã€ãã« |
createdAt | string | äœææ¥æ |
id | string | ã¡ãã»ãŒãžäžæID |
updatedAt | string | æçµæŽæ°æ¥æ |
ãªã¯ãšã¹ãäŸ:
curl -X PATCH http://localhost:8089/messages/2b43d66c-9cab-434b-9cb7-18de8d3ec9c9 \
-H "Content-Type: application/json" \
-d '{"content": "Updated message content"}'
æåã¬ã¹ãã³ã¹:
{
"channelId": "test-channel-123",
"content": "Updated message content",
"senderId": "user-456",
"createdAt": "2025-07-01T03:22:06.178Z",
"id": "2b43d66c-9cab-434b-9cb7-18de8d3ec9c9",
"updatedAt": "2025-07-01T03:22:34.413Z"
}
Not Found ãšã©ãŒäŸ:
{
"error": {
"message": "Chat message not found"
}
}
14. ã¡ãã»ãŒãžåé€â
ãã£ã³ãã«ããã¡ãã»ãŒãžãåé€ããŸãã
ãªã¯ãšã¹ã:
- Method:
DELETE - Path:
/messages/:messageId - ããããŒ:
Authorization: Bearer <token>x-nb-fingerprint: <device-fingerprint>
- èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é
ããªããŒã·ã§ã³:
- ã¹ããŒãæ€èšŒ: ã¡ãã»ãŒãžIDã®ãã¹ãã©ã¡ãŒã¿æ€èšŒ
- ã«ãŒãããªããŒã·ã§ã³:
- èªèšŒæžã¿ãªã¯ãšã¹ãïŒãã¢ã©ãŒïŒå¿ é
- 管çè ããŒã«ãŸãã¯ã¡ãã»ãŒãžææè
ã¬ã¹ãã³ã¹ããã£:
| ãã£ãŒã«ã | å | 説æ |
|---|---|---|
| ãªã | - | æåæã¯ã¬ã¹ãã³ã¹ããã£ãªã |
ãªã¯ãšã¹ãäŸ:
curl -X DELETE http://localhost:8089/messages/81950444-5223-47c8-8a8c-0604c2955f15
æåã¬ã¹ãã³ã¹:
- ã¹ããŒã¿ã¹:
204 No Content - ããã£: ïŒç©ºïŒ
èŠã€ãããªãå Žåã®ãšã©ãŒäŸ:
{
"error": {
"message": "Chat message not found"
}
}
ð ã¡ãã»ãŒãžãã³ãã¬ãŒãæäœâ
ã¡ãã»ãŒãžãã³ãã¬ãŒãã¯åå©çšå¯èœãªã¡ãã»ãŒãžå
容ã§ãããã¹ãŠã®ãã³ãã¬ãŒãæäœã«ã¯ãã¢ã©ãŒããŒã¯ã³ãå¿
èŠã§ãçµç¹ã«å±ãããã³ãã¬ãŒãã§ã¯ç®¡çè
ããŸãã¯ãã®çµç¹ã® ownerïŒadmin æš©éãå¿
èŠã§ãã
16. ã¡ãã»ãŒãžãã³ãã¬ãŒããäœæâ
ãªã¯ãšã¹ã:
- Method:
POST - Path:
/message-templates - ããããŒ:
Content-Type: application/json
| ãã£ãŒã«ã | å | å¿ é | 説æ |
|---|---|---|---|
content | string | â | ãã³ãã¬ãŒãã®ã¡ãã»ãŒãžæ¬æ |
title | string | â | ãã³ãã¬ãŒãã®ã¿ã€ãã«ãŸãã¯èª¬æ |
organizationId | string | â | ãã³ãã¬ãŒãã®å¯Ÿè±¡çµç¹ |
content ãš title ã¯å¿
é ã§ããèªèšŒæžã¿ã§ããã管çè
ããŸãã¯æ¬æã® organizationId ã«å¯Ÿããçµç¹ ownerïŒadmin ã§ããå¿
èŠããããŸãã
curl -X POST {{host}}/message-templates \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-H "x-nb-fingerprint: <device-fingerprint>" \
-d '{"content":"Welcome to our community! Please follow our guidelines.","title":"Welcome Message","organizationId":"org-123"}'
æåã¬ã¹ãã³ã¹:
HTTP/1.1 201 Created
Content-Type: application/json
{
"content": "Welcome to our community! Please follow our guidelines.",
"createdAt": "2025-01-20T10:30:00.000Z",
"id": "template-uuid-here",
"organizationId": "org-123",
"title": "Welcome Message",
"updatedAt": "2025-01-20T10:30:00.000Z"
}
å¿
é é
ç®ããªãå Žå㯠Validation Error ãè¿ããŸãã
{
"error": {
"message": "Validation Error",
"data": [
"request body must have required property 'content'",
"request body must have required property 'title'"
]
}
}
17. ID ã§ã¡ãã»ãŒãžãã³ãã¬ãŒããååŸâ
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/message-templates/:messageTemplateId
messageTemplateId ã¯å¿
é ã®ãã³ãã¬ãŒãäžæèå¥åã§ããèªèšŒæžã¿ã§ããã管çè
ããŸãã¯ãã³ãã¬ãŒãã«ã¢ã¯ã»ã¹ã§ããçµç¹ ownerïŒadmin ã§ããå¿
èŠããããŸããæåæã¯ 200 OK ãšãã³ãã¬ãŒããè¿ããååšããªãå Žå㯠Chat message template not found ãè¿ããŸãã
curl -X GET {{host}}/message-templates/template-123 \
-H "Authorization: Bearer <token>" \
-H "x-nb-fingerprint: <device-fingerprint>"
HTTP/1.1 200 OK
Content-Type: application/json
{
"content": "Welcome to our community! Please follow our guidelines.",
"createdAt": "2025-01-20T10:30:00.000Z",
"id": "template-123",
"organizationId": "org-123",
"title": "Welcome Message",
"updatedAt": "2025-01-20T10:30:00.000Z"
}
{
"error": { "message": "Chat message template not found" }
}
18. ã¡ãã»ãŒãžãã³ãã¬ãŒããæŽæ°â
ãªã¯ãšã¹ã:
- Method:
PATCH - Path:
/message-templates/:messageTemplateId
æ¬æã§ã¯ä»»æã® content ãš title ãéšåæŽæ°ã§ããŸãããã¹ãã©ã¡ãŒã¿ãšéšåæ¬æãæ€èšŒãã管çè
ãŸãã¯ãã³ãã¬ãŒãã®çµç¹ ownerïŒadmin ãèŠæ±ããŸãã
curl -X PATCH {{host}}/message-templates/template-123 \
-H "Authorization: Bearer <token>" \
-H "x-nb-fingerprint: <device-fingerprint>" \
-H "Content-Type: application/json" \
-d '{"content":"Updated welcome message content","title":"Updated Welcome Message"}'
æåæã¯ 200 OKã該åœããªãå Žå㯠Chat message template not foundãç¡å¹ãªããŒã¯ã³ã§ã¯ token could not be verifiedãæš©éäžè¶³ã§ã¯ Identity is not allowed access to this resource ãè¿ããŸãã
HTTP/1.1 200 OK
Content-Type: application/json
{
"content": "Updated welcome message content",
"createdAt": "2025-01-20T10:30:00.000Z",
"id": "template-123",
"organizationId": "org-123",
"title": "Updated Welcome Message",
"updatedAt": "2025-01-25T14:20:00.000Z"
}
{ "error": { "message": "Identity is not allowed access to this resource" } }
{ "error": { "message": "token could not be verified" } }
19. ã¡ãã»ãŒãžãã³ãã¬ãŒããåé€â
ãªã¯ãšã¹ã:
- Method:
DELETE - Path:
/message-templates/:messageTemplateId
管çè
ãŸãã¯çµç¹ ownerïŒadmin ãåé€ã§ããŸããæåæã¯ 204 No Contentãåé€ã«å€±æããå Žå㯠Failed to delete message template ãè¿ããŸãã
curl -X DELETE {{host}}/message-templates/template-123 \
-H "Authorization: Bearer <token>" \
-H "x-nb-fingerprint: <device-fingerprint>"
HTTP/1.1 204 No Content
{ "error": { "message": "Failed to delete message template" } }
{ "error": { "message": "Chat message template not found" } }
{ "error": { "message": "token could not be verified" } }
20. ã¡ãã»ãŒãžãã³ãã¬ãŒãäžèЧâ
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/message-templates
管çè
å°çšã§ãpageïŒ1ïœ1000ïŒãš limitïŒ1ïœ50ïŒã«ããããŒãžããŒã·ã§ã³ãåãåããŸããã¬ã¹ãã³ã¹ã¯ãã³ãã¬ãŒãé
åã dataãããŒãžæ
å ±ã metadata.pagination ã«æ ŒçŽããŸããcheckIdentityType(['admin']) ã䜿çšããŠèªå¯ããŸãã
curl "http://localhost:8089/message-templates?page=1&limit=10" \
-H "Authorization: Bearer <token>" \
-H "x-nb-fingerprint: <device-fingerprint>"
èªèšŒã«å€±æãããš token could not be verifiedãæš©éäžè¶³ã§ã¯ Identity is not authorized to access this resourceãååŸå€±æã§ã¯ Failed to find message templates ãè¿ããŸãã
{
"data": [{
"id": "template-123",
"title": "Welcome Message",
"content": "Hello, welcome to our chat!",
"organizationId": "org-456",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}],
"metadata": { "pagination": { "page": 1, "limit": 10, "total": 1, "totalPages": 1, "hasNext": false, "hasPrev": false } }
}
{ "error": { "message": "Identity is not authorized to access this resource" } }
{ "error": { "message": "Failed to find message templates" } }
21. çµç¹ã®ã¡ãã»ãŒãžãã³ãã¬ãŒãäžèЧâ
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/organizations/:organizationId/message-templates
å¿
é ã® organizationId ãšãä»»æã® pageïŒæ¢å®å€ 1ïŒããã³ limitïŒæ¢å®å€ 10ïŒãåãåããŸããçµç¹ã® owner ãŸã㯠admin ã§ããã¡ã³ããŒã ããã¢ã¯ã»ã¹ã§ããŸããæåæã¯ data ãš metadata.pagination ãå«ã 200 OK ãè¿ããŸãã
curl "http://localhost:8089/organizations/org-123/message-templates?page=1&limit=10" \
-H "Authorization: Bearer <token>" \
-H "x-nb-fingerprint: <device-fingerprint>"
èªèšŒå€±ææã¯ token could not be verifiedãçµç¹ã¡ã³ããŒã§ãªãå Žå㯠Identity is not a member of the organizationãååŸå€±ææã¯ Failed to find message templates ãè¿ããŸãã
{
"data": [{
"id": "template-456",
"title": "Organization Welcome",
"content": "Welcome to our organization chat!",
"organizationId": "org-123",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}],
"metadata": { "pagination": { "page": 1, "limit": 10, "total": 1, "totalPages": 1, "hasNext": false, "hasPrev": false } }
}
{ "error": { "message": "Identity is not a member of the organization" } }
22. ãã£ã³ãã« ID ã§ã¡ãã»ãŒãžãååŸâ
ãã£ã³ãã«ã¹ã³ãŒãã®ãã¹ããããã£ã³ãã«ã®ã¡ãã»ãŒãžãããŒãžããŒã·ã§ã³ä»ãã§ååŸããŸãã
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/channels/:channelId/messages - èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é ïŒãã£ã³ãã«ã賌èªããŠããå¿ èŠããããŸãïŒ
URL ãã©ã¡ãŒã¿:
| ãã©ã¡ãŒã¿ | å | å¿ é | 説æ |
|---|---|---|---|
channelId | string | â | ãã£ã³ãã«èå¥å |
ã¯ãšãªãã©ã¡ãŒã¿:
| ãã©ã¡ãŒã¿ | å | å¿ é | 説æ |
|---|---|---|---|
page | number | â | ããŒãžçªå·ïŒ1ïœ1000ïŒ |
limit | number | â | 1 ããŒãžãããã®ä»¶æ°ïŒ1ïœ50ïŒ |
ããªããŒã·ã§ã³: isAuthenticatedãchannelExistsãhasSubscription ã䜿çšããŸãã
æåã¬ã¹ãã³ã¹: ã¡ãã»ãŒãžäžèЧãšåãã{ data, metadata.pagination } ã®ããŒãžããŒã·ã§ã³åœ¢åŒã§ããæ·»ä»ãã¡ã€ã«é
ç®ã¯ { url, type } ã«æ£èŠåãããŸãã
23. ã¡ãã»ãŒãžæ·»ä»ãã¡ã€ã«ã®ã¢ããããŒã URL ãååŸâ
æ¢åã¡ãã»ãŒãžã«ãã¡ã€ã«ãæ·»ä»ããããã®çœ²åä»ãã¢ããããŒã URL ãçæããŸããfileStorageDriver ãå¿
èŠã§ãã
ãšã³ããã€ã³ã衚èšã¯ GET /messages/:messageId/attachment-upload-url ã§ãã
ãªã¯ãšã¹ã:
- Method:
GET - Path:
/messages/:messageId/attachment-upload-url - èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é ïŒã¡ãã»ãŒãžææè ïŒ
URL ãã©ã¡ãŒã¿:
| ãã©ã¡ãŒã¿ | å | å¿ é | 説æ |
|---|---|---|---|
messageId | string | â | ã¡ãã»ãŒãžèå¥å |
ã¯ãšãªãã©ã¡ãŒã¿:
| ãã©ã¡ãŒã¿ | å | å¿ é | 説æ |
|---|---|---|---|
contentType | string | â | ã¢ããããŒããããã¡ã€ã«ã® MIME ã¿ã€ã |
contentLength | number | â | ãã¡ã€ã«ãµã€ãºïŒãã€ãïŒ |
ãªã¯ãšã¹ãäŸ:
curl "{{host}}/messages/<messageId>/attachment-upload-url?contentType=image/png&contentLength=1048576" \
-H "Authorization: Bearer <access-token>"
æåã¬ã¹ãã³ã¹ïŒ200ïŒ: { objectId, url }ããŸãã¯ãã¡ã€ã«ã¹ãã¬ãŒãžãã©ã€ããŒãè¿ãåçã®ã¢ããããŒã URL ãã€ããŒãã§ãã
24. ã¡ãã»ãŒãžæ·»ä»ãã¡ã€ã«ãäœæâ
äºåã«ã¢ããããŒããããã¡ã€ã«ãã¡ãã»ãŒãžã«æ·»ä»ããŸããã¡ãã»ãŒãžäœææã«ã¯æ·»ä»ãããŸããã
ãšã³ããã€ã³ã衚èšã¯ POST /messages/:messageId/attachments ã§ãã
ãªã¯ãšã¹ã:
- Method:
POST - Path:
/messages/:messageId/attachments - ããããŒ:
Content-Type: application/jsonãAuthorization: Bearer <access-token> - èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é ïŒã¡ãã»ãŒãžææè ïŒ
ãªã¯ãšã¹ãããã£:
| ãã£ãŒã«ã | å | å¿ é | 説æ |
|---|---|---|---|
objectId | string (UUID) | â | ã¢ããããŒã URL ååŸæã«è¿ãããã¹ãã¬ãŒãžãªããžã§ã¯ã ID |
type | string | â | MIME ã¿ã€ããŸãã¯ãã¡ã€ã«ã«ããŽãª |
ãªã¯ãšã¹ãäŸ:
curl -X POST {{host}}/messages/<messageId>/attachments \
-H "Authorization: Bearer <access-token>" \
-H "Content-Type: application/json" \
-d '{"objectId": "7edfb95f-0ab6-4adc-a6e1-2a86a2f1e6d2", "type": "image/png"}'
æåã¬ã¹ãã³ã¹: æ£èŠåãããæ·»ä»ãã¡ã€ã« { url, type } ãå«ã 201 Created ã§ãã
25. ã¡ãã»ãŒãžæ·»ä»ãã¡ã€ã«ãåé€â
ãªã¯ãšã¹ã:
- Method:
DELETE - Path:
/messages/:messageId/attachments/:attachmentId - èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿ é ïŒç®¡çè ãŸãã¯ã¡ãã»ãŒãžææè ïŒ
æåã¬ã¹ãã³ã¹: 204 No Contentã
26. ãã£ã³ãã«æ¢èªç¶æ ã upsertâ
ãã£ã³ãã«å ã§ ID ã«å¯Ÿå¿ãããæåŸã«èªãã ã¡ãã»ãŒãžãèšé²ããŸãã
ãªã¯ãšã¹ã:
- Method:
PUT - Path:
/channels/:channelId/read-state - ããããŒ:
Content-Type: application/jsonãAuthorization: Bearer <access-token> - èªå¯: ãã¢ã©ãŒããŒã¯ã³å¿
é ïŒè³Œèªæžã¿ã§ããã
identityIdã¯æ¬äººã§ããå¿ èŠããããŸãïŒ
ãªã¯ãšã¹ãããã£:
| ãã£ãŒã«ã | å | å¿ é | 説æ |
|---|---|---|---|
identityId | string | â | æ¢èªç¶æ ãæŽæ°ãã IDïŒããŒã¯ã³ãšäžèŽããå¿ èŠããããŸãïŒ |
lastReadMessageId | string | â | æåŸã«èªãã ã¡ãã»ãŒãžã® ID |
æåã¬ã¹ãã³ã¹: 204 No Contentã
27. ã¡ãã»ãŒãžãã¹ããªãŒãã³ã°ïŒWebSocketïŒâ
ãã£ã³ãã«ã®ã¡ãã»ãŒãžããªã¢ã«ã¿ã€ã ã§ã¹ããªãŒãã³ã°ããŸããchatService ã®ç¬¬ 3 åŒæ°ã« { webSocketServer } ãå¿
èŠã§ãã
ãªã¯ãšã¹ã:
- ãããã³ã«: WebSocket
- Path:
/messages/listen
ã¯ãšãªãã©ã¡ãŒã¿:
| ãã©ã¡ãŒã¿ | å | å¿ é | 説æ |
|---|---|---|---|
channelId | string | â | ã¹ããªãŒãã³ã°ã賌èªãããã£ã³ãã« |
泚èš: ãã®ã«ãŒãã®èªèšŒã»è³ŒèªããªããŒã¿ãŒã¯çŸåš SDK ã§ã³ã¡ã³ãã¢ãŠããããŠããŸããã²ãŒããŠã§ã€ã§ä¿è·ããããã«ã¹ã¿ã æ©èœãåæãããšãã«ããªããŒã¿ãŒãæå¹ã«ããŠãã ããã
âïž èšå®ãªãã·ã§ã³â
ãµãŒãã¹ããŒã¿ã¹ãã¢â
ãã£ãããµãŒãã¹ã«ã¯ identitiesãchatChannelsãsubscriptionsãchatMessagesãchatChannelReadStates ã®ã³ã¬ã¯ã·ã§ã³ãå¿
èŠã§ããorganizations ãš chatMessageTemplates ã¯ä»»æã§ãã
interface ChatServiceDataStore {
identities: Collection; // å¿
é : ãŠãŒã¶ãŒã¢ã€ãã³ãã£ãã£ã³ã¬ã¯ã·ã§ã³
chatChannels: Collection; // å¿
é : ãã£ãããã£ã³ãã«ã³ã¬ã¯ã·ã§ã³
organizations?: Collection; // ä»»æ: çµç¹ã³ã¬ã¯ã·ã§ã³
subscriptions: Collection; // å¿
é : ãã£ã³ãã«è³Œèªã³ã¬ã¯ã·ã§ã³
chatMessages: Collection; // å¿
é : ãã£ããã¡ãã»ãŒãžã³ã¬ã¯ã·ã§ã³
chatMessageTemplates?: Collection; // ä»»æ: ã¡ãã»ãŒãžãã³ãã¬ãŒãã³ã¬ã¯ã·ã§ã³
chatChannelReadStates: Collection; // å¿
é : ãã£ã³ãã«æ¢èªç¶æ
ã³ã¬ã¯ã·ã§ã³
}
ãµãŒãã¹èšå®â
interface ChatServiceConfiguration {
authSecrets: {
authEncSecret: string; // JWT encryption secret
authSignSecret: string; // JWT signing secret
};
authMode?: 'bearer' | 'cookie'; // æªæå®æã¯ bearer
identity?: {
typeIds?: {
admin: string; // Admin user type identifier
guest: string; // Guest user type identifier
regular: string; // Regular user type identifier
};
};
organization?: {
roles?: {
admin: string; // çµç¹ç®¡çè
ããŒã«ã®èå¥å
member: string; // çµç¹ã¡ã³ããŒããŒã«ã®èå¥å
owner: string; // çµç¹ææè
ããŒã«ã®èå¥å
};
};
}
èšå®è©³çްâ
ãã£ãããµãŒãã¹ã®èšå®ã¯ãã»ãã¥ãªãã£ãšãŠãŒã¶ãŒçš®å¥ç®¡çã®è«çã°ã«ãŒãã«æŽçãããŠããŸãã
ð ã»ãã¥ãªãã£èšå®â
authSecrets - JWT ããŒã¯ã³ã®ã»ãã¥ãªãã£ã·ãŒã¯ã¬ãã
- å:
{ authEncSecret: string; authSignSecret: string } - 説æ: JWT ã®æå·åããã³çœ²åã«äœ¿çšããç§å¯éµïŒããŒã¯ã³æ€èšŒã«äœ¿çšïŒ
- å¿ é : æ¬çªç°å¢ã§ã¯å¿ é
- åããããã£:
authEncSecret: JWT ãã€ããŒãæå·åã®ç§å¯éµauthSignSecret: JWT çœ²åæ€èšŒã®ç§å¯éµ
ð¥ ãŠãŒã¶ãŒçš®å¥èšå®â
identity.typeIds - ãŠãŒã¶ãŒçš®å¥èå¥åã®èšå®
- å:
{ admin?: string; guest?: string; regular?: string } - 説æ: ããŒã«ããŒã¹ã¢ã¯ã»ã¹å¶åŸ¡ã®ããã®ã«ã¹ã¿ã ãŠãŒã¶ãŒçš®å¥èå¥å
- ããã©ã«ã:
undefinedïŒããã©ã«ãã®çš®å¥æ€èšŒã䜿çšïŒ - åããããã£:
admin: 管çè ãŠãŒã¶ãŒçš®å¥ã®èå¥å- å:
string - 説æ: 管çè ãŠãŒã¶ãŒã®ã«ã¹ã¿ã èå¥å
- å©çšäŸ: 管çæäœã®ããŒã«ããŒã¹ã¢ã¯ã»ã¹å¶åŸ¡
- äŸ:
"admin","administrator","superuser"
- å:
guest: ã²ã¹ããŠãŒã¶ãŒçš®å¥ã®èå¥å- å:
string - 説æ: ã²ã¹ããŠãŒã¶ãŒã®ã«ã¹ã¿ã èå¥å
- å©çšäŸ: æªèªèšŒ/äžæãŠãŒã¶ãŒã®éå®çã¢ã¯ã»ã¹
- äŸ:
"guest","visitor","anonymous"
- å:
regular: äžè¬ãŠãŒã¶ãŒçš®å¥ã®èå¥å- å:
string - 説æ: äžè¬ãŠãŒã¶ãŒã®ã«ã¹ã¿ã èå¥å
- å©çšäŸ: æšæºçãªãŠãŒã¶ãŒæš©é
- äŸ:
"user","member","customer"
- å:
ð¢ çµç¹èšå®â
organization.roles ã¯çµç¹ããŒã«ã®èå¥åãèšå®ããŸããownerãadminãmember ã®ããŒãã«ãŒãããªããŒã¿ãŒã§äœ¿çšããããããã®èšå®æžã¿æåå ID ãçµç¹ã¡ã³ããŒã®ã¬ã³ãŒãã«ä¿åããŸãã
- å:
{ admin?: string; member?: string; owner?: string } - ããã©ã«ã:
undefinedïŒæ¢å®ã®ããŒã«æ€èšŒã䜿çšïŒ admin: çµç¹ç®¡çæäœçšã®èå¥åmember: æšæºã®çµç¹ã¡ã³ããŒæš©éçšã®èå¥åowner: çµç¹ã®å®å šãªæææš©éçšã®èå¥å
èšå®äŸâ
const chatConfig = {
authSecrets: {
authEncSecret: process.env.AUTH_ENC_SECRET || 'your-enc-secret',
authSignSecret: process.env.AUTH_SIGN_SECRET || 'your-sign-secret'
},
identity: {
typeIds: {
admin: 'administrator',
guest: 'visitor',
regular: 'member'
}
}
};
ðš ãšã©ãŒãã³ããªã³ã°â
ãã£ãããµãŒãã¹ã®ãšã©ãŒã¯ãé©åãªHTTPã¹ããŒã¿ã¹ã³ãŒããšJSON圢åŒã§è¿ãããŸãã
代衚çãªãšã©ãŒã³ãŒãâ
| ã¹ããŒã¿ã¹ | ãšã©ãŒã¡ãã»ãŒãž | 説æ |
|---|---|---|
| 400 | Validation Error | ãªã¯ãšã¹ãããã£ã®åœ¢åŒäžæ£ãŸãã¯å¿ é é ç®äžè¶³ |
| 400 | must have ownerId when creating a new channel | ãªã¯ãšã¹ãããã£ã« ownerId ãååšããªã |
| 400 | request body must have required property 'name' | ãªã¯ãšã¹ãããã£ã« name ãååšããªã |
| 400 | request body must have required property 'ownerId' | ãªã¯ãšã¹ãããã£ã« ownerId ãååšããªã |
| 400 | request body must have required property 'channelId' | ãªã¯ãšã¹ãããã£ã« channelId ãååšããªã |
| 400 | request body must have required property 'subscribedId' | ãªã¯ãšã¹ãããã£ã« subscribedId ãååšããªã |
| 400 | request body must have required property 'content' | ãªã¯ãšã¹ãããã£ã« content ãååšããªã |
| 400 | request body must have required property 'senderId' | ãªã¯ãšã¹ãããã£ã« senderId ãååšããªã |
| 400 | request body must NOT have additional properties | ãµããŒããããªããã£ãŒã«ããå«ãŸããŠãã |
| 400 | query parameter 'channelId' is required | å¿ é ã®ã¯ãšãªãã©ã¡ãŒã¿ãäžè¶³ |
| 400 | Failed to create channel | 远å IDãè¿ããäœæã«å€±æ |
| 400 | Failed to update channel | 倿Žãæ€åºãããæŽæ°ã«å€±æ |
| 400 | Failed to delete channel | åé€åŠçã«å€±æ |
| 400 | Failed to create subscription | 远å IDãè¿ããäœæã«å€±æ |
| 400 | Failed to delete subscription | åé€åŠçã«å€±æ |
| 400 | Failed to create message | 远å IDãè¿ããäœæã«å€±æ |
| 400 | Failed to update message | 倿Žãæ€åºãããæŽæ°ã«å€±æ |
| 400 | Failed to delete message | åé€åŠçã«å€±æ |
| 401 | token could not be verified | èªå¯ããŒã¯ã³ããªã/ç¡å¹ |
| 401 | Authentication failed | èªèšŒããŒã¯ã³ããªã/ç¡å¹ |
| 401 | Token fails security check | ããŒã¯ã³ã®ã»ãã¥ãªãã£æ€èšŒã«å€±æ |
| 403 | User is not authorized to access this resource | æš©éäžè¶³ïŒç®¡çè ã¢ã¯ã»ã¹ãå¿ èŠïŒ |
| 404 | Channel not found | 察象ã®ãã£ã³ãã«ãååšããªã |
| 404 | Subscription not found | 察象ã®ãµãã¹ã¯ãªãã·ã§ã³ãååšããªã |
| 404 | Message not found | 察象ã®ã¡ãã»ãŒãžãååšããªã |
| 404 | Chat message not found | 察象ã®ãã£ããã¡ãã»ãŒãžãååšããªã |
| 500 | Failed to create channel | äœæäžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
| 500 | Failed to get channel | ååŸäžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
| 500 | Failed to find channels | äžèЧååŸäžã®DBæ¥ç¶åé¡/ãã£ã«ã¿äžæ£/äºæãã¬å€±æ |
| 500 | Failed to update channel | æŽæ°äžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
| 500 | Failed to delete channel | åé€äžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
| 500 | Failed to create subscription | äœæäžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
| 500 | Failed to get subscription | ååŸäžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
| 500 | Failed to find subscriptions | äžèЧååŸäžã®DBæ¥ç¶åé¡/ãã£ã«ã¿äžæ£/äºæãã¬å€±æ |
| 500 | Failed to delete subscription | åé€äžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
| 500 | Failed to create message | äœæäžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
| 500 | Failed to get message | ååŸäžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
| 500 | Failed to find messages | äžèЧååŸäžã®DBæ¥ç¶åé¡/ãã£ã«ã¿äžæ£/äºæãã¬å€±æ |
| 500 | Failed to update message | æŽæ°äžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
| 500 | Failed to delete message | åé€äžã®DBæ¥ç¶åé¡/äºæãã¬å€±æ |
ãšã©ãŒã¬ã¹ãã³ã¹åœ¢åŒâ
äž»èŠãªãšã³ããã€ã³ãã§è¿ããšã©ãŒã®åœ¢åŒã¯æ¬¡ã®ãšããã§ãããµãŒããŒãè¿ã message ã®å€ã¯æè¡ãªãã©ã«ã®ãã倿ŽããŸããã
ãšã©ãŒãåŠçããã¯ã©ã€ã¢ã³ã㯠HTTP ã¹ããŒã¿ã¹ã³ãŒããš error.message ã®äž¡æ¹ã確èªããŠãã ããã
400 ã¯éåžžãå¿
é ãã£ãŒã«ãã®äžè¶³ã圢åŒã®äžæ£ããŸãã¯è¿œå ããããã£ã瀺ããŸãã
401 ã¯èªèšŒããŒã¯ã³ããªããç¡å¹ããŸãã¯ã»ãã¥ãªãã£æ€èšŒã«å€±æããããšã瀺ããŸãã
403 ã¯èªèšŒæžã¿ã§ãã£ãŠããèŠæ±ããããªãœãŒã¹ã«å¯ŸããããŒã«ãŸãã¯æææš©ãäžè¶³ããŠããããšã瀺ããŸãã
404 ã¯ãã£ã³ãã«ã賌èªãã¡ãã»ãŒãžããŸãã¯ãã³ãã¬ãŒããååšããªãããšã瀺ããŸãã
500 ã¯ã¹ãã¬ãŒãžæ¥ç¶ãããŒã¿ããŒã¹æäœããŸãã¯äºæããªããµãŒãã¹åŽã®å€±æã瀺ããŸãã
ããªããŒã·ã§ã³ãšã©ãŒã§ã¯ãerror.data ã«äžæ£ãªãã£ãŒã«ããäžè¶³ããŠããå€ã®è©³çްãå«ãŸããŸãã
æ·»ä»ãã¡ã€ã«ã®ã¢ããããŒãã§ã¯ãã³ã³ãã³ãã¿ã€ããšãã¡ã€ã«ãµã€ãºã®æ€èšŒãšã©ãŒãè¿ãããŸãã
ã¯ã©ã€ã¢ã³ãã¯ãµãŒããŒããè¿ããããšã©ãŒã¡ãã»ãŒãžããã®ãŸãŸå©çšã§ãããããå¿
èŠã«å¿ããŠè¡šç€ºçšã®æèšãšåé¢ããŠãã ããã
å詊è¡å¯èœãªå€±æãã©ããã¯ãã¹ããŒã¿ã¹ã³ãŒããšæäœã®çš®é¡ã«åºã¥ããŠå€æããŸãã
å逿äœãæåããå Žåã¯ã¬ã¹ãã³ã¹ããã£ããªãããã204 No Content ãæåãšããŠæ±ããŸãã
äžèЧååŸã®ã¬ã¹ãã³ã¹ã§ã¯ãmetadata.pagination ã䜿ã£ãŠæ¬¡ããŒãžãåããŒãžã®æç¡ãå€å®ã§ããŸãã
æš©éãšã©ãŒãåãåã£ãå Žåã¯ãçµç¹ããŒã«ããã£ã³ãã«ææè
ããŸãã¯è³Œèªç¶æ
ã確èªããŠãã ããã
ãã£ã³ãã«ãšã¡ãã»ãŒãžã® ID ã¯ãã¹ãã©ã¡ãŒã¿ãšããŠæž¡ããURL ãšã³ã³ãŒããå¿
èŠãªå€ã¯é©åã«åŠçããŠãã ããã
眲åä»ã URL ã¯äžæçãªãã®ãªã®ã§ãååŸåŸã¯æéå
ã«ã¢ããããŒããå®äºããŠãã ããã
ãšã©ãŒå
容ããã°ãžèšé²ããéã¯ãã¢ã¯ã»ã¹ããŒã¯ã³ããã¡ã€ã« URL ã«å«ãŸãã眲åæ
å ±ãåºåããªãã§ãã ããã
æ¬çªç°å¢ã§ã¯ãã¯ã©ã€ã¢ã³ãã«è¿ã衚瀺æèšãšèšºæçšã®è©³çްæ
å ±ãåããŠç®¡çããããšãæšå¥šããŸãã
WebSocket æ¥ç¶ã®åææã¯ãå¿
èŠã«å¿ããŠãã£ã³ãã«è³Œèªãå確ç«ããŠãã ããã
ã¡ãã»ãŒãžãã³ãã¬ãŒãã¯ãçµç¹ã®ã³ãã¥ãã±ãŒã·ã§ã³æ¹éã«åãããŠå®æçã«èŠçŽããŠãã ããã
ãã¡ã€ã«æ·»ä»ã® MIME ã¿ã€ãã¯ãã¯ã©ã€ã¢ã³ãåŽã§ãäºåã«ç¢ºèªãããšå©çšè
ã«åããããããšã©ãŒã瀺ããŸãã
管çè
æäœã¯ç£æ»å¯èœãªãã°ãšçµã¿åããã誀ã£ãæŽæ°ãåé€ã远跡ã§ããããã«ããŠãã ããã
å¿
èŠã«å¿ããŠãçµç¹ããŒã«ã倿ŽããçŽåŸã«ã¯ã©ã€ã¢ã³ãã®èªå¯ç¶æ
ãæŽæ°ããŠãã ããã
ããŒãžããŒã·ã§ã³ãå©çšããç»é¢ã§ã¯ã空ã®çµæãšæåŸã®ããŒãžãåºå¥ããŠæ±ããŸãã
ãµãŒãã¹èšå®ã®ã·ãŒã¯ã¬ããã¯å®å
šãªç°å¢å€æ°ãŸãã¯ã·ãŒã¯ã¬ããã¹ãã¢ããèªã¿èŸŒãã§ãã ããã
{ "error": { "message": "Channel not found" } }
{ "error": { "message": "Subscription not found" } }
{ "error": { "message": "Message not found" } }
{ "error": { "message": "Chat message not found" } }
{ "error": { "message": "Channel does not exist" } }
{ "error": { "message": "token could not be verified" } }
{ "error": { "message": "Token missing authentication" } }
{ "error": { "message": "Token fails security check" } }
{ "error": { "message": "Identity is not authorized to access this resource" } }
{ "error": { "message": "Failed to create channel" } }
{ "error": { "message": "Failed to update channel" } }
{ "error": { "message": "Failed to delete channel" } }
{ "error": { "message": "Failed to create subscription" } }
{ "error": { "message": "Failed to delete subscription" } }
{ "error": { "message": "Failed to create chat message" } }
{ "error": { "message": "Failed to update chat message" } }
{ "error": { "message": "Failed to delete chat message" } }
{
"error": {
"message": "Error message description",
"data": ["Additional error details"]
}
}
Validation Errors ã«ã¯è¿œå æ å ±ãå«ãŸããŸãïŒ
{
"error": {
"message": "Validation Error",
"data": [
"request body must have required property 'name'",
"request body must have required property 'ownerId'"
]
}
}
ð é¢é£ããã¥ã¡ã³ãâ
- ã¢ã€ãã³ãã£ãã£ãµãŒãã¹ - ãã£ããåå è ã®ãŠãŒã¶ãŒç®¡ç
- çµç¹ãµãŒãã¹ - ããŒã ããŒã¹ã®ãã£ããç·šæ
- èªèšŒãµãŒãã¹ - èªèšŒãšèªå¯
- ãšã©ãŒãã³ããªã³ã° - ãšã©ãŒãã¿ãŒã³ã®çè§£
- ã¹ããŒãã³ã³ããŒãã³ã - ããŒã¿æ€èšŒã®æŠå¿µ
- ã«ã¹ã¿ã ãµãŒãã¹ãã¥ãŒããªã¢ã« - ãã£ããæ©èœã®æ¡åŒµ