Client Queries
Queries for retrieving client information and their associated brands.
client
Retrieves a single client by ID.
Arguments
type ClientArgs {
"""
ID of the client to retrieve.
"""
id: Int!
}
Response
type Client {
"""
Unique identifier for the client.
"""
id: Int!
"""
Name of the client.
"""
name: String!
"""
Optional logo URL.
"""
logo: String
"""
List of brands associated with this client.
"""
brands: [Brand!]!
}
Example Query
query GetClient {
client(id: 123) {
id
name
logo
brands {
id
name
}
}
}
clients
Retrieves all clients the authenticated user has access to.
Response
Returns an array of Client objects.
Example Query
query GetClients {
clients {
id
name
logo
brands {
id
name
}
}
}
Error Handling
Common Errors
| Error Code | Description |
|---|---|
CLIENT_NOT_FOUND | Client ID not found |
PERMISSION_DENIED | Not authorized to view client |
Example Error Response
{
"errors": [
{
"message": "Client not found",
"extensions": {
"code": "CLIENT_NOT_FOUND",
"clientId": "123"
}
}
]
}
Best Practices
-
Authentication
- Always include valid JWT with client_list claim
- Handle token expiration gracefully
-
Performance
- Request only needed fields
- Consider caching strategies
-
Security
- Validate client access
- Implement rate limiting
- Audit sensitive queries
-
Error Handling
- Handle all error cases gracefully
- Provide meaningful error messages to users