Code Monkey home page Code Monkey logo

js-sdk's People

Contributors

cdimitroulas avatar donlion avatar jariwiklund avatar laander avatar paulohp avatar peterdavehello avatar petersuhm avatar sandip-patel-1 avatar trolzie avatar vistik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-sdk's Issues

There is no deleteResource method

In the documentation there is an endpoint for deleting a resource but this doesn't seem to exist in this sdk. Will try to make a PR for this ASAP.

Security alert due to axios dependency

Hi there,

We are getting security alerts due to the use of this library which is depending on quite an old version of axios.

Could you please update to axios version 0.18.1 or later?

Calling updateResource doesn't update resource name

With a created resource, try the following:

timekit.updateResource({
  id: // resource-id,
  name: 'New name'
})

When I do this I am unable to update the name field, but I can confirm the update is working correctly as I am able to update the timezone field.

TypeScript types

It would be great if this project included TypeScript typings!

The search is not very usable

I think it would be really nice if using this SDK you did not have to write the search string yourself.

Ideally the API of this library would allow you to do something like:

timekit.getBookings({
  search: {
    'meta.some_property': 'someValue'
  }
})

And this would be converted to a call to /bookings?search=meta.some_property:someValue automatically.

A function like this should do the trick (quickly tested and tried in my own code using lodash/fp):

function createSearchString(search) {
  const keyValues = fp.map.convert({ cap: false })(
      (val, key) => `${key}:${val}`,
      search
    )

  return keyValues.join(';')
}

500 Error on POST /events endpoint

When attempting to create a new event for a user, I receive a 500 error in response.

Sample request body with UUID obfuscated:

{      
        start: 'Wed Nov 11 2015 15:34:45 GMT-0500 (EST)',
        end: 'Wed Nov 11 2015 16:34:45 GMT-0500 (EST)',
        what: 'Appointment with Foo Bar',
        where: 'http://some.url',
        calendar_id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 
}

I think perhaps the format of my date time strings is not what the API is expecting, however there isn't any documentation of the correct format for the start and end properties in the Timekit docs.

updateBooking return error Invalid URL format

the code is as simple as this:

await Timekit.sdk.updateBooking({id: id, action: action});

the data passed is:

{
  "id": "41ca328e-7cd1-48d9-a5b2-a822a6899b3c",
  "action": "confirm"
} 

and in I'm getting response with statusMessage: 'Unprocessable Entity', and data: { error: 'Index 1: url: Invalid URL format, ' }

here is full response object:

{
  status: 422,
  statusText: 'Unprocessable Entity',
  headers: {
    server: 'nginx/1.9.13',
    'content-type': 'application/json',
    'transfer-encoding': 'chunked',
    connection: 'close',
    'cache-control': 'no-cache',
    vary: 'Origin',
    'x-ratelimit-remaining': '806',
    'timekit-testmode': 'true',
    'access-control-expose-headers': 'Timekit-TestMode',
    'timekit-request-id': 'd37d74e7-5a37-44e0-bf3e-87c4c28c721c',
    date: 'Mon, 27 Apr 2020 07:17:19 GMT',
    'set-cookie': [
      'laravel_session=sUd7O6IqeHQSQRaiPRJO5OcVHmR66ZjCwHz5Werl; expires=Mon, 27-Apr-2020 09:17:19 GMT; Max-Age=7200; path=/; HttpOnly'
    ]
  },
  config: {
    transformRequest: { '0': [Function: transformRequest] },
    transformResponse: { '0': [Function: transformResponse] },
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json;charset=utf-8',
      Authorization: 'Basic OnRlc3RfYXBpX2tleV9oUnE4bjBEVWxENnhLeWtUNlR1djc3dTltbVRpUUdOMA==',
      'User-Agent': 'axios/0.12.0',
      'Content-Length': 2
    },
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    validateStatus: [Function: validateStatus],
    method: 'put',
    url: 'https://api.timekit.io/v2/bookings/41ca328e-7cd1-48d9-a5b2-a822a6899b3c/confirm',
    data: '{}',
    withCredentials: undefined
  },
  request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      error: [Function: handleRequestError],
      prefinish: [Function: requestOnPrefinish]
    },
    _eventsCount: 2,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    useChunkedEncodingByDefault: true,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    _contentLength: 2,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      _SNICallback: null,
      servername: 'api.timekit.io',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 10,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.timekit.io',
      _readableState: [ReadableState],
      readable: true,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [Circular *1],
      [Symbol(res)]: [TLSWrap],
      [Symbol(asyncId)]: 5896,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    _header: 'PUT /v2/bookings/41ca328e-7cd1-48d9-a5b2-a822a6899b3c/confirm HTTP/1.1\r\n' +
      'Accept: application/json, text/plain, */*\r\n' +
      'Content-Type: application/json;charset=utf-8\r\n' +
      'Authorization: Basic OnRlc3RfYXBpX2tleV9oUnE4bjBEVWxENnhLeWtUNlR1djc3dTltbVRpUUdOMA==\r\n' +
      'User-Agent: axios/0.12.0\r\n' +
      'Content-Length: 2\r\n' +
      'Host: api.timekit.io\r\n' +
      'Connection: close\r\n' +
      '\r\n',
    _onPendingData: [Function: noopPendingOutput],
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 443,
      protocol: 'https:',
      options: [Object],
      requests: {},
      sockets: [Object],
      freeSockets: {},
      keepAliveMsecs: 1000,
      keepAlive: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      maxCachedSessions: 100,
      _sessionCache: [Object],
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'PUT',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    path: '/v2/bookings/41ca328e-7cd1-48d9-a5b2-a822a6899b3c/confirm',
    _ended: true,
    res: IncomingMessage {
      _readableState: [ReadableState],
      readable: false,
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      socket: [TLSSocket],
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: true,
      headers: [Object],
      rawHeaders: [Array],
      trailers: {},
      rawTrailers: [],
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 422,
      statusMessage: 'Unprocessable Entity',
      client: [TLSSocket],
      _consuming: false,
      _dumped: false,
      req: [Circular *1],
      fetchedUrls: [Array],
      [Symbol(kCapture)]: false
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: false,
    [Symbol(kCapture)]: false,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      'content-type': [Array],
      authorization: [Array],
      'user-agent': [Array],
      'content-length': [Array],
      host: [Array]
    }
  },
  data: { error: 'Index 1: url: Invalid URL format, ' }
}

Support for new Availability API endpoints

I was trying to check the last activity of this sdk and I see it's using v2 TimeKit API but it doesn't have the new endpoints for Availability nor I see a deprecation notice for the /findTime endpoints.

Is it coming soon?
Thanks.

Resources endpoints?

I'm trying to get resource IDs to include in a /findtime/team API call, but I don't see any documentation for how do to that?

Am I missing something?

Issue in updating Microsoft Calendar

I am getting '500 - Internal Server Error' on updating Microsoft Calendar. I updated it with false and it run smooth. But when I try to update it with true there is problem. I have made new account and calendar. We had an old account (we recently changed password of old one and than cleared all permissions); but we got '502 - Bad Gateway'. For google it runs smooth.

Filtering events

Hello everyone!

There is a small question. Does API (and SDK) support filtering events by "where" field. For example, I want to find all events for current location ('where' field).

Thanks.

Axios vulnerability

Hi,

Theres a vulnerability with axios, a dependency of the timekitsdk and I've been trying to update it to the fixed version of 0.19.0 but it seems to not be doing the trick.

Thinking maybe something that needs to be fixed on your guys side of things?

I'm a newbie to this so apologies if there is a fix I can't see.

Authorizing App Properply (Client-Side)

I am writing an app in Ionic. I have read through the docs and can't find a way to authenticate properly with an API key (without booking-js). Only credentials. The only way to authenticate in the examples in the repo is with a plaintext username and password. This is obviously unacceptable in a mobile app. How might I authenticate given my situation?

.getGroupBookings() orderBy

Hi!

orderBy event.start & event.end doesnt work when using .getGroupBookings()

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'event.start' in 'order clause' (SQL: select bookings.* from bookings where app_id = 34445 and project_id = 131273 and exists (select * from booking_attributes where bookings.id = booking_attributes.booking_id and group = event_info and name = start and value >= 2021-12-12 14:48:03) and (state = tentative and graph = group_owner) and exists (select * from booking_attributes where bookings.id = booking_attributes.booking_id and group = group_booking and name = available_seats and value > 0) order by event.start desc limit 10 offset 0)

Timekit does not properly format callback urls for google auth

Steps to reproduce:

  1. Obtain oAuth url from TimeKit.accountGoogleSignup(), manually setting the callback URL to include a query parameter. eg: https://app.com/users/1/callback?special_token=xxxxxxx
  2. Authenticate with Google using the oAuth sign in flow.
  3. Google redirects to Timekit's callback URL for auth
  4. Timekit redirects to the callback URL supplied by the original callback, and appends a query string containing the values generated by the auth flow. Instead of parsing the callback URL and adding query parameters, the query string is instead naively tacked on to the end of the URL, resulting in a double query string, eg: https:://app.com/users/1/callback?special_token=xxxxxxx?email=...&token=... etc.

Method for Removing Timekit User

Erik from Sweden Unlimited here. I'm looking for a way to set up a testing account to use in unit testing our Timekit based scheduling app. In order for this to work, I have to be able to either delete users or delete an app wholesale to clear the users. Since there's no DELETE route for either of those resources, it doesn't seem that there's a clean way to do this at the moment.

UPDATE

I see that there is now a 'DELETE' route for apps in the SDK. However, when I attempt to use this method to delete a test app, the API responds with a 404 error. Is the delete route for apps not actually implemented?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.