6.5.6 • Published 19 days ago

@rocket.chat/rest-typings v6.5.6

Weekly downloads
-
License
-
Repository
-
Last release
19 days ago

@rocket.chat/rest-typings

Package containing all Rocket.Chat rest endpoint definitions

Contributing

Contributions are always welcome! However we have some recommendations.

  • Check if your implementation matches your definitions, a bad definition is worse than none.
  • Use the generic types we created for paging.
  • Create functions that assert properties (very useful for the backend)
  • Do tests to ensure that your assertions are correct.
  • Avoid incomplete and unknow typings

Good examples of what not to do:

If you have an endpoint that accepts name or id, both are not optional, one of them is required

    
    type EndPointTestGetParams = { name?: string; id?: string; } // WRONG!

    type EndPointTestGetParams = { name: string; } | { id: string; } // Better :)

If you have an endpoint that accepts name or id, both are not optional, one of them is required

    export const isEndPointTestGetParams = (props: any) is EndPointTestGetParams => 'name' in prop || 'id' in prop; // WRONG!

    // .... Better
    
    
    import Ajv from 'ajv';

    const ajv = new Ajv();
    const endPointTestGetParams = {
        oneOf: [
            {
                type: 'object',
                properties: {
                    name: {
                        type: 'string',
                    },
                },
                required: ['name'],
                additionalProperties: false,
            },
            {
                type: 'object',
                properties: {
                    id: {
                        type: 'string',
                    },
                },
                required: ['id'],
                additionalProperties: false,
            },
        ],
    };

    export const isEndPointTestGetParams = ajv.compile<EndPointTestGetParams>(endPointTestGetParams);

Optimizations

we use interfaces to register endpoints, so if you use a custom version, or miss an endpoint, you don't necessarily need to recompile the code, you can do it in your own code

    declare module '@rocket.chat/rest-typings' {
        interface Endpoints {
            'custom/endpoint': {
                GET: (params: PaginatedRequest<{ query: string }>) => PaginatedResult<{
                    some: string[];
                }>;
            };
        }
    }

License

MIT

6.5.6

19 days ago

6.5.5

2 months ago

6.5.4

3 months ago

6.6.0-rc.7

3 months ago

6.6.0-rc.6

3 months ago

6.6.0-rc.5

3 months ago

6.6.0-rc.2

3 months ago

6.6.0-rc.3

3 months ago

6.6.0-rc.4

3 months ago

6.6.0-rc.0

4 months ago

6.6.0-rc.1

4 months ago

6.5.3

4 months ago

6.4.9

4 months ago

6.5.2

4 months ago

6.6.0

5 months ago

6.5.1

5 months ago

6.5.0

5 months ago

6.5.0-rc.19

5 months ago

6.5.0-rc.18

5 months ago

6.5.0-rc.17

5 months ago

6.5.0-rc.16

5 months ago

6.5.0-rc.15

5 months ago

6.5.0-rc.14

6 months ago

6.5.0-rc.13

6 months ago

6.5.0-rc.12

6 months ago

6.5.0-rc.11

6 months ago

6.5.0-rc.10

6 months ago

6.5.0-rc.9

6 months ago

6.5.0-rc.8

6 months ago

6.4.8

6 months ago

6.5.0-rc.7

6 months ago

6.4.7

6 months ago

6.3.12

6 months ago

6.4.6

6 months ago

6.3.11

6 months ago

6.5.0-rc.6

6 months ago

6.5.0-rc.5

6 months ago

6.5.0-rc.4

6 months ago

6.5.0-rc.3

6 months ago

6.5.0-rc.2

6 months ago

6.5.0-rc.1

6 months ago

6.5.0-rc.0

6 months ago

6.4.5

6 months ago

6.4.4

7 months ago

6.4.3

7 months ago

6.4.2

7 months ago

6.4.1

7 months ago

6.3.10

7 months ago

6.3.9

7 months ago

6.4.0

8 months ago

6.4.0-rc.5

8 months ago

6.3.8

8 months ago

6.4.0-rc.4

8 months ago

6.4.0-rc.3

8 months ago

6.3.7

8 months ago

6.4.0-rc.2

8 months ago

6.4.0-rc.1

8 months ago

6.3.6

8 months ago

6.4.0-rc.0

8 months ago

6.3.5

8 months ago

6.3.4

8 months ago

6.3.3

8 months ago

6.3.2

9 months ago

6.3.1

9 months ago

6.3.0

9 months ago

6.3.0-rc.10

9 months ago

6.3.0-rc.9

10 months ago

6.3.0-rc.8

10 months ago

6.3.0-rc.7

10 months ago

6.3.0-rc.6

10 months ago

6.3.0-rc.5

10 months ago

6.3.0-rc.4

10 months ago

6.3.0-rc.3

10 months ago

6.3.0-rc.2

10 months ago

6.3.0-rc.1

10 months ago

6.3.0-rc.0

10 months ago