Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@unicsmcr/unics_social_api_client

Package Overview
Dependencies
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unicsmcr/unics_social_api_client - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

16

dist/index.d.ts

@@ -1,2 +0,2 @@

import { RegisterData, AuthenticateData, APIUser, ProcessedAPIEvent, EventCreationData, EventEditData, GetMessageData, ProcessedAPIMessage, APIMessage, APIDMChannel, ProfileUploadData } from './types/api';
import { RegisterData, AuthenticateData, APIUser, APIEvent, EventCreationData, EventEditData, GetMessageData, APIMessage, APIDMChannel, ProfileUploadData, APIEventChannel } from './types/api';
import { AxiosResponse } from 'axios';

@@ -26,9 +26,11 @@ import { GatewayClient } from './gateway';

editProfile(data: ProfileUploadData): Promise<APIUser>;
getEvents(): Promise<ProcessedAPIEvent[]>;
createEvent(data: EventCreationData): Promise<ProcessedAPIEvent>;
editEvent(data: EventEditData): Promise<ProcessedAPIEvent>;
getMessage(data: GetMessageData): Promise<ProcessedAPIMessage>;
getMessages(channelID: string): Promise<ProcessedAPIMessage[]>;
createMessage(data: Pick<APIMessage, 'content' | 'channelID'>): Promise<ProcessedAPIMessage>;
getEvents(): Promise<APIEvent[]>;
createEvent(data: EventCreationData): Promise<APIEvent>;
editEvent(data: EventEditData): Promise<APIEvent>;
getChannels(): Promise<(APIDMChannel | APIEventChannel)[]>;
createDMChannel(userID: string): Promise<APIDMChannel>;
getMessage(data: GetMessageData): Promise<APIMessage>;
getMessages(channelID: string): Promise<APIMessage[]>;
createMessage(data: Pick<APIMessage, 'content' | 'channelID'>): Promise<APIMessage>;
deleteMessage(data: GetMessageData): Promise<void>;
}

@@ -164,2 +164,43 @@ "use strict";

/*
Channel Routes
*/
async getChannels() {
const response = await axios_1.default.get(`${this.apiBase}/channels`, this.baseConfig);
return response.data.channels.map(channel => {
if (channel.type === 'dm') {
return {
...channel,
lastUpdated: new Date(channel.lastUpdated),
video: channel.video && {
...channel.video,
creationTime: new Date(channel.video.creationTime),
endTime: new Date(channel.video.endTime)
}
};
}
return {
...channel,
lastUpdated: new Date(channel.lastUpdated),
event: {
...channel.event,
startTime: new Date(channel.event.startTime),
endTime: new Date(channel.event.endTime)
}
};
});
}
async createDMChannel(userID) {
const response = await axios_1.default.post(`${this.apiBase}/users/${userID}/channel`, this.baseConfig);
const channel = response.data.channel;
return {
...channel,
lastUpdated: new Date(channel.lastUpdated),
video: channel.video && {
...channel.video,
creationTime: new Date(channel.video.creationTime),
endTime: new Date(channel.video.endTime)
}
};
}
/*
Message Routes

@@ -166,0 +207,0 @@ */

@@ -79,3 +79,3 @@ export declare enum APIAccountStatus {

}
export interface APIEvent {
export interface RawAPIEvent {
id: string;

@@ -90,3 +90,3 @@ title: string;

}
export interface ProcessedAPIEvent {
export interface APIEvent {
id: string;

@@ -100,3 +100,3 @@ title: string;

}
export interface APIMessage {
export interface RawAPIMessage {
id: string;

@@ -108,3 +108,3 @@ channelID: string;

}
export interface ProcessedAPIMessage {
export interface APIMessage {
id: string;

@@ -116,5 +116,14 @@ channelID: string;

}
export interface RawAPIChannel {
id: string;
lastUpdated: string;
}
export interface APIChannel {
id: string;
lastUpdated: Date;
}
export interface RawAPIEventChannel extends RawAPIChannel {
event: RawAPIEvent;
type: 'event';
}
export interface APIEventChannel extends APIChannel {

@@ -124,5 +133,29 @@ event: APIEvent;

}
export interface RawAPIVideoIntegration {
id: string;
creationTime: string;
endTime: string;
users?: {
id: string;
accessToken: string;
}[];
}
export interface APIVideoIntegration {
id: string;
creationTime: Date;
endTime: Date;
users?: {
id: string;
accessToken: string;
}[];
}
export interface RawAPIDMChannel extends RawAPIChannel {
users: string[];
type: 'dm';
video?: RawAPIVideoIntegration;
}
export interface APIDMChannel extends APIChannel {
users: string[];
type: 'dm';
video?: APIVideoIntegration;
}
{
"name": "@unicsmcr/unics_social_api_client",
"version": "0.0.7",
"version": "0.0.8",
"description": "networking for CS students at the University of Manchester",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc