Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Support typings #26

Closed
HarelM opened this issue Mar 28, 2020 · 1 comment
Closed

Support typings #26

HarelM opened this issue Mar 28, 2020 · 1 comment

Comments

@HarelM
Copy link

HarelM commented Mar 28, 2020

It would be great if this library had typings to allow easy integration to angular and modern development tool that provide intellisense.
I have created a partial typings of what I needed as can be seen below.
Instruction of how to add this can be found here:
https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html
In short, you need to add a index.d.ts file and add a link in the package.json file to it.
Here's what I wrote - I'm sure it's pretty partial/incorrect:

export interface IOAuthResponse {
    oauth_token: string;
    oauth_token_secret: string;
}

export interface IOAuthParams {
    oauth_consumer_key: string;
    oauth_signature_method: string;
    oauth_timestamp: number;
    oauth_nonce: string;
    oauth_token: string;
    oauth_signature: string;
}

export interface IOhAuth {
    signature: (authSecret: string, tokenSecret: string, parameters: string) => string;
    baseString: (method: string, url: string, params: IOAuthParams) => string;
    /**
     * generates a querystring from an object
     */
    qsString: (obj: {}) => string;
    /**
    * generate an object from a querystring
    */
    stringQs: (str: string) => IOAuthResponse;
    timestamp: () => number;
    nonce: () => string;
    xhr: (method: string, url: string, params: {}, data: {}, options: {}, callback: (err, xhr) => void) => void;
}
@bhousel
Copy link
Member

bhousel commented Nov 21, 2022

⛔️ This project has been deprecated and will not receive any regular maintenance.
The preferred authentication method for OpenStreetMap is now OAuth2, therefore this library isn't used anymore.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants