Skip to content

Commit

Permalink
chore(defs): use class instead of interface
Browse files Browse the repository at this point in the history
  • Loading branch information
solaris007 committed Feb 1, 2024
1 parent 7f4e2ed commit 4ef1440
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 53 deletions.
6 changes: 3 additions & 3 deletions packages/spacecat-shared-slack-client/src/clients/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
* governing permissions and limitations under the License.
*/

// eslint-disable-next-line max-classes-per-file
import type { SlackChannel } from '../models';

/**
* Represents a Slack client that can be used to interact with the Slack API.
* It can be used to post messages to a channel, or upload files.
* @interface
*/
export declare interface BaseSlackClient {
export class BaseSlackClient {
/**
* Asynchronous method to create a RUM backlink.
Expand All @@ -41,8 +42,7 @@ export declare interface BaseSlackClient {
* Represents a Slack client with elevated privileges, capable of performing
* advanced operations such as user lookups by email and channel management.
*/
export declare interface ElevatedSlackClient extends BaseSlackClient {

export class ElevatedSlackClient extends BaseSlackClient {
/**
* Creates a new Slack channel. The channel can be public or private.
* Optional parameters include the topic and description of the channel.
Expand Down
58 changes: 8 additions & 50 deletions packages/spacecat-shared-slack-client/src/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,94 +14,52 @@
* Represents a Slack channel with detailed information. Provides methods to access
* channel data such as ID, name, and privacy status.
*/
export interface SlackChannel {

// eslint-disable-next-line max-classes-per-file
export class SlackChannel {
/**
* Retrieves the unique identifier of the channel.
* @returns {string} The channel's ID.
*/
getId(): string,
getId(): string;

/**
* Retrieves the name of the channel.
* @returns {string} The channel's name.
*/
getName(): string,
getName(): string;
}

export interface SlackTeam {
export class SlackTeam {
/**
* Retrieves the unique identifier of the team.
* @returns {string} The team's ID.
*/
getId(): string,
getId(): string;

/**
* Retrieves the name of the team.
* @returns {string} The team's name.
*/
getName(): string,
getName(): string;
}

/**
* Represents a Slack user with detailed information. Provides methods to access
* user data such as ID, team ID, name, real name, email, and user roles/status.
*/
export interface SlackUser {
export class SlackUser {
/**
* Retrieves the unique identifier of the user.
* @returns The user's ID.
*/
getId(): string;

/**
* Retrieves the team ID to which the user belongs.
* @returns The team ID of the user.
*/
getTeamId(): string;

/**
* Retrieves the username or handle of the user.
* @returns The user's handle or username.
*/
getHandle(): string;

/**
* Retrieves the real name of the user.
* @returns The real name of the user.
*/
getRealName(): string;

/**
* Retrieves the email address of the user.
* @returns The email address of the user.
*/
getEmail(): string;

/**
* Checks if the user is an admin.
* @returns True if the user is an admin, false otherwise.
*/
isAdminUser(): boolean;

/**
* Checks if the user is an owner of the workspace.
* @returns True if the user is an owner, false otherwise.
*/
isOwnerUser(): boolean;

/**
* Checks if the user is a bot.
* @returns True if the user is a bot, false otherwise.
*/
isBotUser(): boolean;

/**
* Determines if the user is a multichannel guest in the workspace.
* @returns True if the user is a multichannel guest, false otherwise.
*/
isMultiChannelGuestUser(): boolean;

/**
* Determines if the user is a single-channel guest in the workspace.
* @returns True if the user is a single-channel guest, false otherwise.
Expand Down

0 comments on commit 4ef1440

Please sign in to comment.