Skip to content

uclapi/uclapi-js-sdk

Repository files navigation

@uclapi/sdk

JavaScript client for the UCL API.

See the main UCL API Documentation at https://uclapi.com/docs.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.4.11
  • Package version: 1.4.11
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

Installation

npm

Install the SDK through npm via:

npm install @uclapi/sdk --save

git

If you want to use the SDK via this GitHub repository, then install it via:

npm install uclapi/uclapi-js-sdk --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming index.js is your entry file, that's to say your JavaScript file where you actually use this library):

browserify index.js > bundle.js

Then include bundle.js in your HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

const uclapi = require('@uclapi/sdk');

const api = new uclapi.AnalyticsApi()
const opts = {
  'service': "service_example" // {String} The service to check the popularity of methods for
};

const callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ', data);
  }
};
api.dashboardApiAnalyticsMethodsGet(opts, callback);

See more detailed examples at the uclapi-openapi repository.

Documentation for API Endpoints

All URIs are relative to https://uclapi.com

Class Method HTTP request Description
uclapi.AnalyticsApi dashboardApiAnalyticsMethodsGet GET /dashboard/api/analytics/methods Gets all methods for a given service and their popularity
uclapi.AnalyticsApi dashboardApiAnalyticsOauthTotalByDeptGet GET /dashboard/api/analytics/oauth/total_by_dept Gets the total number of users for a given app token, by department
uclapi.AnalyticsApi dashboardApiAnalyticsOauthTotalGet GET /dashboard/api/analytics/oauth/total Gets the total number of users for a given app token
uclapi.AnalyticsApi dashboardApiAnalyticsQuotaGet GET /dashboard/api/analytics/quota Gets the remaining daily quota for a given token
uclapi.AnalyticsApi dashboardApiAnalyticsServicesGet GET /dashboard/api/analytics/services Gets all services and their popularity
uclapi.AnalyticsApi dashboardApiAnalyticsTotalGet GET /dashboard/api/analytics/total Gets the total number of requests made from a given token
uclapi.LibCalApi libcalSpaceBookingsGet GET /libcal/space/bookings Get all LibCal bookings
uclapi.LibCalApi libcalSpaceCancelPost POST /libcal/space/cancel Cancel one or more LibCal bookings
uclapi.LibCalApi libcalSpaceCategoriesGet GET /libcal/space/categories Returns the categories of spaces available in the given location(s)
uclapi.LibCalApi libcalSpaceCategoryGet GET /libcal/space/category Get all spaces corresponding to the specified categories
uclapi.LibCalApi libcalSpaceFormGet GET /libcal/space/form Get all forms (including fields) corresponding to the given LibCal form ID(s)
uclapi.LibCalApi libcalSpaceItemGet GET /libcal/space/item Get the spaces corresponding to the given LibCal space ID(s)
uclapi.LibCalApi libcalSpaceLocationsGet GET /libcal/space/locations Gets all LibCal locations
uclapi.LibCalApi libcalSpaceNicknameGet GET /libcal/space/nickname Get the nicknames asssigned to certain LibCal bookings
uclapi.LibCalApi libcalSpacePersonalBookingsGet GET /libcal/space/personal_bookings Get all LibCal bookings
uclapi.LibCalApi libcalSpaceQuestionGet GET /libcal/space/question Get the questions corresponding to the given LibCal field/question ID(s)
uclapi.LibCalApi libcalSpaceReservePost POST /libcal/space/reserve Reserve one or more LibCal spaces/seats
uclapi.LibCalApi libcalSpaceSeatGet GET /libcal/space/seat Get LibCal seat by ID
uclapi.LibCalApi libcalSpaceSeatsGet GET /libcal/space/seats Get all LibCal seats in a given location
uclapi.LibCalApi libcalSpaceUtilizationGet GET /libcal/space/utilization Get utilisation stats for a particular location
uclapi.LibCalApi libcalSpaceZoneGet GET /libcal/space/zone Get LibCal zone by ID
uclapi.LibCalApi libcalSpaceZonesGet GET /libcal/space/zones Get LibCal zones by location
uclapi.OAuthApi oauthAuthoriseGet GET /oauth/authorise Authorises a user against the API
uclapi.OAuthApi oauthTokenGet GET /oauth/token A token will be generated which your app can use to get user’s personal data in JSON format from the OAuthSecurity/user/data.
uclapi.OAuthApi oauthUserDataGet GET /oauth/user/data Returns personal data on a student at UCL.
uclapi.OAuthApi oauthUserStudentnumberGet GET /oauth/user/studentnumber You can use the oauth/user/data endpoint to find out whether the user is a student before you call this endpoint. If you call this endpoint and the user is not a student, an error will be returned.
uclapi.ResourcesApi resourcesDesktopsGet GET /resources/desktops Returns number of desktops and how many are free at the time of making the request.
uclapi.RoomBookingsApi roombookingsBookingsGet GET /roombookings/bookings Returns the results to a bookings or space availability query. It returns a paginated list of bookings.
uclapi.RoomBookingsApi roombookingsEquipmentGet GET /roombookings/equipment Returns any equipment/feature information about a specific room.
uclapi.RoomBookingsApi roombookingsFreeroomsGet GET /roombookings/freerooms Given a start time and an end time, this endpoint returns all rooms which are free in that time range.
uclapi.RoomBookingsApi roombookingsRoomsGet GET /roombookings/rooms Returns rooms and information about them.
uclapi.SearchApi searchPeopleGet GET /search/people Returns matching people and information about them.
uclapi.TimetableApi timetableBymoduleGet GET /timetable/bymodule Returns a yearly timetable for the supplied modules.
uclapi.TimetableApi timetableDataCoursesGet GET /timetable/data/courses Returns a list of every course taught by a given department at UCL.
uclapi.TimetableApi timetableDataCoursesModulesGet GET /timetable/data/courses/modules Returns a list of every module taught on a given course at UCL.
uclapi.TimetableApi timetableDataDepartmentsGet GET /timetable/data/departments Returns a list of every department at UCL, along with its internal name.
uclapi.TimetableApi timetableDataModulesGet GET /timetable/data/modules Returns a list of every module taught by a given department at UCL.
uclapi.TimetableApi timetablePersonalGet GET /timetable/personal Returns the personal timetable of the user.
uclapi.WorkspacesApi workspacesHistoricalDataGet GET /workspaces/historical/data List Historical Data
uclapi.WorkspacesApi workspacesHistoricalSensorsGet GET /workspaces/historical/sensors List Historical Sensors
uclapi.WorkspacesApi workspacesHistoricalSurveysGet GET /workspaces/historical/surveys List Historical Surveys
uclapi.WorkspacesApi workspacesImagesMapGet GET /workspaces/images/map Returns the image specified by the passed in image_id.
uclapi.WorkspacesApi workspacesImagesMapLiveGet GET /workspaces/images/map/live Takes Survey ID and Map ID as parameters and displays a dynamically generated SVG map.
uclapi.WorkspacesApi workspacesSensorsAveragesTimeGet GET /workspaces/sensors/averages/time Provides a list of every sensor within every map in a survey/library.
uclapi.WorkspacesApi workspacesSensorsGet GET /workspaces/sensors Provides a list of every sensor within every map in a survey/library.
uclapi.WorkspacesApi workspacesSensorsLastupdatedGet GET /workspaces/sensors/lastupdated Replies with the timestamp of the last time the sensor data was updated for a given survey.
uclapi.WorkspacesApi workspacesSensorsSummaryGet GET /workspaces/sensors/summary Summarises, with a one-minute accuracy, the number of seats within each library region that are free and occupied.
uclapi.WorkspacesApi workspacesSurveysGet GET /workspaces/surveys Returns all UCL libraries with the Cad-Capture devices fitted to the seats

Documentation for Models

Documentation for Authorization

ApiToken

  • Type: API key
  • API key parameter name: token
  • Location: URL query string

OAuthSecurity

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: /oauth/authorise
  • Scopes:
    • personal_timetable: read user's timetable
    • student_number: read user's student number
    • libcal_read: read user's LibCal bookings
    • libcal_write: reserve/cancel user's LibCal bookings

OAuthToken

  • Type: API key
  • API key parameter name: token
  • Location: URL query string

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published