1.0.7 ā€¢ Published 1 year ago

spheron-sdk-ts v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

šŸš€ Spheron SDK TS

Banner The Spheron SDK implements the exposed endpoints provided in SwaggerUI

Swagger UI

šŸ˜µ Run Locally

šŸ„¦ Clone the project

  git clone https://github.com/priyansuhub/spheron-sdk-ts.git

šŸ§‹ Go to the project directory

  cd spheron-sdk-ts/src

šŸ„‘ Install dependencies

  npm install

šŸ—ļø Build Project

  npm run build

Test šŸ§‘ā€šŸ’»

Note: šŸ“”

šŸ‘‰ Each test functions has no parameters

šŸ‘‰ Output is console logged

šŸ‘‰ Functions with parameters to be looked on carefully

šŸ‘‰ Uncomment the test function

  cd src/test
  tsc && node dist/test.js

šŸ™‡ā€ā™‚ļø SDK Classes

šŸŒŸ Abstract base class

  Base class
BaseAPIDescription
constructor(key: string)Required. User's API key
methodpatchData<T>(endpoint: string, value: any): Promise<T>returns PATCH data response
methodputData<T>(endpoint: string, value: any): Promise<T>returns PUT data response
methodpostData<T>(endpoint: string, value: any): Promise<T>returns POST data response
methoddeleteDataParam<T>(endpoint: string, value: string): Promise<T>returns DELETE data response
methoddeleteData<T>(endpoint: string): Promise<T>returns DELETE data response
methodgetData<T>(endpoint: string): Promise<T>returns GET data response
methodpatchDataEmpty<T>(endpoint: string): Promise<T>returns PATCH data response
methodpostDataEmpty<T>(endpoint: string): Promise<T>returns POST data response
methodasync getDataParam<T>(endpoint: string): Promise<T>returns GET data response

šŸ’« GetOrganization class extends base class

  GetOrganization class
BaseAPIDescription
methodgetOrganizationDetails (id: string): Promise<Organization>All organization details
methodgetOrganizationUsers (id: string): Promise<Users[]>Get all users of Organization
methodgetOrganizationUserById (id: string, idU: string): Promise<Users\|string>Get a User's detail of Organization by Id
methodgetUserPlatformProfile (id: string, idU: string): Promise<PlatformProfile \| string>Get a User's Platform profile
methodgetAllProviderProfilesOfUser (id: string, idUser: string): Promise<ProviderProfile[]>Get a User' Provider Profile
methodgetProviderProfileOfUserById (id: string, idUser: string, idpP: string): Promise<ProviderProfile \| string>Get a User' Provider Profile by Id
methodgetUserOrganisationsById (id: string, idUser: string): Promise<string[]>Get a User's Organizations by Id
methodgetWalletDetails (id: string): Promise<Wallet>Get Organization's Wallet details
methodgetWalletNetworkDetails (id: string): Promise<NetworkDetails>Get a User's Organizations by Id
methodgetWalletTokenDetails (id: string): Promise<TokenDetails>Get a User's Organizations by Id
methodgetAllInvitedMembers (id: string): Promise<InvitedMembers[]>Get all the Invited Members
methodgetInvitedMembersById (id: string, invitedId: string): Promise<InvitedMembers \| string>Get Invited Members by Id
methodoverdueStatus (id: string): Promise<Overdue>Get Overdue status of Organization
methodgetProjectOrg (id: string): Promise<Project>Returns the projects of organization. Supports pagination and filtering by project state.
methodgetProjectCount (id: string): Promise<number>Returns the number of projects of organization.
methodupdateOrganizationProfileParams (id: string, name: string, username: string, image: string): Promise<boolean>boolean value if the data got updated or Not
methodupdateOrganizationProfile (id: string, obj: Profile): Promise<boolean>boolean value if the data got updated or Not
methoddeleteOrganization (id: string, userId: string): Promise<DeleteResponse>DeleteResponse

šŸ’« InviteClass class extends base class

  InviteClass class
InviteClassAPIDescription
methodgetInvitesById (id: string): Promise<Invite>Return the invitations sent for the organization.
methodinviteMembers (id: string, inviteEmail: string): Promise<InviteResponse>The information about the invite.
methoddeleteInvite (id: string, inviteId: string): Promise<Invite>The information about the deleted invite.

šŸ’« ProjectDetails class extends base class

  ProjectDetails class
ProjectDetailsAPIDescription
methodgetProjectDetailsById (id: string): Promise<Projects>Returns the information about the project.
methodgetProjectDeploymentEnvironments (id: string): Promise<DeploymentEnvironments[]>Returns the array of information about the Deployment Environment of the Project.
methodgetConfigurationDetailsById (id: string): Promise<Configuration>Project Configuration Information
methodgetAllDomainDetailsOfProject (id: string): Promise<Domains[]>Array of domain details of the project
methodgetDomainDetailsOfProjectByName (id: string, name: string): Promise<Domains>domain details of the project

šŸ’« DeploymentInfo class extends base class

  DeploymentInfo class
DeploymentInfoAPIDescription
methodgetDeploymentInfoByProjectId (id: string): Promise<LatestDeployment[]>Returns an array of deployments for the project. Supports pagination and filtering by deployment status
methodgetDeploymentInfoByProjectIdLimit (id: string, lim: number): Promise<LatestDeployment[]>Returns an array of deployments for the project with a limit. Supports pagination and filtering by deployment status
methodgetDeploymentInfoByProjectStatus (id: string, statusQuery: string): Promise<LatestDeployment[]>Returns an array of deployments for the project with filter. Supports pagination and filtering by deployment status
methodgetDeploymentCount (id: string): Promise<ProjectDeploymentCount>Information about the number of deployments.

šŸ’« State class extends base class

  State class
StateAPIDescription
methodupdateState (id: string, uState: string): Promise<StateResponse>Message about the changed state.

šŸ’« CouponsClass class extends base class

  CouponsClass class
CouponsClassAPIDescription
methodgetCouponDetails (id: string): Promise<Coupons>Get request coupon details

šŸ’« Domain class extends base class

  Domain class
DomainAPIDescription
methodgetDomain (id: string): Promise<DomainsGetResponse>Get the domains of the project.
methodgetDomainByDomainId (id: string, domainId: string): Promise<DomainsResponse>Get the domain of the project by Id.
methodaddDomainByProjectId (id: string, obj: DomainsRequest): Promise<DomainsResponse>Added domain.
methodupdateDomainByDomainId (id: string, domainId: string, obj: UpdateDomainsRequest): Promise<DomainsResponse>Updated domain.
methoddeleteDomainByDomainId (id: string, domainId: string): Promise<DomainDelete>Success of the deletion.
methodverifyDomainByProjectId (id: string, domainId: string): Promise<VerifyDomainType>Result of the operation.

šŸ’« AddEnvironment class extends base class

  AddEnvironment class
AddEnvironmentAPIDescription
methodaddEnvironmentVariables (id: string, Name: string, Value: string, DeploymentEnvironment: string[]): Promise<PostEnvironmentResponse>Added environment variables.
methodupdateEnvironmentVariable (id: string, envId: string, Name: string, Value: string, DeploymentEnvironment: string[]): Promise<PutEnvironmentResponse>Updated environment variable.
methoddeleteEnvironmentVariable (id: string, envId: string): Promise<ResponseDelete>Result of the delete operation.

šŸ’« DeploymentEnvironment class extends base class

  DeploymentEnvironment class
DeploymentEnvironmentAPIDescription
methodgetDeploymentEnvironment (id: string): Promise<DeploymentEnvGet>List of deployment environments.
methodaddDeploymentEnvironment (id: string, Name: string, Branches: string[], Protocol: string): Promise<addDeploymentEnvResponse>Added deployment environment
methodupdateDeploymentEnvironmnet (id: string, envVarId: string, Name: string, Branches: string[], Protocol: string): Promise<updateDeploymentEnvResponse>Updated deployment environment
methoddeleteDeploymentEnvironmnet (id: string, envVarId: string): Promise<ResponseDelete>>Deleted deployment environment
methodactivateDeploymentEnvironment (id: string, envVarId: string): Promise<updateDeploymentEnvResponse>activated deployment environment
methoddeactivateDeploymentEnvironment (id: string, envVarId: string): Promise<updateDeploymentEnvResponse>Deactivated deployment environment

šŸ’« Deployment class extends base class

   Deployment class
DeploymentAPIDescription
methoddeploy (input: DeploymentRequest): Promise<DeploymentIdResponse>Information about the deployment
methodgetDeployment (id: string): Promise<DeploymentIdResponse>Information about the deployment
methodauthorizeDeployment (id: string): Promise<Authorize>Information about the deployment
methodcancelDeployment (id: string): Promise<CancelDeployment>Information about the cancelation of deployment.
methodredeployDeployment (id: string): Promise<Redeploy>Information about the redeployment.
methoddefaultDeployment (orgId: string, gitUrl: string, repoName: string, uniqueTopicId: string, protocol: string, provider: string, branch: string): Promise<DeploymentResponse>Information about the start of deployment.

šŸ“¹ Video Tutorial šŸ¤©

Video