yitsushi / go-misskey

Misskey Go SDK
GNU General Public License v3.0
48 stars 12 forks source link

Remove emoji field from note and user model #96

Closed creamlike1024 closed 1 year ago

creamlike1024 commented 1 year ago

Description of the Change

Misskey has removed emoji field from the note and user json response struct. endpoint: /api/notes/create

{
  "createdNote": {
    "id": "xxxxxxxxxx",
    "createdAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "text": "string",
    "cw": "string",
    "userId": "string",
    "user": {
      "id": "xxxxxxxxxx",
      "name": "藍",
      "username": "ai",
      "host": "misskey.example.com",
      "avatarUrl": "string",
      "avatarBlurhash": "string",
      "isAdmin": false,
      "isModerator": false,
      "isBot": true,
      "isCat": true,
      "onlineStatus": "unknown"
    },
    "replyId": "xxxxxxxxxx",
    "renoteId": "xxxxxxxxxx",
    "reply": {},
    "renote": {},
    "isHidden": true,
    "visibility": "string",
    "mentions": [
      "string"
    ],
    "visibleUserIds": [
      "string"
    ],
    "fileIds": [
      "string"
    ],
    "files": [
      {
        "id": "xxxxxxxxxx",
        "createdAt": "2019-08-24T14:15:22Z",
        "name": "lenna.jpg",
        "type": "image/jpeg",
        "md5": "15eca7fba0480996e2245f5185bf39f2",
        "size": 51469,
        "isSensitive": true,
        "blurhash": "string",
        "properties": {
          "width": 1280,
          "height": 720,
          "orientation": 8,
          "avgColor": "rgb(40,65,87)"
        },
        "url": "string",
        "thumbnailUrl": "string",
        "comment": "string",
        "folderId": "xxxxxxxxxx",
        "folder": {
          "id": "xxxxxxxxxx",
          "createdAt": "2019-08-24T14:15:22Z",
          "name": "string",
          "foldersCount": 0,
          "filesCount": 0,
          "parentId": "xxxxxxxxxx",
          "parent": {}
        },
        "userId": "xxxxxxxxxx",
        "user": {
          "id": "xxxxxxxxxx",
          "name": "藍",
          "username": "ai",
          "host": "misskey.example.com",
          "avatarUrl": "string",
          "avatarBlurhash": "string",
          "isAdmin": false,
          "isModerator": false,
          "isBot": true,
          "isCat": true,
          "onlineStatus": "unknown"
        }
      }
    ],
    "tags": [
      "string"
    ],
    "poll": {},
    "channelId": "xxxxxxxxxx",
    "channel": {},
    "localOnly": true,
    "reactionAcceptance": "string",
    "reactions": {},
    "renoteCount": 0,
    "repliesCount": 0,
    "uri": "string",
    "url": "string",
    "myReaction": {}
  }
}

Try to call related api(such as client.Notes().Create) will get json: cannot unmarshal object into Go struct field User.createdNote.user.emojis of type []models.Emoji error.

Removing the emoji field from the User and Note structures in models/user.go and models/note.go seems to be effective

Tested on misskey v13.13.2

Possible Drawbacks

I'm sorry, as I'm not familiar with the library structure, there may be other areas that need to be modified.

Verification Process

I have commented these two fields and have used them normally on my program without any errors

Release Notes

Remove emoji field from note and user model to adapt to Misskey v13.13.2

coveralls commented 1 year ago

Coverage Status

coverage: 83.806%. remained the same when pulling 42559be9b418388144afa7073d277a7251a742be on creamlike1024:main into c6d907d4a6fc12815f79ba20a9891392f4ad57cf on yitsushi:main.