forked from sjmeverett/swift-client
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from hossam-magdy/add-ts-support
Add typings for TypeScript support
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
declare class SwiftClient { | ||
constructor(authenticator: SwiftClient.SwiftAuthenticator); | ||
|
||
container(name: string): SwiftClient.SwiftContainer; | ||
} | ||
|
||
declare namespace SwiftClient { | ||
export class SwiftAuthenticator { | ||
constructor(url: string, username: string, password: string); | ||
} | ||
|
||
export class SwiftContainer { | ||
list( | ||
extra?: { [s: string]: string }, | ||
// @see: https://developer.openstack.org/api-ref/object-store/?expanded=show-container-details-and-list-objects-detail#show-account-details-and-list-containers | ||
query?: string | { [s: string]: string } | ||
): Promise<SwiftObject[]>; | ||
get(name: string, stream: WritableStream): Promise<void>; | ||
create( | ||
name: string, | ||
stream: ReadableStream, | ||
meta?: { [s: string]: string }, | ||
extra?: { [s: string]: string } | ||
): Promise<void>; | ||
meta(name: string): Promise<SwiftObjectMeta>; | ||
delete(name: string, when?: Date | number): Promise<void>; | ||
} | ||
|
||
interface SwiftObject { | ||
bytes: number; // 3344 | ||
content_type: string; // "application/json" | ||
hash: string; // "28c3c00641adc0da09400d1d9a1aec91" | ||
name: string; // "0157f866cdd5cd92b14f261865000c92/Export-Xing.json" | ||
last_modified: string; // "2016-09-09T12:30:09.181050" | ||
} | ||
|
||
interface SwiftObjectMeta { | ||
author: string; | ||
year: string; | ||
} | ||
} | ||
|
||
export = SwiftClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters