Skip to content

Investigating on Webhook and User types #296

Open
@silversonicaxel

Description

@silversonicaxel

Hello everyone, I'm working with Abstract API version ^8.0.0-beta.32 and I am checking the Webhook and User types described in file https://github.com/goabstract/abstract-sdk/blob/master/abstract-sdk.d.ts

type Webhook = {
  active: boolean,
  createdAt: string,
  errorCount?: number,
  events: string[],
  id: string,
  lastPushedAt?: string,
  organizationId: string,
  updatedAt: string,
  url: string,
  user?: User
};

type User = {
  id: string,
  primaryEmailId: string,
  createdAt: string,
  updatedAt: string,
  deletedAt: string,
  lastActiveAt: string,
  username: string,
  name: string,
  avatarUrl: string
};

I setup a small application -built in typescript- with a server listening to the events branch.statusUpdated within my project within Abstract.
And indeed it works, every time someone merge a branch the event is listened by the server.
Issue is, I would like to use the type you offer, and I thought that Webhook type should have been the proper one.

But the data I receive in the server is this one

{
  "createdAt": "2020-07-16T15:13:00Z",
  "event": "branch.statusUpdated",
  "data": {
    "changes": {
      "status": [
        "wip",
        "merged"
      ]
    },
    "object": {
      "createdAt": "2020-07-16T09:07:12Z",
      "description": "",
      "divergedFromBranchId": "",
      "head": "XYZ",
      "id": "XYZ",
      "mergeSha": "XYZ",
      "mergedIntoBranchId": "XYZ",
      "name": "test2",
      "objectType": "branch",
      "parent": "XYZ",
      "projectId": "XYZ",
      "startedAtSha": "XYZ",
      "status": "merged",
      "updatedAt": "2020-07-16T15:12:39Z",
      "user": {
        "avatarUrl": "https://www.gravatar.com/avatar/XYZ",
        "createdAt": "2019-08-22T06:51:02Z",
        "id": "XYZ",
        "name": "XYZ",
        "objectType": "user",
        "updatedAt": "2019-08-22T06:51:02Z",
        "username": "XYZ"
      }
    }
  }
}

as you might notice from the Webhook type is missing data and object, event is not events so I guess this won't be the proper one - but I couldn't even find the proper type.
What is the Abstract Webhook type used for? Shall we expect a proper Webhook type, in line with the data received by the server?

Same question for User type that is missing objectType.
What is the Abstract User type used for? Shall we expect a proper User type, in line with the data received by the server?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions