import type { Organization, InjectedDependenciesParam, InjectedOptionsParam, OrganizationMembershipRole, BalenaModel } from '..'; import type { ODataOptionsWithoutCount, OptionsToResponse } from 'pinejs-client-core'; export interface OrganizationInviteOptions { invitee: string; roleName?: OrganizationMembershipRole['Read']['name']; message?: string; } declare const RESOURCE = "invitee__is_invited_to__organization"; type OrganizationInvite = BalenaModel[typeof RESOURCE]; declare const getOrganizationInviteModel: (deps: InjectedDependenciesParam, opts: InjectedOptionsParam, getOrganization: (handleOrId: string | number, options?: ODataOptionsWithoutCount) => Promise) => { /** * @summary Get all invites * @name getAll * @public * @function * @memberof balena.models.organization.invite * * @description * This method returns all invites. * * @param {Object} [options={}] - extra pine options to use * @fulfil {Object[]} - invites * @returns {Promise} * * @example * balena.models.organization.invite.getAll().then(function(invites) { * console.log(invites); * }); */ getAll>(options?: T): Promise>; /** * @summary Get all invites by organization * @name getAllByOrganization * @public * @function * @memberof balena.models.organization.invite * * @description * This method returns all invites for a specific organization. * * @param {String|Number} handleOrId - organization handle (string), or id (number) * @param {Object} [options={}] - extra pine options to use * @fulfil {Object[]} - invites * @returns {Promise} * * @example * balena.models.organization.invite.getAllByOrganization('MyOrg').then(function(invites) { * console.log(invites); * }); * * @example * balena.models.organization.invite.getAllByOrganization(123).then(function(invites) { * console.log(invites); * }); */ getAllByOrganization>(handleOrId: number | string, options?: T): Promise>; /** * @summary Creates a new invite for an organization * @name create * @public * @function * @memberof balena.models.organization.invite * * @description This method invites a user by their email to an organization. * * @param {String|Number} handleOrId - organization handle (string), or id (number) * @param {Object} options - invite creation parameters * @param {String} options.invitee - the email of the invitee * @param {String} [options.roleName="developer"] - the role name to be granted to the invitee * @param {String} [message=null] - the message to send along with the invite * * @fulfil {String} - organization invite * @returns {Promise} * * @example * balena.models.organization.invite.create('MyOrg', { invitee: "invitee@example.org", roleName: "developer", message: "join my org" }).then(function(invite) { * console.log(invite); * }); */ create(handleOrId: string | number, { invitee, roleName, message }: OrganizationInviteOptions): Promise>; /** * @summary Revoke an invite * @name revoke * @public * @function * @memberof balena.models.organization.invite * * @param {Number} id - organization invite id * @returns {Promise} * * @example * balena.models.organization.invite.revoke(123); */ revoke(id: number): Promise; /** * @summary Accepts an invite * @name accept * @public * @function * @memberof balena.models.organization.invite * * @description This method adds the calling user to the organization. * * @param {String} invitationToken - invite token * @returns {Promise} * * @example * balena.models.organization.invite.accept("qwerty-invitation-token"); */ accept(invitationToken: string): Promise; }; export default getOrganizationInviteModel;