Skip to content

Commit

Permalink
feat(deep): agregamos la funcion editParticipant en Zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos Escobar authored and rodbustamante committed Jul 18, 2022
1 parent f0ca94f commit 758a9c1
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 5 deletions.
10 changes: 9 additions & 1 deletion lib/AdobeConnect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import {
ProviderConstructor,
ParticipantToMeetingProps,
GoMeetingProps,
GoMeetingPayload
GoMeetingPayload,
EditParticipantAttributes,
FetchEndpoint
} from '../'
import { BaseProvider } from '../BaseProvider'

Expand Down Expand Up @@ -74,6 +76,12 @@ export class AdobeConnect extends BaseProvider {
return Meeting
}

public editParticipant (
participant: EditParticipantAttributes
): Promise<FetchEndpoint> {
throw new Error('Method not implemented.')
}

public async createParticipant (
participant: Participant
): Promise<Participant> {
Expand Down
11 changes: 10 additions & 1 deletion lib/BaseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import {
Meeting,
ParticipantToMeetingProps,
GoMeetingProps,
GoMeetingPayload
GoMeetingPayload,
FetchEndpoint,
EditParticipantAttributes
} from '.'

/**
Expand Down Expand Up @@ -34,6 +36,13 @@ export abstract class BaseProvider {
*/
abstract createParticipant (participant: Participant): Promise<Participant>

/**
* Método que permite editar un participante.
*/
abstract editParticipant (
participant: EditParticipantAttributes
): Promise<FetchEndpoint>

/**
* Método que permite crear una reunión.
* @param {Meeting} meeting - Instancia de meeting a crear.
Expand Down
20 changes: 19 additions & 1 deletion lib/Zoom/editParticipant.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
import { EditParticipantAttributes, FetchEndpoint } from '..'
import { fetchEndpoint } from './lib/fetchEndpoint'

// eslint-disable-next-line @typescript-eslint/no-empty-function
export default function () {}
export default async function (
participant: EditParticipantAttributes,
token: string
): Promise<FetchEndpoint> {
try {
return await fetchEndpoint({
token,
pathUrl: `/users/${participant.userId}`,
method: 'PATCH',
body: { ...participant },
parseJson: false
})
} catch (error) {
throw new Error(error)
}
}
16 changes: 14 additions & 2 deletions lib/Zoom/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import {
ProviderConstructor,
ParticipantToMeetingProps,
GoMeetingProps,
GoMeetingPayload
GoMeetingPayload,
FetchEndpoint,
EditParticipantAttributes
} from '../'
import { BaseProvider } from '../BaseProvider'

Expand All @@ -21,7 +23,7 @@ import { goMeeting } from './goMeeting'
import { goMeetingTeacher } from './goMeetingTeacher'

import { participantToMeeting } from './participantToMeeting'
import { updateMeetingTimezone } from './updateMeetingTimezone'
import editParticipant from './editParticipant'

export class Zoom extends BaseProvider {
private _username: string
Expand Down Expand Up @@ -102,6 +104,16 @@ export class Zoom extends BaseProvider {
return Participant
}

public async editParticipant (
participant: EditParticipantAttributes
): Promise<FetchEndpoint> {
if (!this._logged) {
await this.login({ username: this._username, password: this._password })
}

return await editParticipant(participant, this.token)
}

public async participantToMeeting (
props: ParticipantToMeetingProps
): Promise<boolean> {
Expand Down
45 changes: 45 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable camelcase */
import { LoginProps } from './types'

// Clases
Expand Down Expand Up @@ -345,3 +347,46 @@ export type FetchEndpoint = {
*/
log: Log
}

/**
* Interfaces para editParticipant
*/
export interface CustomAttribute {
key: string
name: string
value: string
}

export interface PhoneNumber {
code: string
country: string
label: string
number: string
}

export interface EditParticipantAttributes {
userId: string | number
cms_user_id?: string
company?: string
custom_attributes?: CustomAttribute[]
dept?: string
first_name?: string
group_id?: string
host_key?: string
job_title?: string
language?: string
last_name?: string
location?: string
manager?: string
phone_country?: string
phone_number?: string
phone_numbers?: PhoneNumber[]
pmi?: number
pronouns?: string
pronouns_option?: number
timezone?: string
type?: number
use_pmi?: boolean
vanity_name?: string
zoom_one_type?: number
}

0 comments on commit 758a9c1

Please sign in to comment.