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.1 to 0.0.2

4

dist/index.d.ts

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

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

@@ -24,3 +24,3 @@ import { GatewayClient } from './gateway';

getMe(): Promise<APIUser>;
editProfile(data: ProfileData): Promise<APIUser>;
editProfile(data: ProfileUploadData): Promise<APIUser>;
getEvents(): Promise<ProcessedAPIEvent[]>;

@@ -27,0 +27,0 @@ createEvent(data: EventCreationData): Promise<ProcessedAPIEvent>;

@@ -19,2 +19,3 @@ "use strict";

const gateway_1 = require("./gateway");
const form_data_1 = __importDefault(require("form-data"));
__exportStar(require("./types/"), exports);

@@ -68,3 +69,15 @@ class APIClient {

async editProfile(data) {
const response = await axios_1.default.put(`${this.apiBase}/users/@me/profile`, data, this.baseConfig);
const formData = new form_data_1.default();
const props = ['avatar', 'course', 'yearOfStudy', 'instagram', 'facebook', 'twitter'];
for (const key of props) {
if (data.hasOwnProperty(key))
formData.append(key, data[key]);
}
const response = await axios_1.default.put(`${this.apiBase}/users/@me/profile`, formData, {
...this.baseConfig,
headers: {
...this.baseConfig.headers,
'Content-Type': `multipart/form-data; boundary=${formData.getBoundary()}`
}
});
return response.data.user;

@@ -71,0 +84,0 @@ }

@@ -20,6 +20,14 @@ export declare enum APIAccountStatus {

}
export interface ProfileUploadData {
course?: string;
yearOfStudy?: string;
avatar?: File | 'false';
instagram?: string;
facebook?: string;
twitter?: string;
}
export interface ProfileData {
course?: string;
yearOfStudy?: string;
profilePicture?: string;
avatar?: string;
instagram?: string;

@@ -52,10 +60,3 @@ facebook?: string;

accountType: APIAccountType;
profile?: {
course: string;
yearOfStudy: number;
profilePicture?: string;
instagram?: string;
facebook?: string;
twitter?: string;
};
profile?: ProfileData;
}

@@ -62,0 +63,0 @@ export interface APIEvent {

{
"name": "@unicsmcr/unics_social_api_client",
"version": "0.0.1",
"version": "0.0.2",
"description": "networking for CS students at the University of Manchester",

@@ -70,9 +70,10 @@ "main": "dist/index.js",

"axios": "^0.19.2",
"form-data": "^3.0.0",
"ws": "^7.3.1"
},
"files": [
"dist",
"LICENSE",
"README.md"
"dist",
"LICENSE",
"README.md"
]
}
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