CreateClient
Method Details​
Description: CreateClient creates a single client.
Required Roles: Check proto file for roles
Parameters:
Client
(message) (required): Client is the client resource to create.
Returns: Client
Method Type: METHOD_TYPE_WRITE
Code Examples​
- Go
- Python
- Java
- Protobuf
package main
import (
"context"
"log"
clientv1 "github.com/meshtrade/api/go/compliance/client/v1"
)
func main() {
ctx := context.Background()
// Default configuration is used and credentials come from MESH_API_CREDENTIALS
// environment variable or default discovery methods. Zero config required
// unless you want custom configuration.
service, err := clientv1.NewClientService()
if err != nil {
log.Fatalf("Failed to create service: %v", err)
}
defer service.Close()
// Create request with service-specific parameters
request := &clientv1.CreateClientRequest{
// FIXME: Populate service-specific request fields
}
// Call the CreateClient method
client, err := service.CreateClient(ctx, request)
if err != nil {
log.Fatalf("CreateClient failed: %v", err)
}
// FIXME: Add relevant response object usage
log.Printf("CreateClient successful: %+v", client)
}
from meshtrade.compliance.client.v1 import (
ClientService,
CreateClientRequest,
)
def main():
# Default configuration is used and credentials come from MESH_API_CREDENTIALS
# environment variable or default discovery methods. Zero config required
# unless you want custom configuration.
service = ClientService()
with service:
# Create request with service-specific parameters
request = CreateClientRequest(
# FIXME: Populate service-specific request fields
)
# Call the CreateClient method
client = service.create_client(request)
# FIXME: Add relevant response object usage
print("CreateClient successful:", client)
if __name__ == "__main__":
main()
import co.meshtrade.api.compliance.client.v1.ClientService;
import co.meshtrade.api.compliance.client.v1.Service.CreateClientRequest;
import co.meshtrade.api.compliance.client.v1.Client.Client;
import java.util.Optional;
public class CreateClientExample {
public static void main(String[] args) {
// Default configuration is used and credentials come from MESH_API_CREDENTIALS
// environment variable or default discovery methods. Zero config required
// unless you want custom configuration.
try (ClientService service = new ClientService()) {
// Create request with service-specific parameters
CreateClientRequest request = CreateClientRequest.newBuilder()
// FIXME: Populate service-specific request fields
.build();
// Call the CreateClient method
Client client = service.createClient(request, Optional.empty());
// FIXME: Add relevant response object usage
System.out.println("CreateClient successful: " + client);
} catch (Exception e) {
System.err.println("CreateClient failed: " + e.getMessage());
e.printStackTrace();
}
}
}
syntax = "proto3";
package meshtrade.compliance.client.v1;
import "meshtrade/compliance/client/v1/client.proto";
import "meshtrade/iam/role/v1/role.proto";
import "meshtrade/option/v1/method_type.proto";
option go_package = "github.com/meshtrade/api/go/compliance/client/v1;clientv1";
option java_package = "co.meshtrade.api.compliance.client.v1";
// Service manages client profiles for compliance and Know Your Customer (KYC)
// purposes.
//
// The main entity managed by this service is the `Client` resource. A client can
// be a natural person, company, or trust. This service allows you to retrieve
// the compliance profiles for these clients.
service ClientService {
// CreateClient creates a single client.
rpc CreateClient(CreateClientRequest) returns (meshtrade.compliance.client.v1.Client) {
option (meshtrade.option.v1.method_type) = METHOD_TYPE_WRITE;
option (meshtrade.iam.role.v1.roles) = {
roles: [ROLE_COMPLIANCE_ADMIN]
};
}
// GetClient retrieves a single client's compliance profile by its unique resource name.
//
// This allows for fetching the complete compliance details of a specific client,
// including all associated information like identification documents, tax residencies,
// and company structures.
rpc GetClient(GetClientRequest) returns (meshtrade.compliance.client.v1.Client) {
option (meshtrade.option.v1.method_type) = METHOD_TYPE_READ;
option (meshtrade.iam.role.v1.roles) = {
roles: [
ROLE_COMPLIANCE_ADMIN,
ROLE_COMPLIANCE_VIEWER
]
};
}
// ListClients retrieves a collection of client compliance profiles.
//
// This method is useful for fetching multiple client records at once.
// Note: This endpoint does not currently support pagination or filtering.
rpc ListClients(ListClientsRequest) returns (ListClientsResponse) {
option (meshtrade.option.v1.method_type) = METHOD_TYPE_READ;
option (meshtrade.iam.role.v1.roles) = {
roles: [
ROLE_COMPLIANCE_ADMIN,
ROLE_COMPLIANCE_VIEWER
]
};
}
}
// CreateClientRequest is the message used to create a single client resource.
message GetClientRequest {
// The unique resource name of the client to be retrieved.
// The name serves as the primary identifier for the client resource.
// Format: "clients/{client_id}"
string name = 1;
}
// GetClientRequest is the message used to request a single client resource.
message CreateClientRequest {
// Client is the client resource to create.
meshtrade.compliance.client.v1.Client client = 1;
}
// ListClientsRequest is the message used to request a list of client resources.
message ListClientsRequest {}
// ListClientsResponse contains a list of client resources.
message ListClientsResponse {
// A repeated field containing the client resource objects.
repeated meshtrade.compliance.client.v1.Client clients = 1;
}
Advanced Configuration​
For advanced client configuration options (custom endpoints, TLS settings, timeouts), see the SDK Configuration Guide.
Other Methods​
- Compliance Client v1 Method List - For Other methods