MADANA-IO / madana-apiclient-go

Go JSON client-side library that defines the Go classes that can be (de)serialized to/from JSON. This is useful for accessing the REST endpoints that are published by the madana-api, but only those that produce a JSON representation of their resources (content type "application/json").

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go API client for madanaapiclient

Using the madana-api

This documentation contains a Quickstart Guide, relating client functionality and information about the available endpoints and used datamodels.

The madana-api and its implementations are still in heavy development. This means that there may be problems in our protocols, or there may be mistakes in our implementations. We take security vulnerabilities very seriously. If you discover a security issue, please bring it to our attention right away! If you find a vulnerability that may affect live deployments -- for example, by exposing a remote execution exploit -- please send your report privately to info@madana.io. Please DO NOT file a public issue. If the issue is a protocol weakness that cannot be immediately exploited or something not yet deployed, just discuss it openly


Note: Not all functionality might be acessible without having accquired and api-license token. For more information visit www.madana.io


Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 0.5.0-master.56
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import sw "./madanaapiclient"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identifield by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://api.madana.io/rest

Class Method HTTP request Description
AccountServiceApi ActivateUser Get /account/activation/{token}
AccountServiceApi CreatePasswordReset Post /account/password Sends an Password reset mail to the given MailAddress.
AccountServiceApi RequestVerificationMail Get /account/verifymail Used to request a new activation-mail for the user.
AccountServiceApi UpdatePassword Put /account/password Receives the Password reset and tries to set the provided password for the user.
AuthenticationServiceApi AuthenticateApplication Post /authentication/application Authenticates a new application and returns the token.
AuthenticationServiceApi AuthenticateEthereumWallet Post /authentication/ethereum/{wallet}
AuthenticationServiceApi AuthenticateUser Post /authentication Authenticates a new user and returns the token ( forbidden if the credentials cannot be validated ).
AuthenticationServiceApi AuthenticateWithEthereumChallenge Post /authentication/ethereum/{wallet}/challenge
AuthenticationServiceApi GetFractalAuthenticationURL Get /authentication/fractal Returns the AUthorization URL to verify a Twitter Accounts.
AuthenticationServiceApi GetNonceForEthereumWallet Get /authentication/ethereum/{wallet} Returns a nonce for the client which is used as content for the to be created signature.
AuthenticationServiceApi GetObject Get /authentication Used to validate the active connection with the API.
AuthenticationServiceApi GetTwitterAuthenticationURL Get /authentication/twitter Returns the AUthorization URL to verify a Twitter Accounts.
AuthenticationServiceApi SetFacebookUID Post /authentication/facebook Used as Callback URL when users have successfully authorized their facbeook account.
AuthenticationServiceApi SetFractalUID Post /authentication/fractal
AuthenticationServiceApi SetTwitterUID Post /authentication/twitter
CertificateServiceApi AuthenticateCertificate Post /certificates Issues certificates for logged-in users.
CertificateServiceApi GetCertificateByFingerprint Get /certificates/{fingerprint}
CertificateServiceApi GetRootCertificate Get /certificates/root
DataCollectionServiceApi GetMethodsForType Get /datacollection/types/{name}/methods
DataCollectionServiceApi GetNodes Get /datacollection/methods
DataCollectionServiceApi GetTypes Get /datacollection/types
EnclaveServiceApi AddHistory Post /enclaves/{uuid}/history
EnclaveServiceApi ApproveEnclave Post /enclaves/{uuid}/approval
EnclaveServiceApi AssignEnclaveAgent Post /enclaves/{uuid}/assign
EnclaveServiceApi AttestateEnclave Post /enclaves/{uuid}/attestation
EnclaveServiceApi CreateEnclaveRunRequest Post /enclaves
EnclaveServiceApi GetEnclave Get /enclaves/{uuid}
EnclaveServiceApi GetEnclaveTypes Get /enclaves/types
EnclaveServiceApi GetEnclaves Get /enclaves Returns UUIDs of existing analyses.
EnclaveServiceApi GetStats Get /enclaves/stats
EnclaveServiceApi KillEnclave Post /enclaves/{uuid}/kill
EnvironmentServiceApi DeleteEnvironment Delete /environments/{uuid}
EnvironmentServiceApi DeleteEnvironmentSubscription Delete /environments/{uuid}/subscribe
EnvironmentServiceApi GetEnvironment Get /environments/{uuid}
EnvironmentServiceApi GetEnvironments Get /environments Returns UUIDs of existing analyses.
EnvironmentServiceApi GetPublishedEnvironments Get /environments/published
EnvironmentServiceApi GetSubscribedEnvironments Get /environments/subscriptions
EnvironmentServiceApi PublishEnvironment Post /environments
EnvironmentServiceApi SubscribeEnvironment Post /environments/{uuid}/subscribe
EnvironmentServiceApi UpdateEnvironment Put /environments/{uuid}
InvoiceServiceApi GetBillingPortalURL Get /invoices/portal
InvoiceServiceApi GetInvoices Get /invoices
NodeServiceApi CreateNode Post /nodes/v2
NodeServiceApi GetBootstrap Get /nodes/bootstrap
NodeServiceApi GetNodeLicenses Get /nodes/licenses
NodeServiceApi GetNodeV2 Get /nodes/v2/{ident}
NodeServiceApi GetNodes2 Get /nodes
NodeServiceApi GetNodesV2 Get /nodes/v2 Returns UUIDs of existing analyses.
NodeServiceApi KillNode Post /nodes/v2/{ident}/kill
NodeServiceApi PostNodeInfo Post /nodes
NodeServiceApi PostNodeInfo_0 Post /nodes/create
OrganizationServiceApi GetNodes3 Get /organizations
RequestServiceApi AddData Post /requests/{uuid}/data Is used to upload and park the data till the AnalysisRequest gets processed.
RequestServiceApi CancelProcessing Post /requests/{uuid}/cancel Endpoint is called from the Analysis Processing entity to submit the result.
RequestServiceApi CreateNewRequest Post /requests Endpoint used to create a new Analysis Request.
RequestServiceApi GetActions Get /requests/actions
RequestServiceApi GetAgent Get /requests/{uuid}/agent Is called from the APE to request all parked datasets.
RequestServiceApi GetAllRequests Get /requests Returns UUIDs of existing analyses.
RequestServiceApi GetData Get /requests/{uuid}/data Is called from the APE to request all parked datasets.
RequestServiceApi GetRequest Get /requests/{uuid} Returns the details for certain Request.
RequestServiceApi GetResult Get /requests/{uuid}/result Can be called from creator to request the AnalysisResult.
RequestServiceApi GetStatus Get /requests/stats
RequestServiceApi GiveConsent Post /requests/{uuid}/consent Used to give consent for request.
RequestServiceApi InitRequestParameters Post /requests/{uuid} Endpoint used initialized addition datacollection parameters for requester.
RequestServiceApi SetAgent Post /requests/{uuid}/agent Is called from the APE to request all parked datasets.
RequestServiceApi SetResult Post /requests/{uuid}/result Endpoint is called from the Analysis Processing entity to submit the result.
SocialPlatformServiceApi GetPlatforms Get /platforms Used to Handle Incoming Webhooks from Facebook.
SocialPlatformServiceApi ListenTwitterWebhook Post /platforms/twitter Used to Handle Incoming Webhooks from Facebook.
SocialPlatformServiceApi RegisterTwitterWebhook Get /platforms/twitter Used to Handle Incoming Webhooks from Twitter.
SocialServiceApi GetMyProfile Get /social/profiles/me
SocialServiceApi GetPlatforms2 Get /social Returns all Platforms / Systems that can be Connected to the MADANA Service.
SocialServiceApi GetRanking Get /social/ranking Returns the Ranking by PTS within the System.
SocialServiceApi GetSocialPlatformFeed Get /social/feed/{platform}
SocialServiceApi GetUserProfile Get /social/profiles/{username}
SocialServiceApi GetUserProfile_0 Get /social/profiles/{username}/simple
SubscriptionServiceApi AddFreeSubscription Post /subscriptions/saas/free
SubscriptionServiceApi AddPassTrialSubscription Post /subscriptions/paas/trial
SubscriptionServiceApi GetApplication Get /subscriptions/active
SubscriptionServiceApi GetCheckoutSession Get /subscriptions/{productname}/checkout
SubscriptionServiceApi GetCheckoutSession2 Post /subscriptions/{productname}/{newplan}
SystemServiceApi GetAllObjects Get /system/health
SystemServiceApi GetApplication2 Get /system/usage Return the current application usage.
UserServiceApi CancelSubscription Post /users/{username}/subscriptions/{planname}/cancel
UserServiceApi CreateObject Post /users Creates a new user object.
UserServiceApi DeleteObject Delete /users/{username} Deletes an User based on the provided id and securitycontext.
UserServiceApi DeleteObject_0 Delete /users/{username}/social/{platform}/{ident} Deletes linked account from the user and securitycontext.
UserServiceApi GetAvatars Get /users/{username}/avatars
UserServiceApi GetCertificates Get /users/{username}/certificates
UserServiceApi GetEnclaveHistory Get /users/{username}/enclavehistory
UserServiceApi GetObject2 Get /users/{username}
UserServiceApi SetAvatar Post /users/{username}/avatars
UserServiceApi SetSettings Post /users/{username}/settings
UserServiceApi UpdateObject Put /users/{username} Updates Userproperties based on the provided user object.

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

About

Go JSON client-side library that defines the Go classes that can be (de)serialized to/from JSON. This is useful for accessing the REST endpoints that are published by the madana-api, but only those that produce a JSON representation of their resources (content type "application/json").


Languages

Language:Go 100.0%