-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add clients for actor env vars #202
Changes from 1 commit
6320907
34e73ff
1ccd204
22fcb5a
c6642a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "apify-client", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need for version bump as 2.0.0 is not yet out There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2.0.0 is out on NPM as far as I know. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"description": "Apify API client for JavaScript", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import ow from 'ow'; | ||
import { ApiClientSubResourceOptions } from '../base/api_client'; | ||
import { ResourceClient } from '../base/resource_client'; | ||
import { ActorEnvironmentVariable } from './actor_version'; | ||
|
||
/** | ||
* @hideconstructor | ||
*/ | ||
export class ActorEnvVarClient extends ResourceClient { | ||
constructor(options: ApiClientSubResourceOptions) { | ||
super({ | ||
resourcePath: 'env-vars', | ||
...options, | ||
}); | ||
} | ||
|
||
/** | ||
* TODO: https://docs.apify.com/api/v2#/reference/actors/env-var-object/get-env-var | ||
*/ | ||
async get(): Promise<ActorEnvironmentVariable | undefined> { | ||
return this._get(); | ||
} | ||
|
||
/** | ||
* TODO: https://docs.apify.com/api/v2#/reference/actors/env-var-object/update-env-var | ||
*/ | ||
async update(actorEnvVar: ActorEnvironmentVariable): Promise<ActorEnvironmentVariable> { | ||
ow(actorEnvVar, ow.object); | ||
return this._update(actorEnvVar); | ||
} | ||
|
||
/** | ||
* TODO: https://docs.apify.com/api/v2#/reference/actors/env-var-object/delete-env-var | ||
*/ | ||
async delete(): Promise<void> { | ||
return this._delete(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import ow from 'ow'; | ||
import { ApiClientSubResourceOptions } from '../base/api_client'; | ||
import { ResourceCollectionClient } from '../base/resource_collection_client'; | ||
import { PaginatedList } from '../utils'; | ||
import { ActorEnvironmentVariable } from './actor_version'; | ||
|
||
/** | ||
* @hideconstructor | ||
*/ | ||
export class ActorEnvVarCollectionClient extends ResourceCollectionClient { | ||
constructor(options: ApiClientSubResourceOptions) { | ||
super({ | ||
resourcePath: 'env-vars', | ||
...options, | ||
}); | ||
} | ||
|
||
/** | ||
* TODO: https://docs.apify.com/api/v2#/reference/actors/env-var-collection/get-list-of-env-vars | ||
*/ | ||
async list(options: ActorEnvVarCollectionListOptions = {}): Promise<ActorEnvVarListResult> { | ||
ow(options, ow.object.exactShape({ | ||
limit: ow.optional.number, | ||
offset: ow.optional.number, | ||
desc: ow.optional.boolean, | ||
})); | ||
return this._list(options); | ||
} | ||
|
||
/** | ||
* TODO: https://docs.apify.com/api/v2#/reference/actors/env-var-collection/create-env-var | ||
*/ | ||
async create(actorEnvVar: ActorEnvironmentVariable): Promise<ActorEnvironmentVariable> { | ||
ow(actorEnvVar, ow.optional.object); | ||
return this._create(actorEnvVar); | ||
} | ||
} | ||
|
||
export interface ActorEnvVarCollectionListOptions { | ||
limit?: number; | ||
offset?: number; | ||
desc?: boolean; | ||
} | ||
|
||
export type ActorEnvVarListResult = Pick<PaginatedList<ActorEnvironmentVariable>, 'total' | 'items'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.0.0 is not out yet, so move this to that version