Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigating on Webhook and User types #296

Open
silversonicaxel opened this issue Jul 17, 2020 · 6 comments
Open

Investigating on Webhook and User types #296

silversonicaxel opened this issue Jul 17, 2020 · 6 comments

Comments

@silversonicaxel
Copy link

silversonicaxel commented Jul 17, 2020

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

@mascardoso
Copy link
Contributor

following ^ ...

@berezovskyicom
Copy link
Contributor

Hello there!
The back end response might have been changed on some purposes, which were not synced with sdk.
We added your issue to this sprint, so stay tuned :)

@silversonicaxel
Copy link
Author

Thanks a lot @berezovskycom , I will keep an eye on it

@silversonicaxel
Copy link
Author

hello everyone, for your information, versions moved from ^8.0.0-beta.32 to ^8.0.0-beta.36 and still I've this problem, Webhook type did not change. any news?

@silversonicaxel
Copy link
Author

I could also try to write a PR, in case, do I need an NPM_TOKEN, something else?

@silversonicaxel
Copy link
Author

any news about this issue?

I worked on a small update #305 to solve the Webhook type. I was wondering if that could be merged, or if there is some error to fix.
And, if that's gonna be fixed, I've in mind also to continue with the follow up for the User type.

Thanks a lot for the attention

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@mascardoso @silversonicaxel @berezovskyicom and others