aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth/oauth-client-interface.ts
blob: 3b4325740bca26675dd8d3b478dd9e35770fc866 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as Sequelize from 'sequelize'

export namespace OAuthClientMethods {
  export type CountTotalCallback = (err: Error, total: number) => void
  export type CountTotal = (callback: CountTotalCallback) => void

  export type LoadFirstClientCallback = (err: Error, client: OAuthClientInstance) => void
  export type LoadFirstClient = (callback: LoadFirstClientCallback) => void

  export type GetByIdAndSecret = (clientId, clientSecret) => void
}

export interface OAuthClientClass {
  countTotal: OAuthClientMethods.CountTotal
  loadFirstClient: OAuthClientMethods.LoadFirstClient
  getByIdAndSecret: OAuthClientMethods.GetByIdAndSecret
}

export interface OAuthClientAttributes {
  clientId: string
  clientSecret: string
  grants: string[]
  redirectUris: string[]
}

export interface OAuthClientInstance extends OAuthClientClass, OAuthClientAttributes, Sequelize.Instance<OAuthClientAttributes> {
  id: number
  createdAt: Date
  updatedAt: Date
}

export interface OAuthClientModel extends OAuthClientClass, Sequelize.Model<OAuthClientInstance, OAuthClientAttributes> {}