Skip to content
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(api): modularise APIs into groups #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/generated/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
apis/SnipttApi.ts
apis/AccountsApi.ts
apis/OneTimeSecretsApi.ts
apis/SecretsApi.ts
apis/VaultsApi.ts
apis/index.ts
index.ts
models/AddMemberToVaultRequest.ts
models/AddSecretRequest.ts
models/AddSecretResponse.ts
models/ConfigureAccountRequest.ts
models/ConfigureAccountResponse.ts
models/ContentType.ts
models/CreateOneTimeSecretRequest.ts
models/CreateOneTimeSecretResponse.ts
models/CreateVaultRequest.ts
Expand All @@ -28,6 +32,7 @@ models/RetrieveSecretRequest.ts
models/RetrieveSecretResponse.ts
models/RetrieveVaultKeysRequest.ts
models/RetrieveVaultKeysResponse.ts
models/Role.ts
models/SearchVaultMembershipsRequest.ts
models/SearchVaultMembershipsResponse.ts
models/SendEmailVerificationCodeRequest.ts
Expand Down
278 changes: 278 additions & 0 deletions src/generated/apis/AccountsApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
/* tslint:disable */
/* eslint-disable */
/**
* API Reference
* # Introduction The Sniptt API is organized around [REST](https://en.wikipedia.org/wiki/Representational_State_Transfer). Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns [JSON-encoded](http://www.json.org/) responses, and uses standard HTTP response codes, authentication, and verbs. # Authentication The Sniptt API uses API keys to authenticate requests. Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth. Use your API key by setting it in the initial configuration of sniptt. The Sniptt SDK will then automatically send this key in each request. You can also set a per-request key by passing `x-api-key` in the header of the request or as an additional parameter in SDK methods. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
*
* The version of the OpenAPI document: 0.0.5
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


import * as runtime from '../runtime';
import {
ConfigureAccountRequest,
ConfigureAccountRequestFromJSON,
ConfigureAccountRequestToJSON,
ConfigureAccountResponse,
ConfigureAccountResponseFromJSON,
ConfigureAccountResponseToJSON,
RegisterDeviceRequest,
RegisterDeviceRequestFromJSON,
RegisterDeviceRequestToJSON,
RegisterDeviceResponse,
RegisterDeviceResponseFromJSON,
RegisterDeviceResponseToJSON,
RetrieveAccountConfigurationResponse,
RetrieveAccountConfigurationResponseFromJSON,
RetrieveAccountConfigurationResponseToJSON,
RetrieveAccountPublicKeyRequest,
RetrieveAccountPublicKeyRequestFromJSON,
RetrieveAccountPublicKeyRequestToJSON,
RetrieveAccountPublicKeyResponse,
RetrieveAccountPublicKeyResponseFromJSON,
RetrieveAccountPublicKeyResponseToJSON,
SendEmailVerificationCodeRequest,
SendEmailVerificationCodeRequestFromJSON,
SendEmailVerificationCodeRequestToJSON,
} from '../models';

export interface ConfigureAccountOperationRequest {
configureAccountRequest: ConfigureAccountRequest;
xApiKey?: string;
}

export interface RegisterDeviceOperationRequest {
registerDeviceRequest: RegisterDeviceRequest;
}

export interface RetrieveAccountConfigurationRequest {
body: object;
xApiKey?: string;
}

export interface RetrieveAccountPublicKeyOperationRequest {
retrieveAccountPublicKeyRequest: RetrieveAccountPublicKeyRequest;
xApiKey?: string;
}

export interface SendEmailVerificationCodeOperationRequest {
sendEmailVerificationCodeRequest: SendEmailVerificationCodeRequest;
}

/**
*
*/
export class AccountsApi extends runtime.BaseAPI {

/**
* Configures Sniptt account
* Configure account
*/
async configureAccountRaw(requestParameters: ConfigureAccountOperationRequest): Promise<runtime.ApiResponse<ConfigureAccountResponse>> {
if (requestParameters.configureAccountRequest === null || requestParameters.configureAccountRequest === undefined) {
throw new runtime.RequiredError('configureAccountRequest','Required parameter requestParameters.configureAccountRequest was null or undefined when calling configureAccount.');
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (requestParameters.xApiKey !== undefined && requestParameters.xApiKey !== null) {
headerParameters['x-api-key'] = String(requestParameters.xApiKey);
}

if (this.configuration && this.configuration.apiKey) {
headerParameters["X-API-KEY"] = this.configuration.apiKey("X-API-KEY"); // ApiKeyAuth authentication
}

const response = await this.request({
path: `/configureAccount`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ConfigureAccountRequestToJSON(requestParameters.configureAccountRequest),
});

return new runtime.JSONApiResponse(response, (jsonValue) => ConfigureAccountResponseFromJSON(jsonValue));
}

/**
* Configures Sniptt account
* Configure account
*/
async configureAccount(configureAccountRequest: ConfigureAccountRequest, xApiKey?: string): Promise<ConfigureAccountResponse> {
const response = await this.configureAccountRaw({ configureAccountRequest: configureAccountRequest, xApiKey: xApiKey });
return await response.value();
}

/**
* Register user device
* Register device
*/
async registerDeviceRaw(requestParameters: RegisterDeviceOperationRequest): Promise<runtime.ApiResponse<RegisterDeviceResponse>> {
if (requestParameters.registerDeviceRequest === null || requestParameters.registerDeviceRequest === undefined) {
throw new runtime.RequiredError('registerDeviceRequest','Required parameter requestParameters.registerDeviceRequest was null or undefined when calling registerDevice.');
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.apiKey) {
headerParameters["X-API-KEY"] = this.configuration.apiKey("X-API-KEY"); // ApiKeyAuth authentication
}

const response = await this.request({
path: `/registerDevice`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: RegisterDeviceRequestToJSON(requestParameters.registerDeviceRequest),
});

return new runtime.JSONApiResponse(response, (jsonValue) => RegisterDeviceResponseFromJSON(jsonValue));
}

/**
* Register user device
* Register device
*/
async registerDevice(registerDeviceRequest: RegisterDeviceRequest): Promise<RegisterDeviceResponse> {
const response = await this.registerDeviceRaw({ registerDeviceRequest: registerDeviceRequest });
return await response.value();
}

/**
* Retrieve account configuration
* Retrieve account configuration
*/
async retrieveAccountConfigurationRaw(requestParameters: RetrieveAccountConfigurationRequest): Promise<runtime.ApiResponse<RetrieveAccountConfigurationResponse>> {
if (requestParameters.body === null || requestParameters.body === undefined) {
throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling retrieveAccountConfiguration.');
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (requestParameters.xApiKey !== undefined && requestParameters.xApiKey !== null) {
headerParameters['x-api-key'] = String(requestParameters.xApiKey);
}

if (this.configuration && this.configuration.apiKey) {
headerParameters["X-API-KEY"] = this.configuration.apiKey("X-API-KEY"); // ApiKeyAuth authentication
}

const response = await this.request({
path: `/retrieveAccountConfiguration`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: requestParameters.body as any,
});

return new runtime.JSONApiResponse(response, (jsonValue) => RetrieveAccountConfigurationResponseFromJSON(jsonValue));
}

/**
* Retrieve account configuration
* Retrieve account configuration
*/
async retrieveAccountConfiguration(body: object, xApiKey?: string): Promise<RetrieveAccountConfigurationResponse> {
const response = await this.retrieveAccountConfigurationRaw({ body: body, xApiKey: xApiKey });
return await response.value();
}

/**
* Retrieve account public key
* Retrieve account public key
*/
async retrieveAccountPublicKeyRaw(requestParameters: RetrieveAccountPublicKeyOperationRequest): Promise<runtime.ApiResponse<RetrieveAccountPublicKeyResponse>> {
if (requestParameters.retrieveAccountPublicKeyRequest === null || requestParameters.retrieveAccountPublicKeyRequest === undefined) {
throw new runtime.RequiredError('retrieveAccountPublicKeyRequest','Required parameter requestParameters.retrieveAccountPublicKeyRequest was null or undefined when calling retrieveAccountPublicKey.');
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (requestParameters.xApiKey !== undefined && requestParameters.xApiKey !== null) {
headerParameters['x-api-key'] = String(requestParameters.xApiKey);
}

if (this.configuration && this.configuration.apiKey) {
headerParameters["X-API-KEY"] = this.configuration.apiKey("X-API-KEY"); // ApiKeyAuth authentication
}

const response = await this.request({
path: `/retrieveAccountPublicKey`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: RetrieveAccountPublicKeyRequestToJSON(requestParameters.retrieveAccountPublicKeyRequest),
});

return new runtime.JSONApiResponse(response, (jsonValue) => RetrieveAccountPublicKeyResponseFromJSON(jsonValue));
}

/**
* Retrieve account public key
* Retrieve account public key
*/
async retrieveAccountPublicKey(retrieveAccountPublicKeyRequest: RetrieveAccountPublicKeyRequest, xApiKey?: string): Promise<RetrieveAccountPublicKeyResponse> {
const response = await this.retrieveAccountPublicKeyRaw({ retrieveAccountPublicKeyRequest: retrieveAccountPublicKeyRequest, xApiKey: xApiKey });
return await response.value();
}

/**
* Send email verification code
* Send email verification code
*/
async sendEmailVerificationCodeRaw(requestParameters: SendEmailVerificationCodeOperationRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.sendEmailVerificationCodeRequest === null || requestParameters.sendEmailVerificationCodeRequest === undefined) {
throw new runtime.RequiredError('sendEmailVerificationCodeRequest','Required parameter requestParameters.sendEmailVerificationCodeRequest was null or undefined when calling sendEmailVerificationCode.');
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.apiKey) {
headerParameters["X-API-KEY"] = this.configuration.apiKey("X-API-KEY"); // ApiKeyAuth authentication
}

const response = await this.request({
path: `/sendEmailVerificationCode`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: SendEmailVerificationCodeRequestToJSON(requestParameters.sendEmailVerificationCodeRequest),
});

return new runtime.VoidApiResponse(response);
}

/**
* Send email verification code
* Send email verification code
*/
async sendEmailVerificationCode(sendEmailVerificationCodeRequest: SendEmailVerificationCodeRequest): Promise<void> {
await this.sendEmailVerificationCodeRaw({ sendEmailVerificationCodeRequest: sendEmailVerificationCodeRequest });
}

}
Loading